pdf.worker.js 1.9 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2023 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. })(globalThis, () => {
  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__(3);
  44. var _core_utils = __w_pdfjs_require__(4);
  45. var _pdf_manager = __w_pdfjs_require__(6);
  46. var _cleanup_helper = __w_pdfjs_require__(69);
  47. var _writer = __w_pdfjs_require__(63);
  48. var _is_node = __w_pdfjs_require__(100);
  49. var _message_handler = __w_pdfjs_require__(101);
  50. var _worker_stream = __w_pdfjs_require__(102);
  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 (data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function (data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function (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 {
  97. docId,
  98. apiVersion
  99. } = docParams;
  100. const workerVersion = '3.3.122';
  101. if (apiVersion !== workerVersion) {
  102. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  103. }
  104. const enumerableProperties = [];
  105. for (const property in []) {
  106. enumerableProperties.push(property);
  107. }
  108. if (enumerableProperties.length) {
  109. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  110. }
  111. if (typeof ReadableStream === "undefined") {
  112. const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  113. if (_is_node.isNodeJS) {
  114. throw new Error(partialMsg + "please use a `legacy`-build instead.");
  115. }
  116. throw new Error(partialMsg + "please update to a supported browser.");
  117. }
  118. const workerHandlerName = docId + "_worker";
  119. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  120. function ensureNotTerminated() {
  121. if (terminated) {
  122. throw new Error("Worker was terminated");
  123. }
  124. }
  125. function startWorkerTask(task) {
  126. WorkerTasks.push(task);
  127. }
  128. function finishWorkerTask(task) {
  129. task.finish();
  130. const i = WorkerTasks.indexOf(task);
  131. WorkerTasks.splice(i, 1);
  132. }
  133. async function loadDocument(recoveryMode) {
  134. await pdfManager.ensureDoc("checkHeader");
  135. await pdfManager.ensureDoc("parseStartXRef");
  136. await pdfManager.ensureDoc("parse", [recoveryMode]);
  137. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  138. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  139. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  140. if (isPureXfa) {
  141. const task = new WorkerTask("loadXfaFonts");
  142. startWorkerTask(task);
  143. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  144. }
  145. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  146. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  147. return {
  148. numPages,
  149. fingerprints,
  150. htmlForXfa
  151. };
  152. }
  153. function getPdfManager({
  154. data,
  155. password,
  156. disableAutoFetch,
  157. rangeChunkSize,
  158. length,
  159. docBaseUrl,
  160. enableXfa,
  161. evaluatorOptions
  162. }) {
  163. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  164. let newPdfManager;
  165. if (data) {
  166. try {
  167. newPdfManager = new _pdf_manager.LocalPdfManager(docId, data, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  168. pdfManagerCapability.resolve(newPdfManager);
  169. } catch (ex) {
  170. pdfManagerCapability.reject(ex);
  171. }
  172. return pdfManagerCapability.promise;
  173. }
  174. let pdfStream,
  175. cachedChunks = [];
  176. try {
  177. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  178. } catch (ex) {
  179. pdfManagerCapability.reject(ex);
  180. return pdfManagerCapability.promise;
  181. }
  182. const fullRequest = pdfStream.getFullReader();
  183. fullRequest.headersReady.then(function () {
  184. if (!fullRequest.isRangeSupported) {
  185. return;
  186. }
  187. disableAutoFetch = disableAutoFetch || fullRequest.isStreamingSupported;
  188. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  189. msgHandler: handler,
  190. password,
  191. length: fullRequest.contentLength,
  192. disableAutoFetch,
  193. rangeChunkSize
  194. }, evaluatorOptions, enableXfa, docBaseUrl);
  195. for (const chunk of cachedChunks) {
  196. newPdfManager.sendProgressiveData(chunk);
  197. }
  198. cachedChunks = [];
  199. pdfManagerCapability.resolve(newPdfManager);
  200. cancelXHRs = null;
  201. }).catch(function (reason) {
  202. pdfManagerCapability.reject(reason);
  203. cancelXHRs = null;
  204. });
  205. let loaded = 0;
  206. const flushChunks = function () {
  207. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  208. if (length && pdfFile.length !== length) {
  209. (0, _util.warn)("reported HTTP length is different from actual");
  210. }
  211. try {
  212. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  213. pdfManagerCapability.resolve(newPdfManager);
  214. } catch (ex) {
  215. pdfManagerCapability.reject(ex);
  216. }
  217. cachedChunks = [];
  218. };
  219. new Promise(function (resolve, reject) {
  220. const readChunk = function ({
  221. value,
  222. done
  223. }) {
  224. try {
  225. ensureNotTerminated();
  226. if (done) {
  227. if (!newPdfManager) {
  228. flushChunks();
  229. }
  230. cancelXHRs = null;
  231. return;
  232. }
  233. loaded += (0, _util.arrayByteLength)(value);
  234. if (!fullRequest.isStreamingSupported) {
  235. handler.send("DocProgress", {
  236. loaded,
  237. total: Math.max(loaded, fullRequest.contentLength || 0)
  238. });
  239. }
  240. if (newPdfManager) {
  241. newPdfManager.sendProgressiveData(value);
  242. } else {
  243. cachedChunks.push(value);
  244. }
  245. fullRequest.read().then(readChunk, reject);
  246. } catch (e) {
  247. reject(e);
  248. }
  249. };
  250. fullRequest.read().then(readChunk, reject);
  251. }).catch(function (e) {
  252. pdfManagerCapability.reject(e);
  253. cancelXHRs = null;
  254. });
  255. cancelXHRs = function (reason) {
  256. pdfStream.cancelAllRequests(reason);
  257. };
  258. return pdfManagerCapability.promise;
  259. }
  260. function setupDoc(data) {
  261. function onSuccess(doc) {
  262. ensureNotTerminated();
  263. handler.send("GetDoc", {
  264. pdfInfo: doc
  265. });
  266. }
  267. function onFailure(ex) {
  268. ensureNotTerminated();
  269. if (ex instanceof _util.PasswordException) {
  270. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  271. startWorkerTask(task);
  272. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  273. password
  274. }) {
  275. finishWorkerTask(task);
  276. pdfManager.updatePassword(password);
  277. pdfManagerReady();
  278. }).catch(function () {
  279. finishWorkerTask(task);
  280. handler.send("DocException", ex);
  281. });
  282. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  283. handler.send("DocException", ex);
  284. } else {
  285. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  286. }
  287. }
  288. function pdfManagerReady() {
  289. ensureNotTerminated();
  290. loadDocument(false).then(onSuccess, function (reason) {
  291. ensureNotTerminated();
  292. if (!(reason instanceof _core_utils.XRefParseException)) {
  293. onFailure(reason);
  294. return;
  295. }
  296. pdfManager.requestLoadedStream().then(function () {
  297. ensureNotTerminated();
  298. loadDocument(true).then(onSuccess, onFailure);
  299. });
  300. });
  301. }
  302. ensureNotTerminated();
  303. getPdfManager(data).then(function (newPdfManager) {
  304. if (terminated) {
  305. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  306. throw new Error("Worker was terminated");
  307. }
  308. pdfManager = newPdfManager;
  309. pdfManager.requestLoadedStream(true).then(stream => {
  310. handler.send("DataLoaded", {
  311. length: stream.bytes.byteLength
  312. });
  313. });
  314. }).then(pdfManagerReady, onFailure);
  315. }
  316. handler.on("GetPage", function (data) {
  317. return pdfManager.getPage(data.pageIndex).then(function (page) {
  318. 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]) {
  319. return {
  320. rotate,
  321. ref,
  322. userUnit,
  323. view
  324. };
  325. });
  326. });
  327. });
  328. handler.on("GetPageIndex", function (data) {
  329. const pageRef = _primitives.Ref.get(data.num, data.gen);
  330. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  331. });
  332. handler.on("GetDestinations", function (data) {
  333. return pdfManager.ensureCatalog("destinations");
  334. });
  335. handler.on("GetDestination", function (data) {
  336. return pdfManager.ensureCatalog("getDestination", [data.id]);
  337. });
  338. handler.on("GetPageLabels", function (data) {
  339. return pdfManager.ensureCatalog("pageLabels");
  340. });
  341. handler.on("GetPageLayout", function (data) {
  342. return pdfManager.ensureCatalog("pageLayout");
  343. });
  344. handler.on("GetPageMode", function (data) {
  345. return pdfManager.ensureCatalog("pageMode");
  346. });
  347. handler.on("GetViewerPreferences", function (data) {
  348. return pdfManager.ensureCatalog("viewerPreferences");
  349. });
  350. handler.on("GetOpenAction", function (data) {
  351. return pdfManager.ensureCatalog("openAction");
  352. });
  353. handler.on("GetAttachments", function (data) {
  354. return pdfManager.ensureCatalog("attachments");
  355. });
  356. handler.on("GetJavaScript", function (data) {
  357. return pdfManager.ensureCatalog("javaScript");
  358. });
  359. handler.on("GetDocJSActions", function (data) {
  360. return pdfManager.ensureCatalog("jsActions");
  361. });
  362. handler.on("GetPageJSActions", function ({
  363. pageIndex
  364. }) {
  365. return pdfManager.getPage(pageIndex).then(function (page) {
  366. return pdfManager.ensure(page, "jsActions");
  367. });
  368. });
  369. handler.on("GetOutline", function (data) {
  370. return pdfManager.ensureCatalog("documentOutline");
  371. });
  372. handler.on("GetOptionalContentConfig", function (data) {
  373. return pdfManager.ensureCatalog("optionalContentConfig");
  374. });
  375. handler.on("GetPermissions", function (data) {
  376. return pdfManager.ensureCatalog("permissions");
  377. });
  378. handler.on("GetMetadata", function (data) {
  379. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  380. });
  381. handler.on("GetMarkInfo", function (data) {
  382. return pdfManager.ensureCatalog("markInfo");
  383. });
  384. handler.on("GetData", function (data) {
  385. return pdfManager.requestLoadedStream().then(function (stream) {
  386. return stream.bytes;
  387. });
  388. });
  389. handler.on("GetAnnotations", function ({
  390. pageIndex,
  391. intent
  392. }) {
  393. return pdfManager.getPage(pageIndex).then(function (page) {
  394. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  395. startWorkerTask(task);
  396. return page.getAnnotationsData(handler, task, intent).then(data => {
  397. finishWorkerTask(task);
  398. return data;
  399. }, reason => {
  400. finishWorkerTask(task);
  401. });
  402. });
  403. });
  404. handler.on("GetFieldObjects", function (data) {
  405. return pdfManager.ensureDoc("fieldObjects");
  406. });
  407. handler.on("HasJSActions", function (data) {
  408. return pdfManager.ensureDoc("hasJSActions");
  409. });
  410. handler.on("GetCalculationOrderIds", function (data) {
  411. return pdfManager.ensureDoc("calculationOrderIds");
  412. });
  413. handler.on("SaveDocument", function ({
  414. isPureXfa,
  415. numPages,
  416. annotationStorage,
  417. filename
  418. }) {
  419. const promises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  420. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  421. if (newAnnotationsByPage) {
  422. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  423. promises.push(pdfManager.getPage(pageIndex).then(page => {
  424. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  425. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  426. finishWorkerTask(task);
  427. });
  428. }));
  429. }
  430. }
  431. if (isPureXfa) {
  432. promises.push(pdfManager.serializeXfaData(annotationStorage));
  433. } else {
  434. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  435. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  436. const task = new WorkerTask(`Save: page ${pageIndex}`);
  437. return page.save(handler, task, annotationStorage).finally(function () {
  438. finishWorkerTask(task);
  439. });
  440. }));
  441. }
  442. }
  443. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  444. let newRefs = [];
  445. let xfaData = null;
  446. if (isPureXfa) {
  447. xfaData = refs[0];
  448. if (!xfaData) {
  449. return stream.bytes;
  450. }
  451. } else {
  452. newRefs = refs.flat(2);
  453. if (newRefs.length === 0) {
  454. return stream.bytes;
  455. }
  456. }
  457. const needAppearances = acroFormRef && acroForm instanceof _primitives.Dict && newRefs.some(ref => ref.needAppearances);
  458. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  459. let xfaDatasetsRef = null;
  460. let hasXfaDatasetsEntry = false;
  461. if (Array.isArray(xfa)) {
  462. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  463. if (xfa[i] === "datasets") {
  464. xfaDatasetsRef = xfa[i + 1];
  465. hasXfaDatasetsEntry = true;
  466. }
  467. }
  468. if (xfaDatasetsRef === null) {
  469. xfaDatasetsRef = xref.getNewTemporaryRef();
  470. }
  471. } else if (xfa) {
  472. (0, _util.warn)("Unsupported XFA type.");
  473. }
  474. let newXrefInfo = Object.create(null);
  475. if (xref.trailer) {
  476. const infoObj = Object.create(null);
  477. const xrefInfo = xref.trailer.get("Info") || null;
  478. if (xrefInfo instanceof _primitives.Dict) {
  479. xrefInfo.forEach((key, value) => {
  480. if (typeof value === "string") {
  481. infoObj[key] = (0, _util.stringToPDFString)(value);
  482. }
  483. });
  484. }
  485. newXrefInfo = {
  486. rootRef: xref.trailer.getRaw("Root") || null,
  487. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  488. newRef: xref.getNewTemporaryRef(),
  489. infoRef: xref.trailer.getRaw("Info") || null,
  490. info: infoObj,
  491. fileIds: xref.trailer.get("ID") || null,
  492. startXRef,
  493. filename
  494. };
  495. }
  496. try {
  497. return (0, _writer.incrementalUpdate)({
  498. originalData: stream.bytes,
  499. xrefInfo: newXrefInfo,
  500. newRefs,
  501. xref,
  502. hasXfa: !!xfa,
  503. xfaDatasetsRef,
  504. hasXfaDatasetsEntry,
  505. needAppearances,
  506. acroFormRef,
  507. acroForm,
  508. xfaData
  509. });
  510. } finally {
  511. xref.resetNewTemporaryRef();
  512. }
  513. });
  514. });
  515. handler.on("GetOperatorList", function (data, sink) {
  516. const pageIndex = data.pageIndex;
  517. pdfManager.getPage(pageIndex).then(function (page) {
  518. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  519. startWorkerTask(task);
  520. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  521. page.getOperatorList({
  522. handler,
  523. sink,
  524. task,
  525. intent: data.intent,
  526. cacheKey: data.cacheKey,
  527. annotationStorage: data.annotationStorage
  528. }).then(function (operatorListInfo) {
  529. finishWorkerTask(task);
  530. if (start) {
  531. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  532. }
  533. sink.close();
  534. }, function (reason) {
  535. finishWorkerTask(task);
  536. if (task.terminated) {
  537. return;
  538. }
  539. sink.error(reason);
  540. });
  541. });
  542. });
  543. handler.on("GetTextContent", function (data, sink) {
  544. const pageIndex = data.pageIndex;
  545. pdfManager.getPage(pageIndex).then(function (page) {
  546. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  547. startWorkerTask(task);
  548. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  549. page.extractTextContent({
  550. handler,
  551. task,
  552. sink,
  553. includeMarkedContent: data.includeMarkedContent,
  554. combineTextItems: data.combineTextItems
  555. }).then(function () {
  556. finishWorkerTask(task);
  557. if (start) {
  558. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  559. }
  560. sink.close();
  561. }, function (reason) {
  562. finishWorkerTask(task);
  563. if (task.terminated) {
  564. return;
  565. }
  566. sink.error(reason);
  567. });
  568. });
  569. });
  570. handler.on("GetStructTree", function (data) {
  571. return pdfManager.getPage(data.pageIndex).then(function (page) {
  572. return pdfManager.ensure(page, "getStructTree");
  573. });
  574. });
  575. handler.on("FontFallback", function (data) {
  576. return pdfManager.fontFallback(data.id, handler);
  577. });
  578. handler.on("Cleanup", function (data) {
  579. return pdfManager.cleanup(true);
  580. });
  581. handler.on("Terminate", function (data) {
  582. terminated = true;
  583. const waitOn = [];
  584. if (pdfManager) {
  585. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  586. const cleanupPromise = pdfManager.cleanup();
  587. waitOn.push(cleanupPromise);
  588. pdfManager = null;
  589. } else {
  590. (0, _cleanup_helper.clearGlobalCaches)();
  591. }
  592. if (cancelXHRs) {
  593. cancelXHRs(new _util.AbortException("Worker was terminated."));
  594. }
  595. for (const task of WorkerTasks) {
  596. waitOn.push(task.finished);
  597. task.terminate();
  598. }
  599. return Promise.all(waitOn).then(function () {
  600. handler.destroy();
  601. handler = null;
  602. });
  603. });
  604. handler.on("Ready", function (data) {
  605. setupDoc(docParams);
  606. docParams = null;
  607. });
  608. return workerHandlerName;
  609. }
  610. static initializeFromPort(port) {
  611. const handler = new _message_handler.MessageHandler("worker", "main", port);
  612. WorkerMessageHandler.setup(handler, port);
  613. handler.send("ready", null);
  614. }
  615. }
  616. exports.WorkerMessageHandler = WorkerMessageHandler;
  617. function isMessagePort(maybePort) {
  618. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  619. }
  620. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  621. WorkerMessageHandler.initializeFromPort(self);
  622. }
  623. /***/ }),
  624. /* 2 */
  625. /***/ ((__unused_webpack_module, exports) => {
  626. Object.defineProperty(exports, "__esModule", ({
  627. value: true
  628. }));
  629. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.BASELINE_FACTOR = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  630. exports.arrayByteLength = arrayByteLength;
  631. exports.arraysToBytes = arraysToBytes;
  632. exports.assert = assert;
  633. exports.bytesToString = bytesToString;
  634. exports.createPromiseCapability = createPromiseCapability;
  635. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  636. exports.getModificationDate = getModificationDate;
  637. exports.getVerbosityLevel = getVerbosityLevel;
  638. exports.info = info;
  639. exports.isArrayBuffer = isArrayBuffer;
  640. exports.isArrayEqual = isArrayEqual;
  641. exports.objectFromMap = objectFromMap;
  642. exports.objectSize = objectSize;
  643. exports.setVerbosityLevel = setVerbosityLevel;
  644. exports.shadow = shadow;
  645. exports.string32 = string32;
  646. exports.stringToBytes = stringToBytes;
  647. exports.stringToPDFString = stringToPDFString;
  648. exports.stringToUTF8String = stringToUTF8String;
  649. exports.unreachable = unreachable;
  650. exports.utf8StringToString = utf8StringToString;
  651. exports.warn = warn;
  652. ;
  653. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  654. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  655. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  656. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  657. const LINE_FACTOR = 1.35;
  658. exports.LINE_FACTOR = LINE_FACTOR;
  659. const LINE_DESCENT_FACTOR = 0.35;
  660. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  661. const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
  662. exports.BASELINE_FACTOR = BASELINE_FACTOR;
  663. const RenderingIntentFlag = {
  664. ANY: 0x01,
  665. DISPLAY: 0x02,
  666. PRINT: 0x04,
  667. SAVE: 0x08,
  668. ANNOTATIONS_FORMS: 0x10,
  669. ANNOTATIONS_STORAGE: 0x20,
  670. ANNOTATIONS_DISABLE: 0x40,
  671. OPLIST: 0x100
  672. };
  673. exports.RenderingIntentFlag = RenderingIntentFlag;
  674. const AnnotationMode = {
  675. DISABLE: 0,
  676. ENABLE: 1,
  677. ENABLE_FORMS: 2,
  678. ENABLE_STORAGE: 3
  679. };
  680. exports.AnnotationMode = AnnotationMode;
  681. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  682. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  683. const AnnotationEditorType = {
  684. DISABLE: -1,
  685. NONE: 0,
  686. FREETEXT: 3,
  687. INK: 15
  688. };
  689. exports.AnnotationEditorType = AnnotationEditorType;
  690. const AnnotationEditorParamsType = {
  691. FREETEXT_SIZE: 1,
  692. FREETEXT_COLOR: 2,
  693. FREETEXT_OPACITY: 3,
  694. INK_COLOR: 11,
  695. INK_THICKNESS: 12,
  696. INK_OPACITY: 13
  697. };
  698. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  699. const PermissionFlag = {
  700. PRINT: 0x04,
  701. MODIFY_CONTENTS: 0x08,
  702. COPY: 0x10,
  703. MODIFY_ANNOTATIONS: 0x20,
  704. FILL_INTERACTIVE_FORMS: 0x100,
  705. COPY_FOR_ACCESSIBILITY: 0x200,
  706. ASSEMBLE: 0x400,
  707. PRINT_HIGH_QUALITY: 0x800
  708. };
  709. exports.PermissionFlag = PermissionFlag;
  710. const TextRenderingMode = {
  711. FILL: 0,
  712. STROKE: 1,
  713. FILL_STROKE: 2,
  714. INVISIBLE: 3,
  715. FILL_ADD_TO_PATH: 4,
  716. STROKE_ADD_TO_PATH: 5,
  717. FILL_STROKE_ADD_TO_PATH: 6,
  718. ADD_TO_PATH: 7,
  719. FILL_STROKE_MASK: 3,
  720. ADD_TO_PATH_FLAG: 4
  721. };
  722. exports.TextRenderingMode = TextRenderingMode;
  723. const ImageKind = {
  724. GRAYSCALE_1BPP: 1,
  725. RGB_24BPP: 2,
  726. RGBA_32BPP: 3
  727. };
  728. exports.ImageKind = ImageKind;
  729. const AnnotationType = {
  730. TEXT: 1,
  731. LINK: 2,
  732. FREETEXT: 3,
  733. LINE: 4,
  734. SQUARE: 5,
  735. CIRCLE: 6,
  736. POLYGON: 7,
  737. POLYLINE: 8,
  738. HIGHLIGHT: 9,
  739. UNDERLINE: 10,
  740. SQUIGGLY: 11,
  741. STRIKEOUT: 12,
  742. STAMP: 13,
  743. CARET: 14,
  744. INK: 15,
  745. POPUP: 16,
  746. FILEATTACHMENT: 17,
  747. SOUND: 18,
  748. MOVIE: 19,
  749. WIDGET: 20,
  750. SCREEN: 21,
  751. PRINTERMARK: 22,
  752. TRAPNET: 23,
  753. WATERMARK: 24,
  754. THREED: 25,
  755. REDACT: 26
  756. };
  757. exports.AnnotationType = AnnotationType;
  758. const AnnotationStateModelType = {
  759. MARKED: "Marked",
  760. REVIEW: "Review"
  761. };
  762. exports.AnnotationStateModelType = AnnotationStateModelType;
  763. const AnnotationMarkedState = {
  764. MARKED: "Marked",
  765. UNMARKED: "Unmarked"
  766. };
  767. exports.AnnotationMarkedState = AnnotationMarkedState;
  768. const AnnotationReviewState = {
  769. ACCEPTED: "Accepted",
  770. REJECTED: "Rejected",
  771. CANCELLED: "Cancelled",
  772. COMPLETED: "Completed",
  773. NONE: "None"
  774. };
  775. exports.AnnotationReviewState = AnnotationReviewState;
  776. const AnnotationReplyType = {
  777. GROUP: "Group",
  778. REPLY: "R"
  779. };
  780. exports.AnnotationReplyType = AnnotationReplyType;
  781. const AnnotationFlag = {
  782. INVISIBLE: 0x01,
  783. HIDDEN: 0x02,
  784. PRINT: 0x04,
  785. NOZOOM: 0x08,
  786. NOROTATE: 0x10,
  787. NOVIEW: 0x20,
  788. READONLY: 0x40,
  789. LOCKED: 0x80,
  790. TOGGLENOVIEW: 0x100,
  791. LOCKEDCONTENTS: 0x200
  792. };
  793. exports.AnnotationFlag = AnnotationFlag;
  794. const AnnotationFieldFlag = {
  795. READONLY: 0x0000001,
  796. REQUIRED: 0x0000002,
  797. NOEXPORT: 0x0000004,
  798. MULTILINE: 0x0001000,
  799. PASSWORD: 0x0002000,
  800. NOTOGGLETOOFF: 0x0004000,
  801. RADIO: 0x0008000,
  802. PUSHBUTTON: 0x0010000,
  803. COMBO: 0x0020000,
  804. EDIT: 0x0040000,
  805. SORT: 0x0080000,
  806. FILESELECT: 0x0100000,
  807. MULTISELECT: 0x0200000,
  808. DONOTSPELLCHECK: 0x0400000,
  809. DONOTSCROLL: 0x0800000,
  810. COMB: 0x1000000,
  811. RICHTEXT: 0x2000000,
  812. RADIOSINUNISON: 0x2000000,
  813. COMMITONSELCHANGE: 0x4000000
  814. };
  815. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  816. const AnnotationBorderStyleType = {
  817. SOLID: 1,
  818. DASHED: 2,
  819. BEVELED: 3,
  820. INSET: 4,
  821. UNDERLINE: 5
  822. };
  823. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  824. const AnnotationActionEventType = {
  825. E: "Mouse Enter",
  826. X: "Mouse Exit",
  827. D: "Mouse Down",
  828. U: "Mouse Up",
  829. Fo: "Focus",
  830. Bl: "Blur",
  831. PO: "PageOpen",
  832. PC: "PageClose",
  833. PV: "PageVisible",
  834. PI: "PageInvisible",
  835. K: "Keystroke",
  836. F: "Format",
  837. V: "Validate",
  838. C: "Calculate"
  839. };
  840. exports.AnnotationActionEventType = AnnotationActionEventType;
  841. const DocumentActionEventType = {
  842. WC: "WillClose",
  843. WS: "WillSave",
  844. DS: "DidSave",
  845. WP: "WillPrint",
  846. DP: "DidPrint"
  847. };
  848. exports.DocumentActionEventType = DocumentActionEventType;
  849. const PageActionEventType = {
  850. O: "PageOpen",
  851. C: "PageClose"
  852. };
  853. exports.PageActionEventType = PageActionEventType;
  854. const VerbosityLevel = {
  855. ERRORS: 0,
  856. WARNINGS: 1,
  857. INFOS: 5
  858. };
  859. exports.VerbosityLevel = VerbosityLevel;
  860. const CMapCompressionType = {
  861. NONE: 0,
  862. BINARY: 1
  863. };
  864. exports.CMapCompressionType = CMapCompressionType;
  865. const OPS = {
  866. dependency: 1,
  867. setLineWidth: 2,
  868. setLineCap: 3,
  869. setLineJoin: 4,
  870. setMiterLimit: 5,
  871. setDash: 6,
  872. setRenderingIntent: 7,
  873. setFlatness: 8,
  874. setGState: 9,
  875. save: 10,
  876. restore: 11,
  877. transform: 12,
  878. moveTo: 13,
  879. lineTo: 14,
  880. curveTo: 15,
  881. curveTo2: 16,
  882. curveTo3: 17,
  883. closePath: 18,
  884. rectangle: 19,
  885. stroke: 20,
  886. closeStroke: 21,
  887. fill: 22,
  888. eoFill: 23,
  889. fillStroke: 24,
  890. eoFillStroke: 25,
  891. closeFillStroke: 26,
  892. closeEOFillStroke: 27,
  893. endPath: 28,
  894. clip: 29,
  895. eoClip: 30,
  896. beginText: 31,
  897. endText: 32,
  898. setCharSpacing: 33,
  899. setWordSpacing: 34,
  900. setHScale: 35,
  901. setLeading: 36,
  902. setFont: 37,
  903. setTextRenderingMode: 38,
  904. setTextRise: 39,
  905. moveText: 40,
  906. setLeadingMoveText: 41,
  907. setTextMatrix: 42,
  908. nextLine: 43,
  909. showText: 44,
  910. showSpacedText: 45,
  911. nextLineShowText: 46,
  912. nextLineSetSpacingShowText: 47,
  913. setCharWidth: 48,
  914. setCharWidthAndBounds: 49,
  915. setStrokeColorSpace: 50,
  916. setFillColorSpace: 51,
  917. setStrokeColor: 52,
  918. setStrokeColorN: 53,
  919. setFillColor: 54,
  920. setFillColorN: 55,
  921. setStrokeGray: 56,
  922. setFillGray: 57,
  923. setStrokeRGBColor: 58,
  924. setFillRGBColor: 59,
  925. setStrokeCMYKColor: 60,
  926. setFillCMYKColor: 61,
  927. shadingFill: 62,
  928. beginInlineImage: 63,
  929. beginImageData: 64,
  930. endInlineImage: 65,
  931. paintXObject: 66,
  932. markPoint: 67,
  933. markPointProps: 68,
  934. beginMarkedContent: 69,
  935. beginMarkedContentProps: 70,
  936. endMarkedContent: 71,
  937. beginCompat: 72,
  938. endCompat: 73,
  939. paintFormXObjectBegin: 74,
  940. paintFormXObjectEnd: 75,
  941. beginGroup: 76,
  942. endGroup: 77,
  943. beginAnnotation: 80,
  944. endAnnotation: 81,
  945. paintImageMaskXObject: 83,
  946. paintImageMaskXObjectGroup: 84,
  947. paintImageXObject: 85,
  948. paintInlineImageXObject: 86,
  949. paintInlineImageXObjectGroup: 87,
  950. paintImageXObjectRepeat: 88,
  951. paintImageMaskXObjectRepeat: 89,
  952. paintSolidColorImageMask: 90,
  953. constructPath: 91
  954. };
  955. exports.OPS = OPS;
  956. const UNSUPPORTED_FEATURES = {
  957. forms: "forms",
  958. javaScript: "javaScript",
  959. signatures: "signatures",
  960. smask: "smask",
  961. shadingPattern: "shadingPattern",
  962. errorTilingPattern: "errorTilingPattern",
  963. errorExtGState: "errorExtGState",
  964. errorXObject: "errorXObject",
  965. errorFontLoadType3: "errorFontLoadType3",
  966. errorFontState: "errorFontState",
  967. errorFontMissing: "errorFontMissing",
  968. errorFontTranslate: "errorFontTranslate",
  969. errorColorSpace: "errorColorSpace",
  970. errorOperatorList: "errorOperatorList",
  971. errorFontToUnicode: "errorFontToUnicode",
  972. errorFontLoadNative: "errorFontLoadNative",
  973. errorFontBuildPath: "errorFontBuildPath",
  974. errorFontGetPath: "errorFontGetPath",
  975. errorMarkedContent: "errorMarkedContent",
  976. errorContentSubStream: "errorContentSubStream"
  977. };
  978. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  979. const PasswordResponses = {
  980. NEED_PASSWORD: 1,
  981. INCORRECT_PASSWORD: 2
  982. };
  983. exports.PasswordResponses = PasswordResponses;
  984. let verbosity = VerbosityLevel.WARNINGS;
  985. function setVerbosityLevel(level) {
  986. if (Number.isInteger(level)) {
  987. verbosity = level;
  988. }
  989. }
  990. function getVerbosityLevel() {
  991. return verbosity;
  992. }
  993. function info(msg) {
  994. if (verbosity >= VerbosityLevel.INFOS) {
  995. console.log(`Info: ${msg}`);
  996. }
  997. }
  998. function warn(msg) {
  999. if (verbosity >= VerbosityLevel.WARNINGS) {
  1000. console.log(`Warning: ${msg}`);
  1001. }
  1002. }
  1003. function unreachable(msg) {
  1004. throw new Error(msg);
  1005. }
  1006. function assert(cond, msg) {
  1007. if (!cond) {
  1008. unreachable(msg);
  1009. }
  1010. }
  1011. function _isValidProtocol(url) {
  1012. if (!url) {
  1013. return false;
  1014. }
  1015. switch (url.protocol) {
  1016. case "http:":
  1017. case "https:":
  1018. case "ftp:":
  1019. case "mailto:":
  1020. case "tel:":
  1021. return true;
  1022. default:
  1023. return false;
  1024. }
  1025. }
  1026. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1027. if (!url) {
  1028. return null;
  1029. }
  1030. try {
  1031. if (options && typeof url === "string") {
  1032. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1033. const dots = url.match(/\./g);
  1034. if (dots && dots.length >= 2) {
  1035. url = `http://${url}`;
  1036. }
  1037. }
  1038. if (options.tryConvertEncoding) {
  1039. try {
  1040. url = stringToUTF8String(url);
  1041. } catch (ex) {}
  1042. }
  1043. }
  1044. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1045. if (_isValidProtocol(absoluteUrl)) {
  1046. return absoluteUrl;
  1047. }
  1048. } catch (ex) {}
  1049. return null;
  1050. }
  1051. function shadow(obj, prop, value, nonSerializable = false) {
  1052. Object.defineProperty(obj, prop, {
  1053. value,
  1054. enumerable: !nonSerializable,
  1055. configurable: true,
  1056. writable: false
  1057. });
  1058. return value;
  1059. }
  1060. const BaseException = function BaseExceptionClosure() {
  1061. function BaseException(message, name) {
  1062. if (this.constructor === BaseException) {
  1063. unreachable("Cannot initialize BaseException.");
  1064. }
  1065. this.message = message;
  1066. this.name = name;
  1067. }
  1068. BaseException.prototype = new Error();
  1069. BaseException.constructor = BaseException;
  1070. return BaseException;
  1071. }();
  1072. exports.BaseException = BaseException;
  1073. class PasswordException extends BaseException {
  1074. constructor(msg, code) {
  1075. super(msg, "PasswordException");
  1076. this.code = code;
  1077. }
  1078. }
  1079. exports.PasswordException = PasswordException;
  1080. class UnknownErrorException extends BaseException {
  1081. constructor(msg, details) {
  1082. super(msg, "UnknownErrorException");
  1083. this.details = details;
  1084. }
  1085. }
  1086. exports.UnknownErrorException = UnknownErrorException;
  1087. class InvalidPDFException extends BaseException {
  1088. constructor(msg) {
  1089. super(msg, "InvalidPDFException");
  1090. }
  1091. }
  1092. exports.InvalidPDFException = InvalidPDFException;
  1093. class MissingPDFException extends BaseException {
  1094. constructor(msg) {
  1095. super(msg, "MissingPDFException");
  1096. }
  1097. }
  1098. exports.MissingPDFException = MissingPDFException;
  1099. class UnexpectedResponseException extends BaseException {
  1100. constructor(msg, status) {
  1101. super(msg, "UnexpectedResponseException");
  1102. this.status = status;
  1103. }
  1104. }
  1105. exports.UnexpectedResponseException = UnexpectedResponseException;
  1106. class FormatError extends BaseException {
  1107. constructor(msg) {
  1108. super(msg, "FormatError");
  1109. }
  1110. }
  1111. exports.FormatError = FormatError;
  1112. class AbortException extends BaseException {
  1113. constructor(msg) {
  1114. super(msg, "AbortException");
  1115. }
  1116. }
  1117. exports.AbortException = AbortException;
  1118. function bytesToString(bytes) {
  1119. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1120. unreachable("Invalid argument for bytesToString");
  1121. }
  1122. const length = bytes.length;
  1123. const MAX_ARGUMENT_COUNT = 8192;
  1124. if (length < MAX_ARGUMENT_COUNT) {
  1125. return String.fromCharCode.apply(null, bytes);
  1126. }
  1127. const strBuf = [];
  1128. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1129. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1130. const chunk = bytes.subarray(i, chunkEnd);
  1131. strBuf.push(String.fromCharCode.apply(null, chunk));
  1132. }
  1133. return strBuf.join("");
  1134. }
  1135. function stringToBytes(str) {
  1136. if (typeof str !== "string") {
  1137. unreachable("Invalid argument for stringToBytes");
  1138. }
  1139. const length = str.length;
  1140. const bytes = new Uint8Array(length);
  1141. for (let i = 0; i < length; ++i) {
  1142. bytes[i] = str.charCodeAt(i) & 0xff;
  1143. }
  1144. return bytes;
  1145. }
  1146. function arrayByteLength(arr) {
  1147. if (arr.length !== undefined) {
  1148. return arr.length;
  1149. }
  1150. if (arr.byteLength !== undefined) {
  1151. return arr.byteLength;
  1152. }
  1153. unreachable("Invalid argument for arrayByteLength");
  1154. }
  1155. function arraysToBytes(arr) {
  1156. const length = arr.length;
  1157. if (length === 1 && arr[0] instanceof Uint8Array) {
  1158. return arr[0];
  1159. }
  1160. let resultLength = 0;
  1161. for (let i = 0; i < length; i++) {
  1162. resultLength += arrayByteLength(arr[i]);
  1163. }
  1164. let pos = 0;
  1165. const data = new Uint8Array(resultLength);
  1166. for (let i = 0; i < length; i++) {
  1167. let item = arr[i];
  1168. if (!(item instanceof Uint8Array)) {
  1169. if (typeof item === "string") {
  1170. item = stringToBytes(item);
  1171. } else {
  1172. item = new Uint8Array(item);
  1173. }
  1174. }
  1175. const itemLength = item.byteLength;
  1176. data.set(item, pos);
  1177. pos += itemLength;
  1178. }
  1179. return data;
  1180. }
  1181. function string32(value) {
  1182. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1183. }
  1184. function objectSize(obj) {
  1185. return Object.keys(obj).length;
  1186. }
  1187. function objectFromMap(map) {
  1188. const obj = Object.create(null);
  1189. for (const [key, value] of map) {
  1190. obj[key] = value;
  1191. }
  1192. return obj;
  1193. }
  1194. function isLittleEndian() {
  1195. const buffer8 = new Uint8Array(4);
  1196. buffer8[0] = 1;
  1197. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1198. return view32[0] === 1;
  1199. }
  1200. function isEvalSupported() {
  1201. try {
  1202. new Function("");
  1203. return true;
  1204. } catch (e) {
  1205. return false;
  1206. }
  1207. }
  1208. class FeatureTest {
  1209. static get isLittleEndian() {
  1210. return shadow(this, "isLittleEndian", isLittleEndian());
  1211. }
  1212. static get isEvalSupported() {
  1213. return shadow(this, "isEvalSupported", isEvalSupported());
  1214. }
  1215. static get isOffscreenCanvasSupported() {
  1216. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1217. }
  1218. static get platform() {
  1219. if (typeof navigator === "undefined") {
  1220. return shadow(this, "platform", {
  1221. isWin: false,
  1222. isMac: false
  1223. });
  1224. }
  1225. return shadow(this, "platform", {
  1226. isWin: navigator.platform.includes("Win"),
  1227. isMac: navigator.platform.includes("Mac")
  1228. });
  1229. }
  1230. }
  1231. exports.FeatureTest = FeatureTest;
  1232. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1233. class Util {
  1234. static makeHexColor(r, g, b) {
  1235. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1236. }
  1237. static scaleMinMax(transform, minMax) {
  1238. let temp;
  1239. if (transform[0]) {
  1240. if (transform[0] < 0) {
  1241. temp = minMax[0];
  1242. minMax[0] = minMax[1];
  1243. minMax[1] = temp;
  1244. }
  1245. minMax[0] *= transform[0];
  1246. minMax[1] *= transform[0];
  1247. if (transform[3] < 0) {
  1248. temp = minMax[2];
  1249. minMax[2] = minMax[3];
  1250. minMax[3] = temp;
  1251. }
  1252. minMax[2] *= transform[3];
  1253. minMax[3] *= transform[3];
  1254. } else {
  1255. temp = minMax[0];
  1256. minMax[0] = minMax[2];
  1257. minMax[2] = temp;
  1258. temp = minMax[1];
  1259. minMax[1] = minMax[3];
  1260. minMax[3] = temp;
  1261. if (transform[1] < 0) {
  1262. temp = minMax[2];
  1263. minMax[2] = minMax[3];
  1264. minMax[3] = temp;
  1265. }
  1266. minMax[2] *= transform[1];
  1267. minMax[3] *= transform[1];
  1268. if (transform[2] < 0) {
  1269. temp = minMax[0];
  1270. minMax[0] = minMax[1];
  1271. minMax[1] = temp;
  1272. }
  1273. minMax[0] *= transform[2];
  1274. minMax[1] *= transform[2];
  1275. }
  1276. minMax[0] += transform[4];
  1277. minMax[1] += transform[4];
  1278. minMax[2] += transform[5];
  1279. minMax[3] += transform[5];
  1280. }
  1281. static transform(m1, m2) {
  1282. 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]];
  1283. }
  1284. static applyTransform(p, m) {
  1285. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1286. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1287. return [xt, yt];
  1288. }
  1289. static applyInverseTransform(p, m) {
  1290. const d = m[0] * m[3] - m[1] * m[2];
  1291. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1292. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1293. return [xt, yt];
  1294. }
  1295. static getAxialAlignedBoundingBox(r, m) {
  1296. const p1 = Util.applyTransform(r, m);
  1297. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1298. const p3 = Util.applyTransform([r[0], r[3]], m);
  1299. const p4 = Util.applyTransform([r[2], r[1]], m);
  1300. 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])];
  1301. }
  1302. static inverseTransform(m) {
  1303. const d = m[0] * m[3] - m[1] * m[2];
  1304. 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];
  1305. }
  1306. static singularValueDecompose2dScale(m) {
  1307. const transpose = [m[0], m[2], m[1], m[3]];
  1308. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1309. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1310. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1311. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1312. const first = (a + d) / 2;
  1313. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1314. const sx = first + second || 1;
  1315. const sy = first - second || 1;
  1316. return [Math.sqrt(sx), Math.sqrt(sy)];
  1317. }
  1318. static normalizeRect(rect) {
  1319. const r = rect.slice(0);
  1320. if (rect[0] > rect[2]) {
  1321. r[0] = rect[2];
  1322. r[2] = rect[0];
  1323. }
  1324. if (rect[1] > rect[3]) {
  1325. r[1] = rect[3];
  1326. r[3] = rect[1];
  1327. }
  1328. return r;
  1329. }
  1330. static intersect(rect1, rect2) {
  1331. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1332. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1333. if (xLow > xHigh) {
  1334. return null;
  1335. }
  1336. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1337. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1338. if (yLow > yHigh) {
  1339. return null;
  1340. }
  1341. return [xLow, yLow, xHigh, yHigh];
  1342. }
  1343. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1344. const tvalues = [],
  1345. bounds = [[], []];
  1346. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1347. for (let i = 0; i < 2; ++i) {
  1348. if (i === 0) {
  1349. b = 6 * x0 - 12 * x1 + 6 * x2;
  1350. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1351. c = 3 * x1 - 3 * x0;
  1352. } else {
  1353. b = 6 * y0 - 12 * y1 + 6 * y2;
  1354. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1355. c = 3 * y1 - 3 * y0;
  1356. }
  1357. if (Math.abs(a) < 1e-12) {
  1358. if (Math.abs(b) < 1e-12) {
  1359. continue;
  1360. }
  1361. t = -c / b;
  1362. if (0 < t && t < 1) {
  1363. tvalues.push(t);
  1364. }
  1365. continue;
  1366. }
  1367. b2ac = b * b - 4 * c * a;
  1368. sqrtb2ac = Math.sqrt(b2ac);
  1369. if (b2ac < 0) {
  1370. continue;
  1371. }
  1372. t1 = (-b + sqrtb2ac) / (2 * a);
  1373. if (0 < t1 && t1 < 1) {
  1374. tvalues.push(t1);
  1375. }
  1376. t2 = (-b - sqrtb2ac) / (2 * a);
  1377. if (0 < t2 && t2 < 1) {
  1378. tvalues.push(t2);
  1379. }
  1380. }
  1381. let j = tvalues.length,
  1382. mt;
  1383. const jlen = j;
  1384. while (j--) {
  1385. t = tvalues[j];
  1386. mt = 1 - t;
  1387. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1388. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1389. }
  1390. bounds[0][jlen] = x0;
  1391. bounds[1][jlen] = y0;
  1392. bounds[0][jlen + 1] = x3;
  1393. bounds[1][jlen + 1] = y3;
  1394. bounds[0].length = bounds[1].length = jlen + 2;
  1395. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1396. }
  1397. }
  1398. exports.Util = Util;
  1399. 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];
  1400. function stringToPDFString(str) {
  1401. if (str[0] >= "\xEF") {
  1402. let encoding;
  1403. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1404. encoding = "utf-16be";
  1405. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1406. encoding = "utf-16le";
  1407. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1408. encoding = "utf-8";
  1409. }
  1410. if (encoding) {
  1411. try {
  1412. const decoder = new TextDecoder(encoding, {
  1413. fatal: true
  1414. });
  1415. const buffer = stringToBytes(str);
  1416. return decoder.decode(buffer);
  1417. } catch (ex) {
  1418. warn(`stringToPDFString: "${ex}".`);
  1419. }
  1420. }
  1421. }
  1422. const strBuf = [];
  1423. for (let i = 0, ii = str.length; i < ii; i++) {
  1424. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1425. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1426. }
  1427. return strBuf.join("");
  1428. }
  1429. function stringToUTF8String(str) {
  1430. return decodeURIComponent(escape(str));
  1431. }
  1432. function utf8StringToString(str) {
  1433. return unescape(encodeURIComponent(str));
  1434. }
  1435. function isArrayBuffer(v) {
  1436. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1437. }
  1438. function isArrayEqual(arr1, arr2) {
  1439. if (arr1.length !== arr2.length) {
  1440. return false;
  1441. }
  1442. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1443. if (arr1[i] !== arr2[i]) {
  1444. return false;
  1445. }
  1446. }
  1447. return true;
  1448. }
  1449. function getModificationDate(date = new Date()) {
  1450. 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")];
  1451. return buffer.join("");
  1452. }
  1453. function createPromiseCapability() {
  1454. const capability = Object.create(null);
  1455. let isSettled = false;
  1456. Object.defineProperty(capability, "settled", {
  1457. get() {
  1458. return isSettled;
  1459. }
  1460. });
  1461. capability.promise = new Promise(function (resolve, reject) {
  1462. capability.resolve = function (data) {
  1463. isSettled = true;
  1464. resolve(data);
  1465. };
  1466. capability.reject = function (reason) {
  1467. isSettled = true;
  1468. reject(reason);
  1469. };
  1470. });
  1471. return capability;
  1472. }
  1473. /***/ }),
  1474. /* 3 */
  1475. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1476. Object.defineProperty(exports, "__esModule", ({
  1477. value: true
  1478. }));
  1479. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1480. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1481. exports.isCmd = isCmd;
  1482. exports.isDict = isDict;
  1483. exports.isName = isName;
  1484. exports.isRefsEqual = isRefsEqual;
  1485. var _util = __w_pdfjs_require__(2);
  1486. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1487. exports.CIRCULAR_REF = CIRCULAR_REF;
  1488. const EOF = Symbol("EOF");
  1489. exports.EOF = EOF;
  1490. const Name = function NameClosure() {
  1491. let nameCache = Object.create(null);
  1492. class Name {
  1493. constructor(name) {
  1494. this.name = name;
  1495. }
  1496. static get(name) {
  1497. return nameCache[name] || (nameCache[name] = new Name(name));
  1498. }
  1499. static _clearCache() {
  1500. nameCache = Object.create(null);
  1501. }
  1502. }
  1503. return Name;
  1504. }();
  1505. exports.Name = Name;
  1506. const Cmd = function CmdClosure() {
  1507. let cmdCache = Object.create(null);
  1508. class Cmd {
  1509. constructor(cmd) {
  1510. this.cmd = cmd;
  1511. }
  1512. static get(cmd) {
  1513. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  1514. }
  1515. static _clearCache() {
  1516. cmdCache = Object.create(null);
  1517. }
  1518. }
  1519. return Cmd;
  1520. }();
  1521. exports.Cmd = Cmd;
  1522. const nonSerializable = function nonSerializableClosure() {
  1523. return nonSerializable;
  1524. };
  1525. class Dict {
  1526. constructor(xref = null) {
  1527. this._map = Object.create(null);
  1528. this.xref = xref;
  1529. this.objId = null;
  1530. this.suppressEncryption = false;
  1531. this.__nonSerializable__ = nonSerializable;
  1532. }
  1533. assignXref(newXref) {
  1534. this.xref = newXref;
  1535. }
  1536. get size() {
  1537. return Object.keys(this._map).length;
  1538. }
  1539. get(key1, key2, key3) {
  1540. let value = this._map[key1];
  1541. if (value === undefined && key2 !== undefined) {
  1542. value = this._map[key2];
  1543. if (value === undefined && key3 !== undefined) {
  1544. value = this._map[key3];
  1545. }
  1546. }
  1547. if (value instanceof Ref && this.xref) {
  1548. return this.xref.fetch(value, this.suppressEncryption);
  1549. }
  1550. return value;
  1551. }
  1552. async getAsync(key1, key2, key3) {
  1553. let value = this._map[key1];
  1554. if (value === undefined && key2 !== undefined) {
  1555. value = this._map[key2];
  1556. if (value === undefined && key3 !== undefined) {
  1557. value = this._map[key3];
  1558. }
  1559. }
  1560. if (value instanceof Ref && this.xref) {
  1561. return this.xref.fetchAsync(value, this.suppressEncryption);
  1562. }
  1563. return value;
  1564. }
  1565. getArray(key1, key2, key3) {
  1566. let value = this._map[key1];
  1567. if (value === undefined && key2 !== undefined) {
  1568. value = this._map[key2];
  1569. if (value === undefined && key3 !== undefined) {
  1570. value = this._map[key3];
  1571. }
  1572. }
  1573. if (value instanceof Ref && this.xref) {
  1574. value = this.xref.fetch(value, this.suppressEncryption);
  1575. }
  1576. if (Array.isArray(value)) {
  1577. value = value.slice();
  1578. for (let i = 0, ii = value.length; i < ii; i++) {
  1579. if (value[i] instanceof Ref && this.xref) {
  1580. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1581. }
  1582. }
  1583. }
  1584. return value;
  1585. }
  1586. getRaw(key) {
  1587. return this._map[key];
  1588. }
  1589. getKeys() {
  1590. return Object.keys(this._map);
  1591. }
  1592. getRawValues() {
  1593. return Object.values(this._map);
  1594. }
  1595. set(key, value) {
  1596. this._map[key] = value;
  1597. }
  1598. has(key) {
  1599. return this._map[key] !== undefined;
  1600. }
  1601. forEach(callback) {
  1602. for (const key in this._map) {
  1603. callback(key, this.get(key));
  1604. }
  1605. }
  1606. static get empty() {
  1607. const emptyDict = new Dict(null);
  1608. emptyDict.set = (key, value) => {
  1609. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1610. };
  1611. return (0, _util.shadow)(this, "empty", emptyDict);
  1612. }
  1613. static merge({
  1614. xref,
  1615. dictArray,
  1616. mergeSubDicts = false
  1617. }) {
  1618. const mergedDict = new Dict(xref),
  1619. properties = new Map();
  1620. for (const dict of dictArray) {
  1621. if (!(dict instanceof Dict)) {
  1622. continue;
  1623. }
  1624. for (const [key, value] of Object.entries(dict._map)) {
  1625. let property = properties.get(key);
  1626. if (property === undefined) {
  1627. property = [];
  1628. properties.set(key, property);
  1629. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1630. continue;
  1631. }
  1632. property.push(value);
  1633. }
  1634. }
  1635. for (const [name, values] of properties) {
  1636. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1637. mergedDict._map[name] = values[0];
  1638. continue;
  1639. }
  1640. const subDict = new Dict(xref);
  1641. for (const dict of values) {
  1642. for (const [key, value] of Object.entries(dict._map)) {
  1643. if (subDict._map[key] === undefined) {
  1644. subDict._map[key] = value;
  1645. }
  1646. }
  1647. }
  1648. if (subDict.size > 0) {
  1649. mergedDict._map[name] = subDict;
  1650. }
  1651. }
  1652. properties.clear();
  1653. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1654. }
  1655. }
  1656. exports.Dict = Dict;
  1657. const Ref = function RefClosure() {
  1658. let refCache = Object.create(null);
  1659. class Ref {
  1660. constructor(num, gen) {
  1661. this.num = num;
  1662. this.gen = gen;
  1663. }
  1664. toString() {
  1665. if (this.gen === 0) {
  1666. return `${this.num}R`;
  1667. }
  1668. return `${this.num}R${this.gen}`;
  1669. }
  1670. static get(num, gen) {
  1671. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1672. return refCache[key] || (refCache[key] = new Ref(num, gen));
  1673. }
  1674. static _clearCache() {
  1675. refCache = Object.create(null);
  1676. }
  1677. }
  1678. return Ref;
  1679. }();
  1680. exports.Ref = Ref;
  1681. class RefSet {
  1682. constructor(parent = null) {
  1683. this._set = new Set(parent && parent._set);
  1684. }
  1685. has(ref) {
  1686. return this._set.has(ref.toString());
  1687. }
  1688. put(ref) {
  1689. this._set.add(ref.toString());
  1690. }
  1691. remove(ref) {
  1692. this._set.delete(ref.toString());
  1693. }
  1694. [Symbol.iterator]() {
  1695. return this._set.values();
  1696. }
  1697. clear() {
  1698. this._set.clear();
  1699. }
  1700. }
  1701. exports.RefSet = RefSet;
  1702. class RefSetCache {
  1703. constructor() {
  1704. this._map = new Map();
  1705. }
  1706. get size() {
  1707. return this._map.size;
  1708. }
  1709. get(ref) {
  1710. return this._map.get(ref.toString());
  1711. }
  1712. has(ref) {
  1713. return this._map.has(ref.toString());
  1714. }
  1715. put(ref, obj) {
  1716. this._map.set(ref.toString(), obj);
  1717. }
  1718. putAlias(ref, aliasRef) {
  1719. this._map.set(ref.toString(), this.get(aliasRef));
  1720. }
  1721. [Symbol.iterator]() {
  1722. return this._map.values();
  1723. }
  1724. clear() {
  1725. this._map.clear();
  1726. }
  1727. }
  1728. exports.RefSetCache = RefSetCache;
  1729. function isName(v, name) {
  1730. return v instanceof Name && (name === undefined || v.name === name);
  1731. }
  1732. function isCmd(v, cmd) {
  1733. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1734. }
  1735. function isDict(v, type) {
  1736. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1737. }
  1738. function isRefsEqual(v1, v2) {
  1739. return v1.num === v2.num && v1.gen === v2.gen;
  1740. }
  1741. function clearPrimitiveCaches() {
  1742. Cmd._clearCache();
  1743. Name._clearCache();
  1744. Ref._clearCache();
  1745. }
  1746. /***/ }),
  1747. /* 4 */
  1748. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1749. Object.defineProperty(exports, "__esModule", ({
  1750. value: true
  1751. }));
  1752. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = void 0;
  1753. exports.collectActions = collectActions;
  1754. exports.encodeToXmlString = encodeToXmlString;
  1755. exports.escapePDFName = escapePDFName;
  1756. exports.escapeString = escapeString;
  1757. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  1758. exports.getInheritableProperty = getInheritableProperty;
  1759. exports.getLookupTableFactory = getLookupTableFactory;
  1760. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  1761. exports.getRotationMatrix = getRotationMatrix;
  1762. exports.isAscii = isAscii;
  1763. exports.isWhiteSpace = isWhiteSpace;
  1764. exports.log2 = log2;
  1765. exports.numberToString = numberToString;
  1766. exports.parseXFAPath = parseXFAPath;
  1767. exports.readInt8 = readInt8;
  1768. exports.readUint16 = readUint16;
  1769. exports.readUint32 = readUint32;
  1770. exports.recoverJsURL = recoverJsURL;
  1771. exports.stringToUTF16HexString = stringToUTF16HexString;
  1772. exports.stringToUTF16String = stringToUTF16String;
  1773. exports.toRomanNumerals = toRomanNumerals;
  1774. exports.validateCSSFont = validateCSSFont;
  1775. var _util = __w_pdfjs_require__(2);
  1776. var _primitives = __w_pdfjs_require__(3);
  1777. var _base_stream = __w_pdfjs_require__(5);
  1778. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  1779. exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
  1780. function getLookupTableFactory(initializer) {
  1781. let lookup;
  1782. return function () {
  1783. if (initializer) {
  1784. lookup = Object.create(null);
  1785. initializer(lookup);
  1786. initializer = null;
  1787. }
  1788. return lookup;
  1789. };
  1790. }
  1791. function getArrayLookupTableFactory(initializer) {
  1792. let lookup;
  1793. return function () {
  1794. if (initializer) {
  1795. let arr = initializer();
  1796. initializer = null;
  1797. lookup = Object.create(null);
  1798. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  1799. lookup[arr[i]] = arr[i + 1];
  1800. }
  1801. arr = null;
  1802. }
  1803. return lookup;
  1804. };
  1805. }
  1806. class MissingDataException extends _util.BaseException {
  1807. constructor(begin, end) {
  1808. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  1809. this.begin = begin;
  1810. this.end = end;
  1811. }
  1812. }
  1813. exports.MissingDataException = MissingDataException;
  1814. class ParserEOFException extends _util.BaseException {
  1815. constructor(msg) {
  1816. super(msg, "ParserEOFException");
  1817. }
  1818. }
  1819. exports.ParserEOFException = ParserEOFException;
  1820. class XRefEntryException extends _util.BaseException {
  1821. constructor(msg) {
  1822. super(msg, "XRefEntryException");
  1823. }
  1824. }
  1825. exports.XRefEntryException = XRefEntryException;
  1826. class XRefParseException extends _util.BaseException {
  1827. constructor(msg) {
  1828. super(msg, "XRefParseException");
  1829. }
  1830. }
  1831. exports.XRefParseException = XRefParseException;
  1832. function getInheritableProperty({
  1833. dict,
  1834. key,
  1835. getArray = false,
  1836. stopWhenFound = true
  1837. }) {
  1838. let values;
  1839. const visited = new _primitives.RefSet();
  1840. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  1841. if (dict.objId) {
  1842. visited.put(dict.objId);
  1843. }
  1844. const value = getArray ? dict.getArray(key) : dict.get(key);
  1845. if (value !== undefined) {
  1846. if (stopWhenFound) {
  1847. return value;
  1848. }
  1849. if (!values) {
  1850. values = [];
  1851. }
  1852. values.push(value);
  1853. }
  1854. dict = dict.get("Parent");
  1855. }
  1856. return values;
  1857. }
  1858. 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"];
  1859. function toRomanNumerals(number, lowerCase = false) {
  1860. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  1861. const romanBuf = [];
  1862. let pos;
  1863. while (number >= 1000) {
  1864. number -= 1000;
  1865. romanBuf.push("M");
  1866. }
  1867. pos = number / 100 | 0;
  1868. number %= 100;
  1869. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  1870. pos = number / 10 | 0;
  1871. number %= 10;
  1872. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  1873. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  1874. const romanStr = romanBuf.join("");
  1875. return lowerCase ? romanStr.toLowerCase() : romanStr;
  1876. }
  1877. function log2(x) {
  1878. if (x <= 0) {
  1879. return 0;
  1880. }
  1881. return Math.ceil(Math.log2(x));
  1882. }
  1883. function readInt8(data, offset) {
  1884. return data[offset] << 24 >> 24;
  1885. }
  1886. function readUint16(data, offset) {
  1887. return data[offset] << 8 | data[offset + 1];
  1888. }
  1889. function readUint32(data, offset) {
  1890. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  1891. }
  1892. function isWhiteSpace(ch) {
  1893. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  1894. }
  1895. function parseXFAPath(path) {
  1896. const positionPattern = /(.+)\[(\d+)\]$/;
  1897. return path.split(".").map(component => {
  1898. const m = component.match(positionPattern);
  1899. if (m) {
  1900. return {
  1901. name: m[1],
  1902. pos: parseInt(m[2], 10)
  1903. };
  1904. }
  1905. return {
  1906. name: component,
  1907. pos: 0
  1908. };
  1909. });
  1910. }
  1911. function escapePDFName(str) {
  1912. const buffer = [];
  1913. let start = 0;
  1914. for (let i = 0, ii = str.length; i < ii; i++) {
  1915. const char = str.charCodeAt(i);
  1916. 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) {
  1917. if (start < i) {
  1918. buffer.push(str.substring(start, i));
  1919. }
  1920. buffer.push(`#${char.toString(16)}`);
  1921. start = i + 1;
  1922. }
  1923. }
  1924. if (buffer.length === 0) {
  1925. return str;
  1926. }
  1927. if (start < str.length) {
  1928. buffer.push(str.substring(start, str.length));
  1929. }
  1930. return buffer.join("");
  1931. }
  1932. function escapeString(str) {
  1933. return str.replace(/([()\\\n\r])/g, match => {
  1934. if (match === "\n") {
  1935. return "\\n";
  1936. } else if (match === "\r") {
  1937. return "\\r";
  1938. }
  1939. return `\\${match}`;
  1940. });
  1941. }
  1942. function _collectJS(entry, xref, list, parents) {
  1943. if (!entry) {
  1944. return;
  1945. }
  1946. let parent = null;
  1947. if (entry instanceof _primitives.Ref) {
  1948. if (parents.has(entry)) {
  1949. return;
  1950. }
  1951. parent = entry;
  1952. parents.put(parent);
  1953. entry = xref.fetch(entry);
  1954. }
  1955. if (Array.isArray(entry)) {
  1956. for (const element of entry) {
  1957. _collectJS(element, xref, list, parents);
  1958. }
  1959. } else if (entry instanceof _primitives.Dict) {
  1960. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  1961. const js = entry.get("JS");
  1962. let code;
  1963. if (js instanceof _base_stream.BaseStream) {
  1964. code = js.getString();
  1965. } else if (typeof js === "string") {
  1966. code = js;
  1967. }
  1968. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  1969. if (code) {
  1970. list.push(code);
  1971. }
  1972. }
  1973. _collectJS(entry.getRaw("Next"), xref, list, parents);
  1974. }
  1975. if (parent) {
  1976. parents.remove(parent);
  1977. }
  1978. }
  1979. function collectActions(xref, dict, eventType) {
  1980. const actions = Object.create(null);
  1981. const additionalActionsDicts = getInheritableProperty({
  1982. dict,
  1983. key: "AA",
  1984. stopWhenFound: false
  1985. });
  1986. if (additionalActionsDicts) {
  1987. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  1988. const additionalActions = additionalActionsDicts[i];
  1989. if (!(additionalActions instanceof _primitives.Dict)) {
  1990. continue;
  1991. }
  1992. for (const key of additionalActions.getKeys()) {
  1993. const action = eventType[key];
  1994. if (!action) {
  1995. continue;
  1996. }
  1997. const actionDict = additionalActions.getRaw(key);
  1998. const parents = new _primitives.RefSet();
  1999. const list = [];
  2000. _collectJS(actionDict, xref, list, parents);
  2001. if (list.length > 0) {
  2002. actions[action] = list;
  2003. }
  2004. }
  2005. }
  2006. }
  2007. if (dict.has("A")) {
  2008. const actionDict = dict.get("A");
  2009. const parents = new _primitives.RefSet();
  2010. const list = [];
  2011. _collectJS(actionDict, xref, list, parents);
  2012. if (list.length > 0) {
  2013. actions.Action = list;
  2014. }
  2015. }
  2016. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2017. }
  2018. const XMLEntities = {
  2019. 0x3c: "&lt;",
  2020. 0x3e: "&gt;",
  2021. 0x26: "&amp;",
  2022. 0x22: "&quot;",
  2023. 0x27: "&apos;"
  2024. };
  2025. function encodeToXmlString(str) {
  2026. const buffer = [];
  2027. let start = 0;
  2028. for (let i = 0, ii = str.length; i < ii; i++) {
  2029. const char = str.codePointAt(i);
  2030. if (0x20 <= char && char <= 0x7e) {
  2031. const entity = XMLEntities[char];
  2032. if (entity) {
  2033. if (start < i) {
  2034. buffer.push(str.substring(start, i));
  2035. }
  2036. buffer.push(entity);
  2037. start = i + 1;
  2038. }
  2039. } else {
  2040. if (start < i) {
  2041. buffer.push(str.substring(start, i));
  2042. }
  2043. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2044. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2045. i++;
  2046. }
  2047. start = i + 1;
  2048. }
  2049. }
  2050. if (buffer.length === 0) {
  2051. return str;
  2052. }
  2053. if (start < str.length) {
  2054. buffer.push(str.substring(start, str.length));
  2055. }
  2056. return buffer.join("");
  2057. }
  2058. function validateCSSFont(cssFontInfo) {
  2059. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2060. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2061. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2062. const {
  2063. fontFamily,
  2064. fontWeight,
  2065. italicAngle
  2066. } = cssFontInfo;
  2067. if (/^".*"$/.test(fontFamily)) {
  2068. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2069. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2070. return false;
  2071. }
  2072. } else if (/^'.*'$/.test(fontFamily)) {
  2073. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2074. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2075. return false;
  2076. }
  2077. } else {
  2078. for (const ident of fontFamily.split(/[ \t]+/)) {
  2079. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2080. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2081. return false;
  2082. }
  2083. }
  2084. }
  2085. const weight = fontWeight ? fontWeight.toString() : "";
  2086. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2087. const angle = parseFloat(italicAngle);
  2088. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2089. return true;
  2090. }
  2091. function recoverJsURL(str) {
  2092. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2093. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2094. const jsUrl = regex.exec(str);
  2095. if (jsUrl && jsUrl[2]) {
  2096. const url = jsUrl[2];
  2097. let newWindow = false;
  2098. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2099. newWindow = true;
  2100. }
  2101. return {
  2102. url,
  2103. newWindow
  2104. };
  2105. }
  2106. return null;
  2107. }
  2108. function numberToString(value) {
  2109. if (Number.isInteger(value)) {
  2110. return value.toString();
  2111. }
  2112. const roundedValue = Math.round(value * 100);
  2113. if (roundedValue % 100 === 0) {
  2114. return (roundedValue / 100).toString();
  2115. }
  2116. if (roundedValue % 10 === 0) {
  2117. return value.toFixed(1);
  2118. }
  2119. return value.toFixed(2);
  2120. }
  2121. function getNewAnnotationsMap(annotationStorage) {
  2122. if (!annotationStorage) {
  2123. return null;
  2124. }
  2125. const newAnnotationsByPage = new Map();
  2126. for (const [key, value] of annotationStorage) {
  2127. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  2128. continue;
  2129. }
  2130. let annotations = newAnnotationsByPage.get(value.pageIndex);
  2131. if (!annotations) {
  2132. annotations = [];
  2133. newAnnotationsByPage.set(value.pageIndex, annotations);
  2134. }
  2135. annotations.push(value);
  2136. }
  2137. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  2138. }
  2139. function isAscii(str) {
  2140. return /^[\x00-\x7F]*$/.test(str);
  2141. }
  2142. function stringToUTF16HexString(str) {
  2143. const buf = [];
  2144. for (let i = 0, ii = str.length; i < ii; i++) {
  2145. const char = str.charCodeAt(i);
  2146. buf.push((char >> 8 & 0xff).toString(16).padStart(2, "0"), (char & 0xff).toString(16).padStart(2, "0"));
  2147. }
  2148. return buf.join("");
  2149. }
  2150. function stringToUTF16String(str, bigEndian = false) {
  2151. const buf = [];
  2152. if (bigEndian) {
  2153. buf.push("\xFE\xFF");
  2154. }
  2155. for (let i = 0, ii = str.length; i < ii; i++) {
  2156. const char = str.charCodeAt(i);
  2157. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  2158. }
  2159. return buf.join("");
  2160. }
  2161. function getRotationMatrix(rotation, width, height) {
  2162. switch (rotation) {
  2163. case 90:
  2164. return [0, 1, -1, 0, width, 0];
  2165. case 180:
  2166. return [-1, 0, 0, -1, width, height];
  2167. case 270:
  2168. return [0, -1, 1, 0, 0, height];
  2169. default:
  2170. throw new Error("Invalid rotation");
  2171. }
  2172. }
  2173. /***/ }),
  2174. /* 5 */
  2175. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2176. Object.defineProperty(exports, "__esModule", ({
  2177. value: true
  2178. }));
  2179. exports.BaseStream = void 0;
  2180. var _util = __w_pdfjs_require__(2);
  2181. class BaseStream {
  2182. constructor() {
  2183. if (this.constructor === BaseStream) {
  2184. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2185. }
  2186. }
  2187. get length() {
  2188. (0, _util.unreachable)("Abstract getter `length` accessed");
  2189. }
  2190. get isEmpty() {
  2191. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2192. }
  2193. get isDataLoaded() {
  2194. return (0, _util.shadow)(this, "isDataLoaded", true);
  2195. }
  2196. getByte() {
  2197. (0, _util.unreachable)("Abstract method `getByte` called");
  2198. }
  2199. getBytes(length) {
  2200. (0, _util.unreachable)("Abstract method `getBytes` called");
  2201. }
  2202. peekByte() {
  2203. const peekedByte = this.getByte();
  2204. if (peekedByte !== -1) {
  2205. this.pos--;
  2206. }
  2207. return peekedByte;
  2208. }
  2209. peekBytes(length) {
  2210. const bytes = this.getBytes(length);
  2211. this.pos -= bytes.length;
  2212. return bytes;
  2213. }
  2214. getUint16() {
  2215. const b0 = this.getByte();
  2216. const b1 = this.getByte();
  2217. if (b0 === -1 || b1 === -1) {
  2218. return -1;
  2219. }
  2220. return (b0 << 8) + b1;
  2221. }
  2222. getInt32() {
  2223. const b0 = this.getByte();
  2224. const b1 = this.getByte();
  2225. const b2 = this.getByte();
  2226. const b3 = this.getByte();
  2227. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2228. }
  2229. getByteRange(begin, end) {
  2230. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2231. }
  2232. getString(length) {
  2233. return (0, _util.bytesToString)(this.getBytes(length));
  2234. }
  2235. skip(n) {
  2236. this.pos += n || 1;
  2237. }
  2238. reset() {
  2239. (0, _util.unreachable)("Abstract method `reset` called");
  2240. }
  2241. moveStart() {
  2242. (0, _util.unreachable)("Abstract method `moveStart` called");
  2243. }
  2244. makeSubStream(start, length, dict = null) {
  2245. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2246. }
  2247. getBaseStreams() {
  2248. return null;
  2249. }
  2250. }
  2251. exports.BaseStream = BaseStream;
  2252. /***/ }),
  2253. /* 6 */
  2254. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2255. Object.defineProperty(exports, "__esModule", ({
  2256. value: true
  2257. }));
  2258. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  2259. var _util = __w_pdfjs_require__(2);
  2260. var _chunked_stream = __w_pdfjs_require__(7);
  2261. var _core_utils = __w_pdfjs_require__(4);
  2262. var _document = __w_pdfjs_require__(9);
  2263. var _stream = __w_pdfjs_require__(8);
  2264. function parseDocBaseUrl(url) {
  2265. if (url) {
  2266. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  2267. if (absoluteUrl) {
  2268. return absoluteUrl.href;
  2269. }
  2270. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  2271. }
  2272. return null;
  2273. }
  2274. class BasePdfManager {
  2275. constructor() {
  2276. if (this.constructor === BasePdfManager) {
  2277. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  2278. }
  2279. }
  2280. get docId() {
  2281. return this._docId;
  2282. }
  2283. get password() {
  2284. return this._password;
  2285. }
  2286. get docBaseUrl() {
  2287. const catalog = this.pdfDocument.catalog;
  2288. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  2289. }
  2290. ensureDoc(prop, args) {
  2291. return this.ensure(this.pdfDocument, prop, args);
  2292. }
  2293. ensureXRef(prop, args) {
  2294. return this.ensure(this.pdfDocument.xref, prop, args);
  2295. }
  2296. ensureCatalog(prop, args) {
  2297. return this.ensure(this.pdfDocument.catalog, prop, args);
  2298. }
  2299. getPage(pageIndex) {
  2300. return this.pdfDocument.getPage(pageIndex);
  2301. }
  2302. fontFallback(id, handler) {
  2303. return this.pdfDocument.fontFallback(id, handler);
  2304. }
  2305. loadXfaFonts(handler, task) {
  2306. return this.pdfDocument.loadXfaFonts(handler, task);
  2307. }
  2308. loadXfaImages() {
  2309. return this.pdfDocument.loadXfaImages();
  2310. }
  2311. serializeXfaData(annotationStorage) {
  2312. return this.pdfDocument.serializeXfaData(annotationStorage);
  2313. }
  2314. cleanup(manuallyTriggered = false) {
  2315. return this.pdfDocument.cleanup(manuallyTriggered);
  2316. }
  2317. async ensure(obj, prop, args) {
  2318. (0, _util.unreachable)("Abstract method `ensure` called");
  2319. }
  2320. requestRange(begin, end) {
  2321. (0, _util.unreachable)("Abstract method `requestRange` called");
  2322. }
  2323. requestLoadedStream(noFetch = false) {
  2324. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  2325. }
  2326. sendProgressiveData(chunk) {
  2327. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  2328. }
  2329. updatePassword(password) {
  2330. this._password = password;
  2331. }
  2332. terminate(reason) {
  2333. (0, _util.unreachable)("Abstract method `terminate` called");
  2334. }
  2335. }
  2336. class LocalPdfManager extends BasePdfManager {
  2337. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  2338. super();
  2339. this._docId = docId;
  2340. this._password = password;
  2341. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2342. this.msgHandler = msgHandler;
  2343. this.evaluatorOptions = evaluatorOptions;
  2344. this.enableXfa = enableXfa;
  2345. const stream = new _stream.Stream(data);
  2346. this.pdfDocument = new _document.PDFDocument(this, stream);
  2347. this._loadedStreamPromise = Promise.resolve(stream);
  2348. }
  2349. async ensure(obj, prop, args) {
  2350. const value = obj[prop];
  2351. if (typeof value === "function") {
  2352. return value.apply(obj, args);
  2353. }
  2354. return value;
  2355. }
  2356. requestRange(begin, end) {
  2357. return Promise.resolve();
  2358. }
  2359. requestLoadedStream(noFetch = false) {
  2360. return this._loadedStreamPromise;
  2361. }
  2362. terminate(reason) {}
  2363. }
  2364. exports.LocalPdfManager = LocalPdfManager;
  2365. class NetworkPdfManager extends BasePdfManager {
  2366. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  2367. super();
  2368. this._docId = docId;
  2369. this._password = args.password;
  2370. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2371. this.msgHandler = args.msgHandler;
  2372. this.evaluatorOptions = evaluatorOptions;
  2373. this.enableXfa = enableXfa;
  2374. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  2375. msgHandler: args.msgHandler,
  2376. length: args.length,
  2377. disableAutoFetch: args.disableAutoFetch,
  2378. rangeChunkSize: args.rangeChunkSize
  2379. });
  2380. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  2381. }
  2382. async ensure(obj, prop, args) {
  2383. try {
  2384. const value = obj[prop];
  2385. if (typeof value === "function") {
  2386. return value.apply(obj, args);
  2387. }
  2388. return value;
  2389. } catch (ex) {
  2390. if (!(ex instanceof _core_utils.MissingDataException)) {
  2391. throw ex;
  2392. }
  2393. await this.requestRange(ex.begin, ex.end);
  2394. return this.ensure(obj, prop, args);
  2395. }
  2396. }
  2397. requestRange(begin, end) {
  2398. return this.streamManager.requestRange(begin, end);
  2399. }
  2400. requestLoadedStream(noFetch = false) {
  2401. return this.streamManager.requestAllChunks(noFetch);
  2402. }
  2403. sendProgressiveData(chunk) {
  2404. this.streamManager.onReceiveData({
  2405. chunk
  2406. });
  2407. }
  2408. terminate(reason) {
  2409. this.streamManager.abort(reason);
  2410. }
  2411. }
  2412. exports.NetworkPdfManager = NetworkPdfManager;
  2413. /***/ }),
  2414. /* 7 */
  2415. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2416. Object.defineProperty(exports, "__esModule", ({
  2417. value: true
  2418. }));
  2419. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2420. var _util = __w_pdfjs_require__(2);
  2421. var _core_utils = __w_pdfjs_require__(4);
  2422. var _stream = __w_pdfjs_require__(8);
  2423. class ChunkedStream extends _stream.Stream {
  2424. constructor(length, chunkSize, manager) {
  2425. super(new Uint8Array(length), 0, length, null);
  2426. this.chunkSize = chunkSize;
  2427. this._loadedChunks = new Set();
  2428. this.numChunks = Math.ceil(length / chunkSize);
  2429. this.manager = manager;
  2430. this.progressiveDataLength = 0;
  2431. this.lastSuccessfulEnsureByteChunk = -1;
  2432. }
  2433. getMissingChunks() {
  2434. const chunks = [];
  2435. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2436. if (!this._loadedChunks.has(chunk)) {
  2437. chunks.push(chunk);
  2438. }
  2439. }
  2440. return chunks;
  2441. }
  2442. get numChunksLoaded() {
  2443. return this._loadedChunks.size;
  2444. }
  2445. get isDataLoaded() {
  2446. return this.numChunksLoaded === this.numChunks;
  2447. }
  2448. onReceiveData(begin, chunk) {
  2449. const chunkSize = this.chunkSize;
  2450. if (begin % chunkSize !== 0) {
  2451. throw new Error(`Bad begin offset: ${begin}`);
  2452. }
  2453. const end = begin + chunk.byteLength;
  2454. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2455. throw new Error(`Bad end offset: ${end}`);
  2456. }
  2457. this.bytes.set(new Uint8Array(chunk), begin);
  2458. const beginChunk = Math.floor(begin / chunkSize);
  2459. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2460. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2461. this._loadedChunks.add(curChunk);
  2462. }
  2463. }
  2464. onReceiveProgressiveData(data) {
  2465. let position = this.progressiveDataLength;
  2466. const beginChunk = Math.floor(position / this.chunkSize);
  2467. this.bytes.set(new Uint8Array(data), position);
  2468. position += data.byteLength;
  2469. this.progressiveDataLength = position;
  2470. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2471. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2472. this._loadedChunks.add(curChunk);
  2473. }
  2474. }
  2475. ensureByte(pos) {
  2476. if (pos < this.progressiveDataLength) {
  2477. return;
  2478. }
  2479. const chunk = Math.floor(pos / this.chunkSize);
  2480. if (chunk > this.numChunks) {
  2481. return;
  2482. }
  2483. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2484. return;
  2485. }
  2486. if (!this._loadedChunks.has(chunk)) {
  2487. throw new _core_utils.MissingDataException(pos, pos + 1);
  2488. }
  2489. this.lastSuccessfulEnsureByteChunk = chunk;
  2490. }
  2491. ensureRange(begin, end) {
  2492. if (begin >= end) {
  2493. return;
  2494. }
  2495. if (end <= this.progressiveDataLength) {
  2496. return;
  2497. }
  2498. const beginChunk = Math.floor(begin / this.chunkSize);
  2499. if (beginChunk > this.numChunks) {
  2500. return;
  2501. }
  2502. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2503. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2504. if (!this._loadedChunks.has(chunk)) {
  2505. throw new _core_utils.MissingDataException(begin, end);
  2506. }
  2507. }
  2508. }
  2509. nextEmptyChunk(beginChunk) {
  2510. const numChunks = this.numChunks;
  2511. for (let i = 0; i < numChunks; ++i) {
  2512. const chunk = (beginChunk + i) % numChunks;
  2513. if (!this._loadedChunks.has(chunk)) {
  2514. return chunk;
  2515. }
  2516. }
  2517. return null;
  2518. }
  2519. hasChunk(chunk) {
  2520. return this._loadedChunks.has(chunk);
  2521. }
  2522. getByte() {
  2523. const pos = this.pos;
  2524. if (pos >= this.end) {
  2525. return -1;
  2526. }
  2527. if (pos >= this.progressiveDataLength) {
  2528. this.ensureByte(pos);
  2529. }
  2530. return this.bytes[this.pos++];
  2531. }
  2532. getBytes(length) {
  2533. const bytes = this.bytes;
  2534. const pos = this.pos;
  2535. const strEnd = this.end;
  2536. if (!length) {
  2537. if (strEnd > this.progressiveDataLength) {
  2538. this.ensureRange(pos, strEnd);
  2539. }
  2540. return bytes.subarray(pos, strEnd);
  2541. }
  2542. let end = pos + length;
  2543. if (end > strEnd) {
  2544. end = strEnd;
  2545. }
  2546. if (end > this.progressiveDataLength) {
  2547. this.ensureRange(pos, end);
  2548. }
  2549. this.pos = end;
  2550. return bytes.subarray(pos, end);
  2551. }
  2552. getByteRange(begin, end) {
  2553. if (begin < 0) {
  2554. begin = 0;
  2555. }
  2556. if (end > this.end) {
  2557. end = this.end;
  2558. }
  2559. if (end > this.progressiveDataLength) {
  2560. this.ensureRange(begin, end);
  2561. }
  2562. return this.bytes.subarray(begin, end);
  2563. }
  2564. makeSubStream(start, length, dict = null) {
  2565. if (length) {
  2566. if (start + length > this.progressiveDataLength) {
  2567. this.ensureRange(start, start + length);
  2568. }
  2569. } else {
  2570. if (start >= this.progressiveDataLength) {
  2571. this.ensureByte(start);
  2572. }
  2573. }
  2574. function ChunkedStreamSubstream() {}
  2575. ChunkedStreamSubstream.prototype = Object.create(this);
  2576. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2577. const chunkSize = this.chunkSize;
  2578. const beginChunk = Math.floor(this.start / chunkSize);
  2579. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2580. const missingChunks = [];
  2581. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2582. if (!this._loadedChunks.has(chunk)) {
  2583. missingChunks.push(chunk);
  2584. }
  2585. }
  2586. return missingChunks;
  2587. };
  2588. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2589. get() {
  2590. if (this.numChunksLoaded === this.numChunks) {
  2591. return true;
  2592. }
  2593. return this.getMissingChunks().length === 0;
  2594. },
  2595. configurable: true
  2596. });
  2597. const subStream = new ChunkedStreamSubstream();
  2598. subStream.pos = subStream.start = start;
  2599. subStream.end = start + length || this.end;
  2600. subStream.dict = dict;
  2601. return subStream;
  2602. }
  2603. getBaseStreams() {
  2604. return [this];
  2605. }
  2606. }
  2607. exports.ChunkedStream = ChunkedStream;
  2608. class ChunkedStreamManager {
  2609. constructor(pdfNetworkStream, args) {
  2610. this.length = args.length;
  2611. this.chunkSize = args.rangeChunkSize;
  2612. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2613. this.pdfNetworkStream = pdfNetworkStream;
  2614. this.disableAutoFetch = args.disableAutoFetch;
  2615. this.msgHandler = args.msgHandler;
  2616. this.currRequestId = 0;
  2617. this._chunksNeededByRequest = new Map();
  2618. this._requestsByChunk = new Map();
  2619. this._promisesByRequest = new Map();
  2620. this.progressiveDataLength = 0;
  2621. this.aborted = false;
  2622. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2623. }
  2624. sendRequest(begin, end) {
  2625. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2626. if (!rangeReader.isStreamingSupported) {
  2627. rangeReader.onProgress = this.onProgress.bind(this);
  2628. }
  2629. let chunks = [],
  2630. loaded = 0;
  2631. return new Promise((resolve, reject) => {
  2632. const readChunk = chunk => {
  2633. try {
  2634. if (!chunk.done) {
  2635. const data = chunk.value;
  2636. chunks.push(data);
  2637. loaded += (0, _util.arrayByteLength)(data);
  2638. if (rangeReader.isStreamingSupported) {
  2639. this.onProgress({
  2640. loaded
  2641. });
  2642. }
  2643. rangeReader.read().then(readChunk, reject);
  2644. return;
  2645. }
  2646. const chunkData = (0, _util.arraysToBytes)(chunks);
  2647. chunks = null;
  2648. resolve(chunkData);
  2649. } catch (e) {
  2650. reject(e);
  2651. }
  2652. };
  2653. rangeReader.read().then(readChunk, reject);
  2654. }).then(data => {
  2655. if (this.aborted) {
  2656. return;
  2657. }
  2658. this.onReceiveData({
  2659. chunk: data,
  2660. begin
  2661. });
  2662. });
  2663. }
  2664. requestAllChunks(noFetch = false) {
  2665. if (!noFetch) {
  2666. const missingChunks = this.stream.getMissingChunks();
  2667. this._requestChunks(missingChunks);
  2668. }
  2669. return this._loadedStreamCapability.promise;
  2670. }
  2671. _requestChunks(chunks) {
  2672. const requestId = this.currRequestId++;
  2673. const chunksNeeded = new Set();
  2674. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2675. for (const chunk of chunks) {
  2676. if (!this.stream.hasChunk(chunk)) {
  2677. chunksNeeded.add(chunk);
  2678. }
  2679. }
  2680. if (chunksNeeded.size === 0) {
  2681. return Promise.resolve();
  2682. }
  2683. const capability = (0, _util.createPromiseCapability)();
  2684. this._promisesByRequest.set(requestId, capability);
  2685. const chunksToRequest = [];
  2686. for (const chunk of chunksNeeded) {
  2687. let requestIds = this._requestsByChunk.get(chunk);
  2688. if (!requestIds) {
  2689. requestIds = [];
  2690. this._requestsByChunk.set(chunk, requestIds);
  2691. chunksToRequest.push(chunk);
  2692. }
  2693. requestIds.push(requestId);
  2694. }
  2695. if (chunksToRequest.length > 0) {
  2696. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2697. for (const groupedChunk of groupedChunksToRequest) {
  2698. const begin = groupedChunk.beginChunk * this.chunkSize;
  2699. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2700. this.sendRequest(begin, end).catch(capability.reject);
  2701. }
  2702. }
  2703. return capability.promise.catch(reason => {
  2704. if (this.aborted) {
  2705. return;
  2706. }
  2707. throw reason;
  2708. });
  2709. }
  2710. getStream() {
  2711. return this.stream;
  2712. }
  2713. requestRange(begin, end) {
  2714. end = Math.min(end, this.length);
  2715. const beginChunk = this.getBeginChunk(begin);
  2716. const endChunk = this.getEndChunk(end);
  2717. const chunks = [];
  2718. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2719. chunks.push(chunk);
  2720. }
  2721. return this._requestChunks(chunks);
  2722. }
  2723. requestRanges(ranges = []) {
  2724. const chunksToRequest = [];
  2725. for (const range of ranges) {
  2726. const beginChunk = this.getBeginChunk(range.begin);
  2727. const endChunk = this.getEndChunk(range.end);
  2728. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2729. if (!chunksToRequest.includes(chunk)) {
  2730. chunksToRequest.push(chunk);
  2731. }
  2732. }
  2733. }
  2734. chunksToRequest.sort(function (a, b) {
  2735. return a - b;
  2736. });
  2737. return this._requestChunks(chunksToRequest);
  2738. }
  2739. groupChunks(chunks) {
  2740. const groupedChunks = [];
  2741. let beginChunk = -1;
  2742. let prevChunk = -1;
  2743. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2744. const chunk = chunks[i];
  2745. if (beginChunk < 0) {
  2746. beginChunk = chunk;
  2747. }
  2748. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2749. groupedChunks.push({
  2750. beginChunk,
  2751. endChunk: prevChunk + 1
  2752. });
  2753. beginChunk = chunk;
  2754. }
  2755. if (i + 1 === chunks.length) {
  2756. groupedChunks.push({
  2757. beginChunk,
  2758. endChunk: chunk + 1
  2759. });
  2760. }
  2761. prevChunk = chunk;
  2762. }
  2763. return groupedChunks;
  2764. }
  2765. onProgress(args) {
  2766. this.msgHandler.send("DocProgress", {
  2767. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2768. total: this.length
  2769. });
  2770. }
  2771. onReceiveData(args) {
  2772. const chunk = args.chunk;
  2773. const isProgressive = args.begin === undefined;
  2774. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2775. const end = begin + chunk.byteLength;
  2776. const beginChunk = Math.floor(begin / this.chunkSize);
  2777. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2778. if (isProgressive) {
  2779. this.stream.onReceiveProgressiveData(chunk);
  2780. this.progressiveDataLength = end;
  2781. } else {
  2782. this.stream.onReceiveData(begin, chunk);
  2783. }
  2784. if (this.stream.isDataLoaded) {
  2785. this._loadedStreamCapability.resolve(this.stream);
  2786. }
  2787. const loadedRequests = [];
  2788. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2789. const requestIds = this._requestsByChunk.get(curChunk);
  2790. if (!requestIds) {
  2791. continue;
  2792. }
  2793. this._requestsByChunk.delete(curChunk);
  2794. for (const requestId of requestIds) {
  2795. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2796. if (chunksNeeded.has(curChunk)) {
  2797. chunksNeeded.delete(curChunk);
  2798. }
  2799. if (chunksNeeded.size > 0) {
  2800. continue;
  2801. }
  2802. loadedRequests.push(requestId);
  2803. }
  2804. }
  2805. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2806. let nextEmptyChunk;
  2807. if (this.stream.numChunksLoaded === 1) {
  2808. const lastChunk = this.stream.numChunks - 1;
  2809. if (!this.stream.hasChunk(lastChunk)) {
  2810. nextEmptyChunk = lastChunk;
  2811. }
  2812. } else {
  2813. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2814. }
  2815. if (Number.isInteger(nextEmptyChunk)) {
  2816. this._requestChunks([nextEmptyChunk]);
  2817. }
  2818. }
  2819. for (const requestId of loadedRequests) {
  2820. const capability = this._promisesByRequest.get(requestId);
  2821. this._promisesByRequest.delete(requestId);
  2822. capability.resolve();
  2823. }
  2824. this.msgHandler.send("DocProgress", {
  2825. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2826. total: this.length
  2827. });
  2828. }
  2829. onError(err) {
  2830. this._loadedStreamCapability.reject(err);
  2831. }
  2832. getBeginChunk(begin) {
  2833. return Math.floor(begin / this.chunkSize);
  2834. }
  2835. getEndChunk(end) {
  2836. return Math.floor((end - 1) / this.chunkSize) + 1;
  2837. }
  2838. abort(reason) {
  2839. this.aborted = true;
  2840. if (this.pdfNetworkStream) {
  2841. this.pdfNetworkStream.cancelAllRequests(reason);
  2842. }
  2843. for (const capability of this._promisesByRequest.values()) {
  2844. capability.reject(reason);
  2845. }
  2846. }
  2847. }
  2848. exports.ChunkedStreamManager = ChunkedStreamManager;
  2849. /***/ }),
  2850. /* 8 */
  2851. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2852. Object.defineProperty(exports, "__esModule", ({
  2853. value: true
  2854. }));
  2855. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2856. var _base_stream = __w_pdfjs_require__(5);
  2857. var _util = __w_pdfjs_require__(2);
  2858. class Stream extends _base_stream.BaseStream {
  2859. constructor(arrayBuffer, start, length, dict) {
  2860. super();
  2861. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2862. this.start = start || 0;
  2863. this.pos = this.start;
  2864. this.end = start + length || this.bytes.length;
  2865. this.dict = dict;
  2866. }
  2867. get length() {
  2868. return this.end - this.start;
  2869. }
  2870. get isEmpty() {
  2871. return this.length === 0;
  2872. }
  2873. getByte() {
  2874. if (this.pos >= this.end) {
  2875. return -1;
  2876. }
  2877. return this.bytes[this.pos++];
  2878. }
  2879. getBytes(length) {
  2880. const bytes = this.bytes;
  2881. const pos = this.pos;
  2882. const strEnd = this.end;
  2883. if (!length) {
  2884. return bytes.subarray(pos, strEnd);
  2885. }
  2886. let end = pos + length;
  2887. if (end > strEnd) {
  2888. end = strEnd;
  2889. }
  2890. this.pos = end;
  2891. return bytes.subarray(pos, end);
  2892. }
  2893. getByteRange(begin, end) {
  2894. if (begin < 0) {
  2895. begin = 0;
  2896. }
  2897. if (end > this.end) {
  2898. end = this.end;
  2899. }
  2900. return this.bytes.subarray(begin, end);
  2901. }
  2902. reset() {
  2903. this.pos = this.start;
  2904. }
  2905. moveStart() {
  2906. this.start = this.pos;
  2907. }
  2908. makeSubStream(start, length, dict = null) {
  2909. return new Stream(this.bytes.buffer, start, length, dict);
  2910. }
  2911. }
  2912. exports.Stream = Stream;
  2913. class StringStream extends Stream {
  2914. constructor(str) {
  2915. super((0, _util.stringToBytes)(str));
  2916. }
  2917. }
  2918. exports.StringStream = StringStream;
  2919. class NullStream extends Stream {
  2920. constructor() {
  2921. super(new Uint8Array(0));
  2922. }
  2923. }
  2924. exports.NullStream = NullStream;
  2925. /***/ }),
  2926. /* 9 */
  2927. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2928. Object.defineProperty(exports, "__esModule", ({
  2929. value: true
  2930. }));
  2931. exports.Page = exports.PDFDocument = void 0;
  2932. var _annotation = __w_pdfjs_require__(10);
  2933. var _util = __w_pdfjs_require__(2);
  2934. var _core_utils = __w_pdfjs_require__(4);
  2935. var _primitives = __w_pdfjs_require__(3);
  2936. var _xfa_fonts = __w_pdfjs_require__(49);
  2937. var _base_stream = __w_pdfjs_require__(5);
  2938. var _crypto = __w_pdfjs_require__(65);
  2939. var _catalog = __w_pdfjs_require__(67);
  2940. var _cleanup_helper = __w_pdfjs_require__(69);
  2941. var _dataset_reader = __w_pdfjs_require__(98);
  2942. var _parser = __w_pdfjs_require__(15);
  2943. var _stream = __w_pdfjs_require__(8);
  2944. var _object_loader = __w_pdfjs_require__(73);
  2945. var _operator_list = __w_pdfjs_require__(60);
  2946. var _evaluator = __w_pdfjs_require__(13);
  2947. var _decode_stream = __w_pdfjs_require__(17);
  2948. var _struct_tree = __w_pdfjs_require__(72);
  2949. var _writer = __w_pdfjs_require__(63);
  2950. var _factory = __w_pdfjs_require__(74);
  2951. var _xref = __w_pdfjs_require__(99);
  2952. const DEFAULT_USER_UNIT = 1.0;
  2953. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2954. class Page {
  2955. constructor({
  2956. pdfManager,
  2957. xref,
  2958. pageIndex,
  2959. pageDict,
  2960. ref,
  2961. globalIdFactory,
  2962. fontCache,
  2963. builtInCMapCache,
  2964. standardFontDataCache,
  2965. globalImageCache,
  2966. nonBlendModesSet,
  2967. xfaFactory
  2968. }) {
  2969. this.pdfManager = pdfManager;
  2970. this.pageIndex = pageIndex;
  2971. this.pageDict = pageDict;
  2972. this.xref = xref;
  2973. this.ref = ref;
  2974. this.fontCache = fontCache;
  2975. this.builtInCMapCache = builtInCMapCache;
  2976. this.standardFontDataCache = standardFontDataCache;
  2977. this.globalImageCache = globalImageCache;
  2978. this.nonBlendModesSet = nonBlendModesSet;
  2979. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2980. this.resourcesPromise = null;
  2981. this.xfaFactory = xfaFactory;
  2982. const idCounters = {
  2983. obj: 0
  2984. };
  2985. this._localIdFactory = class extends globalIdFactory {
  2986. static createObjId() {
  2987. return `p${pageIndex}_${++idCounters.obj}`;
  2988. }
  2989. static getPageObjId() {
  2990. return `page${ref.toString()}`;
  2991. }
  2992. };
  2993. }
  2994. _getInheritableProperty(key, getArray = false) {
  2995. const value = (0, _core_utils.getInheritableProperty)({
  2996. dict: this.pageDict,
  2997. key,
  2998. getArray,
  2999. stopWhenFound: false
  3000. });
  3001. if (!Array.isArray(value)) {
  3002. return value;
  3003. }
  3004. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  3005. return value[0];
  3006. }
  3007. return _primitives.Dict.merge({
  3008. xref: this.xref,
  3009. dictArray: value
  3010. });
  3011. }
  3012. get content() {
  3013. return this.pageDict.getArray("Contents");
  3014. }
  3015. get resources() {
  3016. const resources = this._getInheritableProperty("Resources");
  3017. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  3018. }
  3019. _getBoundingBox(name) {
  3020. if (this.xfaData) {
  3021. return this.xfaData.bbox;
  3022. }
  3023. let box = this._getInheritableProperty(name, true);
  3024. if (Array.isArray(box) && box.length === 4) {
  3025. box = _util.Util.normalizeRect(box);
  3026. if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  3027. return box;
  3028. }
  3029. (0, _util.warn)(`Empty, or invalid, /${name} entry.`);
  3030. }
  3031. return null;
  3032. }
  3033. get mediaBox() {
  3034. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3035. }
  3036. get cropBox() {
  3037. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3038. }
  3039. get userUnit() {
  3040. let obj = this.pageDict.get("UserUnit");
  3041. if (typeof obj !== "number" || obj <= 0) {
  3042. obj = DEFAULT_USER_UNIT;
  3043. }
  3044. return (0, _util.shadow)(this, "userUnit", obj);
  3045. }
  3046. get view() {
  3047. const {
  3048. cropBox,
  3049. mediaBox
  3050. } = this;
  3051. if (cropBox !== mediaBox && !(0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3052. const box = _util.Util.intersect(cropBox, mediaBox);
  3053. if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  3054. return (0, _util.shadow)(this, "view", box);
  3055. }
  3056. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3057. }
  3058. return (0, _util.shadow)(this, "view", mediaBox);
  3059. }
  3060. get rotate() {
  3061. let rotate = this._getInheritableProperty("Rotate") || 0;
  3062. if (rotate % 90 !== 0) {
  3063. rotate = 0;
  3064. } else if (rotate >= 360) {
  3065. rotate %= 360;
  3066. } else if (rotate < 0) {
  3067. rotate = (rotate % 360 + 360) % 360;
  3068. }
  3069. return (0, _util.shadow)(this, "rotate", rotate);
  3070. }
  3071. _onSubStreamError(handler, reason, objId) {
  3072. if (this.evaluatorOptions.ignoreErrors) {
  3073. handler.send("UnsupportedFeature", {
  3074. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3075. });
  3076. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3077. return;
  3078. }
  3079. throw reason;
  3080. }
  3081. getContentStream(handler) {
  3082. return this.pdfManager.ensure(this, "content").then(content => {
  3083. if (content instanceof _base_stream.BaseStream) {
  3084. return content;
  3085. }
  3086. if (Array.isArray(content)) {
  3087. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3088. }
  3089. return new _stream.NullStream();
  3090. });
  3091. }
  3092. get xfaData() {
  3093. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3094. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3095. } : null);
  3096. }
  3097. async saveNewAnnotations(handler, task, annotations) {
  3098. if (this.xfaFactory) {
  3099. throw new Error("XFA: Cannot save new annotations.");
  3100. }
  3101. const partialEvaluator = new _evaluator.PartialEvaluator({
  3102. xref: this.xref,
  3103. handler,
  3104. pageIndex: this.pageIndex,
  3105. idFactory: this._localIdFactory,
  3106. fontCache: this.fontCache,
  3107. builtInCMapCache: this.builtInCMapCache,
  3108. standardFontDataCache: this.standardFontDataCache,
  3109. globalImageCache: this.globalImageCache,
  3110. options: this.evaluatorOptions
  3111. });
  3112. const pageDict = this.pageDict;
  3113. const annotationsArray = this.annotations.slice();
  3114. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  3115. for (const {
  3116. ref
  3117. } of newData.annotations) {
  3118. annotationsArray.push(ref);
  3119. }
  3120. const savedDict = pageDict.get("Annots");
  3121. pageDict.set("Annots", annotationsArray);
  3122. const buffer = [];
  3123. let transform = null;
  3124. if (this.xref.encrypt) {
  3125. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  3126. }
  3127. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  3128. if (savedDict) {
  3129. pageDict.set("Annots", savedDict);
  3130. }
  3131. const objects = newData.dependencies;
  3132. objects.push({
  3133. ref: this.ref,
  3134. data: buffer.join("")
  3135. }, ...newData.annotations);
  3136. return objects;
  3137. }
  3138. save(handler, task, annotationStorage) {
  3139. const partialEvaluator = new _evaluator.PartialEvaluator({
  3140. xref: this.xref,
  3141. handler,
  3142. pageIndex: this.pageIndex,
  3143. idFactory: this._localIdFactory,
  3144. fontCache: this.fontCache,
  3145. builtInCMapCache: this.builtInCMapCache,
  3146. standardFontDataCache: this.standardFontDataCache,
  3147. globalImageCache: this.globalImageCache,
  3148. options: this.evaluatorOptions
  3149. });
  3150. return this._parsedAnnotations.then(function (annotations) {
  3151. const newRefsPromises = [];
  3152. for (const annotation of annotations) {
  3153. if (!annotation.mustBePrinted(annotationStorage)) {
  3154. continue;
  3155. }
  3156. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3157. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3158. return null;
  3159. }));
  3160. }
  3161. return Promise.all(newRefsPromises).then(function (newRefs) {
  3162. return newRefs.filter(newRef => !!newRef);
  3163. });
  3164. });
  3165. }
  3166. loadResources(keys) {
  3167. if (!this.resourcesPromise) {
  3168. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3169. }
  3170. return this.resourcesPromise.then(() => {
  3171. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3172. return objectLoader.load();
  3173. });
  3174. }
  3175. getOperatorList({
  3176. handler,
  3177. sink,
  3178. task,
  3179. intent,
  3180. cacheKey,
  3181. annotationStorage = null
  3182. }) {
  3183. const contentStreamPromise = this.getContentStream(handler);
  3184. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3185. const partialEvaluator = new _evaluator.PartialEvaluator({
  3186. xref: this.xref,
  3187. handler,
  3188. pageIndex: this.pageIndex,
  3189. idFactory: this._localIdFactory,
  3190. fontCache: this.fontCache,
  3191. builtInCMapCache: this.builtInCMapCache,
  3192. standardFontDataCache: this.standardFontDataCache,
  3193. globalImageCache: this.globalImageCache,
  3194. options: this.evaluatorOptions
  3195. });
  3196. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  3197. let newAnnotationsPromise = Promise.resolve(null);
  3198. if (newAnnotationsByPage) {
  3199. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  3200. if (newAnnotations) {
  3201. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  3202. }
  3203. }
  3204. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3205. const pageListPromise = dataPromises.then(([contentStream]) => {
  3206. const opList = new _operator_list.OperatorList(intent, sink);
  3207. handler.send("StartRenderPage", {
  3208. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3209. pageIndex: this.pageIndex,
  3210. cacheKey
  3211. });
  3212. return partialEvaluator.getOperatorList({
  3213. stream: contentStream,
  3214. task,
  3215. resources: this.resources,
  3216. operatorList: opList
  3217. }).then(function () {
  3218. return opList;
  3219. });
  3220. });
  3221. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
  3222. if (newAnnotations) {
  3223. annotations = annotations.concat(newAnnotations);
  3224. }
  3225. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3226. pageOpList.flush(true);
  3227. return {
  3228. length: pageOpList.totalLength
  3229. };
  3230. }
  3231. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3232. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3233. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3234. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3235. const opListPromises = [];
  3236. for (const annotation of annotations) {
  3237. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3238. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3239. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3240. return {
  3241. opList: null,
  3242. separateForm: false,
  3243. separateCanvas: false
  3244. };
  3245. }));
  3246. }
  3247. }
  3248. return Promise.all(opListPromises).then(function (opLists) {
  3249. let form = false,
  3250. canvas = false;
  3251. for (const {
  3252. opList,
  3253. separateForm,
  3254. separateCanvas
  3255. } of opLists) {
  3256. pageOpList.addOpList(opList);
  3257. if (separateForm) {
  3258. form = separateForm;
  3259. }
  3260. if (separateCanvas) {
  3261. canvas = separateCanvas;
  3262. }
  3263. }
  3264. pageOpList.flush(true, {
  3265. form,
  3266. canvas
  3267. });
  3268. return {
  3269. length: pageOpList.totalLength
  3270. };
  3271. });
  3272. });
  3273. }
  3274. extractTextContent({
  3275. handler,
  3276. task,
  3277. includeMarkedContent,
  3278. sink,
  3279. combineTextItems
  3280. }) {
  3281. const contentStreamPromise = this.getContentStream(handler);
  3282. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3283. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3284. return dataPromises.then(([contentStream]) => {
  3285. const partialEvaluator = new _evaluator.PartialEvaluator({
  3286. xref: this.xref,
  3287. handler,
  3288. pageIndex: this.pageIndex,
  3289. idFactory: this._localIdFactory,
  3290. fontCache: this.fontCache,
  3291. builtInCMapCache: this.builtInCMapCache,
  3292. standardFontDataCache: this.standardFontDataCache,
  3293. globalImageCache: this.globalImageCache,
  3294. options: this.evaluatorOptions
  3295. });
  3296. return partialEvaluator.getTextContent({
  3297. stream: contentStream,
  3298. task,
  3299. resources: this.resources,
  3300. includeMarkedContent,
  3301. combineTextItems,
  3302. sink,
  3303. viewBox: this.view
  3304. });
  3305. });
  3306. }
  3307. async getStructTree() {
  3308. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3309. if (!structTreeRoot) {
  3310. return null;
  3311. }
  3312. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3313. return structTree.serializable;
  3314. }
  3315. _parseStructTree(structTreeRoot) {
  3316. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3317. tree.parse();
  3318. return tree;
  3319. }
  3320. async getAnnotationsData(handler, task, intent) {
  3321. const annotations = await this._parsedAnnotations;
  3322. if (annotations.length === 0) {
  3323. return [];
  3324. }
  3325. const textContentPromises = [];
  3326. const annotationsData = [];
  3327. let partialEvaluator;
  3328. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3329. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3330. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3331. for (const annotation of annotations) {
  3332. const isVisible = intentAny || intentDisplay && annotation.viewable;
  3333. if (isVisible || intentPrint && annotation.printable) {
  3334. annotationsData.push(annotation.data);
  3335. }
  3336. if (annotation.hasTextContent && isVisible) {
  3337. if (!partialEvaluator) {
  3338. partialEvaluator = new _evaluator.PartialEvaluator({
  3339. xref: this.xref,
  3340. handler,
  3341. pageIndex: this.pageIndex,
  3342. idFactory: this._localIdFactory,
  3343. fontCache: this.fontCache,
  3344. builtInCMapCache: this.builtInCMapCache,
  3345. standardFontDataCache: this.standardFontDataCache,
  3346. globalImageCache: this.globalImageCache,
  3347. options: this.evaluatorOptions
  3348. });
  3349. }
  3350. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  3351. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  3352. }));
  3353. }
  3354. }
  3355. await Promise.all(textContentPromises);
  3356. return annotationsData;
  3357. }
  3358. get annotations() {
  3359. const annots = this._getInheritableProperty("Annots");
  3360. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3361. }
  3362. get _parsedAnnotations() {
  3363. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3364. const annotationPromises = [];
  3365. for (const annotationRef of this.annotations) {
  3366. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3367. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3368. return null;
  3369. }));
  3370. }
  3371. return Promise.all(annotationPromises).then(function (annotations) {
  3372. if (annotations.length === 0) {
  3373. return annotations;
  3374. }
  3375. const sortedAnnotations = [];
  3376. let popupAnnotations;
  3377. for (const annotation of annotations) {
  3378. if (!annotation) {
  3379. continue;
  3380. }
  3381. if (annotation instanceof _annotation.PopupAnnotation) {
  3382. if (!popupAnnotations) {
  3383. popupAnnotations = [];
  3384. }
  3385. popupAnnotations.push(annotation);
  3386. continue;
  3387. }
  3388. sortedAnnotations.push(annotation);
  3389. }
  3390. if (popupAnnotations) {
  3391. sortedAnnotations.push(...popupAnnotations);
  3392. }
  3393. return sortedAnnotations;
  3394. });
  3395. });
  3396. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3397. }
  3398. get jsActions() {
  3399. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3400. return (0, _util.shadow)(this, "jsActions", actions);
  3401. }
  3402. }
  3403. exports.Page = Page;
  3404. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3405. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3406. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3407. const FINGERPRINT_FIRST_BYTES = 1024;
  3408. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3409. function find(stream, signature, limit = 1024, backwards = false) {
  3410. const signatureLength = signature.length;
  3411. const scanBytes = stream.peekBytes(limit);
  3412. const scanLength = scanBytes.length - signatureLength;
  3413. if (scanLength <= 0) {
  3414. return false;
  3415. }
  3416. if (backwards) {
  3417. const signatureEnd = signatureLength - 1;
  3418. let pos = scanBytes.length - 1;
  3419. while (pos >= signatureEnd) {
  3420. let j = 0;
  3421. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3422. j++;
  3423. }
  3424. if (j >= signatureLength) {
  3425. stream.pos += pos - signatureEnd;
  3426. return true;
  3427. }
  3428. pos--;
  3429. }
  3430. } else {
  3431. let pos = 0;
  3432. while (pos <= scanLength) {
  3433. let j = 0;
  3434. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3435. j++;
  3436. }
  3437. if (j >= signatureLength) {
  3438. stream.pos += pos;
  3439. return true;
  3440. }
  3441. pos++;
  3442. }
  3443. }
  3444. return false;
  3445. }
  3446. class PDFDocument {
  3447. constructor(pdfManager, stream) {
  3448. if (stream.length <= 0) {
  3449. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3450. }
  3451. this.pdfManager = pdfManager;
  3452. this.stream = stream;
  3453. this.xref = new _xref.XRef(stream, pdfManager);
  3454. this._pagePromises = new Map();
  3455. this._version = null;
  3456. const idCounters = {
  3457. font: 0
  3458. };
  3459. this._globalIdFactory = class {
  3460. static getDocId() {
  3461. return `g_${pdfManager.docId}`;
  3462. }
  3463. static createFontId() {
  3464. return `f${++idCounters.font}`;
  3465. }
  3466. static createObjId() {
  3467. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3468. }
  3469. static getPageObjId() {
  3470. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3471. }
  3472. };
  3473. }
  3474. parse(recoveryMode) {
  3475. this.xref.parse(recoveryMode);
  3476. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3477. }
  3478. get linearization() {
  3479. let linearization = null;
  3480. try {
  3481. linearization = _parser.Linearization.create(this.stream);
  3482. } catch (err) {
  3483. if (err instanceof _core_utils.MissingDataException) {
  3484. throw err;
  3485. }
  3486. (0, _util.info)(err);
  3487. }
  3488. return (0, _util.shadow)(this, "linearization", linearization);
  3489. }
  3490. get startXRef() {
  3491. const stream = this.stream;
  3492. let startXRef = 0;
  3493. if (this.linearization) {
  3494. stream.reset();
  3495. if (find(stream, ENDOBJ_SIGNATURE)) {
  3496. startXRef = stream.pos + 6 - stream.start;
  3497. }
  3498. } else {
  3499. const step = 1024;
  3500. const startXRefLength = STARTXREF_SIGNATURE.length;
  3501. let found = false,
  3502. pos = stream.end;
  3503. while (!found && pos > 0) {
  3504. pos -= step - startXRefLength;
  3505. if (pos < 0) {
  3506. pos = 0;
  3507. }
  3508. stream.pos = pos;
  3509. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3510. }
  3511. if (found) {
  3512. stream.skip(9);
  3513. let ch;
  3514. do {
  3515. ch = stream.getByte();
  3516. } while ((0, _core_utils.isWhiteSpace)(ch));
  3517. let str = "";
  3518. while (ch >= 0x20 && ch <= 0x39) {
  3519. str += String.fromCharCode(ch);
  3520. ch = stream.getByte();
  3521. }
  3522. startXRef = parseInt(str, 10);
  3523. if (isNaN(startXRef)) {
  3524. startXRef = 0;
  3525. }
  3526. }
  3527. }
  3528. return (0, _util.shadow)(this, "startXRef", startXRef);
  3529. }
  3530. checkHeader() {
  3531. const stream = this.stream;
  3532. stream.reset();
  3533. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3534. return;
  3535. }
  3536. stream.moveStart();
  3537. stream.skip(PDF_HEADER_SIGNATURE.length);
  3538. let version = "",
  3539. ch;
  3540. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  3541. version += String.fromCharCode(ch);
  3542. }
  3543. if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
  3544. this._version = version;
  3545. } else {
  3546. (0, _util.warn)(`Invalid PDF header version: ${version}`);
  3547. }
  3548. }
  3549. parseStartXRef() {
  3550. this.xref.setStartXRef(this.startXRef);
  3551. }
  3552. get numPages() {
  3553. let num = 0;
  3554. if (this.catalog.hasActualNumPages) {
  3555. num = this.catalog.numPages;
  3556. } else if (this.xfaFactory) {
  3557. num = this.xfaFactory.getNumPages();
  3558. } else if (this.linearization) {
  3559. num = this.linearization.numPages;
  3560. } else {
  3561. num = this.catalog.numPages;
  3562. }
  3563. return (0, _util.shadow)(this, "numPages", num);
  3564. }
  3565. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3566. const RECURSION_LIMIT = 10;
  3567. if (!Array.isArray(fields)) {
  3568. return false;
  3569. }
  3570. return fields.every(field => {
  3571. field = this.xref.fetchIfRef(field);
  3572. if (!(field instanceof _primitives.Dict)) {
  3573. return false;
  3574. }
  3575. if (field.has("Kids")) {
  3576. if (++recursionDepth > RECURSION_LIMIT) {
  3577. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3578. return false;
  3579. }
  3580. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3581. }
  3582. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3583. const rectangle = field.get("Rect");
  3584. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3585. return isSignature && isInvisible;
  3586. });
  3587. }
  3588. get _xfaStreams() {
  3589. const acroForm = this.catalog.acroForm;
  3590. if (!acroForm) {
  3591. return null;
  3592. }
  3593. const xfa = acroForm.get("XFA");
  3594. const entries = {
  3595. "xdp:xdp": "",
  3596. template: "",
  3597. datasets: "",
  3598. config: "",
  3599. connectionSet: "",
  3600. localeSet: "",
  3601. stylesheet: "",
  3602. "/xdp:xdp": ""
  3603. };
  3604. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3605. entries["xdp:xdp"] = xfa;
  3606. return entries;
  3607. }
  3608. if (!Array.isArray(xfa) || xfa.length === 0) {
  3609. return null;
  3610. }
  3611. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3612. let name;
  3613. if (i === 0) {
  3614. name = "xdp:xdp";
  3615. } else if (i === ii - 2) {
  3616. name = "/xdp:xdp";
  3617. } else {
  3618. name = xfa[i];
  3619. }
  3620. if (!entries.hasOwnProperty(name)) {
  3621. continue;
  3622. }
  3623. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3624. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3625. continue;
  3626. }
  3627. entries[name] = data;
  3628. }
  3629. return entries;
  3630. }
  3631. get xfaDatasets() {
  3632. const streams = this._xfaStreams;
  3633. if (!streams) {
  3634. return (0, _util.shadow)(this, "xfaDatasets", null);
  3635. }
  3636. for (const key of ["datasets", "xdp:xdp"]) {
  3637. const stream = streams[key];
  3638. if (!stream) {
  3639. continue;
  3640. }
  3641. try {
  3642. const str = (0, _util.stringToUTF8String)(stream.getString());
  3643. const data = {
  3644. [key]: str
  3645. };
  3646. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  3647. } catch (_) {
  3648. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3649. break;
  3650. }
  3651. }
  3652. return (0, _util.shadow)(this, "xfaDatasets", null);
  3653. }
  3654. get xfaData() {
  3655. const streams = this._xfaStreams;
  3656. if (!streams) {
  3657. return null;
  3658. }
  3659. const data = Object.create(null);
  3660. for (const [key, stream] of Object.entries(streams)) {
  3661. if (!stream) {
  3662. continue;
  3663. }
  3664. try {
  3665. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  3666. } catch (_) {
  3667. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3668. return null;
  3669. }
  3670. }
  3671. return data;
  3672. }
  3673. get xfaFactory() {
  3674. let data;
  3675. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3676. data = this.xfaData;
  3677. }
  3678. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3679. }
  3680. get isPureXfa() {
  3681. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3682. }
  3683. get htmlForXfa() {
  3684. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3685. }
  3686. async loadXfaImages() {
  3687. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3688. if (!xfaImagesDict) {
  3689. return;
  3690. }
  3691. const keys = xfaImagesDict.getKeys();
  3692. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3693. await objectLoader.load();
  3694. const xfaImages = new Map();
  3695. for (const key of keys) {
  3696. const stream = xfaImagesDict.get(key);
  3697. if (stream instanceof _base_stream.BaseStream) {
  3698. xfaImages.set(key, stream.getBytes());
  3699. }
  3700. }
  3701. this.xfaFactory.setImages(xfaImages);
  3702. }
  3703. async loadXfaFonts(handler, task) {
  3704. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3705. if (!acroForm) {
  3706. return;
  3707. }
  3708. const resources = await acroForm.getAsync("DR");
  3709. if (!(resources instanceof _primitives.Dict)) {
  3710. return;
  3711. }
  3712. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3713. await objectLoader.load();
  3714. const fontRes = resources.get("Font");
  3715. if (!(fontRes instanceof _primitives.Dict)) {
  3716. return;
  3717. }
  3718. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3719. options.useSystemFonts = false;
  3720. const partialEvaluator = new _evaluator.PartialEvaluator({
  3721. xref: this.xref,
  3722. handler,
  3723. pageIndex: -1,
  3724. idFactory: this._globalIdFactory,
  3725. fontCache: this.catalog.fontCache,
  3726. builtInCMapCache: this.catalog.builtInCMapCache,
  3727. standardFontDataCache: this.catalog.standardFontDataCache,
  3728. options
  3729. });
  3730. const operatorList = new _operator_list.OperatorList();
  3731. const pdfFonts = [];
  3732. const initialState = {
  3733. get font() {
  3734. return pdfFonts.at(-1);
  3735. },
  3736. set font(font) {
  3737. pdfFonts.push(font);
  3738. },
  3739. clone() {
  3740. return this;
  3741. }
  3742. };
  3743. const fonts = new Map();
  3744. fontRes.forEach((fontName, font) => {
  3745. fonts.set(fontName, font);
  3746. });
  3747. const promises = [];
  3748. for (const [fontName, font] of fonts) {
  3749. const descriptor = font.get("FontDescriptor");
  3750. if (!(descriptor instanceof _primitives.Dict)) {
  3751. continue;
  3752. }
  3753. let fontFamily = descriptor.get("FontFamily");
  3754. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3755. const fontWeight = descriptor.get("FontWeight");
  3756. const italicAngle = -descriptor.get("ItalicAngle");
  3757. const cssFontInfo = {
  3758. fontFamily,
  3759. fontWeight,
  3760. italicAngle
  3761. };
  3762. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3763. continue;
  3764. }
  3765. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3766. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3767. return null;
  3768. }));
  3769. }
  3770. await Promise.all(promises);
  3771. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3772. if (!missingFonts) {
  3773. return;
  3774. }
  3775. options.ignoreErrors = true;
  3776. promises.length = 0;
  3777. pdfFonts.length = 0;
  3778. const reallyMissingFonts = new Set();
  3779. for (const missing of missingFonts) {
  3780. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3781. reallyMissingFonts.add(missing);
  3782. }
  3783. }
  3784. if (reallyMissingFonts.size) {
  3785. missingFonts.push("PdfJS-Fallback");
  3786. }
  3787. for (const missing of missingFonts) {
  3788. if (reallyMissingFonts.has(missing)) {
  3789. continue;
  3790. }
  3791. for (const fontInfo of [{
  3792. name: "Regular",
  3793. fontWeight: 400,
  3794. italicAngle: 0
  3795. }, {
  3796. name: "Bold",
  3797. fontWeight: 700,
  3798. italicAngle: 0
  3799. }, {
  3800. name: "Italic",
  3801. fontWeight: 400,
  3802. italicAngle: 12
  3803. }, {
  3804. name: "BoldItalic",
  3805. fontWeight: 700,
  3806. italicAngle: 12
  3807. }]) {
  3808. const name = `${missing}-${fontInfo.name}`;
  3809. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3810. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3811. fontFamily: missing,
  3812. fontWeight: fontInfo.fontWeight,
  3813. italicAngle: fontInfo.italicAngle
  3814. }).catch(function (reason) {
  3815. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3816. return null;
  3817. }));
  3818. }
  3819. }
  3820. await Promise.all(promises);
  3821. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3822. }
  3823. async serializeXfaData(annotationStorage) {
  3824. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3825. }
  3826. get version() {
  3827. return this.catalog.version || this._version;
  3828. }
  3829. get formInfo() {
  3830. const formInfo = {
  3831. hasFields: false,
  3832. hasAcroForm: false,
  3833. hasXfa: false,
  3834. hasSignatures: false
  3835. };
  3836. const acroForm = this.catalog.acroForm;
  3837. if (!acroForm) {
  3838. return (0, _util.shadow)(this, "formInfo", formInfo);
  3839. }
  3840. try {
  3841. const fields = acroForm.get("Fields");
  3842. const hasFields = Array.isArray(fields) && fields.length > 0;
  3843. formInfo.hasFields = hasFields;
  3844. const xfa = acroForm.get("XFA");
  3845. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3846. const sigFlags = acroForm.get("SigFlags");
  3847. const hasSignatures = !!(sigFlags & 0x1);
  3848. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3849. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3850. formInfo.hasSignatures = hasSignatures;
  3851. } catch (ex) {
  3852. if (ex instanceof _core_utils.MissingDataException) {
  3853. throw ex;
  3854. }
  3855. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3856. }
  3857. return (0, _util.shadow)(this, "formInfo", formInfo);
  3858. }
  3859. get documentInfo() {
  3860. const docInfo = {
  3861. PDFFormatVersion: this.version,
  3862. Language: this.catalog.lang,
  3863. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3864. IsLinearized: !!this.linearization,
  3865. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3866. IsXFAPresent: this.formInfo.hasXfa,
  3867. IsCollectionPresent: !!this.catalog.collection,
  3868. IsSignaturesPresent: this.formInfo.hasSignatures
  3869. };
  3870. let infoDict;
  3871. try {
  3872. infoDict = this.xref.trailer.get("Info");
  3873. } catch (err) {
  3874. if (err instanceof _core_utils.MissingDataException) {
  3875. throw err;
  3876. }
  3877. (0, _util.info)("The document information dictionary is invalid.");
  3878. }
  3879. if (!(infoDict instanceof _primitives.Dict)) {
  3880. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3881. }
  3882. for (const key of infoDict.getKeys()) {
  3883. const value = infoDict.get(key);
  3884. switch (key) {
  3885. case "Title":
  3886. case "Author":
  3887. case "Subject":
  3888. case "Keywords":
  3889. case "Creator":
  3890. case "Producer":
  3891. case "CreationDate":
  3892. case "ModDate":
  3893. if (typeof value === "string") {
  3894. docInfo[key] = (0, _util.stringToPDFString)(value);
  3895. continue;
  3896. }
  3897. break;
  3898. case "Trapped":
  3899. if (value instanceof _primitives.Name) {
  3900. docInfo[key] = value;
  3901. continue;
  3902. }
  3903. break;
  3904. default:
  3905. let customValue;
  3906. switch (typeof value) {
  3907. case "string":
  3908. customValue = (0, _util.stringToPDFString)(value);
  3909. break;
  3910. case "number":
  3911. case "boolean":
  3912. customValue = value;
  3913. break;
  3914. default:
  3915. if (value instanceof _primitives.Name) {
  3916. customValue = value;
  3917. }
  3918. break;
  3919. }
  3920. if (customValue === undefined) {
  3921. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3922. continue;
  3923. }
  3924. if (!docInfo.Custom) {
  3925. docInfo.Custom = Object.create(null);
  3926. }
  3927. docInfo.Custom[key] = customValue;
  3928. continue;
  3929. }
  3930. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3931. }
  3932. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3933. }
  3934. get fingerprints() {
  3935. function validate(data) {
  3936. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3937. }
  3938. function hexString(hash) {
  3939. const buf = [];
  3940. for (const num of hash) {
  3941. const hex = num.toString(16);
  3942. buf.push(hex.padStart(2, "0"));
  3943. }
  3944. return buf.join("");
  3945. }
  3946. const idArray = this.xref.trailer.get("ID");
  3947. let hashOriginal, hashModified;
  3948. if (Array.isArray(idArray) && validate(idArray[0])) {
  3949. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3950. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3951. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3952. }
  3953. } else {
  3954. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3955. }
  3956. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3957. }
  3958. async _getLinearizationPage(pageIndex) {
  3959. const {
  3960. catalog,
  3961. linearization,
  3962. xref
  3963. } = this;
  3964. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3965. try {
  3966. const obj = await xref.fetchAsync(ref);
  3967. if (obj instanceof _primitives.Dict) {
  3968. let type = obj.getRaw("Type");
  3969. if (type instanceof _primitives.Ref) {
  3970. type = await xref.fetchAsync(type);
  3971. }
  3972. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  3973. if (!catalog.pageKidsCountCache.has(ref)) {
  3974. catalog.pageKidsCountCache.put(ref, 1);
  3975. }
  3976. if (!catalog.pageIndexCache.has(ref)) {
  3977. catalog.pageIndexCache.put(ref, 0);
  3978. }
  3979. return [obj, ref];
  3980. }
  3981. }
  3982. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  3983. } catch (reason) {
  3984. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  3985. return catalog.getPageDict(pageIndex);
  3986. }
  3987. }
  3988. getPage(pageIndex) {
  3989. const cachedPromise = this._pagePromises.get(pageIndex);
  3990. if (cachedPromise) {
  3991. return cachedPromise;
  3992. }
  3993. const {
  3994. catalog,
  3995. linearization,
  3996. xfaFactory
  3997. } = this;
  3998. let promise;
  3999. if (xfaFactory) {
  4000. promise = Promise.resolve([_primitives.Dict.empty, null]);
  4001. } else if (linearization && linearization.pageFirst === pageIndex) {
  4002. promise = this._getLinearizationPage(pageIndex);
  4003. } else {
  4004. promise = catalog.getPageDict(pageIndex);
  4005. }
  4006. promise = promise.then(([pageDict, ref]) => {
  4007. return new Page({
  4008. pdfManager: this.pdfManager,
  4009. xref: this.xref,
  4010. pageIndex,
  4011. pageDict,
  4012. ref,
  4013. globalIdFactory: this._globalIdFactory,
  4014. fontCache: catalog.fontCache,
  4015. builtInCMapCache: catalog.builtInCMapCache,
  4016. standardFontDataCache: catalog.standardFontDataCache,
  4017. globalImageCache: catalog.globalImageCache,
  4018. nonBlendModesSet: catalog.nonBlendModesSet,
  4019. xfaFactory
  4020. });
  4021. });
  4022. this._pagePromises.set(pageIndex, promise);
  4023. return promise;
  4024. }
  4025. async checkFirstPage(recoveryMode = false) {
  4026. if (recoveryMode) {
  4027. return;
  4028. }
  4029. try {
  4030. await this.getPage(0);
  4031. } catch (reason) {
  4032. if (reason instanceof _core_utils.XRefEntryException) {
  4033. this._pagePromises.delete(0);
  4034. await this.cleanup();
  4035. throw new _core_utils.XRefParseException();
  4036. }
  4037. }
  4038. }
  4039. async checkLastPage(recoveryMode = false) {
  4040. const {
  4041. catalog,
  4042. pdfManager
  4043. } = this;
  4044. catalog.setActualNumPages();
  4045. let numPages;
  4046. try {
  4047. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  4048. if (this.xfaFactory) {
  4049. return;
  4050. } else if (this.linearization) {
  4051. numPages = this.linearization.numPages;
  4052. } else {
  4053. numPages = catalog.numPages;
  4054. }
  4055. if (!Number.isInteger(numPages)) {
  4056. throw new _util.FormatError("Page count is not an integer.");
  4057. } else if (numPages <= 1) {
  4058. return;
  4059. }
  4060. await this.getPage(numPages - 1);
  4061. } catch (reason) {
  4062. this._pagePromises.delete(numPages - 1);
  4063. await this.cleanup();
  4064. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4065. throw new _core_utils.XRefParseException();
  4066. }
  4067. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  4068. let pagesTree;
  4069. try {
  4070. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  4071. } catch (reasonAll) {
  4072. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4073. throw new _core_utils.XRefParseException();
  4074. }
  4075. catalog.setActualNumPages(1);
  4076. return;
  4077. }
  4078. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  4079. let promise;
  4080. if (pageDict instanceof Error) {
  4081. promise = Promise.reject(pageDict);
  4082. promise.catch(() => {});
  4083. } else {
  4084. promise = Promise.resolve(new Page({
  4085. pdfManager,
  4086. xref: this.xref,
  4087. pageIndex,
  4088. pageDict,
  4089. ref,
  4090. globalIdFactory: this._globalIdFactory,
  4091. fontCache: catalog.fontCache,
  4092. builtInCMapCache: catalog.builtInCMapCache,
  4093. standardFontDataCache: catalog.standardFontDataCache,
  4094. globalImageCache: catalog.globalImageCache,
  4095. nonBlendModesSet: catalog.nonBlendModesSet,
  4096. xfaFactory: null
  4097. }));
  4098. }
  4099. this._pagePromises.set(pageIndex, promise);
  4100. }
  4101. catalog.setActualNumPages(pagesTree.size);
  4102. }
  4103. }
  4104. fontFallback(id, handler) {
  4105. return this.catalog.fontFallback(id, handler);
  4106. }
  4107. async cleanup(manuallyTriggered = false) {
  4108. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  4109. }
  4110. _collectFieldObjects(name, fieldRef, promises) {
  4111. const field = this.xref.fetchIfRef(fieldRef);
  4112. if (field.has("T")) {
  4113. const partName = (0, _util.stringToPDFString)(field.get("T"));
  4114. if (name === "") {
  4115. name = partName;
  4116. } else {
  4117. name = `${name}.${partName}`;
  4118. }
  4119. }
  4120. if (!promises.has(name)) {
  4121. promises.set(name, []);
  4122. }
  4123. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  4124. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4125. return null;
  4126. }));
  4127. if (field.has("Kids")) {
  4128. const kids = field.get("Kids");
  4129. for (const kid of kids) {
  4130. this._collectFieldObjects(name, kid, promises);
  4131. }
  4132. }
  4133. }
  4134. get fieldObjects() {
  4135. if (!this.formInfo.hasFields) {
  4136. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  4137. }
  4138. const allFields = Object.create(null);
  4139. const fieldPromises = new Map();
  4140. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4141. this._collectFieldObjects("", fieldRef, fieldPromises);
  4142. }
  4143. const allPromises = [];
  4144. for (const [name, promises] of fieldPromises) {
  4145. allPromises.push(Promise.all(promises).then(fields => {
  4146. fields = fields.filter(field => !!field);
  4147. if (fields.length > 0) {
  4148. allFields[name] = fields;
  4149. }
  4150. }));
  4151. }
  4152. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4153. }
  4154. get hasJSActions() {
  4155. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4156. return (0, _util.shadow)(this, "hasJSActions", promise);
  4157. }
  4158. async _parseHasJSActions() {
  4159. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4160. if (catalogJsActions) {
  4161. return true;
  4162. }
  4163. if (fieldObjects) {
  4164. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4165. }
  4166. return false;
  4167. }
  4168. get calculationOrderIds() {
  4169. const acroForm = this.catalog.acroForm;
  4170. if (!acroForm || !acroForm.has("CO")) {
  4171. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4172. }
  4173. const calculationOrder = acroForm.get("CO");
  4174. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4175. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4176. }
  4177. const ids = [];
  4178. for (const id of calculationOrder) {
  4179. if (id instanceof _primitives.Ref) {
  4180. ids.push(id.toString());
  4181. }
  4182. }
  4183. if (ids.length === 0) {
  4184. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4185. }
  4186. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4187. }
  4188. }
  4189. exports.PDFDocument = PDFDocument;
  4190. /***/ }),
  4191. /* 10 */
  4192. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4193. Object.defineProperty(exports, "__esModule", ({
  4194. value: true
  4195. }));
  4196. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  4197. exports.getQuadPoints = getQuadPoints;
  4198. var _util = __w_pdfjs_require__(2);
  4199. var _core_utils = __w_pdfjs_require__(4);
  4200. var _default_appearance = __w_pdfjs_require__(11);
  4201. var _primitives = __w_pdfjs_require__(3);
  4202. var _writer = __w_pdfjs_require__(63);
  4203. var _base_stream = __w_pdfjs_require__(5);
  4204. var _bidi = __w_pdfjs_require__(58);
  4205. var _catalog = __w_pdfjs_require__(67);
  4206. var _colorspace = __w_pdfjs_require__(12);
  4207. var _file_spec = __w_pdfjs_require__(70);
  4208. var _object_loader = __w_pdfjs_require__(73);
  4209. var _operator_list = __w_pdfjs_require__(60);
  4210. var _stream = __w_pdfjs_require__(8);
  4211. var _factory = __w_pdfjs_require__(74);
  4212. class AnnotationFactory {
  4213. static create(xref, ref, pdfManager, idFactory, collectFields) {
  4214. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, baseUrl, attachments, xfaDatasets, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, attachments, xfaDatasets, collectFields, pageIndex]));
  4215. }
  4216. static _create(xref, ref, pdfManager, idFactory, acroForm, attachments = null, xfaDatasets, collectFields, pageIndex = -1) {
  4217. const dict = xref.fetchIfRef(ref);
  4218. if (!(dict instanceof _primitives.Dict)) {
  4219. return undefined;
  4220. }
  4221. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  4222. let subtype = dict.get("Subtype");
  4223. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  4224. const acroFormDict = acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty;
  4225. const parameters = {
  4226. xref,
  4227. ref,
  4228. dict,
  4229. subtype,
  4230. id,
  4231. pdfManager,
  4232. acroForm: acroFormDict,
  4233. attachments,
  4234. xfaDatasets,
  4235. collectFields,
  4236. needAppearances: !collectFields && acroFormDict.get("NeedAppearances") === true,
  4237. pageIndex,
  4238. isOffscreenCanvasSupported: _util.FeatureTest.isOffscreenCanvasSupported && pdfManager.evaluatorOptions.isOffscreenCanvasSupported
  4239. };
  4240. switch (subtype) {
  4241. case "Link":
  4242. return new LinkAnnotation(parameters);
  4243. case "Text":
  4244. return new TextAnnotation(parameters);
  4245. case "Widget":
  4246. let fieldType = (0, _core_utils.getInheritableProperty)({
  4247. dict,
  4248. key: "FT"
  4249. });
  4250. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  4251. switch (fieldType) {
  4252. case "Tx":
  4253. return new TextWidgetAnnotation(parameters);
  4254. case "Btn":
  4255. return new ButtonWidgetAnnotation(parameters);
  4256. case "Ch":
  4257. return new ChoiceWidgetAnnotation(parameters);
  4258. case "Sig":
  4259. return new SignatureWidgetAnnotation(parameters);
  4260. }
  4261. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  4262. return new WidgetAnnotation(parameters);
  4263. case "Popup":
  4264. return new PopupAnnotation(parameters);
  4265. case "FreeText":
  4266. return new FreeTextAnnotation(parameters);
  4267. case "Line":
  4268. return new LineAnnotation(parameters);
  4269. case "Square":
  4270. return new SquareAnnotation(parameters);
  4271. case "Circle":
  4272. return new CircleAnnotation(parameters);
  4273. case "PolyLine":
  4274. return new PolylineAnnotation(parameters);
  4275. case "Polygon":
  4276. return new PolygonAnnotation(parameters);
  4277. case "Caret":
  4278. return new CaretAnnotation(parameters);
  4279. case "Ink":
  4280. return new InkAnnotation(parameters);
  4281. case "Highlight":
  4282. return new HighlightAnnotation(parameters);
  4283. case "Underline":
  4284. return new UnderlineAnnotation(parameters);
  4285. case "Squiggly":
  4286. return new SquigglyAnnotation(parameters);
  4287. case "StrikeOut":
  4288. return new StrikeOutAnnotation(parameters);
  4289. case "Stamp":
  4290. return new StampAnnotation(parameters);
  4291. case "FileAttachment":
  4292. return new FileAttachmentAnnotation(parameters);
  4293. default:
  4294. if (!collectFields) {
  4295. if (!subtype) {
  4296. (0, _util.warn)("Annotation is missing the required /Subtype.");
  4297. } else {
  4298. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  4299. }
  4300. }
  4301. return new Annotation(parameters);
  4302. }
  4303. }
  4304. static async _getPageIndex(xref, ref, pdfManager) {
  4305. try {
  4306. const annotDict = await xref.fetchIfRefAsync(ref);
  4307. if (!(annotDict instanceof _primitives.Dict)) {
  4308. return -1;
  4309. }
  4310. const pageRef = annotDict.getRaw("P");
  4311. if (!(pageRef instanceof _primitives.Ref)) {
  4312. return -1;
  4313. }
  4314. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  4315. return pageIndex;
  4316. } catch (ex) {
  4317. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  4318. return -1;
  4319. }
  4320. }
  4321. static async saveNewAnnotations(evaluator, task, annotations) {
  4322. const xref = evaluator.xref;
  4323. let baseFontRef;
  4324. const dependencies = [];
  4325. const promises = [];
  4326. for (const annotation of annotations) {
  4327. switch (annotation.annotationType) {
  4328. case _util.AnnotationEditorType.FREETEXT:
  4329. if (!baseFontRef) {
  4330. const baseFont = new _primitives.Dict(xref);
  4331. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  4332. baseFont.set("Type", _primitives.Name.get("Font"));
  4333. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  4334. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  4335. const buffer = [];
  4336. baseFontRef = xref.getNewTemporaryRef();
  4337. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  4338. dependencies.push({
  4339. ref: baseFontRef,
  4340. data: buffer.join("")
  4341. });
  4342. }
  4343. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  4344. evaluator,
  4345. task,
  4346. baseFontRef
  4347. }));
  4348. break;
  4349. case _util.AnnotationEditorType.INK:
  4350. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  4351. }
  4352. }
  4353. return {
  4354. annotations: await Promise.all(promises),
  4355. dependencies
  4356. };
  4357. }
  4358. static async printNewAnnotations(evaluator, task, annotations) {
  4359. if (!annotations) {
  4360. return null;
  4361. }
  4362. const xref = evaluator.xref;
  4363. const promises = [];
  4364. const isOffscreenCanvasSupported = _util.FeatureTest.isOffscreenCanvasSupported && evaluator.options.isOffscreenCanvasSupported;
  4365. for (const annotation of annotations) {
  4366. switch (annotation.annotationType) {
  4367. case _util.AnnotationEditorType.FREETEXT:
  4368. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  4369. evaluator,
  4370. task,
  4371. isOffscreenCanvasSupported
  4372. }));
  4373. break;
  4374. case _util.AnnotationEditorType.INK:
  4375. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation, {
  4376. isOffscreenCanvasSupported
  4377. }));
  4378. break;
  4379. }
  4380. }
  4381. return Promise.all(promises);
  4382. }
  4383. }
  4384. exports.AnnotationFactory = AnnotationFactory;
  4385. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  4386. if (!Array.isArray(color)) {
  4387. return defaultColor;
  4388. }
  4389. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  4390. switch (color.length) {
  4391. case 0:
  4392. return null;
  4393. case 1:
  4394. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  4395. return rgbColor;
  4396. case 3:
  4397. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  4398. return rgbColor;
  4399. case 4:
  4400. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  4401. return rgbColor;
  4402. default:
  4403. return defaultColor;
  4404. }
  4405. }
  4406. function getPdfColorArray(color) {
  4407. return Array.from(color, c => c / 255);
  4408. }
  4409. function getQuadPoints(dict, rect) {
  4410. const quadPoints = dict.getArray("QuadPoints");
  4411. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  4412. return null;
  4413. }
  4414. const quadPointsLists = [];
  4415. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  4416. let minX = Infinity,
  4417. maxX = -Infinity,
  4418. minY = Infinity,
  4419. maxY = -Infinity;
  4420. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  4421. const x = quadPoints[j];
  4422. const y = quadPoints[j + 1];
  4423. minX = Math.min(x, minX);
  4424. maxX = Math.max(x, maxX);
  4425. minY = Math.min(y, minY);
  4426. maxY = Math.max(y, maxY);
  4427. }
  4428. if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
  4429. return null;
  4430. }
  4431. quadPointsLists.push([{
  4432. x: minX,
  4433. y: maxY
  4434. }, {
  4435. x: maxX,
  4436. y: maxY
  4437. }, {
  4438. x: minX,
  4439. y: minY
  4440. }, {
  4441. x: maxX,
  4442. y: minY
  4443. }]);
  4444. }
  4445. return quadPointsLists;
  4446. }
  4447. function getTransformMatrix(rect, bbox, matrix) {
  4448. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  4449. if (minX === maxX || minY === maxY) {
  4450. return [1, 0, 0, 1, rect[0], rect[1]];
  4451. }
  4452. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  4453. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  4454. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  4455. }
  4456. class Annotation {
  4457. constructor(params) {
  4458. const {
  4459. dict,
  4460. xref
  4461. } = params;
  4462. this.setTitle(dict.get("T"));
  4463. this.setContents(dict.get("Contents"));
  4464. this.setModificationDate(dict.get("M"));
  4465. this.setFlags(dict.get("F"));
  4466. this.setRectangle(dict.getArray("Rect"));
  4467. this.setColor(dict.getArray("C"));
  4468. this.setBorderStyle(dict);
  4469. this.setAppearance(dict);
  4470. this.setOptionalContent(dict);
  4471. const MK = dict.get("MK");
  4472. this.setBorderAndBackgroundColors(MK);
  4473. this.setRotation(MK);
  4474. this._streams = [];
  4475. if (this.appearance) {
  4476. this._streams.push(this.appearance);
  4477. }
  4478. this.data = {
  4479. annotationFlags: this.flags,
  4480. borderStyle: this.borderStyle,
  4481. color: this.color,
  4482. backgroundColor: this.backgroundColor,
  4483. borderColor: this.borderColor,
  4484. rotation: this.rotation,
  4485. contentsObj: this._contents,
  4486. hasAppearance: !!this.appearance,
  4487. id: params.id,
  4488. modificationDate: this.modificationDate,
  4489. rect: this.rectangle,
  4490. subtype: params.subtype,
  4491. hasOwnCanvas: false
  4492. };
  4493. if (params.collectFields) {
  4494. const kids = dict.get("Kids");
  4495. if (Array.isArray(kids)) {
  4496. const kidIds = [];
  4497. for (const kid of kids) {
  4498. if (kid instanceof _primitives.Ref) {
  4499. kidIds.push(kid.toString());
  4500. }
  4501. }
  4502. if (kidIds.length !== 0) {
  4503. this.data.kidIds = kidIds;
  4504. }
  4505. }
  4506. this.data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  4507. this.data.fieldName = this._constructFieldName(dict);
  4508. this.data.pageIndex = params.pageIndex;
  4509. }
  4510. this._isOffscreenCanvasSupported = params.isOffscreenCanvasSupported;
  4511. this._fallbackFontDict = null;
  4512. this._needAppearances = false;
  4513. }
  4514. _hasFlag(flags, flag) {
  4515. return !!(flags & flag);
  4516. }
  4517. _isViewable(flags) {
  4518. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  4519. }
  4520. _isPrintable(flags) {
  4521. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  4522. }
  4523. mustBeViewed(annotationStorage) {
  4524. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4525. if (storageEntry && storageEntry.hidden !== undefined) {
  4526. return !storageEntry.hidden;
  4527. }
  4528. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  4529. }
  4530. mustBePrinted(annotationStorage) {
  4531. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4532. if (storageEntry && storageEntry.print !== undefined) {
  4533. return storageEntry.print;
  4534. }
  4535. return this.printable;
  4536. }
  4537. get viewable() {
  4538. if (this.data.quadPoints === null) {
  4539. return false;
  4540. }
  4541. if (this.flags === 0) {
  4542. return true;
  4543. }
  4544. return this._isViewable(this.flags);
  4545. }
  4546. get printable() {
  4547. if (this.data.quadPoints === null) {
  4548. return false;
  4549. }
  4550. if (this.flags === 0) {
  4551. return false;
  4552. }
  4553. return this._isPrintable(this.flags);
  4554. }
  4555. _parseStringHelper(data) {
  4556. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  4557. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  4558. return {
  4559. str,
  4560. dir
  4561. };
  4562. }
  4563. setDefaultAppearance(params) {
  4564. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  4565. dict: params.dict,
  4566. key: "DA"
  4567. }) || params.acroForm.get("DA");
  4568. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  4569. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  4570. }
  4571. setTitle(title) {
  4572. this._title = this._parseStringHelper(title);
  4573. }
  4574. setContents(contents) {
  4575. this._contents = this._parseStringHelper(contents);
  4576. }
  4577. setModificationDate(modificationDate) {
  4578. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  4579. }
  4580. setFlags(flags) {
  4581. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  4582. }
  4583. hasFlag(flag) {
  4584. return this._hasFlag(this.flags, flag);
  4585. }
  4586. setRectangle(rectangle) {
  4587. if (Array.isArray(rectangle) && rectangle.length === 4) {
  4588. this.rectangle = _util.Util.normalizeRect(rectangle);
  4589. } else {
  4590. this.rectangle = [0, 0, 0, 0];
  4591. }
  4592. }
  4593. setColor(color) {
  4594. this.color = getRgbColor(color);
  4595. }
  4596. setLineEndings(lineEndings) {
  4597. this.lineEndings = ["None", "None"];
  4598. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  4599. for (let i = 0; i < 2; i++) {
  4600. const obj = lineEndings[i];
  4601. if (obj instanceof _primitives.Name) {
  4602. switch (obj.name) {
  4603. case "None":
  4604. continue;
  4605. case "Square":
  4606. case "Circle":
  4607. case "Diamond":
  4608. case "OpenArrow":
  4609. case "ClosedArrow":
  4610. case "Butt":
  4611. case "ROpenArrow":
  4612. case "RClosedArrow":
  4613. case "Slash":
  4614. this.lineEndings[i] = obj.name;
  4615. continue;
  4616. }
  4617. }
  4618. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  4619. }
  4620. }
  4621. }
  4622. setRotation(mk) {
  4623. this.rotation = 0;
  4624. if (mk instanceof _primitives.Dict) {
  4625. let angle = mk.get("R") || 0;
  4626. if (Number.isInteger(angle) && angle !== 0) {
  4627. angle %= 360;
  4628. if (angle < 0) {
  4629. angle += 360;
  4630. }
  4631. if (angle % 90 === 0) {
  4632. this.rotation = angle;
  4633. }
  4634. }
  4635. }
  4636. }
  4637. setBorderAndBackgroundColors(mk) {
  4638. if (mk instanceof _primitives.Dict) {
  4639. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  4640. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  4641. } else {
  4642. this.borderColor = this.backgroundColor = null;
  4643. }
  4644. }
  4645. setBorderStyle(borderStyle) {
  4646. this.borderStyle = new AnnotationBorderStyle();
  4647. if (!(borderStyle instanceof _primitives.Dict)) {
  4648. return;
  4649. }
  4650. if (borderStyle.has("BS")) {
  4651. const dict = borderStyle.get("BS");
  4652. const dictType = dict.get("Type");
  4653. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  4654. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  4655. this.borderStyle.setStyle(dict.get("S"));
  4656. this.borderStyle.setDashArray(dict.getArray("D"));
  4657. }
  4658. } else if (borderStyle.has("Border")) {
  4659. const array = borderStyle.getArray("Border");
  4660. if (Array.isArray(array) && array.length >= 3) {
  4661. this.borderStyle.setHorizontalCornerRadius(array[0]);
  4662. this.borderStyle.setVerticalCornerRadius(array[1]);
  4663. this.borderStyle.setWidth(array[2], this.rectangle);
  4664. if (array.length === 4) {
  4665. this.borderStyle.setDashArray(array[3], true);
  4666. }
  4667. }
  4668. } else {
  4669. this.borderStyle.setWidth(0);
  4670. }
  4671. }
  4672. setAppearance(dict) {
  4673. this.appearance = null;
  4674. const appearanceStates = dict.get("AP");
  4675. if (!(appearanceStates instanceof _primitives.Dict)) {
  4676. return;
  4677. }
  4678. const normalAppearanceState = appearanceStates.get("N");
  4679. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  4680. this.appearance = normalAppearanceState;
  4681. return;
  4682. }
  4683. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  4684. return;
  4685. }
  4686. const as = dict.get("AS");
  4687. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  4688. return;
  4689. }
  4690. const appearance = normalAppearanceState.get(as.name);
  4691. if (appearance instanceof _base_stream.BaseStream) {
  4692. this.appearance = appearance;
  4693. }
  4694. }
  4695. setOptionalContent(dict) {
  4696. this.oc = null;
  4697. const oc = dict.get("OC");
  4698. if (oc instanceof _primitives.Name) {
  4699. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  4700. } else if (oc instanceof _primitives.Dict) {
  4701. this.oc = oc;
  4702. }
  4703. }
  4704. loadResources(keys, appearance) {
  4705. return appearance.dict.getAsync("Resources").then(resources => {
  4706. if (!resources) {
  4707. return undefined;
  4708. }
  4709. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  4710. return objectLoader.load().then(function () {
  4711. return resources;
  4712. });
  4713. });
  4714. }
  4715. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  4716. const data = this.data;
  4717. let appearance = this.appearance;
  4718. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  4719. if (!appearance) {
  4720. if (!isUsingOwnCanvas) {
  4721. return {
  4722. opList: new _operator_list.OperatorList(),
  4723. separateForm: false,
  4724. separateCanvas: false
  4725. };
  4726. }
  4727. appearance = new _stream.StringStream("");
  4728. appearance.dict = new _primitives.Dict();
  4729. }
  4730. const appearanceDict = appearance.dict;
  4731. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  4732. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  4733. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  4734. const transform = getTransformMatrix(data.rect, bbox, matrix);
  4735. const opList = new _operator_list.OperatorList();
  4736. let optionalContent;
  4737. if (this.oc) {
  4738. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  4739. }
  4740. if (optionalContent !== undefined) {
  4741. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  4742. }
  4743. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  4744. await evaluator.getOperatorList({
  4745. stream: appearance,
  4746. task,
  4747. resources,
  4748. operatorList: opList,
  4749. fallbackFontDict: this._fallbackFontDict
  4750. });
  4751. opList.addOp(_util.OPS.endAnnotation, []);
  4752. if (optionalContent !== undefined) {
  4753. opList.addOp(_util.OPS.endMarkedContent, []);
  4754. }
  4755. this.reset();
  4756. return {
  4757. opList,
  4758. separateForm: false,
  4759. separateCanvas: isUsingOwnCanvas
  4760. };
  4761. }
  4762. async save(evaluator, task, annotationStorage) {
  4763. return null;
  4764. }
  4765. get hasTextContent() {
  4766. return false;
  4767. }
  4768. async extractTextContent(evaluator, task, viewBox) {
  4769. if (!this.appearance) {
  4770. return;
  4771. }
  4772. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  4773. const text = [];
  4774. const buffer = [];
  4775. const sink = {
  4776. desiredSize: Math.Infinity,
  4777. ready: true,
  4778. enqueue(chunk, size) {
  4779. for (const item of chunk.items) {
  4780. buffer.push(item.str);
  4781. if (item.hasEOL) {
  4782. text.push(buffer.join(""));
  4783. buffer.length = 0;
  4784. }
  4785. }
  4786. }
  4787. };
  4788. await evaluator.getTextContent({
  4789. stream: this.appearance,
  4790. task,
  4791. resources,
  4792. includeMarkedContent: true,
  4793. combineTextItems: true,
  4794. sink,
  4795. viewBox
  4796. });
  4797. this.reset();
  4798. if (buffer.length) {
  4799. text.push(buffer.join(""));
  4800. }
  4801. if (text.length > 0) {
  4802. this.data.textContent = text;
  4803. }
  4804. }
  4805. getFieldObject() {
  4806. if (this.data.kidIds) {
  4807. return {
  4808. id: this.data.id,
  4809. actions: this.data.actions,
  4810. name: this.data.fieldName,
  4811. strokeColor: this.data.borderColor,
  4812. fillColor: this.data.backgroundColor,
  4813. type: "",
  4814. kidIds: this.data.kidIds,
  4815. page: this.data.pageIndex,
  4816. rotation: this.rotation
  4817. };
  4818. }
  4819. return null;
  4820. }
  4821. reset() {
  4822. for (const stream of this._streams) {
  4823. stream.reset();
  4824. }
  4825. }
  4826. _constructFieldName(dict) {
  4827. if (!dict.has("T") && !dict.has("Parent")) {
  4828. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  4829. return "";
  4830. }
  4831. if (!dict.has("Parent")) {
  4832. return (0, _util.stringToPDFString)(dict.get("T"));
  4833. }
  4834. const fieldName = [];
  4835. if (dict.has("T")) {
  4836. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  4837. }
  4838. let loopDict = dict;
  4839. const visited = new _primitives.RefSet();
  4840. if (dict.objId) {
  4841. visited.put(dict.objId);
  4842. }
  4843. while (loopDict.has("Parent")) {
  4844. loopDict = loopDict.get("Parent");
  4845. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  4846. break;
  4847. }
  4848. if (loopDict.objId) {
  4849. visited.put(loopDict.objId);
  4850. }
  4851. if (loopDict.has("T")) {
  4852. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  4853. }
  4854. }
  4855. return fieldName.join(".");
  4856. }
  4857. }
  4858. exports.Annotation = Annotation;
  4859. class AnnotationBorderStyle {
  4860. constructor() {
  4861. this.width = 1;
  4862. this.style = _util.AnnotationBorderStyleType.SOLID;
  4863. this.dashArray = [3];
  4864. this.horizontalCornerRadius = 0;
  4865. this.verticalCornerRadius = 0;
  4866. }
  4867. setWidth(width, rect = [0, 0, 0, 0]) {
  4868. if (width instanceof _primitives.Name) {
  4869. this.width = 0;
  4870. return;
  4871. }
  4872. if (typeof width === "number") {
  4873. if (width > 0) {
  4874. const maxWidth = (rect[2] - rect[0]) / 2;
  4875. const maxHeight = (rect[3] - rect[1]) / 2;
  4876. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  4877. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  4878. width = 1;
  4879. }
  4880. }
  4881. this.width = width;
  4882. }
  4883. }
  4884. setStyle(style) {
  4885. if (!(style instanceof _primitives.Name)) {
  4886. return;
  4887. }
  4888. switch (style.name) {
  4889. case "S":
  4890. this.style = _util.AnnotationBorderStyleType.SOLID;
  4891. break;
  4892. case "D":
  4893. this.style = _util.AnnotationBorderStyleType.DASHED;
  4894. break;
  4895. case "B":
  4896. this.style = _util.AnnotationBorderStyleType.BEVELED;
  4897. break;
  4898. case "I":
  4899. this.style = _util.AnnotationBorderStyleType.INSET;
  4900. break;
  4901. case "U":
  4902. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  4903. break;
  4904. default:
  4905. break;
  4906. }
  4907. }
  4908. setDashArray(dashArray, forceStyle = false) {
  4909. if (Array.isArray(dashArray) && dashArray.length > 0) {
  4910. let isValid = true;
  4911. let allZeros = true;
  4912. for (const element of dashArray) {
  4913. const validNumber = +element >= 0;
  4914. if (!validNumber) {
  4915. isValid = false;
  4916. break;
  4917. } else if (element > 0) {
  4918. allZeros = false;
  4919. }
  4920. }
  4921. if (isValid && !allZeros) {
  4922. this.dashArray = dashArray;
  4923. if (forceStyle) {
  4924. this.setStyle(_primitives.Name.get("D"));
  4925. }
  4926. } else {
  4927. this.width = 0;
  4928. }
  4929. } else if (dashArray) {
  4930. this.width = 0;
  4931. }
  4932. }
  4933. setHorizontalCornerRadius(radius) {
  4934. if (Number.isInteger(radius)) {
  4935. this.horizontalCornerRadius = radius;
  4936. }
  4937. }
  4938. setVerticalCornerRadius(radius) {
  4939. if (Number.isInteger(radius)) {
  4940. this.verticalCornerRadius = radius;
  4941. }
  4942. }
  4943. }
  4944. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  4945. class MarkupAnnotation extends Annotation {
  4946. constructor(params) {
  4947. super(params);
  4948. const {
  4949. dict
  4950. } = params;
  4951. if (dict.has("IRT")) {
  4952. const rawIRT = dict.getRaw("IRT");
  4953. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  4954. const rt = dict.get("RT");
  4955. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  4956. }
  4957. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  4958. const parent = dict.get("IRT");
  4959. this.setTitle(parent.get("T"));
  4960. this.data.titleObj = this._title;
  4961. this.setContents(parent.get("Contents"));
  4962. this.data.contentsObj = this._contents;
  4963. if (!parent.has("CreationDate")) {
  4964. this.data.creationDate = null;
  4965. } else {
  4966. this.setCreationDate(parent.get("CreationDate"));
  4967. this.data.creationDate = this.creationDate;
  4968. }
  4969. if (!parent.has("M")) {
  4970. this.data.modificationDate = null;
  4971. } else {
  4972. this.setModificationDate(parent.get("M"));
  4973. this.data.modificationDate = this.modificationDate;
  4974. }
  4975. this.data.hasPopup = parent.has("Popup");
  4976. if (!parent.has("C")) {
  4977. this.data.color = null;
  4978. } else {
  4979. this.setColor(parent.getArray("C"));
  4980. this.data.color = this.color;
  4981. }
  4982. } else {
  4983. this.data.titleObj = this._title;
  4984. this.setCreationDate(dict.get("CreationDate"));
  4985. this.data.creationDate = this.creationDate;
  4986. this.data.hasPopup = dict.has("Popup");
  4987. if (!dict.has("C")) {
  4988. this.data.color = null;
  4989. }
  4990. }
  4991. if (dict.has("RC")) {
  4992. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  4993. }
  4994. }
  4995. setCreationDate(creationDate) {
  4996. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  4997. }
  4998. _setDefaultAppearance({
  4999. xref,
  5000. extra,
  5001. strokeColor,
  5002. fillColor,
  5003. blendMode,
  5004. strokeAlpha,
  5005. fillAlpha,
  5006. pointsCallback
  5007. }) {
  5008. let minX = Number.MAX_VALUE;
  5009. let minY = Number.MAX_VALUE;
  5010. let maxX = Number.MIN_VALUE;
  5011. let maxY = Number.MIN_VALUE;
  5012. const buffer = ["q"];
  5013. if (extra) {
  5014. buffer.push(extra);
  5015. }
  5016. if (strokeColor) {
  5017. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  5018. }
  5019. if (fillColor) {
  5020. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  5021. }
  5022. let pointsArray = this.data.quadPoints;
  5023. if (!pointsArray) {
  5024. pointsArray = [[{
  5025. x: this.rectangle[0],
  5026. y: this.rectangle[3]
  5027. }, {
  5028. x: this.rectangle[2],
  5029. y: this.rectangle[3]
  5030. }, {
  5031. x: this.rectangle[0],
  5032. y: this.rectangle[1]
  5033. }, {
  5034. x: this.rectangle[2],
  5035. y: this.rectangle[1]
  5036. }]];
  5037. }
  5038. for (const points of pointsArray) {
  5039. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  5040. minX = Math.min(minX, mX);
  5041. maxX = Math.max(maxX, MX);
  5042. minY = Math.min(minY, mY);
  5043. maxY = Math.max(maxY, MY);
  5044. }
  5045. buffer.push("Q");
  5046. const formDict = new _primitives.Dict(xref);
  5047. const appearanceStreamDict = new _primitives.Dict(xref);
  5048. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  5049. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  5050. appearanceStream.dict = appearanceStreamDict;
  5051. formDict.set("Fm0", appearanceStream);
  5052. const gsDict = new _primitives.Dict(xref);
  5053. if (blendMode) {
  5054. gsDict.set("BM", _primitives.Name.get(blendMode));
  5055. }
  5056. if (typeof strokeAlpha === "number") {
  5057. gsDict.set("CA", strokeAlpha);
  5058. }
  5059. if (typeof fillAlpha === "number") {
  5060. gsDict.set("ca", fillAlpha);
  5061. }
  5062. const stateDict = new _primitives.Dict(xref);
  5063. stateDict.set("GS0", gsDict);
  5064. const resources = new _primitives.Dict(xref);
  5065. resources.set("ExtGState", stateDict);
  5066. resources.set("XObject", formDict);
  5067. const appearanceDict = new _primitives.Dict(xref);
  5068. appearanceDict.set("Resources", resources);
  5069. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  5070. appearanceDict.set("BBox", bbox);
  5071. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  5072. this.appearance.dict = appearanceDict;
  5073. this._streams.push(this.appearance, appearanceStream);
  5074. }
  5075. static async createNewAnnotation(xref, annotation, dependencies, params) {
  5076. const annotationRef = xref.getNewTemporaryRef();
  5077. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5078. const buffer = [];
  5079. let annotationDict;
  5080. if (ap) {
  5081. const apRef = xref.getNewTemporaryRef();
  5082. annotationDict = this.createNewDict(annotation, xref, {
  5083. apRef
  5084. });
  5085. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  5086. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  5087. dependencies.push({
  5088. ref: apRef,
  5089. data: buffer.join("")
  5090. });
  5091. } else {
  5092. annotationDict = this.createNewDict(annotation, xref, {});
  5093. }
  5094. buffer.length = 0;
  5095. const transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  5096. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  5097. return {
  5098. ref: annotationRef,
  5099. data: buffer.join("")
  5100. };
  5101. }
  5102. static async createNewPrintAnnotation(xref, annotation, params) {
  5103. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5104. const annotationDict = this.createNewDict(annotation, xref, {
  5105. ap
  5106. });
  5107. return new this.prototype.constructor({
  5108. dict: annotationDict,
  5109. xref,
  5110. isOffscreenCanvasSupported: params.isOffscreenCanvasSupported
  5111. });
  5112. }
  5113. }
  5114. exports.MarkupAnnotation = MarkupAnnotation;
  5115. class WidgetAnnotation extends Annotation {
  5116. constructor(params) {
  5117. super(params);
  5118. const {
  5119. dict,
  5120. xref
  5121. } = params;
  5122. const data = this.data;
  5123. this.ref = params.ref;
  5124. this._needAppearances = params.needAppearances;
  5125. data.annotationType = _util.AnnotationType.WIDGET;
  5126. if (data.fieldName === undefined) {
  5127. data.fieldName = this._constructFieldName(dict);
  5128. }
  5129. if (data.actions === undefined) {
  5130. data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
  5131. }
  5132. let fieldValue = (0, _core_utils.getInheritableProperty)({
  5133. dict,
  5134. key: "V",
  5135. getArray: true
  5136. });
  5137. data.fieldValue = this._decodeFormValue(fieldValue);
  5138. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  5139. dict,
  5140. key: "DV",
  5141. getArray: true
  5142. });
  5143. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  5144. if (fieldValue === undefined && params.xfaDatasets) {
  5145. const path = this._title.str;
  5146. if (path) {
  5147. this._hasValueFromXFA = true;
  5148. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  5149. }
  5150. }
  5151. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  5152. data.fieldValue = data.defaultFieldValue;
  5153. }
  5154. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  5155. this.setDefaultAppearance(params);
  5156. data.hasAppearance = this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null || data.hasAppearance;
  5157. const fieldType = (0, _core_utils.getInheritableProperty)({
  5158. dict,
  5159. key: "FT"
  5160. });
  5161. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  5162. const localResources = (0, _core_utils.getInheritableProperty)({
  5163. dict,
  5164. key: "DR"
  5165. });
  5166. const acroFormResources = params.acroForm.get("DR");
  5167. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  5168. this._fieldResources = {
  5169. localResources,
  5170. acroFormResources,
  5171. appearanceResources,
  5172. mergedResources: _primitives.Dict.merge({
  5173. xref,
  5174. dictArray: [localResources, appearanceResources, acroFormResources],
  5175. mergeSubDicts: true
  5176. })
  5177. };
  5178. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  5179. dict,
  5180. key: "Ff"
  5181. });
  5182. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  5183. data.fieldFlags = 0;
  5184. }
  5185. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  5186. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  5187. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  5188. }
  5189. _decodeFormValue(formValue) {
  5190. if (Array.isArray(formValue)) {
  5191. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  5192. } else if (formValue instanceof _primitives.Name) {
  5193. return (0, _util.stringToPDFString)(formValue.name);
  5194. } else if (typeof formValue === "string") {
  5195. return (0, _util.stringToPDFString)(formValue);
  5196. }
  5197. return null;
  5198. }
  5199. hasFieldFlag(flag) {
  5200. return !!(this.data.fieldFlags & flag);
  5201. }
  5202. getRotationMatrix(annotationStorage) {
  5203. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5204. let rotation = storageEntry && storageEntry.rotation;
  5205. if (rotation === undefined) {
  5206. rotation = this.rotation;
  5207. }
  5208. if (rotation === 0) {
  5209. return _util.IDENTITY_MATRIX;
  5210. }
  5211. const width = this.data.rect[2] - this.data.rect[0];
  5212. const height = this.data.rect[3] - this.data.rect[1];
  5213. return (0, _core_utils.getRotationMatrix)(rotation, width, height);
  5214. }
  5215. getBorderAndBackgroundAppearances(annotationStorage) {
  5216. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5217. let rotation = storageEntry && storageEntry.rotation;
  5218. if (rotation === undefined) {
  5219. rotation = this.rotation;
  5220. }
  5221. if (!this.backgroundColor && !this.borderColor) {
  5222. return "";
  5223. }
  5224. const width = this.data.rect[2] - this.data.rect[0];
  5225. const height = this.data.rect[3] - this.data.rect[1];
  5226. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  5227. let str = "";
  5228. if (this.backgroundColor) {
  5229. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  5230. }
  5231. if (this.borderColor) {
  5232. const borderWidth = this.borderStyle.width || 1;
  5233. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  5234. }
  5235. return str;
  5236. }
  5237. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5238. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  5239. return {
  5240. opList: new _operator_list.OperatorList(),
  5241. separateForm: true,
  5242. separateCanvas: false
  5243. };
  5244. }
  5245. if (!this._hasText) {
  5246. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5247. }
  5248. const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
  5249. if (this.appearance && content === null) {
  5250. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5251. }
  5252. const opList = new _operator_list.OperatorList();
  5253. if (!this._defaultAppearance || content === null) {
  5254. return {
  5255. opList,
  5256. separateForm: false,
  5257. separateCanvas: false
  5258. };
  5259. }
  5260. const matrix = [1, 0, 0, 1, 0, 0];
  5261. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  5262. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  5263. let optionalContent;
  5264. if (this.oc) {
  5265. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  5266. }
  5267. if (optionalContent !== undefined) {
  5268. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  5269. }
  5270. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  5271. const stream = new _stream.StringStream(content);
  5272. await evaluator.getOperatorList({
  5273. stream,
  5274. task,
  5275. resources: this._fieldResources.mergedResources,
  5276. operatorList: opList
  5277. });
  5278. opList.addOp(_util.OPS.endAnnotation, []);
  5279. if (optionalContent !== undefined) {
  5280. opList.addOp(_util.OPS.endMarkedContent, []);
  5281. }
  5282. return {
  5283. opList,
  5284. separateForm: false,
  5285. separateCanvas: false
  5286. };
  5287. }
  5288. _getMKDict(rotation) {
  5289. const mk = new _primitives.Dict(null);
  5290. if (rotation) {
  5291. mk.set("R", rotation);
  5292. }
  5293. if (this.borderColor) {
  5294. mk.set("BC", getPdfColorArray(this.borderColor));
  5295. }
  5296. if (this.backgroundColor) {
  5297. mk.set("BG", getPdfColorArray(this.backgroundColor));
  5298. }
  5299. return mk.size > 0 ? mk : null;
  5300. }
  5301. async save(evaluator, task, annotationStorage) {
  5302. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5303. let value = storageEntry && storageEntry.value;
  5304. let rotation = storageEntry && storageEntry.rotation;
  5305. if (value === this.data.fieldValue || value === undefined) {
  5306. if (!this._hasValueFromXFA && rotation === undefined) {
  5307. return null;
  5308. }
  5309. value = value || this.data.fieldValue;
  5310. }
  5311. if (rotation === undefined && !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])) {
  5312. return null;
  5313. }
  5314. if (rotation === undefined) {
  5315. rotation = this.rotation;
  5316. }
  5317. let appearance = null;
  5318. if (!this._needAppearances) {
  5319. appearance = await this._getAppearance(evaluator, task, _util.RenderingIntentFlag.SAVE, annotationStorage);
  5320. if (appearance === null) {
  5321. return null;
  5322. }
  5323. } else {}
  5324. let needAppearances = false;
  5325. if (appearance && appearance.needAppearances) {
  5326. needAppearances = true;
  5327. appearance = null;
  5328. }
  5329. const {
  5330. xref
  5331. } = evaluator;
  5332. const originalDict = xref.fetchIfRef(this.ref);
  5333. if (!(originalDict instanceof _primitives.Dict)) {
  5334. return null;
  5335. }
  5336. const dict = new _primitives.Dict(xref);
  5337. for (const key of originalDict.getKeys()) {
  5338. if (key !== "AP") {
  5339. dict.set(key, originalDict.getRaw(key));
  5340. }
  5341. }
  5342. const xfa = {
  5343. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5344. value
  5345. };
  5346. const encoder = val => {
  5347. return (0, _core_utils.isAscii)(val) ? val : (0, _core_utils.stringToUTF16String)(val, true);
  5348. };
  5349. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  5350. const maybeMK = this._getMKDict(rotation);
  5351. if (maybeMK) {
  5352. dict.set("MK", maybeMK);
  5353. }
  5354. const encrypt = xref.encrypt;
  5355. const originalTransform = encrypt ? encrypt.createCipherTransform(this.ref.num, this.ref.gen) : null;
  5356. const buffer = [];
  5357. const changes = [{
  5358. ref: this.ref,
  5359. data: "",
  5360. xfa,
  5361. needAppearances
  5362. }];
  5363. if (appearance !== null) {
  5364. const newRef = xref.getNewTemporaryRef();
  5365. const AP = new _primitives.Dict(xref);
  5366. dict.set("AP", AP);
  5367. AP.set("N", newRef);
  5368. let newTransform = null;
  5369. if (encrypt) {
  5370. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  5371. appearance = newTransform.encryptString(appearance);
  5372. }
  5373. const resources = this._getSaveFieldResources(xref);
  5374. const appearanceStream = new _stream.StringStream(appearance);
  5375. const appearanceDict = appearanceStream.dict = new _primitives.Dict(xref);
  5376. appearanceDict.set("Length", appearance.length);
  5377. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  5378. appearanceDict.set("Resources", resources);
  5379. appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
  5380. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  5381. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  5382. appearanceDict.set("Matrix", rotationMatrix);
  5383. }
  5384. (0, _writer.writeObject)(newRef, appearanceStream, buffer, newTransform);
  5385. changes.push({
  5386. ref: newRef,
  5387. data: buffer.join(""),
  5388. xfa: null,
  5389. needAppearances: false
  5390. });
  5391. buffer.length = 0;
  5392. }
  5393. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5394. (0, _writer.writeObject)(this.ref, dict, buffer, originalTransform);
  5395. changes[0].data = buffer.join("");
  5396. return changes;
  5397. }
  5398. async _getAppearance(evaluator, task, intent, annotationStorage) {
  5399. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  5400. if (isPassword) {
  5401. return null;
  5402. }
  5403. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5404. let value, rotation;
  5405. if (storageEntry) {
  5406. value = storageEntry.formattedValue || storageEntry.value;
  5407. rotation = storageEntry.rotation;
  5408. }
  5409. if (rotation === undefined && value === undefined && !this._needAppearances) {
  5410. if (!this._hasValueFromXFA || this.appearance) {
  5411. return null;
  5412. }
  5413. }
  5414. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5415. if (value === undefined) {
  5416. value = this.data.fieldValue;
  5417. if (!value) {
  5418. return `/Tx BMC q ${colors}Q EMC`;
  5419. }
  5420. }
  5421. if (Array.isArray(value) && value.length === 1) {
  5422. value = value[0];
  5423. }
  5424. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  5425. if (!this.data.combo) {
  5426. value = value.trim();
  5427. } else {
  5428. const option = this.data.options.find(({
  5429. exportValue
  5430. }) => value === exportValue) || this.data.options[0];
  5431. value = option && option.displayValue || "";
  5432. }
  5433. if (value === "") {
  5434. return `/Tx BMC q ${colors}Q EMC`;
  5435. }
  5436. if (rotation === undefined) {
  5437. rotation = this.rotation;
  5438. }
  5439. let lineCount = -1;
  5440. let lines;
  5441. if (this.data.multiLine) {
  5442. lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
  5443. lineCount = lines.length;
  5444. } else {
  5445. lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
  5446. }
  5447. const defaultPadding = 1;
  5448. const defaultHPadding = 2;
  5449. let totalHeight = this.data.rect[3] - this.data.rect[1];
  5450. let totalWidth = this.data.rect[2] - this.data.rect[0];
  5451. if (rotation === 90 || rotation === 270) {
  5452. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  5453. }
  5454. if (!this._defaultAppearance) {
  5455. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  5456. }
  5457. let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  5458. let defaultAppearance, fontSize, lineHeight;
  5459. const encodedLines = [];
  5460. let encodingError = false;
  5461. for (const line of lines) {
  5462. const encodedString = font.encodeString(line);
  5463. if (encodedString.length > 1) {
  5464. encodingError = true;
  5465. }
  5466. encodedLines.push(encodedString.join(""));
  5467. }
  5468. if (encodingError && intent & _util.RenderingIntentFlag.SAVE) {
  5469. return {
  5470. needAppearances: true
  5471. };
  5472. }
  5473. if (encodingError && this._isOffscreenCanvasSupported) {
  5474. const fontFamily = this.data.comb ? "monospace" : "sans-serif";
  5475. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(evaluator.xref, fontFamily);
  5476. const resources = fakeUnicodeFont.createFontResources(lines.join(""));
  5477. const newFont = resources.getRaw("Font");
  5478. if (this._fieldResources.mergedResources.has("Font")) {
  5479. const oldFont = this._fieldResources.mergedResources.get("Font");
  5480. for (const key of newFont.getKeys()) {
  5481. oldFont.set(key, newFont.getRaw(key));
  5482. }
  5483. } else {
  5484. this._fieldResources.mergedResources.set("Font", newFont);
  5485. }
  5486. const fontName = fakeUnicodeFont.fontName.name;
  5487. font = await WidgetAnnotation._getFontData(evaluator, task, {
  5488. fontName,
  5489. fontSize: 0
  5490. }, resources);
  5491. for (let i = 0, ii = encodedLines.length; i < ii; i++) {
  5492. encodedLines[i] = (0, _core_utils.stringToUTF16String)(lines[i]);
  5493. }
  5494. const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
  5495. this.data.defaultAppearanceData.fontSize = 0;
  5496. this.data.defaultAppearanceData.fontName = fontName;
  5497. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  5498. this.data.defaultAppearanceData = savedDefaultAppearance;
  5499. } else {
  5500. if (!this._isOffscreenCanvasSupported) {
  5501. (0, _util.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
  5502. }
  5503. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  5504. }
  5505. let descent = font.descent;
  5506. if (isNaN(descent)) {
  5507. descent = _util.BASELINE_FACTOR * lineHeight;
  5508. } else {
  5509. descent = Math.max(_util.BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
  5510. }
  5511. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  5512. const alignment = this.data.textAlignment;
  5513. if (this.data.multiLine) {
  5514. return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  5515. }
  5516. if (this.data.comb) {
  5517. return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  5518. }
  5519. const bottomPadding = defaultVPadding + descent;
  5520. if (alignment === 0 || alignment > 2) {
  5521. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(defaultHPadding)} ${(0, _core_utils.numberToString)(bottomPadding)} Tm (${(0, _core_utils.escapeString)(encodedLines[0])}) Tj` + " ET Q EMC";
  5522. }
  5523. const prevInfo = {
  5524. shift: 0
  5525. };
  5526. const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
  5527. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  5528. }
  5529. static async _getFontData(evaluator, task, appearanceData, resources) {
  5530. const operatorList = new _operator_list.OperatorList();
  5531. const initialState = {
  5532. font: null,
  5533. clone() {
  5534. return this;
  5535. }
  5536. };
  5537. const {
  5538. fontName,
  5539. fontSize
  5540. } = appearanceData;
  5541. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  5542. return initialState.font;
  5543. }
  5544. _getTextWidth(text, font) {
  5545. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  5546. }
  5547. _computeFontSize(height, width, text, font, lineCount) {
  5548. let {
  5549. fontSize
  5550. } = this.data.defaultAppearanceData;
  5551. let lineHeight = (fontSize || 12) * _util.LINE_FACTOR,
  5552. numberOfLines = Math.round(height / lineHeight);
  5553. if (!fontSize) {
  5554. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  5555. if (lineCount === -1) {
  5556. const textWidth = this._getTextWidth(text, font);
  5557. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, textWidth > width ? width / textWidth : Infinity));
  5558. numberOfLines = 1;
  5559. } else {
  5560. const lines = text.split(/\r\n?|\n/);
  5561. const cachedLines = [];
  5562. for (const line of lines) {
  5563. const encoded = font.encodeString(line).join("");
  5564. const glyphs = font.charsToGlyphs(encoded);
  5565. const positions = font.getCharPositions(encoded);
  5566. cachedLines.push({
  5567. line: encoded,
  5568. glyphs,
  5569. positions
  5570. });
  5571. }
  5572. const isTooBig = fsize => {
  5573. let totalHeight = 0;
  5574. for (const cache of cachedLines) {
  5575. const chunks = this._splitLine(null, font, fsize, width, cache);
  5576. totalHeight += chunks.length * fsize;
  5577. if (totalHeight > height) {
  5578. return true;
  5579. }
  5580. }
  5581. return false;
  5582. };
  5583. numberOfLines = Math.max(numberOfLines, lineCount);
  5584. while (true) {
  5585. lineHeight = height / numberOfLines;
  5586. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  5587. if (isTooBig(fontSize)) {
  5588. numberOfLines++;
  5589. continue;
  5590. }
  5591. break;
  5592. }
  5593. }
  5594. const {
  5595. fontName,
  5596. fontColor
  5597. } = this.data.defaultAppearanceData;
  5598. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  5599. fontSize,
  5600. fontName,
  5601. fontColor
  5602. });
  5603. }
  5604. return [this._defaultAppearance, fontSize, height / numberOfLines];
  5605. }
  5606. _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
  5607. let shift;
  5608. if (alignment === 1) {
  5609. const width = this._getTextWidth(text, font) * fontSize;
  5610. shift = (totalWidth - width) / 2;
  5611. } else if (alignment === 2) {
  5612. const width = this._getTextWidth(text, font) * fontSize;
  5613. shift = totalWidth - width - hPadding;
  5614. } else {
  5615. shift = hPadding;
  5616. }
  5617. const shiftStr = (0, _core_utils.numberToString)(shift - prevInfo.shift);
  5618. prevInfo.shift = shift;
  5619. vPadding = (0, _core_utils.numberToString)(vPadding);
  5620. return `${shiftStr} ${vPadding} Td (${(0, _core_utils.escapeString)(text)}) Tj`;
  5621. }
  5622. _getSaveFieldResources(xref) {
  5623. const {
  5624. localResources,
  5625. appearanceResources,
  5626. acroFormResources
  5627. } = this._fieldResources;
  5628. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  5629. if (!fontName) {
  5630. return localResources || _primitives.Dict.empty;
  5631. }
  5632. for (const resources of [localResources, appearanceResources]) {
  5633. if (resources instanceof _primitives.Dict) {
  5634. const localFont = resources.get("Font");
  5635. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  5636. return resources;
  5637. }
  5638. }
  5639. }
  5640. if (acroFormResources instanceof _primitives.Dict) {
  5641. const acroFormFont = acroFormResources.get("Font");
  5642. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  5643. const subFontDict = new _primitives.Dict(xref);
  5644. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  5645. const subResourcesDict = new _primitives.Dict(xref);
  5646. subResourcesDict.set("Font", subFontDict);
  5647. return _primitives.Dict.merge({
  5648. xref,
  5649. dictArray: [subResourcesDict, localResources],
  5650. mergeSubDicts: true
  5651. });
  5652. }
  5653. }
  5654. return localResources || _primitives.Dict.empty;
  5655. }
  5656. getFieldObject() {
  5657. return null;
  5658. }
  5659. }
  5660. class TextWidgetAnnotation extends WidgetAnnotation {
  5661. constructor(params) {
  5662. super(params);
  5663. this._hasText = true;
  5664. const dict = params.dict;
  5665. if (typeof this.data.fieldValue !== "string") {
  5666. this.data.fieldValue = "";
  5667. }
  5668. let alignment = (0, _core_utils.getInheritableProperty)({
  5669. dict,
  5670. key: "Q"
  5671. });
  5672. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  5673. alignment = null;
  5674. }
  5675. this.data.textAlignment = alignment;
  5676. let maximumLength = (0, _core_utils.getInheritableProperty)({
  5677. dict,
  5678. key: "MaxLen"
  5679. });
  5680. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  5681. maximumLength = 0;
  5682. }
  5683. this.data.maxLen = maximumLength;
  5684. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  5685. 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 !== 0;
  5686. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  5687. }
  5688. _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  5689. const combWidth = width / this.data.maxLen;
  5690. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5691. const buf = [];
  5692. const positions = font.getCharPositions(text);
  5693. for (const [start, end] of positions) {
  5694. buf.push(`(${(0, _core_utils.escapeString)(text.substring(start, end))}) Tj`);
  5695. }
  5696. const renderedComb = buf.join(` ${(0, _core_utils.numberToString)(combWidth)} 0 Td `);
  5697. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(hPadding)} ${(0, _core_utils.numberToString)(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC";
  5698. }
  5699. _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  5700. const buf = [];
  5701. const totalWidth = width - 2 * hPadding;
  5702. const prevInfo = {
  5703. shift: 0
  5704. };
  5705. for (let i = 0, ii = lines.length; i < ii; i++) {
  5706. const line = lines[i];
  5707. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  5708. for (let j = 0, jj = chunks.length; j < jj; j++) {
  5709. const chunk = chunks[j];
  5710. const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
  5711. buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
  5712. }
  5713. }
  5714. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5715. const renderedText = buf.join("\n");
  5716. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${(0, _core_utils.numberToString)(height)} Tm ${renderedText}` + " ET Q EMC";
  5717. }
  5718. _splitLine(line, font, fontSize, width, cache = {}) {
  5719. line = cache.line || line;
  5720. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  5721. if (glyphs.length <= 1) {
  5722. return [line];
  5723. }
  5724. const positions = cache.positions || font.getCharPositions(line);
  5725. const scale = fontSize / 1000;
  5726. const chunks = [];
  5727. let lastSpacePosInStringStart = -1,
  5728. lastSpacePosInStringEnd = -1,
  5729. lastSpacePos = -1,
  5730. startChunk = 0,
  5731. currentWidth = 0;
  5732. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  5733. const [start, end] = positions[i];
  5734. const glyph = glyphs[i];
  5735. const glyphWidth = glyph.width * scale;
  5736. if (glyph.unicode === " ") {
  5737. if (currentWidth + glyphWidth > width) {
  5738. chunks.push(line.substring(startChunk, start));
  5739. startChunk = start;
  5740. currentWidth = glyphWidth;
  5741. lastSpacePosInStringStart = -1;
  5742. lastSpacePos = -1;
  5743. } else {
  5744. currentWidth += glyphWidth;
  5745. lastSpacePosInStringStart = start;
  5746. lastSpacePosInStringEnd = end;
  5747. lastSpacePos = i;
  5748. }
  5749. } else {
  5750. if (currentWidth + glyphWidth > width) {
  5751. if (lastSpacePosInStringStart !== -1) {
  5752. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  5753. startChunk = lastSpacePosInStringEnd;
  5754. i = lastSpacePos + 1;
  5755. lastSpacePosInStringStart = -1;
  5756. currentWidth = 0;
  5757. } else {
  5758. chunks.push(line.substring(startChunk, start));
  5759. startChunk = start;
  5760. currentWidth = glyphWidth;
  5761. }
  5762. } else {
  5763. currentWidth += glyphWidth;
  5764. }
  5765. }
  5766. }
  5767. if (startChunk < line.length) {
  5768. chunks.push(line.substring(startChunk, line.length));
  5769. }
  5770. return chunks;
  5771. }
  5772. getFieldObject() {
  5773. return {
  5774. id: this.data.id,
  5775. value: this.data.fieldValue,
  5776. defaultValue: this.data.defaultFieldValue || "",
  5777. multiline: this.data.multiLine,
  5778. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  5779. charLimit: this.data.maxLen,
  5780. comb: this.data.comb,
  5781. editable: !this.data.readOnly,
  5782. hidden: this.data.hidden,
  5783. name: this.data.fieldName,
  5784. rect: this.data.rect,
  5785. actions: this.data.actions,
  5786. page: this.data.pageIndex,
  5787. strokeColor: this.data.borderColor,
  5788. fillColor: this.data.backgroundColor,
  5789. rotation: this.rotation,
  5790. type: "text"
  5791. };
  5792. }
  5793. }
  5794. class ButtonWidgetAnnotation extends WidgetAnnotation {
  5795. constructor(params) {
  5796. super(params);
  5797. this.checkedAppearance = null;
  5798. this.uncheckedAppearance = null;
  5799. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5800. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5801. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5802. this.data.isTooltipOnly = false;
  5803. if (this.data.checkBox) {
  5804. this._processCheckBox(params);
  5805. } else if (this.data.radioButton) {
  5806. this._processRadioButton(params);
  5807. } else if (this.data.pushButton) {
  5808. this.data.hasOwnCanvas = true;
  5809. this._processPushButton(params);
  5810. } else {
  5811. (0, _util.warn)("Invalid field flags for button widget annotation");
  5812. }
  5813. }
  5814. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5815. if (this.data.pushButton) {
  5816. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  5817. }
  5818. let value = null;
  5819. let rotation = null;
  5820. if (annotationStorage) {
  5821. const storageEntry = annotationStorage.get(this.data.id);
  5822. value = storageEntry ? storageEntry.value : null;
  5823. rotation = storageEntry ? storageEntry.rotation : null;
  5824. }
  5825. if (value === null && this.appearance) {
  5826. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5827. }
  5828. if (value === null || value === undefined) {
  5829. if (this.data.checkBox) {
  5830. value = this.data.fieldValue === this.data.exportValue;
  5831. } else {
  5832. value = this.data.fieldValue === this.data.buttonValue;
  5833. }
  5834. }
  5835. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  5836. if (appearance) {
  5837. const savedAppearance = this.appearance;
  5838. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  5839. if (rotation) {
  5840. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  5841. }
  5842. this.appearance = appearance;
  5843. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5844. this.appearance = savedAppearance;
  5845. appearance.dict.set("Matrix", savedMatrix);
  5846. return operatorList;
  5847. }
  5848. return {
  5849. opList: new _operator_list.OperatorList(),
  5850. separateForm: false,
  5851. separateCanvas: false
  5852. };
  5853. }
  5854. async save(evaluator, task, annotationStorage) {
  5855. if (this.data.checkBox) {
  5856. return this._saveCheckbox(evaluator, task, annotationStorage);
  5857. }
  5858. if (this.data.radioButton) {
  5859. return this._saveRadioButton(evaluator, task, annotationStorage);
  5860. }
  5861. return null;
  5862. }
  5863. async _saveCheckbox(evaluator, task, annotationStorage) {
  5864. if (!annotationStorage) {
  5865. return null;
  5866. }
  5867. const storageEntry = annotationStorage.get(this.data.id);
  5868. let rotation = storageEntry && storageEntry.rotation;
  5869. let value = storageEntry && storageEntry.value;
  5870. if (rotation === undefined) {
  5871. if (value === undefined) {
  5872. return null;
  5873. }
  5874. const defaultValue = this.data.fieldValue === this.data.exportValue;
  5875. if (defaultValue === value) {
  5876. return null;
  5877. }
  5878. }
  5879. const dict = evaluator.xref.fetchIfRef(this.ref);
  5880. if (!(dict instanceof _primitives.Dict)) {
  5881. return null;
  5882. }
  5883. if (rotation === undefined) {
  5884. rotation = this.rotation;
  5885. }
  5886. if (value === undefined) {
  5887. value = this.data.fieldValue === this.data.exportValue;
  5888. }
  5889. const xfa = {
  5890. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5891. value: value ? this.data.exportValue : ""
  5892. };
  5893. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  5894. dict.set("V", name);
  5895. dict.set("AS", name);
  5896. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5897. const maybeMK = this._getMKDict(rotation);
  5898. if (maybeMK) {
  5899. dict.set("MK", maybeMK);
  5900. }
  5901. const encrypt = evaluator.xref.encrypt;
  5902. let originalTransform = null;
  5903. if (encrypt) {
  5904. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5905. }
  5906. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5907. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5908. buffer.push("\nendobj\n");
  5909. return [{
  5910. ref: this.ref,
  5911. data: buffer.join(""),
  5912. xfa
  5913. }];
  5914. }
  5915. async _saveRadioButton(evaluator, task, annotationStorage) {
  5916. if (!annotationStorage) {
  5917. return null;
  5918. }
  5919. const storageEntry = annotationStorage.get(this.data.id);
  5920. let rotation = storageEntry && storageEntry.rotation;
  5921. let value = storageEntry && storageEntry.value;
  5922. if (rotation === undefined) {
  5923. if (value === undefined) {
  5924. return null;
  5925. }
  5926. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  5927. if (defaultValue === value) {
  5928. return null;
  5929. }
  5930. }
  5931. const dict = evaluator.xref.fetchIfRef(this.ref);
  5932. if (!(dict instanceof _primitives.Dict)) {
  5933. return null;
  5934. }
  5935. if (value === undefined) {
  5936. value = this.data.fieldValue === this.data.buttonValue;
  5937. }
  5938. if (rotation === undefined) {
  5939. rotation = this.rotation;
  5940. }
  5941. const xfa = {
  5942. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5943. value: value ? this.data.buttonValue : ""
  5944. };
  5945. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  5946. let parentBuffer = null;
  5947. const encrypt = evaluator.xref.encrypt;
  5948. if (value) {
  5949. if (this.parent instanceof _primitives.Ref) {
  5950. const parent = evaluator.xref.fetch(this.parent);
  5951. let parentTransform = null;
  5952. if (encrypt) {
  5953. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  5954. }
  5955. parent.set("V", name);
  5956. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  5957. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  5958. parentBuffer.push("\nendobj\n");
  5959. } else if (this.parent instanceof _primitives.Dict) {
  5960. this.parent.set("V", name);
  5961. }
  5962. }
  5963. dict.set("AS", name);
  5964. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5965. const maybeMK = this._getMKDict(rotation);
  5966. if (maybeMK) {
  5967. dict.set("MK", maybeMK);
  5968. }
  5969. let originalTransform = null;
  5970. if (encrypt) {
  5971. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5972. }
  5973. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5974. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5975. buffer.push("\nendobj\n");
  5976. const newRefs = [{
  5977. ref: this.ref,
  5978. data: buffer.join(""),
  5979. xfa
  5980. }];
  5981. if (parentBuffer !== null) {
  5982. newRefs.push({
  5983. ref: this.parent,
  5984. data: parentBuffer.join(""),
  5985. xfa: null
  5986. });
  5987. }
  5988. return newRefs;
  5989. }
  5990. _getDefaultCheckedAppearance(params, type) {
  5991. const width = this.data.rect[2] - this.data.rect[0];
  5992. const height = this.data.rect[3] - this.data.rect[1];
  5993. const bbox = [0, 0, width, height];
  5994. const FONT_RATIO = 0.8;
  5995. const fontSize = Math.min(width, height) * FONT_RATIO;
  5996. let metrics, char;
  5997. if (type === "check") {
  5998. metrics = {
  5999. width: 0.755 * fontSize,
  6000. height: 0.705 * fontSize
  6001. };
  6002. char = "\x33";
  6003. } else if (type === "disc") {
  6004. metrics = {
  6005. width: 0.791 * fontSize,
  6006. height: 0.705 * fontSize
  6007. };
  6008. char = "\x6C";
  6009. } else {
  6010. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  6011. }
  6012. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  6013. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  6014. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  6015. const appearanceStreamDict = new _primitives.Dict(params.xref);
  6016. appearanceStreamDict.set("FormType", 1);
  6017. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6018. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6019. appearanceStreamDict.set("BBox", bbox);
  6020. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  6021. appearanceStreamDict.set("Length", appearance.length);
  6022. const resources = new _primitives.Dict(params.xref);
  6023. const font = new _primitives.Dict(params.xref);
  6024. font.set("PdfJsZaDb", this.fallbackFontDict);
  6025. resources.set("Font", font);
  6026. appearanceStreamDict.set("Resources", resources);
  6027. this.checkedAppearance = new _stream.StringStream(appearance);
  6028. this.checkedAppearance.dict = appearanceStreamDict;
  6029. this._streams.push(this.checkedAppearance);
  6030. }
  6031. _processCheckBox(params) {
  6032. const customAppearance = params.dict.get("AP");
  6033. if (!(customAppearance instanceof _primitives.Dict)) {
  6034. return;
  6035. }
  6036. const normalAppearance = customAppearance.get("N");
  6037. if (!(normalAppearance instanceof _primitives.Dict)) {
  6038. return;
  6039. }
  6040. const asValue = this._decodeFormValue(params.dict.get("AS"));
  6041. if (typeof asValue === "string") {
  6042. this.data.fieldValue = asValue;
  6043. }
  6044. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  6045. const exportValues = normalAppearance.getKeys();
  6046. if (exportValues.length === 0) {
  6047. exportValues.push("Off", yes);
  6048. } else if (exportValues.length === 1) {
  6049. if (exportValues[0] === "Off") {
  6050. exportValues.push(yes);
  6051. } else {
  6052. exportValues.unshift("Off");
  6053. }
  6054. } else if (exportValues.includes(yes)) {
  6055. exportValues.length = 0;
  6056. exportValues.push("Off", yes);
  6057. } else {
  6058. const otherYes = exportValues.find(v => v !== "Off");
  6059. exportValues.length = 0;
  6060. exportValues.push("Off", otherYes);
  6061. }
  6062. if (!exportValues.includes(this.data.fieldValue)) {
  6063. this.data.fieldValue = "Off";
  6064. }
  6065. this.data.exportValue = exportValues[1];
  6066. const checkedAppearance = normalAppearance.get(this.data.exportValue);
  6067. this.checkedAppearance = checkedAppearance instanceof _base_stream.BaseStream ? checkedAppearance : null;
  6068. const uncheckedAppearance = normalAppearance.get("Off");
  6069. this.uncheckedAppearance = uncheckedAppearance instanceof _base_stream.BaseStream ? uncheckedAppearance : null;
  6070. if (this.checkedAppearance) {
  6071. this._streams.push(this.checkedAppearance);
  6072. } else {
  6073. this._getDefaultCheckedAppearance(params, "check");
  6074. }
  6075. if (this.uncheckedAppearance) {
  6076. this._streams.push(this.uncheckedAppearance);
  6077. }
  6078. this._fallbackFontDict = this.fallbackFontDict;
  6079. }
  6080. _processRadioButton(params) {
  6081. this.data.fieldValue = this.data.buttonValue = null;
  6082. const fieldParent = params.dict.get("Parent");
  6083. if (fieldParent instanceof _primitives.Dict) {
  6084. this.parent = params.dict.getRaw("Parent");
  6085. const fieldParentValue = fieldParent.get("V");
  6086. if (fieldParentValue instanceof _primitives.Name) {
  6087. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  6088. }
  6089. }
  6090. const appearanceStates = params.dict.get("AP");
  6091. if (!(appearanceStates instanceof _primitives.Dict)) {
  6092. return;
  6093. }
  6094. const normalAppearance = appearanceStates.get("N");
  6095. if (!(normalAppearance instanceof _primitives.Dict)) {
  6096. return;
  6097. }
  6098. for (const key of normalAppearance.getKeys()) {
  6099. if (key !== "Off") {
  6100. this.data.buttonValue = this._decodeFormValue(key);
  6101. break;
  6102. }
  6103. }
  6104. const checkedAppearance = normalAppearance.get(this.data.buttonValue);
  6105. this.checkedAppearance = checkedAppearance instanceof _base_stream.BaseStream ? checkedAppearance : null;
  6106. const uncheckedAppearance = normalAppearance.get("Off");
  6107. this.uncheckedAppearance = uncheckedAppearance instanceof _base_stream.BaseStream ? uncheckedAppearance : null;
  6108. if (this.checkedAppearance) {
  6109. this._streams.push(this.checkedAppearance);
  6110. } else {
  6111. this._getDefaultCheckedAppearance(params, "disc");
  6112. }
  6113. if (this.uncheckedAppearance) {
  6114. this._streams.push(this.uncheckedAppearance);
  6115. }
  6116. this._fallbackFontDict = this.fallbackFontDict;
  6117. }
  6118. _processPushButton(params) {
  6119. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  6120. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  6121. return;
  6122. }
  6123. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  6124. _catalog.Catalog.parseDestDictionary({
  6125. destDict: params.dict,
  6126. resultObj: this.data,
  6127. docBaseUrl: params.pdfManager.docBaseUrl,
  6128. docAttachments: params.attachments
  6129. });
  6130. }
  6131. getFieldObject() {
  6132. let type = "button";
  6133. let exportValues;
  6134. if (this.data.checkBox) {
  6135. type = "checkbox";
  6136. exportValues = this.data.exportValue;
  6137. } else if (this.data.radioButton) {
  6138. type = "radiobutton";
  6139. exportValues = this.data.buttonValue;
  6140. }
  6141. return {
  6142. id: this.data.id,
  6143. value: this.data.fieldValue || "Off",
  6144. defaultValue: this.data.defaultFieldValue,
  6145. exportValues,
  6146. editable: !this.data.readOnly,
  6147. name: this.data.fieldName,
  6148. rect: this.data.rect,
  6149. hidden: this.data.hidden,
  6150. actions: this.data.actions,
  6151. page: this.data.pageIndex,
  6152. strokeColor: this.data.borderColor,
  6153. fillColor: this.data.backgroundColor,
  6154. rotation: this.rotation,
  6155. type
  6156. };
  6157. }
  6158. get fallbackFontDict() {
  6159. const dict = new _primitives.Dict();
  6160. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  6161. dict.set("Type", _primitives.Name.get("FallbackType"));
  6162. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  6163. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  6164. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  6165. }
  6166. }
  6167. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  6168. constructor(params) {
  6169. super(params);
  6170. const {
  6171. dict,
  6172. xref
  6173. } = params;
  6174. this.data.options = [];
  6175. const options = (0, _core_utils.getInheritableProperty)({
  6176. dict,
  6177. key: "Opt"
  6178. });
  6179. if (Array.isArray(options)) {
  6180. for (let i = 0, ii = options.length; i < ii; i++) {
  6181. const option = xref.fetchIfRef(options[i]);
  6182. const isOptionArray = Array.isArray(option);
  6183. this.data.options[i] = {
  6184. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  6185. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  6186. };
  6187. }
  6188. }
  6189. if (typeof this.data.fieldValue === "string") {
  6190. this.data.fieldValue = [this.data.fieldValue];
  6191. } else if (!this.data.fieldValue) {
  6192. this.data.fieldValue = [];
  6193. }
  6194. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  6195. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  6196. this._hasText = true;
  6197. }
  6198. getFieldObject() {
  6199. const type = this.data.combo ? "combobox" : "listbox";
  6200. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  6201. return {
  6202. id: this.data.id,
  6203. value,
  6204. defaultValue: this.data.defaultFieldValue,
  6205. editable: !this.data.readOnly,
  6206. name: this.data.fieldName,
  6207. rect: this.data.rect,
  6208. numItems: this.data.fieldValue.length,
  6209. multipleSelection: this.data.multiSelect,
  6210. hidden: this.data.hidden,
  6211. actions: this.data.actions,
  6212. items: this.data.options,
  6213. page: this.data.pageIndex,
  6214. strokeColor: this.data.borderColor,
  6215. fillColor: this.data.backgroundColor,
  6216. rotation: this.rotation,
  6217. type
  6218. };
  6219. }
  6220. async _getAppearance(evaluator, task, intent, annotationStorage) {
  6221. if (this.data.combo) {
  6222. return super._getAppearance(evaluator, task, intent, annotationStorage);
  6223. }
  6224. let exportedValue, rotation;
  6225. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  6226. if (storageEntry) {
  6227. rotation = storageEntry.rotation;
  6228. exportedValue = storageEntry.value;
  6229. }
  6230. if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
  6231. return null;
  6232. }
  6233. if (exportedValue === undefined) {
  6234. exportedValue = this.data.fieldValue;
  6235. } else if (!Array.isArray(exportedValue)) {
  6236. exportedValue = [exportedValue];
  6237. }
  6238. const defaultPadding = 1;
  6239. const defaultHPadding = 2;
  6240. let totalHeight = this.data.rect[3] - this.data.rect[1];
  6241. let totalWidth = this.data.rect[2] - this.data.rect[0];
  6242. if (rotation === 90 || rotation === 270) {
  6243. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  6244. }
  6245. const lineCount = this.data.options.length;
  6246. const valueIndices = [];
  6247. for (let i = 0; i < lineCount; i++) {
  6248. const {
  6249. exportValue
  6250. } = this.data.options[i];
  6251. if (exportedValue.includes(exportValue)) {
  6252. valueIndices.push(i);
  6253. }
  6254. }
  6255. if (!this._defaultAppearance) {
  6256. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  6257. }
  6258. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  6259. let defaultAppearance;
  6260. let {
  6261. fontSize
  6262. } = this.data.defaultAppearanceData;
  6263. if (!fontSize) {
  6264. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  6265. let lineWidth = -1;
  6266. let value;
  6267. for (const {
  6268. displayValue
  6269. } of this.data.options) {
  6270. const width = this._getTextWidth(displayValue, font);
  6271. if (width > lineWidth) {
  6272. lineWidth = width;
  6273. value = displayValue;
  6274. }
  6275. }
  6276. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
  6277. } else {
  6278. defaultAppearance = this._defaultAppearance;
  6279. }
  6280. const lineHeight = fontSize * _util.LINE_FACTOR;
  6281. const vPadding = (lineHeight - fontSize) / 2;
  6282. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  6283. let firstIndex;
  6284. if (valueIndices.length === 1) {
  6285. const valuePosition = valueIndices[0];
  6286. const indexInPage = valuePosition % numberOfVisibleLines;
  6287. firstIndex = valuePosition - indexInPage;
  6288. } else {
  6289. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  6290. }
  6291. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  6292. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  6293. if (valueIndices.length) {
  6294. buf.push("0.600006 0.756866 0.854904 rg");
  6295. for (const index of valueIndices) {
  6296. if (firstIndex <= index && index < end) {
  6297. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  6298. }
  6299. }
  6300. }
  6301. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  6302. const prevInfo = {
  6303. shift: 0
  6304. };
  6305. for (let i = firstIndex; i < end; i++) {
  6306. const {
  6307. displayValue
  6308. } = this.data.options[i];
  6309. const vpadding = i === firstIndex ? vPadding : 0;
  6310. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
  6311. }
  6312. buf.push("ET Q EMC");
  6313. return buf.join("\n");
  6314. }
  6315. }
  6316. class SignatureWidgetAnnotation extends WidgetAnnotation {
  6317. constructor(params) {
  6318. super(params);
  6319. this.data.fieldValue = null;
  6320. }
  6321. getFieldObject() {
  6322. return {
  6323. id: this.data.id,
  6324. value: null,
  6325. page: this.data.pageIndex,
  6326. type: "signature"
  6327. };
  6328. }
  6329. }
  6330. class TextAnnotation extends MarkupAnnotation {
  6331. constructor(params) {
  6332. const DEFAULT_ICON_SIZE = 22;
  6333. super(params);
  6334. const {
  6335. dict
  6336. } = params;
  6337. this.data.annotationType = _util.AnnotationType.TEXT;
  6338. if (this.data.hasAppearance) {
  6339. this.data.name = "NoIcon";
  6340. } else {
  6341. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  6342. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  6343. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  6344. }
  6345. if (dict.has("State")) {
  6346. this.data.state = dict.get("State") || null;
  6347. this.data.stateModel = dict.get("StateModel") || null;
  6348. } else {
  6349. this.data.state = null;
  6350. this.data.stateModel = null;
  6351. }
  6352. }
  6353. }
  6354. class LinkAnnotation extends Annotation {
  6355. constructor(params) {
  6356. super(params);
  6357. this.data.annotationType = _util.AnnotationType.LINK;
  6358. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  6359. if (quadPoints) {
  6360. this.data.quadPoints = quadPoints;
  6361. }
  6362. this.data.borderColor = this.data.borderColor || this.data.color;
  6363. _catalog.Catalog.parseDestDictionary({
  6364. destDict: params.dict,
  6365. resultObj: this.data,
  6366. docBaseUrl: params.pdfManager.docBaseUrl,
  6367. docAttachments: params.attachments
  6368. });
  6369. }
  6370. }
  6371. class PopupAnnotation extends Annotation {
  6372. constructor(params) {
  6373. super(params);
  6374. const {
  6375. dict
  6376. } = params;
  6377. this.data.annotationType = _util.AnnotationType.POPUP;
  6378. let parentItem = dict.get("Parent");
  6379. if (!parentItem) {
  6380. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  6381. return;
  6382. }
  6383. const parentSubtype = parentItem.get("Subtype");
  6384. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  6385. const rawParent = dict.getRaw("Parent");
  6386. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  6387. const parentRect = parentItem.getArray("Rect");
  6388. if (Array.isArray(parentRect) && parentRect.length === 4) {
  6389. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  6390. } else {
  6391. this.data.parentRect = [0, 0, 0, 0];
  6392. }
  6393. const rt = parentItem.get("RT");
  6394. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  6395. parentItem = parentItem.get("IRT");
  6396. }
  6397. if (!parentItem.has("M")) {
  6398. this.data.modificationDate = null;
  6399. } else {
  6400. this.setModificationDate(parentItem.get("M"));
  6401. this.data.modificationDate = this.modificationDate;
  6402. }
  6403. if (!parentItem.has("C")) {
  6404. this.data.color = null;
  6405. } else {
  6406. this.setColor(parentItem.getArray("C"));
  6407. this.data.color = this.color;
  6408. }
  6409. if (!this.viewable) {
  6410. const parentFlags = parentItem.get("F");
  6411. if (this._isViewable(parentFlags)) {
  6412. this.setFlags(parentFlags);
  6413. }
  6414. }
  6415. this.setTitle(parentItem.get("T"));
  6416. this.data.titleObj = this._title;
  6417. this.setContents(parentItem.get("Contents"));
  6418. this.data.contentsObj = this._contents;
  6419. if (parentItem.has("RC")) {
  6420. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  6421. }
  6422. }
  6423. }
  6424. exports.PopupAnnotation = PopupAnnotation;
  6425. class FreeTextAnnotation extends MarkupAnnotation {
  6426. constructor(params) {
  6427. super(params);
  6428. const {
  6429. xref
  6430. } = params;
  6431. this.data.annotationType = _util.AnnotationType.FREETEXT;
  6432. this.setDefaultAppearance(params);
  6433. if (!this.appearance && this._isOffscreenCanvasSupported) {
  6434. const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(xref, "sans-serif");
  6435. const fontData = this.data.defaultAppearanceData;
  6436. this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontData.fontSize || 10, fontData.fontColor);
  6437. this._streams.push(this.appearance, _default_appearance.FakeUnicodeFont.toUnicodeStream);
  6438. } else if (!this._isOffscreenCanvasSupported) {
  6439. (0, _util.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
  6440. }
  6441. }
  6442. get hasTextContent() {
  6443. return !!this.appearance;
  6444. }
  6445. static createNewDict(annotation, xref, {
  6446. apRef,
  6447. ap
  6448. }) {
  6449. const {
  6450. color,
  6451. fontSize,
  6452. rect,
  6453. rotation,
  6454. user,
  6455. value
  6456. } = annotation;
  6457. const freetext = new _primitives.Dict(xref);
  6458. freetext.set("Type", _primitives.Name.get("Annot"));
  6459. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  6460. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6461. freetext.set("Rect", rect);
  6462. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  6463. freetext.set("DA", da);
  6464. freetext.set("Contents", (0, _core_utils.isAscii)(value) ? value : (0, _core_utils.stringToUTF16String)(value, true));
  6465. freetext.set("F", 4);
  6466. freetext.set("Border", [0, 0, 0]);
  6467. freetext.set("Rotate", rotation);
  6468. if (user) {
  6469. freetext.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true));
  6470. }
  6471. if (apRef || ap) {
  6472. const n = new _primitives.Dict(xref);
  6473. freetext.set("AP", n);
  6474. if (apRef) {
  6475. n.set("N", apRef);
  6476. } else {
  6477. n.set("N", ap);
  6478. }
  6479. }
  6480. return freetext;
  6481. }
  6482. static async createNewAppearanceStream(annotation, xref, params) {
  6483. const {
  6484. baseFontRef,
  6485. evaluator,
  6486. task
  6487. } = params;
  6488. const {
  6489. color,
  6490. fontSize,
  6491. rect,
  6492. rotation,
  6493. value
  6494. } = annotation;
  6495. const resources = new _primitives.Dict(xref);
  6496. const font = new _primitives.Dict(xref);
  6497. if (baseFontRef) {
  6498. font.set("Helv", baseFontRef);
  6499. } else {
  6500. const baseFont = new _primitives.Dict(xref);
  6501. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  6502. baseFont.set("Type", _primitives.Name.get("Font"));
  6503. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  6504. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  6505. font.set("Helv", baseFont);
  6506. }
  6507. resources.set("Font", font);
  6508. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  6509. fontName: "Helvetica",
  6510. fontSize
  6511. }, resources);
  6512. const [x1, y1, x2, y2] = rect;
  6513. let w = x2 - x1;
  6514. let h = y2 - y1;
  6515. if (rotation % 180 !== 0) {
  6516. [w, h] = [h, w];
  6517. }
  6518. const lines = value.split("\n");
  6519. const scale = fontSize / 1000;
  6520. let totalWidth = -Infinity;
  6521. const encodedLines = [];
  6522. for (let line of lines) {
  6523. const encoded = helv.encodeString(line);
  6524. if (encoded.length > 1) {
  6525. return null;
  6526. }
  6527. line = encoded.join("");
  6528. encodedLines.push(line);
  6529. let lineWidth = 0;
  6530. const glyphs = helv.charsToGlyphs(line);
  6531. for (const glyph of glyphs) {
  6532. lineWidth += glyph.width * scale;
  6533. }
  6534. totalWidth = Math.max(totalWidth, lineWidth);
  6535. }
  6536. let hscale = 1;
  6537. if (totalWidth > w) {
  6538. hscale = w / totalWidth;
  6539. }
  6540. let vscale = 1;
  6541. const lineHeight = _util.LINE_FACTOR * fontSize;
  6542. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  6543. const totalHeight = lineHeight * lines.length;
  6544. if (totalHeight > h) {
  6545. vscale = h / totalHeight;
  6546. }
  6547. const fscale = Math.min(hscale, vscale);
  6548. const newFontSize = fontSize * fscale;
  6549. const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${(0, _default_appearance.getPdfColor)(color, true)}`, `/Helv ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
  6550. const vShift = (0, _core_utils.numberToString)(lineHeight);
  6551. for (const line of encodedLines) {
  6552. buffer.push(`0 -${vShift} Td (${(0, _core_utils.escapeString)(line)}) Tj`);
  6553. }
  6554. buffer.push("ET", "Q");
  6555. const appearance = buffer.join("\n");
  6556. const appearanceStreamDict = new _primitives.Dict(xref);
  6557. appearanceStreamDict.set("FormType", 1);
  6558. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6559. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6560. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6561. appearanceStreamDict.set("Length", appearance.length);
  6562. appearanceStreamDict.set("Resources", resources);
  6563. if (rotation) {
  6564. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  6565. appearanceStreamDict.set("Matrix", matrix);
  6566. }
  6567. const ap = new _stream.StringStream(appearance);
  6568. ap.dict = appearanceStreamDict;
  6569. return ap;
  6570. }
  6571. }
  6572. class LineAnnotation extends MarkupAnnotation {
  6573. constructor(params) {
  6574. super(params);
  6575. const {
  6576. dict,
  6577. xref
  6578. } = params;
  6579. this.data.annotationType = _util.AnnotationType.LINE;
  6580. const lineCoordinates = dict.getArray("L");
  6581. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  6582. this.setLineEndings(dict.getArray("LE"));
  6583. this.data.lineEndings = this.lineEndings;
  6584. if (!this.appearance) {
  6585. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6586. const strokeAlpha = dict.get("CA");
  6587. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6588. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6589. const fillAlpha = fillColor ? strokeAlpha : null;
  6590. const borderWidth = this.borderStyle.width || 1,
  6591. borderAdjust = 2 * borderWidth;
  6592. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  6593. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6594. this.rectangle = bbox;
  6595. }
  6596. this._setDefaultAppearance({
  6597. xref,
  6598. extra: `${borderWidth} w`,
  6599. strokeColor,
  6600. fillColor,
  6601. strokeAlpha,
  6602. fillAlpha,
  6603. pointsCallback: (buffer, points) => {
  6604. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  6605. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  6606. }
  6607. });
  6608. }
  6609. }
  6610. }
  6611. class SquareAnnotation extends MarkupAnnotation {
  6612. constructor(params) {
  6613. super(params);
  6614. const {
  6615. dict,
  6616. xref
  6617. } = params;
  6618. this.data.annotationType = _util.AnnotationType.SQUARE;
  6619. if (!this.appearance) {
  6620. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6621. const strokeAlpha = dict.get("CA");
  6622. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6623. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6624. const fillAlpha = fillColor ? strokeAlpha : null;
  6625. if (this.borderStyle.width === 0 && !fillColor) {
  6626. return;
  6627. }
  6628. this._setDefaultAppearance({
  6629. xref,
  6630. extra: `${this.borderStyle.width} w`,
  6631. strokeColor,
  6632. fillColor,
  6633. strokeAlpha,
  6634. fillAlpha,
  6635. pointsCallback: (buffer, points) => {
  6636. const x = points[2].x + this.borderStyle.width / 2;
  6637. const y = points[2].y + this.borderStyle.width / 2;
  6638. const width = points[3].x - points[2].x - this.borderStyle.width;
  6639. const height = points[1].y - points[3].y - this.borderStyle.width;
  6640. buffer.push(`${x} ${y} ${width} ${height} re`);
  6641. if (fillColor) {
  6642. buffer.push("B");
  6643. } else {
  6644. buffer.push("S");
  6645. }
  6646. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6647. }
  6648. });
  6649. }
  6650. }
  6651. }
  6652. class CircleAnnotation extends MarkupAnnotation {
  6653. constructor(params) {
  6654. super(params);
  6655. const {
  6656. dict,
  6657. xref
  6658. } = params;
  6659. this.data.annotationType = _util.AnnotationType.CIRCLE;
  6660. if (!this.appearance) {
  6661. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6662. const strokeAlpha = dict.get("CA");
  6663. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  6664. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  6665. const fillAlpha = fillColor ? strokeAlpha : null;
  6666. if (this.borderStyle.width === 0 && !fillColor) {
  6667. return;
  6668. }
  6669. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  6670. this._setDefaultAppearance({
  6671. xref,
  6672. extra: `${this.borderStyle.width} w`,
  6673. strokeColor,
  6674. fillColor,
  6675. strokeAlpha,
  6676. fillAlpha,
  6677. pointsCallback: (buffer, points) => {
  6678. const x0 = points[0].x + this.borderStyle.width / 2;
  6679. const y0 = points[0].y - this.borderStyle.width / 2;
  6680. const x1 = points[3].x - this.borderStyle.width / 2;
  6681. const y1 = points[3].y + this.borderStyle.width / 2;
  6682. const xMid = x0 + (x1 - x0) / 2;
  6683. const yMid = y0 + (y1 - y0) / 2;
  6684. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  6685. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  6686. 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");
  6687. if (fillColor) {
  6688. buffer.push("B");
  6689. } else {
  6690. buffer.push("S");
  6691. }
  6692. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6693. }
  6694. });
  6695. }
  6696. }
  6697. }
  6698. class PolylineAnnotation extends MarkupAnnotation {
  6699. constructor(params) {
  6700. super(params);
  6701. const {
  6702. dict,
  6703. xref
  6704. } = params;
  6705. this.data.annotationType = _util.AnnotationType.POLYLINE;
  6706. this.data.vertices = [];
  6707. if (!(this instanceof PolygonAnnotation)) {
  6708. this.setLineEndings(dict.getArray("LE"));
  6709. this.data.lineEndings = this.lineEndings;
  6710. }
  6711. const rawVertices = dict.getArray("Vertices");
  6712. if (!Array.isArray(rawVertices)) {
  6713. return;
  6714. }
  6715. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  6716. this.data.vertices.push({
  6717. x: rawVertices[i],
  6718. y: rawVertices[i + 1]
  6719. });
  6720. }
  6721. if (!this.appearance) {
  6722. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6723. const strokeAlpha = dict.get("CA");
  6724. const borderWidth = this.borderStyle.width || 1,
  6725. borderAdjust = 2 * borderWidth;
  6726. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6727. for (const vertex of this.data.vertices) {
  6728. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6729. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6730. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6731. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6732. }
  6733. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6734. this.rectangle = bbox;
  6735. }
  6736. this._setDefaultAppearance({
  6737. xref,
  6738. extra: `${borderWidth} w`,
  6739. strokeColor,
  6740. strokeAlpha,
  6741. pointsCallback: (buffer, points) => {
  6742. const vertices = this.data.vertices;
  6743. for (let i = 0, ii = vertices.length; i < ii; i++) {
  6744. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  6745. }
  6746. buffer.push("S");
  6747. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6748. }
  6749. });
  6750. }
  6751. }
  6752. }
  6753. class PolygonAnnotation extends PolylineAnnotation {
  6754. constructor(params) {
  6755. super(params);
  6756. this.data.annotationType = _util.AnnotationType.POLYGON;
  6757. }
  6758. }
  6759. class CaretAnnotation extends MarkupAnnotation {
  6760. constructor(params) {
  6761. super(params);
  6762. this.data.annotationType = _util.AnnotationType.CARET;
  6763. }
  6764. }
  6765. class InkAnnotation extends MarkupAnnotation {
  6766. constructor(params) {
  6767. super(params);
  6768. const {
  6769. dict,
  6770. xref
  6771. } = params;
  6772. this.data.annotationType = _util.AnnotationType.INK;
  6773. this.data.inkLists = [];
  6774. const rawInkLists = dict.getArray("InkList");
  6775. if (!Array.isArray(rawInkLists)) {
  6776. return;
  6777. }
  6778. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  6779. this.data.inkLists.push([]);
  6780. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  6781. this.data.inkLists[i].push({
  6782. x: xref.fetchIfRef(rawInkLists[i][j]),
  6783. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  6784. });
  6785. }
  6786. }
  6787. if (!this.appearance) {
  6788. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6789. const strokeAlpha = dict.get("CA");
  6790. const borderWidth = this.borderStyle.width || 1,
  6791. borderAdjust = 2 * borderWidth;
  6792. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6793. for (const inkLists of this.data.inkLists) {
  6794. for (const vertex of inkLists) {
  6795. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6796. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6797. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6798. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6799. }
  6800. }
  6801. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6802. this.rectangle = bbox;
  6803. }
  6804. this._setDefaultAppearance({
  6805. xref,
  6806. extra: `${borderWidth} w`,
  6807. strokeColor,
  6808. strokeAlpha,
  6809. pointsCallback: (buffer, points) => {
  6810. for (const inkList of this.data.inkLists) {
  6811. for (let i = 0, ii = inkList.length; i < ii; i++) {
  6812. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  6813. }
  6814. buffer.push("S");
  6815. }
  6816. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6817. }
  6818. });
  6819. }
  6820. }
  6821. static createNewDict(annotation, xref, {
  6822. apRef,
  6823. ap
  6824. }) {
  6825. const {
  6826. paths,
  6827. rect,
  6828. rotation
  6829. } = annotation;
  6830. const ink = new _primitives.Dict(xref);
  6831. ink.set("Type", _primitives.Name.get("Annot"));
  6832. ink.set("Subtype", _primitives.Name.get("Ink"));
  6833. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6834. ink.set("Rect", rect);
  6835. ink.set("InkList", paths.map(p => p.points));
  6836. ink.set("F", 4);
  6837. ink.set("Border", [0, 0, 0]);
  6838. ink.set("Rotate", rotation);
  6839. const n = new _primitives.Dict(xref);
  6840. ink.set("AP", n);
  6841. if (apRef) {
  6842. n.set("N", apRef);
  6843. } else {
  6844. n.set("N", ap);
  6845. }
  6846. return ink;
  6847. }
  6848. static async createNewAppearanceStream(annotation, xref, params) {
  6849. const {
  6850. color,
  6851. rect,
  6852. rotation,
  6853. paths,
  6854. thickness,
  6855. opacity
  6856. } = annotation;
  6857. const [x1, y1, x2, y2] = rect;
  6858. let w = x2 - x1;
  6859. let h = y2 - y1;
  6860. if (rotation % 180 !== 0) {
  6861. [w, h] = [h, w];
  6862. }
  6863. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  6864. if (opacity !== 1) {
  6865. appearanceBuffer.push("/R0 gs");
  6866. }
  6867. const buffer = [];
  6868. for (const {
  6869. bezier
  6870. } of paths) {
  6871. buffer.length = 0;
  6872. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  6873. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  6874. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  6875. buffer.push(`${curve} c`);
  6876. }
  6877. buffer.push("S");
  6878. appearanceBuffer.push(buffer.join("\n"));
  6879. }
  6880. const appearance = appearanceBuffer.join("\n");
  6881. const appearanceStreamDict = new _primitives.Dict(xref);
  6882. appearanceStreamDict.set("FormType", 1);
  6883. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6884. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6885. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6886. appearanceStreamDict.set("Length", appearance.length);
  6887. if (rotation) {
  6888. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  6889. appearanceStreamDict.set("Matrix", matrix);
  6890. }
  6891. if (opacity !== 1) {
  6892. const resources = new _primitives.Dict(xref);
  6893. const extGState = new _primitives.Dict(xref);
  6894. const r0 = new _primitives.Dict(xref);
  6895. r0.set("CA", opacity);
  6896. r0.set("Type", _primitives.Name.get("ExtGState"));
  6897. extGState.set("R0", r0);
  6898. resources.set("ExtGState", extGState);
  6899. appearanceStreamDict.set("Resources", resources);
  6900. }
  6901. const ap = new _stream.StringStream(appearance);
  6902. ap.dict = appearanceStreamDict;
  6903. return ap;
  6904. }
  6905. }
  6906. class HighlightAnnotation extends MarkupAnnotation {
  6907. constructor(params) {
  6908. super(params);
  6909. const {
  6910. dict,
  6911. xref
  6912. } = params;
  6913. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  6914. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  6915. if (quadPoints) {
  6916. const resources = this.appearance && this.appearance.dict.get("Resources");
  6917. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  6918. if (this.appearance) {
  6919. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  6920. }
  6921. const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
  6922. const fillAlpha = dict.get("CA");
  6923. this._setDefaultAppearance({
  6924. xref,
  6925. fillColor,
  6926. blendMode: "Multiply",
  6927. fillAlpha,
  6928. pointsCallback: (buffer, points) => {
  6929. 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");
  6930. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6931. }
  6932. });
  6933. }
  6934. } else {
  6935. this.data.hasPopup = false;
  6936. }
  6937. }
  6938. }
  6939. class UnderlineAnnotation extends MarkupAnnotation {
  6940. constructor(params) {
  6941. super(params);
  6942. const {
  6943. dict,
  6944. xref
  6945. } = params;
  6946. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  6947. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  6948. if (quadPoints) {
  6949. if (!this.appearance) {
  6950. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6951. const strokeAlpha = dict.get("CA");
  6952. this._setDefaultAppearance({
  6953. xref,
  6954. extra: "[] 0 d 1 w",
  6955. strokeColor,
  6956. strokeAlpha,
  6957. pointsCallback: (buffer, points) => {
  6958. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  6959. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6960. }
  6961. });
  6962. }
  6963. } else {
  6964. this.data.hasPopup = false;
  6965. }
  6966. }
  6967. }
  6968. class SquigglyAnnotation extends MarkupAnnotation {
  6969. constructor(params) {
  6970. super(params);
  6971. const {
  6972. dict,
  6973. xref
  6974. } = params;
  6975. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  6976. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  6977. if (quadPoints) {
  6978. if (!this.appearance) {
  6979. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  6980. const strokeAlpha = dict.get("CA");
  6981. this._setDefaultAppearance({
  6982. xref,
  6983. extra: "[] 0 d 1 w",
  6984. strokeColor,
  6985. strokeAlpha,
  6986. pointsCallback: (buffer, points) => {
  6987. const dy = (points[0].y - points[2].y) / 6;
  6988. let shift = dy;
  6989. let x = points[2].x;
  6990. const y = points[2].y;
  6991. const xEnd = points[3].x;
  6992. buffer.push(`${x} ${y + shift} m`);
  6993. do {
  6994. x += 2;
  6995. shift = shift === 0 ? dy : 0;
  6996. buffer.push(`${x} ${y + shift} l`);
  6997. } while (x < xEnd);
  6998. buffer.push("S");
  6999. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  7000. }
  7001. });
  7002. }
  7003. } else {
  7004. this.data.hasPopup = false;
  7005. }
  7006. }
  7007. }
  7008. class StrikeOutAnnotation extends MarkupAnnotation {
  7009. constructor(params) {
  7010. super(params);
  7011. const {
  7012. dict,
  7013. xref
  7014. } = params;
  7015. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  7016. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  7017. if (quadPoints) {
  7018. if (!this.appearance) {
  7019. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  7020. const strokeAlpha = dict.get("CA");
  7021. this._setDefaultAppearance({
  7022. xref,
  7023. extra: "[] 0 d 1 w",
  7024. strokeColor,
  7025. strokeAlpha,
  7026. pointsCallback: (buffer, points) => {
  7027. 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");
  7028. return [points[0].x, points[1].x, points[3].y, points[1].y];
  7029. }
  7030. });
  7031. }
  7032. } else {
  7033. this.data.hasPopup = false;
  7034. }
  7035. }
  7036. }
  7037. class StampAnnotation extends MarkupAnnotation {
  7038. constructor(params) {
  7039. super(params);
  7040. this.data.annotationType = _util.AnnotationType.STAMP;
  7041. }
  7042. }
  7043. class FileAttachmentAnnotation extends MarkupAnnotation {
  7044. constructor(params) {
  7045. super(params);
  7046. const {
  7047. dict,
  7048. xref
  7049. } = params;
  7050. const file = new _file_spec.FileSpec(dict.get("FS"), xref);
  7051. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  7052. this.data.file = file.serializable;
  7053. const name = dict.get("Name");
  7054. this.data.name = name instanceof _primitives.Name ? (0, _util.stringToPDFString)(name.name) : "PushPin";
  7055. }
  7056. }
  7057. /***/ }),
  7058. /* 11 */
  7059. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7060. Object.defineProperty(exports, "__esModule", ({
  7061. value: true
  7062. }));
  7063. exports.FakeUnicodeFont = void 0;
  7064. exports.createDefaultAppearance = createDefaultAppearance;
  7065. exports.getPdfColor = getPdfColor;
  7066. exports.parseDefaultAppearance = parseDefaultAppearance;
  7067. var _primitives = __w_pdfjs_require__(3);
  7068. var _core_utils = __w_pdfjs_require__(4);
  7069. var _util = __w_pdfjs_require__(2);
  7070. var _colorspace = __w_pdfjs_require__(12);
  7071. var _evaluator = __w_pdfjs_require__(13);
  7072. var _stream = __w_pdfjs_require__(8);
  7073. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  7074. constructor(str) {
  7075. super(new _stream.StringStream(str));
  7076. }
  7077. parse() {
  7078. const operation = {
  7079. fn: 0,
  7080. args: []
  7081. };
  7082. const result = {
  7083. fontSize: 0,
  7084. fontName: "",
  7085. fontColor: new Uint8ClampedArray(3)
  7086. };
  7087. try {
  7088. while (true) {
  7089. operation.args.length = 0;
  7090. if (!this.read(operation)) {
  7091. break;
  7092. }
  7093. if (this.savedStatesDepth !== 0) {
  7094. continue;
  7095. }
  7096. const {
  7097. fn,
  7098. args
  7099. } = operation;
  7100. switch (fn | 0) {
  7101. case _util.OPS.setFont:
  7102. const [fontName, fontSize] = args;
  7103. if (fontName instanceof _primitives.Name) {
  7104. result.fontName = fontName.name;
  7105. }
  7106. if (typeof fontSize === "number" && fontSize > 0) {
  7107. result.fontSize = fontSize;
  7108. }
  7109. break;
  7110. case _util.OPS.setFillRGBColor:
  7111. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  7112. break;
  7113. case _util.OPS.setFillGray:
  7114. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  7115. break;
  7116. case _util.OPS.setFillColorSpace:
  7117. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  7118. break;
  7119. }
  7120. }
  7121. } catch (reason) {
  7122. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  7123. }
  7124. return result;
  7125. }
  7126. }
  7127. function parseDefaultAppearance(str) {
  7128. return new DefaultAppearanceEvaluator(str).parse();
  7129. }
  7130. function getPdfColor(color, isFill) {
  7131. if (color[0] === color[1] && color[1] === color[2]) {
  7132. const gray = color[0] / 255;
  7133. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  7134. }
  7135. return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  7136. }
  7137. function createDefaultAppearance({
  7138. fontSize,
  7139. fontName,
  7140. fontColor
  7141. }) {
  7142. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  7143. }
  7144. class FakeUnicodeFont {
  7145. constructor(xref, fontFamily) {
  7146. this.xref = xref;
  7147. this.widths = null;
  7148. this.firstChar = Infinity;
  7149. this.lastChar = -Infinity;
  7150. this.fontFamily = fontFamily;
  7151. const canvas = new OffscreenCanvas(1, 1);
  7152. this.ctxMeasure = canvas.getContext("2d");
  7153. if (!FakeUnicodeFont._fontNameId) {
  7154. FakeUnicodeFont._fontNameId = 1;
  7155. }
  7156. this.fontName = _primitives.Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
  7157. }
  7158. get toUnicodeRef() {
  7159. if (!FakeUnicodeFont._toUnicodeRef) {
  7160. const toUnicode = `/CIDInit /ProcSet findresource begin
  7161. 12 dict begin
  7162. begincmap
  7163. /CIDSystemInfo
  7164. << /Registry (Adobe)
  7165. /Ordering (UCS) /Supplement 0 >> def
  7166. /CMapName /Adobe-Identity-UCS def
  7167. /CMapType 2 def
  7168. 1 begincodespacerange
  7169. <0000> <FFFF>
  7170. endcodespacerange
  7171. 1 beginbfrange
  7172. <0000> <FFFF> <0000>
  7173. endbfrange
  7174. endcmap CMapName currentdict /CMap defineresource pop end end`;
  7175. const toUnicodeStream = FakeUnicodeFont.toUnicodeStream = new _stream.StringStream(toUnicode);
  7176. const toUnicodeDict = new _primitives.Dict(this.xref);
  7177. toUnicodeStream.dict = toUnicodeDict;
  7178. toUnicodeDict.set("Length", toUnicode.length);
  7179. FakeUnicodeFont._toUnicodeRef = this.xref.getNewPersistentRef(toUnicodeStream);
  7180. }
  7181. return FakeUnicodeFont._toUnicodeRef;
  7182. }
  7183. get fontDescriptorRef() {
  7184. if (!FakeUnicodeFont._fontDescriptorRef) {
  7185. const fontDescriptor = new _primitives.Dict(this.xref);
  7186. fontDescriptor.set("Type", _primitives.Name.get("FontDescriptor"));
  7187. fontDescriptor.set("FontName", this.fontName);
  7188. fontDescriptor.set("FontFamily", "MyriadPro Regular");
  7189. fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
  7190. fontDescriptor.set("FontStretch", _primitives.Name.get("Normal"));
  7191. fontDescriptor.set("FontWeight", 400);
  7192. fontDescriptor.set("ItalicAngle", 0);
  7193. FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
  7194. }
  7195. return FakeUnicodeFont._fontDescriptorRef;
  7196. }
  7197. get descendantFontRef() {
  7198. const descendantFont = new _primitives.Dict(this.xref);
  7199. descendantFont.set("BaseFont", this.fontName);
  7200. descendantFont.set("Type", _primitives.Name.get("Font"));
  7201. descendantFont.set("Subtype", _primitives.Name.get("CIDFontType0"));
  7202. descendantFont.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  7203. descendantFont.set("FirstChar", this.firstChar);
  7204. descendantFont.set("LastChar", this.lastChar);
  7205. descendantFont.set("FontDescriptor", this.fontDescriptorRef);
  7206. descendantFont.set("DW", 1000);
  7207. const widths = [];
  7208. const chars = [...this.widths.entries()].sort();
  7209. let currentChar = null;
  7210. let currentWidths = null;
  7211. for (const [char, width] of chars) {
  7212. if (!currentChar) {
  7213. currentChar = char;
  7214. currentWidths = [width];
  7215. continue;
  7216. }
  7217. if (char === currentChar + currentWidths.length) {
  7218. currentWidths.push(width);
  7219. } else {
  7220. widths.push(currentChar, currentWidths);
  7221. currentChar = char;
  7222. currentWidths = [width];
  7223. }
  7224. }
  7225. if (currentChar) {
  7226. widths.push(currentChar, currentWidths);
  7227. }
  7228. descendantFont.set("W", widths);
  7229. const cidSystemInfo = new _primitives.Dict(this.xref);
  7230. cidSystemInfo.set("Ordering", "Identity");
  7231. cidSystemInfo.set("Registry", "Adobe");
  7232. cidSystemInfo.set("Supplement", 0);
  7233. descendantFont.set("CIDSystemInfo", cidSystemInfo);
  7234. return this.xref.getNewPersistentRef(descendantFont);
  7235. }
  7236. get baseFontRef() {
  7237. const baseFont = new _primitives.Dict(this.xref);
  7238. baseFont.set("BaseFont", this.fontName);
  7239. baseFont.set("Type", _primitives.Name.get("Font"));
  7240. baseFont.set("Subtype", _primitives.Name.get("Type0"));
  7241. baseFont.set("Encoding", _primitives.Name.get("Identity-H"));
  7242. baseFont.set("DescendantFonts", [this.descendantFontRef]);
  7243. baseFont.set("ToUnicode", this.toUnicodeRef);
  7244. return this.xref.getNewPersistentRef(baseFont);
  7245. }
  7246. get resources() {
  7247. const resources = new _primitives.Dict(this.xref);
  7248. const font = new _primitives.Dict(this.xref);
  7249. font.set(this.fontName.name, this.baseFontRef);
  7250. resources.set("Font", font);
  7251. return resources;
  7252. }
  7253. _createContext() {
  7254. this.widths = new Map();
  7255. this.ctxMeasure.font = `1000px ${this.fontFamily}`;
  7256. return this.ctxMeasure;
  7257. }
  7258. createFontResources(text) {
  7259. const ctx = this._createContext();
  7260. for (const line of text.split(/\r\n?|\n/)) {
  7261. for (const char of line.split("")) {
  7262. const code = char.charCodeAt(0);
  7263. if (this.widths.has(code)) {
  7264. continue;
  7265. }
  7266. const metrics = ctx.measureText(char);
  7267. const width = Math.ceil(metrics.width);
  7268. this.widths.set(code, width);
  7269. this.firstChar = Math.min(code, this.firstChar);
  7270. this.lastChar = Math.max(code, this.lastChar);
  7271. }
  7272. }
  7273. return this.resources;
  7274. }
  7275. createAppearance(text, rect, rotation, fontSize, bgColor) {
  7276. const ctx = this._createContext();
  7277. const lines = [];
  7278. let maxWidth = -Infinity;
  7279. for (const line of text.split(/\r\n?|\n/)) {
  7280. lines.push(line);
  7281. const lineWidth = ctx.measureText(line).width;
  7282. maxWidth = Math.max(maxWidth, lineWidth);
  7283. for (const char of line.split("")) {
  7284. const code = char.charCodeAt(0);
  7285. let width = this.widths.get(code);
  7286. if (width === undefined) {
  7287. const metrics = ctx.measureText(char);
  7288. width = Math.ceil(metrics.width);
  7289. this.widths.set(code, width);
  7290. this.firstChar = Math.min(code, this.firstChar);
  7291. this.lastChar = Math.max(code, this.lastChar);
  7292. }
  7293. }
  7294. }
  7295. maxWidth *= fontSize / 1000;
  7296. const [x1, y1, x2, y2] = rect;
  7297. let w = x2 - x1;
  7298. let h = y2 - y1;
  7299. if (rotation % 180 !== 0) {
  7300. [w, h] = [h, w];
  7301. }
  7302. let hscale = 1;
  7303. if (maxWidth > w) {
  7304. hscale = w / maxWidth;
  7305. }
  7306. let vscale = 1;
  7307. const lineHeight = _util.LINE_FACTOR * fontSize;
  7308. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  7309. const maxHeight = lineHeight * lines.length;
  7310. if (maxHeight > h) {
  7311. vscale = h / maxHeight;
  7312. }
  7313. const fscale = Math.min(hscale, vscale);
  7314. const newFontSize = fontSize * fscale;
  7315. const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
  7316. const vShift = (0, _core_utils.numberToString)(lineHeight);
  7317. for (const line of lines) {
  7318. buffer.push(`0 -${vShift} Td <${(0, _core_utils.stringToUTF16HexString)(line)}> Tj`);
  7319. }
  7320. buffer.push("ET", "Q");
  7321. const appearance = buffer.join("\n");
  7322. const appearanceStreamDict = new _primitives.Dict(this.xref);
  7323. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  7324. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  7325. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  7326. appearanceStreamDict.set("Length", appearance.length);
  7327. appearanceStreamDict.set("Resources", this.resources);
  7328. if (rotation) {
  7329. const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
  7330. appearanceStreamDict.set("Matrix", matrix);
  7331. }
  7332. const ap = new _stream.StringStream(appearance);
  7333. ap.dict = appearanceStreamDict;
  7334. return ap;
  7335. }
  7336. }
  7337. exports.FakeUnicodeFont = FakeUnicodeFont;
  7338. /***/ }),
  7339. /* 12 */
  7340. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7341. Object.defineProperty(exports, "__esModule", ({
  7342. value: true
  7343. }));
  7344. exports.ColorSpace = void 0;
  7345. var _util = __w_pdfjs_require__(2);
  7346. var _primitives = __w_pdfjs_require__(3);
  7347. var _base_stream = __w_pdfjs_require__(5);
  7348. var _core_utils = __w_pdfjs_require__(4);
  7349. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  7350. const COMPONENTS = 3;
  7351. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  7352. const xRatio = w1 / w2;
  7353. const yRatio = h1 / h2;
  7354. let newIndex = 0,
  7355. oldIndex;
  7356. const xScaled = new Uint16Array(w2);
  7357. const w1Scanline = w1 * COMPONENTS;
  7358. for (let i = 0; i < w2; i++) {
  7359. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  7360. }
  7361. for (let i = 0; i < h2; i++) {
  7362. const py = Math.floor(i * yRatio) * w1Scanline;
  7363. for (let j = 0; j < w2; j++) {
  7364. oldIndex = py + xScaled[j];
  7365. dest[newIndex++] = src[oldIndex++];
  7366. dest[newIndex++] = src[oldIndex++];
  7367. dest[newIndex++] = src[oldIndex++];
  7368. newIndex += alpha01;
  7369. }
  7370. }
  7371. }
  7372. class ColorSpace {
  7373. constructor(name, numComps) {
  7374. if (this.constructor === ColorSpace) {
  7375. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  7376. }
  7377. this.name = name;
  7378. this.numComps = numComps;
  7379. }
  7380. getRgb(src, srcOffset) {
  7381. const rgb = new Uint8ClampedArray(3);
  7382. this.getRgbItem(src, srcOffset, rgb, 0);
  7383. return rgb;
  7384. }
  7385. getRgbItem(src, srcOffset, dest, destOffset) {
  7386. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  7387. }
  7388. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7389. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  7390. }
  7391. getOutputLength(inputLength, alpha01) {
  7392. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  7393. }
  7394. isPassthrough(bits) {
  7395. return false;
  7396. }
  7397. isDefaultDecode(decodeMap, bpc) {
  7398. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  7399. }
  7400. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  7401. const count = originalWidth * originalHeight;
  7402. let rgbBuf = null;
  7403. const numComponentColors = 1 << bpc;
  7404. const needsResizing = originalHeight !== height || originalWidth !== width;
  7405. if (this.isPassthrough(bpc)) {
  7406. rgbBuf = comps;
  7407. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  7408. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  7409. for (let i = 0; i < numComponentColors; i++) {
  7410. allColors[i] = i;
  7411. }
  7412. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  7413. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  7414. if (!needsResizing) {
  7415. let destPos = 0;
  7416. for (let i = 0; i < count; ++i) {
  7417. const key = comps[i] * 3;
  7418. dest[destPos++] = colorMap[key];
  7419. dest[destPos++] = colorMap[key + 1];
  7420. dest[destPos++] = colorMap[key + 2];
  7421. destPos += alpha01;
  7422. }
  7423. } else {
  7424. rgbBuf = new Uint8Array(count * 3);
  7425. let rgbPos = 0;
  7426. for (let i = 0; i < count; ++i) {
  7427. const key = comps[i] * 3;
  7428. rgbBuf[rgbPos++] = colorMap[key];
  7429. rgbBuf[rgbPos++] = colorMap[key + 1];
  7430. rgbBuf[rgbPos++] = colorMap[key + 2];
  7431. }
  7432. }
  7433. } else {
  7434. if (!needsResizing) {
  7435. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  7436. } else {
  7437. rgbBuf = new Uint8ClampedArray(count * 3);
  7438. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  7439. }
  7440. }
  7441. if (rgbBuf) {
  7442. if (needsResizing) {
  7443. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  7444. } else {
  7445. let destPos = 0,
  7446. rgbPos = 0;
  7447. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  7448. dest[destPos++] = rgbBuf[rgbPos++];
  7449. dest[destPos++] = rgbBuf[rgbPos++];
  7450. dest[destPos++] = rgbBuf[rgbPos++];
  7451. destPos += alpha01;
  7452. }
  7453. }
  7454. }
  7455. }
  7456. get usesZeroToOneRange() {
  7457. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  7458. }
  7459. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  7460. if (!localColorSpaceCache) {
  7461. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  7462. }
  7463. if (!parsedColorSpace) {
  7464. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  7465. }
  7466. let csName, csRef;
  7467. if (cacheKey instanceof _primitives.Ref) {
  7468. csRef = cacheKey;
  7469. cacheKey = xref.fetch(cacheKey);
  7470. }
  7471. if (cacheKey instanceof _primitives.Name) {
  7472. csName = cacheKey.name;
  7473. }
  7474. if (csName || csRef) {
  7475. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  7476. }
  7477. }
  7478. static getCached(cacheKey, xref, localColorSpaceCache) {
  7479. if (!localColorSpaceCache) {
  7480. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  7481. }
  7482. if (cacheKey instanceof _primitives.Ref) {
  7483. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  7484. if (localColorSpace) {
  7485. return localColorSpace;
  7486. }
  7487. try {
  7488. cacheKey = xref.fetch(cacheKey);
  7489. } catch (ex) {
  7490. if (ex instanceof _core_utils.MissingDataException) {
  7491. throw ex;
  7492. }
  7493. }
  7494. }
  7495. if (cacheKey instanceof _primitives.Name) {
  7496. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  7497. if (localColorSpace) {
  7498. return localColorSpace;
  7499. }
  7500. }
  7501. return null;
  7502. }
  7503. static async parseAsync({
  7504. cs,
  7505. xref,
  7506. resources = null,
  7507. pdfFunctionFactory,
  7508. localColorSpaceCache
  7509. }) {
  7510. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7511. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7512. return parsedColorSpace;
  7513. }
  7514. static parse({
  7515. cs,
  7516. xref,
  7517. resources = null,
  7518. pdfFunctionFactory,
  7519. localColorSpaceCache
  7520. }) {
  7521. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  7522. if (cachedColorSpace) {
  7523. return cachedColorSpace;
  7524. }
  7525. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7526. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7527. return parsedColorSpace;
  7528. }
  7529. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  7530. cs = xref.fetchIfRef(cs);
  7531. if (cs instanceof _primitives.Name) {
  7532. switch (cs.name) {
  7533. case "G":
  7534. case "DeviceGray":
  7535. return this.singletons.gray;
  7536. case "RGB":
  7537. case "DeviceRGB":
  7538. return this.singletons.rgb;
  7539. case "CMYK":
  7540. case "DeviceCMYK":
  7541. return this.singletons.cmyk;
  7542. case "Pattern":
  7543. return new PatternCS(null);
  7544. default:
  7545. if (resources instanceof _primitives.Dict) {
  7546. const colorSpaces = resources.get("ColorSpace");
  7547. if (colorSpaces instanceof _primitives.Dict) {
  7548. const resourcesCS = colorSpaces.get(cs.name);
  7549. if (resourcesCS) {
  7550. if (resourcesCS instanceof _primitives.Name) {
  7551. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  7552. }
  7553. cs = resourcesCS;
  7554. break;
  7555. }
  7556. }
  7557. }
  7558. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  7559. }
  7560. }
  7561. if (Array.isArray(cs)) {
  7562. const mode = xref.fetchIfRef(cs[0]).name;
  7563. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  7564. switch (mode) {
  7565. case "G":
  7566. case "DeviceGray":
  7567. return this.singletons.gray;
  7568. case "RGB":
  7569. case "DeviceRGB":
  7570. return this.singletons.rgb;
  7571. case "CMYK":
  7572. case "DeviceCMYK":
  7573. return this.singletons.cmyk;
  7574. case "CalGray":
  7575. params = xref.fetchIfRef(cs[1]);
  7576. whitePoint = params.getArray("WhitePoint");
  7577. blackPoint = params.getArray("BlackPoint");
  7578. gamma = params.get("Gamma");
  7579. return new CalGrayCS(whitePoint, blackPoint, gamma);
  7580. case "CalRGB":
  7581. params = xref.fetchIfRef(cs[1]);
  7582. whitePoint = params.getArray("WhitePoint");
  7583. blackPoint = params.getArray("BlackPoint");
  7584. gamma = params.getArray("Gamma");
  7585. const matrix = params.getArray("Matrix");
  7586. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  7587. case "ICCBased":
  7588. const stream = xref.fetchIfRef(cs[1]);
  7589. const dict = stream.dict;
  7590. numComps = dict.get("N");
  7591. const alt = dict.get("Alternate");
  7592. if (alt) {
  7593. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  7594. if (altCS.numComps === numComps) {
  7595. return altCS;
  7596. }
  7597. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  7598. }
  7599. if (numComps === 1) {
  7600. return this.singletons.gray;
  7601. } else if (numComps === 3) {
  7602. return this.singletons.rgb;
  7603. } else if (numComps === 4) {
  7604. return this.singletons.cmyk;
  7605. }
  7606. break;
  7607. case "Pattern":
  7608. baseCS = cs[1] || null;
  7609. if (baseCS) {
  7610. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  7611. }
  7612. return new PatternCS(baseCS);
  7613. case "I":
  7614. case "Indexed":
  7615. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  7616. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  7617. const lookup = xref.fetchIfRef(cs[3]);
  7618. return new IndexedCS(baseCS, hiVal, lookup);
  7619. case "Separation":
  7620. case "DeviceN":
  7621. const name = xref.fetchIfRef(cs[1]);
  7622. numComps = Array.isArray(name) ? name.length : 1;
  7623. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  7624. const tintFn = pdfFunctionFactory.create(cs[3]);
  7625. return new AlternateCS(numComps, baseCS, tintFn);
  7626. case "Lab":
  7627. params = xref.fetchIfRef(cs[1]);
  7628. whitePoint = params.getArray("WhitePoint");
  7629. blackPoint = params.getArray("BlackPoint");
  7630. const range = params.getArray("Range");
  7631. return new LabCS(whitePoint, blackPoint, range);
  7632. default:
  7633. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  7634. }
  7635. }
  7636. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  7637. }
  7638. static isDefaultDecode(decode, numComps) {
  7639. if (!Array.isArray(decode)) {
  7640. return true;
  7641. }
  7642. if (numComps * 2 !== decode.length) {
  7643. (0, _util.warn)("The decode map is not the correct length");
  7644. return true;
  7645. }
  7646. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  7647. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  7648. return false;
  7649. }
  7650. }
  7651. return true;
  7652. }
  7653. static get singletons() {
  7654. return (0, _util.shadow)(this, "singletons", {
  7655. get gray() {
  7656. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  7657. },
  7658. get rgb() {
  7659. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  7660. },
  7661. get cmyk() {
  7662. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  7663. }
  7664. });
  7665. }
  7666. }
  7667. exports.ColorSpace = ColorSpace;
  7668. class AlternateCS extends ColorSpace {
  7669. constructor(numComps, base, tintFn) {
  7670. super("Alternate", numComps);
  7671. this.base = base;
  7672. this.tintFn = tintFn;
  7673. this.tmpBuf = new Float32Array(base.numComps);
  7674. }
  7675. getRgbItem(src, srcOffset, dest, destOffset) {
  7676. const tmpBuf = this.tmpBuf;
  7677. this.tintFn(src, srcOffset, tmpBuf, 0);
  7678. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  7679. }
  7680. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7681. const tintFn = this.tintFn;
  7682. const base = this.base;
  7683. const scale = 1 / ((1 << bits) - 1);
  7684. const baseNumComps = base.numComps;
  7685. const usesZeroToOneRange = base.usesZeroToOneRange;
  7686. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  7687. let pos = isPassthrough ? destOffset : 0;
  7688. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  7689. const numComps = this.numComps;
  7690. const scaled = new Float32Array(numComps);
  7691. const tinted = new Float32Array(baseNumComps);
  7692. let i, j;
  7693. for (i = 0; i < count; i++) {
  7694. for (j = 0; j < numComps; j++) {
  7695. scaled[j] = src[srcOffset++] * scale;
  7696. }
  7697. tintFn(scaled, 0, tinted, 0);
  7698. if (usesZeroToOneRange) {
  7699. for (j = 0; j < baseNumComps; j++) {
  7700. baseBuf[pos++] = tinted[j] * 255;
  7701. }
  7702. } else {
  7703. base.getRgbItem(tinted, 0, baseBuf, pos);
  7704. pos += baseNumComps;
  7705. }
  7706. }
  7707. if (!isPassthrough) {
  7708. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  7709. }
  7710. }
  7711. getOutputLength(inputLength, alpha01) {
  7712. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  7713. }
  7714. }
  7715. class PatternCS extends ColorSpace {
  7716. constructor(baseCS) {
  7717. super("Pattern", null);
  7718. this.base = baseCS;
  7719. }
  7720. isDefaultDecode(decodeMap, bpc) {
  7721. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  7722. }
  7723. }
  7724. class IndexedCS extends ColorSpace {
  7725. constructor(base, highVal, lookup) {
  7726. super("Indexed", 1);
  7727. this.base = base;
  7728. this.highVal = highVal;
  7729. const length = base.numComps * highVal;
  7730. this.lookup = new Uint8Array(length);
  7731. if (lookup instanceof _base_stream.BaseStream) {
  7732. const bytes = lookup.getBytes(length);
  7733. this.lookup.set(bytes);
  7734. } else if (typeof lookup === "string") {
  7735. for (let i = 0; i < length; ++i) {
  7736. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  7737. }
  7738. } else {
  7739. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  7740. }
  7741. }
  7742. getRgbItem(src, srcOffset, dest, destOffset) {
  7743. const numComps = this.base.numComps;
  7744. const start = src[srcOffset] * numComps;
  7745. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  7746. }
  7747. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7748. const base = this.base;
  7749. const numComps = base.numComps;
  7750. const outputDelta = base.getOutputLength(numComps, alpha01);
  7751. const lookup = this.lookup;
  7752. for (let i = 0; i < count; ++i) {
  7753. const lookupPos = src[srcOffset++] * numComps;
  7754. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  7755. destOffset += outputDelta;
  7756. }
  7757. }
  7758. getOutputLength(inputLength, alpha01) {
  7759. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  7760. }
  7761. isDefaultDecode(decodeMap, bpc) {
  7762. if (!Array.isArray(decodeMap)) {
  7763. return true;
  7764. }
  7765. if (decodeMap.length !== 2) {
  7766. (0, _util.warn)("Decode map length is not correct");
  7767. return true;
  7768. }
  7769. if (!Number.isInteger(bpc) || bpc < 1) {
  7770. (0, _util.warn)("Bits per component is not correct");
  7771. return true;
  7772. }
  7773. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  7774. }
  7775. }
  7776. class DeviceGrayCS extends ColorSpace {
  7777. constructor() {
  7778. super("DeviceGray", 1);
  7779. }
  7780. getRgbItem(src, srcOffset, dest, destOffset) {
  7781. const c = src[srcOffset] * 255;
  7782. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  7783. }
  7784. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7785. const scale = 255 / ((1 << bits) - 1);
  7786. let j = srcOffset,
  7787. q = destOffset;
  7788. for (let i = 0; i < count; ++i) {
  7789. const c = scale * src[j++];
  7790. dest[q++] = c;
  7791. dest[q++] = c;
  7792. dest[q++] = c;
  7793. q += alpha01;
  7794. }
  7795. }
  7796. getOutputLength(inputLength, alpha01) {
  7797. return inputLength * (3 + alpha01);
  7798. }
  7799. }
  7800. class DeviceRgbCS extends ColorSpace {
  7801. constructor() {
  7802. super("DeviceRGB", 3);
  7803. }
  7804. getRgbItem(src, srcOffset, dest, destOffset) {
  7805. dest[destOffset] = src[srcOffset] * 255;
  7806. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  7807. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  7808. }
  7809. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7810. if (bits === 8 && alpha01 === 0) {
  7811. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  7812. return;
  7813. }
  7814. const scale = 255 / ((1 << bits) - 1);
  7815. let j = srcOffset,
  7816. q = destOffset;
  7817. for (let i = 0; i < count; ++i) {
  7818. dest[q++] = scale * src[j++];
  7819. dest[q++] = scale * src[j++];
  7820. dest[q++] = scale * src[j++];
  7821. q += alpha01;
  7822. }
  7823. }
  7824. getOutputLength(inputLength, alpha01) {
  7825. return inputLength * (3 + alpha01) / 3 | 0;
  7826. }
  7827. isPassthrough(bits) {
  7828. return bits === 8;
  7829. }
  7830. }
  7831. const DeviceCmykCS = function DeviceCmykCSClosure() {
  7832. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  7833. const c = src[srcOffset] * srcScale;
  7834. const m = src[srcOffset + 1] * srcScale;
  7835. const y = src[srcOffset + 2] * srcScale;
  7836. const k = src[srcOffset + 3] * srcScale;
  7837. 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);
  7838. 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);
  7839. 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);
  7840. }
  7841. class DeviceCmykCS extends ColorSpace {
  7842. constructor() {
  7843. super("DeviceCMYK", 4);
  7844. }
  7845. getRgbItem(src, srcOffset, dest, destOffset) {
  7846. convertToRgb(src, srcOffset, 1, dest, destOffset);
  7847. }
  7848. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7849. const scale = 1 / ((1 << bits) - 1);
  7850. for (let i = 0; i < count; i++) {
  7851. convertToRgb(src, srcOffset, scale, dest, destOffset);
  7852. srcOffset += 4;
  7853. destOffset += 3 + alpha01;
  7854. }
  7855. }
  7856. getOutputLength(inputLength, alpha01) {
  7857. return inputLength / 4 * (3 + alpha01) | 0;
  7858. }
  7859. }
  7860. return DeviceCmykCS;
  7861. }();
  7862. const CalGrayCS = function CalGrayCSClosure() {
  7863. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  7864. const A = src[srcOffset] * scale;
  7865. const AG = A ** cs.G;
  7866. const L = cs.YW * AG;
  7867. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  7868. dest[destOffset] = val;
  7869. dest[destOffset + 1] = val;
  7870. dest[destOffset + 2] = val;
  7871. }
  7872. class CalGrayCS extends ColorSpace {
  7873. constructor(whitePoint, blackPoint, gamma) {
  7874. super("CalGray", 1);
  7875. if (!whitePoint) {
  7876. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  7877. }
  7878. blackPoint = blackPoint || [0, 0, 0];
  7879. gamma = gamma || 1;
  7880. this.XW = whitePoint[0];
  7881. this.YW = whitePoint[1];
  7882. this.ZW = whitePoint[2];
  7883. this.XB = blackPoint[0];
  7884. this.YB = blackPoint[1];
  7885. this.ZB = blackPoint[2];
  7886. this.G = gamma;
  7887. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  7888. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  7889. }
  7890. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  7891. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  7892. this.XB = this.YB = this.ZB = 0;
  7893. }
  7894. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  7895. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  7896. }
  7897. if (this.G < 1) {
  7898. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  7899. this.G = 1;
  7900. }
  7901. }
  7902. getRgbItem(src, srcOffset, dest, destOffset) {
  7903. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  7904. }
  7905. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7906. const scale = 1 / ((1 << bits) - 1);
  7907. for (let i = 0; i < count; ++i) {
  7908. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  7909. srcOffset += 1;
  7910. destOffset += 3 + alpha01;
  7911. }
  7912. }
  7913. getOutputLength(inputLength, alpha01) {
  7914. return inputLength * (3 + alpha01);
  7915. }
  7916. }
  7917. return CalGrayCS;
  7918. }();
  7919. const CalRGBCS = function CalRGBCSClosure() {
  7920. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  7921. 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]);
  7922. 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]);
  7923. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  7924. const tempNormalizeMatrix = new Float32Array(3);
  7925. const tempConvertMatrix1 = new Float32Array(3);
  7926. const tempConvertMatrix2 = new Float32Array(3);
  7927. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  7928. function matrixProduct(a, b, result) {
  7929. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  7930. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  7931. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  7932. }
  7933. function convertToFlat(sourceWhitePoint, LMS, result) {
  7934. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  7935. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  7936. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  7937. }
  7938. function convertToD65(sourceWhitePoint, LMS, result) {
  7939. const D65X = 0.95047;
  7940. const D65Y = 1;
  7941. const D65Z = 1.08883;
  7942. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  7943. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  7944. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  7945. }
  7946. function sRGBTransferFunction(color) {
  7947. if (color <= 0.0031308) {
  7948. return adjustToRange(0, 1, 12.92 * color);
  7949. }
  7950. if (color >= 0.99554525) {
  7951. return 1;
  7952. }
  7953. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  7954. }
  7955. function adjustToRange(min, max, value) {
  7956. return Math.max(min, Math.min(max, value));
  7957. }
  7958. function decodeL(L) {
  7959. if (L < 0) {
  7960. return -decodeL(-L);
  7961. }
  7962. if (L > 8.0) {
  7963. return ((L + 16) / 116) ** 3;
  7964. }
  7965. return L * DECODE_L_CONSTANT;
  7966. }
  7967. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  7968. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  7969. result[0] = XYZ_Flat[0];
  7970. result[1] = XYZ_Flat[1];
  7971. result[2] = XYZ_Flat[2];
  7972. return;
  7973. }
  7974. const zeroDecodeL = decodeL(0);
  7975. const X_DST = zeroDecodeL;
  7976. const X_SRC = decodeL(sourceBlackPoint[0]);
  7977. const Y_DST = zeroDecodeL;
  7978. const Y_SRC = decodeL(sourceBlackPoint[1]);
  7979. const Z_DST = zeroDecodeL;
  7980. const Z_SRC = decodeL(sourceBlackPoint[2]);
  7981. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  7982. const X_Offset = 1 - X_Scale;
  7983. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  7984. const Y_Offset = 1 - Y_Scale;
  7985. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  7986. const Z_Offset = 1 - Z_Scale;
  7987. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  7988. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  7989. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  7990. }
  7991. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  7992. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  7993. result[0] = XYZ_In[0];
  7994. result[1] = XYZ_In[1];
  7995. result[2] = XYZ_In[2];
  7996. return;
  7997. }
  7998. const LMS = result;
  7999. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  8000. const LMS_Flat = tempNormalizeMatrix;
  8001. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  8002. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  8003. }
  8004. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  8005. const LMS = result;
  8006. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  8007. const LMS_D65 = tempNormalizeMatrix;
  8008. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  8009. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  8010. }
  8011. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  8012. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  8013. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  8014. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  8015. const AGR = A === 1 ? 1 : A ** cs.GR;
  8016. const BGG = B === 1 ? 1 : B ** cs.GG;
  8017. const CGB = C === 1 ? 1 : C ** cs.GB;
  8018. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  8019. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  8020. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  8021. const XYZ = tempConvertMatrix1;
  8022. XYZ[0] = X;
  8023. XYZ[1] = Y;
  8024. XYZ[2] = Z;
  8025. const XYZ_Flat = tempConvertMatrix2;
  8026. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  8027. const XYZ_Black = tempConvertMatrix1;
  8028. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  8029. const XYZ_D65 = tempConvertMatrix2;
  8030. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  8031. const SRGB = tempConvertMatrix1;
  8032. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  8033. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  8034. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  8035. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  8036. }
  8037. class CalRGBCS extends ColorSpace {
  8038. constructor(whitePoint, blackPoint, gamma, matrix) {
  8039. super("CalRGB", 3);
  8040. if (!whitePoint) {
  8041. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  8042. }
  8043. blackPoint = blackPoint || new Float32Array(3);
  8044. gamma = gamma || new Float32Array([1, 1, 1]);
  8045. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  8046. const XW = whitePoint[0];
  8047. const YW = whitePoint[1];
  8048. const ZW = whitePoint[2];
  8049. this.whitePoint = whitePoint;
  8050. const XB = blackPoint[0];
  8051. const YB = blackPoint[1];
  8052. const ZB = blackPoint[2];
  8053. this.blackPoint = blackPoint;
  8054. this.GR = gamma[0];
  8055. this.GG = gamma[1];
  8056. this.GB = gamma[2];
  8057. this.MXA = matrix[0];
  8058. this.MYA = matrix[1];
  8059. this.MZA = matrix[2];
  8060. this.MXB = matrix[3];
  8061. this.MYB = matrix[4];
  8062. this.MZB = matrix[5];
  8063. this.MXC = matrix[6];
  8064. this.MYC = matrix[7];
  8065. this.MZC = matrix[8];
  8066. if (XW < 0 || ZW < 0 || YW !== 1) {
  8067. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  8068. }
  8069. if (XB < 0 || YB < 0 || ZB < 0) {
  8070. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  8071. this.blackPoint = new Float32Array(3);
  8072. }
  8073. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  8074. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  8075. this.GR = this.GG = this.GB = 1;
  8076. }
  8077. }
  8078. getRgbItem(src, srcOffset, dest, destOffset) {
  8079. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  8080. }
  8081. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8082. const scale = 1 / ((1 << bits) - 1);
  8083. for (let i = 0; i < count; ++i) {
  8084. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  8085. srcOffset += 3;
  8086. destOffset += 3 + alpha01;
  8087. }
  8088. }
  8089. getOutputLength(inputLength, alpha01) {
  8090. return inputLength * (3 + alpha01) / 3 | 0;
  8091. }
  8092. }
  8093. return CalRGBCS;
  8094. }();
  8095. const LabCS = function LabCSClosure() {
  8096. function fn_g(x) {
  8097. let result;
  8098. if (x >= 6 / 29) {
  8099. result = x ** 3;
  8100. } else {
  8101. result = 108 / 841 * (x - 4 / 29);
  8102. }
  8103. return result;
  8104. }
  8105. function decode(value, high1, low2, high2) {
  8106. return low2 + value * (high2 - low2) / high1;
  8107. }
  8108. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  8109. let Ls = src[srcOffset];
  8110. let as = src[srcOffset + 1];
  8111. let bs = src[srcOffset + 2];
  8112. if (maxVal !== false) {
  8113. Ls = decode(Ls, maxVal, 0, 100);
  8114. as = decode(as, maxVal, cs.amin, cs.amax);
  8115. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  8116. }
  8117. if (as > cs.amax) {
  8118. as = cs.amax;
  8119. } else if (as < cs.amin) {
  8120. as = cs.amin;
  8121. }
  8122. if (bs > cs.bmax) {
  8123. bs = cs.bmax;
  8124. } else if (bs < cs.bmin) {
  8125. bs = cs.bmin;
  8126. }
  8127. const M = (Ls + 16) / 116;
  8128. const L = M + as / 500;
  8129. const N = M - bs / 200;
  8130. const X = cs.XW * fn_g(L);
  8131. const Y = cs.YW * fn_g(M);
  8132. const Z = cs.ZW * fn_g(N);
  8133. let r, g, b;
  8134. if (cs.ZW < 1) {
  8135. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  8136. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  8137. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  8138. } else {
  8139. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  8140. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  8141. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  8142. }
  8143. dest[destOffset] = Math.sqrt(r) * 255;
  8144. dest[destOffset + 1] = Math.sqrt(g) * 255;
  8145. dest[destOffset + 2] = Math.sqrt(b) * 255;
  8146. }
  8147. class LabCS extends ColorSpace {
  8148. constructor(whitePoint, blackPoint, range) {
  8149. super("Lab", 3);
  8150. if (!whitePoint) {
  8151. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  8152. }
  8153. blackPoint = blackPoint || [0, 0, 0];
  8154. range = range || [-100, 100, -100, 100];
  8155. this.XW = whitePoint[0];
  8156. this.YW = whitePoint[1];
  8157. this.ZW = whitePoint[2];
  8158. this.amin = range[0];
  8159. this.amax = range[1];
  8160. this.bmin = range[2];
  8161. this.bmax = range[3];
  8162. this.XB = blackPoint[0];
  8163. this.YB = blackPoint[1];
  8164. this.ZB = blackPoint[2];
  8165. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  8166. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  8167. }
  8168. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  8169. (0, _util.info)("Invalid BlackPoint, falling back to default");
  8170. this.XB = this.YB = this.ZB = 0;
  8171. }
  8172. if (this.amin > this.amax || this.bmin > this.bmax) {
  8173. (0, _util.info)("Invalid Range, falling back to defaults");
  8174. this.amin = -100;
  8175. this.amax = 100;
  8176. this.bmin = -100;
  8177. this.bmax = 100;
  8178. }
  8179. }
  8180. getRgbItem(src, srcOffset, dest, destOffset) {
  8181. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  8182. }
  8183. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8184. const maxVal = (1 << bits) - 1;
  8185. for (let i = 0; i < count; i++) {
  8186. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  8187. srcOffset += 3;
  8188. destOffset += 3 + alpha01;
  8189. }
  8190. }
  8191. getOutputLength(inputLength, alpha01) {
  8192. return inputLength * (3 + alpha01) / 3 | 0;
  8193. }
  8194. isDefaultDecode(decodeMap, bpc) {
  8195. return true;
  8196. }
  8197. get usesZeroToOneRange() {
  8198. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  8199. }
  8200. }
  8201. return LabCS;
  8202. }();
  8203. /***/ }),
  8204. /* 13 */
  8205. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8206. Object.defineProperty(exports, "__esModule", ({
  8207. value: true
  8208. }));
  8209. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  8210. var _util = __w_pdfjs_require__(2);
  8211. var _cmap = __w_pdfjs_require__(14);
  8212. var _primitives = __w_pdfjs_require__(3);
  8213. var _fonts = __w_pdfjs_require__(32);
  8214. var _encodings = __w_pdfjs_require__(35);
  8215. var _standard_fonts = __w_pdfjs_require__(39);
  8216. var _pattern = __w_pdfjs_require__(48);
  8217. var _xfa_fonts = __w_pdfjs_require__(49);
  8218. var _to_unicode_map = __w_pdfjs_require__(40);
  8219. var _function = __w_pdfjs_require__(55);
  8220. var _parser = __w_pdfjs_require__(15);
  8221. var _image_utils = __w_pdfjs_require__(57);
  8222. var _stream = __w_pdfjs_require__(8);
  8223. var _base_stream = __w_pdfjs_require__(5);
  8224. var _bidi = __w_pdfjs_require__(58);
  8225. var _colorspace = __w_pdfjs_require__(12);
  8226. var _decode_stream = __w_pdfjs_require__(17);
  8227. var _fonts_utils = __w_pdfjs_require__(36);
  8228. var _glyphlist = __w_pdfjs_require__(37);
  8229. var _core_utils = __w_pdfjs_require__(4);
  8230. var _metrics = __w_pdfjs_require__(43);
  8231. var _unicode = __w_pdfjs_require__(38);
  8232. var _murmurhash = __w_pdfjs_require__(59);
  8233. var _operator_list = __w_pdfjs_require__(60);
  8234. var _image = __w_pdfjs_require__(61);
  8235. const DefaultPartialEvaluatorOptions = Object.freeze({
  8236. maxImageSize: -1,
  8237. disableFontFace: false,
  8238. ignoreErrors: false,
  8239. isEvalSupported: true,
  8240. isOffscreenCanvasSupported: true,
  8241. fontExtraProperties: false,
  8242. useSystemFonts: true,
  8243. cMapUrl: null,
  8244. standardFontDataUrl: null
  8245. });
  8246. const PatternType = {
  8247. TILING: 1,
  8248. SHADING: 2
  8249. };
  8250. const TEXT_CHUNK_BATCH_SIZE = 10;
  8251. const deferred = Promise.resolve();
  8252. function normalizeBlendMode(value, parsingArray = false) {
  8253. if (Array.isArray(value)) {
  8254. for (const val of value) {
  8255. const maybeBM = normalizeBlendMode(val, true);
  8256. if (maybeBM) {
  8257. return maybeBM;
  8258. }
  8259. }
  8260. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  8261. return "source-over";
  8262. }
  8263. if (!(value instanceof _primitives.Name)) {
  8264. if (parsingArray) {
  8265. return null;
  8266. }
  8267. return "source-over";
  8268. }
  8269. switch (value.name) {
  8270. case "Normal":
  8271. case "Compatible":
  8272. return "source-over";
  8273. case "Multiply":
  8274. return "multiply";
  8275. case "Screen":
  8276. return "screen";
  8277. case "Overlay":
  8278. return "overlay";
  8279. case "Darken":
  8280. return "darken";
  8281. case "Lighten":
  8282. return "lighten";
  8283. case "ColorDodge":
  8284. return "color-dodge";
  8285. case "ColorBurn":
  8286. return "color-burn";
  8287. case "HardLight":
  8288. return "hard-light";
  8289. case "SoftLight":
  8290. return "soft-light";
  8291. case "Difference":
  8292. return "difference";
  8293. case "Exclusion":
  8294. return "exclusion";
  8295. case "Hue":
  8296. return "hue";
  8297. case "Saturation":
  8298. return "saturation";
  8299. case "Color":
  8300. return "color";
  8301. case "Luminosity":
  8302. return "luminosity";
  8303. }
  8304. if (parsingArray) {
  8305. return null;
  8306. }
  8307. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  8308. return "source-over";
  8309. }
  8310. function incrementCachedImageMaskCount(data) {
  8311. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  8312. data.args[0].count++;
  8313. }
  8314. }
  8315. class TimeSlotManager {
  8316. static get TIME_SLOT_DURATION_MS() {
  8317. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  8318. }
  8319. static get CHECK_TIME_EVERY() {
  8320. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  8321. }
  8322. constructor() {
  8323. this.reset();
  8324. }
  8325. check() {
  8326. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  8327. return false;
  8328. }
  8329. this.checked = 0;
  8330. return this.endTime <= Date.now();
  8331. }
  8332. reset() {
  8333. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  8334. this.checked = 0;
  8335. }
  8336. }
  8337. class PartialEvaluator {
  8338. constructor({
  8339. xref,
  8340. handler,
  8341. pageIndex,
  8342. idFactory,
  8343. fontCache,
  8344. builtInCMapCache,
  8345. standardFontDataCache,
  8346. globalImageCache,
  8347. options = null
  8348. }) {
  8349. this.xref = xref;
  8350. this.handler = handler;
  8351. this.pageIndex = pageIndex;
  8352. this.idFactory = idFactory;
  8353. this.fontCache = fontCache;
  8354. this.builtInCMapCache = builtInCMapCache;
  8355. this.standardFontDataCache = standardFontDataCache;
  8356. this.globalImageCache = globalImageCache;
  8357. this.options = options || DefaultPartialEvaluatorOptions;
  8358. this.parsingType3Font = false;
  8359. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  8360. }
  8361. get _pdfFunctionFactory() {
  8362. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  8363. xref: this.xref,
  8364. isEvalSupported: this.options.isEvalSupported
  8365. });
  8366. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  8367. }
  8368. clone(newOptions = null) {
  8369. const newEvaluator = Object.create(this);
  8370. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  8371. return newEvaluator;
  8372. }
  8373. hasBlendModes(resources, nonBlendModesSet) {
  8374. if (!(resources instanceof _primitives.Dict)) {
  8375. return false;
  8376. }
  8377. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  8378. return false;
  8379. }
  8380. const processed = new _primitives.RefSet(nonBlendModesSet);
  8381. if (resources.objId) {
  8382. processed.put(resources.objId);
  8383. }
  8384. const nodes = [resources],
  8385. xref = this.xref;
  8386. while (nodes.length) {
  8387. const node = nodes.shift();
  8388. const graphicStates = node.get("ExtGState");
  8389. if (graphicStates instanceof _primitives.Dict) {
  8390. for (let graphicState of graphicStates.getRawValues()) {
  8391. if (graphicState instanceof _primitives.Ref) {
  8392. if (processed.has(graphicState)) {
  8393. continue;
  8394. }
  8395. try {
  8396. graphicState = xref.fetch(graphicState);
  8397. } catch (ex) {
  8398. processed.put(graphicState);
  8399. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  8400. continue;
  8401. }
  8402. }
  8403. if (!(graphicState instanceof _primitives.Dict)) {
  8404. continue;
  8405. }
  8406. if (graphicState.objId) {
  8407. processed.put(graphicState.objId);
  8408. }
  8409. const bm = graphicState.get("BM");
  8410. if (bm instanceof _primitives.Name) {
  8411. if (bm.name !== "Normal") {
  8412. return true;
  8413. }
  8414. continue;
  8415. }
  8416. if (bm !== undefined && Array.isArray(bm)) {
  8417. for (const element of bm) {
  8418. if (element instanceof _primitives.Name && element.name !== "Normal") {
  8419. return true;
  8420. }
  8421. }
  8422. }
  8423. }
  8424. }
  8425. const xObjects = node.get("XObject");
  8426. if (!(xObjects instanceof _primitives.Dict)) {
  8427. continue;
  8428. }
  8429. for (let xObject of xObjects.getRawValues()) {
  8430. if (xObject instanceof _primitives.Ref) {
  8431. if (processed.has(xObject)) {
  8432. continue;
  8433. }
  8434. try {
  8435. xObject = xref.fetch(xObject);
  8436. } catch (ex) {
  8437. processed.put(xObject);
  8438. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  8439. continue;
  8440. }
  8441. }
  8442. if (!(xObject instanceof _base_stream.BaseStream)) {
  8443. continue;
  8444. }
  8445. if (xObject.dict.objId) {
  8446. processed.put(xObject.dict.objId);
  8447. }
  8448. const xResources = xObject.dict.get("Resources");
  8449. if (!(xResources instanceof _primitives.Dict)) {
  8450. continue;
  8451. }
  8452. if (xResources.objId && processed.has(xResources.objId)) {
  8453. continue;
  8454. }
  8455. nodes.push(xResources);
  8456. if (xResources.objId) {
  8457. processed.put(xResources.objId);
  8458. }
  8459. }
  8460. }
  8461. for (const ref of processed) {
  8462. nonBlendModesSet.put(ref);
  8463. }
  8464. return false;
  8465. }
  8466. async fetchBuiltInCMap(name) {
  8467. const cachedData = this.builtInCMapCache.get(name);
  8468. if (cachedData) {
  8469. return cachedData;
  8470. }
  8471. let data;
  8472. if (this.options.cMapUrl !== null) {
  8473. const url = `${this.options.cMapUrl}${name}.bcmap`;
  8474. const response = await fetch(url);
  8475. if (!response.ok) {
  8476. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  8477. }
  8478. data = {
  8479. cMapData: new Uint8Array(await response.arrayBuffer()),
  8480. compressionType: _util.CMapCompressionType.BINARY
  8481. };
  8482. } else {
  8483. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  8484. name
  8485. });
  8486. }
  8487. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  8488. this.builtInCMapCache.set(name, data);
  8489. }
  8490. return data;
  8491. }
  8492. async fetchStandardFontData(name) {
  8493. const cachedData = this.standardFontDataCache.get(name);
  8494. if (cachedData) {
  8495. return new _stream.Stream(cachedData);
  8496. }
  8497. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  8498. return null;
  8499. }
  8500. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  8501. filename = standardFontNameToFileName[name];
  8502. let data;
  8503. if (this.options.standardFontDataUrl !== null) {
  8504. const url = `${this.options.standardFontDataUrl}${filename}`;
  8505. const response = await fetch(url);
  8506. if (!response.ok) {
  8507. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  8508. } else {
  8509. data = await response.arrayBuffer();
  8510. }
  8511. } else {
  8512. try {
  8513. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  8514. filename
  8515. });
  8516. } catch (e) {
  8517. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  8518. }
  8519. }
  8520. if (!data) {
  8521. return null;
  8522. }
  8523. this.standardFontDataCache.set(name, data);
  8524. return new _stream.Stream(data);
  8525. }
  8526. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  8527. const dict = xobj.dict;
  8528. const matrix = dict.getArray("Matrix");
  8529. let bbox = dict.getArray("BBox");
  8530. if (Array.isArray(bbox) && bbox.length === 4) {
  8531. bbox = _util.Util.normalizeRect(bbox);
  8532. } else {
  8533. bbox = null;
  8534. }
  8535. let optionalContent, groupOptions;
  8536. if (dict.has("OC")) {
  8537. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8538. }
  8539. if (optionalContent !== undefined) {
  8540. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8541. }
  8542. const group = dict.get("Group");
  8543. if (group) {
  8544. groupOptions = {
  8545. matrix,
  8546. bbox,
  8547. smask,
  8548. isolated: false,
  8549. knockout: false
  8550. };
  8551. const groupSubtype = group.get("S");
  8552. let colorSpace = null;
  8553. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  8554. groupOptions.isolated = group.get("I") || false;
  8555. groupOptions.knockout = group.get("K") || false;
  8556. if (group.has("CS")) {
  8557. const cs = group.getRaw("CS");
  8558. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  8559. if (cachedColorSpace) {
  8560. colorSpace = cachedColorSpace;
  8561. } else {
  8562. colorSpace = await this.parseColorSpace({
  8563. cs,
  8564. resources,
  8565. localColorSpaceCache
  8566. });
  8567. }
  8568. }
  8569. }
  8570. if (smask && smask.backdrop) {
  8571. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  8572. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  8573. }
  8574. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  8575. }
  8576. const args = group ? [matrix, null] : [matrix, bbox];
  8577. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  8578. return this.getOperatorList({
  8579. stream: xobj,
  8580. task,
  8581. resources: dict.get("Resources") || resources,
  8582. operatorList,
  8583. initialState
  8584. }).then(function () {
  8585. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  8586. if (group) {
  8587. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  8588. }
  8589. if (optionalContent !== undefined) {
  8590. operatorList.addOp(_util.OPS.endMarkedContent, []);
  8591. }
  8592. });
  8593. }
  8594. _sendImgData(objId, imgData, cacheGlobally = false) {
  8595. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  8596. if (this.parsingType3Font || cacheGlobally) {
  8597. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  8598. }
  8599. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  8600. }
  8601. async buildPaintImageXObject({
  8602. resources,
  8603. image,
  8604. isInline = false,
  8605. operatorList,
  8606. cacheKey,
  8607. localImageCache,
  8608. localColorSpaceCache
  8609. }) {
  8610. const dict = image.dict;
  8611. const imageRef = dict.objId;
  8612. const w = dict.get("W", "Width");
  8613. const h = dict.get("H", "Height");
  8614. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  8615. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  8616. return;
  8617. }
  8618. const maxImageSize = this.options.maxImageSize;
  8619. if (maxImageSize !== -1 && w * h > maxImageSize) {
  8620. const msg = "Image exceeded maximum allowed size and was removed.";
  8621. if (this.options.ignoreErrors) {
  8622. (0, _util.warn)(msg);
  8623. return;
  8624. }
  8625. throw new Error(msg);
  8626. }
  8627. let optionalContent;
  8628. if (dict.has("OC")) {
  8629. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8630. }
  8631. const imageMask = dict.get("IM", "ImageMask") || false;
  8632. let imgData, args;
  8633. if (imageMask) {
  8634. const interpolate = dict.get("I", "Interpolate");
  8635. const bitStrideLength = w + 7 >> 3;
  8636. const imgArray = image.getBytes(bitStrideLength * h);
  8637. const decode = dict.getArray("D", "Decode");
  8638. if (this.parsingType3Font) {
  8639. imgData = _image.PDFImage.createRawMask({
  8640. imgArray,
  8641. width: w,
  8642. height: h,
  8643. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8644. inverseDecode: !!decode && decode[0] > 0,
  8645. interpolate
  8646. });
  8647. imgData.cached = !!cacheKey;
  8648. args = [imgData];
  8649. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8650. if (cacheKey) {
  8651. localImageCache.set(cacheKey, imageRef, {
  8652. fn: _util.OPS.paintImageMaskXObject,
  8653. args,
  8654. optionalContent
  8655. });
  8656. }
  8657. return;
  8658. }
  8659. imgData = _image.PDFImage.createMask({
  8660. imgArray,
  8661. width: w,
  8662. height: h,
  8663. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8664. inverseDecode: !!decode && decode[0] > 0,
  8665. interpolate,
  8666. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  8667. });
  8668. if (imgData.isSingleOpaquePixel) {
  8669. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  8670. if (cacheKey) {
  8671. localImageCache.set(cacheKey, imageRef, {
  8672. fn: _util.OPS.paintSolidColorImageMask,
  8673. args: [],
  8674. optionalContent
  8675. });
  8676. }
  8677. return;
  8678. }
  8679. const objId = `mask_${this.idFactory.createObjId()}`;
  8680. operatorList.addDependency(objId);
  8681. this._sendImgData(objId, imgData);
  8682. args = [{
  8683. data: objId,
  8684. width: imgData.width,
  8685. height: imgData.height,
  8686. interpolate: imgData.interpolate,
  8687. count: 1
  8688. }];
  8689. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8690. if (cacheKey) {
  8691. localImageCache.set(cacheKey, imageRef, {
  8692. fn: _util.OPS.paintImageMaskXObject,
  8693. args,
  8694. optionalContent
  8695. });
  8696. }
  8697. return;
  8698. }
  8699. const softMask = dict.get("SM", "SMask") || false;
  8700. const mask = dict.get("Mask") || false;
  8701. const SMALL_IMAGE_DIMENSIONS = 200;
  8702. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  8703. const imageObj = new _image.PDFImage({
  8704. xref: this.xref,
  8705. res: resources,
  8706. image,
  8707. isInline,
  8708. pdfFunctionFactory: this._pdfFunctionFactory,
  8709. localColorSpaceCache
  8710. });
  8711. imgData = imageObj.createImageData(true);
  8712. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  8713. return;
  8714. }
  8715. let objId = `img_${this.idFactory.createObjId()}`,
  8716. cacheGlobally = false;
  8717. if (this.parsingType3Font) {
  8718. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  8719. } else if (imageRef) {
  8720. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  8721. if (cacheGlobally) {
  8722. objId = `${this.idFactory.getDocId()}_${objId}`;
  8723. }
  8724. }
  8725. operatorList.addDependency(objId);
  8726. args = [objId, w, h];
  8727. _image.PDFImage.buildImage({
  8728. xref: this.xref,
  8729. res: resources,
  8730. image,
  8731. isInline,
  8732. pdfFunctionFactory: this._pdfFunctionFactory,
  8733. localColorSpaceCache
  8734. }).then(imageObj => {
  8735. imgData = imageObj.createImageData(false);
  8736. if (cacheKey && imageRef && cacheGlobally) {
  8737. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  8738. }
  8739. return this._sendImgData(objId, imgData, cacheGlobally);
  8740. }).catch(reason => {
  8741. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  8742. return this._sendImgData(objId, null, cacheGlobally);
  8743. });
  8744. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  8745. if (cacheKey) {
  8746. localImageCache.set(cacheKey, imageRef, {
  8747. fn: _util.OPS.paintImageXObject,
  8748. args,
  8749. optionalContent
  8750. });
  8751. if (imageRef) {
  8752. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  8753. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  8754. if (cacheGlobally) {
  8755. this.globalImageCache.setData(imageRef, {
  8756. objId,
  8757. fn: _util.OPS.paintImageXObject,
  8758. args,
  8759. optionalContent,
  8760. byteSize: 0
  8761. });
  8762. }
  8763. }
  8764. }
  8765. }
  8766. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  8767. const smaskContent = smask.get("G");
  8768. const smaskOptions = {
  8769. subtype: smask.get("S").name,
  8770. backdrop: smask.get("BC")
  8771. };
  8772. const transferObj = smask.get("TR");
  8773. if ((0, _function.isPDFFunction)(transferObj)) {
  8774. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8775. const transferMap = new Uint8Array(256);
  8776. const tmp = new Float32Array(1);
  8777. for (let i = 0; i < 256; i++) {
  8778. tmp[0] = i / 255;
  8779. transferFn(tmp, 0, tmp, 0);
  8780. transferMap[i] = tmp[0] * 255 | 0;
  8781. }
  8782. smaskOptions.transferMap = transferMap;
  8783. }
  8784. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  8785. }
  8786. handleTransferFunction(tr) {
  8787. let transferArray;
  8788. if (Array.isArray(tr)) {
  8789. transferArray = tr;
  8790. } else if ((0, _function.isPDFFunction)(tr)) {
  8791. transferArray = [tr];
  8792. } else {
  8793. return null;
  8794. }
  8795. const transferMaps = [];
  8796. let numFns = 0,
  8797. numEffectfulFns = 0;
  8798. for (const entry of transferArray) {
  8799. const transferObj = this.xref.fetchIfRef(entry);
  8800. numFns++;
  8801. if ((0, _primitives.isName)(transferObj, "Identity")) {
  8802. transferMaps.push(null);
  8803. continue;
  8804. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  8805. return null;
  8806. }
  8807. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8808. const transferMap = new Uint8Array(256),
  8809. tmp = new Float32Array(1);
  8810. for (let j = 0; j < 256; j++) {
  8811. tmp[0] = j / 255;
  8812. transferFn(tmp, 0, tmp, 0);
  8813. transferMap[j] = tmp[0] * 255 | 0;
  8814. }
  8815. transferMaps.push(transferMap);
  8816. numEffectfulFns++;
  8817. }
  8818. if (!(numFns === 1 || numFns === 4)) {
  8819. return null;
  8820. }
  8821. if (numEffectfulFns === 0) {
  8822. return null;
  8823. }
  8824. return transferMaps;
  8825. }
  8826. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  8827. const tilingOpList = new _operator_list.OperatorList();
  8828. const patternResources = _primitives.Dict.merge({
  8829. xref: this.xref,
  8830. dictArray: [patternDict.get("Resources"), resources]
  8831. });
  8832. return this.getOperatorList({
  8833. stream: pattern,
  8834. task,
  8835. resources: patternResources,
  8836. operatorList: tilingOpList
  8837. }).then(function () {
  8838. const operatorListIR = tilingOpList.getIR();
  8839. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  8840. operatorList.addDependencies(tilingOpList.dependencies);
  8841. operatorList.addOp(fn, tilingPatternIR);
  8842. if (patternDict.objId) {
  8843. localTilingPatternCache.set(null, patternDict.objId, {
  8844. operatorListIR,
  8845. dict: patternDict
  8846. });
  8847. }
  8848. }).catch(reason => {
  8849. if (reason instanceof _util.AbortException) {
  8850. return;
  8851. }
  8852. if (this.options.ignoreErrors) {
  8853. this.handler.send("UnsupportedFeature", {
  8854. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  8855. });
  8856. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  8857. return;
  8858. }
  8859. throw reason;
  8860. });
  8861. }
  8862. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  8863. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  8864. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  8865. if (!translated.font.isType3Font) {
  8866. return translated;
  8867. }
  8868. return translated.loadType3Data(this, resources, task).then(function () {
  8869. operatorList.addDependencies(translated.type3Dependencies);
  8870. return translated;
  8871. }).catch(reason => {
  8872. this.handler.send("UnsupportedFeature", {
  8873. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  8874. });
  8875. return new TranslatedFont({
  8876. loadedName: "g_font_error",
  8877. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  8878. dict: translated.font,
  8879. evaluatorOptions: this.options
  8880. });
  8881. });
  8882. }).then(translated => {
  8883. state.font = translated.font;
  8884. translated.send(this.handler);
  8885. return translated.loadedName;
  8886. });
  8887. }
  8888. handleText(chars, state) {
  8889. const font = state.font;
  8890. const glyphs = font.charsToGlyphs(chars);
  8891. if (font.data) {
  8892. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  8893. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  8894. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  8895. }
  8896. }
  8897. return glyphs;
  8898. }
  8899. ensureStateFont(state) {
  8900. if (state.font) {
  8901. return;
  8902. }
  8903. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  8904. if (this.options.ignoreErrors) {
  8905. this.handler.send("UnsupportedFeature", {
  8906. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  8907. });
  8908. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  8909. return;
  8910. }
  8911. throw reason;
  8912. }
  8913. async setGState({
  8914. resources,
  8915. gState,
  8916. operatorList,
  8917. cacheKey,
  8918. task,
  8919. stateManager,
  8920. localGStateCache,
  8921. localColorSpaceCache
  8922. }) {
  8923. const gStateRef = gState.objId;
  8924. let isSimpleGState = true;
  8925. const gStateObj = [];
  8926. let promise = Promise.resolve();
  8927. for (const key of gState.getKeys()) {
  8928. const value = gState.get(key);
  8929. switch (key) {
  8930. case "Type":
  8931. break;
  8932. case "LW":
  8933. case "LC":
  8934. case "LJ":
  8935. case "ML":
  8936. case "D":
  8937. case "RI":
  8938. case "FL":
  8939. case "CA":
  8940. case "ca":
  8941. gStateObj.push([key, value]);
  8942. break;
  8943. case "Font":
  8944. isSimpleGState = false;
  8945. promise = promise.then(() => {
  8946. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  8947. operatorList.addDependency(loadedName);
  8948. gStateObj.push([key, [loadedName, value[1]]]);
  8949. });
  8950. });
  8951. break;
  8952. case "BM":
  8953. gStateObj.push([key, normalizeBlendMode(value)]);
  8954. break;
  8955. case "SMask":
  8956. if ((0, _primitives.isName)(value, "None")) {
  8957. gStateObj.push([key, false]);
  8958. break;
  8959. }
  8960. if (value instanceof _primitives.Dict) {
  8961. isSimpleGState = false;
  8962. promise = promise.then(() => {
  8963. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  8964. });
  8965. gStateObj.push([key, true]);
  8966. } else {
  8967. (0, _util.warn)("Unsupported SMask type");
  8968. }
  8969. break;
  8970. case "TR":
  8971. const transferMaps = this.handleTransferFunction(value);
  8972. gStateObj.push([key, transferMaps]);
  8973. break;
  8974. case "OP":
  8975. case "op":
  8976. case "OPM":
  8977. case "BG":
  8978. case "BG2":
  8979. case "UCR":
  8980. case "UCR2":
  8981. case "TR2":
  8982. case "HT":
  8983. case "SM":
  8984. case "SA":
  8985. case "AIS":
  8986. case "TK":
  8987. (0, _util.info)("graphic state operator " + key);
  8988. break;
  8989. default:
  8990. (0, _util.info)("Unknown graphic state operator " + key);
  8991. break;
  8992. }
  8993. }
  8994. return promise.then(function () {
  8995. if (gStateObj.length > 0) {
  8996. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  8997. }
  8998. if (isSimpleGState) {
  8999. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  9000. }
  9001. });
  9002. }
  9003. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  9004. const errorFont = async () => {
  9005. return new TranslatedFont({
  9006. loadedName: "g_font_error",
  9007. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  9008. dict: font,
  9009. evaluatorOptions: this.options
  9010. });
  9011. };
  9012. const xref = this.xref;
  9013. let fontRef;
  9014. if (font) {
  9015. if (font instanceof _primitives.Ref) {
  9016. fontRef = font;
  9017. }
  9018. } else {
  9019. const fontRes = resources.get("Font");
  9020. if (fontRes) {
  9021. fontRef = fontRes.getRaw(fontName);
  9022. }
  9023. }
  9024. if (!fontRef) {
  9025. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  9026. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  9027. (0, _util.warn)(`${partialMsg}.`);
  9028. return errorFont();
  9029. }
  9030. this.handler.send("UnsupportedFeature", {
  9031. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  9032. });
  9033. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  9034. if (fallbackFontDict) {
  9035. fontRef = fallbackFontDict;
  9036. } else {
  9037. fontRef = PartialEvaluator.fallbackFontDict;
  9038. }
  9039. }
  9040. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  9041. return errorFont();
  9042. }
  9043. if (this.fontCache.has(fontRef)) {
  9044. return this.fontCache.get(fontRef);
  9045. }
  9046. font = xref.fetchIfRef(fontRef);
  9047. if (!(font instanceof _primitives.Dict)) {
  9048. return errorFont();
  9049. }
  9050. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  9051. return this.fontCache.get(font.cacheKey);
  9052. }
  9053. const fontCapability = (0, _util.createPromiseCapability)();
  9054. let preEvaluatedFont;
  9055. try {
  9056. preEvaluatedFont = this.preEvaluateFont(font);
  9057. preEvaluatedFont.cssFontInfo = cssFontInfo;
  9058. } catch (reason) {
  9059. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  9060. return errorFont();
  9061. }
  9062. const {
  9063. descriptor,
  9064. hash
  9065. } = preEvaluatedFont;
  9066. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  9067. let fontID;
  9068. if (fontRefIsRef) {
  9069. fontID = `f${fontRef.toString()}`;
  9070. }
  9071. if (hash && descriptor instanceof _primitives.Dict) {
  9072. if (!descriptor.fontAliases) {
  9073. descriptor.fontAliases = Object.create(null);
  9074. }
  9075. const fontAliases = descriptor.fontAliases;
  9076. if (fontAliases[hash]) {
  9077. const aliasFontRef = fontAliases[hash].aliasRef;
  9078. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  9079. this.fontCache.putAlias(fontRef, aliasFontRef);
  9080. return this.fontCache.get(fontRef);
  9081. }
  9082. } else {
  9083. fontAliases[hash] = {
  9084. fontID: this.idFactory.createFontId()
  9085. };
  9086. }
  9087. if (fontRefIsRef) {
  9088. fontAliases[hash].aliasRef = fontRef;
  9089. }
  9090. fontID = fontAliases[hash].fontID;
  9091. }
  9092. if (fontRefIsRef) {
  9093. this.fontCache.put(fontRef, fontCapability.promise);
  9094. } else {
  9095. if (!fontID) {
  9096. fontID = this.idFactory.createFontId();
  9097. }
  9098. font.cacheKey = `cacheKey_${fontID}`;
  9099. this.fontCache.put(font.cacheKey, fontCapability.promise);
  9100. }
  9101. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  9102. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  9103. this.translateFont(preEvaluatedFont).then(translatedFont => {
  9104. fontCapability.resolve(new TranslatedFont({
  9105. loadedName: font.loadedName,
  9106. font: translatedFont,
  9107. dict: font,
  9108. evaluatorOptions: this.options
  9109. }));
  9110. }).catch(reason => {
  9111. this.handler.send("UnsupportedFeature", {
  9112. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  9113. });
  9114. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  9115. fontCapability.resolve(new TranslatedFont({
  9116. loadedName: font.loadedName,
  9117. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  9118. dict: font,
  9119. evaluatorOptions: this.options
  9120. }));
  9121. });
  9122. return fontCapability.promise;
  9123. }
  9124. buildPath(operatorList, fn, args, parsingText = false) {
  9125. const lastIndex = operatorList.length - 1;
  9126. if (!args) {
  9127. args = [];
  9128. }
  9129. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  9130. if (parsingText) {
  9131. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  9132. operatorList.addOp(_util.OPS.save, null);
  9133. }
  9134. let minMax;
  9135. switch (fn) {
  9136. case _util.OPS.rectangle:
  9137. const x = args[0] + args[2];
  9138. const y = args[1] + args[3];
  9139. minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
  9140. break;
  9141. case _util.OPS.moveTo:
  9142. case _util.OPS.lineTo:
  9143. minMax = [args[0], args[0], args[1], args[1]];
  9144. break;
  9145. default:
  9146. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  9147. break;
  9148. }
  9149. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  9150. if (parsingText) {
  9151. operatorList.addOp(_util.OPS.restore, null);
  9152. }
  9153. } else {
  9154. const opArgs = operatorList.argsArray[lastIndex];
  9155. opArgs[0].push(fn);
  9156. opArgs[1].push(...args);
  9157. const minMax = opArgs[2];
  9158. switch (fn) {
  9159. case _util.OPS.rectangle:
  9160. const x = args[0] + args[2];
  9161. const y = args[1] + args[3];
  9162. minMax[0] = Math.min(minMax[0], args[0], x);
  9163. minMax[1] = Math.max(minMax[1], args[0], x);
  9164. minMax[2] = Math.min(minMax[2], args[1], y);
  9165. minMax[3] = Math.max(minMax[3], args[1], y);
  9166. break;
  9167. case _util.OPS.moveTo:
  9168. case _util.OPS.lineTo:
  9169. minMax[0] = Math.min(minMax[0], args[0]);
  9170. minMax[1] = Math.max(minMax[1], args[0]);
  9171. minMax[2] = Math.min(minMax[2], args[1]);
  9172. minMax[3] = Math.max(minMax[3], args[1]);
  9173. break;
  9174. }
  9175. }
  9176. }
  9177. parseColorSpace({
  9178. cs,
  9179. resources,
  9180. localColorSpaceCache
  9181. }) {
  9182. return _colorspace.ColorSpace.parseAsync({
  9183. cs,
  9184. xref: this.xref,
  9185. resources,
  9186. pdfFunctionFactory: this._pdfFunctionFactory,
  9187. localColorSpaceCache
  9188. }).catch(reason => {
  9189. if (reason instanceof _util.AbortException) {
  9190. return null;
  9191. }
  9192. if (this.options.ignoreErrors) {
  9193. this.handler.send("UnsupportedFeature", {
  9194. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  9195. });
  9196. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  9197. return null;
  9198. }
  9199. throw reason;
  9200. });
  9201. }
  9202. parseShading({
  9203. shading,
  9204. resources,
  9205. localColorSpaceCache,
  9206. localShadingPatternCache
  9207. }) {
  9208. let id = localShadingPatternCache.get(shading);
  9209. if (!id) {
  9210. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  9211. const patternIR = shadingFill.getIR();
  9212. id = `pattern_${this.idFactory.createObjId()}`;
  9213. localShadingPatternCache.set(shading, id);
  9214. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  9215. }
  9216. return id;
  9217. }
  9218. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  9219. const patternName = args.pop();
  9220. if (patternName instanceof _primitives.Name) {
  9221. const rawPattern = patterns.getRaw(patternName.name);
  9222. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  9223. if (localTilingPattern) {
  9224. try {
  9225. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  9226. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  9227. operatorList.addOp(fn, tilingPatternIR);
  9228. return undefined;
  9229. } catch (ex) {}
  9230. }
  9231. const pattern = this.xref.fetchIfRef(rawPattern);
  9232. if (pattern) {
  9233. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  9234. const typeNum = dict.get("PatternType");
  9235. if (typeNum === PatternType.TILING) {
  9236. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  9237. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  9238. } else if (typeNum === PatternType.SHADING) {
  9239. const shading = dict.get("Shading");
  9240. const matrix = dict.getArray("Matrix");
  9241. const objId = this.parseShading({
  9242. shading,
  9243. resources,
  9244. localColorSpaceCache,
  9245. localShadingPatternCache
  9246. });
  9247. operatorList.addOp(fn, ["Shading", objId, matrix]);
  9248. return undefined;
  9249. }
  9250. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  9251. }
  9252. }
  9253. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  9254. }
  9255. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  9256. const MAX_NESTING = 10;
  9257. if (++nestingCounter > MAX_NESTING) {
  9258. (0, _util.warn)("Visibility expression is too deeply nested");
  9259. return;
  9260. }
  9261. const length = array.length;
  9262. const operator = this.xref.fetchIfRef(array[0]);
  9263. if (length < 2 || !(operator instanceof _primitives.Name)) {
  9264. (0, _util.warn)("Invalid visibility expression");
  9265. return;
  9266. }
  9267. switch (operator.name) {
  9268. case "And":
  9269. case "Or":
  9270. case "Not":
  9271. currentResult.push(operator.name);
  9272. break;
  9273. default:
  9274. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  9275. return;
  9276. }
  9277. for (let i = 1; i < length; i++) {
  9278. const raw = array[i];
  9279. const object = this.xref.fetchIfRef(raw);
  9280. if (Array.isArray(object)) {
  9281. const nestedResult = [];
  9282. currentResult.push(nestedResult);
  9283. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  9284. } else if (raw instanceof _primitives.Ref) {
  9285. currentResult.push(raw.toString());
  9286. }
  9287. }
  9288. }
  9289. async parseMarkedContentProps(contentProperties, resources) {
  9290. let optionalContent;
  9291. if (contentProperties instanceof _primitives.Name) {
  9292. const properties = resources.get("Properties");
  9293. optionalContent = properties.get(contentProperties.name);
  9294. } else if (contentProperties instanceof _primitives.Dict) {
  9295. optionalContent = contentProperties;
  9296. } else {
  9297. throw new _util.FormatError("Optional content properties malformed.");
  9298. }
  9299. const optionalContentType = optionalContent.get("Type").name;
  9300. if (optionalContentType === "OCG") {
  9301. return {
  9302. type: optionalContentType,
  9303. id: optionalContent.objId
  9304. };
  9305. } else if (optionalContentType === "OCMD") {
  9306. const expression = optionalContent.get("VE");
  9307. if (Array.isArray(expression)) {
  9308. const result = [];
  9309. this._parseVisibilityExpression(expression, 0, result);
  9310. if (result.length > 0) {
  9311. return {
  9312. type: "OCMD",
  9313. expression: result
  9314. };
  9315. }
  9316. }
  9317. const optionalContentGroups = optionalContent.get("OCGs");
  9318. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  9319. const groupIds = [];
  9320. if (Array.isArray(optionalContentGroups)) {
  9321. for (const ocg of optionalContentGroups) {
  9322. groupIds.push(ocg.toString());
  9323. }
  9324. } else {
  9325. groupIds.push(optionalContentGroups.objId);
  9326. }
  9327. return {
  9328. type: optionalContentType,
  9329. ids: groupIds,
  9330. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  9331. expression: null
  9332. };
  9333. } else if (optionalContentGroups instanceof _primitives.Ref) {
  9334. return {
  9335. type: optionalContentType,
  9336. id: optionalContentGroups.toString()
  9337. };
  9338. }
  9339. }
  9340. return null;
  9341. }
  9342. getOperatorList({
  9343. stream,
  9344. task,
  9345. resources,
  9346. operatorList,
  9347. initialState = null,
  9348. fallbackFontDict = null
  9349. }) {
  9350. resources = resources || _primitives.Dict.empty;
  9351. initialState = initialState || new EvalState();
  9352. if (!operatorList) {
  9353. throw new Error('getOperatorList: missing "operatorList" parameter');
  9354. }
  9355. const self = this;
  9356. const xref = this.xref;
  9357. let parsingText = false;
  9358. const localImageCache = new _image_utils.LocalImageCache();
  9359. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  9360. const localGStateCache = new _image_utils.LocalGStateCache();
  9361. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  9362. const localShadingPatternCache = new Map();
  9363. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  9364. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  9365. const stateManager = new StateManager(initialState);
  9366. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9367. const timeSlotManager = new TimeSlotManager();
  9368. function closePendingRestoreOPS(argument) {
  9369. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  9370. operatorList.addOp(_util.OPS.restore, []);
  9371. }
  9372. }
  9373. return new Promise(function promiseBody(resolve, reject) {
  9374. const next = function (promise) {
  9375. Promise.all([promise, operatorList.ready]).then(function () {
  9376. try {
  9377. promiseBody(resolve, reject);
  9378. } catch (ex) {
  9379. reject(ex);
  9380. }
  9381. }, reject);
  9382. };
  9383. task.ensureNotTerminated();
  9384. timeSlotManager.reset();
  9385. const operation = {};
  9386. let stop, i, ii, cs, name, isValidName;
  9387. while (!(stop = timeSlotManager.check())) {
  9388. operation.args = null;
  9389. if (!preprocessor.read(operation)) {
  9390. break;
  9391. }
  9392. let args = operation.args;
  9393. let fn = operation.fn;
  9394. switch (fn | 0) {
  9395. case _util.OPS.paintXObject:
  9396. isValidName = args[0] instanceof _primitives.Name;
  9397. name = args[0].name;
  9398. if (isValidName) {
  9399. const localImage = localImageCache.getByName(name);
  9400. if (localImage) {
  9401. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9402. incrementCachedImageMaskCount(localImage);
  9403. args = null;
  9404. continue;
  9405. }
  9406. }
  9407. next(new Promise(function (resolveXObject, rejectXObject) {
  9408. if (!isValidName) {
  9409. throw new _util.FormatError("XObject must be referred to by name.");
  9410. }
  9411. let xobj = xobjs.getRaw(name);
  9412. if (xobj instanceof _primitives.Ref) {
  9413. const localImage = localImageCache.getByRef(xobj);
  9414. if (localImage) {
  9415. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9416. incrementCachedImageMaskCount(localImage);
  9417. resolveXObject();
  9418. return;
  9419. }
  9420. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  9421. if (globalImage) {
  9422. operatorList.addDependency(globalImage.objId);
  9423. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  9424. resolveXObject();
  9425. return;
  9426. }
  9427. xobj = xref.fetch(xobj);
  9428. }
  9429. if (!(xobj instanceof _base_stream.BaseStream)) {
  9430. throw new _util.FormatError("XObject should be a stream");
  9431. }
  9432. const type = xobj.dict.get("Subtype");
  9433. if (!(type instanceof _primitives.Name)) {
  9434. throw new _util.FormatError("XObject should have a Name subtype");
  9435. }
  9436. if (type.name === "Form") {
  9437. stateManager.save();
  9438. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  9439. stateManager.restore();
  9440. resolveXObject();
  9441. }, rejectXObject);
  9442. return;
  9443. } else if (type.name === "Image") {
  9444. self.buildPaintImageXObject({
  9445. resources,
  9446. image: xobj,
  9447. operatorList,
  9448. cacheKey: name,
  9449. localImageCache,
  9450. localColorSpaceCache
  9451. }).then(resolveXObject, rejectXObject);
  9452. return;
  9453. } else if (type.name === "PS") {
  9454. (0, _util.info)("Ignored XObject subtype PS");
  9455. } else {
  9456. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  9457. }
  9458. resolveXObject();
  9459. }).catch(function (reason) {
  9460. if (reason instanceof _util.AbortException) {
  9461. return;
  9462. }
  9463. if (self.options.ignoreErrors) {
  9464. self.handler.send("UnsupportedFeature", {
  9465. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  9466. });
  9467. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  9468. return;
  9469. }
  9470. throw reason;
  9471. }));
  9472. return;
  9473. case _util.OPS.setFont:
  9474. var fontSize = args[1];
  9475. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  9476. operatorList.addDependency(loadedName);
  9477. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  9478. }));
  9479. return;
  9480. case _util.OPS.beginText:
  9481. parsingText = true;
  9482. break;
  9483. case _util.OPS.endText:
  9484. parsingText = false;
  9485. break;
  9486. case _util.OPS.endInlineImage:
  9487. var cacheKey = args[0].cacheKey;
  9488. if (cacheKey) {
  9489. const localImage = localImageCache.getByName(cacheKey);
  9490. if (localImage) {
  9491. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9492. incrementCachedImageMaskCount(localImage);
  9493. args = null;
  9494. continue;
  9495. }
  9496. }
  9497. next(self.buildPaintImageXObject({
  9498. resources,
  9499. image: args[0],
  9500. isInline: true,
  9501. operatorList,
  9502. cacheKey,
  9503. localImageCache,
  9504. localColorSpaceCache
  9505. }));
  9506. return;
  9507. case _util.OPS.showText:
  9508. if (!stateManager.state.font) {
  9509. self.ensureStateFont(stateManager.state);
  9510. continue;
  9511. }
  9512. args[0] = self.handleText(args[0], stateManager.state);
  9513. break;
  9514. case _util.OPS.showSpacedText:
  9515. if (!stateManager.state.font) {
  9516. self.ensureStateFont(stateManager.state);
  9517. continue;
  9518. }
  9519. var combinedGlyphs = [];
  9520. var state = stateManager.state;
  9521. for (const arrItem of args[0]) {
  9522. if (typeof arrItem === "string") {
  9523. combinedGlyphs.push(...self.handleText(arrItem, state));
  9524. } else if (typeof arrItem === "number") {
  9525. combinedGlyphs.push(arrItem);
  9526. }
  9527. }
  9528. args[0] = combinedGlyphs;
  9529. fn = _util.OPS.showText;
  9530. break;
  9531. case _util.OPS.nextLineShowText:
  9532. if (!stateManager.state.font) {
  9533. self.ensureStateFont(stateManager.state);
  9534. continue;
  9535. }
  9536. operatorList.addOp(_util.OPS.nextLine);
  9537. args[0] = self.handleText(args[0], stateManager.state);
  9538. fn = _util.OPS.showText;
  9539. break;
  9540. case _util.OPS.nextLineSetSpacingShowText:
  9541. if (!stateManager.state.font) {
  9542. self.ensureStateFont(stateManager.state);
  9543. continue;
  9544. }
  9545. operatorList.addOp(_util.OPS.nextLine);
  9546. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  9547. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  9548. args[0] = self.handleText(args[0], stateManager.state);
  9549. fn = _util.OPS.showText;
  9550. break;
  9551. case _util.OPS.setTextRenderingMode:
  9552. stateManager.state.textRenderingMode = args[0];
  9553. break;
  9554. case _util.OPS.setFillColorSpace:
  9555. {
  9556. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9557. if (cachedColorSpace) {
  9558. stateManager.state.fillColorSpace = cachedColorSpace;
  9559. continue;
  9560. }
  9561. next(self.parseColorSpace({
  9562. cs: args[0],
  9563. resources,
  9564. localColorSpaceCache
  9565. }).then(function (colorSpace) {
  9566. if (colorSpace) {
  9567. stateManager.state.fillColorSpace = colorSpace;
  9568. }
  9569. }));
  9570. return;
  9571. }
  9572. case _util.OPS.setStrokeColorSpace:
  9573. {
  9574. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9575. if (cachedColorSpace) {
  9576. stateManager.state.strokeColorSpace = cachedColorSpace;
  9577. continue;
  9578. }
  9579. next(self.parseColorSpace({
  9580. cs: args[0],
  9581. resources,
  9582. localColorSpaceCache
  9583. }).then(function (colorSpace) {
  9584. if (colorSpace) {
  9585. stateManager.state.strokeColorSpace = colorSpace;
  9586. }
  9587. }));
  9588. return;
  9589. }
  9590. case _util.OPS.setFillColor:
  9591. cs = stateManager.state.fillColorSpace;
  9592. args = cs.getRgb(args, 0);
  9593. fn = _util.OPS.setFillRGBColor;
  9594. break;
  9595. case _util.OPS.setStrokeColor:
  9596. cs = stateManager.state.strokeColorSpace;
  9597. args = cs.getRgb(args, 0);
  9598. fn = _util.OPS.setStrokeRGBColor;
  9599. break;
  9600. case _util.OPS.setFillGray:
  9601. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  9602. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9603. fn = _util.OPS.setFillRGBColor;
  9604. break;
  9605. case _util.OPS.setStrokeGray:
  9606. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  9607. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9608. fn = _util.OPS.setStrokeRGBColor;
  9609. break;
  9610. case _util.OPS.setFillCMYKColor:
  9611. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9612. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9613. fn = _util.OPS.setFillRGBColor;
  9614. break;
  9615. case _util.OPS.setStrokeCMYKColor:
  9616. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9617. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9618. fn = _util.OPS.setStrokeRGBColor;
  9619. break;
  9620. case _util.OPS.setFillRGBColor:
  9621. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9622. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9623. break;
  9624. case _util.OPS.setStrokeRGBColor:
  9625. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9626. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9627. break;
  9628. case _util.OPS.setFillColorN:
  9629. cs = stateManager.state.fillColorSpace;
  9630. if (cs.name === "Pattern") {
  9631. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9632. return;
  9633. }
  9634. args = cs.getRgb(args, 0);
  9635. fn = _util.OPS.setFillRGBColor;
  9636. break;
  9637. case _util.OPS.setStrokeColorN:
  9638. cs = stateManager.state.strokeColorSpace;
  9639. if (cs.name === "Pattern") {
  9640. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9641. return;
  9642. }
  9643. args = cs.getRgb(args, 0);
  9644. fn = _util.OPS.setStrokeRGBColor;
  9645. break;
  9646. case _util.OPS.shadingFill:
  9647. var shadingRes = resources.get("Shading");
  9648. if (!shadingRes) {
  9649. throw new _util.FormatError("No shading resource found");
  9650. }
  9651. var shading = shadingRes.get(args[0].name);
  9652. if (!shading) {
  9653. throw new _util.FormatError("No shading object found");
  9654. }
  9655. const patternId = self.parseShading({
  9656. shading,
  9657. resources,
  9658. localColorSpaceCache,
  9659. localShadingPatternCache
  9660. });
  9661. args = [patternId];
  9662. fn = _util.OPS.shadingFill;
  9663. break;
  9664. case _util.OPS.setGState:
  9665. isValidName = args[0] instanceof _primitives.Name;
  9666. name = args[0].name;
  9667. if (isValidName) {
  9668. const localGStateObj = localGStateCache.getByName(name);
  9669. if (localGStateObj) {
  9670. if (localGStateObj.length > 0) {
  9671. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  9672. }
  9673. args = null;
  9674. continue;
  9675. }
  9676. }
  9677. next(new Promise(function (resolveGState, rejectGState) {
  9678. if (!isValidName) {
  9679. throw new _util.FormatError("GState must be referred to by name.");
  9680. }
  9681. const extGState = resources.get("ExtGState");
  9682. if (!(extGState instanceof _primitives.Dict)) {
  9683. throw new _util.FormatError("ExtGState should be a dictionary.");
  9684. }
  9685. const gState = extGState.get(name);
  9686. if (!(gState instanceof _primitives.Dict)) {
  9687. throw new _util.FormatError("GState should be a dictionary.");
  9688. }
  9689. self.setGState({
  9690. resources,
  9691. gState,
  9692. operatorList,
  9693. cacheKey: name,
  9694. task,
  9695. stateManager,
  9696. localGStateCache,
  9697. localColorSpaceCache
  9698. }).then(resolveGState, rejectGState);
  9699. }).catch(function (reason) {
  9700. if (reason instanceof _util.AbortException) {
  9701. return;
  9702. }
  9703. if (self.options.ignoreErrors) {
  9704. self.handler.send("UnsupportedFeature", {
  9705. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  9706. });
  9707. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  9708. return;
  9709. }
  9710. throw reason;
  9711. }));
  9712. return;
  9713. case _util.OPS.moveTo:
  9714. case _util.OPS.lineTo:
  9715. case _util.OPS.curveTo:
  9716. case _util.OPS.curveTo2:
  9717. case _util.OPS.curveTo3:
  9718. case _util.OPS.closePath:
  9719. case _util.OPS.rectangle:
  9720. self.buildPath(operatorList, fn, args, parsingText);
  9721. continue;
  9722. case _util.OPS.markPoint:
  9723. case _util.OPS.markPointProps:
  9724. case _util.OPS.beginCompat:
  9725. case _util.OPS.endCompat:
  9726. continue;
  9727. case _util.OPS.beginMarkedContentProps:
  9728. if (!(args[0] instanceof _primitives.Name)) {
  9729. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  9730. continue;
  9731. }
  9732. if (args[0].name === "OC") {
  9733. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  9734. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  9735. }).catch(reason => {
  9736. if (reason instanceof _util.AbortException) {
  9737. return;
  9738. }
  9739. if (self.options.ignoreErrors) {
  9740. self.handler.send("UnsupportedFeature", {
  9741. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  9742. });
  9743. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  9744. return;
  9745. }
  9746. throw reason;
  9747. }));
  9748. return;
  9749. }
  9750. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  9751. break;
  9752. case _util.OPS.beginMarkedContent:
  9753. case _util.OPS.endMarkedContent:
  9754. default:
  9755. if (args !== null) {
  9756. for (i = 0, ii = args.length; i < ii; i++) {
  9757. if (args[i] instanceof _primitives.Dict) {
  9758. break;
  9759. }
  9760. }
  9761. if (i < ii) {
  9762. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  9763. continue;
  9764. }
  9765. }
  9766. }
  9767. operatorList.addOp(fn, args);
  9768. }
  9769. if (stop) {
  9770. next(deferred);
  9771. return;
  9772. }
  9773. closePendingRestoreOPS();
  9774. resolve();
  9775. }).catch(reason => {
  9776. if (reason instanceof _util.AbortException) {
  9777. return;
  9778. }
  9779. if (this.options.ignoreErrors) {
  9780. this.handler.send("UnsupportedFeature", {
  9781. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  9782. });
  9783. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  9784. closePendingRestoreOPS();
  9785. return;
  9786. }
  9787. throw reason;
  9788. });
  9789. }
  9790. getTextContent({
  9791. stream,
  9792. task,
  9793. resources,
  9794. stateManager = null,
  9795. combineTextItems = false,
  9796. includeMarkedContent = false,
  9797. sink,
  9798. seenStyles = new Set(),
  9799. viewBox,
  9800. markedContentData = null
  9801. }) {
  9802. resources = resources || _primitives.Dict.empty;
  9803. stateManager = stateManager || new StateManager(new TextState());
  9804. if (includeMarkedContent) {
  9805. markedContentData = markedContentData || {
  9806. level: 0
  9807. };
  9808. }
  9809. const textContent = {
  9810. items: [],
  9811. styles: Object.create(null)
  9812. };
  9813. const textContentItem = {
  9814. initialized: false,
  9815. str: [],
  9816. totalWidth: 0,
  9817. totalHeight: 0,
  9818. width: 0,
  9819. height: 0,
  9820. vertical: false,
  9821. prevTransform: null,
  9822. textAdvanceScale: 0,
  9823. spaceInFlowMin: 0,
  9824. spaceInFlowMax: 0,
  9825. trackingSpaceMin: Infinity,
  9826. negativeSpaceMax: -Infinity,
  9827. notASpace: -Infinity,
  9828. transform: null,
  9829. fontName: null,
  9830. hasEOL: false
  9831. };
  9832. const twoLastChars = [" ", " "];
  9833. let twoLastCharsPos = 0;
  9834. function saveLastChar(char) {
  9835. const nextPos = (twoLastCharsPos + 1) % 2;
  9836. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  9837. twoLastChars[twoLastCharsPos] = char;
  9838. twoLastCharsPos = nextPos;
  9839. return ret;
  9840. }
  9841. function resetLastChars() {
  9842. twoLastChars[0] = twoLastChars[1] = " ";
  9843. twoLastCharsPos = 0;
  9844. }
  9845. const TRACKING_SPACE_FACTOR = 0.1;
  9846. const NOT_A_SPACE_FACTOR = 0.03;
  9847. const NEGATIVE_SPACE_FACTOR = -0.2;
  9848. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  9849. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  9850. const self = this;
  9851. const xref = this.xref;
  9852. const showSpacedTextBuffer = [];
  9853. let xobjs = null;
  9854. const emptyXObjectCache = new _image_utils.LocalImageCache();
  9855. const emptyGStateCache = new _image_utils.LocalGStateCache();
  9856. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9857. let textState;
  9858. function getCurrentTextTransform() {
  9859. const font = textState.font;
  9860. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  9861. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  9862. const glyphHeight = font.bbox[3] - font.bbox[1];
  9863. if (glyphHeight > 0) {
  9864. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  9865. }
  9866. }
  9867. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  9868. }
  9869. function ensureTextContentItem() {
  9870. if (textContentItem.initialized) {
  9871. return textContentItem;
  9872. }
  9873. const {
  9874. font,
  9875. loadedName
  9876. } = textState;
  9877. if (!seenStyles.has(loadedName)) {
  9878. seenStyles.add(loadedName);
  9879. textContent.styles[loadedName] = {
  9880. fontFamily: font.fallbackName,
  9881. ascent: font.ascent,
  9882. descent: font.descent,
  9883. vertical: font.vertical
  9884. };
  9885. }
  9886. textContentItem.fontName = loadedName;
  9887. const trm = textContentItem.transform = getCurrentTextTransform();
  9888. if (!font.vertical) {
  9889. textContentItem.width = textContentItem.totalWidth = 0;
  9890. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  9891. textContentItem.vertical = false;
  9892. } else {
  9893. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  9894. textContentItem.height = textContentItem.totalHeight = 0;
  9895. textContentItem.vertical = true;
  9896. }
  9897. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9898. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9899. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  9900. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  9901. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  9902. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  9903. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  9904. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  9905. textContentItem.hasEOL = false;
  9906. textContentItem.initialized = true;
  9907. return textContentItem;
  9908. }
  9909. function updateAdvanceScale() {
  9910. if (!textContentItem.initialized) {
  9911. return;
  9912. }
  9913. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9914. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9915. const scaleFactor = scaleCtmX * scaleLineX;
  9916. if (scaleFactor === textContentItem.textAdvanceScale) {
  9917. return;
  9918. }
  9919. if (!textContentItem.vertical) {
  9920. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  9921. textContentItem.width = 0;
  9922. } else {
  9923. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  9924. textContentItem.height = 0;
  9925. }
  9926. textContentItem.textAdvanceScale = scaleFactor;
  9927. }
  9928. function runBidiTransform(textChunk) {
  9929. const text = textChunk.str.join("");
  9930. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  9931. return {
  9932. str: bidiResult.str,
  9933. dir: bidiResult.dir,
  9934. width: Math.abs(textChunk.totalWidth),
  9935. height: Math.abs(textChunk.totalHeight),
  9936. transform: textChunk.transform,
  9937. fontName: textChunk.fontName,
  9938. hasEOL: textChunk.hasEOL
  9939. };
  9940. }
  9941. function handleSetFont(fontName, fontRef) {
  9942. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  9943. if (!translated.font.isType3Font) {
  9944. return translated;
  9945. }
  9946. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  9947. return translated;
  9948. });
  9949. }).then(function (translated) {
  9950. textState.loadedName = translated.loadedName;
  9951. textState.font = translated.font;
  9952. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  9953. });
  9954. }
  9955. function applyInverseRotation(x, y, matrix) {
  9956. const scale = Math.hypot(matrix[0], matrix[1]);
  9957. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  9958. }
  9959. function compareWithLastPosition() {
  9960. const currentTransform = getCurrentTextTransform();
  9961. let posX = currentTransform[4];
  9962. let posY = currentTransform[5];
  9963. const shiftedX = posX - viewBox[0];
  9964. const shiftedY = posY - viewBox[1];
  9965. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  9966. return false;
  9967. }
  9968. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  9969. return true;
  9970. }
  9971. let lastPosX = textContentItem.prevTransform[4];
  9972. let lastPosY = textContentItem.prevTransform[5];
  9973. if (lastPosX === posX && lastPosY === posY) {
  9974. return true;
  9975. }
  9976. let rotate = -1;
  9977. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  9978. rotate = currentTransform[0] > 0 ? 0 : 180;
  9979. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  9980. rotate = currentTransform[1] > 0 ? 90 : 270;
  9981. }
  9982. switch (rotate) {
  9983. case 0:
  9984. break;
  9985. case 90:
  9986. [posX, posY] = [posY, posX];
  9987. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  9988. break;
  9989. case 180:
  9990. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  9991. break;
  9992. case 270:
  9993. [posX, posY] = [-posY, -posX];
  9994. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  9995. break;
  9996. default:
  9997. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  9998. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  9999. }
  10000. if (textState.font.vertical) {
  10001. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  10002. const advanceX = posX - lastPosX;
  10003. const textOrientation = Math.sign(textContentItem.height);
  10004. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  10005. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  10006. appendEOL();
  10007. return true;
  10008. }
  10009. resetLastChars();
  10010. flushTextContentItem();
  10011. return true;
  10012. }
  10013. if (Math.abs(advanceX) > textContentItem.width) {
  10014. appendEOL();
  10015. return true;
  10016. }
  10017. if (advanceY <= textOrientation * textContentItem.notASpace) {
  10018. resetLastChars();
  10019. }
  10020. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  10021. textContentItem.height += advanceY;
  10022. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  10023. if (textContentItem.str.length === 0) {
  10024. resetLastChars();
  10025. textContent.items.push({
  10026. str: " ",
  10027. dir: "ltr",
  10028. width: 0,
  10029. height: Math.abs(advanceY),
  10030. transform: textContentItem.prevTransform,
  10031. fontName: textContentItem.fontName,
  10032. hasEOL: false
  10033. });
  10034. } else {
  10035. textContentItem.height += advanceY;
  10036. }
  10037. }
  10038. return true;
  10039. }
  10040. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  10041. const advanceY = posY - lastPosY;
  10042. const textOrientation = Math.sign(textContentItem.width);
  10043. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  10044. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  10045. appendEOL();
  10046. return true;
  10047. }
  10048. resetLastChars();
  10049. flushTextContentItem();
  10050. return true;
  10051. }
  10052. if (Math.abs(advanceY) > textContentItem.height) {
  10053. appendEOL();
  10054. return true;
  10055. }
  10056. if (advanceX <= textOrientation * textContentItem.notASpace) {
  10057. resetLastChars();
  10058. }
  10059. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  10060. textContentItem.width += advanceX;
  10061. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  10062. if (textContentItem.str.length === 0) {
  10063. resetLastChars();
  10064. textContent.items.push({
  10065. str: " ",
  10066. dir: "ltr",
  10067. width: Math.abs(advanceX),
  10068. height: 0,
  10069. transform: textContentItem.prevTransform,
  10070. fontName: textContentItem.fontName,
  10071. hasEOL: false
  10072. });
  10073. } else {
  10074. textContentItem.width += advanceX;
  10075. }
  10076. }
  10077. return true;
  10078. }
  10079. function buildTextContentItem({
  10080. chars,
  10081. extraSpacing
  10082. }) {
  10083. const font = textState.font;
  10084. if (!chars) {
  10085. const charSpacing = textState.charSpacing + extraSpacing;
  10086. if (charSpacing) {
  10087. if (!font.vertical) {
  10088. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10089. } else {
  10090. textState.translateTextMatrix(0, -charSpacing);
  10091. }
  10092. }
  10093. return;
  10094. }
  10095. const glyphs = font.charsToGlyphs(chars);
  10096. const scale = textState.fontMatrix[0] * textState.fontSize;
  10097. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  10098. const glyph = glyphs[i];
  10099. const {
  10100. category
  10101. } = glyph;
  10102. if (category.isInvisibleFormatMark) {
  10103. continue;
  10104. }
  10105. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  10106. let glyphWidth = glyph.width;
  10107. if (font.vertical) {
  10108. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  10109. }
  10110. let scaledDim = glyphWidth * scale;
  10111. if (category.isWhitespace) {
  10112. if (!font.vertical) {
  10113. charSpacing += scaledDim + textState.wordSpacing;
  10114. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10115. } else {
  10116. charSpacing += -scaledDim + textState.wordSpacing;
  10117. textState.translateTextMatrix(0, -charSpacing);
  10118. }
  10119. saveLastChar(" ");
  10120. continue;
  10121. }
  10122. if (!compareWithLastPosition()) {
  10123. continue;
  10124. }
  10125. const textChunk = ensureTextContentItem();
  10126. if (category.isZeroWidthDiacritic) {
  10127. scaledDim = 0;
  10128. }
  10129. if (!font.vertical) {
  10130. scaledDim *= textState.textHScale;
  10131. textState.translateTextMatrix(scaledDim, 0);
  10132. textChunk.width += scaledDim;
  10133. } else {
  10134. textState.translateTextMatrix(0, scaledDim);
  10135. scaledDim = Math.abs(scaledDim);
  10136. textChunk.height += scaledDim;
  10137. }
  10138. if (scaledDim) {
  10139. textChunk.prevTransform = getCurrentTextTransform();
  10140. }
  10141. const glyphUnicode = glyph.normalizedUnicode;
  10142. if (saveLastChar(glyphUnicode)) {
  10143. textChunk.str.push(" ");
  10144. }
  10145. textChunk.str.push(glyphUnicode);
  10146. if (charSpacing) {
  10147. if (!font.vertical) {
  10148. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  10149. } else {
  10150. textState.translateTextMatrix(0, -charSpacing);
  10151. }
  10152. }
  10153. }
  10154. }
  10155. function appendEOL() {
  10156. resetLastChars();
  10157. if (textContentItem.initialized) {
  10158. textContentItem.hasEOL = true;
  10159. flushTextContentItem();
  10160. } else {
  10161. textContent.items.push({
  10162. str: "",
  10163. dir: "ltr",
  10164. width: 0,
  10165. height: 0,
  10166. transform: getCurrentTextTransform(),
  10167. fontName: textState.loadedName,
  10168. hasEOL: true
  10169. });
  10170. }
  10171. }
  10172. function addFakeSpaces(width, transf, textOrientation) {
  10173. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  10174. if (textContentItem.initialized) {
  10175. resetLastChars();
  10176. textContentItem.str.push(" ");
  10177. }
  10178. return false;
  10179. }
  10180. const fontName = textContentItem.fontName;
  10181. let height = 0;
  10182. if (textContentItem.vertical) {
  10183. height = width;
  10184. width = 0;
  10185. }
  10186. flushTextContentItem();
  10187. resetLastChars();
  10188. textContent.items.push({
  10189. str: " ",
  10190. dir: "ltr",
  10191. width: Math.abs(width),
  10192. height: Math.abs(height),
  10193. transform: transf || getCurrentTextTransform(),
  10194. fontName,
  10195. hasEOL: false
  10196. });
  10197. return true;
  10198. }
  10199. function flushTextContentItem() {
  10200. if (!textContentItem.initialized || !textContentItem.str) {
  10201. return;
  10202. }
  10203. if (!textContentItem.vertical) {
  10204. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  10205. } else {
  10206. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  10207. }
  10208. textContent.items.push(runBidiTransform(textContentItem));
  10209. textContentItem.initialized = false;
  10210. textContentItem.str.length = 0;
  10211. }
  10212. function enqueueChunk(batch = false) {
  10213. const length = textContent.items.length;
  10214. if (length === 0) {
  10215. return;
  10216. }
  10217. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  10218. return;
  10219. }
  10220. sink.enqueue(textContent, length);
  10221. textContent.items = [];
  10222. textContent.styles = Object.create(null);
  10223. }
  10224. const timeSlotManager = new TimeSlotManager();
  10225. return new Promise(function promiseBody(resolve, reject) {
  10226. const next = function (promise) {
  10227. enqueueChunk(true);
  10228. Promise.all([promise, sink.ready]).then(function () {
  10229. try {
  10230. promiseBody(resolve, reject);
  10231. } catch (ex) {
  10232. reject(ex);
  10233. }
  10234. }, reject);
  10235. };
  10236. task.ensureNotTerminated();
  10237. timeSlotManager.reset();
  10238. const operation = {};
  10239. let stop,
  10240. args = [];
  10241. while (!(stop = timeSlotManager.check())) {
  10242. args.length = 0;
  10243. operation.args = args;
  10244. if (!preprocessor.read(operation)) {
  10245. break;
  10246. }
  10247. textState = stateManager.state;
  10248. const fn = operation.fn;
  10249. args = operation.args;
  10250. switch (fn | 0) {
  10251. case _util.OPS.setFont:
  10252. var fontNameArg = args[0].name,
  10253. fontSizeArg = args[1];
  10254. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  10255. break;
  10256. }
  10257. flushTextContentItem();
  10258. textState.fontName = fontNameArg;
  10259. textState.fontSize = fontSizeArg;
  10260. next(handleSetFont(fontNameArg, null));
  10261. return;
  10262. case _util.OPS.setTextRise:
  10263. textState.textRise = args[0];
  10264. break;
  10265. case _util.OPS.setHScale:
  10266. textState.textHScale = args[0] / 100;
  10267. break;
  10268. case _util.OPS.setLeading:
  10269. textState.leading = args[0];
  10270. break;
  10271. case _util.OPS.moveText:
  10272. textState.translateTextLineMatrix(args[0], args[1]);
  10273. textState.textMatrix = textState.textLineMatrix.slice();
  10274. break;
  10275. case _util.OPS.setLeadingMoveText:
  10276. textState.leading = -args[1];
  10277. textState.translateTextLineMatrix(args[0], args[1]);
  10278. textState.textMatrix = textState.textLineMatrix.slice();
  10279. break;
  10280. case _util.OPS.nextLine:
  10281. textState.carriageReturn();
  10282. break;
  10283. case _util.OPS.setTextMatrix:
  10284. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  10285. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  10286. updateAdvanceScale();
  10287. break;
  10288. case _util.OPS.setCharSpacing:
  10289. textState.charSpacing = args[0];
  10290. break;
  10291. case _util.OPS.setWordSpacing:
  10292. textState.wordSpacing = args[0];
  10293. break;
  10294. case _util.OPS.beginText:
  10295. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  10296. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  10297. break;
  10298. case _util.OPS.showSpacedText:
  10299. if (!stateManager.state.font) {
  10300. self.ensureStateFont(stateManager.state);
  10301. continue;
  10302. }
  10303. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  10304. const elements = args[0];
  10305. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  10306. const item = elements[i];
  10307. if (typeof item === "string") {
  10308. showSpacedTextBuffer.push(item);
  10309. } else if (typeof item === "number" && item !== 0) {
  10310. const str = showSpacedTextBuffer.join("");
  10311. showSpacedTextBuffer.length = 0;
  10312. buildTextContentItem({
  10313. chars: str,
  10314. extraSpacing: item * spaceFactor
  10315. });
  10316. }
  10317. }
  10318. const item = elements.at(-1);
  10319. if (typeof item === "string") {
  10320. showSpacedTextBuffer.push(item);
  10321. }
  10322. if (showSpacedTextBuffer.length > 0) {
  10323. const str = showSpacedTextBuffer.join("");
  10324. showSpacedTextBuffer.length = 0;
  10325. buildTextContentItem({
  10326. chars: str,
  10327. extraSpacing: 0
  10328. });
  10329. }
  10330. break;
  10331. case _util.OPS.showText:
  10332. if (!stateManager.state.font) {
  10333. self.ensureStateFont(stateManager.state);
  10334. continue;
  10335. }
  10336. buildTextContentItem({
  10337. chars: args[0],
  10338. extraSpacing: 0
  10339. });
  10340. break;
  10341. case _util.OPS.nextLineShowText:
  10342. if (!stateManager.state.font) {
  10343. self.ensureStateFont(stateManager.state);
  10344. continue;
  10345. }
  10346. textState.carriageReturn();
  10347. buildTextContentItem({
  10348. chars: args[0],
  10349. extraSpacing: 0
  10350. });
  10351. break;
  10352. case _util.OPS.nextLineSetSpacingShowText:
  10353. if (!stateManager.state.font) {
  10354. self.ensureStateFont(stateManager.state);
  10355. continue;
  10356. }
  10357. textState.wordSpacing = args[0];
  10358. textState.charSpacing = args[1];
  10359. textState.carriageReturn();
  10360. buildTextContentItem({
  10361. chars: args[2],
  10362. extraSpacing: 0
  10363. });
  10364. break;
  10365. case _util.OPS.paintXObject:
  10366. flushTextContentItem();
  10367. if (!xobjs) {
  10368. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  10369. }
  10370. var isValidName = args[0] instanceof _primitives.Name;
  10371. var name = args[0].name;
  10372. if (isValidName && emptyXObjectCache.getByName(name)) {
  10373. break;
  10374. }
  10375. next(new Promise(function (resolveXObject, rejectXObject) {
  10376. if (!isValidName) {
  10377. throw new _util.FormatError("XObject must be referred to by name.");
  10378. }
  10379. let xobj = xobjs.getRaw(name);
  10380. if (xobj instanceof _primitives.Ref) {
  10381. if (emptyXObjectCache.getByRef(xobj)) {
  10382. resolveXObject();
  10383. return;
  10384. }
  10385. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  10386. if (globalImage) {
  10387. resolveXObject();
  10388. return;
  10389. }
  10390. xobj = xref.fetch(xobj);
  10391. }
  10392. if (!(xobj instanceof _base_stream.BaseStream)) {
  10393. throw new _util.FormatError("XObject should be a stream");
  10394. }
  10395. const type = xobj.dict.get("Subtype");
  10396. if (!(type instanceof _primitives.Name)) {
  10397. throw new _util.FormatError("XObject should have a Name subtype");
  10398. }
  10399. if (type.name !== "Form") {
  10400. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10401. resolveXObject();
  10402. return;
  10403. }
  10404. const currentState = stateManager.state.clone();
  10405. const xObjStateManager = new StateManager(currentState);
  10406. const matrix = xobj.dict.getArray("Matrix");
  10407. if (Array.isArray(matrix) && matrix.length === 6) {
  10408. xObjStateManager.transform(matrix);
  10409. }
  10410. enqueueChunk();
  10411. const sinkWrapper = {
  10412. enqueueInvoked: false,
  10413. enqueue(chunk, size) {
  10414. this.enqueueInvoked = true;
  10415. sink.enqueue(chunk, size);
  10416. },
  10417. get desiredSize() {
  10418. return sink.desiredSize;
  10419. },
  10420. get ready() {
  10421. return sink.ready;
  10422. }
  10423. };
  10424. self.getTextContent({
  10425. stream: xobj,
  10426. task,
  10427. resources: xobj.dict.get("Resources") || resources,
  10428. stateManager: xObjStateManager,
  10429. combineTextItems,
  10430. includeMarkedContent,
  10431. sink: sinkWrapper,
  10432. seenStyles,
  10433. viewBox,
  10434. markedContentData
  10435. }).then(function () {
  10436. if (!sinkWrapper.enqueueInvoked) {
  10437. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10438. }
  10439. resolveXObject();
  10440. }, rejectXObject);
  10441. }).catch(function (reason) {
  10442. if (reason instanceof _util.AbortException) {
  10443. return;
  10444. }
  10445. if (self.options.ignoreErrors) {
  10446. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  10447. return;
  10448. }
  10449. throw reason;
  10450. }));
  10451. return;
  10452. case _util.OPS.setGState:
  10453. isValidName = args[0] instanceof _primitives.Name;
  10454. name = args[0].name;
  10455. if (isValidName && emptyGStateCache.getByName(name)) {
  10456. break;
  10457. }
  10458. next(new Promise(function (resolveGState, rejectGState) {
  10459. if (!isValidName) {
  10460. throw new _util.FormatError("GState must be referred to by name.");
  10461. }
  10462. const extGState = resources.get("ExtGState");
  10463. if (!(extGState instanceof _primitives.Dict)) {
  10464. throw new _util.FormatError("ExtGState should be a dictionary.");
  10465. }
  10466. const gState = extGState.get(name);
  10467. if (!(gState instanceof _primitives.Dict)) {
  10468. throw new _util.FormatError("GState should be a dictionary.");
  10469. }
  10470. const gStateFont = gState.get("Font");
  10471. if (!gStateFont) {
  10472. emptyGStateCache.set(name, gState.objId, true);
  10473. resolveGState();
  10474. return;
  10475. }
  10476. flushTextContentItem();
  10477. textState.fontName = null;
  10478. textState.fontSize = gStateFont[1];
  10479. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  10480. }).catch(function (reason) {
  10481. if (reason instanceof _util.AbortException) {
  10482. return;
  10483. }
  10484. if (self.options.ignoreErrors) {
  10485. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  10486. return;
  10487. }
  10488. throw reason;
  10489. }));
  10490. return;
  10491. case _util.OPS.beginMarkedContent:
  10492. flushTextContentItem();
  10493. if (includeMarkedContent) {
  10494. markedContentData.level++;
  10495. textContent.items.push({
  10496. type: "beginMarkedContent",
  10497. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10498. });
  10499. }
  10500. break;
  10501. case _util.OPS.beginMarkedContentProps:
  10502. flushTextContentItem();
  10503. if (includeMarkedContent) {
  10504. markedContentData.level++;
  10505. let mcid = null;
  10506. if (args[1] instanceof _primitives.Dict) {
  10507. mcid = args[1].get("MCID");
  10508. }
  10509. textContent.items.push({
  10510. type: "beginMarkedContentProps",
  10511. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  10512. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10513. });
  10514. }
  10515. break;
  10516. case _util.OPS.endMarkedContent:
  10517. flushTextContentItem();
  10518. if (includeMarkedContent) {
  10519. if (markedContentData.level === 0) {
  10520. break;
  10521. }
  10522. markedContentData.level--;
  10523. textContent.items.push({
  10524. type: "endMarkedContent"
  10525. });
  10526. }
  10527. break;
  10528. }
  10529. if (textContent.items.length >= sink.desiredSize) {
  10530. stop = true;
  10531. break;
  10532. }
  10533. }
  10534. if (stop) {
  10535. next(deferred);
  10536. return;
  10537. }
  10538. flushTextContentItem();
  10539. enqueueChunk();
  10540. resolve();
  10541. }).catch(reason => {
  10542. if (reason instanceof _util.AbortException) {
  10543. return;
  10544. }
  10545. if (this.options.ignoreErrors) {
  10546. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  10547. flushTextContentItem();
  10548. enqueueChunk();
  10549. return;
  10550. }
  10551. throw reason;
  10552. });
  10553. }
  10554. extractDataStructures(dict, baseDict, properties) {
  10555. const xref = this.xref;
  10556. let cidToGidBytes;
  10557. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  10558. if (properties.composite) {
  10559. const cidSystemInfo = dict.get("CIDSystemInfo");
  10560. if (cidSystemInfo instanceof _primitives.Dict) {
  10561. properties.cidSystemInfo = {
  10562. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  10563. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  10564. supplement: cidSystemInfo.get("Supplement")
  10565. };
  10566. }
  10567. try {
  10568. const cidToGidMap = dict.get("CIDToGIDMap");
  10569. if (cidToGidMap instanceof _base_stream.BaseStream) {
  10570. cidToGidBytes = cidToGidMap.getBytes();
  10571. }
  10572. } catch (ex) {
  10573. if (!this.options.ignoreErrors) {
  10574. throw ex;
  10575. }
  10576. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  10577. }
  10578. }
  10579. const differences = [];
  10580. let baseEncodingName = null;
  10581. let encoding;
  10582. if (dict.has("Encoding")) {
  10583. encoding = dict.get("Encoding");
  10584. if (encoding instanceof _primitives.Dict) {
  10585. baseEncodingName = encoding.get("BaseEncoding");
  10586. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  10587. if (encoding.has("Differences")) {
  10588. const diffEncoding = encoding.get("Differences");
  10589. let index = 0;
  10590. for (const entry of diffEncoding) {
  10591. const data = xref.fetchIfRef(entry);
  10592. if (typeof data === "number") {
  10593. index = data;
  10594. } else if (data instanceof _primitives.Name) {
  10595. differences[index++] = data.name;
  10596. } else {
  10597. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  10598. }
  10599. }
  10600. }
  10601. } else if (encoding instanceof _primitives.Name) {
  10602. baseEncodingName = encoding.name;
  10603. } else {
  10604. const msg = "Encoding is not a Name nor a Dict";
  10605. if (!this.options.ignoreErrors) {
  10606. throw new _util.FormatError(msg);
  10607. }
  10608. (0, _util.warn)(msg);
  10609. }
  10610. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  10611. baseEncodingName = null;
  10612. }
  10613. }
  10614. if (baseEncodingName) {
  10615. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10616. } else {
  10617. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  10618. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  10619. encoding = _encodings.StandardEncoding;
  10620. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  10621. encoding = _encodings.WinAnsiEncoding;
  10622. }
  10623. if (isSymbolicFont) {
  10624. encoding = _encodings.MacRomanEncoding;
  10625. if (!properties.file || properties.isInternalFont) {
  10626. if (/Symbol/i.test(properties.name)) {
  10627. encoding = _encodings.SymbolSetEncoding;
  10628. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  10629. encoding = _encodings.ZapfDingbatsEncoding;
  10630. }
  10631. }
  10632. }
  10633. properties.defaultEncoding = encoding;
  10634. }
  10635. properties.differences = differences;
  10636. properties.baseEncodingName = baseEncodingName;
  10637. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  10638. properties.dict = dict;
  10639. return toUnicodePromise.then(readToUnicode => {
  10640. properties.toUnicode = readToUnicode;
  10641. return this.buildToUnicode(properties);
  10642. }).then(builtToUnicode => {
  10643. properties.toUnicode = builtToUnicode;
  10644. if (cidToGidBytes) {
  10645. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  10646. }
  10647. return properties;
  10648. });
  10649. }
  10650. _simpleFontToUnicode(properties, forceGlyphs = false) {
  10651. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  10652. const toUnicode = [];
  10653. const encoding = properties.defaultEncoding.slice();
  10654. const baseEncodingName = properties.baseEncodingName;
  10655. const differences = properties.differences;
  10656. for (const charcode in differences) {
  10657. const glyphName = differences[charcode];
  10658. if (glyphName === ".notdef") {
  10659. continue;
  10660. }
  10661. encoding[charcode] = glyphName;
  10662. }
  10663. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  10664. for (const charcode in encoding) {
  10665. let glyphName = encoding[charcode];
  10666. if (glyphName === "") {
  10667. continue;
  10668. }
  10669. let unicode = glyphsUnicodeMap[glyphName];
  10670. if (unicode !== undefined) {
  10671. toUnicode[charcode] = String.fromCharCode(unicode);
  10672. continue;
  10673. }
  10674. let code = 0;
  10675. switch (glyphName[0]) {
  10676. case "G":
  10677. if (glyphName.length === 3) {
  10678. code = parseInt(glyphName.substring(1), 16);
  10679. }
  10680. break;
  10681. case "g":
  10682. if (glyphName.length === 5) {
  10683. code = parseInt(glyphName.substring(1), 16);
  10684. }
  10685. break;
  10686. case "C":
  10687. case "c":
  10688. if (glyphName.length >= 3 && glyphName.length <= 4) {
  10689. const codeStr = glyphName.substring(1);
  10690. if (forceGlyphs) {
  10691. code = parseInt(codeStr, 16);
  10692. break;
  10693. }
  10694. code = +codeStr;
  10695. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  10696. return this._simpleFontToUnicode(properties, true);
  10697. }
  10698. }
  10699. break;
  10700. case "u":
  10701. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  10702. if (unicode !== -1) {
  10703. code = unicode;
  10704. }
  10705. break;
  10706. }
  10707. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  10708. if (baseEncodingName && code === +charcode) {
  10709. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10710. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  10711. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  10712. continue;
  10713. }
  10714. }
  10715. toUnicode[charcode] = String.fromCodePoint(code);
  10716. }
  10717. }
  10718. return toUnicode;
  10719. }
  10720. async buildToUnicode(properties) {
  10721. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  10722. if (properties.hasIncludedToUnicodeMap) {
  10723. if (!properties.composite && properties.hasEncoding) {
  10724. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  10725. }
  10726. return properties.toUnicode;
  10727. }
  10728. if (!properties.composite) {
  10729. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  10730. }
  10731. 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"))) {
  10732. const {
  10733. registry,
  10734. ordering
  10735. } = properties.cidSystemInfo;
  10736. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  10737. const ucs2CMap = await _cmap.CMapFactory.create({
  10738. encoding: ucs2CMapName,
  10739. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10740. useCMap: null
  10741. });
  10742. const toUnicode = [];
  10743. properties.cMap.forEach(function (charcode, cid) {
  10744. if (cid > 0xffff) {
  10745. throw new _util.FormatError("Max size of CID is 65,535");
  10746. }
  10747. const ucs2 = ucs2CMap.lookup(cid);
  10748. if (ucs2) {
  10749. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  10750. }
  10751. });
  10752. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  10753. }
  10754. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  10755. }
  10756. readToUnicode(cmapObj) {
  10757. if (!cmapObj) {
  10758. return Promise.resolve(null);
  10759. }
  10760. if (cmapObj instanceof _primitives.Name) {
  10761. return _cmap.CMapFactory.create({
  10762. encoding: cmapObj,
  10763. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10764. useCMap: null
  10765. }).then(function (cmap) {
  10766. if (cmap instanceof _cmap.IdentityCMap) {
  10767. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10768. }
  10769. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  10770. });
  10771. } else if (cmapObj instanceof _base_stream.BaseStream) {
  10772. return _cmap.CMapFactory.create({
  10773. encoding: cmapObj,
  10774. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10775. useCMap: null
  10776. }).then(function (cmap) {
  10777. if (cmap instanceof _cmap.IdentityCMap) {
  10778. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10779. }
  10780. const map = new Array(cmap.length);
  10781. cmap.forEach(function (charCode, token) {
  10782. if (typeof token === "number") {
  10783. map[charCode] = String.fromCodePoint(token);
  10784. return;
  10785. }
  10786. const str = [];
  10787. for (let k = 0; k < token.length; k += 2) {
  10788. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10789. if ((w1 & 0xf800) !== 0xd800) {
  10790. str.push(w1);
  10791. continue;
  10792. }
  10793. k += 2;
  10794. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10795. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  10796. }
  10797. map[charCode] = String.fromCodePoint(...str);
  10798. });
  10799. return new _to_unicode_map.ToUnicodeMap(map);
  10800. }, reason => {
  10801. if (reason instanceof _util.AbortException) {
  10802. return null;
  10803. }
  10804. if (this.options.ignoreErrors) {
  10805. this.handler.send("UnsupportedFeature", {
  10806. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  10807. });
  10808. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  10809. return null;
  10810. }
  10811. throw reason;
  10812. });
  10813. }
  10814. return Promise.resolve(null);
  10815. }
  10816. readCidToGidMap(glyphsData, toUnicode) {
  10817. const result = [];
  10818. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  10819. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  10820. const code = j >> 1;
  10821. if (glyphID === 0 && !toUnicode.has(code)) {
  10822. continue;
  10823. }
  10824. result[code] = glyphID;
  10825. }
  10826. return result;
  10827. }
  10828. extractWidths(dict, descriptor, properties) {
  10829. const xref = this.xref;
  10830. let glyphsWidths = [];
  10831. let defaultWidth = 0;
  10832. const glyphsVMetrics = [];
  10833. let defaultVMetrics;
  10834. let i, ii, j, jj, start, code, widths;
  10835. if (properties.composite) {
  10836. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  10837. widths = dict.get("W");
  10838. if (widths) {
  10839. for (i = 0, ii = widths.length; i < ii; i++) {
  10840. start = xref.fetchIfRef(widths[i++]);
  10841. code = xref.fetchIfRef(widths[i]);
  10842. if (Array.isArray(code)) {
  10843. for (j = 0, jj = code.length; j < jj; j++) {
  10844. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  10845. }
  10846. } else {
  10847. const width = xref.fetchIfRef(widths[++i]);
  10848. for (j = start; j <= code; j++) {
  10849. glyphsWidths[j] = width;
  10850. }
  10851. }
  10852. }
  10853. }
  10854. if (properties.vertical) {
  10855. let vmetrics = dict.getArray("DW2") || [880, -1000];
  10856. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  10857. vmetrics = dict.get("W2");
  10858. if (vmetrics) {
  10859. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  10860. start = xref.fetchIfRef(vmetrics[i++]);
  10861. code = xref.fetchIfRef(vmetrics[i]);
  10862. if (Array.isArray(code)) {
  10863. for (j = 0, jj = code.length; j < jj; j++) {
  10864. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  10865. }
  10866. } else {
  10867. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  10868. for (j = start; j <= code; j++) {
  10869. glyphsVMetrics[j] = vmetric;
  10870. }
  10871. }
  10872. }
  10873. }
  10874. }
  10875. } else {
  10876. const firstChar = properties.firstChar;
  10877. widths = dict.get("Widths");
  10878. if (widths) {
  10879. j = firstChar;
  10880. for (i = 0, ii = widths.length; i < ii; i++) {
  10881. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  10882. }
  10883. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  10884. } else {
  10885. const baseFontName = dict.get("BaseFont");
  10886. if (baseFontName instanceof _primitives.Name) {
  10887. const metrics = this.getBaseFontMetrics(baseFontName.name);
  10888. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  10889. defaultWidth = metrics.defaultWidth;
  10890. }
  10891. }
  10892. }
  10893. let isMonospace = true;
  10894. let firstWidth = defaultWidth;
  10895. for (const glyph in glyphsWidths) {
  10896. const glyphWidth = glyphsWidths[glyph];
  10897. if (!glyphWidth) {
  10898. continue;
  10899. }
  10900. if (!firstWidth) {
  10901. firstWidth = glyphWidth;
  10902. continue;
  10903. }
  10904. if (firstWidth !== glyphWidth) {
  10905. isMonospace = false;
  10906. break;
  10907. }
  10908. }
  10909. if (isMonospace) {
  10910. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  10911. }
  10912. properties.defaultWidth = defaultWidth;
  10913. properties.widths = glyphsWidths;
  10914. properties.defaultVMetrics = defaultVMetrics;
  10915. properties.vmetrics = glyphsVMetrics;
  10916. }
  10917. isSerifFont(baseFontName) {
  10918. const fontNameWoStyle = baseFontName.split("-")[0];
  10919. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
  10920. }
  10921. getBaseFontMetrics(name) {
  10922. let defaultWidth = 0;
  10923. let widths = Object.create(null);
  10924. let monospace = false;
  10925. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  10926. let lookupName = stdFontMap[name] || name;
  10927. const Metrics = (0, _metrics.getMetrics)();
  10928. if (!(lookupName in Metrics)) {
  10929. if (this.isSerifFont(name)) {
  10930. lookupName = "Times-Roman";
  10931. } else {
  10932. lookupName = "Helvetica";
  10933. }
  10934. }
  10935. const glyphWidths = Metrics[lookupName];
  10936. if (typeof glyphWidths === "number") {
  10937. defaultWidth = glyphWidths;
  10938. monospace = true;
  10939. } else {
  10940. widths = glyphWidths();
  10941. }
  10942. return {
  10943. defaultWidth,
  10944. monospace,
  10945. widths
  10946. };
  10947. }
  10948. buildCharCodeToWidth(widthsByGlyphName, properties) {
  10949. const widths = Object.create(null);
  10950. const differences = properties.differences;
  10951. const encoding = properties.defaultEncoding;
  10952. for (let charCode = 0; charCode < 256; charCode++) {
  10953. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  10954. widths[charCode] = widthsByGlyphName[differences[charCode]];
  10955. continue;
  10956. }
  10957. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  10958. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  10959. continue;
  10960. }
  10961. }
  10962. return widths;
  10963. }
  10964. preEvaluateFont(dict) {
  10965. const baseDict = dict;
  10966. let type = dict.get("Subtype");
  10967. if (!(type instanceof _primitives.Name)) {
  10968. throw new _util.FormatError("invalid font Subtype");
  10969. }
  10970. let composite = false;
  10971. let hash, toUnicode;
  10972. if (type.name === "Type0") {
  10973. const df = dict.get("DescendantFonts");
  10974. if (!df) {
  10975. throw new _util.FormatError("Descendant fonts are not specified");
  10976. }
  10977. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  10978. if (!(dict instanceof _primitives.Dict)) {
  10979. throw new _util.FormatError("Descendant font is not a dictionary.");
  10980. }
  10981. type = dict.get("Subtype");
  10982. if (!(type instanceof _primitives.Name)) {
  10983. throw new _util.FormatError("invalid font Subtype");
  10984. }
  10985. composite = true;
  10986. }
  10987. const firstChar = dict.get("FirstChar") || 0,
  10988. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  10989. const descriptor = dict.get("FontDescriptor");
  10990. if (descriptor) {
  10991. hash = new _murmurhash.MurmurHash3_64();
  10992. const encoding = baseDict.getRaw("Encoding");
  10993. if (encoding instanceof _primitives.Name) {
  10994. hash.update(encoding.name);
  10995. } else if (encoding instanceof _primitives.Ref) {
  10996. hash.update(encoding.toString());
  10997. } else if (encoding instanceof _primitives.Dict) {
  10998. for (const entry of encoding.getRawValues()) {
  10999. if (entry instanceof _primitives.Name) {
  11000. hash.update(entry.name);
  11001. } else if (entry instanceof _primitives.Ref) {
  11002. hash.update(entry.toString());
  11003. } else if (Array.isArray(entry)) {
  11004. const diffLength = entry.length,
  11005. diffBuf = new Array(diffLength);
  11006. for (let j = 0; j < diffLength; j++) {
  11007. const diffEntry = entry[j];
  11008. if (diffEntry instanceof _primitives.Name) {
  11009. diffBuf[j] = diffEntry.name;
  11010. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  11011. diffBuf[j] = diffEntry.toString();
  11012. }
  11013. }
  11014. hash.update(diffBuf.join());
  11015. }
  11016. }
  11017. }
  11018. hash.update(`${firstChar}-${lastChar}`);
  11019. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  11020. if (toUnicode instanceof _base_stream.BaseStream) {
  11021. const stream = toUnicode.str || toUnicode;
  11022. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  11023. hash.update(uint8array);
  11024. } else if (toUnicode instanceof _primitives.Name) {
  11025. hash.update(toUnicode.name);
  11026. }
  11027. const widths = dict.get("Widths") || baseDict.get("Widths");
  11028. if (Array.isArray(widths)) {
  11029. const widthsBuf = [];
  11030. for (const entry of widths) {
  11031. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  11032. widthsBuf.push(entry.toString());
  11033. }
  11034. }
  11035. hash.update(widthsBuf.join());
  11036. }
  11037. if (composite) {
  11038. hash.update("compositeFont");
  11039. const compositeWidths = dict.get("W") || baseDict.get("W");
  11040. if (Array.isArray(compositeWidths)) {
  11041. const widthsBuf = [];
  11042. for (const entry of compositeWidths) {
  11043. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  11044. widthsBuf.push(entry.toString());
  11045. } else if (Array.isArray(entry)) {
  11046. const subWidthsBuf = [];
  11047. for (const element of entry) {
  11048. if (typeof element === "number" || element instanceof _primitives.Ref) {
  11049. subWidthsBuf.push(element.toString());
  11050. }
  11051. }
  11052. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  11053. }
  11054. }
  11055. hash.update(widthsBuf.join());
  11056. }
  11057. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  11058. if (cidToGidMap instanceof _primitives.Name) {
  11059. hash.update(cidToGidMap.name);
  11060. } else if (cidToGidMap instanceof _primitives.Ref) {
  11061. hash.update(cidToGidMap.toString());
  11062. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  11063. hash.update(cidToGidMap.peekBytes());
  11064. }
  11065. }
  11066. }
  11067. return {
  11068. descriptor,
  11069. dict,
  11070. baseDict,
  11071. composite,
  11072. type: type.name,
  11073. firstChar,
  11074. lastChar,
  11075. toUnicode,
  11076. hash: hash ? hash.hexdigest() : ""
  11077. };
  11078. }
  11079. async translateFont({
  11080. descriptor,
  11081. dict,
  11082. baseDict,
  11083. composite,
  11084. type,
  11085. firstChar,
  11086. lastChar,
  11087. toUnicode,
  11088. cssFontInfo
  11089. }) {
  11090. const isType3Font = type === "Type3";
  11091. let properties;
  11092. if (!descriptor) {
  11093. if (isType3Font) {
  11094. descriptor = new _primitives.Dict(null);
  11095. descriptor.set("FontName", _primitives.Name.get(type));
  11096. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  11097. } else {
  11098. let baseFontName = dict.get("BaseFont");
  11099. if (!(baseFontName instanceof _primitives.Name)) {
  11100. throw new _util.FormatError("Base font is not specified");
  11101. }
  11102. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  11103. const metrics = this.getBaseFontMetrics(baseFontName);
  11104. const fontNameWoStyle = baseFontName.split("-")[0];
  11105. 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);
  11106. properties = {
  11107. type,
  11108. name: baseFontName,
  11109. loadedName: baseDict.loadedName,
  11110. widths: metrics.widths,
  11111. defaultWidth: metrics.defaultWidth,
  11112. isSimulatedFlags: true,
  11113. flags,
  11114. firstChar,
  11115. lastChar,
  11116. toUnicode,
  11117. xHeight: 0,
  11118. capHeight: 0,
  11119. italicAngle: 0,
  11120. isType3Font
  11121. };
  11122. const widths = dict.get("Widths");
  11123. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  11124. let file = null;
  11125. if (standardFontName) {
  11126. properties.isStandardFont = true;
  11127. file = await this.fetchStandardFontData(standardFontName);
  11128. properties.isInternalFont = !!file;
  11129. }
  11130. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  11131. if (widths) {
  11132. const glyphWidths = [];
  11133. let j = firstChar;
  11134. for (const width of widths) {
  11135. glyphWidths[j++] = this.xref.fetchIfRef(width);
  11136. }
  11137. newProperties.widths = glyphWidths;
  11138. } else {
  11139. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  11140. }
  11141. return new _fonts.Font(baseFontName, file, newProperties);
  11142. });
  11143. }
  11144. }
  11145. let fontName = descriptor.get("FontName");
  11146. let baseFont = dict.get("BaseFont");
  11147. if (typeof fontName === "string") {
  11148. fontName = _primitives.Name.get(fontName);
  11149. }
  11150. if (typeof baseFont === "string") {
  11151. baseFont = _primitives.Name.get(baseFont);
  11152. }
  11153. if (!isType3Font) {
  11154. const fontNameStr = fontName && fontName.name;
  11155. const baseFontStr = baseFont && baseFont.name;
  11156. if (fontNameStr !== baseFontStr) {
  11157. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  11158. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  11159. fontName = baseFont;
  11160. }
  11161. }
  11162. }
  11163. fontName = fontName || baseFont;
  11164. if (!(fontName instanceof _primitives.Name)) {
  11165. throw new _util.FormatError("invalid font name");
  11166. }
  11167. let fontFile, subtype, length1, length2, length3;
  11168. try {
  11169. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  11170. } catch (ex) {
  11171. if (!this.options.ignoreErrors) {
  11172. throw ex;
  11173. }
  11174. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  11175. fontFile = new _stream.NullStream();
  11176. }
  11177. let isStandardFont = false;
  11178. let isInternalFont = false;
  11179. let glyphScaleFactors = null;
  11180. if (fontFile) {
  11181. if (fontFile.dict) {
  11182. const subtypeEntry = fontFile.dict.get("Subtype");
  11183. if (subtypeEntry instanceof _primitives.Name) {
  11184. subtype = subtypeEntry.name;
  11185. }
  11186. length1 = fontFile.dict.get("Length1");
  11187. length2 = fontFile.dict.get("Length2");
  11188. length3 = fontFile.dict.get("Length3");
  11189. }
  11190. } else if (cssFontInfo) {
  11191. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  11192. if (standardFontName) {
  11193. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  11194. cssFontInfo.metrics = standardFontName.metrics || null;
  11195. glyphScaleFactors = standardFontName.factors || null;
  11196. fontFile = await this.fetchStandardFontData(standardFontName.name);
  11197. isInternalFont = !!fontFile;
  11198. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  11199. composite = true;
  11200. }
  11201. } else if (!isType3Font) {
  11202. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  11203. if (standardFontName) {
  11204. isStandardFont = true;
  11205. fontFile = await this.fetchStandardFontData(standardFontName);
  11206. isInternalFont = !!fontFile;
  11207. }
  11208. }
  11209. properties = {
  11210. type,
  11211. name: fontName.name,
  11212. subtype,
  11213. file: fontFile,
  11214. length1,
  11215. length2,
  11216. length3,
  11217. isStandardFont,
  11218. isInternalFont,
  11219. loadedName: baseDict.loadedName,
  11220. composite,
  11221. fixedPitch: false,
  11222. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  11223. firstChar,
  11224. lastChar,
  11225. toUnicode,
  11226. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  11227. ascent: descriptor.get("Ascent"),
  11228. descent: descriptor.get("Descent"),
  11229. xHeight: descriptor.get("XHeight") || 0,
  11230. capHeight: descriptor.get("CapHeight") || 0,
  11231. flags: descriptor.get("Flags"),
  11232. italicAngle: descriptor.get("ItalicAngle") || 0,
  11233. isType3Font,
  11234. cssFontInfo,
  11235. scaleFactors: glyphScaleFactors
  11236. };
  11237. if (composite) {
  11238. const cidEncoding = baseDict.get("Encoding");
  11239. if (cidEncoding instanceof _primitives.Name) {
  11240. properties.cidEncoding = cidEncoding.name;
  11241. }
  11242. const cMap = await _cmap.CMapFactory.create({
  11243. encoding: cidEncoding,
  11244. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  11245. useCMap: null
  11246. });
  11247. properties.cMap = cMap;
  11248. properties.vertical = properties.cMap.vertical;
  11249. }
  11250. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  11251. this.extractWidths(dict, descriptor, newProperties);
  11252. return new _fonts.Font(fontName.name, fontFile, newProperties);
  11253. });
  11254. }
  11255. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  11256. function buildPath(fontChar) {
  11257. const glyphName = `${font.loadedName}_path_${fontChar}`;
  11258. try {
  11259. if (font.renderer.hasBuiltPath(fontChar)) {
  11260. return;
  11261. }
  11262. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  11263. } catch (reason) {
  11264. if (evaluatorOptions.ignoreErrors) {
  11265. handler.send("UnsupportedFeature", {
  11266. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  11267. });
  11268. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  11269. return;
  11270. }
  11271. throw reason;
  11272. }
  11273. }
  11274. for (const glyph of glyphs) {
  11275. buildPath(glyph.fontChar);
  11276. const accent = glyph.accent;
  11277. if (accent && accent.fontChar) {
  11278. buildPath(accent.fontChar);
  11279. }
  11280. }
  11281. }
  11282. static get fallbackFontDict() {
  11283. const dict = new _primitives.Dict();
  11284. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  11285. dict.set("Type", _primitives.Name.get("FallbackType"));
  11286. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  11287. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  11288. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  11289. }
  11290. }
  11291. exports.PartialEvaluator = PartialEvaluator;
  11292. class TranslatedFont {
  11293. constructor({
  11294. loadedName,
  11295. font,
  11296. dict,
  11297. evaluatorOptions
  11298. }) {
  11299. this.loadedName = loadedName;
  11300. this.font = font;
  11301. this.dict = dict;
  11302. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  11303. this.type3Loaded = null;
  11304. this.type3Dependencies = font.isType3Font ? new Set() : null;
  11305. this.sent = false;
  11306. }
  11307. send(handler) {
  11308. if (this.sent) {
  11309. return;
  11310. }
  11311. this.sent = true;
  11312. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  11313. }
  11314. fallback(handler) {
  11315. if (!this.font.data) {
  11316. return;
  11317. }
  11318. this.font.disableFontFace = true;
  11319. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  11320. }
  11321. loadType3Data(evaluator, resources, task) {
  11322. if (this.type3Loaded) {
  11323. return this.type3Loaded;
  11324. }
  11325. if (!this.font.isType3Font) {
  11326. throw new Error("Must be a Type3 font.");
  11327. }
  11328. const type3Evaluator = evaluator.clone({
  11329. ignoreErrors: false
  11330. });
  11331. type3Evaluator.parsingType3Font = true;
  11332. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  11333. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  11334. type3FontRefs.put(this.dict.objId);
  11335. }
  11336. type3Evaluator.type3FontRefs = type3FontRefs;
  11337. const translatedFont = this.font,
  11338. type3Dependencies = this.type3Dependencies;
  11339. let loadCharProcsPromise = Promise.resolve();
  11340. const charProcs = this.dict.get("CharProcs");
  11341. const fontResources = this.dict.get("Resources") || resources;
  11342. const charProcOperatorList = Object.create(null);
  11343. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  11344. width = fontBBox[2] - fontBBox[0],
  11345. height = fontBBox[3] - fontBBox[1];
  11346. const fontBBoxSize = Math.hypot(width, height);
  11347. for (const key of charProcs.getKeys()) {
  11348. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  11349. const glyphStream = charProcs.get(key);
  11350. const operatorList = new _operator_list.OperatorList();
  11351. return type3Evaluator.getOperatorList({
  11352. stream: glyphStream,
  11353. task,
  11354. resources: fontResources,
  11355. operatorList
  11356. }).then(() => {
  11357. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  11358. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  11359. }
  11360. charProcOperatorList[key] = operatorList.getIR();
  11361. for (const dependency of operatorList.dependencies) {
  11362. type3Dependencies.add(dependency);
  11363. }
  11364. }).catch(function (reason) {
  11365. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  11366. const dummyOperatorList = new _operator_list.OperatorList();
  11367. charProcOperatorList[key] = dummyOperatorList.getIR();
  11368. });
  11369. });
  11370. }
  11371. this.type3Loaded = loadCharProcsPromise.then(() => {
  11372. translatedFont.charProcOperatorList = charProcOperatorList;
  11373. if (this._bbox) {
  11374. translatedFont.isCharBBox = true;
  11375. translatedFont.bbox = this._bbox;
  11376. }
  11377. });
  11378. return this.type3Loaded;
  11379. }
  11380. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  11381. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  11382. width = charBBox[2] - charBBox[0],
  11383. height = charBBox[3] - charBBox[1];
  11384. const charBBoxSize = Math.hypot(width, height);
  11385. if (width === 0 || height === 0) {
  11386. operatorList.fnArray.splice(0, 1);
  11387. operatorList.argsArray.splice(0, 1);
  11388. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  11389. if (!this._bbox) {
  11390. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  11391. }
  11392. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  11393. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  11394. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  11395. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  11396. }
  11397. let i = 0,
  11398. ii = operatorList.length;
  11399. while (i < ii) {
  11400. switch (operatorList.fnArray[i]) {
  11401. case _util.OPS.setCharWidthAndBounds:
  11402. break;
  11403. case _util.OPS.setStrokeColorSpace:
  11404. case _util.OPS.setFillColorSpace:
  11405. case _util.OPS.setStrokeColor:
  11406. case _util.OPS.setStrokeColorN:
  11407. case _util.OPS.setFillColor:
  11408. case _util.OPS.setFillColorN:
  11409. case _util.OPS.setStrokeGray:
  11410. case _util.OPS.setFillGray:
  11411. case _util.OPS.setStrokeRGBColor:
  11412. case _util.OPS.setFillRGBColor:
  11413. case _util.OPS.setStrokeCMYKColor:
  11414. case _util.OPS.setFillCMYKColor:
  11415. case _util.OPS.shadingFill:
  11416. case _util.OPS.setRenderingIntent:
  11417. operatorList.fnArray.splice(i, 1);
  11418. operatorList.argsArray.splice(i, 1);
  11419. ii--;
  11420. continue;
  11421. case _util.OPS.setGState:
  11422. const [gStateObj] = operatorList.argsArray[i];
  11423. let j = 0,
  11424. jj = gStateObj.length;
  11425. while (j < jj) {
  11426. const [gStateKey] = gStateObj[j];
  11427. switch (gStateKey) {
  11428. case "TR":
  11429. case "TR2":
  11430. case "HT":
  11431. case "BG":
  11432. case "BG2":
  11433. case "UCR":
  11434. case "UCR2":
  11435. gStateObj.splice(j, 1);
  11436. jj--;
  11437. continue;
  11438. }
  11439. j++;
  11440. }
  11441. break;
  11442. }
  11443. i++;
  11444. }
  11445. }
  11446. }
  11447. class StateManager {
  11448. constructor(initialState = new EvalState()) {
  11449. this.state = initialState;
  11450. this.stateStack = [];
  11451. }
  11452. save() {
  11453. const old = this.state;
  11454. this.stateStack.push(this.state);
  11455. this.state = old.clone();
  11456. }
  11457. restore() {
  11458. const prev = this.stateStack.pop();
  11459. if (prev) {
  11460. this.state = prev;
  11461. }
  11462. }
  11463. transform(args) {
  11464. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  11465. }
  11466. }
  11467. class TextState {
  11468. constructor() {
  11469. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11470. this.fontName = null;
  11471. this.fontSize = 0;
  11472. this.loadedName = null;
  11473. this.font = null;
  11474. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  11475. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  11476. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  11477. this.charSpacing = 0;
  11478. this.wordSpacing = 0;
  11479. this.leading = 0;
  11480. this.textHScale = 1;
  11481. this.textRise = 0;
  11482. }
  11483. setTextMatrix(a, b, c, d, e, f) {
  11484. const m = this.textMatrix;
  11485. m[0] = a;
  11486. m[1] = b;
  11487. m[2] = c;
  11488. m[3] = d;
  11489. m[4] = e;
  11490. m[5] = f;
  11491. }
  11492. setTextLineMatrix(a, b, c, d, e, f) {
  11493. const m = this.textLineMatrix;
  11494. m[0] = a;
  11495. m[1] = b;
  11496. m[2] = c;
  11497. m[3] = d;
  11498. m[4] = e;
  11499. m[5] = f;
  11500. }
  11501. translateTextMatrix(x, y) {
  11502. const m = this.textMatrix;
  11503. m[4] = m[0] * x + m[2] * y + m[4];
  11504. m[5] = m[1] * x + m[3] * y + m[5];
  11505. }
  11506. translateTextLineMatrix(x, y) {
  11507. const m = this.textLineMatrix;
  11508. m[4] = m[0] * x + m[2] * y + m[4];
  11509. m[5] = m[1] * x + m[3] * y + m[5];
  11510. }
  11511. carriageReturn() {
  11512. this.translateTextLineMatrix(0, -this.leading);
  11513. this.textMatrix = this.textLineMatrix.slice();
  11514. }
  11515. clone() {
  11516. const clone = Object.create(this);
  11517. clone.textMatrix = this.textMatrix.slice();
  11518. clone.textLineMatrix = this.textLineMatrix.slice();
  11519. clone.fontMatrix = this.fontMatrix.slice();
  11520. return clone;
  11521. }
  11522. }
  11523. class EvalState {
  11524. constructor() {
  11525. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11526. this.font = null;
  11527. this.textRenderingMode = _util.TextRenderingMode.FILL;
  11528. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  11529. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  11530. }
  11531. clone() {
  11532. return Object.create(this);
  11533. }
  11534. }
  11535. class EvaluatorPreprocessor {
  11536. static get opMap() {
  11537. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  11538. t.w = {
  11539. id: _util.OPS.setLineWidth,
  11540. numArgs: 1,
  11541. variableArgs: false
  11542. };
  11543. t.J = {
  11544. id: _util.OPS.setLineCap,
  11545. numArgs: 1,
  11546. variableArgs: false
  11547. };
  11548. t.j = {
  11549. id: _util.OPS.setLineJoin,
  11550. numArgs: 1,
  11551. variableArgs: false
  11552. };
  11553. t.M = {
  11554. id: _util.OPS.setMiterLimit,
  11555. numArgs: 1,
  11556. variableArgs: false
  11557. };
  11558. t.d = {
  11559. id: _util.OPS.setDash,
  11560. numArgs: 2,
  11561. variableArgs: false
  11562. };
  11563. t.ri = {
  11564. id: _util.OPS.setRenderingIntent,
  11565. numArgs: 1,
  11566. variableArgs: false
  11567. };
  11568. t.i = {
  11569. id: _util.OPS.setFlatness,
  11570. numArgs: 1,
  11571. variableArgs: false
  11572. };
  11573. t.gs = {
  11574. id: _util.OPS.setGState,
  11575. numArgs: 1,
  11576. variableArgs: false
  11577. };
  11578. t.q = {
  11579. id: _util.OPS.save,
  11580. numArgs: 0,
  11581. variableArgs: false
  11582. };
  11583. t.Q = {
  11584. id: _util.OPS.restore,
  11585. numArgs: 0,
  11586. variableArgs: false
  11587. };
  11588. t.cm = {
  11589. id: _util.OPS.transform,
  11590. numArgs: 6,
  11591. variableArgs: false
  11592. };
  11593. t.m = {
  11594. id: _util.OPS.moveTo,
  11595. numArgs: 2,
  11596. variableArgs: false
  11597. };
  11598. t.l = {
  11599. id: _util.OPS.lineTo,
  11600. numArgs: 2,
  11601. variableArgs: false
  11602. };
  11603. t.c = {
  11604. id: _util.OPS.curveTo,
  11605. numArgs: 6,
  11606. variableArgs: false
  11607. };
  11608. t.v = {
  11609. id: _util.OPS.curveTo2,
  11610. numArgs: 4,
  11611. variableArgs: false
  11612. };
  11613. t.y = {
  11614. id: _util.OPS.curveTo3,
  11615. numArgs: 4,
  11616. variableArgs: false
  11617. };
  11618. t.h = {
  11619. id: _util.OPS.closePath,
  11620. numArgs: 0,
  11621. variableArgs: false
  11622. };
  11623. t.re = {
  11624. id: _util.OPS.rectangle,
  11625. numArgs: 4,
  11626. variableArgs: false
  11627. };
  11628. t.S = {
  11629. id: _util.OPS.stroke,
  11630. numArgs: 0,
  11631. variableArgs: false
  11632. };
  11633. t.s = {
  11634. id: _util.OPS.closeStroke,
  11635. numArgs: 0,
  11636. variableArgs: false
  11637. };
  11638. t.f = {
  11639. id: _util.OPS.fill,
  11640. numArgs: 0,
  11641. variableArgs: false
  11642. };
  11643. t.F = {
  11644. id: _util.OPS.fill,
  11645. numArgs: 0,
  11646. variableArgs: false
  11647. };
  11648. t["f*"] = {
  11649. id: _util.OPS.eoFill,
  11650. numArgs: 0,
  11651. variableArgs: false
  11652. };
  11653. t.B = {
  11654. id: _util.OPS.fillStroke,
  11655. numArgs: 0,
  11656. variableArgs: false
  11657. };
  11658. t["B*"] = {
  11659. id: _util.OPS.eoFillStroke,
  11660. numArgs: 0,
  11661. variableArgs: false
  11662. };
  11663. t.b = {
  11664. id: _util.OPS.closeFillStroke,
  11665. numArgs: 0,
  11666. variableArgs: false
  11667. };
  11668. t["b*"] = {
  11669. id: _util.OPS.closeEOFillStroke,
  11670. numArgs: 0,
  11671. variableArgs: false
  11672. };
  11673. t.n = {
  11674. id: _util.OPS.endPath,
  11675. numArgs: 0,
  11676. variableArgs: false
  11677. };
  11678. t.W = {
  11679. id: _util.OPS.clip,
  11680. numArgs: 0,
  11681. variableArgs: false
  11682. };
  11683. t["W*"] = {
  11684. id: _util.OPS.eoClip,
  11685. numArgs: 0,
  11686. variableArgs: false
  11687. };
  11688. t.BT = {
  11689. id: _util.OPS.beginText,
  11690. numArgs: 0,
  11691. variableArgs: false
  11692. };
  11693. t.ET = {
  11694. id: _util.OPS.endText,
  11695. numArgs: 0,
  11696. variableArgs: false
  11697. };
  11698. t.Tc = {
  11699. id: _util.OPS.setCharSpacing,
  11700. numArgs: 1,
  11701. variableArgs: false
  11702. };
  11703. t.Tw = {
  11704. id: _util.OPS.setWordSpacing,
  11705. numArgs: 1,
  11706. variableArgs: false
  11707. };
  11708. t.Tz = {
  11709. id: _util.OPS.setHScale,
  11710. numArgs: 1,
  11711. variableArgs: false
  11712. };
  11713. t.TL = {
  11714. id: _util.OPS.setLeading,
  11715. numArgs: 1,
  11716. variableArgs: false
  11717. };
  11718. t.Tf = {
  11719. id: _util.OPS.setFont,
  11720. numArgs: 2,
  11721. variableArgs: false
  11722. };
  11723. t.Tr = {
  11724. id: _util.OPS.setTextRenderingMode,
  11725. numArgs: 1,
  11726. variableArgs: false
  11727. };
  11728. t.Ts = {
  11729. id: _util.OPS.setTextRise,
  11730. numArgs: 1,
  11731. variableArgs: false
  11732. };
  11733. t.Td = {
  11734. id: _util.OPS.moveText,
  11735. numArgs: 2,
  11736. variableArgs: false
  11737. };
  11738. t.TD = {
  11739. id: _util.OPS.setLeadingMoveText,
  11740. numArgs: 2,
  11741. variableArgs: false
  11742. };
  11743. t.Tm = {
  11744. id: _util.OPS.setTextMatrix,
  11745. numArgs: 6,
  11746. variableArgs: false
  11747. };
  11748. t["T*"] = {
  11749. id: _util.OPS.nextLine,
  11750. numArgs: 0,
  11751. variableArgs: false
  11752. };
  11753. t.Tj = {
  11754. id: _util.OPS.showText,
  11755. numArgs: 1,
  11756. variableArgs: false
  11757. };
  11758. t.TJ = {
  11759. id: _util.OPS.showSpacedText,
  11760. numArgs: 1,
  11761. variableArgs: false
  11762. };
  11763. t["'"] = {
  11764. id: _util.OPS.nextLineShowText,
  11765. numArgs: 1,
  11766. variableArgs: false
  11767. };
  11768. t['"'] = {
  11769. id: _util.OPS.nextLineSetSpacingShowText,
  11770. numArgs: 3,
  11771. variableArgs: false
  11772. };
  11773. t.d0 = {
  11774. id: _util.OPS.setCharWidth,
  11775. numArgs: 2,
  11776. variableArgs: false
  11777. };
  11778. t.d1 = {
  11779. id: _util.OPS.setCharWidthAndBounds,
  11780. numArgs: 6,
  11781. variableArgs: false
  11782. };
  11783. t.CS = {
  11784. id: _util.OPS.setStrokeColorSpace,
  11785. numArgs: 1,
  11786. variableArgs: false
  11787. };
  11788. t.cs = {
  11789. id: _util.OPS.setFillColorSpace,
  11790. numArgs: 1,
  11791. variableArgs: false
  11792. };
  11793. t.SC = {
  11794. id: _util.OPS.setStrokeColor,
  11795. numArgs: 4,
  11796. variableArgs: true
  11797. };
  11798. t.SCN = {
  11799. id: _util.OPS.setStrokeColorN,
  11800. numArgs: 33,
  11801. variableArgs: true
  11802. };
  11803. t.sc = {
  11804. id: _util.OPS.setFillColor,
  11805. numArgs: 4,
  11806. variableArgs: true
  11807. };
  11808. t.scn = {
  11809. id: _util.OPS.setFillColorN,
  11810. numArgs: 33,
  11811. variableArgs: true
  11812. };
  11813. t.G = {
  11814. id: _util.OPS.setStrokeGray,
  11815. numArgs: 1,
  11816. variableArgs: false
  11817. };
  11818. t.g = {
  11819. id: _util.OPS.setFillGray,
  11820. numArgs: 1,
  11821. variableArgs: false
  11822. };
  11823. t.RG = {
  11824. id: _util.OPS.setStrokeRGBColor,
  11825. numArgs: 3,
  11826. variableArgs: false
  11827. };
  11828. t.rg = {
  11829. id: _util.OPS.setFillRGBColor,
  11830. numArgs: 3,
  11831. variableArgs: false
  11832. };
  11833. t.K = {
  11834. id: _util.OPS.setStrokeCMYKColor,
  11835. numArgs: 4,
  11836. variableArgs: false
  11837. };
  11838. t.k = {
  11839. id: _util.OPS.setFillCMYKColor,
  11840. numArgs: 4,
  11841. variableArgs: false
  11842. };
  11843. t.sh = {
  11844. id: _util.OPS.shadingFill,
  11845. numArgs: 1,
  11846. variableArgs: false
  11847. };
  11848. t.BI = {
  11849. id: _util.OPS.beginInlineImage,
  11850. numArgs: 0,
  11851. variableArgs: false
  11852. };
  11853. t.ID = {
  11854. id: _util.OPS.beginImageData,
  11855. numArgs: 0,
  11856. variableArgs: false
  11857. };
  11858. t.EI = {
  11859. id: _util.OPS.endInlineImage,
  11860. numArgs: 1,
  11861. variableArgs: false
  11862. };
  11863. t.Do = {
  11864. id: _util.OPS.paintXObject,
  11865. numArgs: 1,
  11866. variableArgs: false
  11867. };
  11868. t.MP = {
  11869. id: _util.OPS.markPoint,
  11870. numArgs: 1,
  11871. variableArgs: false
  11872. };
  11873. t.DP = {
  11874. id: _util.OPS.markPointProps,
  11875. numArgs: 2,
  11876. variableArgs: false
  11877. };
  11878. t.BMC = {
  11879. id: _util.OPS.beginMarkedContent,
  11880. numArgs: 1,
  11881. variableArgs: false
  11882. };
  11883. t.BDC = {
  11884. id: _util.OPS.beginMarkedContentProps,
  11885. numArgs: 2,
  11886. variableArgs: false
  11887. };
  11888. t.EMC = {
  11889. id: _util.OPS.endMarkedContent,
  11890. numArgs: 0,
  11891. variableArgs: false
  11892. };
  11893. t.BX = {
  11894. id: _util.OPS.beginCompat,
  11895. numArgs: 0,
  11896. variableArgs: false
  11897. };
  11898. t.EX = {
  11899. id: _util.OPS.endCompat,
  11900. numArgs: 0,
  11901. variableArgs: false
  11902. };
  11903. t.BM = null;
  11904. t.BD = null;
  11905. t.true = null;
  11906. t.fa = null;
  11907. t.fal = null;
  11908. t.fals = null;
  11909. t.false = null;
  11910. t.nu = null;
  11911. t.nul = null;
  11912. t.null = null;
  11913. });
  11914. return (0, _util.shadow)(this, "opMap", getOPMap());
  11915. }
  11916. static get MAX_INVALID_PATH_OPS() {
  11917. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  11918. }
  11919. constructor(stream, xref, stateManager = new StateManager()) {
  11920. this.parser = new _parser.Parser({
  11921. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  11922. xref
  11923. });
  11924. this.stateManager = stateManager;
  11925. this.nonProcessedArgs = [];
  11926. this._isPathOp = false;
  11927. this._numInvalidPathOPS = 0;
  11928. }
  11929. get savedStatesDepth() {
  11930. return this.stateManager.stateStack.length;
  11931. }
  11932. read(operation) {
  11933. let args = operation.args;
  11934. while (true) {
  11935. const obj = this.parser.getObj();
  11936. if (obj instanceof _primitives.Cmd) {
  11937. const cmd = obj.cmd;
  11938. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  11939. if (!opSpec) {
  11940. (0, _util.warn)(`Unknown command "${cmd}".`);
  11941. continue;
  11942. }
  11943. const fn = opSpec.id;
  11944. const numArgs = opSpec.numArgs;
  11945. let argsLength = args !== null ? args.length : 0;
  11946. if (!this._isPathOp) {
  11947. this._numInvalidPathOPS = 0;
  11948. }
  11949. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  11950. if (!opSpec.variableArgs) {
  11951. if (argsLength !== numArgs) {
  11952. const nonProcessedArgs = this.nonProcessedArgs;
  11953. while (argsLength > numArgs) {
  11954. nonProcessedArgs.push(args.shift());
  11955. argsLength--;
  11956. }
  11957. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  11958. if (args === null) {
  11959. args = [];
  11960. }
  11961. args.unshift(nonProcessedArgs.pop());
  11962. argsLength++;
  11963. }
  11964. }
  11965. if (argsLength < numArgs) {
  11966. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  11967. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  11968. throw new _util.FormatError(`Invalid ${partialMsg}`);
  11969. }
  11970. (0, _util.warn)(`Skipping ${partialMsg}`);
  11971. if (args !== null) {
  11972. args.length = 0;
  11973. }
  11974. continue;
  11975. }
  11976. } else if (argsLength > numArgs) {
  11977. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  11978. }
  11979. this.preprocessCommand(fn, args);
  11980. operation.fn = fn;
  11981. operation.args = args;
  11982. return true;
  11983. }
  11984. if (obj === _primitives.EOF) {
  11985. return false;
  11986. }
  11987. if (obj !== null) {
  11988. if (args === null) {
  11989. args = [];
  11990. }
  11991. args.push(obj);
  11992. if (args.length > 33) {
  11993. throw new _util.FormatError("Too many arguments");
  11994. }
  11995. }
  11996. }
  11997. }
  11998. preprocessCommand(fn, args) {
  11999. switch (fn | 0) {
  12000. case _util.OPS.save:
  12001. this.stateManager.save();
  12002. break;
  12003. case _util.OPS.restore:
  12004. this.stateManager.restore();
  12005. break;
  12006. case _util.OPS.transform:
  12007. this.stateManager.transform(args);
  12008. break;
  12009. }
  12010. }
  12011. }
  12012. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  12013. /***/ }),
  12014. /* 14 */
  12015. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12016. Object.defineProperty(exports, "__esModule", ({
  12017. value: true
  12018. }));
  12019. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  12020. var _util = __w_pdfjs_require__(2);
  12021. var _primitives = __w_pdfjs_require__(3);
  12022. var _base_stream = __w_pdfjs_require__(5);
  12023. var _parser = __w_pdfjs_require__(15);
  12024. var _core_utils = __w_pdfjs_require__(4);
  12025. var _stream = __w_pdfjs_require__(8);
  12026. 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"];
  12027. const MAX_MAP_RANGE = 2 ** 24 - 1;
  12028. class CMap {
  12029. constructor(builtInCMap = false) {
  12030. this.codespaceRanges = [[], [], [], []];
  12031. this.numCodespaceRanges = 0;
  12032. this._map = [];
  12033. this.name = "";
  12034. this.vertical = false;
  12035. this.useCMap = null;
  12036. this.builtInCMap = builtInCMap;
  12037. }
  12038. addCodespaceRange(n, low, high) {
  12039. this.codespaceRanges[n - 1].push(low, high);
  12040. this.numCodespaceRanges++;
  12041. }
  12042. mapCidRange(low, high, dstLow) {
  12043. if (high - low > MAX_MAP_RANGE) {
  12044. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  12045. }
  12046. while (low <= high) {
  12047. this._map[low++] = dstLow++;
  12048. }
  12049. }
  12050. mapBfRange(low, high, dstLow) {
  12051. if (high - low > MAX_MAP_RANGE) {
  12052. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  12053. }
  12054. const lastByte = dstLow.length - 1;
  12055. while (low <= high) {
  12056. this._map[low++] = dstLow;
  12057. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  12058. if (nextCharCode > 0xff) {
  12059. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  12060. continue;
  12061. }
  12062. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  12063. }
  12064. }
  12065. mapBfRangeToArray(low, high, array) {
  12066. if (high - low > MAX_MAP_RANGE) {
  12067. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  12068. }
  12069. const ii = array.length;
  12070. let i = 0;
  12071. while (low <= high && i < ii) {
  12072. this._map[low] = array[i++];
  12073. ++low;
  12074. }
  12075. }
  12076. mapOne(src, dst) {
  12077. this._map[src] = dst;
  12078. }
  12079. lookup(code) {
  12080. return this._map[code];
  12081. }
  12082. contains(code) {
  12083. return this._map[code] !== undefined;
  12084. }
  12085. forEach(callback) {
  12086. const map = this._map;
  12087. const length = map.length;
  12088. if (length <= 0x10000) {
  12089. for (let i = 0; i < length; i++) {
  12090. if (map[i] !== undefined) {
  12091. callback(i, map[i]);
  12092. }
  12093. }
  12094. } else {
  12095. for (const i in map) {
  12096. callback(i, map[i]);
  12097. }
  12098. }
  12099. }
  12100. charCodeOf(value) {
  12101. const map = this._map;
  12102. if (map.length <= 0x10000) {
  12103. return map.indexOf(value);
  12104. }
  12105. for (const charCode in map) {
  12106. if (map[charCode] === value) {
  12107. return charCode | 0;
  12108. }
  12109. }
  12110. return -1;
  12111. }
  12112. getMap() {
  12113. return this._map;
  12114. }
  12115. readCharCode(str, offset, out) {
  12116. let c = 0;
  12117. const codespaceRanges = this.codespaceRanges;
  12118. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  12119. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  12120. const codespaceRange = codespaceRanges[n];
  12121. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  12122. const low = codespaceRange[k++];
  12123. const high = codespaceRange[k++];
  12124. if (c >= low && c <= high) {
  12125. out.charcode = c;
  12126. out.length = n + 1;
  12127. return;
  12128. }
  12129. }
  12130. }
  12131. out.charcode = 0;
  12132. out.length = 1;
  12133. }
  12134. getCharCodeLength(charCode) {
  12135. const codespaceRanges = this.codespaceRanges;
  12136. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  12137. const codespaceRange = codespaceRanges[n];
  12138. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  12139. const low = codespaceRange[k++];
  12140. const high = codespaceRange[k++];
  12141. if (charCode >= low && charCode <= high) {
  12142. return n + 1;
  12143. }
  12144. }
  12145. }
  12146. return 1;
  12147. }
  12148. get length() {
  12149. return this._map.length;
  12150. }
  12151. get isIdentityCMap() {
  12152. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  12153. return false;
  12154. }
  12155. if (this._map.length !== 0x10000) {
  12156. return false;
  12157. }
  12158. for (let i = 0; i < 0x10000; i++) {
  12159. if (this._map[i] !== i) {
  12160. return false;
  12161. }
  12162. }
  12163. return true;
  12164. }
  12165. }
  12166. exports.CMap = CMap;
  12167. class IdentityCMap extends CMap {
  12168. constructor(vertical, n) {
  12169. super();
  12170. this.vertical = vertical;
  12171. this.addCodespaceRange(n, 0, 0xffff);
  12172. }
  12173. mapCidRange(low, high, dstLow) {
  12174. (0, _util.unreachable)("should not call mapCidRange");
  12175. }
  12176. mapBfRange(low, high, dstLow) {
  12177. (0, _util.unreachable)("should not call mapBfRange");
  12178. }
  12179. mapBfRangeToArray(low, high, array) {
  12180. (0, _util.unreachable)("should not call mapBfRangeToArray");
  12181. }
  12182. mapOne(src, dst) {
  12183. (0, _util.unreachable)("should not call mapCidOne");
  12184. }
  12185. lookup(code) {
  12186. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  12187. }
  12188. contains(code) {
  12189. return Number.isInteger(code) && code <= 0xffff;
  12190. }
  12191. forEach(callback) {
  12192. for (let i = 0; i <= 0xffff; i++) {
  12193. callback(i, i);
  12194. }
  12195. }
  12196. charCodeOf(value) {
  12197. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  12198. }
  12199. getMap() {
  12200. const map = new Array(0x10000);
  12201. for (let i = 0; i <= 0xffff; i++) {
  12202. map[i] = i;
  12203. }
  12204. return map;
  12205. }
  12206. get length() {
  12207. return 0x10000;
  12208. }
  12209. get isIdentityCMap() {
  12210. (0, _util.unreachable)("should not access .isIdentityCMap");
  12211. }
  12212. }
  12213. exports.IdentityCMap = IdentityCMap;
  12214. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  12215. function hexToInt(a, size) {
  12216. let n = 0;
  12217. for (let i = 0; i <= size; i++) {
  12218. n = n << 8 | a[i];
  12219. }
  12220. return n >>> 0;
  12221. }
  12222. function hexToStr(a, size) {
  12223. if (size === 1) {
  12224. return String.fromCharCode(a[0], a[1]);
  12225. }
  12226. if (size === 3) {
  12227. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  12228. }
  12229. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  12230. }
  12231. function addHex(a, b, size) {
  12232. let c = 0;
  12233. for (let i = size; i >= 0; i--) {
  12234. c += a[i] + b[i];
  12235. a[i] = c & 255;
  12236. c >>= 8;
  12237. }
  12238. }
  12239. function incHex(a, size) {
  12240. let c = 1;
  12241. for (let i = size; i >= 0 && c > 0; i--) {
  12242. c += a[i];
  12243. a[i] = c & 255;
  12244. c >>= 8;
  12245. }
  12246. }
  12247. const MAX_NUM_SIZE = 16;
  12248. const MAX_ENCODED_NUM_SIZE = 19;
  12249. class BinaryCMapStream {
  12250. constructor(data) {
  12251. this.buffer = data;
  12252. this.pos = 0;
  12253. this.end = data.length;
  12254. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  12255. }
  12256. readByte() {
  12257. if (this.pos >= this.end) {
  12258. return -1;
  12259. }
  12260. return this.buffer[this.pos++];
  12261. }
  12262. readNumber() {
  12263. let n = 0;
  12264. let last;
  12265. do {
  12266. const b = this.readByte();
  12267. if (b < 0) {
  12268. throw new _util.FormatError("unexpected EOF in bcmap");
  12269. }
  12270. last = !(b & 0x80);
  12271. n = n << 7 | b & 0x7f;
  12272. } while (!last);
  12273. return n;
  12274. }
  12275. readSigned() {
  12276. const n = this.readNumber();
  12277. return n & 1 ? ~(n >>> 1) : n >>> 1;
  12278. }
  12279. readHex(num, size) {
  12280. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  12281. this.pos += size + 1;
  12282. }
  12283. readHexNumber(num, size) {
  12284. let last;
  12285. const stack = this.tmpBuf;
  12286. let sp = 0;
  12287. do {
  12288. const b = this.readByte();
  12289. if (b < 0) {
  12290. throw new _util.FormatError("unexpected EOF in bcmap");
  12291. }
  12292. last = !(b & 0x80);
  12293. stack[sp++] = b & 0x7f;
  12294. } while (!last);
  12295. let i = size,
  12296. buffer = 0,
  12297. bufferSize = 0;
  12298. while (i >= 0) {
  12299. while (bufferSize < 8 && stack.length > 0) {
  12300. buffer |= stack[--sp] << bufferSize;
  12301. bufferSize += 7;
  12302. }
  12303. num[i] = buffer & 255;
  12304. i--;
  12305. buffer >>= 8;
  12306. bufferSize -= 8;
  12307. }
  12308. }
  12309. readHexSigned(num, size) {
  12310. this.readHexNumber(num, size);
  12311. const sign = num[size] & 1 ? 255 : 0;
  12312. let c = 0;
  12313. for (let i = 0; i <= size; i++) {
  12314. c = (c & 1) << 8 | num[i];
  12315. num[i] = c >> 1 ^ sign;
  12316. }
  12317. }
  12318. readString() {
  12319. const len = this.readNumber();
  12320. let s = "";
  12321. for (let i = 0; i < len; i++) {
  12322. s += String.fromCharCode(this.readNumber());
  12323. }
  12324. return s;
  12325. }
  12326. }
  12327. class BinaryCMapReader {
  12328. async process(data, cMap, extend) {
  12329. const stream = new BinaryCMapStream(data);
  12330. const header = stream.readByte();
  12331. cMap.vertical = !!(header & 1);
  12332. let useCMap = null;
  12333. const start = new Uint8Array(MAX_NUM_SIZE);
  12334. const end = new Uint8Array(MAX_NUM_SIZE);
  12335. const char = new Uint8Array(MAX_NUM_SIZE);
  12336. const charCode = new Uint8Array(MAX_NUM_SIZE);
  12337. const tmp = new Uint8Array(MAX_NUM_SIZE);
  12338. let code;
  12339. let b;
  12340. while ((b = stream.readByte()) >= 0) {
  12341. const type = b >> 5;
  12342. if (type === 7) {
  12343. switch (b & 0x1f) {
  12344. case 0:
  12345. stream.readString();
  12346. break;
  12347. case 1:
  12348. useCMap = stream.readString();
  12349. break;
  12350. }
  12351. continue;
  12352. }
  12353. const sequence = !!(b & 0x10);
  12354. const dataSize = b & 15;
  12355. if (dataSize + 1 > MAX_NUM_SIZE) {
  12356. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  12357. }
  12358. const ucs2DataSize = 1;
  12359. const subitemsCount = stream.readNumber();
  12360. switch (type) {
  12361. case 0:
  12362. stream.readHex(start, dataSize);
  12363. stream.readHexNumber(end, dataSize);
  12364. addHex(end, start, dataSize);
  12365. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12366. for (let i = 1; i < subitemsCount; i++) {
  12367. incHex(end, dataSize);
  12368. stream.readHexNumber(start, dataSize);
  12369. addHex(start, end, dataSize);
  12370. stream.readHexNumber(end, dataSize);
  12371. addHex(end, start, dataSize);
  12372. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12373. }
  12374. break;
  12375. case 1:
  12376. stream.readHex(start, dataSize);
  12377. stream.readHexNumber(end, dataSize);
  12378. addHex(end, start, dataSize);
  12379. stream.readNumber();
  12380. for (let i = 1; i < subitemsCount; i++) {
  12381. incHex(end, dataSize);
  12382. stream.readHexNumber(start, dataSize);
  12383. addHex(start, end, dataSize);
  12384. stream.readHexNumber(end, dataSize);
  12385. addHex(end, start, dataSize);
  12386. stream.readNumber();
  12387. }
  12388. break;
  12389. case 2:
  12390. stream.readHex(char, dataSize);
  12391. code = stream.readNumber();
  12392. cMap.mapOne(hexToInt(char, dataSize), code);
  12393. for (let i = 1; i < subitemsCount; i++) {
  12394. incHex(char, dataSize);
  12395. if (!sequence) {
  12396. stream.readHexNumber(tmp, dataSize);
  12397. addHex(char, tmp, dataSize);
  12398. }
  12399. code = stream.readSigned() + (code + 1);
  12400. cMap.mapOne(hexToInt(char, dataSize), code);
  12401. }
  12402. break;
  12403. case 3:
  12404. stream.readHex(start, dataSize);
  12405. stream.readHexNumber(end, dataSize);
  12406. addHex(end, start, dataSize);
  12407. code = stream.readNumber();
  12408. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12409. for (let i = 1; i < subitemsCount; i++) {
  12410. incHex(end, dataSize);
  12411. if (!sequence) {
  12412. stream.readHexNumber(start, dataSize);
  12413. addHex(start, end, dataSize);
  12414. } else {
  12415. start.set(end);
  12416. }
  12417. stream.readHexNumber(end, dataSize);
  12418. addHex(end, start, dataSize);
  12419. code = stream.readNumber();
  12420. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12421. }
  12422. break;
  12423. case 4:
  12424. stream.readHex(char, ucs2DataSize);
  12425. stream.readHex(charCode, dataSize);
  12426. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12427. for (let i = 1; i < subitemsCount; i++) {
  12428. incHex(char, ucs2DataSize);
  12429. if (!sequence) {
  12430. stream.readHexNumber(tmp, ucs2DataSize);
  12431. addHex(char, tmp, ucs2DataSize);
  12432. }
  12433. incHex(charCode, dataSize);
  12434. stream.readHexSigned(tmp, dataSize);
  12435. addHex(charCode, tmp, dataSize);
  12436. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12437. }
  12438. break;
  12439. case 5:
  12440. stream.readHex(start, ucs2DataSize);
  12441. stream.readHexNumber(end, ucs2DataSize);
  12442. addHex(end, start, ucs2DataSize);
  12443. stream.readHex(charCode, dataSize);
  12444. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12445. for (let i = 1; i < subitemsCount; i++) {
  12446. incHex(end, ucs2DataSize);
  12447. if (!sequence) {
  12448. stream.readHexNumber(start, ucs2DataSize);
  12449. addHex(start, end, ucs2DataSize);
  12450. } else {
  12451. start.set(end);
  12452. }
  12453. stream.readHexNumber(end, ucs2DataSize);
  12454. addHex(end, start, ucs2DataSize);
  12455. stream.readHex(charCode, dataSize);
  12456. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12457. }
  12458. break;
  12459. default:
  12460. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  12461. }
  12462. }
  12463. if (useCMap) {
  12464. return extend(useCMap);
  12465. }
  12466. return cMap;
  12467. }
  12468. }
  12469. return BinaryCMapReader;
  12470. }();
  12471. const CMapFactory = function CMapFactoryClosure() {
  12472. function strToInt(str) {
  12473. let a = 0;
  12474. for (let i = 0; i < str.length; i++) {
  12475. a = a << 8 | str.charCodeAt(i);
  12476. }
  12477. return a >>> 0;
  12478. }
  12479. function expectString(obj) {
  12480. if (typeof obj !== "string") {
  12481. throw new _util.FormatError("Malformed CMap: expected string.");
  12482. }
  12483. }
  12484. function expectInt(obj) {
  12485. if (!Number.isInteger(obj)) {
  12486. throw new _util.FormatError("Malformed CMap: expected int.");
  12487. }
  12488. }
  12489. function parseBfChar(cMap, lexer) {
  12490. while (true) {
  12491. let obj = lexer.getObj();
  12492. if (obj === _primitives.EOF) {
  12493. break;
  12494. }
  12495. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  12496. return;
  12497. }
  12498. expectString(obj);
  12499. const src = strToInt(obj);
  12500. obj = lexer.getObj();
  12501. expectString(obj);
  12502. const dst = obj;
  12503. cMap.mapOne(src, dst);
  12504. }
  12505. }
  12506. function parseBfRange(cMap, lexer) {
  12507. while (true) {
  12508. let obj = lexer.getObj();
  12509. if (obj === _primitives.EOF) {
  12510. break;
  12511. }
  12512. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  12513. return;
  12514. }
  12515. expectString(obj);
  12516. const low = strToInt(obj);
  12517. obj = lexer.getObj();
  12518. expectString(obj);
  12519. const high = strToInt(obj);
  12520. obj = lexer.getObj();
  12521. if (Number.isInteger(obj) || typeof obj === "string") {
  12522. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  12523. cMap.mapBfRange(low, high, dstLow);
  12524. } else if ((0, _primitives.isCmd)(obj, "[")) {
  12525. obj = lexer.getObj();
  12526. const array = [];
  12527. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  12528. array.push(obj);
  12529. obj = lexer.getObj();
  12530. }
  12531. cMap.mapBfRangeToArray(low, high, array);
  12532. } else {
  12533. break;
  12534. }
  12535. }
  12536. throw new _util.FormatError("Invalid bf range.");
  12537. }
  12538. function parseCidChar(cMap, lexer) {
  12539. while (true) {
  12540. let obj = lexer.getObj();
  12541. if (obj === _primitives.EOF) {
  12542. break;
  12543. }
  12544. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  12545. return;
  12546. }
  12547. expectString(obj);
  12548. const src = strToInt(obj);
  12549. obj = lexer.getObj();
  12550. expectInt(obj);
  12551. const dst = obj;
  12552. cMap.mapOne(src, dst);
  12553. }
  12554. }
  12555. function parseCidRange(cMap, lexer) {
  12556. while (true) {
  12557. let obj = lexer.getObj();
  12558. if (obj === _primitives.EOF) {
  12559. break;
  12560. }
  12561. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  12562. return;
  12563. }
  12564. expectString(obj);
  12565. const low = strToInt(obj);
  12566. obj = lexer.getObj();
  12567. expectString(obj);
  12568. const high = strToInt(obj);
  12569. obj = lexer.getObj();
  12570. expectInt(obj);
  12571. const dstLow = obj;
  12572. cMap.mapCidRange(low, high, dstLow);
  12573. }
  12574. }
  12575. function parseCodespaceRange(cMap, lexer) {
  12576. while (true) {
  12577. let obj = lexer.getObj();
  12578. if (obj === _primitives.EOF) {
  12579. break;
  12580. }
  12581. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  12582. return;
  12583. }
  12584. if (typeof obj !== "string") {
  12585. break;
  12586. }
  12587. const low = strToInt(obj);
  12588. obj = lexer.getObj();
  12589. if (typeof obj !== "string") {
  12590. break;
  12591. }
  12592. const high = strToInt(obj);
  12593. cMap.addCodespaceRange(obj.length, low, high);
  12594. }
  12595. throw new _util.FormatError("Invalid codespace range.");
  12596. }
  12597. function parseWMode(cMap, lexer) {
  12598. const obj = lexer.getObj();
  12599. if (Number.isInteger(obj)) {
  12600. cMap.vertical = !!obj;
  12601. }
  12602. }
  12603. function parseCMapName(cMap, lexer) {
  12604. const obj = lexer.getObj();
  12605. if (obj instanceof _primitives.Name) {
  12606. cMap.name = obj.name;
  12607. }
  12608. }
  12609. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  12610. let previous, embeddedUseCMap;
  12611. objLoop: while (true) {
  12612. try {
  12613. const obj = lexer.getObj();
  12614. if (obj === _primitives.EOF) {
  12615. break;
  12616. } else if (obj instanceof _primitives.Name) {
  12617. if (obj.name === "WMode") {
  12618. parseWMode(cMap, lexer);
  12619. } else if (obj.name === "CMapName") {
  12620. parseCMapName(cMap, lexer);
  12621. }
  12622. previous = obj;
  12623. } else if (obj instanceof _primitives.Cmd) {
  12624. switch (obj.cmd) {
  12625. case "endcmap":
  12626. break objLoop;
  12627. case "usecmap":
  12628. if (previous instanceof _primitives.Name) {
  12629. embeddedUseCMap = previous.name;
  12630. }
  12631. break;
  12632. case "begincodespacerange":
  12633. parseCodespaceRange(cMap, lexer);
  12634. break;
  12635. case "beginbfchar":
  12636. parseBfChar(cMap, lexer);
  12637. break;
  12638. case "begincidchar":
  12639. parseCidChar(cMap, lexer);
  12640. break;
  12641. case "beginbfrange":
  12642. parseBfRange(cMap, lexer);
  12643. break;
  12644. case "begincidrange":
  12645. parseCidRange(cMap, lexer);
  12646. break;
  12647. }
  12648. }
  12649. } catch (ex) {
  12650. if (ex instanceof _core_utils.MissingDataException) {
  12651. throw ex;
  12652. }
  12653. (0, _util.warn)("Invalid cMap data: " + ex);
  12654. continue;
  12655. }
  12656. }
  12657. if (!useCMap && embeddedUseCMap) {
  12658. useCMap = embeddedUseCMap;
  12659. }
  12660. if (useCMap) {
  12661. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12662. }
  12663. return cMap;
  12664. }
  12665. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  12666. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  12667. if (cMap.numCodespaceRanges === 0) {
  12668. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  12669. for (let i = 0; i < useCodespaceRanges.length; i++) {
  12670. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  12671. }
  12672. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  12673. }
  12674. cMap.useCMap.forEach(function (key, value) {
  12675. if (!cMap.contains(key)) {
  12676. cMap.mapOne(key, cMap.useCMap.lookup(key));
  12677. }
  12678. });
  12679. return cMap;
  12680. }
  12681. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  12682. if (name === "Identity-H") {
  12683. return new IdentityCMap(false, 2);
  12684. } else if (name === "Identity-V") {
  12685. return new IdentityCMap(true, 2);
  12686. }
  12687. if (!BUILT_IN_CMAPS.includes(name)) {
  12688. throw new Error("Unknown CMap name: " + name);
  12689. }
  12690. if (!fetchBuiltInCMap) {
  12691. throw new Error("Built-in CMap parameters are not provided.");
  12692. }
  12693. const {
  12694. cMapData,
  12695. compressionType
  12696. } = await fetchBuiltInCMap(name);
  12697. const cMap = new CMap(true);
  12698. if (compressionType === _util.CMapCompressionType.BINARY) {
  12699. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  12700. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12701. });
  12702. }
  12703. if (compressionType === _util.CMapCompressionType.NONE) {
  12704. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  12705. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  12706. }
  12707. throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
  12708. }
  12709. return {
  12710. async create(params) {
  12711. const encoding = params.encoding;
  12712. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  12713. const useCMap = params.useCMap;
  12714. if (encoding instanceof _primitives.Name) {
  12715. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  12716. } else if (encoding instanceof _base_stream.BaseStream) {
  12717. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  12718. if (parsedCMap.isIdentityCMap) {
  12719. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  12720. }
  12721. return parsedCMap;
  12722. }
  12723. throw new Error("Encoding required.");
  12724. }
  12725. };
  12726. }();
  12727. exports.CMapFactory = CMapFactory;
  12728. /***/ }),
  12729. /* 15 */
  12730. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12731. Object.defineProperty(exports, "__esModule", ({
  12732. value: true
  12733. }));
  12734. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  12735. var _util = __w_pdfjs_require__(2);
  12736. var _primitives = __w_pdfjs_require__(3);
  12737. var _core_utils = __w_pdfjs_require__(4);
  12738. var _ascii_85_stream = __w_pdfjs_require__(16);
  12739. var _ascii_hex_stream = __w_pdfjs_require__(18);
  12740. var _ccitt_stream = __w_pdfjs_require__(19);
  12741. var _flate_stream = __w_pdfjs_require__(21);
  12742. var _jbig2_stream = __w_pdfjs_require__(22);
  12743. var _jpeg_stream = __w_pdfjs_require__(25);
  12744. var _jpx_stream = __w_pdfjs_require__(27);
  12745. var _lzw_stream = __w_pdfjs_require__(29);
  12746. var _stream = __w_pdfjs_require__(8);
  12747. var _predictor_stream = __w_pdfjs_require__(30);
  12748. var _run_length_stream = __w_pdfjs_require__(31);
  12749. const MAX_LENGTH_TO_CACHE = 1000;
  12750. function getInlineImageCacheKey(bytes) {
  12751. const strBuf = [],
  12752. ii = bytes.length;
  12753. let i = 0;
  12754. while (i < ii - 1) {
  12755. strBuf.push(bytes[i++] << 8 | bytes[i++]);
  12756. }
  12757. if (i < ii) {
  12758. strBuf.push(bytes[i]);
  12759. }
  12760. return ii + "_" + String.fromCharCode.apply(null, strBuf);
  12761. }
  12762. class Parser {
  12763. constructor({
  12764. lexer,
  12765. xref,
  12766. allowStreams = false,
  12767. recoveryMode = false
  12768. }) {
  12769. this.lexer = lexer;
  12770. this.xref = xref;
  12771. this.allowStreams = allowStreams;
  12772. this.recoveryMode = recoveryMode;
  12773. this.imageCache = Object.create(null);
  12774. this._imageId = 0;
  12775. this.refill();
  12776. }
  12777. refill() {
  12778. this.buf1 = this.lexer.getObj();
  12779. this.buf2 = this.lexer.getObj();
  12780. }
  12781. shift() {
  12782. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  12783. this.buf1 = this.buf2;
  12784. this.buf2 = null;
  12785. } else {
  12786. this.buf1 = this.buf2;
  12787. this.buf2 = this.lexer.getObj();
  12788. }
  12789. }
  12790. tryShift() {
  12791. try {
  12792. this.shift();
  12793. return true;
  12794. } catch (e) {
  12795. if (e instanceof _core_utils.MissingDataException) {
  12796. throw e;
  12797. }
  12798. return false;
  12799. }
  12800. }
  12801. getObj(cipherTransform = null) {
  12802. const buf1 = this.buf1;
  12803. this.shift();
  12804. if (buf1 instanceof _primitives.Cmd) {
  12805. switch (buf1.cmd) {
  12806. case "BI":
  12807. return this.makeInlineImage(cipherTransform);
  12808. case "[":
  12809. const array = [];
  12810. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  12811. array.push(this.getObj(cipherTransform));
  12812. }
  12813. if (this.buf1 === _primitives.EOF) {
  12814. if (this.recoveryMode) {
  12815. return array;
  12816. }
  12817. throw new _core_utils.ParserEOFException("End of file inside array.");
  12818. }
  12819. this.shift();
  12820. return array;
  12821. case "<<":
  12822. const dict = new _primitives.Dict(this.xref);
  12823. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  12824. if (!(this.buf1 instanceof _primitives.Name)) {
  12825. (0, _util.info)("Malformed dictionary: key must be a name object");
  12826. this.shift();
  12827. continue;
  12828. }
  12829. const key = this.buf1.name;
  12830. this.shift();
  12831. if (this.buf1 === _primitives.EOF) {
  12832. break;
  12833. }
  12834. dict.set(key, this.getObj(cipherTransform));
  12835. }
  12836. if (this.buf1 === _primitives.EOF) {
  12837. if (this.recoveryMode) {
  12838. return dict;
  12839. }
  12840. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  12841. }
  12842. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  12843. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12844. }
  12845. this.shift();
  12846. return dict;
  12847. default:
  12848. return buf1;
  12849. }
  12850. }
  12851. if (Number.isInteger(buf1)) {
  12852. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  12853. const ref = _primitives.Ref.get(buf1, this.buf1);
  12854. this.shift();
  12855. this.shift();
  12856. return ref;
  12857. }
  12858. return buf1;
  12859. }
  12860. if (typeof buf1 === "string") {
  12861. if (cipherTransform) {
  12862. return cipherTransform.decryptString(buf1);
  12863. }
  12864. return buf1;
  12865. }
  12866. return buf1;
  12867. }
  12868. findDefaultInlineStreamEnd(stream) {
  12869. const E = 0x45,
  12870. I = 0x49,
  12871. SPACE = 0x20,
  12872. LF = 0xa,
  12873. CR = 0xd,
  12874. NUL = 0x0;
  12875. const lexer = this.lexer,
  12876. startPos = stream.pos,
  12877. n = 10;
  12878. let state = 0,
  12879. ch,
  12880. maybeEIPos;
  12881. while ((ch = stream.getByte()) !== -1) {
  12882. if (state === 0) {
  12883. state = ch === E ? 1 : 0;
  12884. } else if (state === 1) {
  12885. state = ch === I ? 2 : 0;
  12886. } else {
  12887. if (ch === SPACE || ch === LF || ch === CR) {
  12888. maybeEIPos = stream.pos;
  12889. const followingBytes = stream.peekBytes(n);
  12890. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  12891. ch = followingBytes[i];
  12892. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  12893. continue;
  12894. }
  12895. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  12896. state = 0;
  12897. break;
  12898. }
  12899. }
  12900. if (state !== 2) {
  12901. continue;
  12902. }
  12903. if (lexer.knownCommands) {
  12904. const nextObj = lexer.peekObj();
  12905. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  12906. state = 0;
  12907. }
  12908. } else {
  12909. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  12910. }
  12911. if (state === 2) {
  12912. break;
  12913. }
  12914. } else {
  12915. state = 0;
  12916. }
  12917. }
  12918. }
  12919. if (ch === -1) {
  12920. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  12921. if (maybeEIPos) {
  12922. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  12923. stream.skip(-(stream.pos - maybeEIPos));
  12924. }
  12925. }
  12926. let endOffset = 4;
  12927. stream.skip(-endOffset);
  12928. ch = stream.peekByte();
  12929. stream.skip(endOffset);
  12930. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  12931. endOffset--;
  12932. }
  12933. return stream.pos - endOffset - startPos;
  12934. }
  12935. findDCTDecodeInlineStreamEnd(stream) {
  12936. const startPos = stream.pos;
  12937. let foundEOI = false,
  12938. b,
  12939. markerLength;
  12940. while ((b = stream.getByte()) !== -1) {
  12941. if (b !== 0xff) {
  12942. continue;
  12943. }
  12944. switch (stream.getByte()) {
  12945. case 0x00:
  12946. break;
  12947. case 0xff:
  12948. stream.skip(-1);
  12949. break;
  12950. case 0xd9:
  12951. foundEOI = true;
  12952. break;
  12953. case 0xc0:
  12954. case 0xc1:
  12955. case 0xc2:
  12956. case 0xc3:
  12957. case 0xc5:
  12958. case 0xc6:
  12959. case 0xc7:
  12960. case 0xc9:
  12961. case 0xca:
  12962. case 0xcb:
  12963. case 0xcd:
  12964. case 0xce:
  12965. case 0xcf:
  12966. case 0xc4:
  12967. case 0xcc:
  12968. case 0xda:
  12969. case 0xdb:
  12970. case 0xdc:
  12971. case 0xdd:
  12972. case 0xde:
  12973. case 0xdf:
  12974. case 0xe0:
  12975. case 0xe1:
  12976. case 0xe2:
  12977. case 0xe3:
  12978. case 0xe4:
  12979. case 0xe5:
  12980. case 0xe6:
  12981. case 0xe7:
  12982. case 0xe8:
  12983. case 0xe9:
  12984. case 0xea:
  12985. case 0xeb:
  12986. case 0xec:
  12987. case 0xed:
  12988. case 0xee:
  12989. case 0xef:
  12990. case 0xfe:
  12991. markerLength = stream.getUint16();
  12992. if (markerLength > 2) {
  12993. stream.skip(markerLength - 2);
  12994. } else {
  12995. stream.skip(-2);
  12996. }
  12997. break;
  12998. }
  12999. if (foundEOI) {
  13000. break;
  13001. }
  13002. }
  13003. const length = stream.pos - startPos;
  13004. if (b === -1) {
  13005. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  13006. stream.skip(-length);
  13007. return this.findDefaultInlineStreamEnd(stream);
  13008. }
  13009. this.inlineStreamSkipEI(stream);
  13010. return length;
  13011. }
  13012. findASCII85DecodeInlineStreamEnd(stream) {
  13013. const TILDE = 0x7e,
  13014. GT = 0x3e;
  13015. const startPos = stream.pos;
  13016. let ch;
  13017. while ((ch = stream.getByte()) !== -1) {
  13018. if (ch === TILDE) {
  13019. const tildePos = stream.pos;
  13020. ch = stream.peekByte();
  13021. while ((0, _core_utils.isWhiteSpace)(ch)) {
  13022. stream.skip();
  13023. ch = stream.peekByte();
  13024. }
  13025. if (ch === GT) {
  13026. stream.skip();
  13027. break;
  13028. }
  13029. if (stream.pos > tildePos) {
  13030. const maybeEI = stream.peekBytes(2);
  13031. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  13032. break;
  13033. }
  13034. }
  13035. }
  13036. }
  13037. const length = stream.pos - startPos;
  13038. if (ch === -1) {
  13039. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  13040. stream.skip(-length);
  13041. return this.findDefaultInlineStreamEnd(stream);
  13042. }
  13043. this.inlineStreamSkipEI(stream);
  13044. return length;
  13045. }
  13046. findASCIIHexDecodeInlineStreamEnd(stream) {
  13047. const GT = 0x3e;
  13048. const startPos = stream.pos;
  13049. let ch;
  13050. while ((ch = stream.getByte()) !== -1) {
  13051. if (ch === GT) {
  13052. break;
  13053. }
  13054. }
  13055. const length = stream.pos - startPos;
  13056. if (ch === -1) {
  13057. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  13058. stream.skip(-length);
  13059. return this.findDefaultInlineStreamEnd(stream);
  13060. }
  13061. this.inlineStreamSkipEI(stream);
  13062. return length;
  13063. }
  13064. inlineStreamSkipEI(stream) {
  13065. const E = 0x45,
  13066. I = 0x49;
  13067. let state = 0,
  13068. ch;
  13069. while ((ch = stream.getByte()) !== -1) {
  13070. if (state === 0) {
  13071. state = ch === E ? 1 : 0;
  13072. } else if (state === 1) {
  13073. state = ch === I ? 2 : 0;
  13074. } else if (state === 2) {
  13075. break;
  13076. }
  13077. }
  13078. }
  13079. makeInlineImage(cipherTransform) {
  13080. const lexer = this.lexer;
  13081. const stream = lexer.stream;
  13082. const dictMap = Object.create(null);
  13083. let dictLength;
  13084. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  13085. if (!(this.buf1 instanceof _primitives.Name)) {
  13086. throw new _util.FormatError("Dictionary key must be a name object");
  13087. }
  13088. const key = this.buf1.name;
  13089. this.shift();
  13090. if (this.buf1 === _primitives.EOF) {
  13091. break;
  13092. }
  13093. dictMap[key] = this.getObj(cipherTransform);
  13094. }
  13095. if (lexer.beginInlineImagePos !== -1) {
  13096. dictLength = stream.pos - lexer.beginInlineImagePos;
  13097. }
  13098. const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
  13099. let filterName;
  13100. if (filter instanceof _primitives.Name) {
  13101. filterName = filter.name;
  13102. } else if (Array.isArray(filter)) {
  13103. const filterZero = this.xref.fetchIfRef(filter[0]);
  13104. if (filterZero instanceof _primitives.Name) {
  13105. filterName = filterZero.name;
  13106. }
  13107. }
  13108. const startPos = stream.pos;
  13109. let length;
  13110. switch (filterName) {
  13111. case "DCT":
  13112. case "DCTDecode":
  13113. length = this.findDCTDecodeInlineStreamEnd(stream);
  13114. break;
  13115. case "A85":
  13116. case "ASCII85Decode":
  13117. length = this.findASCII85DecodeInlineStreamEnd(stream);
  13118. break;
  13119. case "AHx":
  13120. case "ASCIIHexDecode":
  13121. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  13122. break;
  13123. default:
  13124. length = this.findDefaultInlineStreamEnd(stream);
  13125. }
  13126. let cacheKey;
  13127. if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
  13128. const initialStreamPos = stream.pos;
  13129. stream.pos = lexer.beginInlineImagePos;
  13130. cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
  13131. stream.pos = initialStreamPos;
  13132. const cacheEntry = this.imageCache[cacheKey];
  13133. if (cacheEntry !== undefined) {
  13134. this.buf2 = _primitives.Cmd.get("EI");
  13135. this.shift();
  13136. cacheEntry.reset();
  13137. return cacheEntry;
  13138. }
  13139. }
  13140. const dict = new _primitives.Dict(this.xref);
  13141. for (const key in dictMap) {
  13142. dict.set(key, dictMap[key]);
  13143. }
  13144. let imageStream = stream.makeSubStream(startPos, length, dict);
  13145. if (cipherTransform) {
  13146. imageStream = cipherTransform.createStream(imageStream, length);
  13147. }
  13148. imageStream = this.filter(imageStream, dict, length);
  13149. imageStream.dict = dict;
  13150. if (cacheKey !== undefined) {
  13151. imageStream.cacheKey = `inline_img_${++this._imageId}`;
  13152. this.imageCache[cacheKey] = imageStream;
  13153. }
  13154. this.buf2 = _primitives.Cmd.get("EI");
  13155. this.shift();
  13156. return imageStream;
  13157. }
  13158. _findStreamLength(startPos, signature) {
  13159. const {
  13160. stream
  13161. } = this.lexer;
  13162. stream.pos = startPos;
  13163. const SCAN_BLOCK_LENGTH = 2048;
  13164. const signatureLength = signature.length;
  13165. while (stream.pos < stream.end) {
  13166. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  13167. const scanLength = scanBytes.length - signatureLength;
  13168. if (scanLength <= 0) {
  13169. break;
  13170. }
  13171. let pos = 0;
  13172. while (pos < scanLength) {
  13173. let j = 0;
  13174. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  13175. j++;
  13176. }
  13177. if (j >= signatureLength) {
  13178. stream.pos += pos;
  13179. return stream.pos - startPos;
  13180. }
  13181. pos++;
  13182. }
  13183. stream.pos += scanLength;
  13184. }
  13185. return -1;
  13186. }
  13187. makeStream(dict, cipherTransform) {
  13188. const lexer = this.lexer;
  13189. let stream = lexer.stream;
  13190. lexer.skipToNextLine();
  13191. const startPos = stream.pos - 1;
  13192. let length = dict.get("Length");
  13193. if (!Number.isInteger(length)) {
  13194. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  13195. length = 0;
  13196. }
  13197. stream.pos = startPos + length;
  13198. lexer.nextChar();
  13199. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  13200. this.shift();
  13201. } else {
  13202. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  13203. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  13204. if (actualLength < 0) {
  13205. const MAX_TRUNCATION = 1;
  13206. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  13207. const end = ENDSTREAM_SIGNATURE.length - i;
  13208. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  13209. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  13210. if (maybeLength >= 0) {
  13211. const lastByte = stream.peekBytes(end + 1)[end];
  13212. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  13213. break;
  13214. }
  13215. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  13216. actualLength = maybeLength;
  13217. break;
  13218. }
  13219. }
  13220. if (actualLength < 0) {
  13221. throw new _util.FormatError("Missing endstream command.");
  13222. }
  13223. }
  13224. length = actualLength;
  13225. lexer.nextChar();
  13226. this.shift();
  13227. this.shift();
  13228. }
  13229. this.shift();
  13230. stream = stream.makeSubStream(startPos, length, dict);
  13231. if (cipherTransform) {
  13232. stream = cipherTransform.createStream(stream, length);
  13233. }
  13234. stream = this.filter(stream, dict, length);
  13235. stream.dict = dict;
  13236. return stream;
  13237. }
  13238. filter(stream, dict, length) {
  13239. let filter = dict.get("F", "Filter");
  13240. let params = dict.get("DP", "DecodeParms");
  13241. if (filter instanceof _primitives.Name) {
  13242. if (Array.isArray(params)) {
  13243. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  13244. }
  13245. return this.makeFilter(stream, filter.name, length, params);
  13246. }
  13247. let maybeLength = length;
  13248. if (Array.isArray(filter)) {
  13249. const filterArray = filter;
  13250. const paramsArray = params;
  13251. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  13252. filter = this.xref.fetchIfRef(filterArray[i]);
  13253. if (!(filter instanceof _primitives.Name)) {
  13254. throw new _util.FormatError(`Bad filter name "${filter}"`);
  13255. }
  13256. params = null;
  13257. if (Array.isArray(paramsArray) && i in paramsArray) {
  13258. params = this.xref.fetchIfRef(paramsArray[i]);
  13259. }
  13260. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  13261. maybeLength = null;
  13262. }
  13263. }
  13264. return stream;
  13265. }
  13266. makeFilter(stream, name, maybeLength, params) {
  13267. if (maybeLength === 0) {
  13268. (0, _util.warn)(`Empty "${name}" stream.`);
  13269. return new _stream.NullStream();
  13270. }
  13271. try {
  13272. switch (name) {
  13273. case "Fl":
  13274. case "FlateDecode":
  13275. if (params) {
  13276. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  13277. }
  13278. return new _flate_stream.FlateStream(stream, maybeLength);
  13279. case "LZW":
  13280. case "LZWDecode":
  13281. let earlyChange = 1;
  13282. if (params) {
  13283. if (params.has("EarlyChange")) {
  13284. earlyChange = params.get("EarlyChange");
  13285. }
  13286. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  13287. }
  13288. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  13289. case "DCT":
  13290. case "DCTDecode":
  13291. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  13292. case "JPX":
  13293. case "JPXDecode":
  13294. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  13295. case "A85":
  13296. case "ASCII85Decode":
  13297. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  13298. case "AHx":
  13299. case "ASCIIHexDecode":
  13300. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  13301. case "CCF":
  13302. case "CCITTFaxDecode":
  13303. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  13304. case "RL":
  13305. case "RunLengthDecode":
  13306. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  13307. case "JBIG2Decode":
  13308. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  13309. }
  13310. (0, _util.warn)(`Filter "${name}" is not supported.`);
  13311. return stream;
  13312. } catch (ex) {
  13313. if (ex instanceof _core_utils.MissingDataException) {
  13314. throw ex;
  13315. }
  13316. (0, _util.warn)(`Invalid stream: "${ex}"`);
  13317. return new _stream.NullStream();
  13318. }
  13319. }
  13320. }
  13321. exports.Parser = Parser;
  13322. 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];
  13323. function toHexDigit(ch) {
  13324. if (ch >= 0x30 && ch <= 0x39) {
  13325. return ch & 0x0f;
  13326. }
  13327. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  13328. return (ch & 0x0f) + 9;
  13329. }
  13330. return -1;
  13331. }
  13332. class Lexer {
  13333. constructor(stream, knownCommands = null) {
  13334. this.stream = stream;
  13335. this.nextChar();
  13336. this.strBuf = [];
  13337. this.knownCommands = knownCommands;
  13338. this._hexStringNumWarn = 0;
  13339. this.beginInlineImagePos = -1;
  13340. }
  13341. nextChar() {
  13342. return this.currentChar = this.stream.getByte();
  13343. }
  13344. peekChar() {
  13345. return this.stream.peekByte();
  13346. }
  13347. getNumber() {
  13348. let ch = this.currentChar;
  13349. let eNotation = false;
  13350. let divideBy = 0;
  13351. let sign = 0;
  13352. if (ch === 0x2d) {
  13353. sign = -1;
  13354. ch = this.nextChar();
  13355. if (ch === 0x2d) {
  13356. ch = this.nextChar();
  13357. }
  13358. } else if (ch === 0x2b) {
  13359. sign = 1;
  13360. ch = this.nextChar();
  13361. }
  13362. if (ch === 0x0a || ch === 0x0d) {
  13363. do {
  13364. ch = this.nextChar();
  13365. } while (ch === 0x0a || ch === 0x0d);
  13366. }
  13367. if (ch === 0x2e) {
  13368. divideBy = 10;
  13369. ch = this.nextChar();
  13370. }
  13371. if (ch < 0x30 || ch > 0x39) {
  13372. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  13373. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  13374. (0, _util.info)(`Lexer.getNumber - "${msg}".`);
  13375. return 0;
  13376. }
  13377. throw new _util.FormatError(msg);
  13378. }
  13379. sign = sign || 1;
  13380. let baseValue = ch - 0x30;
  13381. let powerValue = 0;
  13382. let powerValueSign = 1;
  13383. while ((ch = this.nextChar()) >= 0) {
  13384. if (ch >= 0x30 && ch <= 0x39) {
  13385. const currentDigit = ch - 0x30;
  13386. if (eNotation) {
  13387. powerValue = powerValue * 10 + currentDigit;
  13388. } else {
  13389. if (divideBy !== 0) {
  13390. divideBy *= 10;
  13391. }
  13392. baseValue = baseValue * 10 + currentDigit;
  13393. }
  13394. } else if (ch === 0x2e) {
  13395. if (divideBy === 0) {
  13396. divideBy = 1;
  13397. } else {
  13398. break;
  13399. }
  13400. } else if (ch === 0x2d) {
  13401. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  13402. } else if (ch === 0x45 || ch === 0x65) {
  13403. ch = this.peekChar();
  13404. if (ch === 0x2b || ch === 0x2d) {
  13405. powerValueSign = ch === 0x2d ? -1 : 1;
  13406. this.nextChar();
  13407. } else if (ch < 0x30 || ch > 0x39) {
  13408. break;
  13409. }
  13410. eNotation = true;
  13411. } else {
  13412. break;
  13413. }
  13414. }
  13415. if (divideBy !== 0) {
  13416. baseValue /= divideBy;
  13417. }
  13418. if (eNotation) {
  13419. baseValue *= 10 ** (powerValueSign * powerValue);
  13420. }
  13421. return sign * baseValue;
  13422. }
  13423. getString() {
  13424. let numParen = 1;
  13425. let done = false;
  13426. const strBuf = this.strBuf;
  13427. strBuf.length = 0;
  13428. let ch = this.nextChar();
  13429. while (true) {
  13430. let charBuffered = false;
  13431. switch (ch | 0) {
  13432. case -1:
  13433. (0, _util.warn)("Unterminated string");
  13434. done = true;
  13435. break;
  13436. case 0x28:
  13437. ++numParen;
  13438. strBuf.push("(");
  13439. break;
  13440. case 0x29:
  13441. if (--numParen === 0) {
  13442. this.nextChar();
  13443. done = true;
  13444. } else {
  13445. strBuf.push(")");
  13446. }
  13447. break;
  13448. case 0x5c:
  13449. ch = this.nextChar();
  13450. switch (ch) {
  13451. case -1:
  13452. (0, _util.warn)("Unterminated string");
  13453. done = true;
  13454. break;
  13455. case 0x6e:
  13456. strBuf.push("\n");
  13457. break;
  13458. case 0x72:
  13459. strBuf.push("\r");
  13460. break;
  13461. case 0x74:
  13462. strBuf.push("\t");
  13463. break;
  13464. case 0x62:
  13465. strBuf.push("\b");
  13466. break;
  13467. case 0x66:
  13468. strBuf.push("\f");
  13469. break;
  13470. case 0x5c:
  13471. case 0x28:
  13472. case 0x29:
  13473. strBuf.push(String.fromCharCode(ch));
  13474. break;
  13475. case 0x30:
  13476. case 0x31:
  13477. case 0x32:
  13478. case 0x33:
  13479. case 0x34:
  13480. case 0x35:
  13481. case 0x36:
  13482. case 0x37:
  13483. let x = ch & 0x0f;
  13484. ch = this.nextChar();
  13485. charBuffered = true;
  13486. if (ch >= 0x30 && ch <= 0x37) {
  13487. x = (x << 3) + (ch & 0x0f);
  13488. ch = this.nextChar();
  13489. if (ch >= 0x30 && ch <= 0x37) {
  13490. charBuffered = false;
  13491. x = (x << 3) + (ch & 0x0f);
  13492. }
  13493. }
  13494. strBuf.push(String.fromCharCode(x));
  13495. break;
  13496. case 0x0d:
  13497. if (this.peekChar() === 0x0a) {
  13498. this.nextChar();
  13499. }
  13500. break;
  13501. case 0x0a:
  13502. break;
  13503. default:
  13504. strBuf.push(String.fromCharCode(ch));
  13505. break;
  13506. }
  13507. break;
  13508. default:
  13509. strBuf.push(String.fromCharCode(ch));
  13510. break;
  13511. }
  13512. if (done) {
  13513. break;
  13514. }
  13515. if (!charBuffered) {
  13516. ch = this.nextChar();
  13517. }
  13518. }
  13519. return strBuf.join("");
  13520. }
  13521. getName() {
  13522. let ch, previousCh;
  13523. const strBuf = this.strBuf;
  13524. strBuf.length = 0;
  13525. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13526. if (ch === 0x23) {
  13527. ch = this.nextChar();
  13528. if (specialChars[ch]) {
  13529. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  13530. strBuf.push("#");
  13531. break;
  13532. }
  13533. const x = toHexDigit(ch);
  13534. if (x !== -1) {
  13535. previousCh = ch;
  13536. ch = this.nextChar();
  13537. const x2 = toHexDigit(ch);
  13538. if (x2 === -1) {
  13539. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  13540. strBuf.push("#", String.fromCharCode(previousCh));
  13541. if (specialChars[ch]) {
  13542. break;
  13543. }
  13544. strBuf.push(String.fromCharCode(ch));
  13545. continue;
  13546. }
  13547. strBuf.push(String.fromCharCode(x << 4 | x2));
  13548. } else {
  13549. strBuf.push("#", String.fromCharCode(ch));
  13550. }
  13551. } else {
  13552. strBuf.push(String.fromCharCode(ch));
  13553. }
  13554. }
  13555. if (strBuf.length > 127) {
  13556. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  13557. }
  13558. return _primitives.Name.get(strBuf.join(""));
  13559. }
  13560. _hexStringWarn(ch) {
  13561. const MAX_HEX_STRING_NUM_WARN = 5;
  13562. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  13563. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  13564. return;
  13565. }
  13566. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  13567. return;
  13568. }
  13569. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  13570. }
  13571. getHexString() {
  13572. const strBuf = this.strBuf;
  13573. strBuf.length = 0;
  13574. let ch = this.currentChar;
  13575. let isFirstHex = true;
  13576. let firstDigit, secondDigit;
  13577. this._hexStringNumWarn = 0;
  13578. while (true) {
  13579. if (ch < 0) {
  13580. (0, _util.warn)("Unterminated hex string");
  13581. break;
  13582. } else if (ch === 0x3e) {
  13583. this.nextChar();
  13584. break;
  13585. } else if (specialChars[ch] === 1) {
  13586. ch = this.nextChar();
  13587. continue;
  13588. } else {
  13589. if (isFirstHex) {
  13590. firstDigit = toHexDigit(ch);
  13591. if (firstDigit === -1) {
  13592. this._hexStringWarn(ch);
  13593. ch = this.nextChar();
  13594. continue;
  13595. }
  13596. } else {
  13597. secondDigit = toHexDigit(ch);
  13598. if (secondDigit === -1) {
  13599. this._hexStringWarn(ch);
  13600. ch = this.nextChar();
  13601. continue;
  13602. }
  13603. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  13604. }
  13605. isFirstHex = !isFirstHex;
  13606. ch = this.nextChar();
  13607. }
  13608. }
  13609. return strBuf.join("");
  13610. }
  13611. getObj() {
  13612. let comment = false;
  13613. let ch = this.currentChar;
  13614. while (true) {
  13615. if (ch < 0) {
  13616. return _primitives.EOF;
  13617. }
  13618. if (comment) {
  13619. if (ch === 0x0a || ch === 0x0d) {
  13620. comment = false;
  13621. }
  13622. } else if (ch === 0x25) {
  13623. comment = true;
  13624. } else if (specialChars[ch] !== 1) {
  13625. break;
  13626. }
  13627. ch = this.nextChar();
  13628. }
  13629. switch (ch | 0) {
  13630. case 0x30:
  13631. case 0x31:
  13632. case 0x32:
  13633. case 0x33:
  13634. case 0x34:
  13635. case 0x35:
  13636. case 0x36:
  13637. case 0x37:
  13638. case 0x38:
  13639. case 0x39:
  13640. case 0x2b:
  13641. case 0x2d:
  13642. case 0x2e:
  13643. return this.getNumber();
  13644. case 0x28:
  13645. return this.getString();
  13646. case 0x2f:
  13647. return this.getName();
  13648. case 0x5b:
  13649. this.nextChar();
  13650. return _primitives.Cmd.get("[");
  13651. case 0x5d:
  13652. this.nextChar();
  13653. return _primitives.Cmd.get("]");
  13654. case 0x3c:
  13655. ch = this.nextChar();
  13656. if (ch === 0x3c) {
  13657. this.nextChar();
  13658. return _primitives.Cmd.get("<<");
  13659. }
  13660. return this.getHexString();
  13661. case 0x3e:
  13662. ch = this.nextChar();
  13663. if (ch === 0x3e) {
  13664. this.nextChar();
  13665. return _primitives.Cmd.get(">>");
  13666. }
  13667. return _primitives.Cmd.get(">");
  13668. case 0x7b:
  13669. this.nextChar();
  13670. return _primitives.Cmd.get("{");
  13671. case 0x7d:
  13672. this.nextChar();
  13673. return _primitives.Cmd.get("}");
  13674. case 0x29:
  13675. this.nextChar();
  13676. throw new _util.FormatError(`Illegal character: ${ch}`);
  13677. }
  13678. let str = String.fromCharCode(ch);
  13679. if (ch < 0x20 || ch > 0x7f) {
  13680. const nextCh = this.peekChar();
  13681. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  13682. this.nextChar();
  13683. return _primitives.Cmd.get(str);
  13684. }
  13685. }
  13686. const knownCommands = this.knownCommands;
  13687. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13688. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13689. const possibleCommand = str + String.fromCharCode(ch);
  13690. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13691. break;
  13692. }
  13693. if (str.length === 128) {
  13694. throw new _util.FormatError(`Command token too long: ${str.length}`);
  13695. }
  13696. str = possibleCommand;
  13697. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13698. }
  13699. if (str === "true") {
  13700. return true;
  13701. }
  13702. if (str === "false") {
  13703. return false;
  13704. }
  13705. if (str === "null") {
  13706. return null;
  13707. }
  13708. if (str === "BI") {
  13709. this.beginInlineImagePos = this.stream.pos;
  13710. }
  13711. return _primitives.Cmd.get(str);
  13712. }
  13713. peekObj() {
  13714. const streamPos = this.stream.pos,
  13715. currentChar = this.currentChar,
  13716. beginInlineImagePos = this.beginInlineImagePos;
  13717. let nextObj;
  13718. try {
  13719. nextObj = this.getObj();
  13720. } catch (ex) {
  13721. if (ex instanceof _core_utils.MissingDataException) {
  13722. throw ex;
  13723. }
  13724. (0, _util.warn)(`peekObj: ${ex}`);
  13725. }
  13726. this.stream.pos = streamPos;
  13727. this.currentChar = currentChar;
  13728. this.beginInlineImagePos = beginInlineImagePos;
  13729. return nextObj;
  13730. }
  13731. skipToNextLine() {
  13732. let ch = this.currentChar;
  13733. while (ch >= 0) {
  13734. if (ch === 0x0d) {
  13735. ch = this.nextChar();
  13736. if (ch === 0x0a) {
  13737. this.nextChar();
  13738. }
  13739. break;
  13740. } else if (ch === 0x0a) {
  13741. this.nextChar();
  13742. break;
  13743. }
  13744. ch = this.nextChar();
  13745. }
  13746. }
  13747. }
  13748. exports.Lexer = Lexer;
  13749. class Linearization {
  13750. static create(stream) {
  13751. function getInt(linDict, name, allowZeroValue = false) {
  13752. const obj = linDict.get(name);
  13753. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13754. return obj;
  13755. }
  13756. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  13757. }
  13758. function getHints(linDict) {
  13759. const hints = linDict.get("H");
  13760. let hintsLength;
  13761. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13762. for (let index = 0; index < hintsLength; index++) {
  13763. const hint = hints[index];
  13764. if (!(Number.isInteger(hint) && hint > 0)) {
  13765. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  13766. }
  13767. }
  13768. return hints;
  13769. }
  13770. throw new Error("Hint array in the linearization dictionary is invalid.");
  13771. }
  13772. const parser = new Parser({
  13773. lexer: new Lexer(stream),
  13774. xref: null
  13775. });
  13776. const obj1 = parser.getObj();
  13777. const obj2 = parser.getObj();
  13778. const obj3 = parser.getObj();
  13779. const linDict = parser.getObj();
  13780. let obj, length;
  13781. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  13782. return null;
  13783. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  13784. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  13785. }
  13786. return {
  13787. length,
  13788. hints: getHints(linDict),
  13789. objectNumberFirst: getInt(linDict, "O"),
  13790. endFirst: getInt(linDict, "E"),
  13791. numPages: getInt(linDict, "N"),
  13792. mainXRefEntriesOffset: getInt(linDict, "T"),
  13793. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  13794. };
  13795. }
  13796. }
  13797. exports.Linearization = Linearization;
  13798. /***/ }),
  13799. /* 16 */
  13800. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13801. Object.defineProperty(exports, "__esModule", ({
  13802. value: true
  13803. }));
  13804. exports.Ascii85Stream = void 0;
  13805. var _decode_stream = __w_pdfjs_require__(17);
  13806. var _core_utils = __w_pdfjs_require__(4);
  13807. class Ascii85Stream extends _decode_stream.DecodeStream {
  13808. constructor(str, maybeLength) {
  13809. if (maybeLength) {
  13810. maybeLength *= 0.8;
  13811. }
  13812. super(maybeLength);
  13813. this.str = str;
  13814. this.dict = str.dict;
  13815. this.input = new Uint8Array(5);
  13816. }
  13817. readBlock() {
  13818. const TILDA_CHAR = 0x7e;
  13819. const Z_LOWER_CHAR = 0x7a;
  13820. const EOF = -1;
  13821. const str = this.str;
  13822. let c = str.getByte();
  13823. while ((0, _core_utils.isWhiteSpace)(c)) {
  13824. c = str.getByte();
  13825. }
  13826. if (c === EOF || c === TILDA_CHAR) {
  13827. this.eof = true;
  13828. return;
  13829. }
  13830. const bufferLength = this.bufferLength;
  13831. let buffer, i;
  13832. if (c === Z_LOWER_CHAR) {
  13833. buffer = this.ensureBuffer(bufferLength + 4);
  13834. for (i = 0; i < 4; ++i) {
  13835. buffer[bufferLength + i] = 0;
  13836. }
  13837. this.bufferLength += 4;
  13838. } else {
  13839. const input = this.input;
  13840. input[0] = c;
  13841. for (i = 1; i < 5; ++i) {
  13842. c = str.getByte();
  13843. while ((0, _core_utils.isWhiteSpace)(c)) {
  13844. c = str.getByte();
  13845. }
  13846. input[i] = c;
  13847. if (c === EOF || c === TILDA_CHAR) {
  13848. break;
  13849. }
  13850. }
  13851. buffer = this.ensureBuffer(bufferLength + i - 1);
  13852. this.bufferLength += i - 1;
  13853. if (i < 5) {
  13854. for (; i < 5; ++i) {
  13855. input[i] = 0x21 + 84;
  13856. }
  13857. this.eof = true;
  13858. }
  13859. let t = 0;
  13860. for (i = 0; i < 5; ++i) {
  13861. t = t * 85 + (input[i] - 0x21);
  13862. }
  13863. for (i = 3; i >= 0; --i) {
  13864. buffer[bufferLength + i] = t & 0xff;
  13865. t >>= 8;
  13866. }
  13867. }
  13868. }
  13869. }
  13870. exports.Ascii85Stream = Ascii85Stream;
  13871. /***/ }),
  13872. /* 17 */
  13873. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13874. Object.defineProperty(exports, "__esModule", ({
  13875. value: true
  13876. }));
  13877. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  13878. var _base_stream = __w_pdfjs_require__(5);
  13879. var _stream = __w_pdfjs_require__(8);
  13880. const emptyBuffer = new Uint8Array(0);
  13881. class DecodeStream extends _base_stream.BaseStream {
  13882. constructor(maybeMinBufferLength) {
  13883. super();
  13884. this._rawMinBufferLength = maybeMinBufferLength || 0;
  13885. this.pos = 0;
  13886. this.bufferLength = 0;
  13887. this.eof = false;
  13888. this.buffer = emptyBuffer;
  13889. this.minBufferLength = 512;
  13890. if (maybeMinBufferLength) {
  13891. while (this.minBufferLength < maybeMinBufferLength) {
  13892. this.minBufferLength *= 2;
  13893. }
  13894. }
  13895. }
  13896. get isEmpty() {
  13897. while (!this.eof && this.bufferLength === 0) {
  13898. this.readBlock();
  13899. }
  13900. return this.bufferLength === 0;
  13901. }
  13902. ensureBuffer(requested) {
  13903. const buffer = this.buffer;
  13904. if (requested <= buffer.byteLength) {
  13905. return buffer;
  13906. }
  13907. let size = this.minBufferLength;
  13908. while (size < requested) {
  13909. size *= 2;
  13910. }
  13911. const buffer2 = new Uint8Array(size);
  13912. buffer2.set(buffer);
  13913. return this.buffer = buffer2;
  13914. }
  13915. getByte() {
  13916. const pos = this.pos;
  13917. while (this.bufferLength <= pos) {
  13918. if (this.eof) {
  13919. return -1;
  13920. }
  13921. this.readBlock();
  13922. }
  13923. return this.buffer[this.pos++];
  13924. }
  13925. getBytes(length) {
  13926. const pos = this.pos;
  13927. let end;
  13928. if (length) {
  13929. this.ensureBuffer(pos + length);
  13930. end = pos + length;
  13931. while (!this.eof && this.bufferLength < end) {
  13932. this.readBlock();
  13933. }
  13934. const bufEnd = this.bufferLength;
  13935. if (end > bufEnd) {
  13936. end = bufEnd;
  13937. }
  13938. } else {
  13939. while (!this.eof) {
  13940. this.readBlock();
  13941. }
  13942. end = this.bufferLength;
  13943. }
  13944. this.pos = end;
  13945. return this.buffer.subarray(pos, end);
  13946. }
  13947. reset() {
  13948. this.pos = 0;
  13949. }
  13950. makeSubStream(start, length, dict = null) {
  13951. if (length === undefined) {
  13952. while (!this.eof) {
  13953. this.readBlock();
  13954. }
  13955. } else {
  13956. const end = start + length;
  13957. while (this.bufferLength <= end && !this.eof) {
  13958. this.readBlock();
  13959. }
  13960. }
  13961. return new _stream.Stream(this.buffer, start, length, dict);
  13962. }
  13963. getBaseStreams() {
  13964. return this.str ? this.str.getBaseStreams() : null;
  13965. }
  13966. }
  13967. exports.DecodeStream = DecodeStream;
  13968. class StreamsSequenceStream extends DecodeStream {
  13969. constructor(streams, onError = null) {
  13970. let maybeLength = 0;
  13971. for (const stream of streams) {
  13972. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  13973. }
  13974. super(maybeLength);
  13975. this.streams = streams;
  13976. this._onError = onError;
  13977. }
  13978. readBlock() {
  13979. const streams = this.streams;
  13980. if (streams.length === 0) {
  13981. this.eof = true;
  13982. return;
  13983. }
  13984. const stream = streams.shift();
  13985. let chunk;
  13986. try {
  13987. chunk = stream.getBytes();
  13988. } catch (reason) {
  13989. if (this._onError) {
  13990. this._onError(reason, stream.dict && stream.dict.objId);
  13991. return;
  13992. }
  13993. throw reason;
  13994. }
  13995. const bufferLength = this.bufferLength;
  13996. const newLength = bufferLength + chunk.length;
  13997. const buffer = this.ensureBuffer(newLength);
  13998. buffer.set(chunk, bufferLength);
  13999. this.bufferLength = newLength;
  14000. }
  14001. getBaseStreams() {
  14002. const baseStreamsBuf = [];
  14003. for (const stream of this.streams) {
  14004. const baseStreams = stream.getBaseStreams();
  14005. if (baseStreams) {
  14006. baseStreamsBuf.push(...baseStreams);
  14007. }
  14008. }
  14009. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  14010. }
  14011. }
  14012. exports.StreamsSequenceStream = StreamsSequenceStream;
  14013. /***/ }),
  14014. /* 18 */
  14015. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14016. Object.defineProperty(exports, "__esModule", ({
  14017. value: true
  14018. }));
  14019. exports.AsciiHexStream = void 0;
  14020. var _decode_stream = __w_pdfjs_require__(17);
  14021. class AsciiHexStream extends _decode_stream.DecodeStream {
  14022. constructor(str, maybeLength) {
  14023. if (maybeLength) {
  14024. maybeLength *= 0.5;
  14025. }
  14026. super(maybeLength);
  14027. this.str = str;
  14028. this.dict = str.dict;
  14029. this.firstDigit = -1;
  14030. }
  14031. readBlock() {
  14032. const UPSTREAM_BLOCK_SIZE = 8000;
  14033. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  14034. if (!bytes.length) {
  14035. this.eof = true;
  14036. return;
  14037. }
  14038. const maxDecodeLength = bytes.length + 1 >> 1;
  14039. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  14040. let bufferLength = this.bufferLength;
  14041. let firstDigit = this.firstDigit;
  14042. for (const ch of bytes) {
  14043. let digit;
  14044. if (ch >= 0x30 && ch <= 0x39) {
  14045. digit = ch & 0x0f;
  14046. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  14047. digit = (ch & 0x0f) + 9;
  14048. } else if (ch === 0x3e) {
  14049. this.eof = true;
  14050. break;
  14051. } else {
  14052. continue;
  14053. }
  14054. if (firstDigit < 0) {
  14055. firstDigit = digit;
  14056. } else {
  14057. buffer[bufferLength++] = firstDigit << 4 | digit;
  14058. firstDigit = -1;
  14059. }
  14060. }
  14061. if (firstDigit >= 0 && this.eof) {
  14062. buffer[bufferLength++] = firstDigit << 4;
  14063. firstDigit = -1;
  14064. }
  14065. this.firstDigit = firstDigit;
  14066. this.bufferLength = bufferLength;
  14067. }
  14068. }
  14069. exports.AsciiHexStream = AsciiHexStream;
  14070. /***/ }),
  14071. /* 19 */
  14072. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14073. Object.defineProperty(exports, "__esModule", ({
  14074. value: true
  14075. }));
  14076. exports.CCITTFaxStream = void 0;
  14077. var _ccitt = __w_pdfjs_require__(20);
  14078. var _decode_stream = __w_pdfjs_require__(17);
  14079. var _primitives = __w_pdfjs_require__(3);
  14080. class CCITTFaxStream extends _decode_stream.DecodeStream {
  14081. constructor(str, maybeLength, params) {
  14082. super(maybeLength);
  14083. this.str = str;
  14084. this.dict = str.dict;
  14085. if (!(params instanceof _primitives.Dict)) {
  14086. params = _primitives.Dict.empty;
  14087. }
  14088. const source = {
  14089. next() {
  14090. return str.getByte();
  14091. }
  14092. };
  14093. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  14094. K: params.get("K"),
  14095. EndOfLine: params.get("EndOfLine"),
  14096. EncodedByteAlign: params.get("EncodedByteAlign"),
  14097. Columns: params.get("Columns"),
  14098. Rows: params.get("Rows"),
  14099. EndOfBlock: params.get("EndOfBlock"),
  14100. BlackIs1: params.get("BlackIs1")
  14101. });
  14102. }
  14103. readBlock() {
  14104. while (!this.eof) {
  14105. const c = this.ccittFaxDecoder.readNextChar();
  14106. if (c === -1) {
  14107. this.eof = true;
  14108. return;
  14109. }
  14110. this.ensureBuffer(this.bufferLength + 1);
  14111. this.buffer[this.bufferLength++] = c;
  14112. }
  14113. }
  14114. }
  14115. exports.CCITTFaxStream = CCITTFaxStream;
  14116. /***/ }),
  14117. /* 20 */
  14118. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14119. Object.defineProperty(exports, "__esModule", ({
  14120. value: true
  14121. }));
  14122. exports.CCITTFaxDecoder = void 0;
  14123. var _util = __w_pdfjs_require__(2);
  14124. const ccittEOL = -2;
  14125. const ccittEOF = -1;
  14126. const twoDimPass = 0;
  14127. const twoDimHoriz = 1;
  14128. const twoDimVert0 = 2;
  14129. const twoDimVertR1 = 3;
  14130. const twoDimVertL1 = 4;
  14131. const twoDimVertR2 = 5;
  14132. const twoDimVertL2 = 6;
  14133. const twoDimVertR3 = 7;
  14134. const twoDimVertL3 = 8;
  14135. 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]];
  14136. 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]];
  14137. 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]];
  14138. 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]];
  14139. 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]];
  14140. 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]];
  14141. class CCITTFaxDecoder {
  14142. constructor(source, options = {}) {
  14143. if (!source || typeof source.next !== "function") {
  14144. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  14145. }
  14146. this.source = source;
  14147. this.eof = false;
  14148. this.encoding = options.K || 0;
  14149. this.eoline = options.EndOfLine || false;
  14150. this.byteAlign = options.EncodedByteAlign || false;
  14151. this.columns = options.Columns || 1728;
  14152. this.rows = options.Rows || 0;
  14153. let eoblock = options.EndOfBlock;
  14154. if (eoblock === null || eoblock === undefined) {
  14155. eoblock = true;
  14156. }
  14157. this.eoblock = eoblock;
  14158. this.black = options.BlackIs1 || false;
  14159. this.codingLine = new Uint32Array(this.columns + 1);
  14160. this.refLine = new Uint32Array(this.columns + 2);
  14161. this.codingLine[0] = this.columns;
  14162. this.codingPos = 0;
  14163. this.row = 0;
  14164. this.nextLine2D = this.encoding < 0;
  14165. this.inputBits = 0;
  14166. this.inputBuf = 0;
  14167. this.outputBits = 0;
  14168. this.rowsDone = false;
  14169. let code1;
  14170. while ((code1 = this._lookBits(12)) === 0) {
  14171. this._eatBits(1);
  14172. }
  14173. if (code1 === 1) {
  14174. this._eatBits(12);
  14175. }
  14176. if (this.encoding > 0) {
  14177. this.nextLine2D = !this._lookBits(1);
  14178. this._eatBits(1);
  14179. }
  14180. }
  14181. readNextChar() {
  14182. if (this.eof) {
  14183. return -1;
  14184. }
  14185. const refLine = this.refLine;
  14186. const codingLine = this.codingLine;
  14187. const columns = this.columns;
  14188. let refPos, blackPixels, bits, i;
  14189. if (this.outputBits === 0) {
  14190. if (this.rowsDone) {
  14191. this.eof = true;
  14192. }
  14193. if (this.eof) {
  14194. return -1;
  14195. }
  14196. this.err = false;
  14197. let code1, code2, code3;
  14198. if (this.nextLine2D) {
  14199. for (i = 0; codingLine[i] < columns; ++i) {
  14200. refLine[i] = codingLine[i];
  14201. }
  14202. refLine[i++] = columns;
  14203. refLine[i] = columns;
  14204. codingLine[0] = 0;
  14205. this.codingPos = 0;
  14206. refPos = 0;
  14207. blackPixels = 0;
  14208. while (codingLine[this.codingPos] < columns) {
  14209. code1 = this._getTwoDimCode();
  14210. switch (code1) {
  14211. case twoDimPass:
  14212. this._addPixels(refLine[refPos + 1], blackPixels);
  14213. if (refLine[refPos + 1] < columns) {
  14214. refPos += 2;
  14215. }
  14216. break;
  14217. case twoDimHoriz:
  14218. code1 = code2 = 0;
  14219. if (blackPixels) {
  14220. do {
  14221. code1 += code3 = this._getBlackCode();
  14222. } while (code3 >= 64);
  14223. do {
  14224. code2 += code3 = this._getWhiteCode();
  14225. } while (code3 >= 64);
  14226. } else {
  14227. do {
  14228. code1 += code3 = this._getWhiteCode();
  14229. } while (code3 >= 64);
  14230. do {
  14231. code2 += code3 = this._getBlackCode();
  14232. } while (code3 >= 64);
  14233. }
  14234. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  14235. if (codingLine[this.codingPos] < columns) {
  14236. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  14237. }
  14238. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14239. refPos += 2;
  14240. }
  14241. break;
  14242. case twoDimVertR3:
  14243. this._addPixels(refLine[refPos] + 3, blackPixels);
  14244. blackPixels ^= 1;
  14245. if (codingLine[this.codingPos] < columns) {
  14246. ++refPos;
  14247. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14248. refPos += 2;
  14249. }
  14250. }
  14251. break;
  14252. case twoDimVertR2:
  14253. this._addPixels(refLine[refPos] + 2, blackPixels);
  14254. blackPixels ^= 1;
  14255. if (codingLine[this.codingPos] < columns) {
  14256. ++refPos;
  14257. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14258. refPos += 2;
  14259. }
  14260. }
  14261. break;
  14262. case twoDimVertR1:
  14263. this._addPixels(refLine[refPos] + 1, blackPixels);
  14264. blackPixels ^= 1;
  14265. if (codingLine[this.codingPos] < columns) {
  14266. ++refPos;
  14267. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14268. refPos += 2;
  14269. }
  14270. }
  14271. break;
  14272. case twoDimVert0:
  14273. this._addPixels(refLine[refPos], blackPixels);
  14274. blackPixels ^= 1;
  14275. if (codingLine[this.codingPos] < columns) {
  14276. ++refPos;
  14277. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14278. refPos += 2;
  14279. }
  14280. }
  14281. break;
  14282. case twoDimVertL3:
  14283. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  14284. blackPixels ^= 1;
  14285. if (codingLine[this.codingPos] < columns) {
  14286. if (refPos > 0) {
  14287. --refPos;
  14288. } else {
  14289. ++refPos;
  14290. }
  14291. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14292. refPos += 2;
  14293. }
  14294. }
  14295. break;
  14296. case twoDimVertL2:
  14297. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  14298. blackPixels ^= 1;
  14299. if (codingLine[this.codingPos] < columns) {
  14300. if (refPos > 0) {
  14301. --refPos;
  14302. } else {
  14303. ++refPos;
  14304. }
  14305. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14306. refPos += 2;
  14307. }
  14308. }
  14309. break;
  14310. case twoDimVertL1:
  14311. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  14312. blackPixels ^= 1;
  14313. if (codingLine[this.codingPos] < columns) {
  14314. if (refPos > 0) {
  14315. --refPos;
  14316. } else {
  14317. ++refPos;
  14318. }
  14319. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14320. refPos += 2;
  14321. }
  14322. }
  14323. break;
  14324. case ccittEOF:
  14325. this._addPixels(columns, 0);
  14326. this.eof = true;
  14327. break;
  14328. default:
  14329. (0, _util.info)("bad 2d code");
  14330. this._addPixels(columns, 0);
  14331. this.err = true;
  14332. }
  14333. }
  14334. } else {
  14335. codingLine[0] = 0;
  14336. this.codingPos = 0;
  14337. blackPixels = 0;
  14338. while (codingLine[this.codingPos] < columns) {
  14339. code1 = 0;
  14340. if (blackPixels) {
  14341. do {
  14342. code1 += code3 = this._getBlackCode();
  14343. } while (code3 >= 64);
  14344. } else {
  14345. do {
  14346. code1 += code3 = this._getWhiteCode();
  14347. } while (code3 >= 64);
  14348. }
  14349. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  14350. blackPixels ^= 1;
  14351. }
  14352. }
  14353. let gotEOL = false;
  14354. if (this.byteAlign) {
  14355. this.inputBits &= ~7;
  14356. }
  14357. if (!this.eoblock && this.row === this.rows - 1) {
  14358. this.rowsDone = true;
  14359. } else {
  14360. code1 = this._lookBits(12);
  14361. if (this.eoline) {
  14362. while (code1 !== ccittEOF && code1 !== 1) {
  14363. this._eatBits(1);
  14364. code1 = this._lookBits(12);
  14365. }
  14366. } else {
  14367. while (code1 === 0) {
  14368. this._eatBits(1);
  14369. code1 = this._lookBits(12);
  14370. }
  14371. }
  14372. if (code1 === 1) {
  14373. this._eatBits(12);
  14374. gotEOL = true;
  14375. } else if (code1 === ccittEOF) {
  14376. this.eof = true;
  14377. }
  14378. }
  14379. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  14380. this.nextLine2D = !this._lookBits(1);
  14381. this._eatBits(1);
  14382. }
  14383. if (this.eoblock && gotEOL && this.byteAlign) {
  14384. code1 = this._lookBits(12);
  14385. if (code1 === 1) {
  14386. this._eatBits(12);
  14387. if (this.encoding > 0) {
  14388. this._lookBits(1);
  14389. this._eatBits(1);
  14390. }
  14391. if (this.encoding >= 0) {
  14392. for (i = 0; i < 4; ++i) {
  14393. code1 = this._lookBits(12);
  14394. if (code1 !== 1) {
  14395. (0, _util.info)("bad rtc code: " + code1);
  14396. }
  14397. this._eatBits(12);
  14398. if (this.encoding > 0) {
  14399. this._lookBits(1);
  14400. this._eatBits(1);
  14401. }
  14402. }
  14403. }
  14404. this.eof = true;
  14405. }
  14406. } else if (this.err && this.eoline) {
  14407. while (true) {
  14408. code1 = this._lookBits(13);
  14409. if (code1 === ccittEOF) {
  14410. this.eof = true;
  14411. return -1;
  14412. }
  14413. if (code1 >> 1 === 1) {
  14414. break;
  14415. }
  14416. this._eatBits(1);
  14417. }
  14418. this._eatBits(12);
  14419. if (this.encoding > 0) {
  14420. this._eatBits(1);
  14421. this.nextLine2D = !(code1 & 1);
  14422. }
  14423. }
  14424. if (codingLine[0] > 0) {
  14425. this.outputBits = codingLine[this.codingPos = 0];
  14426. } else {
  14427. this.outputBits = codingLine[this.codingPos = 1];
  14428. }
  14429. this.row++;
  14430. }
  14431. let c;
  14432. if (this.outputBits >= 8) {
  14433. c = this.codingPos & 1 ? 0 : 0xff;
  14434. this.outputBits -= 8;
  14435. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  14436. this.codingPos++;
  14437. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14438. }
  14439. } else {
  14440. bits = 8;
  14441. c = 0;
  14442. do {
  14443. if (typeof this.outputBits !== "number") {
  14444. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  14445. }
  14446. if (this.outputBits > bits) {
  14447. c <<= bits;
  14448. if (!(this.codingPos & 1)) {
  14449. c |= 0xff >> 8 - bits;
  14450. }
  14451. this.outputBits -= bits;
  14452. bits = 0;
  14453. } else {
  14454. c <<= this.outputBits;
  14455. if (!(this.codingPos & 1)) {
  14456. c |= 0xff >> 8 - this.outputBits;
  14457. }
  14458. bits -= this.outputBits;
  14459. this.outputBits = 0;
  14460. if (codingLine[this.codingPos] < columns) {
  14461. this.codingPos++;
  14462. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14463. } else if (bits > 0) {
  14464. c <<= bits;
  14465. bits = 0;
  14466. }
  14467. }
  14468. } while (bits);
  14469. }
  14470. if (this.black) {
  14471. c ^= 0xff;
  14472. }
  14473. return c;
  14474. }
  14475. _addPixels(a1, blackPixels) {
  14476. const codingLine = this.codingLine;
  14477. let codingPos = this.codingPos;
  14478. if (a1 > codingLine[codingPos]) {
  14479. if (a1 > this.columns) {
  14480. (0, _util.info)("row is wrong length");
  14481. this.err = true;
  14482. a1 = this.columns;
  14483. }
  14484. if (codingPos & 1 ^ blackPixels) {
  14485. ++codingPos;
  14486. }
  14487. codingLine[codingPos] = a1;
  14488. }
  14489. this.codingPos = codingPos;
  14490. }
  14491. _addPixelsNeg(a1, blackPixels) {
  14492. const codingLine = this.codingLine;
  14493. let codingPos = this.codingPos;
  14494. if (a1 > codingLine[codingPos]) {
  14495. if (a1 > this.columns) {
  14496. (0, _util.info)("row is wrong length");
  14497. this.err = true;
  14498. a1 = this.columns;
  14499. }
  14500. if (codingPos & 1 ^ blackPixels) {
  14501. ++codingPos;
  14502. }
  14503. codingLine[codingPos] = a1;
  14504. } else if (a1 < codingLine[codingPos]) {
  14505. if (a1 < 0) {
  14506. (0, _util.info)("invalid code");
  14507. this.err = true;
  14508. a1 = 0;
  14509. }
  14510. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  14511. --codingPos;
  14512. }
  14513. codingLine[codingPos] = a1;
  14514. }
  14515. this.codingPos = codingPos;
  14516. }
  14517. _findTableCode(start, end, table, limit) {
  14518. const limitValue = limit || 0;
  14519. for (let i = start; i <= end; ++i) {
  14520. let code = this._lookBits(i);
  14521. if (code === ccittEOF) {
  14522. return [true, 1, false];
  14523. }
  14524. if (i < end) {
  14525. code <<= end - i;
  14526. }
  14527. if (!limitValue || code >= limitValue) {
  14528. const p = table[code - limitValue];
  14529. if (p[0] === i) {
  14530. this._eatBits(i);
  14531. return [true, p[1], true];
  14532. }
  14533. }
  14534. }
  14535. return [false, 0, false];
  14536. }
  14537. _getTwoDimCode() {
  14538. let code = 0;
  14539. let p;
  14540. if (this.eoblock) {
  14541. code = this._lookBits(7);
  14542. p = twoDimTable[code];
  14543. if (p && p[0] > 0) {
  14544. this._eatBits(p[0]);
  14545. return p[1];
  14546. }
  14547. } else {
  14548. const result = this._findTableCode(1, 7, twoDimTable);
  14549. if (result[0] && result[2]) {
  14550. return result[1];
  14551. }
  14552. }
  14553. (0, _util.info)("Bad two dim code");
  14554. return ccittEOF;
  14555. }
  14556. _getWhiteCode() {
  14557. let code = 0;
  14558. let p;
  14559. if (this.eoblock) {
  14560. code = this._lookBits(12);
  14561. if (code === ccittEOF) {
  14562. return 1;
  14563. }
  14564. if (code >> 5 === 0) {
  14565. p = whiteTable1[code];
  14566. } else {
  14567. p = whiteTable2[code >> 3];
  14568. }
  14569. if (p[0] > 0) {
  14570. this._eatBits(p[0]);
  14571. return p[1];
  14572. }
  14573. } else {
  14574. let result = this._findTableCode(1, 9, whiteTable2);
  14575. if (result[0]) {
  14576. return result[1];
  14577. }
  14578. result = this._findTableCode(11, 12, whiteTable1);
  14579. if (result[0]) {
  14580. return result[1];
  14581. }
  14582. }
  14583. (0, _util.info)("bad white code");
  14584. this._eatBits(1);
  14585. return 1;
  14586. }
  14587. _getBlackCode() {
  14588. let code, p;
  14589. if (this.eoblock) {
  14590. code = this._lookBits(13);
  14591. if (code === ccittEOF) {
  14592. return 1;
  14593. }
  14594. if (code >> 7 === 0) {
  14595. p = blackTable1[code];
  14596. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  14597. p = blackTable2[(code >> 1) - 64];
  14598. } else {
  14599. p = blackTable3[code >> 7];
  14600. }
  14601. if (p[0] > 0) {
  14602. this._eatBits(p[0]);
  14603. return p[1];
  14604. }
  14605. } else {
  14606. let result = this._findTableCode(2, 6, blackTable3);
  14607. if (result[0]) {
  14608. return result[1];
  14609. }
  14610. result = this._findTableCode(7, 12, blackTable2, 64);
  14611. if (result[0]) {
  14612. return result[1];
  14613. }
  14614. result = this._findTableCode(10, 13, blackTable1);
  14615. if (result[0]) {
  14616. return result[1];
  14617. }
  14618. }
  14619. (0, _util.info)("bad black code");
  14620. this._eatBits(1);
  14621. return 1;
  14622. }
  14623. _lookBits(n) {
  14624. let c;
  14625. while (this.inputBits < n) {
  14626. if ((c = this.source.next()) === -1) {
  14627. if (this.inputBits === 0) {
  14628. return ccittEOF;
  14629. }
  14630. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  14631. }
  14632. this.inputBuf = this.inputBuf << 8 | c;
  14633. this.inputBits += 8;
  14634. }
  14635. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  14636. }
  14637. _eatBits(n) {
  14638. if ((this.inputBits -= n) < 0) {
  14639. this.inputBits = 0;
  14640. }
  14641. }
  14642. }
  14643. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  14644. /***/ }),
  14645. /* 21 */
  14646. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14647. Object.defineProperty(exports, "__esModule", ({
  14648. value: true
  14649. }));
  14650. exports.FlateStream = void 0;
  14651. var _decode_stream = __w_pdfjs_require__(17);
  14652. var _util = __w_pdfjs_require__(2);
  14653. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  14654. 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]);
  14655. 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]);
  14656. 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];
  14657. 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];
  14658. class FlateStream extends _decode_stream.DecodeStream {
  14659. constructor(str, maybeLength) {
  14660. super(maybeLength);
  14661. this.str = str;
  14662. this.dict = str.dict;
  14663. const cmf = str.getByte();
  14664. const flg = str.getByte();
  14665. if (cmf === -1 || flg === -1) {
  14666. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  14667. }
  14668. if ((cmf & 0x0f) !== 0x08) {
  14669. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  14670. }
  14671. if (((cmf << 8) + flg) % 31 !== 0) {
  14672. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  14673. }
  14674. if (flg & 0x20) {
  14675. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  14676. }
  14677. this.codeSize = 0;
  14678. this.codeBuf = 0;
  14679. }
  14680. getBits(bits) {
  14681. const str = this.str;
  14682. let codeSize = this.codeSize;
  14683. let codeBuf = this.codeBuf;
  14684. let b;
  14685. while (codeSize < bits) {
  14686. if ((b = str.getByte()) === -1) {
  14687. throw new _util.FormatError("Bad encoding in flate stream");
  14688. }
  14689. codeBuf |= b << codeSize;
  14690. codeSize += 8;
  14691. }
  14692. b = codeBuf & (1 << bits) - 1;
  14693. this.codeBuf = codeBuf >> bits;
  14694. this.codeSize = codeSize -= bits;
  14695. return b;
  14696. }
  14697. getCode(table) {
  14698. const str = this.str;
  14699. const codes = table[0];
  14700. const maxLen = table[1];
  14701. let codeSize = this.codeSize;
  14702. let codeBuf = this.codeBuf;
  14703. let b;
  14704. while (codeSize < maxLen) {
  14705. if ((b = str.getByte()) === -1) {
  14706. break;
  14707. }
  14708. codeBuf |= b << codeSize;
  14709. codeSize += 8;
  14710. }
  14711. const code = codes[codeBuf & (1 << maxLen) - 1];
  14712. const codeLen = code >> 16;
  14713. const codeVal = code & 0xffff;
  14714. if (codeLen < 1 || codeSize < codeLen) {
  14715. throw new _util.FormatError("Bad encoding in flate stream");
  14716. }
  14717. this.codeBuf = codeBuf >> codeLen;
  14718. this.codeSize = codeSize - codeLen;
  14719. return codeVal;
  14720. }
  14721. generateHuffmanTable(lengths) {
  14722. const n = lengths.length;
  14723. let maxLen = 0;
  14724. let i;
  14725. for (i = 0; i < n; ++i) {
  14726. if (lengths[i] > maxLen) {
  14727. maxLen = lengths[i];
  14728. }
  14729. }
  14730. const size = 1 << maxLen;
  14731. const codes = new Int32Array(size);
  14732. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  14733. for (let val = 0; val < n; ++val) {
  14734. if (lengths[val] === len) {
  14735. let code2 = 0;
  14736. let t = code;
  14737. for (i = 0; i < len; ++i) {
  14738. code2 = code2 << 1 | t & 1;
  14739. t >>= 1;
  14740. }
  14741. for (i = code2; i < size; i += skip) {
  14742. codes[i] = len << 16 | val;
  14743. }
  14744. ++code;
  14745. }
  14746. }
  14747. }
  14748. return [codes, maxLen];
  14749. }
  14750. readBlock() {
  14751. let buffer, len;
  14752. const str = this.str;
  14753. let hdr = this.getBits(3);
  14754. if (hdr & 1) {
  14755. this.eof = true;
  14756. }
  14757. hdr >>= 1;
  14758. if (hdr === 0) {
  14759. let b;
  14760. if ((b = str.getByte()) === -1) {
  14761. throw new _util.FormatError("Bad block header in flate stream");
  14762. }
  14763. let blockLen = b;
  14764. if ((b = str.getByte()) === -1) {
  14765. throw new _util.FormatError("Bad block header in flate stream");
  14766. }
  14767. blockLen |= b << 8;
  14768. if ((b = str.getByte()) === -1) {
  14769. throw new _util.FormatError("Bad block header in flate stream");
  14770. }
  14771. let check = b;
  14772. if ((b = str.getByte()) === -1) {
  14773. throw new _util.FormatError("Bad block header in flate stream");
  14774. }
  14775. check |= b << 8;
  14776. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  14777. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  14778. }
  14779. this.codeBuf = 0;
  14780. this.codeSize = 0;
  14781. const bufferLength = this.bufferLength,
  14782. end = bufferLength + blockLen;
  14783. buffer = this.ensureBuffer(end);
  14784. this.bufferLength = end;
  14785. if (blockLen === 0) {
  14786. if (str.peekByte() === -1) {
  14787. this.eof = true;
  14788. }
  14789. } else {
  14790. const block = str.getBytes(blockLen);
  14791. buffer.set(block, bufferLength);
  14792. if (block.length < blockLen) {
  14793. this.eof = true;
  14794. }
  14795. }
  14796. return;
  14797. }
  14798. let litCodeTable;
  14799. let distCodeTable;
  14800. if (hdr === 1) {
  14801. litCodeTable = fixedLitCodeTab;
  14802. distCodeTable = fixedDistCodeTab;
  14803. } else if (hdr === 2) {
  14804. const numLitCodes = this.getBits(5) + 257;
  14805. const numDistCodes = this.getBits(5) + 1;
  14806. const numCodeLenCodes = this.getBits(4) + 4;
  14807. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  14808. let i;
  14809. for (i = 0; i < numCodeLenCodes; ++i) {
  14810. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  14811. }
  14812. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  14813. len = 0;
  14814. i = 0;
  14815. const codes = numLitCodes + numDistCodes;
  14816. const codeLengths = new Uint8Array(codes);
  14817. let bitsLength, bitsOffset, what;
  14818. while (i < codes) {
  14819. const code = this.getCode(codeLenCodeTab);
  14820. if (code === 16) {
  14821. bitsLength = 2;
  14822. bitsOffset = 3;
  14823. what = len;
  14824. } else if (code === 17) {
  14825. bitsLength = 3;
  14826. bitsOffset = 3;
  14827. what = len = 0;
  14828. } else if (code === 18) {
  14829. bitsLength = 7;
  14830. bitsOffset = 11;
  14831. what = len = 0;
  14832. } else {
  14833. codeLengths[i++] = len = code;
  14834. continue;
  14835. }
  14836. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  14837. while (repeatLength-- > 0) {
  14838. codeLengths[i++] = what;
  14839. }
  14840. }
  14841. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  14842. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  14843. } else {
  14844. throw new _util.FormatError("Unknown block type in flate stream");
  14845. }
  14846. buffer = this.buffer;
  14847. let limit = buffer ? buffer.length : 0;
  14848. let pos = this.bufferLength;
  14849. while (true) {
  14850. let code1 = this.getCode(litCodeTable);
  14851. if (code1 < 256) {
  14852. if (pos + 1 >= limit) {
  14853. buffer = this.ensureBuffer(pos + 1);
  14854. limit = buffer.length;
  14855. }
  14856. buffer[pos++] = code1;
  14857. continue;
  14858. }
  14859. if (code1 === 256) {
  14860. this.bufferLength = pos;
  14861. return;
  14862. }
  14863. code1 -= 257;
  14864. code1 = lengthDecode[code1];
  14865. let code2 = code1 >> 16;
  14866. if (code2 > 0) {
  14867. code2 = this.getBits(code2);
  14868. }
  14869. len = (code1 & 0xffff) + code2;
  14870. code1 = this.getCode(distCodeTable);
  14871. code1 = distDecode[code1];
  14872. code2 = code1 >> 16;
  14873. if (code2 > 0) {
  14874. code2 = this.getBits(code2);
  14875. }
  14876. const dist = (code1 & 0xffff) + code2;
  14877. if (pos + len >= limit) {
  14878. buffer = this.ensureBuffer(pos + len);
  14879. limit = buffer.length;
  14880. }
  14881. for (let k = 0; k < len; ++k, ++pos) {
  14882. buffer[pos] = buffer[pos - dist];
  14883. }
  14884. }
  14885. }
  14886. }
  14887. exports.FlateStream = FlateStream;
  14888. /***/ }),
  14889. /* 22 */
  14890. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14891. Object.defineProperty(exports, "__esModule", ({
  14892. value: true
  14893. }));
  14894. exports.Jbig2Stream = void 0;
  14895. var _base_stream = __w_pdfjs_require__(5);
  14896. var _decode_stream = __w_pdfjs_require__(17);
  14897. var _primitives = __w_pdfjs_require__(3);
  14898. var _jbig = __w_pdfjs_require__(23);
  14899. var _util = __w_pdfjs_require__(2);
  14900. class Jbig2Stream extends _decode_stream.DecodeStream {
  14901. constructor(stream, maybeLength, params) {
  14902. super(maybeLength);
  14903. this.stream = stream;
  14904. this.dict = stream.dict;
  14905. this.maybeLength = maybeLength;
  14906. this.params = params;
  14907. }
  14908. get bytes() {
  14909. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  14910. }
  14911. ensureBuffer(requested) {}
  14912. readBlock() {
  14913. if (this.eof) {
  14914. return;
  14915. }
  14916. const jbig2Image = new _jbig.Jbig2Image();
  14917. const chunks = [];
  14918. if (this.params instanceof _primitives.Dict) {
  14919. const globalsStream = this.params.get("JBIG2Globals");
  14920. if (globalsStream instanceof _base_stream.BaseStream) {
  14921. const globals = globalsStream.getBytes();
  14922. chunks.push({
  14923. data: globals,
  14924. start: 0,
  14925. end: globals.length
  14926. });
  14927. }
  14928. }
  14929. chunks.push({
  14930. data: this.bytes,
  14931. start: 0,
  14932. end: this.bytes.length
  14933. });
  14934. const data = jbig2Image.parseChunks(chunks);
  14935. const dataLength = data.length;
  14936. for (let i = 0; i < dataLength; i++) {
  14937. data[i] ^= 0xff;
  14938. }
  14939. this.buffer = data;
  14940. this.bufferLength = dataLength;
  14941. this.eof = true;
  14942. }
  14943. }
  14944. exports.Jbig2Stream = Jbig2Stream;
  14945. /***/ }),
  14946. /* 23 */
  14947. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14948. Object.defineProperty(exports, "__esModule", ({
  14949. value: true
  14950. }));
  14951. exports.Jbig2Image = void 0;
  14952. var _util = __w_pdfjs_require__(2);
  14953. var _core_utils = __w_pdfjs_require__(4);
  14954. var _arithmetic_decoder = __w_pdfjs_require__(24);
  14955. var _ccitt = __w_pdfjs_require__(20);
  14956. class Jbig2Error extends _util.BaseException {
  14957. constructor(msg) {
  14958. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  14959. }
  14960. }
  14961. class ContextCache {
  14962. getContexts(id) {
  14963. if (id in this) {
  14964. return this[id];
  14965. }
  14966. return this[id] = new Int8Array(1 << 16);
  14967. }
  14968. }
  14969. class DecodingContext {
  14970. constructor(data, start, end) {
  14971. this.data = data;
  14972. this.start = start;
  14973. this.end = end;
  14974. }
  14975. get decoder() {
  14976. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  14977. return (0, _util.shadow)(this, "decoder", decoder);
  14978. }
  14979. get contextCache() {
  14980. const cache = new ContextCache();
  14981. return (0, _util.shadow)(this, "contextCache", cache);
  14982. }
  14983. }
  14984. const MAX_INT_32 = 2 ** 31 - 1;
  14985. const MIN_INT_32 = -(2 ** 31);
  14986. function decodeInteger(contextCache, procedure, decoder) {
  14987. const contexts = contextCache.getContexts(procedure);
  14988. let prev = 1;
  14989. function readBits(length) {
  14990. let v = 0;
  14991. for (let i = 0; i < length; i++) {
  14992. const bit = decoder.readBit(contexts, prev);
  14993. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  14994. v = v << 1 | bit;
  14995. }
  14996. return v >>> 0;
  14997. }
  14998. const sign = readBits(1);
  14999. 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);
  15000. let signedValue;
  15001. if (sign === 0) {
  15002. signedValue = value;
  15003. } else if (value > 0) {
  15004. signedValue = -value;
  15005. }
  15006. if (signedValue >= MIN_INT_32 && signedValue <= MAX_INT_32) {
  15007. return signedValue;
  15008. }
  15009. return null;
  15010. }
  15011. function decodeIAID(contextCache, decoder, codeLength) {
  15012. const contexts = contextCache.getContexts("IAID");
  15013. let prev = 1;
  15014. for (let i = 0; i < codeLength; i++) {
  15015. const bit = decoder.readBit(contexts, prev);
  15016. prev = prev << 1 | bit;
  15017. }
  15018. if (codeLength < 31) {
  15019. return prev & (1 << codeLength) - 1;
  15020. }
  15021. return prev & 0x7fffffff;
  15022. }
  15023. 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"];
  15024. const CodingTemplates = [[{
  15025. x: -1,
  15026. y: -2
  15027. }, {
  15028. x: 0,
  15029. y: -2
  15030. }, {
  15031. x: 1,
  15032. y: -2
  15033. }, {
  15034. x: -2,
  15035. y: -1
  15036. }, {
  15037. x: -1,
  15038. y: -1
  15039. }, {
  15040. x: 0,
  15041. y: -1
  15042. }, {
  15043. x: 1,
  15044. y: -1
  15045. }, {
  15046. x: 2,
  15047. y: -1
  15048. }, {
  15049. x: -4,
  15050. y: 0
  15051. }, {
  15052. x: -3,
  15053. y: 0
  15054. }, {
  15055. x: -2,
  15056. y: 0
  15057. }, {
  15058. x: -1,
  15059. y: 0
  15060. }], [{
  15061. x: -1,
  15062. y: -2
  15063. }, {
  15064. x: 0,
  15065. y: -2
  15066. }, {
  15067. x: 1,
  15068. y: -2
  15069. }, {
  15070. x: 2,
  15071. y: -2
  15072. }, {
  15073. x: -2,
  15074. y: -1
  15075. }, {
  15076. x: -1,
  15077. y: -1
  15078. }, {
  15079. x: 0,
  15080. y: -1
  15081. }, {
  15082. x: 1,
  15083. y: -1
  15084. }, {
  15085. x: 2,
  15086. y: -1
  15087. }, {
  15088. x: -3,
  15089. y: 0
  15090. }, {
  15091. x: -2,
  15092. y: 0
  15093. }, {
  15094. x: -1,
  15095. y: 0
  15096. }], [{
  15097. x: -1,
  15098. y: -2
  15099. }, {
  15100. x: 0,
  15101. y: -2
  15102. }, {
  15103. x: 1,
  15104. y: -2
  15105. }, {
  15106. x: -2,
  15107. y: -1
  15108. }, {
  15109. x: -1,
  15110. y: -1
  15111. }, {
  15112. x: 0,
  15113. y: -1
  15114. }, {
  15115. x: 1,
  15116. y: -1
  15117. }, {
  15118. x: -2,
  15119. y: 0
  15120. }, {
  15121. x: -1,
  15122. y: 0
  15123. }], [{
  15124. x: -3,
  15125. y: -1
  15126. }, {
  15127. x: -2,
  15128. y: -1
  15129. }, {
  15130. x: -1,
  15131. y: -1
  15132. }, {
  15133. x: 0,
  15134. y: -1
  15135. }, {
  15136. x: 1,
  15137. y: -1
  15138. }, {
  15139. x: -4,
  15140. y: 0
  15141. }, {
  15142. x: -3,
  15143. y: 0
  15144. }, {
  15145. x: -2,
  15146. y: 0
  15147. }, {
  15148. x: -1,
  15149. y: 0
  15150. }]];
  15151. const RefinementTemplates = [{
  15152. coding: [{
  15153. x: 0,
  15154. y: -1
  15155. }, {
  15156. x: 1,
  15157. y: -1
  15158. }, {
  15159. x: -1,
  15160. y: 0
  15161. }],
  15162. reference: [{
  15163. x: 0,
  15164. y: -1
  15165. }, {
  15166. x: 1,
  15167. y: -1
  15168. }, {
  15169. x: -1,
  15170. y: 0
  15171. }, {
  15172. x: 0,
  15173. y: 0
  15174. }, {
  15175. x: 1,
  15176. y: 0
  15177. }, {
  15178. x: -1,
  15179. y: 1
  15180. }, {
  15181. x: 0,
  15182. y: 1
  15183. }, {
  15184. x: 1,
  15185. y: 1
  15186. }]
  15187. }, {
  15188. coding: [{
  15189. x: -1,
  15190. y: -1
  15191. }, {
  15192. x: 0,
  15193. y: -1
  15194. }, {
  15195. x: 1,
  15196. y: -1
  15197. }, {
  15198. x: -1,
  15199. y: 0
  15200. }],
  15201. reference: [{
  15202. x: 0,
  15203. y: -1
  15204. }, {
  15205. x: -1,
  15206. y: 0
  15207. }, {
  15208. x: 0,
  15209. y: 0
  15210. }, {
  15211. x: 1,
  15212. y: 0
  15213. }, {
  15214. x: 0,
  15215. y: 1
  15216. }, {
  15217. x: 1,
  15218. y: 1
  15219. }]
  15220. }];
  15221. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  15222. const RefinementReusedContexts = [0x0020, 0x0008];
  15223. function decodeBitmapTemplate0(width, height, decodingContext) {
  15224. const decoder = decodingContext.decoder;
  15225. const contexts = decodingContext.contextCache.getContexts("GB");
  15226. const bitmap = [];
  15227. let contextLabel, i, j, pixel, row, row1, row2;
  15228. const OLD_PIXEL_MASK = 0x7bf7;
  15229. for (i = 0; i < height; i++) {
  15230. row = bitmap[i] = new Uint8Array(width);
  15231. row1 = i < 1 ? row : bitmap[i - 1];
  15232. row2 = i < 2 ? row : bitmap[i - 2];
  15233. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  15234. for (j = 0; j < width; j++) {
  15235. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  15236. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  15237. }
  15238. }
  15239. return bitmap;
  15240. }
  15241. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  15242. if (mmr) {
  15243. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  15244. return decodeMMRBitmap(input, width, height, false);
  15245. }
  15246. 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) {
  15247. return decodeBitmapTemplate0(width, height, decodingContext);
  15248. }
  15249. const useskip = !!skip;
  15250. const template = CodingTemplates[templateIndex].concat(at);
  15251. template.sort(function (a, b) {
  15252. return a.y - b.y || a.x - b.x;
  15253. });
  15254. const templateLength = template.length;
  15255. const templateX = new Int8Array(templateLength);
  15256. const templateY = new Int8Array(templateLength);
  15257. const changingTemplateEntries = [];
  15258. let reuseMask = 0,
  15259. minX = 0,
  15260. maxX = 0,
  15261. minY = 0;
  15262. let c, k;
  15263. for (k = 0; k < templateLength; k++) {
  15264. templateX[k] = template[k].x;
  15265. templateY[k] = template[k].y;
  15266. minX = Math.min(minX, template[k].x);
  15267. maxX = Math.max(maxX, template[k].x);
  15268. minY = Math.min(minY, template[k].y);
  15269. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  15270. reuseMask |= 1 << templateLength - 1 - k;
  15271. } else {
  15272. changingTemplateEntries.push(k);
  15273. }
  15274. }
  15275. const changingEntriesLength = changingTemplateEntries.length;
  15276. const changingTemplateX = new Int8Array(changingEntriesLength);
  15277. const changingTemplateY = new Int8Array(changingEntriesLength);
  15278. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  15279. for (c = 0; c < changingEntriesLength; c++) {
  15280. k = changingTemplateEntries[c];
  15281. changingTemplateX[c] = template[k].x;
  15282. changingTemplateY[c] = template[k].y;
  15283. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  15284. }
  15285. const sbb_left = -minX;
  15286. const sbb_top = -minY;
  15287. const sbb_right = width - maxX;
  15288. const pseudoPixelContext = ReusedContexts[templateIndex];
  15289. let row = new Uint8Array(width);
  15290. const bitmap = [];
  15291. const decoder = decodingContext.decoder;
  15292. const contexts = decodingContext.contextCache.getContexts("GB");
  15293. let ltp = 0,
  15294. j,
  15295. i0,
  15296. j0,
  15297. contextLabel = 0,
  15298. bit,
  15299. shift;
  15300. for (let i = 0; i < height; i++) {
  15301. if (prediction) {
  15302. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  15303. ltp ^= sltp;
  15304. if (ltp) {
  15305. bitmap.push(row);
  15306. continue;
  15307. }
  15308. }
  15309. row = new Uint8Array(row);
  15310. bitmap.push(row);
  15311. for (j = 0; j < width; j++) {
  15312. if (useskip && skip[i][j]) {
  15313. row[j] = 0;
  15314. continue;
  15315. }
  15316. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  15317. contextLabel = contextLabel << 1 & reuseMask;
  15318. for (k = 0; k < changingEntriesLength; k++) {
  15319. i0 = i + changingTemplateY[k];
  15320. j0 = j + changingTemplateX[k];
  15321. bit = bitmap[i0][j0];
  15322. if (bit) {
  15323. bit = changingTemplateBit[k];
  15324. contextLabel |= bit;
  15325. }
  15326. }
  15327. } else {
  15328. contextLabel = 0;
  15329. shift = templateLength - 1;
  15330. for (k = 0; k < templateLength; k++, shift--) {
  15331. j0 = j + templateX[k];
  15332. if (j0 >= 0 && j0 < width) {
  15333. i0 = i + templateY[k];
  15334. if (i0 >= 0) {
  15335. bit = bitmap[i0][j0];
  15336. if (bit) {
  15337. contextLabel |= bit << shift;
  15338. }
  15339. }
  15340. }
  15341. }
  15342. }
  15343. const pixel = decoder.readBit(contexts, contextLabel);
  15344. row[j] = pixel;
  15345. }
  15346. }
  15347. return bitmap;
  15348. }
  15349. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  15350. let codingTemplate = RefinementTemplates[templateIndex].coding;
  15351. if (templateIndex === 0) {
  15352. codingTemplate = codingTemplate.concat([at[0]]);
  15353. }
  15354. const codingTemplateLength = codingTemplate.length;
  15355. const codingTemplateX = new Int32Array(codingTemplateLength);
  15356. const codingTemplateY = new Int32Array(codingTemplateLength);
  15357. let k;
  15358. for (k = 0; k < codingTemplateLength; k++) {
  15359. codingTemplateX[k] = codingTemplate[k].x;
  15360. codingTemplateY[k] = codingTemplate[k].y;
  15361. }
  15362. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  15363. if (templateIndex === 0) {
  15364. referenceTemplate = referenceTemplate.concat([at[1]]);
  15365. }
  15366. const referenceTemplateLength = referenceTemplate.length;
  15367. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  15368. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  15369. for (k = 0; k < referenceTemplateLength; k++) {
  15370. referenceTemplateX[k] = referenceTemplate[k].x;
  15371. referenceTemplateY[k] = referenceTemplate[k].y;
  15372. }
  15373. const referenceWidth = referenceBitmap[0].length;
  15374. const referenceHeight = referenceBitmap.length;
  15375. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  15376. const bitmap = [];
  15377. const decoder = decodingContext.decoder;
  15378. const contexts = decodingContext.contextCache.getContexts("GR");
  15379. let ltp = 0;
  15380. for (let i = 0; i < height; i++) {
  15381. if (prediction) {
  15382. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  15383. ltp ^= sltp;
  15384. if (ltp) {
  15385. throw new Jbig2Error("prediction is not supported");
  15386. }
  15387. }
  15388. const row = new Uint8Array(width);
  15389. bitmap.push(row);
  15390. for (let j = 0; j < width; j++) {
  15391. let i0, j0;
  15392. let contextLabel = 0;
  15393. for (k = 0; k < codingTemplateLength; k++) {
  15394. i0 = i + codingTemplateY[k];
  15395. j0 = j + codingTemplateX[k];
  15396. if (i0 < 0 || j0 < 0 || j0 >= width) {
  15397. contextLabel <<= 1;
  15398. } else {
  15399. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  15400. }
  15401. }
  15402. for (k = 0; k < referenceTemplateLength; k++) {
  15403. i0 = i + referenceTemplateY[k] - offsetY;
  15404. j0 = j + referenceTemplateX[k] - offsetX;
  15405. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  15406. contextLabel <<= 1;
  15407. } else {
  15408. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  15409. }
  15410. }
  15411. const pixel = decoder.readBit(contexts, contextLabel);
  15412. row[j] = pixel;
  15413. }
  15414. }
  15415. return bitmap;
  15416. }
  15417. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  15418. if (huffman && refinement) {
  15419. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  15420. }
  15421. const newSymbols = [];
  15422. let currentHeight = 0;
  15423. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  15424. const decoder = decodingContext.decoder;
  15425. const contextCache = decodingContext.contextCache;
  15426. let tableB1, symbolWidths;
  15427. if (huffman) {
  15428. tableB1 = getStandardTable(1);
  15429. symbolWidths = [];
  15430. symbolCodeLength = Math.max(symbolCodeLength, 1);
  15431. }
  15432. while (newSymbols.length < numberOfNewSymbols) {
  15433. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  15434. currentHeight += deltaHeight;
  15435. let currentWidth = 0,
  15436. totalWidth = 0;
  15437. const firstSymbol = huffman ? symbolWidths.length : 0;
  15438. while (true) {
  15439. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  15440. if (deltaWidth === null) {
  15441. break;
  15442. }
  15443. currentWidth += deltaWidth;
  15444. totalWidth += currentWidth;
  15445. let bitmap;
  15446. if (refinement) {
  15447. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  15448. if (numberOfInstances > 1) {
  15449. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  15450. } else {
  15451. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  15452. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15453. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15454. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  15455. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  15456. }
  15457. newSymbols.push(bitmap);
  15458. } else if (huffman) {
  15459. symbolWidths.push(currentWidth);
  15460. } else {
  15461. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  15462. newSymbols.push(bitmap);
  15463. }
  15464. }
  15465. if (huffman && !refinement) {
  15466. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  15467. huffmanInput.byteAlign();
  15468. let collectiveBitmap;
  15469. if (bitmapSize === 0) {
  15470. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  15471. } else {
  15472. const originalEnd = huffmanInput.end;
  15473. const bitmapEnd = huffmanInput.position + bitmapSize;
  15474. huffmanInput.end = bitmapEnd;
  15475. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  15476. huffmanInput.end = originalEnd;
  15477. huffmanInput.position = bitmapEnd;
  15478. }
  15479. const numberOfSymbolsDecoded = symbolWidths.length;
  15480. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  15481. newSymbols.push(collectiveBitmap);
  15482. } else {
  15483. let i,
  15484. y,
  15485. xMin = 0,
  15486. xMax,
  15487. bitmapWidth,
  15488. symbolBitmap;
  15489. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  15490. bitmapWidth = symbolWidths[i];
  15491. xMax = xMin + bitmapWidth;
  15492. symbolBitmap = [];
  15493. for (y = 0; y < currentHeight; y++) {
  15494. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15495. }
  15496. newSymbols.push(symbolBitmap);
  15497. xMin = xMax;
  15498. }
  15499. }
  15500. }
  15501. }
  15502. const exportedSymbols = [],
  15503. flags = [];
  15504. let currentFlag = false,
  15505. i,
  15506. ii;
  15507. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  15508. while (flags.length < totalSymbolsLength) {
  15509. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  15510. while (runLength--) {
  15511. flags.push(currentFlag);
  15512. }
  15513. currentFlag = !currentFlag;
  15514. }
  15515. for (i = 0, ii = symbols.length; i < ii; i++) {
  15516. if (flags[i]) {
  15517. exportedSymbols.push(symbols[i]);
  15518. }
  15519. }
  15520. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  15521. if (flags[i]) {
  15522. exportedSymbols.push(newSymbols[j]);
  15523. }
  15524. }
  15525. return exportedSymbols;
  15526. }
  15527. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  15528. if (huffman && refinement) {
  15529. throw new Jbig2Error("refinement with Huffman is not supported");
  15530. }
  15531. const bitmap = [];
  15532. let i, row;
  15533. for (i = 0; i < height; i++) {
  15534. row = new Uint8Array(width);
  15535. if (defaultPixelValue) {
  15536. for (let j = 0; j < width; j++) {
  15537. row[j] = defaultPixelValue;
  15538. }
  15539. }
  15540. bitmap.push(row);
  15541. }
  15542. const decoder = decodingContext.decoder;
  15543. const contextCache = decodingContext.contextCache;
  15544. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  15545. let firstS = 0;
  15546. i = 0;
  15547. while (i < numberOfSymbolInstances) {
  15548. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  15549. stripT += deltaT;
  15550. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  15551. firstS += deltaFirstS;
  15552. let currentS = firstS;
  15553. do {
  15554. let currentT = 0;
  15555. if (stripSize > 1) {
  15556. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  15557. }
  15558. const t = stripSize * stripT + currentT;
  15559. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  15560. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  15561. let symbolBitmap = inputSymbols[symbolId];
  15562. let symbolWidth = symbolBitmap[0].length;
  15563. let symbolHeight = symbolBitmap.length;
  15564. if (applyRefinement) {
  15565. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  15566. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  15567. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15568. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15569. symbolWidth += rdw;
  15570. symbolHeight += rdh;
  15571. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  15572. }
  15573. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  15574. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  15575. let s2, t2, symbolRow;
  15576. if (transposed) {
  15577. for (s2 = 0; s2 < symbolHeight; s2++) {
  15578. row = bitmap[offsetS + s2];
  15579. if (!row) {
  15580. continue;
  15581. }
  15582. symbolRow = symbolBitmap[s2];
  15583. const maxWidth = Math.min(width - offsetT, symbolWidth);
  15584. switch (combinationOperator) {
  15585. case 0:
  15586. for (t2 = 0; t2 < maxWidth; t2++) {
  15587. row[offsetT + t2] |= symbolRow[t2];
  15588. }
  15589. break;
  15590. case 2:
  15591. for (t2 = 0; t2 < maxWidth; t2++) {
  15592. row[offsetT + t2] ^= symbolRow[t2];
  15593. }
  15594. break;
  15595. default:
  15596. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15597. }
  15598. }
  15599. currentS += symbolHeight - 1;
  15600. } else {
  15601. for (t2 = 0; t2 < symbolHeight; t2++) {
  15602. row = bitmap[offsetT + t2];
  15603. if (!row) {
  15604. continue;
  15605. }
  15606. symbolRow = symbolBitmap[t2];
  15607. switch (combinationOperator) {
  15608. case 0:
  15609. for (s2 = 0; s2 < symbolWidth; s2++) {
  15610. row[offsetS + s2] |= symbolRow[s2];
  15611. }
  15612. break;
  15613. case 2:
  15614. for (s2 = 0; s2 < symbolWidth; s2++) {
  15615. row[offsetS + s2] ^= symbolRow[s2];
  15616. }
  15617. break;
  15618. default:
  15619. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15620. }
  15621. }
  15622. currentS += symbolWidth - 1;
  15623. }
  15624. i++;
  15625. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  15626. if (deltaS === null) {
  15627. break;
  15628. }
  15629. currentS += deltaS + dsOffset;
  15630. } while (true);
  15631. }
  15632. return bitmap;
  15633. }
  15634. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  15635. const at = [];
  15636. if (!mmr) {
  15637. at.push({
  15638. x: -patternWidth,
  15639. y: 0
  15640. });
  15641. if (template === 0) {
  15642. at.push({
  15643. x: -3,
  15644. y: -1
  15645. }, {
  15646. x: 2,
  15647. y: -2
  15648. }, {
  15649. x: -2,
  15650. y: -2
  15651. });
  15652. }
  15653. }
  15654. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  15655. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  15656. const patterns = [];
  15657. for (let i = 0; i <= maxPatternIndex; i++) {
  15658. const patternBitmap = [];
  15659. const xMin = patternWidth * i;
  15660. const xMax = xMin + patternWidth;
  15661. for (let y = 0; y < patternHeight; y++) {
  15662. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15663. }
  15664. patterns.push(patternBitmap);
  15665. }
  15666. return patterns;
  15667. }
  15668. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  15669. const skip = null;
  15670. if (enableSkip) {
  15671. throw new Jbig2Error("skip is not supported");
  15672. }
  15673. if (combinationOperator !== 0) {
  15674. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  15675. }
  15676. const regionBitmap = [];
  15677. let i, j, row;
  15678. for (i = 0; i < regionHeight; i++) {
  15679. row = new Uint8Array(regionWidth);
  15680. if (defaultPixelValue) {
  15681. for (j = 0; j < regionWidth; j++) {
  15682. row[j] = defaultPixelValue;
  15683. }
  15684. }
  15685. regionBitmap.push(row);
  15686. }
  15687. const numberOfPatterns = patterns.length;
  15688. const pattern0 = patterns[0];
  15689. const patternWidth = pattern0[0].length,
  15690. patternHeight = pattern0.length;
  15691. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  15692. const at = [];
  15693. if (!mmr) {
  15694. at.push({
  15695. x: template <= 1 ? 3 : 2,
  15696. y: -1
  15697. });
  15698. if (template === 0) {
  15699. at.push({
  15700. x: -3,
  15701. y: -1
  15702. }, {
  15703. x: 2,
  15704. y: -2
  15705. }, {
  15706. x: -2,
  15707. y: -2
  15708. });
  15709. }
  15710. }
  15711. const grayScaleBitPlanes = [];
  15712. let mmrInput, bitmap;
  15713. if (mmr) {
  15714. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  15715. }
  15716. for (i = bitsPerValue - 1; i >= 0; i--) {
  15717. if (mmr) {
  15718. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  15719. } else {
  15720. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  15721. }
  15722. grayScaleBitPlanes[i] = bitmap;
  15723. }
  15724. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  15725. for (mg = 0; mg < gridHeight; mg++) {
  15726. for (ng = 0; ng < gridWidth; ng++) {
  15727. bit = 0;
  15728. patternIndex = 0;
  15729. for (j = bitsPerValue - 1; j >= 0; j--) {
  15730. bit ^= grayScaleBitPlanes[j][mg][ng];
  15731. patternIndex |= bit << j;
  15732. }
  15733. patternBitmap = patterns[patternIndex];
  15734. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  15735. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  15736. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  15737. for (i = 0; i < patternHeight; i++) {
  15738. regionRow = regionBitmap[y + i];
  15739. patternRow = patternBitmap[i];
  15740. for (j = 0; j < patternWidth; j++) {
  15741. regionRow[x + j] |= patternRow[j];
  15742. }
  15743. }
  15744. } else {
  15745. let regionX, regionY;
  15746. for (i = 0; i < patternHeight; i++) {
  15747. regionY = y + i;
  15748. if (regionY < 0 || regionY >= regionHeight) {
  15749. continue;
  15750. }
  15751. regionRow = regionBitmap[regionY];
  15752. patternRow = patternBitmap[i];
  15753. for (j = 0; j < patternWidth; j++) {
  15754. regionX = x + j;
  15755. if (regionX >= 0 && regionX < regionWidth) {
  15756. regionRow[regionX] |= patternRow[j];
  15757. }
  15758. }
  15759. }
  15760. }
  15761. }
  15762. }
  15763. return regionBitmap;
  15764. }
  15765. function readSegmentHeader(data, start) {
  15766. const segmentHeader = {};
  15767. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  15768. const flags = data[start + 4];
  15769. const segmentType = flags & 0x3f;
  15770. if (!SegmentTypes[segmentType]) {
  15771. throw new Jbig2Error("invalid segment type: " + segmentType);
  15772. }
  15773. segmentHeader.type = segmentType;
  15774. segmentHeader.typeName = SegmentTypes[segmentType];
  15775. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  15776. const pageAssociationFieldSize = !!(flags & 0x40);
  15777. const referredFlags = data[start + 5];
  15778. let referredToCount = referredFlags >> 5 & 7;
  15779. const retainBits = [referredFlags & 31];
  15780. let position = start + 6;
  15781. if (referredFlags === 7) {
  15782. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  15783. position += 3;
  15784. let bytes = referredToCount + 7 >> 3;
  15785. retainBits[0] = data[position++];
  15786. while (--bytes > 0) {
  15787. retainBits.push(data[position++]);
  15788. }
  15789. } else if (referredFlags === 5 || referredFlags === 6) {
  15790. throw new Jbig2Error("invalid referred-to flags");
  15791. }
  15792. segmentHeader.retainBits = retainBits;
  15793. let referredToSegmentNumberSize = 4;
  15794. if (segmentHeader.number <= 256) {
  15795. referredToSegmentNumberSize = 1;
  15796. } else if (segmentHeader.number <= 65536) {
  15797. referredToSegmentNumberSize = 2;
  15798. }
  15799. const referredTo = [];
  15800. let i, ii;
  15801. for (i = 0; i < referredToCount; i++) {
  15802. let number;
  15803. if (referredToSegmentNumberSize === 1) {
  15804. number = data[position];
  15805. } else if (referredToSegmentNumberSize === 2) {
  15806. number = (0, _core_utils.readUint16)(data, position);
  15807. } else {
  15808. number = (0, _core_utils.readUint32)(data, position);
  15809. }
  15810. referredTo.push(number);
  15811. position += referredToSegmentNumberSize;
  15812. }
  15813. segmentHeader.referredTo = referredTo;
  15814. if (!pageAssociationFieldSize) {
  15815. segmentHeader.pageAssociation = data[position++];
  15816. } else {
  15817. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  15818. position += 4;
  15819. }
  15820. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  15821. position += 4;
  15822. if (segmentHeader.length === 0xffffffff) {
  15823. if (segmentType === 38) {
  15824. const genericRegionInfo = readRegionSegmentInformation(data, position);
  15825. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  15826. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  15827. const searchPatternLength = 6;
  15828. const searchPattern = new Uint8Array(searchPatternLength);
  15829. if (!genericRegionMmr) {
  15830. searchPattern[0] = 0xff;
  15831. searchPattern[1] = 0xac;
  15832. }
  15833. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  15834. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  15835. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  15836. searchPattern[5] = genericRegionInfo.height & 0xff;
  15837. for (i = position, ii = data.length; i < ii; i++) {
  15838. let j = 0;
  15839. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  15840. j++;
  15841. }
  15842. if (j === searchPatternLength) {
  15843. segmentHeader.length = i + searchPatternLength;
  15844. break;
  15845. }
  15846. }
  15847. if (segmentHeader.length === 0xffffffff) {
  15848. throw new Jbig2Error("segment end was not found");
  15849. }
  15850. } else {
  15851. throw new Jbig2Error("invalid unknown segment length");
  15852. }
  15853. }
  15854. segmentHeader.headerEnd = position;
  15855. return segmentHeader;
  15856. }
  15857. function readSegments(header, data, start, end) {
  15858. const segments = [];
  15859. let position = start;
  15860. while (position < end) {
  15861. const segmentHeader = readSegmentHeader(data, position);
  15862. position = segmentHeader.headerEnd;
  15863. const segment = {
  15864. header: segmentHeader,
  15865. data
  15866. };
  15867. if (!header.randomAccess) {
  15868. segment.start = position;
  15869. position += segmentHeader.length;
  15870. segment.end = position;
  15871. }
  15872. segments.push(segment);
  15873. if (segmentHeader.type === 51) {
  15874. break;
  15875. }
  15876. }
  15877. if (header.randomAccess) {
  15878. for (let i = 0, ii = segments.length; i < ii; i++) {
  15879. segments[i].start = position;
  15880. position += segments[i].header.length;
  15881. segments[i].end = position;
  15882. }
  15883. }
  15884. return segments;
  15885. }
  15886. function readRegionSegmentInformation(data, start) {
  15887. return {
  15888. width: (0, _core_utils.readUint32)(data, start),
  15889. height: (0, _core_utils.readUint32)(data, start + 4),
  15890. x: (0, _core_utils.readUint32)(data, start + 8),
  15891. y: (0, _core_utils.readUint32)(data, start + 12),
  15892. combinationOperator: data[start + 16] & 7
  15893. };
  15894. }
  15895. const RegionSegmentInformationFieldLength = 17;
  15896. function processSegment(segment, visitor) {
  15897. const header = segment.header;
  15898. const data = segment.data,
  15899. end = segment.end;
  15900. let position = segment.start;
  15901. let args, at, i, atLength;
  15902. switch (header.type) {
  15903. case 0:
  15904. const dictionary = {};
  15905. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  15906. dictionary.huffman = !!(dictionaryFlags & 1);
  15907. dictionary.refinement = !!(dictionaryFlags & 2);
  15908. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  15909. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  15910. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  15911. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  15912. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  15913. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  15914. dictionary.template = dictionaryFlags >> 10 & 3;
  15915. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  15916. position += 2;
  15917. if (!dictionary.huffman) {
  15918. atLength = dictionary.template === 0 ? 4 : 1;
  15919. at = [];
  15920. for (i = 0; i < atLength; i++) {
  15921. at.push({
  15922. x: (0, _core_utils.readInt8)(data, position),
  15923. y: (0, _core_utils.readInt8)(data, position + 1)
  15924. });
  15925. position += 2;
  15926. }
  15927. dictionary.at = at;
  15928. }
  15929. if (dictionary.refinement && !dictionary.refinementTemplate) {
  15930. at = [];
  15931. for (i = 0; i < 2; i++) {
  15932. at.push({
  15933. x: (0, _core_utils.readInt8)(data, position),
  15934. y: (0, _core_utils.readInt8)(data, position + 1)
  15935. });
  15936. position += 2;
  15937. }
  15938. dictionary.refinementAt = at;
  15939. }
  15940. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  15941. position += 4;
  15942. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  15943. position += 4;
  15944. args = [dictionary, header.number, header.referredTo, data, position, end];
  15945. break;
  15946. case 6:
  15947. case 7:
  15948. const textRegion = {};
  15949. textRegion.info = readRegionSegmentInformation(data, position);
  15950. position += RegionSegmentInformationFieldLength;
  15951. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  15952. position += 2;
  15953. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  15954. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  15955. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  15956. textRegion.stripSize = 1 << textRegion.logStripSize;
  15957. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  15958. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  15959. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  15960. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  15961. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  15962. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  15963. if (textRegion.huffman) {
  15964. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  15965. position += 2;
  15966. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  15967. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  15968. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  15969. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  15970. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  15971. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  15972. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  15973. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  15974. }
  15975. if (textRegion.refinement && !textRegion.refinementTemplate) {
  15976. at = [];
  15977. for (i = 0; i < 2; i++) {
  15978. at.push({
  15979. x: (0, _core_utils.readInt8)(data, position),
  15980. y: (0, _core_utils.readInt8)(data, position + 1)
  15981. });
  15982. position += 2;
  15983. }
  15984. textRegion.refinementAt = at;
  15985. }
  15986. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  15987. position += 4;
  15988. args = [textRegion, header.referredTo, data, position, end];
  15989. break;
  15990. case 16:
  15991. const patternDictionary = {};
  15992. const patternDictionaryFlags = data[position++];
  15993. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  15994. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  15995. patternDictionary.patternWidth = data[position++];
  15996. patternDictionary.patternHeight = data[position++];
  15997. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  15998. position += 4;
  15999. args = [patternDictionary, header.number, data, position, end];
  16000. break;
  16001. case 22:
  16002. case 23:
  16003. const halftoneRegion = {};
  16004. halftoneRegion.info = readRegionSegmentInformation(data, position);
  16005. position += RegionSegmentInformationFieldLength;
  16006. const halftoneRegionFlags = data[position++];
  16007. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  16008. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  16009. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  16010. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  16011. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  16012. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  16013. position += 4;
  16014. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  16015. position += 4;
  16016. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  16017. position += 4;
  16018. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  16019. position += 4;
  16020. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  16021. position += 2;
  16022. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  16023. position += 2;
  16024. args = [halftoneRegion, header.referredTo, data, position, end];
  16025. break;
  16026. case 38:
  16027. case 39:
  16028. const genericRegion = {};
  16029. genericRegion.info = readRegionSegmentInformation(data, position);
  16030. position += RegionSegmentInformationFieldLength;
  16031. const genericRegionSegmentFlags = data[position++];
  16032. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  16033. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  16034. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  16035. if (!genericRegion.mmr) {
  16036. atLength = genericRegion.template === 0 ? 4 : 1;
  16037. at = [];
  16038. for (i = 0; i < atLength; i++) {
  16039. at.push({
  16040. x: (0, _core_utils.readInt8)(data, position),
  16041. y: (0, _core_utils.readInt8)(data, position + 1)
  16042. });
  16043. position += 2;
  16044. }
  16045. genericRegion.at = at;
  16046. }
  16047. args = [genericRegion, data, position, end];
  16048. break;
  16049. case 48:
  16050. const pageInfo = {
  16051. width: (0, _core_utils.readUint32)(data, position),
  16052. height: (0, _core_utils.readUint32)(data, position + 4),
  16053. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  16054. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  16055. };
  16056. if (pageInfo.height === 0xffffffff) {
  16057. delete pageInfo.height;
  16058. }
  16059. const pageSegmentFlags = data[position + 16];
  16060. (0, _core_utils.readUint16)(data, position + 17);
  16061. pageInfo.lossless = !!(pageSegmentFlags & 1);
  16062. pageInfo.refinement = !!(pageSegmentFlags & 2);
  16063. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  16064. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  16065. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  16066. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  16067. args = [pageInfo];
  16068. break;
  16069. case 49:
  16070. break;
  16071. case 50:
  16072. break;
  16073. case 51:
  16074. break;
  16075. case 53:
  16076. args = [header.number, data, position, end];
  16077. break;
  16078. case 62:
  16079. break;
  16080. default:
  16081. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  16082. }
  16083. const callbackName = "on" + header.typeName;
  16084. if (callbackName in visitor) {
  16085. visitor[callbackName].apply(visitor, args);
  16086. }
  16087. }
  16088. function processSegments(segments, visitor) {
  16089. for (let i = 0, ii = segments.length; i < ii; i++) {
  16090. processSegment(segments[i], visitor);
  16091. }
  16092. }
  16093. function parseJbig2Chunks(chunks) {
  16094. const visitor = new SimpleSegmentVisitor();
  16095. for (let i = 0, ii = chunks.length; i < ii; i++) {
  16096. const chunk = chunks[i];
  16097. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  16098. processSegments(segments, visitor);
  16099. }
  16100. return visitor.buffer;
  16101. }
  16102. function parseJbig2(data) {
  16103. throw new Error("Not implemented: parseJbig2");
  16104. }
  16105. class SimpleSegmentVisitor {
  16106. onPageInformation(info) {
  16107. this.currentPageInfo = info;
  16108. const rowSize = info.width + 7 >> 3;
  16109. const buffer = new Uint8ClampedArray(rowSize * info.height);
  16110. if (info.defaultPixelValue) {
  16111. buffer.fill(0xff);
  16112. }
  16113. this.buffer = buffer;
  16114. }
  16115. drawBitmap(regionInfo, bitmap) {
  16116. const pageInfo = this.currentPageInfo;
  16117. const width = regionInfo.width,
  16118. height = regionInfo.height;
  16119. const rowSize = pageInfo.width + 7 >> 3;
  16120. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  16121. const buffer = this.buffer;
  16122. const mask0 = 128 >> (regionInfo.x & 7);
  16123. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  16124. let i, j, mask, offset;
  16125. switch (combinationOperator) {
  16126. case 0:
  16127. for (i = 0; i < height; i++) {
  16128. mask = mask0;
  16129. offset = offset0;
  16130. for (j = 0; j < width; j++) {
  16131. if (bitmap[i][j]) {
  16132. buffer[offset] |= mask;
  16133. }
  16134. mask >>= 1;
  16135. if (!mask) {
  16136. mask = 128;
  16137. offset++;
  16138. }
  16139. }
  16140. offset0 += rowSize;
  16141. }
  16142. break;
  16143. case 2:
  16144. for (i = 0; i < height; i++) {
  16145. mask = mask0;
  16146. offset = offset0;
  16147. for (j = 0; j < width; j++) {
  16148. if (bitmap[i][j]) {
  16149. buffer[offset] ^= mask;
  16150. }
  16151. mask >>= 1;
  16152. if (!mask) {
  16153. mask = 128;
  16154. offset++;
  16155. }
  16156. }
  16157. offset0 += rowSize;
  16158. }
  16159. break;
  16160. default:
  16161. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  16162. }
  16163. }
  16164. onImmediateGenericRegion(region, data, start, end) {
  16165. const regionInfo = region.info;
  16166. const decodingContext = new DecodingContext(data, start, end);
  16167. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  16168. this.drawBitmap(regionInfo, bitmap);
  16169. }
  16170. onImmediateLosslessGenericRegion() {
  16171. this.onImmediateGenericRegion(...arguments);
  16172. }
  16173. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  16174. let huffmanTables, huffmanInput;
  16175. if (dictionary.huffman) {
  16176. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  16177. huffmanInput = new Reader(data, start, end);
  16178. }
  16179. let symbols = this.symbols;
  16180. if (!symbols) {
  16181. this.symbols = symbols = {};
  16182. }
  16183. const inputSymbols = [];
  16184. for (const referredSegment of referredSegments) {
  16185. const referredSymbols = symbols[referredSegment];
  16186. if (referredSymbols) {
  16187. inputSymbols.push(...referredSymbols);
  16188. }
  16189. }
  16190. const decodingContext = new DecodingContext(data, start, end);
  16191. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  16192. }
  16193. onImmediateTextRegion(region, referredSegments, data, start, end) {
  16194. const regionInfo = region.info;
  16195. let huffmanTables, huffmanInput;
  16196. const symbols = this.symbols;
  16197. const inputSymbols = [];
  16198. for (const referredSegment of referredSegments) {
  16199. const referredSymbols = symbols[referredSegment];
  16200. if (referredSymbols) {
  16201. inputSymbols.push(...referredSymbols);
  16202. }
  16203. }
  16204. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  16205. if (region.huffman) {
  16206. huffmanInput = new Reader(data, start, end);
  16207. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  16208. }
  16209. const decodingContext = new DecodingContext(data, start, end);
  16210. 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);
  16211. this.drawBitmap(regionInfo, bitmap);
  16212. }
  16213. onImmediateLosslessTextRegion() {
  16214. this.onImmediateTextRegion(...arguments);
  16215. }
  16216. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  16217. let patterns = this.patterns;
  16218. if (!patterns) {
  16219. this.patterns = patterns = {};
  16220. }
  16221. const decodingContext = new DecodingContext(data, start, end);
  16222. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  16223. }
  16224. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  16225. const patterns = this.patterns[referredSegments[0]];
  16226. const regionInfo = region.info;
  16227. const decodingContext = new DecodingContext(data, start, end);
  16228. 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);
  16229. this.drawBitmap(regionInfo, bitmap);
  16230. }
  16231. onImmediateLosslessHalftoneRegion() {
  16232. this.onImmediateHalftoneRegion(...arguments);
  16233. }
  16234. onTables(currentSegment, data, start, end) {
  16235. let customTables = this.customTables;
  16236. if (!customTables) {
  16237. this.customTables = customTables = {};
  16238. }
  16239. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  16240. }
  16241. }
  16242. class HuffmanLine {
  16243. constructor(lineData) {
  16244. if (lineData.length === 2) {
  16245. this.isOOB = true;
  16246. this.rangeLow = 0;
  16247. this.prefixLength = lineData[0];
  16248. this.rangeLength = 0;
  16249. this.prefixCode = lineData[1];
  16250. this.isLowerRange = false;
  16251. } else {
  16252. this.isOOB = false;
  16253. this.rangeLow = lineData[0];
  16254. this.prefixLength = lineData[1];
  16255. this.rangeLength = lineData[2];
  16256. this.prefixCode = lineData[3];
  16257. this.isLowerRange = lineData[4] === "lower";
  16258. }
  16259. }
  16260. }
  16261. class HuffmanTreeNode {
  16262. constructor(line) {
  16263. this.children = [];
  16264. if (line) {
  16265. this.isLeaf = true;
  16266. this.rangeLength = line.rangeLength;
  16267. this.rangeLow = line.rangeLow;
  16268. this.isLowerRange = line.isLowerRange;
  16269. this.isOOB = line.isOOB;
  16270. } else {
  16271. this.isLeaf = false;
  16272. }
  16273. }
  16274. buildTree(line, shift) {
  16275. const bit = line.prefixCode >> shift & 1;
  16276. if (shift <= 0) {
  16277. this.children[bit] = new HuffmanTreeNode(line);
  16278. } else {
  16279. let node = this.children[bit];
  16280. if (!node) {
  16281. this.children[bit] = node = new HuffmanTreeNode(null);
  16282. }
  16283. node.buildTree(line, shift - 1);
  16284. }
  16285. }
  16286. decodeNode(reader) {
  16287. if (this.isLeaf) {
  16288. if (this.isOOB) {
  16289. return null;
  16290. }
  16291. const htOffset = reader.readBits(this.rangeLength);
  16292. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  16293. }
  16294. const node = this.children[reader.readBit()];
  16295. if (!node) {
  16296. throw new Jbig2Error("invalid Huffman data");
  16297. }
  16298. return node.decodeNode(reader);
  16299. }
  16300. }
  16301. class HuffmanTable {
  16302. constructor(lines, prefixCodesDone) {
  16303. if (!prefixCodesDone) {
  16304. this.assignPrefixCodes(lines);
  16305. }
  16306. this.rootNode = new HuffmanTreeNode(null);
  16307. for (let i = 0, ii = lines.length; i < ii; i++) {
  16308. const line = lines[i];
  16309. if (line.prefixLength > 0) {
  16310. this.rootNode.buildTree(line, line.prefixLength - 1);
  16311. }
  16312. }
  16313. }
  16314. decode(reader) {
  16315. return this.rootNode.decodeNode(reader);
  16316. }
  16317. assignPrefixCodes(lines) {
  16318. const linesLength = lines.length;
  16319. let prefixLengthMax = 0;
  16320. for (let i = 0; i < linesLength; i++) {
  16321. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  16322. }
  16323. const histogram = new Uint32Array(prefixLengthMax + 1);
  16324. for (let i = 0; i < linesLength; i++) {
  16325. histogram[lines[i].prefixLength]++;
  16326. }
  16327. let currentLength = 1,
  16328. firstCode = 0,
  16329. currentCode,
  16330. currentTemp,
  16331. line;
  16332. histogram[0] = 0;
  16333. while (currentLength <= prefixLengthMax) {
  16334. firstCode = firstCode + histogram[currentLength - 1] << 1;
  16335. currentCode = firstCode;
  16336. currentTemp = 0;
  16337. while (currentTemp < linesLength) {
  16338. line = lines[currentTemp];
  16339. if (line.prefixLength === currentLength) {
  16340. line.prefixCode = currentCode;
  16341. currentCode++;
  16342. }
  16343. currentTemp++;
  16344. }
  16345. currentLength++;
  16346. }
  16347. }
  16348. }
  16349. function decodeTablesSegment(data, start, end) {
  16350. const flags = data[start];
  16351. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  16352. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  16353. const reader = new Reader(data, start + 9, end);
  16354. const prefixSizeBits = (flags >> 1 & 7) + 1;
  16355. const rangeSizeBits = (flags >> 4 & 7) + 1;
  16356. const lines = [];
  16357. let prefixLength,
  16358. rangeLength,
  16359. currentRangeLow = lowestValue;
  16360. do {
  16361. prefixLength = reader.readBits(prefixSizeBits);
  16362. rangeLength = reader.readBits(rangeSizeBits);
  16363. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  16364. currentRangeLow += 1 << rangeLength;
  16365. } while (currentRangeLow < highestValue);
  16366. prefixLength = reader.readBits(prefixSizeBits);
  16367. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  16368. prefixLength = reader.readBits(prefixSizeBits);
  16369. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  16370. if (flags & 1) {
  16371. prefixLength = reader.readBits(prefixSizeBits);
  16372. lines.push(new HuffmanLine([prefixLength, 0]));
  16373. }
  16374. return new HuffmanTable(lines, false);
  16375. }
  16376. const standardTablesCache = {};
  16377. function getStandardTable(number) {
  16378. let table = standardTablesCache[number];
  16379. if (table) {
  16380. return table;
  16381. }
  16382. let lines;
  16383. switch (number) {
  16384. case 1:
  16385. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  16386. break;
  16387. case 2:
  16388. 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]];
  16389. break;
  16390. case 3:
  16391. 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]];
  16392. break;
  16393. case 4:
  16394. 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]];
  16395. break;
  16396. case 5:
  16397. 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]];
  16398. break;
  16399. case 6:
  16400. 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]];
  16401. break;
  16402. case 7:
  16403. 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]];
  16404. break;
  16405. case 8:
  16406. 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]];
  16407. break;
  16408. case 9:
  16409. 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]];
  16410. break;
  16411. case 10:
  16412. 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]];
  16413. break;
  16414. case 11:
  16415. 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]];
  16416. break;
  16417. case 12:
  16418. 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]];
  16419. break;
  16420. case 13:
  16421. 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]];
  16422. break;
  16423. case 14:
  16424. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  16425. break;
  16426. case 15:
  16427. 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]];
  16428. break;
  16429. default:
  16430. throw new Jbig2Error(`standard table B.${number} does not exist`);
  16431. }
  16432. for (let i = 0, ii = lines.length; i < ii; i++) {
  16433. lines[i] = new HuffmanLine(lines[i]);
  16434. }
  16435. table = new HuffmanTable(lines, true);
  16436. standardTablesCache[number] = table;
  16437. return table;
  16438. }
  16439. class Reader {
  16440. constructor(data, start, end) {
  16441. this.data = data;
  16442. this.start = start;
  16443. this.end = end;
  16444. this.position = start;
  16445. this.shift = -1;
  16446. this.currentByte = 0;
  16447. }
  16448. readBit() {
  16449. if (this.shift < 0) {
  16450. if (this.position >= this.end) {
  16451. throw new Jbig2Error("end of data while reading bit");
  16452. }
  16453. this.currentByte = this.data[this.position++];
  16454. this.shift = 7;
  16455. }
  16456. const bit = this.currentByte >> this.shift & 1;
  16457. this.shift--;
  16458. return bit;
  16459. }
  16460. readBits(numBits) {
  16461. let result = 0,
  16462. i;
  16463. for (i = numBits - 1; i >= 0; i--) {
  16464. result |= this.readBit() << i;
  16465. }
  16466. return result;
  16467. }
  16468. byteAlign() {
  16469. this.shift = -1;
  16470. }
  16471. next() {
  16472. if (this.position >= this.end) {
  16473. return -1;
  16474. }
  16475. return this.data[this.position++];
  16476. }
  16477. }
  16478. function getCustomHuffmanTable(index, referredTo, customTables) {
  16479. let currentIndex = 0;
  16480. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  16481. const table = customTables[referredTo[i]];
  16482. if (table) {
  16483. if (index === currentIndex) {
  16484. return table;
  16485. }
  16486. currentIndex++;
  16487. }
  16488. }
  16489. throw new Jbig2Error("can't find custom Huffman table");
  16490. }
  16491. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  16492. const codes = [];
  16493. for (let i = 0; i <= 34; i++) {
  16494. const codeLength = reader.readBits(4);
  16495. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16496. }
  16497. const runCodesTable = new HuffmanTable(codes, false);
  16498. codes.length = 0;
  16499. for (let i = 0; i < numberOfSymbols;) {
  16500. const codeLength = runCodesTable.decode(reader);
  16501. if (codeLength >= 32) {
  16502. let repeatedLength, numberOfRepeats, j;
  16503. switch (codeLength) {
  16504. case 32:
  16505. if (i === 0) {
  16506. throw new Jbig2Error("no previous value in symbol ID table");
  16507. }
  16508. numberOfRepeats = reader.readBits(2) + 3;
  16509. repeatedLength = codes[i - 1].prefixLength;
  16510. break;
  16511. case 33:
  16512. numberOfRepeats = reader.readBits(3) + 3;
  16513. repeatedLength = 0;
  16514. break;
  16515. case 34:
  16516. numberOfRepeats = reader.readBits(7) + 11;
  16517. repeatedLength = 0;
  16518. break;
  16519. default:
  16520. throw new Jbig2Error("invalid code length in symbol ID table");
  16521. }
  16522. for (j = 0; j < numberOfRepeats; j++) {
  16523. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  16524. i++;
  16525. }
  16526. } else {
  16527. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16528. i++;
  16529. }
  16530. }
  16531. reader.byteAlign();
  16532. const symbolIDTable = new HuffmanTable(codes, false);
  16533. let customIndex = 0,
  16534. tableFirstS,
  16535. tableDeltaS,
  16536. tableDeltaT;
  16537. switch (textRegion.huffmanFS) {
  16538. case 0:
  16539. case 1:
  16540. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  16541. break;
  16542. case 3:
  16543. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16544. customIndex++;
  16545. break;
  16546. default:
  16547. throw new Jbig2Error("invalid Huffman FS selector");
  16548. }
  16549. switch (textRegion.huffmanDS) {
  16550. case 0:
  16551. case 1:
  16552. case 2:
  16553. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  16554. break;
  16555. case 3:
  16556. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16557. customIndex++;
  16558. break;
  16559. default:
  16560. throw new Jbig2Error("invalid Huffman DS selector");
  16561. }
  16562. switch (textRegion.huffmanDT) {
  16563. case 0:
  16564. case 1:
  16565. case 2:
  16566. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  16567. break;
  16568. case 3:
  16569. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16570. customIndex++;
  16571. break;
  16572. default:
  16573. throw new Jbig2Error("invalid Huffman DT selector");
  16574. }
  16575. if (textRegion.refinement) {
  16576. throw new Jbig2Error("refinement with Huffman is not supported");
  16577. }
  16578. return {
  16579. symbolIDTable,
  16580. tableFirstS,
  16581. tableDeltaS,
  16582. tableDeltaT
  16583. };
  16584. }
  16585. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  16586. let customIndex = 0,
  16587. tableDeltaHeight,
  16588. tableDeltaWidth;
  16589. switch (dictionary.huffmanDHSelector) {
  16590. case 0:
  16591. case 1:
  16592. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  16593. break;
  16594. case 3:
  16595. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16596. customIndex++;
  16597. break;
  16598. default:
  16599. throw new Jbig2Error("invalid Huffman DH selector");
  16600. }
  16601. switch (dictionary.huffmanDWSelector) {
  16602. case 0:
  16603. case 1:
  16604. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  16605. break;
  16606. case 3:
  16607. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16608. customIndex++;
  16609. break;
  16610. default:
  16611. throw new Jbig2Error("invalid Huffman DW selector");
  16612. }
  16613. let tableBitmapSize, tableAggregateInstances;
  16614. if (dictionary.bitmapSizeSelector) {
  16615. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16616. customIndex++;
  16617. } else {
  16618. tableBitmapSize = getStandardTable(1);
  16619. }
  16620. if (dictionary.aggregationInstancesSelector) {
  16621. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16622. } else {
  16623. tableAggregateInstances = getStandardTable(1);
  16624. }
  16625. return {
  16626. tableDeltaHeight,
  16627. tableDeltaWidth,
  16628. tableBitmapSize,
  16629. tableAggregateInstances
  16630. };
  16631. }
  16632. function readUncompressedBitmap(reader, width, height) {
  16633. const bitmap = [];
  16634. for (let y = 0; y < height; y++) {
  16635. const row = new Uint8Array(width);
  16636. bitmap.push(row);
  16637. for (let x = 0; x < width; x++) {
  16638. row[x] = reader.readBit();
  16639. }
  16640. reader.byteAlign();
  16641. }
  16642. return bitmap;
  16643. }
  16644. function decodeMMRBitmap(input, width, height, endOfBlock) {
  16645. const params = {
  16646. K: -1,
  16647. Columns: width,
  16648. Rows: height,
  16649. BlackIs1: true,
  16650. EndOfBlock: endOfBlock
  16651. };
  16652. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  16653. const bitmap = [];
  16654. let currentByte,
  16655. eof = false;
  16656. for (let y = 0; y < height; y++) {
  16657. const row = new Uint8Array(width);
  16658. bitmap.push(row);
  16659. let shift = -1;
  16660. for (let x = 0; x < width; x++) {
  16661. if (shift < 0) {
  16662. currentByte = decoder.readNextChar();
  16663. if (currentByte === -1) {
  16664. currentByte = 0;
  16665. eof = true;
  16666. }
  16667. shift = 7;
  16668. }
  16669. row[x] = currentByte >> shift & 1;
  16670. shift--;
  16671. }
  16672. }
  16673. if (endOfBlock && !eof) {
  16674. const lookForEOFLimit = 5;
  16675. for (let i = 0; i < lookForEOFLimit; i++) {
  16676. if (decoder.readNextChar() === -1) {
  16677. break;
  16678. }
  16679. }
  16680. }
  16681. return bitmap;
  16682. }
  16683. class Jbig2Image {
  16684. parseChunks(chunks) {
  16685. return parseJbig2Chunks(chunks);
  16686. }
  16687. parse(data) {
  16688. throw new Error("Not implemented: Jbig2Image.parse");
  16689. }
  16690. }
  16691. exports.Jbig2Image = Jbig2Image;
  16692. /***/ }),
  16693. /* 24 */
  16694. /***/ ((__unused_webpack_module, exports) => {
  16695. Object.defineProperty(exports, "__esModule", ({
  16696. value: true
  16697. }));
  16698. exports.ArithmeticDecoder = void 0;
  16699. const QeTable = [{
  16700. qe: 0x5601,
  16701. nmps: 1,
  16702. nlps: 1,
  16703. switchFlag: 1
  16704. }, {
  16705. qe: 0x3401,
  16706. nmps: 2,
  16707. nlps: 6,
  16708. switchFlag: 0
  16709. }, {
  16710. qe: 0x1801,
  16711. nmps: 3,
  16712. nlps: 9,
  16713. switchFlag: 0
  16714. }, {
  16715. qe: 0x0ac1,
  16716. nmps: 4,
  16717. nlps: 12,
  16718. switchFlag: 0
  16719. }, {
  16720. qe: 0x0521,
  16721. nmps: 5,
  16722. nlps: 29,
  16723. switchFlag: 0
  16724. }, {
  16725. qe: 0x0221,
  16726. nmps: 38,
  16727. nlps: 33,
  16728. switchFlag: 0
  16729. }, {
  16730. qe: 0x5601,
  16731. nmps: 7,
  16732. nlps: 6,
  16733. switchFlag: 1
  16734. }, {
  16735. qe: 0x5401,
  16736. nmps: 8,
  16737. nlps: 14,
  16738. switchFlag: 0
  16739. }, {
  16740. qe: 0x4801,
  16741. nmps: 9,
  16742. nlps: 14,
  16743. switchFlag: 0
  16744. }, {
  16745. qe: 0x3801,
  16746. nmps: 10,
  16747. nlps: 14,
  16748. switchFlag: 0
  16749. }, {
  16750. qe: 0x3001,
  16751. nmps: 11,
  16752. nlps: 17,
  16753. switchFlag: 0
  16754. }, {
  16755. qe: 0x2401,
  16756. nmps: 12,
  16757. nlps: 18,
  16758. switchFlag: 0
  16759. }, {
  16760. qe: 0x1c01,
  16761. nmps: 13,
  16762. nlps: 20,
  16763. switchFlag: 0
  16764. }, {
  16765. qe: 0x1601,
  16766. nmps: 29,
  16767. nlps: 21,
  16768. switchFlag: 0
  16769. }, {
  16770. qe: 0x5601,
  16771. nmps: 15,
  16772. nlps: 14,
  16773. switchFlag: 1
  16774. }, {
  16775. qe: 0x5401,
  16776. nmps: 16,
  16777. nlps: 14,
  16778. switchFlag: 0
  16779. }, {
  16780. qe: 0x5101,
  16781. nmps: 17,
  16782. nlps: 15,
  16783. switchFlag: 0
  16784. }, {
  16785. qe: 0x4801,
  16786. nmps: 18,
  16787. nlps: 16,
  16788. switchFlag: 0
  16789. }, {
  16790. qe: 0x3801,
  16791. nmps: 19,
  16792. nlps: 17,
  16793. switchFlag: 0
  16794. }, {
  16795. qe: 0x3401,
  16796. nmps: 20,
  16797. nlps: 18,
  16798. switchFlag: 0
  16799. }, {
  16800. qe: 0x3001,
  16801. nmps: 21,
  16802. nlps: 19,
  16803. switchFlag: 0
  16804. }, {
  16805. qe: 0x2801,
  16806. nmps: 22,
  16807. nlps: 19,
  16808. switchFlag: 0
  16809. }, {
  16810. qe: 0x2401,
  16811. nmps: 23,
  16812. nlps: 20,
  16813. switchFlag: 0
  16814. }, {
  16815. qe: 0x2201,
  16816. nmps: 24,
  16817. nlps: 21,
  16818. switchFlag: 0
  16819. }, {
  16820. qe: 0x1c01,
  16821. nmps: 25,
  16822. nlps: 22,
  16823. switchFlag: 0
  16824. }, {
  16825. qe: 0x1801,
  16826. nmps: 26,
  16827. nlps: 23,
  16828. switchFlag: 0
  16829. }, {
  16830. qe: 0x1601,
  16831. nmps: 27,
  16832. nlps: 24,
  16833. switchFlag: 0
  16834. }, {
  16835. qe: 0x1401,
  16836. nmps: 28,
  16837. nlps: 25,
  16838. switchFlag: 0
  16839. }, {
  16840. qe: 0x1201,
  16841. nmps: 29,
  16842. nlps: 26,
  16843. switchFlag: 0
  16844. }, {
  16845. qe: 0x1101,
  16846. nmps: 30,
  16847. nlps: 27,
  16848. switchFlag: 0
  16849. }, {
  16850. qe: 0x0ac1,
  16851. nmps: 31,
  16852. nlps: 28,
  16853. switchFlag: 0
  16854. }, {
  16855. qe: 0x09c1,
  16856. nmps: 32,
  16857. nlps: 29,
  16858. switchFlag: 0
  16859. }, {
  16860. qe: 0x08a1,
  16861. nmps: 33,
  16862. nlps: 30,
  16863. switchFlag: 0
  16864. }, {
  16865. qe: 0x0521,
  16866. nmps: 34,
  16867. nlps: 31,
  16868. switchFlag: 0
  16869. }, {
  16870. qe: 0x0441,
  16871. nmps: 35,
  16872. nlps: 32,
  16873. switchFlag: 0
  16874. }, {
  16875. qe: 0x02a1,
  16876. nmps: 36,
  16877. nlps: 33,
  16878. switchFlag: 0
  16879. }, {
  16880. qe: 0x0221,
  16881. nmps: 37,
  16882. nlps: 34,
  16883. switchFlag: 0
  16884. }, {
  16885. qe: 0x0141,
  16886. nmps: 38,
  16887. nlps: 35,
  16888. switchFlag: 0
  16889. }, {
  16890. qe: 0x0111,
  16891. nmps: 39,
  16892. nlps: 36,
  16893. switchFlag: 0
  16894. }, {
  16895. qe: 0x0085,
  16896. nmps: 40,
  16897. nlps: 37,
  16898. switchFlag: 0
  16899. }, {
  16900. qe: 0x0049,
  16901. nmps: 41,
  16902. nlps: 38,
  16903. switchFlag: 0
  16904. }, {
  16905. qe: 0x0025,
  16906. nmps: 42,
  16907. nlps: 39,
  16908. switchFlag: 0
  16909. }, {
  16910. qe: 0x0015,
  16911. nmps: 43,
  16912. nlps: 40,
  16913. switchFlag: 0
  16914. }, {
  16915. qe: 0x0009,
  16916. nmps: 44,
  16917. nlps: 41,
  16918. switchFlag: 0
  16919. }, {
  16920. qe: 0x0005,
  16921. nmps: 45,
  16922. nlps: 42,
  16923. switchFlag: 0
  16924. }, {
  16925. qe: 0x0001,
  16926. nmps: 45,
  16927. nlps: 43,
  16928. switchFlag: 0
  16929. }, {
  16930. qe: 0x5601,
  16931. nmps: 46,
  16932. nlps: 46,
  16933. switchFlag: 0
  16934. }];
  16935. class ArithmeticDecoder {
  16936. constructor(data, start, end) {
  16937. this.data = data;
  16938. this.bp = start;
  16939. this.dataEnd = end;
  16940. this.chigh = data[start];
  16941. this.clow = 0;
  16942. this.byteIn();
  16943. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  16944. this.clow = this.clow << 7 & 0xffff;
  16945. this.ct -= 7;
  16946. this.a = 0x8000;
  16947. }
  16948. byteIn() {
  16949. const data = this.data;
  16950. let bp = this.bp;
  16951. if (data[bp] === 0xff) {
  16952. if (data[bp + 1] > 0x8f) {
  16953. this.clow += 0xff00;
  16954. this.ct = 8;
  16955. } else {
  16956. bp++;
  16957. this.clow += data[bp] << 9;
  16958. this.ct = 7;
  16959. this.bp = bp;
  16960. }
  16961. } else {
  16962. bp++;
  16963. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  16964. this.ct = 8;
  16965. this.bp = bp;
  16966. }
  16967. if (this.clow > 0xffff) {
  16968. this.chigh += this.clow >> 16;
  16969. this.clow &= 0xffff;
  16970. }
  16971. }
  16972. readBit(contexts, pos) {
  16973. let cx_index = contexts[pos] >> 1,
  16974. cx_mps = contexts[pos] & 1;
  16975. const qeTableIcx = QeTable[cx_index];
  16976. const qeIcx = qeTableIcx.qe;
  16977. let d;
  16978. let a = this.a - qeIcx;
  16979. if (this.chigh < qeIcx) {
  16980. if (a < qeIcx) {
  16981. a = qeIcx;
  16982. d = cx_mps;
  16983. cx_index = qeTableIcx.nmps;
  16984. } else {
  16985. a = qeIcx;
  16986. d = 1 ^ cx_mps;
  16987. if (qeTableIcx.switchFlag === 1) {
  16988. cx_mps = d;
  16989. }
  16990. cx_index = qeTableIcx.nlps;
  16991. }
  16992. } else {
  16993. this.chigh -= qeIcx;
  16994. if ((a & 0x8000) !== 0) {
  16995. this.a = a;
  16996. return cx_mps;
  16997. }
  16998. if (a < qeIcx) {
  16999. d = 1 ^ cx_mps;
  17000. if (qeTableIcx.switchFlag === 1) {
  17001. cx_mps = d;
  17002. }
  17003. cx_index = qeTableIcx.nlps;
  17004. } else {
  17005. d = cx_mps;
  17006. cx_index = qeTableIcx.nmps;
  17007. }
  17008. }
  17009. do {
  17010. if (this.ct === 0) {
  17011. this.byteIn();
  17012. }
  17013. a <<= 1;
  17014. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  17015. this.clow = this.clow << 1 & 0xffff;
  17016. this.ct--;
  17017. } while ((a & 0x8000) === 0);
  17018. this.a = a;
  17019. contexts[pos] = cx_index << 1 | cx_mps;
  17020. return d;
  17021. }
  17022. }
  17023. exports.ArithmeticDecoder = ArithmeticDecoder;
  17024. /***/ }),
  17025. /* 25 */
  17026. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17027. Object.defineProperty(exports, "__esModule", ({
  17028. value: true
  17029. }));
  17030. exports.JpegStream = void 0;
  17031. var _decode_stream = __w_pdfjs_require__(17);
  17032. var _primitives = __w_pdfjs_require__(3);
  17033. var _jpg = __w_pdfjs_require__(26);
  17034. var _util = __w_pdfjs_require__(2);
  17035. class JpegStream extends _decode_stream.DecodeStream {
  17036. constructor(stream, maybeLength, params) {
  17037. let ch;
  17038. while ((ch = stream.getByte()) !== -1) {
  17039. if (ch === 0xff) {
  17040. stream.skip(-1);
  17041. break;
  17042. }
  17043. }
  17044. super(maybeLength);
  17045. this.stream = stream;
  17046. this.dict = stream.dict;
  17047. this.maybeLength = maybeLength;
  17048. this.params = params;
  17049. }
  17050. get bytes() {
  17051. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  17052. }
  17053. ensureBuffer(requested) {}
  17054. readBlock() {
  17055. if (this.eof) {
  17056. return;
  17057. }
  17058. const jpegOptions = {
  17059. decodeTransform: undefined,
  17060. colorTransform: undefined
  17061. };
  17062. const decodeArr = this.dict.getArray("D", "Decode");
  17063. if (this.forceRGB && Array.isArray(decodeArr)) {
  17064. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  17065. const decodeArrLength = decodeArr.length;
  17066. const transform = new Int32Array(decodeArrLength);
  17067. let transformNeeded = false;
  17068. const maxValue = (1 << bitsPerComponent) - 1;
  17069. for (let i = 0; i < decodeArrLength; i += 2) {
  17070. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  17071. transform[i + 1] = decodeArr[i] * maxValue | 0;
  17072. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  17073. transformNeeded = true;
  17074. }
  17075. }
  17076. if (transformNeeded) {
  17077. jpegOptions.decodeTransform = transform;
  17078. }
  17079. }
  17080. if (this.params instanceof _primitives.Dict) {
  17081. const colorTransform = this.params.get("ColorTransform");
  17082. if (Number.isInteger(colorTransform)) {
  17083. jpegOptions.colorTransform = colorTransform;
  17084. }
  17085. }
  17086. const jpegImage = new _jpg.JpegImage(jpegOptions);
  17087. jpegImage.parse(this.bytes);
  17088. const data = jpegImage.getData({
  17089. width: this.drawWidth,
  17090. height: this.drawHeight,
  17091. forceRGB: this.forceRGB,
  17092. isSourcePDF: true
  17093. });
  17094. this.buffer = data;
  17095. this.bufferLength = data.length;
  17096. this.eof = true;
  17097. }
  17098. }
  17099. exports.JpegStream = JpegStream;
  17100. /***/ }),
  17101. /* 26 */
  17102. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17103. Object.defineProperty(exports, "__esModule", ({
  17104. value: true
  17105. }));
  17106. exports.JpegImage = void 0;
  17107. var _util = __w_pdfjs_require__(2);
  17108. var _core_utils = __w_pdfjs_require__(4);
  17109. class JpegError extends _util.BaseException {
  17110. constructor(msg) {
  17111. super(`JPEG error: ${msg}`, "JpegError");
  17112. }
  17113. }
  17114. class DNLMarkerError extends _util.BaseException {
  17115. constructor(message, scanLines) {
  17116. super(message, "DNLMarkerError");
  17117. this.scanLines = scanLines;
  17118. }
  17119. }
  17120. class EOIMarkerError extends _util.BaseException {
  17121. constructor(msg) {
  17122. super(msg, "EOIMarkerError");
  17123. }
  17124. }
  17125. 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]);
  17126. const dctCos1 = 4017;
  17127. const dctSin1 = 799;
  17128. const dctCos3 = 3406;
  17129. const dctSin3 = 2276;
  17130. const dctCos6 = 1567;
  17131. const dctSin6 = 3784;
  17132. const dctSqrt2 = 5793;
  17133. const dctSqrt1d2 = 2896;
  17134. function buildHuffmanTable(codeLengths, values) {
  17135. let k = 0,
  17136. i,
  17137. j,
  17138. length = 16;
  17139. while (length > 0 && !codeLengths[length - 1]) {
  17140. length--;
  17141. }
  17142. const code = [{
  17143. children: [],
  17144. index: 0
  17145. }];
  17146. let p = code[0],
  17147. q;
  17148. for (i = 0; i < length; i++) {
  17149. for (j = 0; j < codeLengths[i]; j++) {
  17150. p = code.pop();
  17151. p.children[p.index] = values[k];
  17152. while (p.index > 0) {
  17153. p = code.pop();
  17154. }
  17155. p.index++;
  17156. code.push(p);
  17157. while (code.length <= i) {
  17158. code.push(q = {
  17159. children: [],
  17160. index: 0
  17161. });
  17162. p.children[p.index] = q.children;
  17163. p = q;
  17164. }
  17165. k++;
  17166. }
  17167. if (i + 1 < length) {
  17168. code.push(q = {
  17169. children: [],
  17170. index: 0
  17171. });
  17172. p.children[p.index] = q.children;
  17173. p = q;
  17174. }
  17175. }
  17176. return code[0].children;
  17177. }
  17178. function getBlockBufferOffset(component, row, col) {
  17179. return 64 * ((component.blocksPerLine + 1) * row + col);
  17180. }
  17181. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  17182. const mcusPerLine = frame.mcusPerLine;
  17183. const progressive = frame.progressive;
  17184. const startOffset = offset;
  17185. let bitsData = 0,
  17186. bitsCount = 0;
  17187. function readBit() {
  17188. if (bitsCount > 0) {
  17189. bitsCount--;
  17190. return bitsData >> bitsCount & 1;
  17191. }
  17192. bitsData = data[offset++];
  17193. if (bitsData === 0xff) {
  17194. const nextByte = data[offset++];
  17195. if (nextByte) {
  17196. if (nextByte === 0xdc && parseDNLMarker) {
  17197. offset += 2;
  17198. const scanLines = (0, _core_utils.readUint16)(data, offset);
  17199. offset += 2;
  17200. if (scanLines > 0 && scanLines !== frame.scanLines) {
  17201. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  17202. }
  17203. } else if (nextByte === 0xd9) {
  17204. if (parseDNLMarker) {
  17205. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  17206. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  17207. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  17208. }
  17209. }
  17210. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  17211. }
  17212. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  17213. }
  17214. }
  17215. bitsCount = 7;
  17216. return bitsData >>> 7;
  17217. }
  17218. function decodeHuffman(tree) {
  17219. let node = tree;
  17220. while (true) {
  17221. node = node[readBit()];
  17222. switch (typeof node) {
  17223. case "number":
  17224. return node;
  17225. case "object":
  17226. continue;
  17227. }
  17228. throw new JpegError("invalid huffman sequence");
  17229. }
  17230. }
  17231. function receive(length) {
  17232. let n = 0;
  17233. while (length > 0) {
  17234. n = n << 1 | readBit();
  17235. length--;
  17236. }
  17237. return n;
  17238. }
  17239. function receiveAndExtend(length) {
  17240. if (length === 1) {
  17241. return readBit() === 1 ? 1 : -1;
  17242. }
  17243. const n = receive(length);
  17244. if (n >= 1 << length - 1) {
  17245. return n;
  17246. }
  17247. return n + (-1 << length) + 1;
  17248. }
  17249. function decodeBaseline(component, blockOffset) {
  17250. const t = decodeHuffman(component.huffmanTableDC);
  17251. const diff = t === 0 ? 0 : receiveAndExtend(t);
  17252. component.blockData[blockOffset] = component.pred += diff;
  17253. let k = 1;
  17254. while (k < 64) {
  17255. const rs = decodeHuffman(component.huffmanTableAC);
  17256. const s = rs & 15,
  17257. r = rs >> 4;
  17258. if (s === 0) {
  17259. if (r < 15) {
  17260. break;
  17261. }
  17262. k += 16;
  17263. continue;
  17264. }
  17265. k += r;
  17266. const z = dctZigZag[k];
  17267. component.blockData[blockOffset + z] = receiveAndExtend(s);
  17268. k++;
  17269. }
  17270. }
  17271. function decodeDCFirst(component, blockOffset) {
  17272. const t = decodeHuffman(component.huffmanTableDC);
  17273. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  17274. component.blockData[blockOffset] = component.pred += diff;
  17275. }
  17276. function decodeDCSuccessive(component, blockOffset) {
  17277. component.blockData[blockOffset] |= readBit() << successive;
  17278. }
  17279. let eobrun = 0;
  17280. function decodeACFirst(component, blockOffset) {
  17281. if (eobrun > 0) {
  17282. eobrun--;
  17283. return;
  17284. }
  17285. let k = spectralStart;
  17286. const e = spectralEnd;
  17287. while (k <= e) {
  17288. const rs = decodeHuffman(component.huffmanTableAC);
  17289. const s = rs & 15,
  17290. r = rs >> 4;
  17291. if (s === 0) {
  17292. if (r < 15) {
  17293. eobrun = receive(r) + (1 << r) - 1;
  17294. break;
  17295. }
  17296. k += 16;
  17297. continue;
  17298. }
  17299. k += r;
  17300. const z = dctZigZag[k];
  17301. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  17302. k++;
  17303. }
  17304. }
  17305. let successiveACState = 0,
  17306. successiveACNextValue;
  17307. function decodeACSuccessive(component, blockOffset) {
  17308. let k = spectralStart;
  17309. const e = spectralEnd;
  17310. let r = 0;
  17311. let s;
  17312. let rs;
  17313. while (k <= e) {
  17314. const offsetZ = blockOffset + dctZigZag[k];
  17315. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  17316. switch (successiveACState) {
  17317. case 0:
  17318. rs = decodeHuffman(component.huffmanTableAC);
  17319. s = rs & 15;
  17320. r = rs >> 4;
  17321. if (s === 0) {
  17322. if (r < 15) {
  17323. eobrun = receive(r) + (1 << r);
  17324. successiveACState = 4;
  17325. } else {
  17326. r = 16;
  17327. successiveACState = 1;
  17328. }
  17329. } else {
  17330. if (s !== 1) {
  17331. throw new JpegError("invalid ACn encoding");
  17332. }
  17333. successiveACNextValue = receiveAndExtend(s);
  17334. successiveACState = r ? 2 : 3;
  17335. }
  17336. continue;
  17337. case 1:
  17338. case 2:
  17339. if (component.blockData[offsetZ]) {
  17340. component.blockData[offsetZ] += sign * (readBit() << successive);
  17341. } else {
  17342. r--;
  17343. if (r === 0) {
  17344. successiveACState = successiveACState === 2 ? 3 : 0;
  17345. }
  17346. }
  17347. break;
  17348. case 3:
  17349. if (component.blockData[offsetZ]) {
  17350. component.blockData[offsetZ] += sign * (readBit() << successive);
  17351. } else {
  17352. component.blockData[offsetZ] = successiveACNextValue << successive;
  17353. successiveACState = 0;
  17354. }
  17355. break;
  17356. case 4:
  17357. if (component.blockData[offsetZ]) {
  17358. component.blockData[offsetZ] += sign * (readBit() << successive);
  17359. }
  17360. break;
  17361. }
  17362. k++;
  17363. }
  17364. if (successiveACState === 4) {
  17365. eobrun--;
  17366. if (eobrun === 0) {
  17367. successiveACState = 0;
  17368. }
  17369. }
  17370. }
  17371. let blockRow = 0;
  17372. function decodeMcu(component, decode, mcu, row, col) {
  17373. const mcuRow = mcu / mcusPerLine | 0;
  17374. const mcuCol = mcu % mcusPerLine;
  17375. blockRow = mcuRow * component.v + row;
  17376. const blockCol = mcuCol * component.h + col;
  17377. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17378. decode(component, blockOffset);
  17379. }
  17380. function decodeBlock(component, decode, mcu) {
  17381. blockRow = mcu / component.blocksPerLine | 0;
  17382. const blockCol = mcu % component.blocksPerLine;
  17383. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17384. decode(component, blockOffset);
  17385. }
  17386. const componentsLength = components.length;
  17387. let component, i, j, k, n;
  17388. let decodeFn;
  17389. if (progressive) {
  17390. if (spectralStart === 0) {
  17391. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  17392. } else {
  17393. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  17394. }
  17395. } else {
  17396. decodeFn = decodeBaseline;
  17397. }
  17398. let mcu = 0,
  17399. fileMarker;
  17400. let mcuExpected;
  17401. if (componentsLength === 1) {
  17402. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  17403. } else {
  17404. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  17405. }
  17406. let h, v;
  17407. while (mcu <= mcuExpected) {
  17408. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  17409. if (mcuToRead > 0) {
  17410. for (i = 0; i < componentsLength; i++) {
  17411. components[i].pred = 0;
  17412. }
  17413. eobrun = 0;
  17414. if (componentsLength === 1) {
  17415. component = components[0];
  17416. for (n = 0; n < mcuToRead; n++) {
  17417. decodeBlock(component, decodeFn, mcu);
  17418. mcu++;
  17419. }
  17420. } else {
  17421. for (n = 0; n < mcuToRead; n++) {
  17422. for (i = 0; i < componentsLength; i++) {
  17423. component = components[i];
  17424. h = component.h;
  17425. v = component.v;
  17426. for (j = 0; j < v; j++) {
  17427. for (k = 0; k < h; k++) {
  17428. decodeMcu(component, decodeFn, mcu, j, k);
  17429. }
  17430. }
  17431. }
  17432. mcu++;
  17433. }
  17434. }
  17435. }
  17436. bitsCount = 0;
  17437. fileMarker = findNextFileMarker(data, offset);
  17438. if (!fileMarker) {
  17439. break;
  17440. }
  17441. if (fileMarker.invalid) {
  17442. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  17443. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  17444. offset = fileMarker.offset;
  17445. }
  17446. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  17447. offset += 2;
  17448. } else {
  17449. break;
  17450. }
  17451. }
  17452. return offset - startOffset;
  17453. }
  17454. function quantizeAndInverse(component, blockBufferOffset, p) {
  17455. const qt = component.quantizationTable,
  17456. blockData = component.blockData;
  17457. let v0, v1, v2, v3, v4, v5, v6, v7;
  17458. let p0, p1, p2, p3, p4, p5, p6, p7;
  17459. let t;
  17460. if (!qt) {
  17461. throw new JpegError("missing required Quantization Table.");
  17462. }
  17463. for (let row = 0; row < 64; row += 8) {
  17464. p0 = blockData[blockBufferOffset + row];
  17465. p1 = blockData[blockBufferOffset + row + 1];
  17466. p2 = blockData[blockBufferOffset + row + 2];
  17467. p3 = blockData[blockBufferOffset + row + 3];
  17468. p4 = blockData[blockBufferOffset + row + 4];
  17469. p5 = blockData[blockBufferOffset + row + 5];
  17470. p6 = blockData[blockBufferOffset + row + 6];
  17471. p7 = blockData[blockBufferOffset + row + 7];
  17472. p0 *= qt[row];
  17473. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17474. t = dctSqrt2 * p0 + 512 >> 10;
  17475. p[row] = t;
  17476. p[row + 1] = t;
  17477. p[row + 2] = t;
  17478. p[row + 3] = t;
  17479. p[row + 4] = t;
  17480. p[row + 5] = t;
  17481. p[row + 6] = t;
  17482. p[row + 7] = t;
  17483. continue;
  17484. }
  17485. p1 *= qt[row + 1];
  17486. p2 *= qt[row + 2];
  17487. p3 *= qt[row + 3];
  17488. p4 *= qt[row + 4];
  17489. p5 *= qt[row + 5];
  17490. p6 *= qt[row + 6];
  17491. p7 *= qt[row + 7];
  17492. v0 = dctSqrt2 * p0 + 128 >> 8;
  17493. v1 = dctSqrt2 * p4 + 128 >> 8;
  17494. v2 = p2;
  17495. v3 = p6;
  17496. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  17497. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  17498. v5 = p3 << 4;
  17499. v6 = p5 << 4;
  17500. v0 = v0 + v1 + 1 >> 1;
  17501. v1 = v0 - v1;
  17502. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  17503. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  17504. v3 = t;
  17505. v4 = v4 + v6 + 1 >> 1;
  17506. v6 = v4 - v6;
  17507. v7 = v7 + v5 + 1 >> 1;
  17508. v5 = v7 - v5;
  17509. v0 = v0 + v3 + 1 >> 1;
  17510. v3 = v0 - v3;
  17511. v1 = v1 + v2 + 1 >> 1;
  17512. v2 = v1 - v2;
  17513. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17514. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17515. v7 = t;
  17516. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17517. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17518. v6 = t;
  17519. p[row] = v0 + v7;
  17520. p[row + 7] = v0 - v7;
  17521. p[row + 1] = v1 + v6;
  17522. p[row + 6] = v1 - v6;
  17523. p[row + 2] = v2 + v5;
  17524. p[row + 5] = v2 - v5;
  17525. p[row + 3] = v3 + v4;
  17526. p[row + 4] = v3 - v4;
  17527. }
  17528. for (let col = 0; col < 8; ++col) {
  17529. p0 = p[col];
  17530. p1 = p[col + 8];
  17531. p2 = p[col + 16];
  17532. p3 = p[col + 24];
  17533. p4 = p[col + 32];
  17534. p5 = p[col + 40];
  17535. p6 = p[col + 48];
  17536. p7 = p[col + 56];
  17537. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17538. t = dctSqrt2 * p0 + 8192 >> 14;
  17539. if (t < -2040) {
  17540. t = 0;
  17541. } else if (t >= 2024) {
  17542. t = 255;
  17543. } else {
  17544. t = t + 2056 >> 4;
  17545. }
  17546. blockData[blockBufferOffset + col] = t;
  17547. blockData[blockBufferOffset + col + 8] = t;
  17548. blockData[blockBufferOffset + col + 16] = t;
  17549. blockData[blockBufferOffset + col + 24] = t;
  17550. blockData[blockBufferOffset + col + 32] = t;
  17551. blockData[blockBufferOffset + col + 40] = t;
  17552. blockData[blockBufferOffset + col + 48] = t;
  17553. blockData[blockBufferOffset + col + 56] = t;
  17554. continue;
  17555. }
  17556. v0 = dctSqrt2 * p0 + 2048 >> 12;
  17557. v1 = dctSqrt2 * p4 + 2048 >> 12;
  17558. v2 = p2;
  17559. v3 = p6;
  17560. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  17561. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  17562. v5 = p3;
  17563. v6 = p5;
  17564. v0 = (v0 + v1 + 1 >> 1) + 4112;
  17565. v1 = v0 - v1;
  17566. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  17567. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  17568. v3 = t;
  17569. v4 = v4 + v6 + 1 >> 1;
  17570. v6 = v4 - v6;
  17571. v7 = v7 + v5 + 1 >> 1;
  17572. v5 = v7 - v5;
  17573. v0 = v0 + v3 + 1 >> 1;
  17574. v3 = v0 - v3;
  17575. v1 = v1 + v2 + 1 >> 1;
  17576. v2 = v1 - v2;
  17577. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17578. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17579. v7 = t;
  17580. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17581. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17582. v6 = t;
  17583. p0 = v0 + v7;
  17584. p7 = v0 - v7;
  17585. p1 = v1 + v6;
  17586. p6 = v1 - v6;
  17587. p2 = v2 + v5;
  17588. p5 = v2 - v5;
  17589. p3 = v3 + v4;
  17590. p4 = v3 - v4;
  17591. if (p0 < 16) {
  17592. p0 = 0;
  17593. } else if (p0 >= 4080) {
  17594. p0 = 255;
  17595. } else {
  17596. p0 >>= 4;
  17597. }
  17598. if (p1 < 16) {
  17599. p1 = 0;
  17600. } else if (p1 >= 4080) {
  17601. p1 = 255;
  17602. } else {
  17603. p1 >>= 4;
  17604. }
  17605. if (p2 < 16) {
  17606. p2 = 0;
  17607. } else if (p2 >= 4080) {
  17608. p2 = 255;
  17609. } else {
  17610. p2 >>= 4;
  17611. }
  17612. if (p3 < 16) {
  17613. p3 = 0;
  17614. } else if (p3 >= 4080) {
  17615. p3 = 255;
  17616. } else {
  17617. p3 >>= 4;
  17618. }
  17619. if (p4 < 16) {
  17620. p4 = 0;
  17621. } else if (p4 >= 4080) {
  17622. p4 = 255;
  17623. } else {
  17624. p4 >>= 4;
  17625. }
  17626. if (p5 < 16) {
  17627. p5 = 0;
  17628. } else if (p5 >= 4080) {
  17629. p5 = 255;
  17630. } else {
  17631. p5 >>= 4;
  17632. }
  17633. if (p6 < 16) {
  17634. p6 = 0;
  17635. } else if (p6 >= 4080) {
  17636. p6 = 255;
  17637. } else {
  17638. p6 >>= 4;
  17639. }
  17640. if (p7 < 16) {
  17641. p7 = 0;
  17642. } else if (p7 >= 4080) {
  17643. p7 = 255;
  17644. } else {
  17645. p7 >>= 4;
  17646. }
  17647. blockData[blockBufferOffset + col] = p0;
  17648. blockData[blockBufferOffset + col + 8] = p1;
  17649. blockData[blockBufferOffset + col + 16] = p2;
  17650. blockData[blockBufferOffset + col + 24] = p3;
  17651. blockData[blockBufferOffset + col + 32] = p4;
  17652. blockData[blockBufferOffset + col + 40] = p5;
  17653. blockData[blockBufferOffset + col + 48] = p6;
  17654. blockData[blockBufferOffset + col + 56] = p7;
  17655. }
  17656. }
  17657. function buildComponentData(frame, component) {
  17658. const blocksPerLine = component.blocksPerLine;
  17659. const blocksPerColumn = component.blocksPerColumn;
  17660. const computationBuffer = new Int16Array(64);
  17661. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  17662. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  17663. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  17664. quantizeAndInverse(component, offset, computationBuffer);
  17665. }
  17666. }
  17667. return component.blockData;
  17668. }
  17669. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  17670. const maxPos = data.length - 1;
  17671. let newPos = startPos < currentPos ? startPos : currentPos;
  17672. if (currentPos >= maxPos) {
  17673. return null;
  17674. }
  17675. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  17676. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  17677. return {
  17678. invalid: null,
  17679. marker: currentMarker,
  17680. offset: currentPos
  17681. };
  17682. }
  17683. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  17684. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  17685. if (++newPos >= maxPos) {
  17686. return null;
  17687. }
  17688. newMarker = (0, _core_utils.readUint16)(data, newPos);
  17689. }
  17690. return {
  17691. invalid: currentMarker.toString(16),
  17692. marker: newMarker,
  17693. offset: newPos
  17694. };
  17695. }
  17696. class JpegImage {
  17697. constructor({
  17698. decodeTransform = null,
  17699. colorTransform = -1
  17700. } = {}) {
  17701. this._decodeTransform = decodeTransform;
  17702. this._colorTransform = colorTransform;
  17703. }
  17704. parse(data, {
  17705. dnlScanLines = null
  17706. } = {}) {
  17707. function readDataBlock() {
  17708. const length = (0, _core_utils.readUint16)(data, offset);
  17709. offset += 2;
  17710. let endOffset = offset + length - 2;
  17711. const fileMarker = findNextFileMarker(data, endOffset, offset);
  17712. if (fileMarker && fileMarker.invalid) {
  17713. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  17714. endOffset = fileMarker.offset;
  17715. }
  17716. const array = data.subarray(offset, endOffset);
  17717. offset += array.length;
  17718. return array;
  17719. }
  17720. function prepareComponents(frame) {
  17721. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  17722. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  17723. for (const component of frame.components) {
  17724. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  17725. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  17726. const blocksPerLineForMcu = mcusPerLine * component.h;
  17727. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  17728. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  17729. component.blockData = new Int16Array(blocksBufferSize);
  17730. component.blocksPerLine = blocksPerLine;
  17731. component.blocksPerColumn = blocksPerColumn;
  17732. }
  17733. frame.mcusPerLine = mcusPerLine;
  17734. frame.mcusPerColumn = mcusPerColumn;
  17735. }
  17736. let offset = 0;
  17737. let jfif = null;
  17738. let adobe = null;
  17739. let frame, resetInterval;
  17740. let numSOSMarkers = 0;
  17741. const quantizationTables = [];
  17742. const huffmanTablesAC = [],
  17743. huffmanTablesDC = [];
  17744. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  17745. offset += 2;
  17746. if (fileMarker !== 0xffd8) {
  17747. throw new JpegError("SOI not found");
  17748. }
  17749. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17750. offset += 2;
  17751. markerLoop: while (fileMarker !== 0xffd9) {
  17752. let i, j, l;
  17753. switch (fileMarker) {
  17754. case 0xffe0:
  17755. case 0xffe1:
  17756. case 0xffe2:
  17757. case 0xffe3:
  17758. case 0xffe4:
  17759. case 0xffe5:
  17760. case 0xffe6:
  17761. case 0xffe7:
  17762. case 0xffe8:
  17763. case 0xffe9:
  17764. case 0xffea:
  17765. case 0xffeb:
  17766. case 0xffec:
  17767. case 0xffed:
  17768. case 0xffee:
  17769. case 0xffef:
  17770. case 0xfffe:
  17771. const appData = readDataBlock();
  17772. if (fileMarker === 0xffe0) {
  17773. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  17774. jfif = {
  17775. version: {
  17776. major: appData[5],
  17777. minor: appData[6]
  17778. },
  17779. densityUnits: appData[7],
  17780. xDensity: appData[8] << 8 | appData[9],
  17781. yDensity: appData[10] << 8 | appData[11],
  17782. thumbWidth: appData[12],
  17783. thumbHeight: appData[13],
  17784. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  17785. };
  17786. }
  17787. }
  17788. if (fileMarker === 0xffee) {
  17789. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  17790. adobe = {
  17791. version: appData[5] << 8 | appData[6],
  17792. flags0: appData[7] << 8 | appData[8],
  17793. flags1: appData[9] << 8 | appData[10],
  17794. transformCode: appData[11]
  17795. };
  17796. }
  17797. }
  17798. break;
  17799. case 0xffdb:
  17800. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  17801. offset += 2;
  17802. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  17803. let z;
  17804. while (offset < quantizationTablesEnd) {
  17805. const quantizationTableSpec = data[offset++];
  17806. const tableData = new Uint16Array(64);
  17807. if (quantizationTableSpec >> 4 === 0) {
  17808. for (j = 0; j < 64; j++) {
  17809. z = dctZigZag[j];
  17810. tableData[z] = data[offset++];
  17811. }
  17812. } else if (quantizationTableSpec >> 4 === 1) {
  17813. for (j = 0; j < 64; j++) {
  17814. z = dctZigZag[j];
  17815. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  17816. offset += 2;
  17817. }
  17818. } else {
  17819. throw new JpegError("DQT - invalid table spec");
  17820. }
  17821. quantizationTables[quantizationTableSpec & 15] = tableData;
  17822. }
  17823. break;
  17824. case 0xffc0:
  17825. case 0xffc1:
  17826. case 0xffc2:
  17827. if (frame) {
  17828. throw new JpegError("Only single frame JPEGs supported");
  17829. }
  17830. offset += 2;
  17831. frame = {};
  17832. frame.extended = fileMarker === 0xffc1;
  17833. frame.progressive = fileMarker === 0xffc2;
  17834. frame.precision = data[offset++];
  17835. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  17836. offset += 2;
  17837. frame.scanLines = dnlScanLines || sofScanLines;
  17838. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  17839. offset += 2;
  17840. frame.components = [];
  17841. frame.componentIds = {};
  17842. const componentsCount = data[offset++];
  17843. let maxH = 0,
  17844. maxV = 0;
  17845. for (i = 0; i < componentsCount; i++) {
  17846. const componentId = data[offset];
  17847. const h = data[offset + 1] >> 4;
  17848. const v = data[offset + 1] & 15;
  17849. if (maxH < h) {
  17850. maxH = h;
  17851. }
  17852. if (maxV < v) {
  17853. maxV = v;
  17854. }
  17855. const qId = data[offset + 2];
  17856. l = frame.components.push({
  17857. h,
  17858. v,
  17859. quantizationId: qId,
  17860. quantizationTable: null
  17861. });
  17862. frame.componentIds[componentId] = l - 1;
  17863. offset += 3;
  17864. }
  17865. frame.maxH = maxH;
  17866. frame.maxV = maxV;
  17867. prepareComponents(frame);
  17868. break;
  17869. case 0xffc4:
  17870. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  17871. offset += 2;
  17872. for (i = 2; i < huffmanLength;) {
  17873. const huffmanTableSpec = data[offset++];
  17874. const codeLengths = new Uint8Array(16);
  17875. let codeLengthSum = 0;
  17876. for (j = 0; j < 16; j++, offset++) {
  17877. codeLengthSum += codeLengths[j] = data[offset];
  17878. }
  17879. const huffmanValues = new Uint8Array(codeLengthSum);
  17880. for (j = 0; j < codeLengthSum; j++, offset++) {
  17881. huffmanValues[j] = data[offset];
  17882. }
  17883. i += 17 + codeLengthSum;
  17884. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  17885. }
  17886. break;
  17887. case 0xffdd:
  17888. offset += 2;
  17889. resetInterval = (0, _core_utils.readUint16)(data, offset);
  17890. offset += 2;
  17891. break;
  17892. case 0xffda:
  17893. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  17894. offset += 2;
  17895. const selectorsCount = data[offset++],
  17896. components = [];
  17897. for (i = 0; i < selectorsCount; i++) {
  17898. const index = data[offset++];
  17899. const componentIndex = frame.componentIds[index];
  17900. const component = frame.components[componentIndex];
  17901. component.index = index;
  17902. const tableSpec = data[offset++];
  17903. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  17904. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  17905. components.push(component);
  17906. }
  17907. const spectralStart = data[offset++],
  17908. spectralEnd = data[offset++],
  17909. successiveApproximation = data[offset++];
  17910. try {
  17911. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  17912. offset += processed;
  17913. } catch (ex) {
  17914. if (ex instanceof DNLMarkerError) {
  17915. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  17916. return this.parse(data, {
  17917. dnlScanLines: ex.scanLines
  17918. });
  17919. } else if (ex instanceof EOIMarkerError) {
  17920. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  17921. break markerLoop;
  17922. }
  17923. throw ex;
  17924. }
  17925. break;
  17926. case 0xffdc:
  17927. offset += 4;
  17928. break;
  17929. case 0xffff:
  17930. if (data[offset] !== 0xff) {
  17931. offset--;
  17932. }
  17933. break;
  17934. default:
  17935. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  17936. if (nextFileMarker && nextFileMarker.invalid) {
  17937. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  17938. offset = nextFileMarker.offset;
  17939. break;
  17940. }
  17941. if (!nextFileMarker || offset >= data.length - 1) {
  17942. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  17943. break markerLoop;
  17944. }
  17945. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  17946. }
  17947. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17948. offset += 2;
  17949. }
  17950. this.width = frame.samplesPerLine;
  17951. this.height = frame.scanLines;
  17952. this.jfif = jfif;
  17953. this.adobe = adobe;
  17954. this.components = [];
  17955. for (const component of frame.components) {
  17956. const quantizationTable = quantizationTables[component.quantizationId];
  17957. if (quantizationTable) {
  17958. component.quantizationTable = quantizationTable;
  17959. }
  17960. this.components.push({
  17961. index: component.index,
  17962. output: buildComponentData(frame, component),
  17963. scaleX: component.h / frame.maxH,
  17964. scaleY: component.v / frame.maxV,
  17965. blocksPerLine: component.blocksPerLine,
  17966. blocksPerColumn: component.blocksPerColumn
  17967. });
  17968. }
  17969. this.numComponents = this.components.length;
  17970. return undefined;
  17971. }
  17972. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  17973. const scaleX = this.width / width,
  17974. scaleY = this.height / height;
  17975. let component, componentScaleX, componentScaleY, blocksPerScanline;
  17976. let x, y, i, j, k;
  17977. let index;
  17978. let offset = 0;
  17979. let output;
  17980. const numComponents = this.components.length;
  17981. const dataLength = width * height * numComponents;
  17982. const data = new Uint8ClampedArray(dataLength);
  17983. const xScaleBlockOffset = new Uint32Array(width);
  17984. const mask3LSB = 0xfffffff8;
  17985. let lastComponentScaleX;
  17986. for (i = 0; i < numComponents; i++) {
  17987. component = this.components[i];
  17988. componentScaleX = component.scaleX * scaleX;
  17989. componentScaleY = component.scaleY * scaleY;
  17990. offset = i;
  17991. output = component.output;
  17992. blocksPerScanline = component.blocksPerLine + 1 << 3;
  17993. if (componentScaleX !== lastComponentScaleX) {
  17994. for (x = 0; x < width; x++) {
  17995. j = 0 | x * componentScaleX;
  17996. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  17997. }
  17998. lastComponentScaleX = componentScaleX;
  17999. }
  18000. for (y = 0; y < height; y++) {
  18001. j = 0 | y * componentScaleY;
  18002. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  18003. for (x = 0; x < width; x++) {
  18004. data[offset] = output[index + xScaleBlockOffset[x]];
  18005. offset += numComponents;
  18006. }
  18007. }
  18008. }
  18009. let transform = this._decodeTransform;
  18010. if (!isSourcePDF && numComponents === 4 && !transform) {
  18011. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  18012. }
  18013. if (transform) {
  18014. for (i = 0; i < dataLength;) {
  18015. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  18016. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  18017. }
  18018. }
  18019. }
  18020. return data;
  18021. }
  18022. get _isColorConversionNeeded() {
  18023. if (this.adobe) {
  18024. return !!this.adobe.transformCode;
  18025. }
  18026. if (this.numComponents === 3) {
  18027. if (this._colorTransform === 0) {
  18028. return false;
  18029. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  18030. return false;
  18031. }
  18032. return true;
  18033. }
  18034. if (this._colorTransform === 1) {
  18035. return true;
  18036. }
  18037. return false;
  18038. }
  18039. _convertYccToRgb(data) {
  18040. let Y, Cb, Cr;
  18041. for (let i = 0, length = data.length; i < length; i += 3) {
  18042. Y = data[i];
  18043. Cb = data[i + 1];
  18044. Cr = data[i + 2];
  18045. data[i] = Y - 179.456 + 1.402 * Cr;
  18046. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  18047. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  18048. }
  18049. return data;
  18050. }
  18051. _convertYcckToRgb(data) {
  18052. let Y, Cb, Cr, k;
  18053. let offset = 0;
  18054. for (let i = 0, length = data.length; i < length; i += 4) {
  18055. Y = data[i];
  18056. Cb = data[i + 1];
  18057. Cr = data[i + 2];
  18058. k = data[i + 3];
  18059. 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);
  18060. 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);
  18061. 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);
  18062. }
  18063. return data.subarray(0, offset);
  18064. }
  18065. _convertYcckToCmyk(data) {
  18066. let Y, Cb, Cr;
  18067. for (let i = 0, length = data.length; i < length; i += 4) {
  18068. Y = data[i];
  18069. Cb = data[i + 1];
  18070. Cr = data[i + 2];
  18071. data[i] = 434.456 - Y - 1.402 * Cr;
  18072. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  18073. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  18074. }
  18075. return data;
  18076. }
  18077. _convertCmykToRgb(data) {
  18078. let c, m, y, k;
  18079. let offset = 0;
  18080. for (let i = 0, length = data.length; i < length; i += 4) {
  18081. c = data[i];
  18082. m = data[i + 1];
  18083. y = data[i + 2];
  18084. k = data[i + 3];
  18085. 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);
  18086. 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);
  18087. 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);
  18088. }
  18089. return data.subarray(0, offset);
  18090. }
  18091. getData({
  18092. width,
  18093. height,
  18094. forceRGB = false,
  18095. isSourcePDF = false
  18096. }) {
  18097. if (this.numComponents > 4) {
  18098. throw new JpegError("Unsupported color mode");
  18099. }
  18100. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  18101. if (this.numComponents === 1 && forceRGB) {
  18102. const rgbData = new Uint8ClampedArray(data.length * 3);
  18103. let offset = 0;
  18104. for (const grayColor of data) {
  18105. rgbData[offset++] = grayColor;
  18106. rgbData[offset++] = grayColor;
  18107. rgbData[offset++] = grayColor;
  18108. }
  18109. return rgbData;
  18110. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  18111. return this._convertYccToRgb(data);
  18112. } else if (this.numComponents === 4) {
  18113. if (this._isColorConversionNeeded) {
  18114. if (forceRGB) {
  18115. return this._convertYcckToRgb(data);
  18116. }
  18117. return this._convertYcckToCmyk(data);
  18118. } else if (forceRGB) {
  18119. return this._convertCmykToRgb(data);
  18120. }
  18121. }
  18122. return data;
  18123. }
  18124. }
  18125. exports.JpegImage = JpegImage;
  18126. /***/ }),
  18127. /* 27 */
  18128. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18129. Object.defineProperty(exports, "__esModule", ({
  18130. value: true
  18131. }));
  18132. exports.JpxStream = void 0;
  18133. var _decode_stream = __w_pdfjs_require__(17);
  18134. var _jpx = __w_pdfjs_require__(28);
  18135. var _util = __w_pdfjs_require__(2);
  18136. class JpxStream extends _decode_stream.DecodeStream {
  18137. constructor(stream, maybeLength, params) {
  18138. super(maybeLength);
  18139. this.stream = stream;
  18140. this.dict = stream.dict;
  18141. this.maybeLength = maybeLength;
  18142. this.params = params;
  18143. }
  18144. get bytes() {
  18145. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  18146. }
  18147. ensureBuffer(requested) {}
  18148. readBlock() {
  18149. if (this.eof) {
  18150. return;
  18151. }
  18152. const jpxImage = new _jpx.JpxImage();
  18153. jpxImage.parse(this.bytes);
  18154. const width = jpxImage.width;
  18155. const height = jpxImage.height;
  18156. const componentsCount = jpxImage.componentsCount;
  18157. const tileCount = jpxImage.tiles.length;
  18158. if (tileCount === 1) {
  18159. this.buffer = jpxImage.tiles[0].items;
  18160. } else {
  18161. const data = new Uint8ClampedArray(width * height * componentsCount);
  18162. for (let k = 0; k < tileCount; k++) {
  18163. const tileComponents = jpxImage.tiles[k];
  18164. const tileWidth = tileComponents.width;
  18165. const tileHeight = tileComponents.height;
  18166. const tileLeft = tileComponents.left;
  18167. const tileTop = tileComponents.top;
  18168. const src = tileComponents.items;
  18169. let srcPosition = 0;
  18170. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  18171. const imgRowSize = width * componentsCount;
  18172. const tileRowSize = tileWidth * componentsCount;
  18173. for (let j = 0; j < tileHeight; j++) {
  18174. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  18175. data.set(rowBytes, dataPosition);
  18176. srcPosition += tileRowSize;
  18177. dataPosition += imgRowSize;
  18178. }
  18179. }
  18180. this.buffer = data;
  18181. }
  18182. this.bufferLength = this.buffer.length;
  18183. this.eof = true;
  18184. }
  18185. }
  18186. exports.JpxStream = JpxStream;
  18187. /***/ }),
  18188. /* 28 */
  18189. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18190. Object.defineProperty(exports, "__esModule", ({
  18191. value: true
  18192. }));
  18193. exports.JpxImage = void 0;
  18194. var _util = __w_pdfjs_require__(2);
  18195. var _core_utils = __w_pdfjs_require__(4);
  18196. var _arithmetic_decoder = __w_pdfjs_require__(24);
  18197. class JpxError extends _util.BaseException {
  18198. constructor(msg) {
  18199. super(`JPX error: ${msg}`, "JpxError");
  18200. }
  18201. }
  18202. const SubbandsGainLog2 = {
  18203. LL: 0,
  18204. LH: 1,
  18205. HL: 1,
  18206. HH: 2
  18207. };
  18208. class JpxImage {
  18209. constructor() {
  18210. this.failOnCorruptedImage = false;
  18211. }
  18212. parse(data) {
  18213. const head = (0, _core_utils.readUint16)(data, 0);
  18214. if (head === 0xff4f) {
  18215. this.parseCodestream(data, 0, data.length);
  18216. return;
  18217. }
  18218. const length = data.length;
  18219. let position = 0;
  18220. while (position < length) {
  18221. let headerSize = 8;
  18222. let lbox = (0, _core_utils.readUint32)(data, position);
  18223. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  18224. position += headerSize;
  18225. if (lbox === 1) {
  18226. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  18227. position += 8;
  18228. headerSize += 8;
  18229. }
  18230. if (lbox === 0) {
  18231. lbox = length - position + headerSize;
  18232. }
  18233. if (lbox < headerSize) {
  18234. throw new JpxError("Invalid box field size");
  18235. }
  18236. const dataLength = lbox - headerSize;
  18237. let jumpDataLength = true;
  18238. switch (tbox) {
  18239. case 0x6a703268:
  18240. jumpDataLength = false;
  18241. break;
  18242. case 0x636f6c72:
  18243. const method = data[position];
  18244. if (method === 1) {
  18245. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  18246. switch (colorspace) {
  18247. case 16:
  18248. case 17:
  18249. case 18:
  18250. break;
  18251. default:
  18252. (0, _util.warn)("Unknown colorspace " + colorspace);
  18253. break;
  18254. }
  18255. } else if (method === 2) {
  18256. (0, _util.info)("ICC profile not supported");
  18257. }
  18258. break;
  18259. case 0x6a703263:
  18260. this.parseCodestream(data, position, position + dataLength);
  18261. break;
  18262. case 0x6a502020:
  18263. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  18264. (0, _util.warn)("Invalid JP2 signature");
  18265. }
  18266. break;
  18267. case 0x6a501a1a:
  18268. case 0x66747970:
  18269. case 0x72726571:
  18270. case 0x72657320:
  18271. case 0x69686472:
  18272. break;
  18273. default:
  18274. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  18275. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  18276. break;
  18277. }
  18278. if (jumpDataLength) {
  18279. position += dataLength;
  18280. }
  18281. }
  18282. }
  18283. parseImageProperties(stream) {
  18284. let newByte = stream.getByte();
  18285. while (newByte >= 0) {
  18286. const oldByte = newByte;
  18287. newByte = stream.getByte();
  18288. const code = oldByte << 8 | newByte;
  18289. if (code === 0xff51) {
  18290. stream.skip(4);
  18291. const Xsiz = stream.getInt32() >>> 0;
  18292. const Ysiz = stream.getInt32() >>> 0;
  18293. const XOsiz = stream.getInt32() >>> 0;
  18294. const YOsiz = stream.getInt32() >>> 0;
  18295. stream.skip(16);
  18296. const Csiz = stream.getUint16();
  18297. this.width = Xsiz - XOsiz;
  18298. this.height = Ysiz - YOsiz;
  18299. this.componentsCount = Csiz;
  18300. this.bitsPerComponent = 8;
  18301. return;
  18302. }
  18303. }
  18304. throw new JpxError("No size marker found in JPX stream");
  18305. }
  18306. parseCodestream(data, start, end) {
  18307. const context = {};
  18308. let doNotRecover = false;
  18309. try {
  18310. let position = start;
  18311. while (position + 1 < end) {
  18312. const code = (0, _core_utils.readUint16)(data, position);
  18313. position += 2;
  18314. let length = 0,
  18315. j,
  18316. sqcd,
  18317. spqcds,
  18318. spqcdSize,
  18319. scalarExpounded,
  18320. tile;
  18321. switch (code) {
  18322. case 0xff4f:
  18323. context.mainHeader = true;
  18324. break;
  18325. case 0xffd9:
  18326. break;
  18327. case 0xff51:
  18328. length = (0, _core_utils.readUint16)(data, position);
  18329. const siz = {};
  18330. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  18331. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  18332. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  18333. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  18334. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  18335. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  18336. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  18337. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  18338. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  18339. siz.Csiz = componentsCount;
  18340. const components = [];
  18341. j = position + 38;
  18342. for (let i = 0; i < componentsCount; i++) {
  18343. const component = {
  18344. precision: (data[j] & 0x7f) + 1,
  18345. isSigned: !!(data[j] & 0x80),
  18346. XRsiz: data[j + 1],
  18347. YRsiz: data[j + 2]
  18348. };
  18349. j += 3;
  18350. calculateComponentDimensions(component, siz);
  18351. components.push(component);
  18352. }
  18353. context.SIZ = siz;
  18354. context.components = components;
  18355. calculateTileGrids(context, components);
  18356. context.QCC = [];
  18357. context.COC = [];
  18358. break;
  18359. case 0xff5c:
  18360. length = (0, _core_utils.readUint16)(data, position);
  18361. const qcd = {};
  18362. j = position + 2;
  18363. sqcd = data[j++];
  18364. switch (sqcd & 0x1f) {
  18365. case 0:
  18366. spqcdSize = 8;
  18367. scalarExpounded = true;
  18368. break;
  18369. case 1:
  18370. spqcdSize = 16;
  18371. scalarExpounded = false;
  18372. break;
  18373. case 2:
  18374. spqcdSize = 16;
  18375. scalarExpounded = true;
  18376. break;
  18377. default:
  18378. throw new Error("Invalid SQcd value " + sqcd);
  18379. }
  18380. qcd.noQuantization = spqcdSize === 8;
  18381. qcd.scalarExpounded = scalarExpounded;
  18382. qcd.guardBits = sqcd >> 5;
  18383. spqcds = [];
  18384. while (j < length + position) {
  18385. const spqcd = {};
  18386. if (spqcdSize === 8) {
  18387. spqcd.epsilon = data[j++] >> 3;
  18388. spqcd.mu = 0;
  18389. } else {
  18390. spqcd.epsilon = data[j] >> 3;
  18391. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18392. j += 2;
  18393. }
  18394. spqcds.push(spqcd);
  18395. }
  18396. qcd.SPqcds = spqcds;
  18397. if (context.mainHeader) {
  18398. context.QCD = qcd;
  18399. } else {
  18400. context.currentTile.QCD = qcd;
  18401. context.currentTile.QCC = [];
  18402. }
  18403. break;
  18404. case 0xff5d:
  18405. length = (0, _core_utils.readUint16)(data, position);
  18406. const qcc = {};
  18407. j = position + 2;
  18408. let cqcc;
  18409. if (context.SIZ.Csiz < 257) {
  18410. cqcc = data[j++];
  18411. } else {
  18412. cqcc = (0, _core_utils.readUint16)(data, j);
  18413. j += 2;
  18414. }
  18415. sqcd = data[j++];
  18416. switch (sqcd & 0x1f) {
  18417. case 0:
  18418. spqcdSize = 8;
  18419. scalarExpounded = true;
  18420. break;
  18421. case 1:
  18422. spqcdSize = 16;
  18423. scalarExpounded = false;
  18424. break;
  18425. case 2:
  18426. spqcdSize = 16;
  18427. scalarExpounded = true;
  18428. break;
  18429. default:
  18430. throw new Error("Invalid SQcd value " + sqcd);
  18431. }
  18432. qcc.noQuantization = spqcdSize === 8;
  18433. qcc.scalarExpounded = scalarExpounded;
  18434. qcc.guardBits = sqcd >> 5;
  18435. spqcds = [];
  18436. while (j < length + position) {
  18437. const spqcd = {};
  18438. if (spqcdSize === 8) {
  18439. spqcd.epsilon = data[j++] >> 3;
  18440. spqcd.mu = 0;
  18441. } else {
  18442. spqcd.epsilon = data[j] >> 3;
  18443. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18444. j += 2;
  18445. }
  18446. spqcds.push(spqcd);
  18447. }
  18448. qcc.SPqcds = spqcds;
  18449. if (context.mainHeader) {
  18450. context.QCC[cqcc] = qcc;
  18451. } else {
  18452. context.currentTile.QCC[cqcc] = qcc;
  18453. }
  18454. break;
  18455. case 0xff52:
  18456. length = (0, _core_utils.readUint16)(data, position);
  18457. const cod = {};
  18458. j = position + 2;
  18459. const scod = data[j++];
  18460. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  18461. cod.sopMarkerUsed = !!(scod & 2);
  18462. cod.ephMarkerUsed = !!(scod & 4);
  18463. cod.progressionOrder = data[j++];
  18464. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  18465. j += 2;
  18466. cod.multipleComponentTransform = data[j++];
  18467. cod.decompositionLevelsCount = data[j++];
  18468. cod.xcb = (data[j++] & 0xf) + 2;
  18469. cod.ycb = (data[j++] & 0xf) + 2;
  18470. const blockStyle = data[j++];
  18471. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  18472. cod.resetContextProbabilities = !!(blockStyle & 2);
  18473. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  18474. cod.verticallyStripe = !!(blockStyle & 8);
  18475. cod.predictableTermination = !!(blockStyle & 16);
  18476. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  18477. cod.reversibleTransformation = data[j++];
  18478. if (cod.entropyCoderWithCustomPrecincts) {
  18479. const precinctsSizes = [];
  18480. while (j < length + position) {
  18481. const precinctsSize = data[j++];
  18482. precinctsSizes.push({
  18483. PPx: precinctsSize & 0xf,
  18484. PPy: precinctsSize >> 4
  18485. });
  18486. }
  18487. cod.precinctsSizes = precinctsSizes;
  18488. }
  18489. const unsupported = [];
  18490. if (cod.selectiveArithmeticCodingBypass) {
  18491. unsupported.push("selectiveArithmeticCodingBypass");
  18492. }
  18493. if (cod.terminationOnEachCodingPass) {
  18494. unsupported.push("terminationOnEachCodingPass");
  18495. }
  18496. if (cod.verticallyStripe) {
  18497. unsupported.push("verticallyStripe");
  18498. }
  18499. if (cod.predictableTermination) {
  18500. unsupported.push("predictableTermination");
  18501. }
  18502. if (unsupported.length > 0) {
  18503. doNotRecover = true;
  18504. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  18505. }
  18506. if (context.mainHeader) {
  18507. context.COD = cod;
  18508. } else {
  18509. context.currentTile.COD = cod;
  18510. context.currentTile.COC = [];
  18511. }
  18512. break;
  18513. case 0xff90:
  18514. length = (0, _core_utils.readUint16)(data, position);
  18515. tile = {};
  18516. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  18517. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  18518. tile.dataEnd = tile.length + position - 2;
  18519. tile.partIndex = data[position + 8];
  18520. tile.partsCount = data[position + 9];
  18521. context.mainHeader = false;
  18522. if (tile.partIndex === 0) {
  18523. tile.COD = context.COD;
  18524. tile.COC = context.COC.slice(0);
  18525. tile.QCD = context.QCD;
  18526. tile.QCC = context.QCC.slice(0);
  18527. }
  18528. context.currentTile = tile;
  18529. break;
  18530. case 0xff93:
  18531. tile = context.currentTile;
  18532. if (tile.partIndex === 0) {
  18533. initializeTile(context, tile.index);
  18534. buildPackets(context);
  18535. }
  18536. length = tile.dataEnd - position;
  18537. parseTilePackets(context, data, position, length);
  18538. break;
  18539. case 0xff53:
  18540. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  18541. case 0xff55:
  18542. case 0xff57:
  18543. case 0xff58:
  18544. case 0xff64:
  18545. length = (0, _core_utils.readUint16)(data, position);
  18546. break;
  18547. default:
  18548. throw new Error("Unknown codestream code: " + code.toString(16));
  18549. }
  18550. position += length;
  18551. }
  18552. } catch (e) {
  18553. if (doNotRecover || this.failOnCorruptedImage) {
  18554. throw new JpxError(e.message);
  18555. } else {
  18556. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  18557. }
  18558. }
  18559. this.tiles = transformComponents(context);
  18560. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  18561. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  18562. this.componentsCount = context.SIZ.Csiz;
  18563. }
  18564. }
  18565. exports.JpxImage = JpxImage;
  18566. function calculateComponentDimensions(component, siz) {
  18567. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  18568. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  18569. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  18570. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  18571. component.width = component.x1 - component.x0;
  18572. component.height = component.y1 - component.y0;
  18573. }
  18574. function calculateTileGrids(context, components) {
  18575. const siz = context.SIZ;
  18576. const tiles = [];
  18577. let tile;
  18578. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  18579. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  18580. for (let q = 0; q < numYtiles; q++) {
  18581. for (let p = 0; p < numXtiles; p++) {
  18582. tile = {};
  18583. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  18584. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  18585. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  18586. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  18587. tile.width = tile.tx1 - tile.tx0;
  18588. tile.height = tile.ty1 - tile.ty0;
  18589. tile.components = [];
  18590. tiles.push(tile);
  18591. }
  18592. }
  18593. context.tiles = tiles;
  18594. const componentsCount = siz.Csiz;
  18595. for (let i = 0, ii = componentsCount; i < ii; i++) {
  18596. const component = components[i];
  18597. for (let j = 0, jj = tiles.length; j < jj; j++) {
  18598. const tileComponent = {};
  18599. tile = tiles[j];
  18600. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  18601. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  18602. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  18603. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  18604. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  18605. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  18606. tile.components[i] = tileComponent;
  18607. }
  18608. }
  18609. }
  18610. function getBlocksDimensions(context, component, r) {
  18611. const codOrCoc = component.codingStyleParameters;
  18612. const result = {};
  18613. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  18614. result.PPx = 15;
  18615. result.PPy = 15;
  18616. } else {
  18617. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  18618. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  18619. }
  18620. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  18621. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  18622. return result;
  18623. }
  18624. function buildPrecincts(context, resolution, dimensions) {
  18625. const precinctWidth = 1 << dimensions.PPx;
  18626. const precinctHeight = 1 << dimensions.PPy;
  18627. const isZeroRes = resolution.resLevel === 0;
  18628. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  18629. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  18630. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  18631. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  18632. const numprecincts = numprecinctswide * numprecinctshigh;
  18633. resolution.precinctParameters = {
  18634. precinctWidth,
  18635. precinctHeight,
  18636. numprecinctswide,
  18637. numprecinctshigh,
  18638. numprecincts,
  18639. precinctWidthInSubband,
  18640. precinctHeightInSubband
  18641. };
  18642. }
  18643. function buildCodeblocks(context, subband, dimensions) {
  18644. const xcb_ = dimensions.xcb_;
  18645. const ycb_ = dimensions.ycb_;
  18646. const codeblockWidth = 1 << xcb_;
  18647. const codeblockHeight = 1 << ycb_;
  18648. const cbx0 = subband.tbx0 >> xcb_;
  18649. const cby0 = subband.tby0 >> ycb_;
  18650. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  18651. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  18652. const precinctParameters = subband.resolution.precinctParameters;
  18653. const codeblocks = [];
  18654. const precincts = [];
  18655. let i, j, codeblock, precinctNumber;
  18656. for (j = cby0; j < cby1; j++) {
  18657. for (i = cbx0; i < cbx1; i++) {
  18658. codeblock = {
  18659. cbx: i,
  18660. cby: j,
  18661. tbx0: codeblockWidth * i,
  18662. tby0: codeblockHeight * j,
  18663. tbx1: codeblockWidth * (i + 1),
  18664. tby1: codeblockHeight * (j + 1)
  18665. };
  18666. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  18667. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  18668. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  18669. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  18670. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  18671. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  18672. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  18673. codeblock.precinctNumber = precinctNumber;
  18674. codeblock.subbandType = subband.type;
  18675. codeblock.Lblock = 3;
  18676. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  18677. continue;
  18678. }
  18679. codeblocks.push(codeblock);
  18680. let precinct = precincts[precinctNumber];
  18681. if (precinct !== undefined) {
  18682. if (i < precinct.cbxMin) {
  18683. precinct.cbxMin = i;
  18684. } else if (i > precinct.cbxMax) {
  18685. precinct.cbxMax = i;
  18686. }
  18687. if (j < precinct.cbyMin) {
  18688. precinct.cbxMin = j;
  18689. } else if (j > precinct.cbyMax) {
  18690. precinct.cbyMax = j;
  18691. }
  18692. } else {
  18693. precincts[precinctNumber] = precinct = {
  18694. cbxMin: i,
  18695. cbyMin: j,
  18696. cbxMax: i,
  18697. cbyMax: j
  18698. };
  18699. }
  18700. codeblock.precinct = precinct;
  18701. }
  18702. }
  18703. subband.codeblockParameters = {
  18704. codeblockWidth: xcb_,
  18705. codeblockHeight: ycb_,
  18706. numcodeblockwide: cbx1 - cbx0 + 1,
  18707. numcodeblockhigh: cby1 - cby0 + 1
  18708. };
  18709. subband.codeblocks = codeblocks;
  18710. subband.precincts = precincts;
  18711. }
  18712. function createPacket(resolution, precinctNumber, layerNumber) {
  18713. const precinctCodeblocks = [];
  18714. const subbands = resolution.subbands;
  18715. for (let i = 0, ii = subbands.length; i < ii; i++) {
  18716. const subband = subbands[i];
  18717. const codeblocks = subband.codeblocks;
  18718. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  18719. const codeblock = codeblocks[j];
  18720. if (codeblock.precinctNumber !== precinctNumber) {
  18721. continue;
  18722. }
  18723. precinctCodeblocks.push(codeblock);
  18724. }
  18725. }
  18726. return {
  18727. layerNumber,
  18728. codeblocks: precinctCodeblocks
  18729. };
  18730. }
  18731. function LayerResolutionComponentPositionIterator(context) {
  18732. const siz = context.SIZ;
  18733. const tileIndex = context.currentTile.index;
  18734. const tile = context.tiles[tileIndex];
  18735. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18736. const componentsCount = siz.Csiz;
  18737. let maxDecompositionLevelsCount = 0;
  18738. for (let q = 0; q < componentsCount; q++) {
  18739. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18740. }
  18741. let l = 0,
  18742. r = 0,
  18743. i = 0,
  18744. k = 0;
  18745. this.nextPacket = function JpxImage_nextPacket() {
  18746. for (; l < layersCount; l++) {
  18747. for (; r <= maxDecompositionLevelsCount; r++) {
  18748. for (; i < componentsCount; i++) {
  18749. const component = tile.components[i];
  18750. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18751. continue;
  18752. }
  18753. const resolution = component.resolutions[r];
  18754. const numprecincts = resolution.precinctParameters.numprecincts;
  18755. for (; k < numprecincts;) {
  18756. const packet = createPacket(resolution, k, l);
  18757. k++;
  18758. return packet;
  18759. }
  18760. k = 0;
  18761. }
  18762. i = 0;
  18763. }
  18764. r = 0;
  18765. }
  18766. throw new JpxError("Out of packets");
  18767. };
  18768. }
  18769. function ResolutionLayerComponentPositionIterator(context) {
  18770. const siz = context.SIZ;
  18771. const tileIndex = context.currentTile.index;
  18772. const tile = context.tiles[tileIndex];
  18773. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18774. const componentsCount = siz.Csiz;
  18775. let maxDecompositionLevelsCount = 0;
  18776. for (let q = 0; q < componentsCount; q++) {
  18777. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18778. }
  18779. let r = 0,
  18780. l = 0,
  18781. i = 0,
  18782. k = 0;
  18783. this.nextPacket = function JpxImage_nextPacket() {
  18784. for (; r <= maxDecompositionLevelsCount; r++) {
  18785. for (; l < layersCount; l++) {
  18786. for (; i < componentsCount; i++) {
  18787. const component = tile.components[i];
  18788. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18789. continue;
  18790. }
  18791. const resolution = component.resolutions[r];
  18792. const numprecincts = resolution.precinctParameters.numprecincts;
  18793. for (; k < numprecincts;) {
  18794. const packet = createPacket(resolution, k, l);
  18795. k++;
  18796. return packet;
  18797. }
  18798. k = 0;
  18799. }
  18800. i = 0;
  18801. }
  18802. l = 0;
  18803. }
  18804. throw new JpxError("Out of packets");
  18805. };
  18806. }
  18807. function ResolutionPositionComponentLayerIterator(context) {
  18808. const siz = context.SIZ;
  18809. const tileIndex = context.currentTile.index;
  18810. const tile = context.tiles[tileIndex];
  18811. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18812. const componentsCount = siz.Csiz;
  18813. let l, r, c, p;
  18814. let maxDecompositionLevelsCount = 0;
  18815. for (c = 0; c < componentsCount; c++) {
  18816. const component = tile.components[c];
  18817. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  18818. }
  18819. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  18820. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  18821. let maxNumPrecincts = 0;
  18822. for (c = 0; c < componentsCount; ++c) {
  18823. const resolutions = tile.components[c].resolutions;
  18824. if (r < resolutions.length) {
  18825. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  18826. }
  18827. }
  18828. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  18829. }
  18830. l = 0;
  18831. r = 0;
  18832. c = 0;
  18833. p = 0;
  18834. this.nextPacket = function JpxImage_nextPacket() {
  18835. for (; r <= maxDecompositionLevelsCount; r++) {
  18836. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  18837. for (; c < componentsCount; c++) {
  18838. const component = tile.components[c];
  18839. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18840. continue;
  18841. }
  18842. const resolution = component.resolutions[r];
  18843. const numprecincts = resolution.precinctParameters.numprecincts;
  18844. if (p >= numprecincts) {
  18845. continue;
  18846. }
  18847. for (; l < layersCount;) {
  18848. const packet = createPacket(resolution, p, l);
  18849. l++;
  18850. return packet;
  18851. }
  18852. l = 0;
  18853. }
  18854. c = 0;
  18855. }
  18856. p = 0;
  18857. }
  18858. throw new JpxError("Out of packets");
  18859. };
  18860. }
  18861. function PositionComponentResolutionLayerIterator(context) {
  18862. const siz = context.SIZ;
  18863. const tileIndex = context.currentTile.index;
  18864. const tile = context.tiles[tileIndex];
  18865. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18866. const componentsCount = siz.Csiz;
  18867. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18868. const precinctsIterationSizes = precinctsSizes;
  18869. let l = 0,
  18870. r = 0,
  18871. c = 0,
  18872. px = 0,
  18873. py = 0;
  18874. this.nextPacket = function JpxImage_nextPacket() {
  18875. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18876. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18877. for (; c < componentsCount; c++) {
  18878. const component = tile.components[c];
  18879. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18880. for (; r <= decompositionLevelsCount; r++) {
  18881. const resolution = component.resolutions[r];
  18882. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  18883. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18884. if (k === null) {
  18885. continue;
  18886. }
  18887. for (; l < layersCount;) {
  18888. const packet = createPacket(resolution, k, l);
  18889. l++;
  18890. return packet;
  18891. }
  18892. l = 0;
  18893. }
  18894. r = 0;
  18895. }
  18896. c = 0;
  18897. }
  18898. px = 0;
  18899. }
  18900. throw new JpxError("Out of packets");
  18901. };
  18902. }
  18903. function ComponentPositionResolutionLayerIterator(context) {
  18904. const siz = context.SIZ;
  18905. const tileIndex = context.currentTile.index;
  18906. const tile = context.tiles[tileIndex];
  18907. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18908. const componentsCount = siz.Csiz;
  18909. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18910. let l = 0,
  18911. r = 0,
  18912. c = 0,
  18913. px = 0,
  18914. py = 0;
  18915. this.nextPacket = function JpxImage_nextPacket() {
  18916. for (; c < componentsCount; ++c) {
  18917. const component = tile.components[c];
  18918. const precinctsIterationSizes = precinctsSizes.components[c];
  18919. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18920. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18921. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18922. for (; r <= decompositionLevelsCount; r++) {
  18923. const resolution = component.resolutions[r];
  18924. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  18925. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18926. if (k === null) {
  18927. continue;
  18928. }
  18929. for (; l < layersCount;) {
  18930. const packet = createPacket(resolution, k, l);
  18931. l++;
  18932. return packet;
  18933. }
  18934. l = 0;
  18935. }
  18936. r = 0;
  18937. }
  18938. px = 0;
  18939. }
  18940. py = 0;
  18941. }
  18942. throw new JpxError("Out of packets");
  18943. };
  18944. }
  18945. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  18946. const posX = pxIndex * precinctIterationSizes.minWidth;
  18947. const posY = pyIndex * precinctIterationSizes.minHeight;
  18948. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  18949. return null;
  18950. }
  18951. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  18952. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  18953. }
  18954. function getPrecinctSizesInImageScale(tile) {
  18955. const componentsCount = tile.components.length;
  18956. let minWidth = Number.MAX_VALUE;
  18957. let minHeight = Number.MAX_VALUE;
  18958. let maxNumWide = 0;
  18959. let maxNumHigh = 0;
  18960. const sizePerComponent = new Array(componentsCount);
  18961. for (let c = 0; c < componentsCount; c++) {
  18962. const component = tile.components[c];
  18963. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18964. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  18965. let minWidthCurrentComponent = Number.MAX_VALUE;
  18966. let minHeightCurrentComponent = Number.MAX_VALUE;
  18967. let maxNumWideCurrentComponent = 0;
  18968. let maxNumHighCurrentComponent = 0;
  18969. let scale = 1;
  18970. for (let r = decompositionLevelsCount; r >= 0; --r) {
  18971. const resolution = component.resolutions[r];
  18972. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  18973. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  18974. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  18975. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  18976. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  18977. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  18978. sizePerResolution[r] = {
  18979. width: widthCurrentResolution,
  18980. height: heightCurrentResolution
  18981. };
  18982. scale <<= 1;
  18983. }
  18984. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  18985. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  18986. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  18987. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  18988. sizePerComponent[c] = {
  18989. resolutions: sizePerResolution,
  18990. minWidth: minWidthCurrentComponent,
  18991. minHeight: minHeightCurrentComponent,
  18992. maxNumWide: maxNumWideCurrentComponent,
  18993. maxNumHigh: maxNumHighCurrentComponent
  18994. };
  18995. }
  18996. return {
  18997. components: sizePerComponent,
  18998. minWidth,
  18999. minHeight,
  19000. maxNumWide,
  19001. maxNumHigh
  19002. };
  19003. }
  19004. function buildPackets(context) {
  19005. const siz = context.SIZ;
  19006. const tileIndex = context.currentTile.index;
  19007. const tile = context.tiles[tileIndex];
  19008. const componentsCount = siz.Csiz;
  19009. for (let c = 0; c < componentsCount; c++) {
  19010. const component = tile.components[c];
  19011. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  19012. const resolutions = [];
  19013. const subbands = [];
  19014. for (let r = 0; r <= decompositionLevelsCount; r++) {
  19015. const blocksDimensions = getBlocksDimensions(context, component, r);
  19016. const resolution = {};
  19017. const scale = 1 << decompositionLevelsCount - r;
  19018. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  19019. resolution.try0 = Math.ceil(component.tcy0 / scale);
  19020. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  19021. resolution.try1 = Math.ceil(component.tcy1 / scale);
  19022. resolution.resLevel = r;
  19023. buildPrecincts(context, resolution, blocksDimensions);
  19024. resolutions.push(resolution);
  19025. let subband;
  19026. if (r === 0) {
  19027. subband = {};
  19028. subband.type = "LL";
  19029. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  19030. subband.tby0 = Math.ceil(component.tcy0 / scale);
  19031. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  19032. subband.tby1 = Math.ceil(component.tcy1 / scale);
  19033. subband.resolution = resolution;
  19034. buildCodeblocks(context, subband, blocksDimensions);
  19035. subbands.push(subband);
  19036. resolution.subbands = [subband];
  19037. } else {
  19038. const bscale = 1 << decompositionLevelsCount - r + 1;
  19039. const resolutionSubbands = [];
  19040. subband = {};
  19041. subband.type = "HL";
  19042. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  19043. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  19044. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  19045. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  19046. subband.resolution = resolution;
  19047. buildCodeblocks(context, subband, blocksDimensions);
  19048. subbands.push(subband);
  19049. resolutionSubbands.push(subband);
  19050. subband = {};
  19051. subband.type = "LH";
  19052. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  19053. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  19054. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  19055. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  19056. subband.resolution = resolution;
  19057. buildCodeblocks(context, subband, blocksDimensions);
  19058. subbands.push(subband);
  19059. resolutionSubbands.push(subband);
  19060. subband = {};
  19061. subband.type = "HH";
  19062. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  19063. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  19064. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  19065. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  19066. subband.resolution = resolution;
  19067. buildCodeblocks(context, subband, blocksDimensions);
  19068. subbands.push(subband);
  19069. resolutionSubbands.push(subband);
  19070. resolution.subbands = resolutionSubbands;
  19071. }
  19072. }
  19073. component.resolutions = resolutions;
  19074. component.subbands = subbands;
  19075. }
  19076. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  19077. switch (progressionOrder) {
  19078. case 0:
  19079. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  19080. break;
  19081. case 1:
  19082. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  19083. break;
  19084. case 2:
  19085. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  19086. break;
  19087. case 3:
  19088. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  19089. break;
  19090. case 4:
  19091. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  19092. break;
  19093. default:
  19094. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  19095. }
  19096. }
  19097. function parseTilePackets(context, data, offset, dataLength) {
  19098. let position = 0;
  19099. let buffer,
  19100. bufferSize = 0,
  19101. skipNextBit = false;
  19102. function readBits(count) {
  19103. while (bufferSize < count) {
  19104. const b = data[offset + position];
  19105. position++;
  19106. if (skipNextBit) {
  19107. buffer = buffer << 7 | b;
  19108. bufferSize += 7;
  19109. skipNextBit = false;
  19110. } else {
  19111. buffer = buffer << 8 | b;
  19112. bufferSize += 8;
  19113. }
  19114. if (b === 0xff) {
  19115. skipNextBit = true;
  19116. }
  19117. }
  19118. bufferSize -= count;
  19119. return buffer >>> bufferSize & (1 << count) - 1;
  19120. }
  19121. function skipMarkerIfEqual(value) {
  19122. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  19123. skipBytes(1);
  19124. return true;
  19125. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  19126. skipBytes(2);
  19127. return true;
  19128. }
  19129. return false;
  19130. }
  19131. function skipBytes(count) {
  19132. position += count;
  19133. }
  19134. function alignToByte() {
  19135. bufferSize = 0;
  19136. if (skipNextBit) {
  19137. position++;
  19138. skipNextBit = false;
  19139. }
  19140. }
  19141. function readCodingpasses() {
  19142. if (readBits(1) === 0) {
  19143. return 1;
  19144. }
  19145. if (readBits(1) === 0) {
  19146. return 2;
  19147. }
  19148. let value = readBits(2);
  19149. if (value < 3) {
  19150. return value + 3;
  19151. }
  19152. value = readBits(5);
  19153. if (value < 31) {
  19154. return value + 6;
  19155. }
  19156. value = readBits(7);
  19157. return value + 37;
  19158. }
  19159. const tileIndex = context.currentTile.index;
  19160. const tile = context.tiles[tileIndex];
  19161. const sopMarkerUsed = context.COD.sopMarkerUsed;
  19162. const ephMarkerUsed = context.COD.ephMarkerUsed;
  19163. const packetsIterator = tile.packetsIterator;
  19164. while (position < dataLength) {
  19165. alignToByte();
  19166. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  19167. skipBytes(4);
  19168. }
  19169. const packet = packetsIterator.nextPacket();
  19170. if (!readBits(1)) {
  19171. continue;
  19172. }
  19173. const layerNumber = packet.layerNumber,
  19174. queue = [];
  19175. let codeblock;
  19176. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  19177. codeblock = packet.codeblocks[i];
  19178. let precinct = codeblock.precinct;
  19179. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  19180. const codeblockRow = codeblock.cby - precinct.cbyMin;
  19181. let codeblockIncluded = false;
  19182. let firstTimeInclusion = false;
  19183. let valueReady, zeroBitPlanesTree;
  19184. if (codeblock.included !== undefined) {
  19185. codeblockIncluded = !!readBits(1);
  19186. } else {
  19187. precinct = codeblock.precinct;
  19188. let inclusionTree;
  19189. if (precinct.inclusionTree !== undefined) {
  19190. inclusionTree = precinct.inclusionTree;
  19191. } else {
  19192. const width = precinct.cbxMax - precinct.cbxMin + 1;
  19193. const height = precinct.cbyMax - precinct.cbyMin + 1;
  19194. inclusionTree = new InclusionTree(width, height, layerNumber);
  19195. zeroBitPlanesTree = new TagTree(width, height);
  19196. precinct.inclusionTree = inclusionTree;
  19197. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  19198. for (let l = 0; l < layerNumber; l++) {
  19199. if (readBits(1) !== 0) {
  19200. throw new JpxError("Invalid tag tree");
  19201. }
  19202. }
  19203. }
  19204. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  19205. while (true) {
  19206. if (readBits(1)) {
  19207. valueReady = !inclusionTree.nextLevel();
  19208. if (valueReady) {
  19209. codeblock.included = true;
  19210. codeblockIncluded = firstTimeInclusion = true;
  19211. break;
  19212. }
  19213. } else {
  19214. inclusionTree.incrementValue(layerNumber);
  19215. break;
  19216. }
  19217. }
  19218. }
  19219. }
  19220. if (!codeblockIncluded) {
  19221. continue;
  19222. }
  19223. if (firstTimeInclusion) {
  19224. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  19225. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  19226. while (true) {
  19227. if (readBits(1)) {
  19228. valueReady = !zeroBitPlanesTree.nextLevel();
  19229. if (valueReady) {
  19230. break;
  19231. }
  19232. } else {
  19233. zeroBitPlanesTree.incrementValue();
  19234. }
  19235. }
  19236. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  19237. }
  19238. const codingpasses = readCodingpasses();
  19239. while (readBits(1)) {
  19240. codeblock.Lblock++;
  19241. }
  19242. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  19243. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  19244. const codedDataLength = readBits(bits);
  19245. queue.push({
  19246. codeblock,
  19247. codingpasses,
  19248. dataLength: codedDataLength
  19249. });
  19250. }
  19251. alignToByte();
  19252. if (ephMarkerUsed) {
  19253. skipMarkerIfEqual(0x92);
  19254. }
  19255. while (queue.length > 0) {
  19256. const packetItem = queue.shift();
  19257. codeblock = packetItem.codeblock;
  19258. if (codeblock.data === undefined) {
  19259. codeblock.data = [];
  19260. }
  19261. codeblock.data.push({
  19262. data,
  19263. start: offset + position,
  19264. end: offset + position + packetItem.dataLength,
  19265. codingpasses: packetItem.codingpasses
  19266. });
  19267. position += packetItem.dataLength;
  19268. }
  19269. }
  19270. return position;
  19271. }
  19272. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  19273. const x0 = subband.tbx0;
  19274. const y0 = subband.tby0;
  19275. const width = subband.tbx1 - subband.tbx0;
  19276. const codeblocks = subband.codeblocks;
  19277. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  19278. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  19279. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  19280. const codeblock = codeblocks[i];
  19281. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  19282. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  19283. if (blockWidth === 0 || blockHeight === 0) {
  19284. continue;
  19285. }
  19286. if (codeblock.data === undefined) {
  19287. continue;
  19288. }
  19289. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  19290. let currentCodingpassType = 2;
  19291. const data = codeblock.data;
  19292. let totalLength = 0,
  19293. codingpasses = 0;
  19294. let j, jj, dataItem;
  19295. for (j = 0, jj = data.length; j < jj; j++) {
  19296. dataItem = data[j];
  19297. totalLength += dataItem.end - dataItem.start;
  19298. codingpasses += dataItem.codingpasses;
  19299. }
  19300. const encodedData = new Uint8Array(totalLength);
  19301. let position = 0;
  19302. for (j = 0, jj = data.length; j < jj; j++) {
  19303. dataItem = data[j];
  19304. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  19305. encodedData.set(chunk, position);
  19306. position += chunk.length;
  19307. }
  19308. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  19309. bitModel.setDecoder(decoder);
  19310. for (j = 0; j < codingpasses; j++) {
  19311. switch (currentCodingpassType) {
  19312. case 0:
  19313. bitModel.runSignificancePropagationPass();
  19314. break;
  19315. case 1:
  19316. bitModel.runMagnitudeRefinementPass();
  19317. break;
  19318. case 2:
  19319. bitModel.runCleanupPass();
  19320. if (segmentationSymbolUsed) {
  19321. bitModel.checkSegmentationSymbol();
  19322. }
  19323. break;
  19324. }
  19325. if (resetContextProbabilities) {
  19326. bitModel.reset();
  19327. }
  19328. currentCodingpassType = (currentCodingpassType + 1) % 3;
  19329. }
  19330. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  19331. const sign = bitModel.coefficentsSign;
  19332. const magnitude = bitModel.coefficentsMagnitude;
  19333. const bitsDecoded = bitModel.bitsDecoded;
  19334. const magnitudeCorrection = reversible ? 0 : 0.5;
  19335. let k, n, nb;
  19336. position = 0;
  19337. const interleave = subband.type !== "LL";
  19338. for (j = 0; j < blockHeight; j++) {
  19339. const row = offset / width | 0;
  19340. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  19341. for (k = 0; k < blockWidth; k++) {
  19342. n = magnitude[position];
  19343. if (n !== 0) {
  19344. n = (n + magnitudeCorrection) * delta;
  19345. if (sign[position] !== 0) {
  19346. n = -n;
  19347. }
  19348. nb = bitsDecoded[position];
  19349. const pos = interleave ? levelOffset + (offset << 1) : offset;
  19350. if (reversible && nb >= mb) {
  19351. coefficients[pos] = n;
  19352. } else {
  19353. coefficients[pos] = n * (1 << mb - nb);
  19354. }
  19355. }
  19356. offset++;
  19357. position++;
  19358. }
  19359. offset += width - blockWidth;
  19360. }
  19361. }
  19362. }
  19363. function transformTile(context, tile, c) {
  19364. const component = tile.components[c];
  19365. const codingStyleParameters = component.codingStyleParameters;
  19366. const quantizationParameters = component.quantizationParameters;
  19367. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  19368. const spqcds = quantizationParameters.SPqcds;
  19369. const scalarExpounded = quantizationParameters.scalarExpounded;
  19370. const guardBits = quantizationParameters.guardBits;
  19371. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  19372. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  19373. const precision = context.components[c].precision;
  19374. const reversible = codingStyleParameters.reversibleTransformation;
  19375. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  19376. const subbandCoefficients = [];
  19377. let b = 0;
  19378. for (let i = 0; i <= decompositionLevelsCount; i++) {
  19379. const resolution = component.resolutions[i];
  19380. const width = resolution.trx1 - resolution.trx0;
  19381. const height = resolution.try1 - resolution.try0;
  19382. const coefficients = new Float32Array(width * height);
  19383. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  19384. let mu, epsilon;
  19385. if (!scalarExpounded) {
  19386. mu = spqcds[0].mu;
  19387. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  19388. } else {
  19389. mu = spqcds[b].mu;
  19390. epsilon = spqcds[b].epsilon;
  19391. b++;
  19392. }
  19393. const subband = resolution.subbands[j];
  19394. const gainLog2 = SubbandsGainLog2[subband.type];
  19395. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  19396. const mb = guardBits + epsilon - 1;
  19397. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  19398. }
  19399. subbandCoefficients.push({
  19400. width,
  19401. height,
  19402. items: coefficients
  19403. });
  19404. }
  19405. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  19406. return {
  19407. left: component.tcx0,
  19408. top: component.tcy0,
  19409. width: result.width,
  19410. height: result.height,
  19411. items: result.items
  19412. };
  19413. }
  19414. function transformComponents(context) {
  19415. const siz = context.SIZ;
  19416. const components = context.components;
  19417. const componentsCount = siz.Csiz;
  19418. const resultImages = [];
  19419. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  19420. const tile = context.tiles[i];
  19421. const transformedTiles = [];
  19422. for (let c = 0; c < componentsCount; c++) {
  19423. transformedTiles[c] = transformTile(context, tile, c);
  19424. }
  19425. const tile0 = transformedTiles[0];
  19426. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  19427. const result = {
  19428. left: tile0.left,
  19429. top: tile0.top,
  19430. width: tile0.width,
  19431. height: tile0.height,
  19432. items: out
  19433. };
  19434. let shift, offset;
  19435. let pos = 0,
  19436. j,
  19437. jj,
  19438. y0,
  19439. y1,
  19440. y2;
  19441. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  19442. const fourComponents = componentsCount === 4;
  19443. const y0items = transformedTiles[0].items;
  19444. const y1items = transformedTiles[1].items;
  19445. const y2items = transformedTiles[2].items;
  19446. const y3items = fourComponents ? transformedTiles[3].items : null;
  19447. shift = components[0].precision - 8;
  19448. offset = (128 << shift) + 0.5;
  19449. const component0 = tile.components[0];
  19450. const alpha01 = componentsCount - 3;
  19451. jj = y0items.length;
  19452. if (!component0.codingStyleParameters.reversibleTransformation) {
  19453. for (j = 0; j < jj; j++, pos += alpha01) {
  19454. y0 = y0items[j] + offset;
  19455. y1 = y1items[j];
  19456. y2 = y2items[j];
  19457. out[pos++] = y0 + 1.402 * y2 >> shift;
  19458. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  19459. out[pos++] = y0 + 1.772 * y1 >> shift;
  19460. }
  19461. } else {
  19462. for (j = 0; j < jj; j++, pos += alpha01) {
  19463. y0 = y0items[j] + offset;
  19464. y1 = y1items[j];
  19465. y2 = y2items[j];
  19466. const g = y0 - (y2 + y1 >> 2);
  19467. out[pos++] = g + y2 >> shift;
  19468. out[pos++] = g >> shift;
  19469. out[pos++] = g + y1 >> shift;
  19470. }
  19471. }
  19472. if (fourComponents) {
  19473. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  19474. out[pos] = y3items[j] + offset >> shift;
  19475. }
  19476. }
  19477. } else {
  19478. for (let c = 0; c < componentsCount; c++) {
  19479. const items = transformedTiles[c].items;
  19480. shift = components[c].precision - 8;
  19481. offset = (128 << shift) + 0.5;
  19482. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  19483. out[pos] = items[j] + offset >> shift;
  19484. pos += componentsCount;
  19485. }
  19486. }
  19487. }
  19488. resultImages.push(result);
  19489. }
  19490. return resultImages;
  19491. }
  19492. function initializeTile(context, tileIndex) {
  19493. const siz = context.SIZ;
  19494. const componentsCount = siz.Csiz;
  19495. const tile = context.tiles[tileIndex];
  19496. for (let c = 0; c < componentsCount; c++) {
  19497. const component = tile.components[c];
  19498. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  19499. component.quantizationParameters = qcdOrQcc;
  19500. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  19501. component.codingStyleParameters = codOrCoc;
  19502. }
  19503. tile.codingStyleDefaultParameters = context.currentTile.COD;
  19504. }
  19505. class TagTree {
  19506. constructor(width, height) {
  19507. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19508. this.levels = [];
  19509. for (let i = 0; i < levelsLength; i++) {
  19510. const level = {
  19511. width,
  19512. height,
  19513. items: []
  19514. };
  19515. this.levels.push(level);
  19516. width = Math.ceil(width / 2);
  19517. height = Math.ceil(height / 2);
  19518. }
  19519. }
  19520. reset(i, j) {
  19521. let currentLevel = 0,
  19522. value = 0,
  19523. level;
  19524. while (currentLevel < this.levels.length) {
  19525. level = this.levels[currentLevel];
  19526. const index = i + j * level.width;
  19527. if (level.items[index] !== undefined) {
  19528. value = level.items[index];
  19529. break;
  19530. }
  19531. level.index = index;
  19532. i >>= 1;
  19533. j >>= 1;
  19534. currentLevel++;
  19535. }
  19536. currentLevel--;
  19537. level = this.levels[currentLevel];
  19538. level.items[level.index] = value;
  19539. this.currentLevel = currentLevel;
  19540. delete this.value;
  19541. }
  19542. incrementValue() {
  19543. const level = this.levels[this.currentLevel];
  19544. level.items[level.index]++;
  19545. }
  19546. nextLevel() {
  19547. let currentLevel = this.currentLevel;
  19548. let level = this.levels[currentLevel];
  19549. const value = level.items[level.index];
  19550. currentLevel--;
  19551. if (currentLevel < 0) {
  19552. this.value = value;
  19553. return false;
  19554. }
  19555. this.currentLevel = currentLevel;
  19556. level = this.levels[currentLevel];
  19557. level.items[level.index] = value;
  19558. return true;
  19559. }
  19560. }
  19561. class InclusionTree {
  19562. constructor(width, height, defaultValue) {
  19563. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19564. this.levels = [];
  19565. for (let i = 0; i < levelsLength; i++) {
  19566. const items = new Uint8Array(width * height);
  19567. for (let j = 0, jj = items.length; j < jj; j++) {
  19568. items[j] = defaultValue;
  19569. }
  19570. const level = {
  19571. width,
  19572. height,
  19573. items
  19574. };
  19575. this.levels.push(level);
  19576. width = Math.ceil(width / 2);
  19577. height = Math.ceil(height / 2);
  19578. }
  19579. }
  19580. reset(i, j, stopValue) {
  19581. let currentLevel = 0;
  19582. while (currentLevel < this.levels.length) {
  19583. const level = this.levels[currentLevel];
  19584. const index = i + j * level.width;
  19585. level.index = index;
  19586. const value = level.items[index];
  19587. if (value === 0xff) {
  19588. break;
  19589. }
  19590. if (value > stopValue) {
  19591. this.currentLevel = currentLevel;
  19592. this.propagateValues();
  19593. return false;
  19594. }
  19595. i >>= 1;
  19596. j >>= 1;
  19597. currentLevel++;
  19598. }
  19599. this.currentLevel = currentLevel - 1;
  19600. return true;
  19601. }
  19602. incrementValue(stopValue) {
  19603. const level = this.levels[this.currentLevel];
  19604. level.items[level.index] = stopValue + 1;
  19605. this.propagateValues();
  19606. }
  19607. propagateValues() {
  19608. let levelIndex = this.currentLevel;
  19609. let level = this.levels[levelIndex];
  19610. const currentValue = level.items[level.index];
  19611. while (--levelIndex >= 0) {
  19612. level = this.levels[levelIndex];
  19613. level.items[level.index] = currentValue;
  19614. }
  19615. }
  19616. nextLevel() {
  19617. let currentLevel = this.currentLevel;
  19618. let level = this.levels[currentLevel];
  19619. const value = level.items[level.index];
  19620. level.items[level.index] = 0xff;
  19621. currentLevel--;
  19622. if (currentLevel < 0) {
  19623. return false;
  19624. }
  19625. this.currentLevel = currentLevel;
  19626. level = this.levels[currentLevel];
  19627. level.items[level.index] = value;
  19628. return true;
  19629. }
  19630. }
  19631. const BitModel = function BitModelClosure() {
  19632. const UNIFORM_CONTEXT = 17;
  19633. const RUNLENGTH_CONTEXT = 18;
  19634. 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]);
  19635. 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]);
  19636. 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]);
  19637. class BitModel {
  19638. constructor(width, height, subband, zeroBitPlanes, mb) {
  19639. this.width = width;
  19640. this.height = height;
  19641. let contextLabelTable;
  19642. if (subband === "HH") {
  19643. contextLabelTable = HHContextLabel;
  19644. } else if (subband === "HL") {
  19645. contextLabelTable = HLContextLabel;
  19646. } else {
  19647. contextLabelTable = LLAndLHContextsLabel;
  19648. }
  19649. this.contextLabelTable = contextLabelTable;
  19650. const coefficientCount = width * height;
  19651. this.neighborsSignificance = new Uint8Array(coefficientCount);
  19652. this.coefficentsSign = new Uint8Array(coefficientCount);
  19653. let coefficentsMagnitude;
  19654. if (mb > 14) {
  19655. coefficentsMagnitude = new Uint32Array(coefficientCount);
  19656. } else if (mb > 6) {
  19657. coefficentsMagnitude = new Uint16Array(coefficientCount);
  19658. } else {
  19659. coefficentsMagnitude = new Uint8Array(coefficientCount);
  19660. }
  19661. this.coefficentsMagnitude = coefficentsMagnitude;
  19662. this.processingFlags = new Uint8Array(coefficientCount);
  19663. const bitsDecoded = new Uint8Array(coefficientCount);
  19664. if (zeroBitPlanes !== 0) {
  19665. for (let i = 0; i < coefficientCount; i++) {
  19666. bitsDecoded[i] = zeroBitPlanes;
  19667. }
  19668. }
  19669. this.bitsDecoded = bitsDecoded;
  19670. this.reset();
  19671. }
  19672. setDecoder(decoder) {
  19673. this.decoder = decoder;
  19674. }
  19675. reset() {
  19676. this.contexts = new Int8Array(19);
  19677. this.contexts[0] = 4 << 1 | 0;
  19678. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  19679. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  19680. }
  19681. setNeighborsSignificance(row, column, index) {
  19682. const neighborsSignificance = this.neighborsSignificance;
  19683. const width = this.width,
  19684. height = this.height;
  19685. const left = column > 0;
  19686. const right = column + 1 < width;
  19687. let i;
  19688. if (row > 0) {
  19689. i = index - width;
  19690. if (left) {
  19691. neighborsSignificance[i - 1] += 0x10;
  19692. }
  19693. if (right) {
  19694. neighborsSignificance[i + 1] += 0x10;
  19695. }
  19696. neighborsSignificance[i] += 0x04;
  19697. }
  19698. if (row + 1 < height) {
  19699. i = index + width;
  19700. if (left) {
  19701. neighborsSignificance[i - 1] += 0x10;
  19702. }
  19703. if (right) {
  19704. neighborsSignificance[i + 1] += 0x10;
  19705. }
  19706. neighborsSignificance[i] += 0x04;
  19707. }
  19708. if (left) {
  19709. neighborsSignificance[index - 1] += 0x01;
  19710. }
  19711. if (right) {
  19712. neighborsSignificance[index + 1] += 0x01;
  19713. }
  19714. neighborsSignificance[index] |= 0x80;
  19715. }
  19716. runSignificancePropagationPass() {
  19717. const decoder = this.decoder;
  19718. const width = this.width,
  19719. height = this.height;
  19720. const coefficentsMagnitude = this.coefficentsMagnitude;
  19721. const coefficentsSign = this.coefficentsSign;
  19722. const neighborsSignificance = this.neighborsSignificance;
  19723. const processingFlags = this.processingFlags;
  19724. const contexts = this.contexts;
  19725. const labels = this.contextLabelTable;
  19726. const bitsDecoded = this.bitsDecoded;
  19727. const processedInverseMask = ~1;
  19728. const processedMask = 1;
  19729. const firstMagnitudeBitMask = 2;
  19730. for (let i0 = 0; i0 < height; i0 += 4) {
  19731. for (let j = 0; j < width; j++) {
  19732. let index = i0 * width + j;
  19733. for (let i1 = 0; i1 < 4; i1++, index += width) {
  19734. const i = i0 + i1;
  19735. if (i >= height) {
  19736. break;
  19737. }
  19738. processingFlags[index] &= processedInverseMask;
  19739. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  19740. continue;
  19741. }
  19742. const contextLabel = labels[neighborsSignificance[index]];
  19743. const decision = decoder.readBit(contexts, contextLabel);
  19744. if (decision) {
  19745. const sign = this.decodeSignBit(i, j, index);
  19746. coefficentsSign[index] = sign;
  19747. coefficentsMagnitude[index] = 1;
  19748. this.setNeighborsSignificance(i, j, index);
  19749. processingFlags[index] |= firstMagnitudeBitMask;
  19750. }
  19751. bitsDecoded[index]++;
  19752. processingFlags[index] |= processedMask;
  19753. }
  19754. }
  19755. }
  19756. }
  19757. decodeSignBit(row, column, index) {
  19758. const width = this.width,
  19759. height = this.height;
  19760. const coefficentsMagnitude = this.coefficentsMagnitude;
  19761. const coefficentsSign = this.coefficentsSign;
  19762. let contribution, sign0, sign1, significance1;
  19763. let contextLabel, decoded;
  19764. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  19765. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  19766. sign1 = coefficentsSign[index + 1];
  19767. if (significance1) {
  19768. sign0 = coefficentsSign[index - 1];
  19769. contribution = 1 - sign1 - sign0;
  19770. } else {
  19771. contribution = 1 - sign1 - sign1;
  19772. }
  19773. } else if (significance1) {
  19774. sign0 = coefficentsSign[index - 1];
  19775. contribution = 1 - sign0 - sign0;
  19776. } else {
  19777. contribution = 0;
  19778. }
  19779. const horizontalContribution = 3 * contribution;
  19780. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  19781. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  19782. sign1 = coefficentsSign[index + width];
  19783. if (significance1) {
  19784. sign0 = coefficentsSign[index - width];
  19785. contribution = 1 - sign1 - sign0 + horizontalContribution;
  19786. } else {
  19787. contribution = 1 - sign1 - sign1 + horizontalContribution;
  19788. }
  19789. } else if (significance1) {
  19790. sign0 = coefficentsSign[index - width];
  19791. contribution = 1 - sign0 - sign0 + horizontalContribution;
  19792. } else {
  19793. contribution = horizontalContribution;
  19794. }
  19795. if (contribution >= 0) {
  19796. contextLabel = 9 + contribution;
  19797. decoded = this.decoder.readBit(this.contexts, contextLabel);
  19798. } else {
  19799. contextLabel = 9 - contribution;
  19800. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  19801. }
  19802. return decoded;
  19803. }
  19804. runMagnitudeRefinementPass() {
  19805. const decoder = this.decoder;
  19806. const width = this.width,
  19807. height = this.height;
  19808. const coefficentsMagnitude = this.coefficentsMagnitude;
  19809. const neighborsSignificance = this.neighborsSignificance;
  19810. const contexts = this.contexts;
  19811. const bitsDecoded = this.bitsDecoded;
  19812. const processingFlags = this.processingFlags;
  19813. const processedMask = 1;
  19814. const firstMagnitudeBitMask = 2;
  19815. const length = width * height;
  19816. const width4 = width * 4;
  19817. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  19818. indexNext = Math.min(length, index0 + width4);
  19819. for (let j = 0; j < width; j++) {
  19820. for (let index = index0 + j; index < indexNext; index += width) {
  19821. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19822. continue;
  19823. }
  19824. let contextLabel = 16;
  19825. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  19826. processingFlags[index] ^= firstMagnitudeBitMask;
  19827. const significance = neighborsSignificance[index] & 127;
  19828. contextLabel = significance === 0 ? 15 : 14;
  19829. }
  19830. const bit = decoder.readBit(contexts, contextLabel);
  19831. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  19832. bitsDecoded[index]++;
  19833. processingFlags[index] |= processedMask;
  19834. }
  19835. }
  19836. }
  19837. }
  19838. runCleanupPass() {
  19839. const decoder = this.decoder;
  19840. const width = this.width,
  19841. height = this.height;
  19842. const neighborsSignificance = this.neighborsSignificance;
  19843. const coefficentsMagnitude = this.coefficentsMagnitude;
  19844. const coefficentsSign = this.coefficentsSign;
  19845. const contexts = this.contexts;
  19846. const labels = this.contextLabelTable;
  19847. const bitsDecoded = this.bitsDecoded;
  19848. const processingFlags = this.processingFlags;
  19849. const processedMask = 1;
  19850. const firstMagnitudeBitMask = 2;
  19851. const oneRowDown = width;
  19852. const twoRowsDown = width * 2;
  19853. const threeRowsDown = width * 3;
  19854. let iNext;
  19855. for (let i0 = 0; i0 < height; i0 = iNext) {
  19856. iNext = Math.min(i0 + 4, height);
  19857. const indexBase = i0 * width;
  19858. const checkAllEmpty = i0 + 3 < height;
  19859. for (let j = 0; j < width; j++) {
  19860. const index0 = indexBase + j;
  19861. 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;
  19862. let i1 = 0,
  19863. index = index0;
  19864. let i = i0,
  19865. sign;
  19866. if (allEmpty) {
  19867. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  19868. if (!hasSignificantCoefficent) {
  19869. bitsDecoded[index0]++;
  19870. bitsDecoded[index0 + oneRowDown]++;
  19871. bitsDecoded[index0 + twoRowsDown]++;
  19872. bitsDecoded[index0 + threeRowsDown]++;
  19873. continue;
  19874. }
  19875. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  19876. if (i1 !== 0) {
  19877. i = i0 + i1;
  19878. index += i1 * width;
  19879. }
  19880. sign = this.decodeSignBit(i, j, index);
  19881. coefficentsSign[index] = sign;
  19882. coefficentsMagnitude[index] = 1;
  19883. this.setNeighborsSignificance(i, j, index);
  19884. processingFlags[index] |= firstMagnitudeBitMask;
  19885. index = index0;
  19886. for (let i2 = i0; i2 <= i; i2++, index += width) {
  19887. bitsDecoded[index]++;
  19888. }
  19889. i1++;
  19890. }
  19891. for (i = i0 + i1; i < iNext; i++, index += width) {
  19892. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19893. continue;
  19894. }
  19895. const contextLabel = labels[neighborsSignificance[index]];
  19896. const decision = decoder.readBit(contexts, contextLabel);
  19897. if (decision === 1) {
  19898. sign = this.decodeSignBit(i, j, index);
  19899. coefficentsSign[index] = sign;
  19900. coefficentsMagnitude[index] = 1;
  19901. this.setNeighborsSignificance(i, j, index);
  19902. processingFlags[index] |= firstMagnitudeBitMask;
  19903. }
  19904. bitsDecoded[index]++;
  19905. }
  19906. }
  19907. }
  19908. }
  19909. checkSegmentationSymbol() {
  19910. const decoder = this.decoder;
  19911. const contexts = this.contexts;
  19912. 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);
  19913. if (symbol !== 0xa) {
  19914. throw new JpxError("Invalid segmentation symbol");
  19915. }
  19916. }
  19917. }
  19918. return BitModel;
  19919. }();
  19920. class Transform {
  19921. constructor() {
  19922. if (this.constructor === Transform) {
  19923. (0, _util.unreachable)("Cannot initialize Transform.");
  19924. }
  19925. }
  19926. calculate(subbands, u0, v0) {
  19927. let ll = subbands[0];
  19928. for (let i = 1, ii = subbands.length; i < ii; i++) {
  19929. ll = this.iterate(ll, subbands[i], u0, v0);
  19930. }
  19931. return ll;
  19932. }
  19933. extend(buffer, offset, size) {
  19934. let i1 = offset - 1,
  19935. j1 = offset + 1;
  19936. let i2 = offset + size - 2,
  19937. j2 = offset + size;
  19938. buffer[i1--] = buffer[j1++];
  19939. buffer[j2++] = buffer[i2--];
  19940. buffer[i1--] = buffer[j1++];
  19941. buffer[j2++] = buffer[i2--];
  19942. buffer[i1--] = buffer[j1++];
  19943. buffer[j2++] = buffer[i2--];
  19944. buffer[i1] = buffer[j1];
  19945. buffer[j2] = buffer[i2];
  19946. }
  19947. filter(x, offset, length) {
  19948. (0, _util.unreachable)("Abstract method `filter` called");
  19949. }
  19950. iterate(ll, hl_lh_hh, u0, v0) {
  19951. const llWidth = ll.width,
  19952. llHeight = ll.height;
  19953. let llItems = ll.items;
  19954. const width = hl_lh_hh.width;
  19955. const height = hl_lh_hh.height;
  19956. const items = hl_lh_hh.items;
  19957. let i, j, k, l, u, v;
  19958. for (k = 0, i = 0; i < llHeight; i++) {
  19959. l = i * 2 * width;
  19960. for (j = 0; j < llWidth; j++, k++, l += 2) {
  19961. items[l] = llItems[k];
  19962. }
  19963. }
  19964. llItems = ll.items = null;
  19965. const bufferPadding = 4;
  19966. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  19967. if (width === 1) {
  19968. if ((u0 & 1) !== 0) {
  19969. for (v = 0, k = 0; v < height; v++, k += width) {
  19970. items[k] *= 0.5;
  19971. }
  19972. }
  19973. } else {
  19974. for (v = 0, k = 0; v < height; v++, k += width) {
  19975. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  19976. this.extend(rowBuffer, bufferPadding, width);
  19977. this.filter(rowBuffer, bufferPadding, width);
  19978. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  19979. }
  19980. }
  19981. let numBuffers = 16;
  19982. const colBuffers = [];
  19983. for (i = 0; i < numBuffers; i++) {
  19984. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  19985. }
  19986. let b,
  19987. currentBuffer = 0;
  19988. ll = bufferPadding + height;
  19989. if (height === 1) {
  19990. if ((v0 & 1) !== 0) {
  19991. for (u = 0; u < width; u++) {
  19992. items[u] *= 0.5;
  19993. }
  19994. }
  19995. } else {
  19996. for (u = 0; u < width; u++) {
  19997. if (currentBuffer === 0) {
  19998. numBuffers = Math.min(width - u, numBuffers);
  19999. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  20000. for (b = 0; b < numBuffers; b++) {
  20001. colBuffers[b][l] = items[k + b];
  20002. }
  20003. }
  20004. currentBuffer = numBuffers;
  20005. }
  20006. currentBuffer--;
  20007. const buffer = colBuffers[currentBuffer];
  20008. this.extend(buffer, bufferPadding, height);
  20009. this.filter(buffer, bufferPadding, height);
  20010. if (currentBuffer === 0) {
  20011. k = u - numBuffers + 1;
  20012. for (l = bufferPadding; l < ll; k += width, l++) {
  20013. for (b = 0; b < numBuffers; b++) {
  20014. items[k + b] = colBuffers[b][l];
  20015. }
  20016. }
  20017. }
  20018. }
  20019. }
  20020. return {
  20021. width,
  20022. height,
  20023. items
  20024. };
  20025. }
  20026. }
  20027. class IrreversibleTransform extends Transform {
  20028. filter(x, offset, length) {
  20029. const len = length >> 1;
  20030. offset |= 0;
  20031. let j, n, current, next;
  20032. const alpha = -1.586134342059924;
  20033. const beta = -0.052980118572961;
  20034. const gamma = 0.882911075530934;
  20035. const delta = 0.443506852043971;
  20036. const K = 1.230174104914001;
  20037. const K_ = 1 / K;
  20038. j = offset - 3;
  20039. for (n = len + 4; n--; j += 2) {
  20040. x[j] *= K_;
  20041. }
  20042. j = offset - 2;
  20043. current = delta * x[j - 1];
  20044. for (n = len + 3; n--; j += 2) {
  20045. next = delta * x[j + 1];
  20046. x[j] = K * x[j] - current - next;
  20047. if (n--) {
  20048. j += 2;
  20049. current = delta * x[j + 1];
  20050. x[j] = K * x[j] - current - next;
  20051. } else {
  20052. break;
  20053. }
  20054. }
  20055. j = offset - 1;
  20056. current = gamma * x[j - 1];
  20057. for (n = len + 2; n--; j += 2) {
  20058. next = gamma * x[j + 1];
  20059. x[j] -= current + next;
  20060. if (n--) {
  20061. j += 2;
  20062. current = gamma * x[j + 1];
  20063. x[j] -= current + next;
  20064. } else {
  20065. break;
  20066. }
  20067. }
  20068. j = offset;
  20069. current = beta * x[j - 1];
  20070. for (n = len + 1; n--; j += 2) {
  20071. next = beta * x[j + 1];
  20072. x[j] -= current + next;
  20073. if (n--) {
  20074. j += 2;
  20075. current = beta * x[j + 1];
  20076. x[j] -= current + next;
  20077. } else {
  20078. break;
  20079. }
  20080. }
  20081. if (len !== 0) {
  20082. j = offset + 1;
  20083. current = alpha * x[j - 1];
  20084. for (n = len; n--; j += 2) {
  20085. next = alpha * x[j + 1];
  20086. x[j] -= current + next;
  20087. if (n--) {
  20088. j += 2;
  20089. current = alpha * x[j + 1];
  20090. x[j] -= current + next;
  20091. } else {
  20092. break;
  20093. }
  20094. }
  20095. }
  20096. }
  20097. }
  20098. class ReversibleTransform extends Transform {
  20099. filter(x, offset, length) {
  20100. const len = length >> 1;
  20101. offset |= 0;
  20102. let j, n;
  20103. for (j = offset, n = len + 1; n--; j += 2) {
  20104. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  20105. }
  20106. for (j = offset + 1, n = len; n--; j += 2) {
  20107. x[j] += x[j - 1] + x[j + 1] >> 1;
  20108. }
  20109. }
  20110. }
  20111. /***/ }),
  20112. /* 29 */
  20113. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20114. Object.defineProperty(exports, "__esModule", ({
  20115. value: true
  20116. }));
  20117. exports.LZWStream = void 0;
  20118. var _decode_stream = __w_pdfjs_require__(17);
  20119. class LZWStream extends _decode_stream.DecodeStream {
  20120. constructor(str, maybeLength, earlyChange) {
  20121. super(maybeLength);
  20122. this.str = str;
  20123. this.dict = str.dict;
  20124. this.cachedData = 0;
  20125. this.bitsCached = 0;
  20126. const maxLzwDictionarySize = 4096;
  20127. const lzwState = {
  20128. earlyChange,
  20129. codeLength: 9,
  20130. nextCode: 258,
  20131. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  20132. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  20133. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  20134. currentSequence: new Uint8Array(maxLzwDictionarySize),
  20135. currentSequenceLength: 0
  20136. };
  20137. for (let i = 0; i < 256; ++i) {
  20138. lzwState.dictionaryValues[i] = i;
  20139. lzwState.dictionaryLengths[i] = 1;
  20140. }
  20141. this.lzwState = lzwState;
  20142. }
  20143. readBits(n) {
  20144. let bitsCached = this.bitsCached;
  20145. let cachedData = this.cachedData;
  20146. while (bitsCached < n) {
  20147. const c = this.str.getByte();
  20148. if (c === -1) {
  20149. this.eof = true;
  20150. return null;
  20151. }
  20152. cachedData = cachedData << 8 | c;
  20153. bitsCached += 8;
  20154. }
  20155. this.bitsCached = bitsCached -= n;
  20156. this.cachedData = cachedData;
  20157. this.lastCode = null;
  20158. return cachedData >>> bitsCached & (1 << n) - 1;
  20159. }
  20160. readBlock() {
  20161. const blockSize = 512,
  20162. decodedSizeDelta = blockSize;
  20163. let estimatedDecodedSize = blockSize * 2;
  20164. let i, j, q;
  20165. const lzwState = this.lzwState;
  20166. if (!lzwState) {
  20167. return;
  20168. }
  20169. const earlyChange = lzwState.earlyChange;
  20170. let nextCode = lzwState.nextCode;
  20171. const dictionaryValues = lzwState.dictionaryValues;
  20172. const dictionaryLengths = lzwState.dictionaryLengths;
  20173. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  20174. let codeLength = lzwState.codeLength;
  20175. let prevCode = lzwState.prevCode;
  20176. const currentSequence = lzwState.currentSequence;
  20177. let currentSequenceLength = lzwState.currentSequenceLength;
  20178. let decodedLength = 0;
  20179. let currentBufferLength = this.bufferLength;
  20180. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  20181. for (i = 0; i < blockSize; i++) {
  20182. const code = this.readBits(codeLength);
  20183. const hasPrev = currentSequenceLength > 0;
  20184. if (code < 256) {
  20185. currentSequence[0] = code;
  20186. currentSequenceLength = 1;
  20187. } else if (code >= 258) {
  20188. if (code < nextCode) {
  20189. currentSequenceLength = dictionaryLengths[code];
  20190. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  20191. currentSequence[j] = dictionaryValues[q];
  20192. q = dictionaryPrevCodes[q];
  20193. }
  20194. } else {
  20195. currentSequence[currentSequenceLength++] = currentSequence[0];
  20196. }
  20197. } else if (code === 256) {
  20198. codeLength = 9;
  20199. nextCode = 258;
  20200. currentSequenceLength = 0;
  20201. continue;
  20202. } else {
  20203. this.eof = true;
  20204. delete this.lzwState;
  20205. break;
  20206. }
  20207. if (hasPrev) {
  20208. dictionaryPrevCodes[nextCode] = prevCode;
  20209. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  20210. dictionaryValues[nextCode] = currentSequence[0];
  20211. nextCode++;
  20212. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  20213. }
  20214. prevCode = code;
  20215. decodedLength += currentSequenceLength;
  20216. if (estimatedDecodedSize < decodedLength) {
  20217. do {
  20218. estimatedDecodedSize += decodedSizeDelta;
  20219. } while (estimatedDecodedSize < decodedLength);
  20220. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  20221. }
  20222. for (j = 0; j < currentSequenceLength; j++) {
  20223. buffer[currentBufferLength++] = currentSequence[j];
  20224. }
  20225. }
  20226. lzwState.nextCode = nextCode;
  20227. lzwState.codeLength = codeLength;
  20228. lzwState.prevCode = prevCode;
  20229. lzwState.currentSequenceLength = currentSequenceLength;
  20230. this.bufferLength = currentBufferLength;
  20231. }
  20232. }
  20233. exports.LZWStream = LZWStream;
  20234. /***/ }),
  20235. /* 30 */
  20236. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20237. Object.defineProperty(exports, "__esModule", ({
  20238. value: true
  20239. }));
  20240. exports.PredictorStream = void 0;
  20241. var _decode_stream = __w_pdfjs_require__(17);
  20242. var _primitives = __w_pdfjs_require__(3);
  20243. var _util = __w_pdfjs_require__(2);
  20244. class PredictorStream extends _decode_stream.DecodeStream {
  20245. constructor(str, maybeLength, params) {
  20246. super(maybeLength);
  20247. if (!(params instanceof _primitives.Dict)) {
  20248. return str;
  20249. }
  20250. const predictor = this.predictor = params.get("Predictor") || 1;
  20251. if (predictor <= 1) {
  20252. return str;
  20253. }
  20254. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  20255. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  20256. }
  20257. if (predictor === 2) {
  20258. this.readBlock = this.readBlockTiff;
  20259. } else {
  20260. this.readBlock = this.readBlockPng;
  20261. }
  20262. this.str = str;
  20263. this.dict = str.dict;
  20264. const colors = this.colors = params.get("Colors") || 1;
  20265. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  20266. const columns = this.columns = params.get("Columns") || 1;
  20267. this.pixBytes = colors * bits + 7 >> 3;
  20268. this.rowBytes = columns * colors * bits + 7 >> 3;
  20269. return this;
  20270. }
  20271. readBlockTiff() {
  20272. const rowBytes = this.rowBytes;
  20273. const bufferLength = this.bufferLength;
  20274. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  20275. const bits = this.bits;
  20276. const colors = this.colors;
  20277. const rawBytes = this.str.getBytes(rowBytes);
  20278. this.eof = !rawBytes.length;
  20279. if (this.eof) {
  20280. return;
  20281. }
  20282. let inbuf = 0,
  20283. outbuf = 0;
  20284. let inbits = 0,
  20285. outbits = 0;
  20286. let pos = bufferLength;
  20287. let i;
  20288. if (bits === 1 && colors === 1) {
  20289. for (i = 0; i < rowBytes; ++i) {
  20290. let c = rawBytes[i] ^ inbuf;
  20291. c ^= c >> 1;
  20292. c ^= c >> 2;
  20293. c ^= c >> 4;
  20294. inbuf = (c & 1) << 7;
  20295. buffer[pos++] = c;
  20296. }
  20297. } else if (bits === 8) {
  20298. for (i = 0; i < colors; ++i) {
  20299. buffer[pos++] = rawBytes[i];
  20300. }
  20301. for (; i < rowBytes; ++i) {
  20302. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  20303. pos++;
  20304. }
  20305. } else if (bits === 16) {
  20306. const bytesPerPixel = colors * 2;
  20307. for (i = 0; i < bytesPerPixel; ++i) {
  20308. buffer[pos++] = rawBytes[i];
  20309. }
  20310. for (; i < rowBytes; i += 2) {
  20311. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  20312. buffer[pos++] = sum >> 8 & 0xff;
  20313. buffer[pos++] = sum & 0xff;
  20314. }
  20315. } else {
  20316. const compArray = new Uint8Array(colors + 1);
  20317. const bitMask = (1 << bits) - 1;
  20318. let j = 0,
  20319. k = bufferLength;
  20320. const columns = this.columns;
  20321. for (i = 0; i < columns; ++i) {
  20322. for (let kk = 0; kk < colors; ++kk) {
  20323. if (inbits < bits) {
  20324. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  20325. inbits += 8;
  20326. }
  20327. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  20328. inbits -= bits;
  20329. outbuf = outbuf << bits | compArray[kk];
  20330. outbits += bits;
  20331. if (outbits >= 8) {
  20332. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  20333. outbits -= 8;
  20334. }
  20335. }
  20336. }
  20337. if (outbits > 0) {
  20338. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  20339. }
  20340. }
  20341. this.bufferLength += rowBytes;
  20342. }
  20343. readBlockPng() {
  20344. const rowBytes = this.rowBytes;
  20345. const pixBytes = this.pixBytes;
  20346. const predictor = this.str.getByte();
  20347. const rawBytes = this.str.getBytes(rowBytes);
  20348. this.eof = !rawBytes.length;
  20349. if (this.eof) {
  20350. return;
  20351. }
  20352. const bufferLength = this.bufferLength;
  20353. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  20354. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  20355. if (prevRow.length === 0) {
  20356. prevRow = new Uint8Array(rowBytes);
  20357. }
  20358. let i,
  20359. j = bufferLength,
  20360. up,
  20361. c;
  20362. switch (predictor) {
  20363. case 0:
  20364. for (i = 0; i < rowBytes; ++i) {
  20365. buffer[j++] = rawBytes[i];
  20366. }
  20367. break;
  20368. case 1:
  20369. for (i = 0; i < pixBytes; ++i) {
  20370. buffer[j++] = rawBytes[i];
  20371. }
  20372. for (; i < rowBytes; ++i) {
  20373. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  20374. j++;
  20375. }
  20376. break;
  20377. case 2:
  20378. for (i = 0; i < rowBytes; ++i) {
  20379. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  20380. }
  20381. break;
  20382. case 3:
  20383. for (i = 0; i < pixBytes; ++i) {
  20384. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  20385. }
  20386. for (; i < rowBytes; ++i) {
  20387. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  20388. j++;
  20389. }
  20390. break;
  20391. case 4:
  20392. for (i = 0; i < pixBytes; ++i) {
  20393. up = prevRow[i];
  20394. c = rawBytes[i];
  20395. buffer[j++] = up + c;
  20396. }
  20397. for (; i < rowBytes; ++i) {
  20398. up = prevRow[i];
  20399. const upLeft = prevRow[i - pixBytes];
  20400. const left = buffer[j - pixBytes];
  20401. const p = left + up - upLeft;
  20402. let pa = p - left;
  20403. if (pa < 0) {
  20404. pa = -pa;
  20405. }
  20406. let pb = p - up;
  20407. if (pb < 0) {
  20408. pb = -pb;
  20409. }
  20410. let pc = p - upLeft;
  20411. if (pc < 0) {
  20412. pc = -pc;
  20413. }
  20414. c = rawBytes[i];
  20415. if (pa <= pb && pa <= pc) {
  20416. buffer[j++] = left + c;
  20417. } else if (pb <= pc) {
  20418. buffer[j++] = up + c;
  20419. } else {
  20420. buffer[j++] = upLeft + c;
  20421. }
  20422. }
  20423. break;
  20424. default:
  20425. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  20426. }
  20427. this.bufferLength += rowBytes;
  20428. }
  20429. }
  20430. exports.PredictorStream = PredictorStream;
  20431. /***/ }),
  20432. /* 31 */
  20433. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20434. Object.defineProperty(exports, "__esModule", ({
  20435. value: true
  20436. }));
  20437. exports.RunLengthStream = void 0;
  20438. var _decode_stream = __w_pdfjs_require__(17);
  20439. class RunLengthStream extends _decode_stream.DecodeStream {
  20440. constructor(str, maybeLength) {
  20441. super(maybeLength);
  20442. this.str = str;
  20443. this.dict = str.dict;
  20444. }
  20445. readBlock() {
  20446. const repeatHeader = this.str.getBytes(2);
  20447. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  20448. this.eof = true;
  20449. return;
  20450. }
  20451. let buffer;
  20452. let bufferLength = this.bufferLength;
  20453. let n = repeatHeader[0];
  20454. if (n < 128) {
  20455. buffer = this.ensureBuffer(bufferLength + n + 1);
  20456. buffer[bufferLength++] = repeatHeader[1];
  20457. if (n > 0) {
  20458. const source = this.str.getBytes(n);
  20459. buffer.set(source, bufferLength);
  20460. bufferLength += n;
  20461. }
  20462. } else {
  20463. n = 257 - n;
  20464. const b = repeatHeader[1];
  20465. buffer = this.ensureBuffer(bufferLength + n + 1);
  20466. for (let i = 0; i < n; i++) {
  20467. buffer[bufferLength++] = b;
  20468. }
  20469. }
  20470. this.bufferLength = bufferLength;
  20471. }
  20472. }
  20473. exports.RunLengthStream = RunLengthStream;
  20474. /***/ }),
  20475. /* 32 */
  20476. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20477. Object.defineProperty(exports, "__esModule", ({
  20478. value: true
  20479. }));
  20480. exports.Font = exports.ErrorFont = void 0;
  20481. var _util = __w_pdfjs_require__(2);
  20482. var _cff_parser = __w_pdfjs_require__(33);
  20483. var _fonts_utils = __w_pdfjs_require__(36);
  20484. var _unicode = __w_pdfjs_require__(38);
  20485. var _glyphlist = __w_pdfjs_require__(37);
  20486. var _encodings = __w_pdfjs_require__(35);
  20487. var _standard_fonts = __w_pdfjs_require__(39);
  20488. var _to_unicode_map = __w_pdfjs_require__(40);
  20489. var _cff_font = __w_pdfjs_require__(41);
  20490. var _font_renderer = __w_pdfjs_require__(42);
  20491. var _metrics = __w_pdfjs_require__(43);
  20492. var _glyf = __w_pdfjs_require__(44);
  20493. var _cmap = __w_pdfjs_require__(14);
  20494. var _opentype_file_builder = __w_pdfjs_require__(45);
  20495. var _core_utils = __w_pdfjs_require__(4);
  20496. var _stream = __w_pdfjs_require__(8);
  20497. var _type1_font = __w_pdfjs_require__(46);
  20498. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  20499. const PDF_GLYPH_SPACE_UNITS = 1000;
  20500. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  20501. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  20502. function adjustWidths(properties) {
  20503. if (!properties.fontMatrix) {
  20504. return;
  20505. }
  20506. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  20507. return;
  20508. }
  20509. const scale = 0.001 / properties.fontMatrix[0];
  20510. const glyphsWidths = properties.widths;
  20511. for (const glyph in glyphsWidths) {
  20512. glyphsWidths[glyph] *= scale;
  20513. }
  20514. properties.defaultWidth *= scale;
  20515. }
  20516. function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) {
  20517. if (properties.isInternalFont) {
  20518. return;
  20519. }
  20520. if (properties.hasIncludedToUnicodeMap) {
  20521. return;
  20522. }
  20523. if (properties.hasEncoding) {
  20524. return;
  20525. }
  20526. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20527. return;
  20528. }
  20529. if (!isSymbolicFont) {
  20530. return;
  20531. }
  20532. if (nameRecords.length === 0) {
  20533. return;
  20534. }
  20535. if (properties.defaultEncoding === _encodings.WinAnsiEncoding) {
  20536. return;
  20537. }
  20538. for (const r of nameRecords) {
  20539. if (!isWinNameRecord(r)) {
  20540. return;
  20541. }
  20542. }
  20543. const encoding = _encodings.WinAnsiEncoding;
  20544. const toUnicode = [],
  20545. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20546. for (const charCode in encoding) {
  20547. const glyphName = encoding[charCode];
  20548. if (glyphName === "") {
  20549. continue;
  20550. }
  20551. const unicode = glyphsUnicodeMap[glyphName];
  20552. if (unicode === undefined) {
  20553. continue;
  20554. }
  20555. toUnicode[charCode] = String.fromCharCode(unicode);
  20556. }
  20557. if (toUnicode.length > 0) {
  20558. properties.toUnicode.amend(toUnicode);
  20559. }
  20560. }
  20561. function adjustType1ToUnicode(properties, builtInEncoding) {
  20562. if (properties.isInternalFont) {
  20563. return;
  20564. }
  20565. if (properties.hasIncludedToUnicodeMap) {
  20566. return;
  20567. }
  20568. if (builtInEncoding === properties.defaultEncoding) {
  20569. return;
  20570. }
  20571. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20572. return;
  20573. }
  20574. const toUnicode = [],
  20575. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20576. for (const charCode in builtInEncoding) {
  20577. if (properties.hasEncoding) {
  20578. if (properties.baseEncodingName || properties.differences[charCode] !== undefined) {
  20579. continue;
  20580. }
  20581. }
  20582. const glyphName = builtInEncoding[charCode];
  20583. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20584. if (unicode !== -1) {
  20585. toUnicode[charCode] = String.fromCharCode(unicode);
  20586. }
  20587. }
  20588. if (toUnicode.length > 0) {
  20589. properties.toUnicode.amend(toUnicode);
  20590. }
  20591. }
  20592. function amendFallbackToUnicode(properties) {
  20593. if (!properties.fallbackToUnicode) {
  20594. return;
  20595. }
  20596. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20597. return;
  20598. }
  20599. const toUnicode = [];
  20600. for (const charCode in properties.fallbackToUnicode) {
  20601. if (properties.toUnicode.has(charCode)) {
  20602. continue;
  20603. }
  20604. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  20605. }
  20606. if (toUnicode.length > 0) {
  20607. properties.toUnicode.amend(toUnicode);
  20608. }
  20609. }
  20610. class Glyph {
  20611. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20612. this.originalCharCode = originalCharCode;
  20613. this.fontChar = fontChar;
  20614. this.unicode = unicode;
  20615. this.accent = accent;
  20616. this.width = width;
  20617. this.vmetric = vmetric;
  20618. this.operatorListId = operatorListId;
  20619. this.isSpace = isSpace;
  20620. this.isInFont = isInFont;
  20621. }
  20622. get category() {
  20623. return (0, _util.shadow)(this, "category", (0, _unicode.getCharUnicodeCategory)(this.unicode), true);
  20624. }
  20625. get normalizedUnicode() {
  20626. return (0, _util.shadow)(this, "normalizedUnicode", (0, _unicode.reverseIfRtl)(Glyph._NormalizedUnicodes[this.unicode] || this.unicode), true);
  20627. }
  20628. static get _NormalizedUnicodes() {
  20629. return (0, _util.shadow)(this, "_NormalizedUnicodes", (0, _unicode.getNormalizedUnicodes)());
  20630. }
  20631. }
  20632. function int16(b0, b1) {
  20633. return (b0 << 8) + b1;
  20634. }
  20635. function writeSignedInt16(bytes, index, value) {
  20636. bytes[index + 1] = value;
  20637. bytes[index] = value >>> 8;
  20638. }
  20639. function signedInt16(b0, b1) {
  20640. const value = (b0 << 8) + b1;
  20641. return value & 1 << 15 ? value - 0x10000 : value;
  20642. }
  20643. function int32(b0, b1, b2, b3) {
  20644. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  20645. }
  20646. function string16(value) {
  20647. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20648. }
  20649. function safeString16(value) {
  20650. if (value > 0x7fff) {
  20651. value = 0x7fff;
  20652. } else if (value < -0x8000) {
  20653. value = -0x8000;
  20654. }
  20655. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20656. }
  20657. function isTrueTypeFile(file) {
  20658. const header = file.peekBytes(4);
  20659. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  20660. }
  20661. function isTrueTypeCollectionFile(file) {
  20662. const header = file.peekBytes(4);
  20663. return (0, _util.bytesToString)(header) === "ttcf";
  20664. }
  20665. function isOpenTypeFile(file) {
  20666. const header = file.peekBytes(4);
  20667. return (0, _util.bytesToString)(header) === "OTTO";
  20668. }
  20669. function isType1File(file) {
  20670. const header = file.peekBytes(2);
  20671. if (header[0] === 0x25 && header[1] === 0x21) {
  20672. return true;
  20673. }
  20674. if (header[0] === 0x80 && header[1] === 0x01) {
  20675. return true;
  20676. }
  20677. return false;
  20678. }
  20679. function isCFFFile(file) {
  20680. const header = file.peekBytes(4);
  20681. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  20682. return true;
  20683. }
  20684. return false;
  20685. }
  20686. function getFontFileType(file, {
  20687. type,
  20688. subtype,
  20689. composite
  20690. }) {
  20691. let fileType, fileSubtype;
  20692. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  20693. if (composite) {
  20694. fileType = "CIDFontType2";
  20695. } else {
  20696. fileType = "TrueType";
  20697. }
  20698. } else if (isOpenTypeFile(file)) {
  20699. if (composite) {
  20700. fileType = "CIDFontType2";
  20701. } else {
  20702. fileType = "OpenType";
  20703. }
  20704. } else if (isType1File(file)) {
  20705. if (composite) {
  20706. fileType = "CIDFontType0";
  20707. } else {
  20708. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20709. }
  20710. } else if (isCFFFile(file)) {
  20711. if (composite) {
  20712. fileType = "CIDFontType0";
  20713. fileSubtype = "CIDFontType0C";
  20714. } else {
  20715. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20716. fileSubtype = "Type1C";
  20717. }
  20718. } else {
  20719. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  20720. fileType = type;
  20721. fileSubtype = subtype;
  20722. }
  20723. return [fileType, fileSubtype];
  20724. }
  20725. function applyStandardFontGlyphMap(map, glyphMap) {
  20726. for (const charCode in glyphMap) {
  20727. map[+charCode] = glyphMap[charCode];
  20728. }
  20729. }
  20730. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  20731. const toFontChar = [];
  20732. let unicode;
  20733. for (let i = 0, ii = encoding.length; i < ii; i++) {
  20734. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  20735. if (unicode !== -1) {
  20736. toFontChar[i] = unicode;
  20737. }
  20738. }
  20739. for (const charCode in differences) {
  20740. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  20741. if (unicode !== -1) {
  20742. toFontChar[+charCode] = unicode;
  20743. }
  20744. }
  20745. return toFontChar;
  20746. }
  20747. function isMacNameRecord(r) {
  20748. return r.platform === 1 && r.encoding === 0 && r.language === 0;
  20749. }
  20750. function isWinNameRecord(r) {
  20751. return r.platform === 3 && r.encoding === 1 && r.language === 0x409;
  20752. }
  20753. function convertCidString(charCode, cid, shouldThrow = false) {
  20754. switch (cid.length) {
  20755. case 1:
  20756. return cid.charCodeAt(0);
  20757. case 2:
  20758. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  20759. }
  20760. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  20761. if (shouldThrow) {
  20762. throw new _util.FormatError(msg);
  20763. }
  20764. (0, _util.warn)(msg);
  20765. return cid;
  20766. }
  20767. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  20768. const newMap = Object.create(null);
  20769. const toUnicodeExtraMap = new Map();
  20770. const toFontChar = [];
  20771. const usedGlyphIds = new Set();
  20772. let privateUseAreaIndex = 0;
  20773. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20774. let nextAvailableFontCharCode = privateUseOffetStart;
  20775. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20776. for (let originalCharCode in charCodeToGlyphId) {
  20777. originalCharCode |= 0;
  20778. let glyphId = charCodeToGlyphId[originalCharCode];
  20779. if (!hasGlyph(glyphId)) {
  20780. continue;
  20781. }
  20782. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  20783. privateUseAreaIndex++;
  20784. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  20785. (0, _util.warn)("Ran out of space in font private use area.");
  20786. break;
  20787. }
  20788. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20789. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20790. }
  20791. const fontCharCode = nextAvailableFontCharCode++;
  20792. if (glyphId === 0) {
  20793. glyphId = newGlyphZeroId;
  20794. }
  20795. let unicode = toUnicode.get(originalCharCode);
  20796. if (typeof unicode === "string") {
  20797. unicode = unicode.codePointAt(0);
  20798. }
  20799. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  20800. toUnicodeExtraMap.set(unicode, glyphId);
  20801. usedGlyphIds.add(glyphId);
  20802. }
  20803. newMap[fontCharCode] = glyphId;
  20804. toFontChar[originalCharCode] = fontCharCode;
  20805. }
  20806. return {
  20807. toFontChar,
  20808. charCodeToGlyphId: newMap,
  20809. toUnicodeExtraMap,
  20810. nextAvailableFontCharCode
  20811. };
  20812. }
  20813. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  20814. const codes = [];
  20815. for (const charCode in glyphs) {
  20816. if (glyphs[charCode] >= numGlyphs) {
  20817. continue;
  20818. }
  20819. codes.push({
  20820. fontCharCode: charCode | 0,
  20821. glyphId: glyphs[charCode]
  20822. });
  20823. }
  20824. if (toUnicodeExtraMap) {
  20825. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  20826. if (glyphId >= numGlyphs) {
  20827. continue;
  20828. }
  20829. codes.push({
  20830. fontCharCode: unicode,
  20831. glyphId
  20832. });
  20833. }
  20834. }
  20835. if (codes.length === 0) {
  20836. codes.push({
  20837. fontCharCode: 0,
  20838. glyphId: 0
  20839. });
  20840. }
  20841. codes.sort(function fontGetRangesSort(a, b) {
  20842. return a.fontCharCode - b.fontCharCode;
  20843. });
  20844. const ranges = [];
  20845. const length = codes.length;
  20846. for (let n = 0; n < length;) {
  20847. const start = codes[n].fontCharCode;
  20848. const codeIndices = [codes[n].glyphId];
  20849. ++n;
  20850. let end = start;
  20851. while (n < length && end + 1 === codes[n].fontCharCode) {
  20852. codeIndices.push(codes[n].glyphId);
  20853. ++end;
  20854. ++n;
  20855. if (end === 0xffff) {
  20856. break;
  20857. }
  20858. }
  20859. ranges.push([start, end, codeIndices]);
  20860. }
  20861. return ranges;
  20862. }
  20863. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  20864. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  20865. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  20866. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  20867. let i, ii, j, jj;
  20868. for (i = ranges.length - 1; i >= 0; --i) {
  20869. if (ranges[i][0] <= 0xffff) {
  20870. break;
  20871. }
  20872. }
  20873. const bmpLength = i + 1;
  20874. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  20875. ranges[i][1] = 0xfffe;
  20876. }
  20877. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  20878. const segCount = bmpLength + trailingRangesCount;
  20879. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  20880. let startCount = "";
  20881. let endCount = "";
  20882. let idDeltas = "";
  20883. let idRangeOffsets = "";
  20884. let glyphsIds = "";
  20885. let bias = 0;
  20886. let range, start, end, codes;
  20887. for (i = 0, ii = bmpLength; i < ii; i++) {
  20888. range = ranges[i];
  20889. start = range[0];
  20890. end = range[1];
  20891. startCount += string16(start);
  20892. endCount += string16(end);
  20893. codes = range[2];
  20894. let contiguous = true;
  20895. for (j = 1, jj = codes.length; j < jj; ++j) {
  20896. if (codes[j] !== codes[j - 1] + 1) {
  20897. contiguous = false;
  20898. break;
  20899. }
  20900. }
  20901. if (!contiguous) {
  20902. const offset = (segCount - i) * 2 + bias * 2;
  20903. bias += end - start + 1;
  20904. idDeltas += string16(0);
  20905. idRangeOffsets += string16(offset);
  20906. for (j = 0, jj = codes.length; j < jj; ++j) {
  20907. glyphsIds += string16(codes[j]);
  20908. }
  20909. } else {
  20910. const startCode = codes[0];
  20911. idDeltas += string16(startCode - start & 0xffff);
  20912. idRangeOffsets += string16(0);
  20913. }
  20914. }
  20915. if (trailingRangesCount > 0) {
  20916. endCount += "\xFF\xFF";
  20917. startCount += "\xFF\xFF";
  20918. idDeltas += "\x00\x01";
  20919. idRangeOffsets += "\x00\x00";
  20920. }
  20921. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  20922. let format31012 = "";
  20923. let header31012 = "";
  20924. if (numTables > 1) {
  20925. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  20926. format31012 = "";
  20927. for (i = 0, ii = ranges.length; i < ii; i++) {
  20928. range = ranges[i];
  20929. start = range[0];
  20930. codes = range[2];
  20931. let code = codes[0];
  20932. for (j = 1, jj = codes.length; j < jj; ++j) {
  20933. if (codes[j] !== codes[j - 1] + 1) {
  20934. end = range[0] + j - 1;
  20935. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  20936. start = end + 1;
  20937. code = codes[j];
  20938. }
  20939. }
  20940. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  20941. }
  20942. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  20943. }
  20944. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  20945. }
  20946. function validateOS2Table(os2, file) {
  20947. file.pos = (file.start || 0) + os2.offset;
  20948. const version = file.getUint16();
  20949. file.skip(60);
  20950. const selection = file.getUint16();
  20951. if (version < 4 && selection & 0x0300) {
  20952. return false;
  20953. }
  20954. const firstChar = file.getUint16();
  20955. const lastChar = file.getUint16();
  20956. if (firstChar > lastChar) {
  20957. return false;
  20958. }
  20959. file.skip(6);
  20960. const usWinAscent = file.getUint16();
  20961. if (usWinAscent === 0) {
  20962. return false;
  20963. }
  20964. os2.data[8] = os2.data[9] = 0;
  20965. return true;
  20966. }
  20967. function createOS2Table(properties, charstrings, override) {
  20968. override = override || {
  20969. unitsPerEm: 0,
  20970. yMax: 0,
  20971. yMin: 0,
  20972. ascent: 0,
  20973. descent: 0
  20974. };
  20975. let ulUnicodeRange1 = 0;
  20976. let ulUnicodeRange2 = 0;
  20977. let ulUnicodeRange3 = 0;
  20978. let ulUnicodeRange4 = 0;
  20979. let firstCharIndex = null;
  20980. let lastCharIndex = 0;
  20981. if (charstrings) {
  20982. for (let code in charstrings) {
  20983. code |= 0;
  20984. if (firstCharIndex > code || !firstCharIndex) {
  20985. firstCharIndex = code;
  20986. }
  20987. if (lastCharIndex < code) {
  20988. lastCharIndex = code;
  20989. }
  20990. const position = (0, _unicode.getUnicodeRangeFor)(code);
  20991. if (position < 32) {
  20992. ulUnicodeRange1 |= 1 << position;
  20993. } else if (position < 64) {
  20994. ulUnicodeRange2 |= 1 << position - 32;
  20995. } else if (position < 96) {
  20996. ulUnicodeRange3 |= 1 << position - 64;
  20997. } else if (position < 123) {
  20998. ulUnicodeRange4 |= 1 << position - 96;
  20999. } else {
  21000. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  21001. }
  21002. }
  21003. if (lastCharIndex > 0xffff) {
  21004. lastCharIndex = 0xffff;
  21005. }
  21006. } else {
  21007. firstCharIndex = 0;
  21008. lastCharIndex = 255;
  21009. }
  21010. const bbox = properties.bbox || [0, 0, 0, 0];
  21011. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  21012. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  21013. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  21014. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  21015. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  21016. typoDescent = -typoDescent;
  21017. }
  21018. const winAscent = override.yMax || typoAscent;
  21019. const winDescent = -override.yMin || -typoDescent;
  21020. 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";
  21021. }
  21022. function createPostTable(properties) {
  21023. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  21024. 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";
  21025. }
  21026. function createPostscriptName(name) {
  21027. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  21028. }
  21029. function createNameTable(name, proto) {
  21030. if (!proto) {
  21031. proto = [[], []];
  21032. }
  21033. 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"];
  21034. const stringsUnicode = [];
  21035. let i, ii, j, jj, str;
  21036. for (i = 0, ii = strings.length; i < ii; i++) {
  21037. str = proto[1][i] || strings[i];
  21038. const strBufUnicode = [];
  21039. for (j = 0, jj = str.length; j < jj; j++) {
  21040. strBufUnicode.push(string16(str.charCodeAt(j)));
  21041. }
  21042. stringsUnicode.push(strBufUnicode.join(""));
  21043. }
  21044. const names = [strings, stringsUnicode];
  21045. const platforms = ["\x00\x01", "\x00\x03"];
  21046. const encodings = ["\x00\x00", "\x00\x01"];
  21047. const languages = ["\x00\x00", "\x04\x09"];
  21048. const namesRecordCount = strings.length * platforms.length;
  21049. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  21050. let strOffset = 0;
  21051. for (i = 0, ii = platforms.length; i < ii; i++) {
  21052. const strs = names[i];
  21053. for (j = 0, jj = strs.length; j < jj; j++) {
  21054. str = strs[j];
  21055. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  21056. nameTable += nameRecord;
  21057. strOffset += str.length;
  21058. }
  21059. }
  21060. nameTable += strings.join("") + stringsUnicode.join("");
  21061. return nameTable;
  21062. }
  21063. class Font {
  21064. constructor(name, file, properties) {
  21065. this.name = name;
  21066. this.psName = null;
  21067. this.mimetype = null;
  21068. this.disableFontFace = false;
  21069. this.loadedName = properties.loadedName;
  21070. this.isType3Font = properties.isType3Font;
  21071. this.missingFile = false;
  21072. this.cssFontInfo = properties.cssFontInfo;
  21073. this._charsCache = Object.create(null);
  21074. this._glyphCache = Object.create(null);
  21075. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  21076. if (!isSerifFont && !properties.isSimulatedFlags) {
  21077. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  21078. serifFonts = (0, _standard_fonts.getSerifFonts)();
  21079. for (const namePart of baseName.split("+")) {
  21080. if (serifFonts[namePart]) {
  21081. isSerifFont = true;
  21082. break;
  21083. }
  21084. }
  21085. }
  21086. this.isSerifFont = isSerifFont;
  21087. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  21088. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  21089. let {
  21090. type,
  21091. subtype
  21092. } = properties;
  21093. this.type = type;
  21094. this.subtype = subtype;
  21095. const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
  21096. this.isInvalidPDFjsFont = !!matches;
  21097. if (this.isInvalidPDFjsFont) {
  21098. this.fallbackName = matches[1];
  21099. } else if (this.isMonospace) {
  21100. this.fallbackName = "monospace";
  21101. } else if (this.isSerifFont) {
  21102. this.fallbackName = "serif";
  21103. } else {
  21104. this.fallbackName = "sans-serif";
  21105. }
  21106. this.differences = properties.differences;
  21107. this.widths = properties.widths;
  21108. this.defaultWidth = properties.defaultWidth;
  21109. this.composite = properties.composite;
  21110. this.cMap = properties.cMap;
  21111. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  21112. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  21113. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  21114. this.lineHeight = this.ascent - this.descent;
  21115. this.fontMatrix = properties.fontMatrix;
  21116. this.bbox = properties.bbox;
  21117. this.defaultEncoding = properties.defaultEncoding;
  21118. this.toUnicode = properties.toUnicode;
  21119. this.toFontChar = [];
  21120. if (properties.type === "Type3") {
  21121. for (let charCode = 0; charCode < 256; charCode++) {
  21122. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  21123. }
  21124. return;
  21125. }
  21126. this.cidEncoding = properties.cidEncoding || "";
  21127. this.vertical = !!properties.vertical;
  21128. if (this.vertical) {
  21129. this.vmetrics = properties.vmetrics;
  21130. this.defaultVMetrics = properties.defaultVMetrics;
  21131. }
  21132. if (!file || file.isEmpty) {
  21133. if (file) {
  21134. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  21135. }
  21136. this.fallbackToSystemFont(properties);
  21137. return;
  21138. }
  21139. [type, subtype] = getFontFileType(file, properties);
  21140. if (type !== this.type || subtype !== this.subtype) {
  21141. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  21142. }
  21143. let data;
  21144. try {
  21145. switch (type) {
  21146. case "MMType1":
  21147. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  21148. case "Type1":
  21149. case "CIDFontType0":
  21150. this.mimetype = "font/opentype";
  21151. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  21152. adjustWidths(properties);
  21153. data = this.convert(name, cff, properties);
  21154. break;
  21155. case "OpenType":
  21156. case "TrueType":
  21157. case "CIDFontType2":
  21158. this.mimetype = "font/opentype";
  21159. data = this.checkAndRepair(name, file, properties);
  21160. if (this.isOpenType) {
  21161. adjustWidths(properties);
  21162. type = "OpenType";
  21163. }
  21164. break;
  21165. default:
  21166. throw new _util.FormatError(`Font ${type} is not supported`);
  21167. }
  21168. } catch (e) {
  21169. (0, _util.warn)(e);
  21170. this.fallbackToSystemFont(properties);
  21171. return;
  21172. }
  21173. amendFallbackToUnicode(properties);
  21174. this.data = data;
  21175. this.type = type;
  21176. this.subtype = subtype;
  21177. this.fontMatrix = properties.fontMatrix;
  21178. this.widths = properties.widths;
  21179. this.defaultWidth = properties.defaultWidth;
  21180. this.toUnicode = properties.toUnicode;
  21181. this.seacMap = properties.seacMap;
  21182. }
  21183. get renderer() {
  21184. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  21185. return (0, _util.shadow)(this, "renderer", renderer);
  21186. }
  21187. exportData(extraProperties = false) {
  21188. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  21189. const data = Object.create(null);
  21190. let property, value;
  21191. for (property of exportDataProperties) {
  21192. value = this[property];
  21193. if (value !== undefined) {
  21194. data[property] = value;
  21195. }
  21196. }
  21197. return data;
  21198. }
  21199. fallbackToSystemFont(properties) {
  21200. this.missingFile = true;
  21201. const {
  21202. name,
  21203. type
  21204. } = this;
  21205. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  21206. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  21207. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  21208. const isStandardFont = !!stdFontMap[fontName];
  21209. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  21210. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  21211. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  21212. const metrics = fontBasicMetricsMap[fontName];
  21213. if (metrics) {
  21214. if (isNaN(this.ascent)) {
  21215. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  21216. }
  21217. if (isNaN(this.descent)) {
  21218. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  21219. }
  21220. if (isNaN(this.capHeight)) {
  21221. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  21222. }
  21223. }
  21224. this.bold = /bold/gi.test(fontName);
  21225. this.italic = /oblique|italic/gi.test(fontName);
  21226. this.black = /Black/g.test(name);
  21227. const isNarrow = /Narrow/g.test(name);
  21228. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  21229. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  21230. const cidToGidMap = properties.cidToGidMap;
  21231. const map = [];
  21232. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  21233. if (/Arial-?Black/i.test(name)) {
  21234. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  21235. } else if (/Calibri/i.test(name)) {
  21236. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  21237. }
  21238. if (cidToGidMap) {
  21239. for (const charCode in map) {
  21240. const cid = map[charCode];
  21241. if (cidToGidMap[cid] !== undefined) {
  21242. map[+charCode] = cidToGidMap[cid];
  21243. }
  21244. }
  21245. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  21246. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21247. const cid = map[charCode];
  21248. if (cidToGidMap[cid] === undefined) {
  21249. map[+charCode] = unicodeCharCode;
  21250. }
  21251. });
  21252. }
  21253. }
  21254. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  21255. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21256. map[+charCode] = unicodeCharCode;
  21257. });
  21258. }
  21259. this.toFontChar = map;
  21260. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  21261. } else if (/Symbol/i.test(fontName)) {
  21262. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  21263. } else if (/Dingbats/i.test(fontName)) {
  21264. if (/Wingdings/i.test(name)) {
  21265. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  21266. }
  21267. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  21268. } else if (isStandardFont) {
  21269. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  21270. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  21271. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  21272. map[+charCode] = unicodeCharCode;
  21273. });
  21274. }
  21275. this.toFontChar = map;
  21276. } else {
  21277. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  21278. const map = [];
  21279. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  21280. if (!this.composite) {
  21281. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  21282. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  21283. if (unicode !== -1) {
  21284. unicodeCharCode = unicode;
  21285. }
  21286. }
  21287. map[+charCode] = unicodeCharCode;
  21288. });
  21289. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  21290. if (/Tahoma|Verdana/i.test(name)) {
  21291. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  21292. }
  21293. }
  21294. this.toFontChar = map;
  21295. }
  21296. amendFallbackToUnicode(properties);
  21297. this.loadedName = fontName.split("-")[0];
  21298. }
  21299. checkAndRepair(name, font, properties) {
  21300. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  21301. function readTables(file, numTables) {
  21302. const tables = Object.create(null);
  21303. tables["OS/2"] = null;
  21304. tables.cmap = null;
  21305. tables.head = null;
  21306. tables.hhea = null;
  21307. tables.hmtx = null;
  21308. tables.maxp = null;
  21309. tables.name = null;
  21310. tables.post = null;
  21311. for (let i = 0; i < numTables; i++) {
  21312. const table = readTableEntry(file);
  21313. if (!VALID_TABLES.includes(table.tag)) {
  21314. continue;
  21315. }
  21316. if (table.length === 0) {
  21317. continue;
  21318. }
  21319. tables[table.tag] = table;
  21320. }
  21321. return tables;
  21322. }
  21323. function readTableEntry(file) {
  21324. const tag = file.getString(4);
  21325. const checksum = file.getInt32() >>> 0;
  21326. const offset = file.getInt32() >>> 0;
  21327. const length = file.getInt32() >>> 0;
  21328. const previousPosition = file.pos;
  21329. file.pos = file.start || 0;
  21330. file.skip(offset);
  21331. const data = file.getBytes(length);
  21332. file.pos = previousPosition;
  21333. if (tag === "head") {
  21334. data[8] = data[9] = data[10] = data[11] = 0;
  21335. data[17] |= 0x20;
  21336. }
  21337. return {
  21338. tag,
  21339. checksum,
  21340. length,
  21341. offset,
  21342. data
  21343. };
  21344. }
  21345. function readOpenTypeHeader(ttf) {
  21346. return {
  21347. version: ttf.getString(4),
  21348. numTables: ttf.getUint16(),
  21349. searchRange: ttf.getUint16(),
  21350. entrySelector: ttf.getUint16(),
  21351. rangeShift: ttf.getUint16()
  21352. };
  21353. }
  21354. function readTrueTypeCollectionHeader(ttc) {
  21355. const ttcTag = ttc.getString(4);
  21356. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  21357. const majorVersion = ttc.getUint16();
  21358. const minorVersion = ttc.getUint16();
  21359. const numFonts = ttc.getInt32() >>> 0;
  21360. const offsetTable = [];
  21361. for (let i = 0; i < numFonts; i++) {
  21362. offsetTable.push(ttc.getInt32() >>> 0);
  21363. }
  21364. const header = {
  21365. ttcTag,
  21366. majorVersion,
  21367. minorVersion,
  21368. numFonts,
  21369. offsetTable
  21370. };
  21371. switch (majorVersion) {
  21372. case 1:
  21373. return header;
  21374. case 2:
  21375. header.dsigTag = ttc.getInt32() >>> 0;
  21376. header.dsigLength = ttc.getInt32() >>> 0;
  21377. header.dsigOffset = ttc.getInt32() >>> 0;
  21378. return header;
  21379. }
  21380. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  21381. }
  21382. function readTrueTypeCollectionData(ttc, fontName) {
  21383. const {
  21384. numFonts,
  21385. offsetTable
  21386. } = readTrueTypeCollectionHeader(ttc);
  21387. const fontNameParts = fontName.split("+");
  21388. let fallbackData;
  21389. for (let i = 0; i < numFonts; i++) {
  21390. ttc.pos = (ttc.start || 0) + offsetTable[i];
  21391. const potentialHeader = readOpenTypeHeader(ttc);
  21392. const potentialTables = readTables(ttc, potentialHeader.numTables);
  21393. if (!potentialTables.name) {
  21394. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  21395. }
  21396. const [nameTable] = readNameTable(potentialTables.name);
  21397. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  21398. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  21399. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  21400. if (!nameEntry) {
  21401. continue;
  21402. }
  21403. if (nameEntry === fontName) {
  21404. return {
  21405. header: potentialHeader,
  21406. tables: potentialTables
  21407. };
  21408. }
  21409. if (fontNameParts.length < 2) {
  21410. continue;
  21411. }
  21412. for (const part of fontNameParts) {
  21413. if (nameEntry === part) {
  21414. fallbackData = {
  21415. name: part,
  21416. header: potentialHeader,
  21417. tables: potentialTables
  21418. };
  21419. }
  21420. }
  21421. }
  21422. }
  21423. }
  21424. if (fallbackData) {
  21425. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  21426. return {
  21427. header: fallbackData.header,
  21428. tables: fallbackData.tables
  21429. };
  21430. }
  21431. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  21432. }
  21433. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  21434. if (!cmap) {
  21435. (0, _util.warn)("No cmap table available.");
  21436. return {
  21437. platformId: -1,
  21438. encodingId: -1,
  21439. mappings: [],
  21440. hasShortCmap: false
  21441. };
  21442. }
  21443. let segment;
  21444. let start = (file.start || 0) + cmap.offset;
  21445. file.pos = start;
  21446. file.skip(2);
  21447. const numTables = file.getUint16();
  21448. let potentialTable;
  21449. let canBreak = false;
  21450. for (let i = 0; i < numTables; i++) {
  21451. const platformId = file.getUint16();
  21452. const encodingId = file.getUint16();
  21453. const offset = file.getInt32() >>> 0;
  21454. let useTable = false;
  21455. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  21456. continue;
  21457. }
  21458. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  21459. useTable = true;
  21460. } else if (platformId === 1 && encodingId === 0) {
  21461. useTable = true;
  21462. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  21463. useTable = true;
  21464. if (!isSymbolicFont) {
  21465. canBreak = true;
  21466. }
  21467. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  21468. useTable = true;
  21469. let correctlySorted = true;
  21470. if (i < numTables - 1) {
  21471. const nextBytes = file.peekBytes(2),
  21472. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  21473. if (nextPlatformId < platformId) {
  21474. correctlySorted = false;
  21475. }
  21476. }
  21477. if (correctlySorted) {
  21478. canBreak = true;
  21479. }
  21480. }
  21481. if (useTable) {
  21482. potentialTable = {
  21483. platformId,
  21484. encodingId,
  21485. offset
  21486. };
  21487. }
  21488. if (canBreak) {
  21489. break;
  21490. }
  21491. }
  21492. if (potentialTable) {
  21493. file.pos = start + potentialTable.offset;
  21494. }
  21495. if (!potentialTable || file.peekByte() === -1) {
  21496. (0, _util.warn)("Could not find a preferred cmap table.");
  21497. return {
  21498. platformId: -1,
  21499. encodingId: -1,
  21500. mappings: [],
  21501. hasShortCmap: false
  21502. };
  21503. }
  21504. const format = file.getUint16();
  21505. let hasShortCmap = false;
  21506. const mappings = [];
  21507. let j, glyphId;
  21508. if (format === 0) {
  21509. file.skip(2 + 2);
  21510. for (j = 0; j < 256; j++) {
  21511. const index = file.getByte();
  21512. if (!index) {
  21513. continue;
  21514. }
  21515. mappings.push({
  21516. charCode: j,
  21517. glyphId: index
  21518. });
  21519. }
  21520. hasShortCmap = true;
  21521. } else if (format === 2) {
  21522. file.skip(2 + 2);
  21523. const subHeaderKeys = [];
  21524. let maxSubHeaderKey = 0;
  21525. for (let i = 0; i < 256; i++) {
  21526. const subHeaderKey = file.getUint16() >> 3;
  21527. subHeaderKeys.push(subHeaderKey);
  21528. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  21529. }
  21530. const subHeaders = [];
  21531. for (let i = 0; i <= maxSubHeaderKey; i++) {
  21532. subHeaders.push({
  21533. firstCode: file.getUint16(),
  21534. entryCount: file.getUint16(),
  21535. idDelta: signedInt16(file.getByte(), file.getByte()),
  21536. idRangePos: file.pos + file.getUint16()
  21537. });
  21538. }
  21539. for (let i = 0; i < 256; i++) {
  21540. if (subHeaderKeys[i] === 0) {
  21541. file.pos = subHeaders[0].idRangePos + 2 * i;
  21542. glyphId = file.getUint16();
  21543. mappings.push({
  21544. charCode: i,
  21545. glyphId
  21546. });
  21547. } else {
  21548. const s = subHeaders[subHeaderKeys[i]];
  21549. for (j = 0; j < s.entryCount; j++) {
  21550. const charCode = (i << 8) + j + s.firstCode;
  21551. file.pos = s.idRangePos + 2 * j;
  21552. glyphId = file.getUint16();
  21553. if (glyphId !== 0) {
  21554. glyphId = (glyphId + s.idDelta) % 65536;
  21555. }
  21556. mappings.push({
  21557. charCode,
  21558. glyphId
  21559. });
  21560. }
  21561. }
  21562. }
  21563. } else if (format === 4) {
  21564. file.skip(2 + 2);
  21565. const segCount = file.getUint16() >> 1;
  21566. file.skip(6);
  21567. const segments = [];
  21568. let segIndex;
  21569. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21570. segments.push({
  21571. end: file.getUint16()
  21572. });
  21573. }
  21574. file.skip(2);
  21575. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21576. segments[segIndex].start = file.getUint16();
  21577. }
  21578. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21579. segments[segIndex].delta = file.getUint16();
  21580. }
  21581. let offsetsCount = 0,
  21582. offsetIndex;
  21583. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21584. segment = segments[segIndex];
  21585. const rangeOffset = file.getUint16();
  21586. if (!rangeOffset) {
  21587. segment.offsetIndex = -1;
  21588. continue;
  21589. }
  21590. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  21591. segment.offsetIndex = offsetIndex;
  21592. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  21593. }
  21594. const offsets = [];
  21595. for (j = 0; j < offsetsCount; j++) {
  21596. offsets.push(file.getUint16());
  21597. }
  21598. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21599. segment = segments[segIndex];
  21600. start = segment.start;
  21601. const end = segment.end;
  21602. const delta = segment.delta;
  21603. offsetIndex = segment.offsetIndex;
  21604. for (j = start; j <= end; j++) {
  21605. if (j === 0xffff) {
  21606. continue;
  21607. }
  21608. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  21609. glyphId = glyphId + delta & 0xffff;
  21610. mappings.push({
  21611. charCode: j,
  21612. glyphId
  21613. });
  21614. }
  21615. }
  21616. } else if (format === 6) {
  21617. file.skip(2 + 2);
  21618. const firstCode = file.getUint16();
  21619. const entryCount = file.getUint16();
  21620. for (j = 0; j < entryCount; j++) {
  21621. glyphId = file.getUint16();
  21622. const charCode = firstCode + j;
  21623. mappings.push({
  21624. charCode,
  21625. glyphId
  21626. });
  21627. }
  21628. } else if (format === 12) {
  21629. file.skip(2 + 4 + 4);
  21630. const nGroups = file.getInt32() >>> 0;
  21631. for (j = 0; j < nGroups; j++) {
  21632. const startCharCode = file.getInt32() >>> 0;
  21633. const endCharCode = file.getInt32() >>> 0;
  21634. let glyphCode = file.getInt32() >>> 0;
  21635. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  21636. mappings.push({
  21637. charCode,
  21638. glyphId: glyphCode++
  21639. });
  21640. }
  21641. }
  21642. } else {
  21643. (0, _util.warn)("cmap table has unsupported format: " + format);
  21644. return {
  21645. platformId: -1,
  21646. encodingId: -1,
  21647. mappings: [],
  21648. hasShortCmap: false
  21649. };
  21650. }
  21651. mappings.sort(function (a, b) {
  21652. return a.charCode - b.charCode;
  21653. });
  21654. for (let i = 1; i < mappings.length; i++) {
  21655. if (mappings[i - 1].charCode === mappings[i].charCode) {
  21656. mappings.splice(i, 1);
  21657. i--;
  21658. }
  21659. }
  21660. return {
  21661. platformId: potentialTable.platformId,
  21662. encodingId: potentialTable.encodingId,
  21663. mappings,
  21664. hasShortCmap
  21665. };
  21666. }
  21667. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  21668. if (!header) {
  21669. if (metrics) {
  21670. metrics.data = null;
  21671. }
  21672. return;
  21673. }
  21674. file.pos = (file.start || 0) + header.offset;
  21675. file.pos += 4;
  21676. file.pos += 2;
  21677. file.pos += 2;
  21678. file.pos += 2;
  21679. file.pos += 2;
  21680. file.pos += 2;
  21681. file.pos += 2;
  21682. file.pos += 2;
  21683. file.pos += 2;
  21684. file.pos += 2;
  21685. const caretOffset = file.getUint16();
  21686. file.pos += 8;
  21687. file.pos += 2;
  21688. let numOfMetrics = file.getUint16();
  21689. if (caretOffset !== 0) {
  21690. const macStyle = int16(headTable.data[44], headTable.data[45]);
  21691. if (!(macStyle & 2)) {
  21692. header.data[22] = 0;
  21693. header.data[23] = 0;
  21694. }
  21695. }
  21696. if (numOfMetrics > numGlyphs) {
  21697. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  21698. numOfMetrics = numGlyphs;
  21699. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  21700. header.data[35] = numOfMetrics & 0x00ff;
  21701. }
  21702. const numOfSidebearings = numGlyphs - numOfMetrics;
  21703. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  21704. if (numMissing > 0) {
  21705. const entries = new Uint8Array(metrics.length + numMissing * 2);
  21706. entries.set(metrics.data);
  21707. if (dupFirstEntry) {
  21708. entries[metrics.length] = metrics.data[2];
  21709. entries[metrics.length + 1] = metrics.data[3];
  21710. }
  21711. metrics.data = entries;
  21712. }
  21713. }
  21714. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  21715. const glyphProfile = {
  21716. length: 0,
  21717. sizeOfInstructions: 0
  21718. };
  21719. if (sourceEnd - sourceStart <= 12) {
  21720. return glyphProfile;
  21721. }
  21722. const glyf = source.subarray(sourceStart, sourceEnd);
  21723. let contoursCount = signedInt16(glyf[0], glyf[1]);
  21724. if (contoursCount < 0) {
  21725. contoursCount = -1;
  21726. writeSignedInt16(glyf, 0, contoursCount);
  21727. dest.set(glyf, destStart);
  21728. glyphProfile.length = glyf.length;
  21729. return glyphProfile;
  21730. }
  21731. let i,
  21732. j = 10,
  21733. flagsCount = 0;
  21734. for (i = 0; i < contoursCount; i++) {
  21735. const endPoint = glyf[j] << 8 | glyf[j + 1];
  21736. flagsCount = endPoint + 1;
  21737. j += 2;
  21738. }
  21739. const instructionsStart = j;
  21740. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  21741. glyphProfile.sizeOfInstructions = instructionsLength;
  21742. j += 2 + instructionsLength;
  21743. const instructionsEnd = j;
  21744. let coordinatesLength = 0;
  21745. for (i = 0; i < flagsCount; i++) {
  21746. const flag = glyf[j++];
  21747. if (flag & 0xc0) {
  21748. glyf[j - 1] = flag & 0x3f;
  21749. }
  21750. let xLength = 2;
  21751. if (flag & 2) {
  21752. xLength = 1;
  21753. } else if (flag & 16) {
  21754. xLength = 0;
  21755. }
  21756. let yLength = 2;
  21757. if (flag & 4) {
  21758. yLength = 1;
  21759. } else if (flag & 32) {
  21760. yLength = 0;
  21761. }
  21762. const xyLength = xLength + yLength;
  21763. coordinatesLength += xyLength;
  21764. if (flag & 8) {
  21765. const repeat = glyf[j++];
  21766. i += repeat;
  21767. coordinatesLength += repeat * xyLength;
  21768. }
  21769. }
  21770. if (coordinatesLength === 0) {
  21771. return glyphProfile;
  21772. }
  21773. let glyphDataLength = j + coordinatesLength;
  21774. if (glyphDataLength > glyf.length) {
  21775. return glyphProfile;
  21776. }
  21777. if (!hintsValid && instructionsLength > 0) {
  21778. dest.set(glyf.subarray(0, instructionsStart), destStart);
  21779. dest.set([0, 0], destStart + instructionsStart);
  21780. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  21781. glyphDataLength -= instructionsLength;
  21782. if (glyf.length - glyphDataLength > 3) {
  21783. glyphDataLength = glyphDataLength + 3 & ~3;
  21784. }
  21785. glyphProfile.length = glyphDataLength;
  21786. return glyphProfile;
  21787. }
  21788. if (glyf.length - glyphDataLength > 3) {
  21789. glyphDataLength = glyphDataLength + 3 & ~3;
  21790. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  21791. glyphProfile.length = glyphDataLength;
  21792. return glyphProfile;
  21793. }
  21794. dest.set(glyf, destStart);
  21795. glyphProfile.length = glyf.length;
  21796. return glyphProfile;
  21797. }
  21798. function sanitizeHead(head, numGlyphs, locaLength) {
  21799. const data = head.data;
  21800. const version = int32(data[0], data[1], data[2], data[3]);
  21801. if (version >> 16 !== 1) {
  21802. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  21803. data[0] = 0;
  21804. data[1] = 1;
  21805. data[2] = 0;
  21806. data[3] = 0;
  21807. }
  21808. const indexToLocFormat = int16(data[50], data[51]);
  21809. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  21810. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  21811. const numGlyphsPlusOne = numGlyphs + 1;
  21812. if (locaLength === numGlyphsPlusOne << 1) {
  21813. data[50] = 0;
  21814. data[51] = 0;
  21815. } else if (locaLength === numGlyphsPlusOne << 2) {
  21816. data[50] = 0;
  21817. data[51] = 1;
  21818. } else {
  21819. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  21820. }
  21821. }
  21822. }
  21823. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  21824. let itemSize, itemDecode, itemEncode;
  21825. if (isGlyphLocationsLong) {
  21826. itemSize = 4;
  21827. itemDecode = function fontItemDecodeLong(data, offset) {
  21828. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  21829. };
  21830. itemEncode = function fontItemEncodeLong(data, offset, value) {
  21831. data[offset] = value >>> 24 & 0xff;
  21832. data[offset + 1] = value >> 16 & 0xff;
  21833. data[offset + 2] = value >> 8 & 0xff;
  21834. data[offset + 3] = value & 0xff;
  21835. };
  21836. } else {
  21837. itemSize = 2;
  21838. itemDecode = function fontItemDecode(data, offset) {
  21839. return data[offset] << 9 | data[offset + 1] << 1;
  21840. };
  21841. itemEncode = function fontItemEncode(data, offset, value) {
  21842. data[offset] = value >> 9 & 0xff;
  21843. data[offset + 1] = value >> 1 & 0xff;
  21844. };
  21845. }
  21846. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  21847. const locaDataSize = itemSize * (1 + numGlyphsOut);
  21848. const locaData = new Uint8Array(locaDataSize);
  21849. locaData.set(loca.data.subarray(0, locaDataSize));
  21850. loca.data = locaData;
  21851. const oldGlyfData = glyf.data;
  21852. const oldGlyfDataLength = oldGlyfData.length;
  21853. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  21854. let i, j;
  21855. const locaEntries = [];
  21856. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  21857. let offset = itemDecode(locaData, j);
  21858. if (offset > oldGlyfDataLength) {
  21859. offset = oldGlyfDataLength;
  21860. }
  21861. locaEntries.push({
  21862. index: i,
  21863. offset,
  21864. endOffset: 0
  21865. });
  21866. }
  21867. locaEntries.sort((a, b) => {
  21868. return a.offset - b.offset;
  21869. });
  21870. for (i = 0; i < numGlyphs; i++) {
  21871. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  21872. }
  21873. locaEntries.sort((a, b) => {
  21874. return a.index - b.index;
  21875. });
  21876. for (i = 0; i < numGlyphs; i++) {
  21877. const {
  21878. offset,
  21879. endOffset
  21880. } = locaEntries[i];
  21881. if (offset !== 0 || endOffset !== 0) {
  21882. break;
  21883. }
  21884. const nextOffset = locaEntries[i + 1].offset;
  21885. if (nextOffset === 0) {
  21886. continue;
  21887. }
  21888. locaEntries[i].endOffset = nextOffset;
  21889. break;
  21890. }
  21891. const missingGlyphs = Object.create(null);
  21892. let writeOffset = 0;
  21893. itemEncode(locaData, 0, writeOffset);
  21894. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  21895. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  21896. const newLength = glyphProfile.length;
  21897. if (newLength === 0) {
  21898. missingGlyphs[i] = true;
  21899. }
  21900. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  21901. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  21902. }
  21903. writeOffset += newLength;
  21904. itemEncode(locaData, j, writeOffset);
  21905. }
  21906. if (writeOffset === 0) {
  21907. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  21908. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  21909. itemEncode(locaData, j, simpleGlyph.length);
  21910. }
  21911. glyf.data = simpleGlyph;
  21912. } else if (dupFirstEntry) {
  21913. const firstEntryLength = itemDecode(locaData, itemSize);
  21914. if (newGlyfData.length > firstEntryLength + writeOffset) {
  21915. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  21916. } else {
  21917. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  21918. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  21919. }
  21920. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  21921. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  21922. } else {
  21923. glyf.data = newGlyfData.subarray(0, writeOffset);
  21924. }
  21925. return {
  21926. missingGlyphs,
  21927. maxSizeOfInstructions
  21928. };
  21929. }
  21930. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  21931. const start = (font.start || 0) + post.offset;
  21932. font.pos = start;
  21933. const length = post.length,
  21934. end = start + length;
  21935. const version = font.getInt32();
  21936. font.skip(28);
  21937. let glyphNames;
  21938. let valid = true;
  21939. let i;
  21940. switch (version) {
  21941. case 0x00010000:
  21942. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  21943. break;
  21944. case 0x00020000:
  21945. const numGlyphs = font.getUint16();
  21946. if (numGlyphs !== maxpNumGlyphs) {
  21947. valid = false;
  21948. break;
  21949. }
  21950. const glyphNameIndexes = [];
  21951. for (i = 0; i < numGlyphs; ++i) {
  21952. const index = font.getUint16();
  21953. if (index >= 32768) {
  21954. valid = false;
  21955. break;
  21956. }
  21957. glyphNameIndexes.push(index);
  21958. }
  21959. if (!valid) {
  21960. break;
  21961. }
  21962. const customNames = [],
  21963. strBuf = [];
  21964. while (font.pos < end) {
  21965. const stringLength = font.getByte();
  21966. strBuf.length = stringLength;
  21967. for (i = 0; i < stringLength; ++i) {
  21968. strBuf[i] = String.fromCharCode(font.getByte());
  21969. }
  21970. customNames.push(strBuf.join(""));
  21971. }
  21972. glyphNames = [];
  21973. for (i = 0; i < numGlyphs; ++i) {
  21974. const j = glyphNameIndexes[i];
  21975. if (j < 258) {
  21976. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  21977. continue;
  21978. }
  21979. glyphNames.push(customNames[j - 258]);
  21980. }
  21981. break;
  21982. case 0x00030000:
  21983. break;
  21984. default:
  21985. (0, _util.warn)("Unknown/unsupported post table version " + version);
  21986. valid = false;
  21987. if (propertiesObj.defaultEncoding) {
  21988. glyphNames = propertiesObj.defaultEncoding;
  21989. }
  21990. break;
  21991. }
  21992. propertiesObj.glyphNames = glyphNames;
  21993. return valid;
  21994. }
  21995. function readNameTable(nameTable) {
  21996. const start = (font.start || 0) + nameTable.offset;
  21997. font.pos = start;
  21998. const names = [[], []],
  21999. records = [];
  22000. const length = nameTable.length,
  22001. end = start + length;
  22002. const format = font.getUint16();
  22003. const FORMAT_0_HEADER_LENGTH = 6;
  22004. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  22005. return [names, records];
  22006. }
  22007. const numRecords = font.getUint16();
  22008. const stringsStart = font.getUint16();
  22009. const NAME_RECORD_LENGTH = 12;
  22010. let i, ii;
  22011. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  22012. const r = {
  22013. platform: font.getUint16(),
  22014. encoding: font.getUint16(),
  22015. language: font.getUint16(),
  22016. name: font.getUint16(),
  22017. length: font.getUint16(),
  22018. offset: font.getUint16()
  22019. };
  22020. if (isMacNameRecord(r) || isWinNameRecord(r)) {
  22021. records.push(r);
  22022. }
  22023. }
  22024. for (i = 0, ii = records.length; i < ii; i++) {
  22025. const record = records[i];
  22026. if (record.length <= 0) {
  22027. continue;
  22028. }
  22029. const pos = start + stringsStart + record.offset;
  22030. if (pos + record.length > end) {
  22031. continue;
  22032. }
  22033. font.pos = pos;
  22034. const nameIndex = record.name;
  22035. if (record.encoding) {
  22036. let str = "";
  22037. for (let j = 0, jj = record.length; j < jj; j += 2) {
  22038. str += String.fromCharCode(font.getUint16());
  22039. }
  22040. names[1][nameIndex] = str;
  22041. } else {
  22042. names[0][nameIndex] = font.getString(record.length);
  22043. }
  22044. }
  22045. return [names, records];
  22046. }
  22047. 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];
  22048. function sanitizeTTProgram(table, ttContext) {
  22049. let data = table.data;
  22050. let i = 0,
  22051. j,
  22052. n,
  22053. b,
  22054. funcId,
  22055. pc,
  22056. lastEndf = 0,
  22057. lastDeff = 0;
  22058. const stack = [];
  22059. const callstack = [];
  22060. const functionsCalled = [];
  22061. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  22062. let inFDEF = false,
  22063. ifLevel = 0,
  22064. inELSE = 0;
  22065. for (let ii = data.length; i < ii;) {
  22066. const op = data[i++];
  22067. if (op === 0x40) {
  22068. n = data[i++];
  22069. if (inFDEF || inELSE) {
  22070. i += n;
  22071. } else {
  22072. for (j = 0; j < n; j++) {
  22073. stack.push(data[i++]);
  22074. }
  22075. }
  22076. } else if (op === 0x41) {
  22077. n = data[i++];
  22078. if (inFDEF || inELSE) {
  22079. i += n * 2;
  22080. } else {
  22081. for (j = 0; j < n; j++) {
  22082. b = data[i++];
  22083. stack.push(b << 8 | data[i++]);
  22084. }
  22085. }
  22086. } else if ((op & 0xf8) === 0xb0) {
  22087. n = op - 0xb0 + 1;
  22088. if (inFDEF || inELSE) {
  22089. i += n;
  22090. } else {
  22091. for (j = 0; j < n; j++) {
  22092. stack.push(data[i++]);
  22093. }
  22094. }
  22095. } else if ((op & 0xf8) === 0xb8) {
  22096. n = op - 0xb8 + 1;
  22097. if (inFDEF || inELSE) {
  22098. i += n * 2;
  22099. } else {
  22100. for (j = 0; j < n; j++) {
  22101. b = data[i++];
  22102. stack.push(b << 8 | data[i++]);
  22103. }
  22104. }
  22105. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  22106. if (!inFDEF && !inELSE) {
  22107. funcId = stack.at(-1);
  22108. if (isNaN(funcId)) {
  22109. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  22110. } else {
  22111. ttContext.functionsUsed[funcId] = true;
  22112. if (funcId in ttContext.functionsStackDeltas) {
  22113. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  22114. if (newStackLength < 0) {
  22115. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  22116. ttContext.hintsValid = false;
  22117. return;
  22118. }
  22119. stack.length = newStackLength;
  22120. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  22121. callstack.push({
  22122. data,
  22123. i,
  22124. stackTop: stack.length - 1
  22125. });
  22126. functionsCalled.push(funcId);
  22127. pc = ttContext.functionsDefined[funcId];
  22128. if (!pc) {
  22129. (0, _util.warn)("TT: CALL non-existent function");
  22130. ttContext.hintsValid = false;
  22131. return;
  22132. }
  22133. data = pc.data;
  22134. i = pc.i;
  22135. }
  22136. }
  22137. }
  22138. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  22139. if (inFDEF || inELSE) {
  22140. (0, _util.warn)("TT: nested FDEFs not allowed");
  22141. tooComplexToFollowFunctions = true;
  22142. }
  22143. inFDEF = true;
  22144. lastDeff = i;
  22145. funcId = stack.pop();
  22146. ttContext.functionsDefined[funcId] = {
  22147. data,
  22148. i
  22149. };
  22150. } else if (op === 0x2d) {
  22151. if (inFDEF) {
  22152. inFDEF = false;
  22153. lastEndf = i;
  22154. } else {
  22155. pc = callstack.pop();
  22156. if (!pc) {
  22157. (0, _util.warn)("TT: ENDF bad stack");
  22158. ttContext.hintsValid = false;
  22159. return;
  22160. }
  22161. funcId = functionsCalled.pop();
  22162. data = pc.data;
  22163. i = pc.i;
  22164. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  22165. }
  22166. } else if (op === 0x89) {
  22167. if (inFDEF || inELSE) {
  22168. (0, _util.warn)("TT: nested IDEFs not allowed");
  22169. tooComplexToFollowFunctions = true;
  22170. }
  22171. inFDEF = true;
  22172. lastDeff = i;
  22173. } else if (op === 0x58) {
  22174. ++ifLevel;
  22175. } else if (op === 0x1b) {
  22176. inELSE = ifLevel;
  22177. } else if (op === 0x59) {
  22178. if (inELSE === ifLevel) {
  22179. inELSE = 0;
  22180. }
  22181. --ifLevel;
  22182. } else if (op === 0x1c) {
  22183. if (!inFDEF && !inELSE) {
  22184. const offset = stack.at(-1);
  22185. if (offset > 0) {
  22186. i += offset - 1;
  22187. }
  22188. }
  22189. }
  22190. if (!inFDEF && !inELSE) {
  22191. let stackDelta = 0;
  22192. if (op <= 0x8e) {
  22193. stackDelta = TTOpsStackDeltas[op];
  22194. } else if (op >= 0xc0 && op <= 0xdf) {
  22195. stackDelta = -1;
  22196. } else if (op >= 0xe0) {
  22197. stackDelta = -2;
  22198. }
  22199. if (op >= 0x71 && op <= 0x75) {
  22200. n = stack.pop();
  22201. if (!isNaN(n)) {
  22202. stackDelta = -n * 2;
  22203. }
  22204. }
  22205. while (stackDelta < 0 && stack.length > 0) {
  22206. stack.pop();
  22207. stackDelta++;
  22208. }
  22209. while (stackDelta > 0) {
  22210. stack.push(NaN);
  22211. stackDelta--;
  22212. }
  22213. }
  22214. }
  22215. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  22216. const content = [data];
  22217. if (i > data.length) {
  22218. content.push(new Uint8Array(i - data.length));
  22219. }
  22220. if (lastDeff > lastEndf) {
  22221. (0, _util.warn)("TT: complementing a missing function tail");
  22222. content.push(new Uint8Array([0x22, 0x2d]));
  22223. }
  22224. foldTTTable(table, content);
  22225. }
  22226. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  22227. if (ttContext.tooComplexToFollowFunctions) {
  22228. return;
  22229. }
  22230. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  22231. (0, _util.warn)("TT: more functions defined than expected");
  22232. ttContext.hintsValid = false;
  22233. return;
  22234. }
  22235. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  22236. if (j > maxFunctionDefs) {
  22237. (0, _util.warn)("TT: invalid function id: " + j);
  22238. ttContext.hintsValid = false;
  22239. return;
  22240. }
  22241. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  22242. (0, _util.warn)("TT: undefined function: " + j);
  22243. ttContext.hintsValid = false;
  22244. return;
  22245. }
  22246. }
  22247. }
  22248. function foldTTTable(table, content) {
  22249. if (content.length > 1) {
  22250. let newLength = 0;
  22251. let j, jj;
  22252. for (j = 0, jj = content.length; j < jj; j++) {
  22253. newLength += content[j].length;
  22254. }
  22255. newLength = newLength + 3 & ~3;
  22256. const result = new Uint8Array(newLength);
  22257. let pos = 0;
  22258. for (j = 0, jj = content.length; j < jj; j++) {
  22259. result.set(content[j], pos);
  22260. pos += content[j].length;
  22261. }
  22262. table.data = result;
  22263. table.length = newLength;
  22264. }
  22265. }
  22266. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  22267. const ttContext = {
  22268. functionsDefined: [],
  22269. functionsUsed: [],
  22270. functionsStackDeltas: [],
  22271. tooComplexToFollowFunctions: false,
  22272. hintsValid: true
  22273. };
  22274. if (fpgm) {
  22275. sanitizeTTProgram(fpgm, ttContext);
  22276. }
  22277. if (prep) {
  22278. sanitizeTTProgram(prep, ttContext);
  22279. }
  22280. if (fpgm) {
  22281. checkInvalidFunctions(ttContext, maxFunctionDefs);
  22282. }
  22283. if (cvt && cvt.length & 1) {
  22284. const cvtData = new Uint8Array(cvt.length + 1);
  22285. cvtData.set(cvt.data);
  22286. cvt.data = cvtData;
  22287. }
  22288. return ttContext.hintsValid;
  22289. }
  22290. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  22291. let header, tables;
  22292. if (isTrueTypeCollectionFile(font)) {
  22293. const ttcData = readTrueTypeCollectionData(font, this.name);
  22294. header = ttcData.header;
  22295. tables = ttcData.tables;
  22296. } else {
  22297. header = readOpenTypeHeader(font);
  22298. tables = readTables(font, header.numTables);
  22299. }
  22300. let cff, cffFile;
  22301. const isTrueType = !tables["CFF "];
  22302. if (!isTrueType) {
  22303. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  22304. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  22305. cffFile = new _stream.Stream(tables["CFF "].data);
  22306. cff = new _cff_font.CFFFont(cffFile, properties);
  22307. adjustWidths(properties);
  22308. return this.convert(name, cff, properties);
  22309. }
  22310. delete tables.glyf;
  22311. delete tables.loca;
  22312. delete tables.fpgm;
  22313. delete tables.prep;
  22314. delete tables["cvt "];
  22315. this.isOpenType = true;
  22316. } else {
  22317. if (!tables.loca) {
  22318. throw new _util.FormatError('Required "loca" table is not found');
  22319. }
  22320. if (!tables.glyf) {
  22321. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  22322. tables.glyf = {
  22323. tag: "glyf",
  22324. data: new Uint8Array(0)
  22325. };
  22326. }
  22327. this.isOpenType = false;
  22328. }
  22329. if (!tables.maxp) {
  22330. throw new _util.FormatError('Required "maxp" table is not found');
  22331. }
  22332. font.pos = (font.start || 0) + tables.maxp.offset;
  22333. const version = font.getInt32();
  22334. const numGlyphs = font.getUint16();
  22335. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  22336. const {
  22337. scaleFactors
  22338. } = properties;
  22339. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  22340. const glyphs = new _glyf.GlyfTable({
  22341. glyfTable: tables.glyf.data,
  22342. isGlyphLocationsLong,
  22343. locaTable: tables.loca.data,
  22344. numGlyphs
  22345. });
  22346. glyphs.scale(scaleFactors);
  22347. const {
  22348. glyf,
  22349. loca,
  22350. isLocationLong
  22351. } = glyphs.write();
  22352. tables.glyf.data = glyf;
  22353. tables.loca.data = loca;
  22354. if (isLocationLong !== !!isGlyphLocationsLong) {
  22355. tables.head.data[50] = 0;
  22356. tables.head.data[51] = isLocationLong ? 1 : 0;
  22357. }
  22358. const metrics = tables.hmtx.data;
  22359. for (let i = 0; i < numGlyphs; i++) {
  22360. const j = 4 * i;
  22361. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  22362. metrics[j] = advanceWidth >> 8 & 0xff;
  22363. metrics[j + 1] = advanceWidth & 0xff;
  22364. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  22365. writeSignedInt16(metrics, j + 2, lsb);
  22366. }
  22367. }
  22368. let numGlyphsOut = numGlyphs + 1;
  22369. let dupFirstEntry = true;
  22370. if (numGlyphsOut > 0xffff) {
  22371. dupFirstEntry = false;
  22372. numGlyphsOut = numGlyphs;
  22373. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  22374. }
  22375. let maxFunctionDefs = 0;
  22376. let maxSizeOfInstructions = 0;
  22377. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22378. font.pos += 8;
  22379. const maxZones = font.getUint16();
  22380. if (maxZones > 2) {
  22381. tables.maxp.data[14] = 0;
  22382. tables.maxp.data[15] = 2;
  22383. }
  22384. font.pos += 4;
  22385. maxFunctionDefs = font.getUint16();
  22386. font.pos += 4;
  22387. maxSizeOfInstructions = font.getUint16();
  22388. }
  22389. tables.maxp.data[4] = numGlyphsOut >> 8;
  22390. tables.maxp.data[5] = numGlyphsOut & 255;
  22391. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  22392. if (!hintsValid) {
  22393. delete tables.fpgm;
  22394. delete tables.prep;
  22395. delete tables["cvt "];
  22396. }
  22397. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  22398. if (!tables.head) {
  22399. throw new _util.FormatError('Required "head" table is not found');
  22400. }
  22401. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  22402. let missingGlyphs = Object.create(null);
  22403. if (isTrueType) {
  22404. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  22405. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  22406. missingGlyphs = glyphsInfo.missingGlyphs;
  22407. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22408. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  22409. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  22410. }
  22411. }
  22412. if (!tables.hhea) {
  22413. throw new _util.FormatError('Required "hhea" table is not found');
  22414. }
  22415. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  22416. tables.hhea.data[10] = 0xff;
  22417. tables.hhea.data[11] = 0xff;
  22418. }
  22419. const metricsOverride = {
  22420. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  22421. yMax: int16(tables.head.data[42], tables.head.data[43]),
  22422. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  22423. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  22424. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  22425. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  22426. };
  22427. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  22428. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  22429. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  22430. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  22431. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  22432. this.lineGap = this.cssFontInfo.metrics.lineGap;
  22433. } else {
  22434. this.lineHeight = this.ascent - this.descent + this.lineGap;
  22435. }
  22436. if (tables.post) {
  22437. readPostScriptTable(tables.post, properties, numGlyphs);
  22438. }
  22439. tables.post = {
  22440. tag: "post",
  22441. data: createPostTable(properties)
  22442. };
  22443. const charCodeToGlyphId = [];
  22444. function hasGlyph(glyphId) {
  22445. return !missingGlyphs[glyphId];
  22446. }
  22447. if (properties.composite) {
  22448. const cidToGidMap = properties.cidToGidMap || [];
  22449. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  22450. properties.cMap.forEach(function (charCode, cid) {
  22451. if (typeof cid === "string") {
  22452. cid = convertCidString(charCode, cid, true);
  22453. }
  22454. if (cid > 0xffff) {
  22455. throw new _util.FormatError("Max size of CID is 65,535");
  22456. }
  22457. let glyphId = -1;
  22458. if (isCidToGidMapEmpty) {
  22459. glyphId = cid;
  22460. } else if (cidToGidMap[cid] !== undefined) {
  22461. glyphId = cidToGidMap[cid];
  22462. }
  22463. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  22464. charCodeToGlyphId[charCode] = glyphId;
  22465. }
  22466. });
  22467. } else {
  22468. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  22469. const cmapPlatformId = cmapTable.platformId;
  22470. const cmapEncodingId = cmapTable.encodingId;
  22471. const cmapMappings = cmapTable.mappings;
  22472. let baseEncoding = [],
  22473. forcePostTable = false;
  22474. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  22475. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22476. }
  22477. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  22478. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22479. for (let charCode = 0; charCode < 256; charCode++) {
  22480. let glyphName;
  22481. if (this.differences[charCode] !== undefined) {
  22482. glyphName = this.differences[charCode];
  22483. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  22484. glyphName = baseEncoding[charCode];
  22485. } else {
  22486. glyphName = _encodings.StandardEncoding[charCode];
  22487. }
  22488. if (!glyphName) {
  22489. continue;
  22490. }
  22491. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  22492. let unicodeOrCharCode;
  22493. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  22494. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  22495. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  22496. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  22497. }
  22498. if (unicodeOrCharCode === undefined) {
  22499. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  22500. const unicode = this.toUnicode.get(charCode);
  22501. if (unicode) {
  22502. unicodeOrCharCode = unicode.codePointAt(0);
  22503. }
  22504. }
  22505. if (unicodeOrCharCode === undefined) {
  22506. continue;
  22507. }
  22508. }
  22509. for (const mapping of cmapMappings) {
  22510. if (mapping.charCode !== unicodeOrCharCode) {
  22511. continue;
  22512. }
  22513. charCodeToGlyphId[charCode] = mapping.glyphId;
  22514. break;
  22515. }
  22516. }
  22517. } else if (cmapPlatformId === 0) {
  22518. for (const mapping of cmapMappings) {
  22519. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  22520. }
  22521. forcePostTable = true;
  22522. } else {
  22523. for (const mapping of cmapMappings) {
  22524. let charCode = mapping.charCode;
  22525. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  22526. charCode &= 0xff;
  22527. }
  22528. charCodeToGlyphId[charCode] = mapping.glyphId;
  22529. }
  22530. }
  22531. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  22532. for (let i = 0; i < 256; ++i) {
  22533. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  22534. continue;
  22535. }
  22536. const glyphName = this.differences[i] || baseEncoding[i];
  22537. if (!glyphName) {
  22538. continue;
  22539. }
  22540. const glyphId = properties.glyphNames.indexOf(glyphName);
  22541. if (glyphId > 0 && hasGlyph(glyphId)) {
  22542. charCodeToGlyphId[i] = glyphId;
  22543. }
  22544. }
  22545. }
  22546. }
  22547. if (charCodeToGlyphId.length === 0) {
  22548. charCodeToGlyphId[0] = 0;
  22549. }
  22550. let glyphZeroId = numGlyphsOut - 1;
  22551. if (!dupFirstEntry) {
  22552. glyphZeroId = 0;
  22553. }
  22554. if (!properties.cssFontInfo) {
  22555. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  22556. this.toFontChar = newMapping.toFontChar;
  22557. tables.cmap = {
  22558. tag: "cmap",
  22559. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  22560. };
  22561. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  22562. tables["OS/2"] = {
  22563. tag: "OS/2",
  22564. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  22565. };
  22566. }
  22567. }
  22568. if (!isTrueType) {
  22569. try {
  22570. cffFile = new _stream.Stream(tables["CFF "].data);
  22571. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  22572. cff = parser.parse();
  22573. cff.duplicateFirstGlyph();
  22574. const compiler = new _cff_parser.CFFCompiler(cff);
  22575. tables["CFF "].data = compiler.compile();
  22576. } catch (e) {
  22577. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  22578. }
  22579. }
  22580. if (!tables.name) {
  22581. tables.name = {
  22582. tag: "name",
  22583. data: createNameTable(this.name)
  22584. };
  22585. } else {
  22586. const [namePrototype, nameRecords] = readNameTable(tables.name);
  22587. tables.name.data = createNameTable(name, namePrototype);
  22588. this.psName = namePrototype[0][6] || null;
  22589. if (!properties.composite) {
  22590. adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords);
  22591. }
  22592. }
  22593. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  22594. for (const tableTag in tables) {
  22595. builder.addTable(tableTag, tables[tableTag].data);
  22596. }
  22597. return builder.toArray();
  22598. }
  22599. convert(fontName, font, properties) {
  22600. properties.fixedPitch = false;
  22601. if (properties.builtInEncoding) {
  22602. adjustType1ToUnicode(properties, properties.builtInEncoding);
  22603. }
  22604. let glyphZeroId = 1;
  22605. if (font instanceof _cff_font.CFFFont) {
  22606. glyphZeroId = font.numGlyphs - 1;
  22607. }
  22608. const mapping = font.getGlyphMapping(properties);
  22609. let newMapping = null;
  22610. let newCharCodeToGlyphId = mapping;
  22611. let toUnicodeExtraMap = null;
  22612. if (!properties.cssFontInfo) {
  22613. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  22614. this.toFontChar = newMapping.toFontChar;
  22615. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  22616. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  22617. }
  22618. const numGlyphs = font.numGlyphs;
  22619. function getCharCodes(charCodeToGlyphId, glyphId) {
  22620. let charCodes = null;
  22621. for (const charCode in charCodeToGlyphId) {
  22622. if (glyphId === charCodeToGlyphId[charCode]) {
  22623. if (!charCodes) {
  22624. charCodes = [];
  22625. }
  22626. charCodes.push(charCode | 0);
  22627. }
  22628. }
  22629. return charCodes;
  22630. }
  22631. function createCharCode(charCodeToGlyphId, glyphId) {
  22632. for (const charCode in charCodeToGlyphId) {
  22633. if (glyphId === charCodeToGlyphId[charCode]) {
  22634. return charCode | 0;
  22635. }
  22636. }
  22637. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  22638. return newMapping.nextAvailableFontCharCode++;
  22639. }
  22640. const seacs = font.seacs;
  22641. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  22642. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  22643. const charset = font.getCharset();
  22644. const seacMap = Object.create(null);
  22645. for (let glyphId in seacs) {
  22646. glyphId |= 0;
  22647. const seac = seacs[glyphId];
  22648. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  22649. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  22650. const baseGlyphId = charset.indexOf(baseGlyphName);
  22651. const accentGlyphId = charset.indexOf(accentGlyphName);
  22652. if (baseGlyphId < 0 || accentGlyphId < 0) {
  22653. continue;
  22654. }
  22655. const accentOffset = {
  22656. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  22657. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  22658. };
  22659. const charCodes = getCharCodes(mapping, glyphId);
  22660. if (!charCodes) {
  22661. continue;
  22662. }
  22663. for (const charCode of charCodes) {
  22664. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  22665. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  22666. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  22667. seacMap[charCode] = {
  22668. baseFontCharCode,
  22669. accentFontCharCode,
  22670. accentOffset
  22671. };
  22672. }
  22673. }
  22674. properties.seacMap = seacMap;
  22675. }
  22676. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  22677. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  22678. builder.addTable("CFF ", font.data);
  22679. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  22680. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  22681. 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");
  22682. 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));
  22683. builder.addTable("hmtx", function fontFieldsHmtx() {
  22684. const charstrings = font.charstrings;
  22685. const cffWidths = font.cff ? font.cff.widths : null;
  22686. let hmtx = "\x00\x00\x00\x00";
  22687. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  22688. let width = 0;
  22689. if (charstrings) {
  22690. const charstring = charstrings[i - 1];
  22691. width = "width" in charstring ? charstring.width : 0;
  22692. } else if (cffWidths) {
  22693. width = Math.ceil(cffWidths[i] || 0);
  22694. }
  22695. hmtx += string16(width) + string16(0);
  22696. }
  22697. return hmtx;
  22698. }());
  22699. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  22700. builder.addTable("name", createNameTable(fontName));
  22701. builder.addTable("post", createPostTable(properties));
  22702. return builder.toArray();
  22703. }
  22704. get spaceWidth() {
  22705. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  22706. let width;
  22707. for (const glyphName of possibleSpaceReplacements) {
  22708. if (glyphName in this.widths) {
  22709. width = this.widths[glyphName];
  22710. break;
  22711. }
  22712. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22713. const glyphUnicode = glyphsUnicodeMap[glyphName];
  22714. let charcode = 0;
  22715. if (this.composite && this.cMap.contains(glyphUnicode)) {
  22716. charcode = this.cMap.lookup(glyphUnicode);
  22717. if (typeof charcode === "string") {
  22718. charcode = convertCidString(glyphUnicode, charcode);
  22719. }
  22720. }
  22721. if (!charcode && this.toUnicode) {
  22722. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  22723. }
  22724. if (charcode <= 0) {
  22725. charcode = glyphUnicode;
  22726. }
  22727. width = this.widths[charcode];
  22728. if (width) {
  22729. break;
  22730. }
  22731. }
  22732. width = width || this.defaultWidth;
  22733. return (0, _util.shadow)(this, "spaceWidth", width);
  22734. }
  22735. _charToGlyph(charcode, isSpace = false) {
  22736. let glyph = this._glyphCache[charcode];
  22737. if (glyph && glyph.isSpace === isSpace) {
  22738. return glyph;
  22739. }
  22740. let fontCharCode, width, operatorListId;
  22741. let widthCode = charcode;
  22742. if (this.cMap && this.cMap.contains(charcode)) {
  22743. widthCode = this.cMap.lookup(charcode);
  22744. if (typeof widthCode === "string") {
  22745. widthCode = convertCidString(charcode, widthCode);
  22746. }
  22747. }
  22748. width = this.widths[widthCode];
  22749. if (typeof width !== "number") {
  22750. width = this.defaultWidth;
  22751. }
  22752. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  22753. let unicode = this.toUnicode.get(charcode) || charcode;
  22754. if (typeof unicode === "number") {
  22755. unicode = String.fromCharCode(unicode);
  22756. }
  22757. let isInFont = this.toFontChar[charcode] !== undefined;
  22758. fontCharCode = this.toFontChar[charcode] || charcode;
  22759. if (this.missingFile) {
  22760. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  22761. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  22762. fontCharCode = 0x20;
  22763. }
  22764. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  22765. }
  22766. if (this.isType3Font) {
  22767. operatorListId = fontCharCode;
  22768. }
  22769. let accent = null;
  22770. if (this.seacMap && this.seacMap[charcode]) {
  22771. isInFont = true;
  22772. const seac = this.seacMap[charcode];
  22773. fontCharCode = seac.baseFontCharCode;
  22774. accent = {
  22775. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  22776. offset: seac.accentOffset
  22777. };
  22778. }
  22779. let fontChar = "";
  22780. if (typeof fontCharCode === "number") {
  22781. if (fontCharCode <= 0x10ffff) {
  22782. fontChar = String.fromCodePoint(fontCharCode);
  22783. } else {
  22784. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  22785. }
  22786. }
  22787. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  22788. return this._glyphCache[charcode] = glyph;
  22789. }
  22790. charsToGlyphs(chars) {
  22791. let glyphs = this._charsCache[chars];
  22792. if (glyphs) {
  22793. return glyphs;
  22794. }
  22795. glyphs = [];
  22796. if (this.cMap) {
  22797. const c = Object.create(null),
  22798. ii = chars.length;
  22799. let i = 0;
  22800. while (i < ii) {
  22801. this.cMap.readCharCode(chars, i, c);
  22802. const {
  22803. charcode,
  22804. length
  22805. } = c;
  22806. i += length;
  22807. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  22808. glyphs.push(glyph);
  22809. }
  22810. } else {
  22811. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22812. const charcode = chars.charCodeAt(i);
  22813. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  22814. glyphs.push(glyph);
  22815. }
  22816. }
  22817. return this._charsCache[chars] = glyphs;
  22818. }
  22819. getCharPositions(chars) {
  22820. const positions = [];
  22821. if (this.cMap) {
  22822. const c = Object.create(null);
  22823. let i = 0;
  22824. while (i < chars.length) {
  22825. this.cMap.readCharCode(chars, i, c);
  22826. const length = c.length;
  22827. positions.push([i, i + length]);
  22828. i += length;
  22829. }
  22830. } else {
  22831. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22832. positions.push([i, i + 1]);
  22833. }
  22834. }
  22835. return positions;
  22836. }
  22837. get glyphCacheValues() {
  22838. return Object.values(this._glyphCache);
  22839. }
  22840. encodeString(str) {
  22841. const buffers = [];
  22842. const currentBuf = [];
  22843. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  22844. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  22845. for (let i = 0, ii = str.length; i < ii; i++) {
  22846. const unicode = str.codePointAt(i);
  22847. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  22848. i++;
  22849. }
  22850. if (this.toUnicode) {
  22851. const charCode = getCharCode(unicode);
  22852. if (charCode !== -1) {
  22853. if (hasCurrentBufErrors()) {
  22854. buffers.push(currentBuf.join(""));
  22855. currentBuf.length = 0;
  22856. }
  22857. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  22858. for (let j = charCodeLength - 1; j >= 0; j--) {
  22859. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  22860. }
  22861. continue;
  22862. }
  22863. }
  22864. if (!hasCurrentBufErrors()) {
  22865. buffers.push(currentBuf.join(""));
  22866. currentBuf.length = 0;
  22867. }
  22868. currentBuf.push(String.fromCodePoint(unicode));
  22869. }
  22870. buffers.push(currentBuf.join(""));
  22871. return buffers;
  22872. }
  22873. }
  22874. exports.Font = Font;
  22875. class ErrorFont {
  22876. constructor(error) {
  22877. this.error = error;
  22878. this.loadedName = "g_font_error";
  22879. this.missingFile = true;
  22880. }
  22881. charsToGlyphs() {
  22882. return [];
  22883. }
  22884. encodeString(chars) {
  22885. return [chars];
  22886. }
  22887. exportData(extraProperties = false) {
  22888. return {
  22889. error: this.error
  22890. };
  22891. }
  22892. }
  22893. exports.ErrorFont = ErrorFont;
  22894. /***/ }),
  22895. /* 33 */
  22896. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22897. Object.defineProperty(exports, "__esModule", ({
  22898. value: true
  22899. }));
  22900. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  22901. var _util = __w_pdfjs_require__(2);
  22902. var _charsets = __w_pdfjs_require__(34);
  22903. var _encodings = __w_pdfjs_require__(35);
  22904. const MAX_SUBR_NESTING = 10;
  22905. 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"];
  22906. exports.CFFStandardStrings = CFFStandardStrings;
  22907. const NUM_STANDARD_CFF_STRINGS = 391;
  22908. const CharstringValidationData = [null, {
  22909. id: "hstem",
  22910. min: 2,
  22911. stackClearing: true,
  22912. stem: true
  22913. }, null, {
  22914. id: "vstem",
  22915. min: 2,
  22916. stackClearing: true,
  22917. stem: true
  22918. }, {
  22919. id: "vmoveto",
  22920. min: 1,
  22921. stackClearing: true
  22922. }, {
  22923. id: "rlineto",
  22924. min: 2,
  22925. resetStack: true
  22926. }, {
  22927. id: "hlineto",
  22928. min: 1,
  22929. resetStack: true
  22930. }, {
  22931. id: "vlineto",
  22932. min: 1,
  22933. resetStack: true
  22934. }, {
  22935. id: "rrcurveto",
  22936. min: 6,
  22937. resetStack: true
  22938. }, null, {
  22939. id: "callsubr",
  22940. min: 1,
  22941. undefStack: true
  22942. }, {
  22943. id: "return",
  22944. min: 0,
  22945. undefStack: true
  22946. }, null, null, {
  22947. id: "endchar",
  22948. min: 0,
  22949. stackClearing: true
  22950. }, null, null, null, {
  22951. id: "hstemhm",
  22952. min: 2,
  22953. stackClearing: true,
  22954. stem: true
  22955. }, {
  22956. id: "hintmask",
  22957. min: 0,
  22958. stackClearing: true
  22959. }, {
  22960. id: "cntrmask",
  22961. min: 0,
  22962. stackClearing: true
  22963. }, {
  22964. id: "rmoveto",
  22965. min: 2,
  22966. stackClearing: true
  22967. }, {
  22968. id: "hmoveto",
  22969. min: 1,
  22970. stackClearing: true
  22971. }, {
  22972. id: "vstemhm",
  22973. min: 2,
  22974. stackClearing: true,
  22975. stem: true
  22976. }, {
  22977. id: "rcurveline",
  22978. min: 8,
  22979. resetStack: true
  22980. }, {
  22981. id: "rlinecurve",
  22982. min: 8,
  22983. resetStack: true
  22984. }, {
  22985. id: "vvcurveto",
  22986. min: 4,
  22987. resetStack: true
  22988. }, {
  22989. id: "hhcurveto",
  22990. min: 4,
  22991. resetStack: true
  22992. }, null, {
  22993. id: "callgsubr",
  22994. min: 1,
  22995. undefStack: true
  22996. }, {
  22997. id: "vhcurveto",
  22998. min: 4,
  22999. resetStack: true
  23000. }, {
  23001. id: "hvcurveto",
  23002. min: 4,
  23003. resetStack: true
  23004. }];
  23005. const CharstringValidationData12 = [null, null, null, {
  23006. id: "and",
  23007. min: 2,
  23008. stackDelta: -1
  23009. }, {
  23010. id: "or",
  23011. min: 2,
  23012. stackDelta: -1
  23013. }, {
  23014. id: "not",
  23015. min: 1,
  23016. stackDelta: 0
  23017. }, null, null, null, {
  23018. id: "abs",
  23019. min: 1,
  23020. stackDelta: 0
  23021. }, {
  23022. id: "add",
  23023. min: 2,
  23024. stackDelta: -1,
  23025. stackFn(stack, index) {
  23026. stack[index - 2] = stack[index - 2] + stack[index - 1];
  23027. }
  23028. }, {
  23029. id: "sub",
  23030. min: 2,
  23031. stackDelta: -1,
  23032. stackFn(stack, index) {
  23033. stack[index - 2] = stack[index - 2] - stack[index - 1];
  23034. }
  23035. }, {
  23036. id: "div",
  23037. min: 2,
  23038. stackDelta: -1,
  23039. stackFn(stack, index) {
  23040. stack[index - 2] = stack[index - 2] / stack[index - 1];
  23041. }
  23042. }, null, {
  23043. id: "neg",
  23044. min: 1,
  23045. stackDelta: 0,
  23046. stackFn(stack, index) {
  23047. stack[index - 1] = -stack[index - 1];
  23048. }
  23049. }, {
  23050. id: "eq",
  23051. min: 2,
  23052. stackDelta: -1
  23053. }, null, null, {
  23054. id: "drop",
  23055. min: 1,
  23056. stackDelta: -1
  23057. }, null, {
  23058. id: "put",
  23059. min: 2,
  23060. stackDelta: -2
  23061. }, {
  23062. id: "get",
  23063. min: 1,
  23064. stackDelta: 0
  23065. }, {
  23066. id: "ifelse",
  23067. min: 4,
  23068. stackDelta: -3
  23069. }, {
  23070. id: "random",
  23071. min: 0,
  23072. stackDelta: 1
  23073. }, {
  23074. id: "mul",
  23075. min: 2,
  23076. stackDelta: -1,
  23077. stackFn(stack, index) {
  23078. stack[index - 2] = stack[index - 2] * stack[index - 1];
  23079. }
  23080. }, null, {
  23081. id: "sqrt",
  23082. min: 1,
  23083. stackDelta: 0
  23084. }, {
  23085. id: "dup",
  23086. min: 1,
  23087. stackDelta: 1
  23088. }, {
  23089. id: "exch",
  23090. min: 2,
  23091. stackDelta: 0
  23092. }, {
  23093. id: "index",
  23094. min: 2,
  23095. stackDelta: 0
  23096. }, {
  23097. id: "roll",
  23098. min: 3,
  23099. stackDelta: -2
  23100. }, null, null, null, {
  23101. id: "hflex",
  23102. min: 7,
  23103. resetStack: true
  23104. }, {
  23105. id: "flex",
  23106. min: 13,
  23107. resetStack: true
  23108. }, {
  23109. id: "hflex1",
  23110. min: 9,
  23111. resetStack: true
  23112. }, {
  23113. id: "flex1",
  23114. min: 11,
  23115. resetStack: true
  23116. }];
  23117. class CFFParser {
  23118. constructor(file, properties, seacAnalysisEnabled) {
  23119. this.bytes = file.getBytes();
  23120. this.properties = properties;
  23121. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  23122. }
  23123. parse() {
  23124. const properties = this.properties;
  23125. const cff = new CFF();
  23126. this.cff = cff;
  23127. const header = this.parseHeader();
  23128. const nameIndex = this.parseIndex(header.endPos);
  23129. const topDictIndex = this.parseIndex(nameIndex.endPos);
  23130. const stringIndex = this.parseIndex(topDictIndex.endPos);
  23131. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  23132. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  23133. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  23134. cff.header = header.obj;
  23135. cff.names = this.parseNameIndex(nameIndex.obj);
  23136. cff.strings = this.parseStringIndex(stringIndex.obj);
  23137. cff.topDict = topDict;
  23138. cff.globalSubrIndex = globalSubrIndex.obj;
  23139. this.parsePrivateDict(cff.topDict);
  23140. cff.isCIDFont = topDict.hasName("ROS");
  23141. const charStringOffset = topDict.getByName("CharStrings");
  23142. const charStringIndex = this.parseIndex(charStringOffset).obj;
  23143. const fontMatrix = topDict.getByName("FontMatrix");
  23144. if (fontMatrix) {
  23145. properties.fontMatrix = fontMatrix;
  23146. }
  23147. const fontBBox = topDict.getByName("FontBBox");
  23148. if (fontBBox) {
  23149. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  23150. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  23151. properties.ascentScaled = true;
  23152. }
  23153. let charset, encoding;
  23154. if (cff.isCIDFont) {
  23155. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  23156. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  23157. const dictRaw = fdArrayIndex.get(i);
  23158. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  23159. this.parsePrivateDict(fontDict);
  23160. cff.fdArray.push(fontDict);
  23161. }
  23162. encoding = null;
  23163. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  23164. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  23165. } else {
  23166. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  23167. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  23168. }
  23169. cff.charset = charset;
  23170. cff.encoding = encoding;
  23171. const charStringsAndSeacs = this.parseCharStrings({
  23172. charStrings: charStringIndex,
  23173. localSubrIndex: topDict.privateDict.subrsIndex,
  23174. globalSubrIndex: globalSubrIndex.obj,
  23175. fdSelect: cff.fdSelect,
  23176. fdArray: cff.fdArray,
  23177. privateDict: topDict.privateDict
  23178. });
  23179. cff.charStrings = charStringsAndSeacs.charStrings;
  23180. cff.seacs = charStringsAndSeacs.seacs;
  23181. cff.widths = charStringsAndSeacs.widths;
  23182. return cff;
  23183. }
  23184. parseHeader() {
  23185. let bytes = this.bytes;
  23186. const bytesLength = bytes.length;
  23187. let offset = 0;
  23188. while (offset < bytesLength && bytes[offset] !== 1) {
  23189. ++offset;
  23190. }
  23191. if (offset >= bytesLength) {
  23192. throw new _util.FormatError("Invalid CFF header");
  23193. }
  23194. if (offset !== 0) {
  23195. (0, _util.info)("cff data is shifted");
  23196. bytes = bytes.subarray(offset);
  23197. this.bytes = bytes;
  23198. }
  23199. const major = bytes[0];
  23200. const minor = bytes[1];
  23201. const hdrSize = bytes[2];
  23202. const offSize = bytes[3];
  23203. const header = new CFFHeader(major, minor, hdrSize, offSize);
  23204. return {
  23205. obj: header,
  23206. endPos: hdrSize
  23207. };
  23208. }
  23209. parseDict(dict) {
  23210. let pos = 0;
  23211. function parseOperand() {
  23212. let value = dict[pos++];
  23213. if (value === 30) {
  23214. return parseFloatOperand();
  23215. } else if (value === 28) {
  23216. value = dict[pos++];
  23217. value = (value << 24 | dict[pos++] << 16) >> 16;
  23218. return value;
  23219. } else if (value === 29) {
  23220. value = dict[pos++];
  23221. value = value << 8 | dict[pos++];
  23222. value = value << 8 | dict[pos++];
  23223. value = value << 8 | dict[pos++];
  23224. return value;
  23225. } else if (value >= 32 && value <= 246) {
  23226. return value - 139;
  23227. } else if (value >= 247 && value <= 250) {
  23228. return (value - 247) * 256 + dict[pos++] + 108;
  23229. } else if (value >= 251 && value <= 254) {
  23230. return -((value - 251) * 256) - dict[pos++] - 108;
  23231. }
  23232. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  23233. return NaN;
  23234. }
  23235. function parseFloatOperand() {
  23236. let str = "";
  23237. const eof = 15;
  23238. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  23239. const length = dict.length;
  23240. while (pos < length) {
  23241. const b = dict[pos++];
  23242. const b1 = b >> 4;
  23243. const b2 = b & 15;
  23244. if (b1 === eof) {
  23245. break;
  23246. }
  23247. str += lookup[b1];
  23248. if (b2 === eof) {
  23249. break;
  23250. }
  23251. str += lookup[b2];
  23252. }
  23253. return parseFloat(str);
  23254. }
  23255. let operands = [];
  23256. const entries = [];
  23257. pos = 0;
  23258. const end = dict.length;
  23259. while (pos < end) {
  23260. let b = dict[pos];
  23261. if (b <= 21) {
  23262. if (b === 12) {
  23263. b = b << 8 | dict[++pos];
  23264. }
  23265. entries.push([b, operands]);
  23266. operands = [];
  23267. ++pos;
  23268. } else {
  23269. operands.push(parseOperand());
  23270. }
  23271. }
  23272. return entries;
  23273. }
  23274. parseIndex(pos) {
  23275. const cffIndex = new CFFIndex();
  23276. const bytes = this.bytes;
  23277. const count = bytes[pos++] << 8 | bytes[pos++];
  23278. const offsets = [];
  23279. let end = pos;
  23280. let i, ii;
  23281. if (count !== 0) {
  23282. const offsetSize = bytes[pos++];
  23283. const startPos = pos + (count + 1) * offsetSize - 1;
  23284. for (i = 0, ii = count + 1; i < ii; ++i) {
  23285. let offset = 0;
  23286. for (let j = 0; j < offsetSize; ++j) {
  23287. offset <<= 8;
  23288. offset += bytes[pos++];
  23289. }
  23290. offsets.push(startPos + offset);
  23291. }
  23292. end = offsets[count];
  23293. }
  23294. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  23295. const offsetStart = offsets[i];
  23296. const offsetEnd = offsets[i + 1];
  23297. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  23298. }
  23299. return {
  23300. obj: cffIndex,
  23301. endPos: end
  23302. };
  23303. }
  23304. parseNameIndex(index) {
  23305. const names = [];
  23306. for (let i = 0, ii = index.count; i < ii; ++i) {
  23307. const name = index.get(i);
  23308. names.push((0, _util.bytesToString)(name));
  23309. }
  23310. return names;
  23311. }
  23312. parseStringIndex(index) {
  23313. const strings = new CFFStrings();
  23314. for (let i = 0, ii = index.count; i < ii; ++i) {
  23315. const data = index.get(i);
  23316. strings.add((0, _util.bytesToString)(data));
  23317. }
  23318. return strings;
  23319. }
  23320. createDict(Type, dict, strings) {
  23321. const cffDict = new Type(strings);
  23322. for (const [key, value] of dict) {
  23323. cffDict.setByKey(key, value);
  23324. }
  23325. return cffDict;
  23326. }
  23327. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  23328. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  23329. return false;
  23330. }
  23331. let stackSize = state.stackSize;
  23332. const stack = state.stack;
  23333. let length = data.length;
  23334. for (let j = 0; j < length;) {
  23335. const value = data[j++];
  23336. let validationCommand = null;
  23337. if (value === 12) {
  23338. const q = data[j++];
  23339. if (q === 0) {
  23340. data[j - 2] = 139;
  23341. data[j - 1] = 22;
  23342. stackSize = 0;
  23343. } else {
  23344. validationCommand = CharstringValidationData12[q];
  23345. }
  23346. } else if (value === 28) {
  23347. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  23348. j += 2;
  23349. stackSize++;
  23350. } else if (value === 14) {
  23351. if (stackSize >= 4) {
  23352. stackSize -= 4;
  23353. if (this.seacAnalysisEnabled) {
  23354. state.seac = stack.slice(stackSize, stackSize + 4);
  23355. return false;
  23356. }
  23357. }
  23358. validationCommand = CharstringValidationData[value];
  23359. } else if (value >= 32 && value <= 246) {
  23360. stack[stackSize] = value - 139;
  23361. stackSize++;
  23362. } else if (value >= 247 && value <= 254) {
  23363. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  23364. j++;
  23365. stackSize++;
  23366. } else if (value === 255) {
  23367. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  23368. j += 4;
  23369. stackSize++;
  23370. } else if (value === 19 || value === 20) {
  23371. state.hints += stackSize >> 1;
  23372. j += state.hints + 7 >> 3;
  23373. stackSize %= 2;
  23374. validationCommand = CharstringValidationData[value];
  23375. } else if (value === 10 || value === 29) {
  23376. let subrsIndex;
  23377. if (value === 10) {
  23378. subrsIndex = localSubrIndex;
  23379. } else {
  23380. subrsIndex = globalSubrIndex;
  23381. }
  23382. if (!subrsIndex) {
  23383. validationCommand = CharstringValidationData[value];
  23384. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  23385. return false;
  23386. }
  23387. let bias = 32768;
  23388. if (subrsIndex.count < 1240) {
  23389. bias = 107;
  23390. } else if (subrsIndex.count < 33900) {
  23391. bias = 1131;
  23392. }
  23393. const subrNumber = stack[--stackSize] + bias;
  23394. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  23395. validationCommand = CharstringValidationData[value];
  23396. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  23397. return false;
  23398. }
  23399. state.stackSize = stackSize;
  23400. state.callDepth++;
  23401. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  23402. if (!valid) {
  23403. return false;
  23404. }
  23405. state.callDepth--;
  23406. stackSize = state.stackSize;
  23407. continue;
  23408. } else if (value === 11) {
  23409. state.stackSize = stackSize;
  23410. return true;
  23411. } else if (value === 0 && j === data.length) {
  23412. data[j - 1] = 14;
  23413. validationCommand = CharstringValidationData[14];
  23414. } else if (value === 9) {
  23415. data.copyWithin(j - 1, j, -1);
  23416. j -= 1;
  23417. length -= 1;
  23418. continue;
  23419. } else {
  23420. validationCommand = CharstringValidationData[value];
  23421. }
  23422. if (validationCommand) {
  23423. if (validationCommand.stem) {
  23424. state.hints += stackSize >> 1;
  23425. if (value === 3 || value === 23) {
  23426. state.hasVStems = true;
  23427. } else if (state.hasVStems && (value === 1 || value === 18)) {
  23428. (0, _util.warn)("CFF stem hints are in wrong order");
  23429. data[j - 1] = value === 1 ? 3 : 23;
  23430. }
  23431. }
  23432. if ("min" in validationCommand) {
  23433. if (!state.undefStack && stackSize < validationCommand.min) {
  23434. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  23435. if (stackSize === 0) {
  23436. data[j - 1] = 14;
  23437. return true;
  23438. }
  23439. return false;
  23440. }
  23441. }
  23442. if (state.firstStackClearing && validationCommand.stackClearing) {
  23443. state.firstStackClearing = false;
  23444. stackSize -= validationCommand.min;
  23445. if (stackSize >= 2 && validationCommand.stem) {
  23446. stackSize %= 2;
  23447. } else if (stackSize > 1) {
  23448. (0, _util.warn)("Found too many parameters for stack-clearing command");
  23449. }
  23450. if (stackSize > 0) {
  23451. state.width = stack[stackSize - 1];
  23452. }
  23453. }
  23454. if ("stackDelta" in validationCommand) {
  23455. if ("stackFn" in validationCommand) {
  23456. validationCommand.stackFn(stack, stackSize);
  23457. }
  23458. stackSize += validationCommand.stackDelta;
  23459. } else if (validationCommand.stackClearing) {
  23460. stackSize = 0;
  23461. } else if (validationCommand.resetStack) {
  23462. stackSize = 0;
  23463. state.undefStack = false;
  23464. } else if (validationCommand.undefStack) {
  23465. stackSize = 0;
  23466. state.undefStack = true;
  23467. state.firstStackClearing = false;
  23468. }
  23469. }
  23470. }
  23471. if (length < data.length) {
  23472. data.fill(14, length);
  23473. }
  23474. state.stackSize = stackSize;
  23475. return true;
  23476. }
  23477. parseCharStrings({
  23478. charStrings,
  23479. localSubrIndex,
  23480. globalSubrIndex,
  23481. fdSelect,
  23482. fdArray,
  23483. privateDict
  23484. }) {
  23485. const seacs = [];
  23486. const widths = [];
  23487. const count = charStrings.count;
  23488. for (let i = 0; i < count; i++) {
  23489. const charstring = charStrings.get(i);
  23490. const state = {
  23491. callDepth: 0,
  23492. stackSize: 0,
  23493. stack: [],
  23494. undefStack: true,
  23495. hints: 0,
  23496. firstStackClearing: true,
  23497. seac: null,
  23498. width: null,
  23499. hasVStems: false
  23500. };
  23501. let valid = true;
  23502. let localSubrToUse = null;
  23503. let privateDictToUse = privateDict;
  23504. if (fdSelect && fdArray.length) {
  23505. const fdIndex = fdSelect.getFDIndex(i);
  23506. if (fdIndex === -1) {
  23507. (0, _util.warn)("Glyph index is not in fd select.");
  23508. valid = false;
  23509. }
  23510. if (fdIndex >= fdArray.length) {
  23511. (0, _util.warn)("Invalid fd index for glyph index.");
  23512. valid = false;
  23513. }
  23514. if (valid) {
  23515. privateDictToUse = fdArray[fdIndex].privateDict;
  23516. localSubrToUse = privateDictToUse.subrsIndex;
  23517. }
  23518. } else if (localSubrIndex) {
  23519. localSubrToUse = localSubrIndex;
  23520. }
  23521. if (valid) {
  23522. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  23523. }
  23524. if (state.width !== null) {
  23525. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  23526. widths[i] = nominalWidth + state.width;
  23527. } else {
  23528. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  23529. widths[i] = defaultWidth;
  23530. }
  23531. if (state.seac !== null) {
  23532. seacs[i] = state.seac;
  23533. }
  23534. if (!valid) {
  23535. charStrings.set(i, new Uint8Array([14]));
  23536. }
  23537. }
  23538. return {
  23539. charStrings,
  23540. seacs,
  23541. widths
  23542. };
  23543. }
  23544. emptyPrivateDictionary(parentDict) {
  23545. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  23546. parentDict.setByKey(18, [0, 0]);
  23547. parentDict.privateDict = privateDict;
  23548. }
  23549. parsePrivateDict(parentDict) {
  23550. if (!parentDict.hasName("Private")) {
  23551. this.emptyPrivateDictionary(parentDict);
  23552. return;
  23553. }
  23554. const privateOffset = parentDict.getByName("Private");
  23555. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  23556. parentDict.removeByName("Private");
  23557. return;
  23558. }
  23559. const size = privateOffset[0];
  23560. const offset = privateOffset[1];
  23561. if (size === 0 || offset >= this.bytes.length) {
  23562. this.emptyPrivateDictionary(parentDict);
  23563. return;
  23564. }
  23565. const privateDictEnd = offset + size;
  23566. const dictData = this.bytes.subarray(offset, privateDictEnd);
  23567. const dict = this.parseDict(dictData);
  23568. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  23569. parentDict.privateDict = privateDict;
  23570. if (privateDict.getByName("ExpansionFactor") === 0) {
  23571. privateDict.setByName("ExpansionFactor", 0.06);
  23572. }
  23573. if (!privateDict.getByName("Subrs")) {
  23574. return;
  23575. }
  23576. const subrsOffset = privateDict.getByName("Subrs");
  23577. const relativeOffset = offset + subrsOffset;
  23578. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  23579. this.emptyPrivateDictionary(parentDict);
  23580. return;
  23581. }
  23582. const subrsIndex = this.parseIndex(relativeOffset);
  23583. privateDict.subrsIndex = subrsIndex.obj;
  23584. }
  23585. parseCharsets(pos, length, strings, cid) {
  23586. if (pos === 0) {
  23587. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  23588. } else if (pos === 1) {
  23589. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  23590. } else if (pos === 2) {
  23591. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  23592. }
  23593. const bytes = this.bytes;
  23594. const start = pos;
  23595. const format = bytes[pos++];
  23596. const charset = [cid ? 0 : ".notdef"];
  23597. let id, count, i;
  23598. length -= 1;
  23599. switch (format) {
  23600. case 0:
  23601. for (i = 0; i < length; i++) {
  23602. id = bytes[pos++] << 8 | bytes[pos++];
  23603. charset.push(cid ? id : strings.get(id));
  23604. }
  23605. break;
  23606. case 1:
  23607. while (charset.length <= length) {
  23608. id = bytes[pos++] << 8 | bytes[pos++];
  23609. count = bytes[pos++];
  23610. for (i = 0; i <= count; i++) {
  23611. charset.push(cid ? id++ : strings.get(id++));
  23612. }
  23613. }
  23614. break;
  23615. case 2:
  23616. while (charset.length <= length) {
  23617. id = bytes[pos++] << 8 | bytes[pos++];
  23618. count = bytes[pos++] << 8 | bytes[pos++];
  23619. for (i = 0; i <= count; i++) {
  23620. charset.push(cid ? id++ : strings.get(id++));
  23621. }
  23622. }
  23623. break;
  23624. default:
  23625. throw new _util.FormatError("Unknown charset format");
  23626. }
  23627. const end = pos;
  23628. const raw = bytes.subarray(start, end);
  23629. return new CFFCharset(false, format, charset, raw);
  23630. }
  23631. parseEncoding(pos, properties, strings, charset) {
  23632. const encoding = Object.create(null);
  23633. const bytes = this.bytes;
  23634. let predefined = false;
  23635. let format, i, ii;
  23636. let raw = null;
  23637. function readSupplement() {
  23638. const supplementsCount = bytes[pos++];
  23639. for (i = 0; i < supplementsCount; i++) {
  23640. const code = bytes[pos++];
  23641. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  23642. encoding[code] = charset.indexOf(strings.get(sid));
  23643. }
  23644. }
  23645. if (pos === 0 || pos === 1) {
  23646. predefined = true;
  23647. format = pos;
  23648. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  23649. for (i = 0, ii = charset.length; i < ii; i++) {
  23650. const index = baseEncoding.indexOf(charset[i]);
  23651. if (index !== -1) {
  23652. encoding[index] = i;
  23653. }
  23654. }
  23655. } else {
  23656. const dataStart = pos;
  23657. format = bytes[pos++];
  23658. switch (format & 0x7f) {
  23659. case 0:
  23660. const glyphsCount = bytes[pos++];
  23661. for (i = 1; i <= glyphsCount; i++) {
  23662. encoding[bytes[pos++]] = i;
  23663. }
  23664. break;
  23665. case 1:
  23666. const rangesCount = bytes[pos++];
  23667. let gid = 1;
  23668. for (i = 0; i < rangesCount; i++) {
  23669. const start = bytes[pos++];
  23670. const left = bytes[pos++];
  23671. for (let j = start; j <= start + left; j++) {
  23672. encoding[j] = gid++;
  23673. }
  23674. }
  23675. break;
  23676. default:
  23677. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  23678. }
  23679. const dataEnd = pos;
  23680. if (format & 0x80) {
  23681. bytes[dataStart] &= 0x7f;
  23682. readSupplement();
  23683. }
  23684. raw = bytes.subarray(dataStart, dataEnd);
  23685. }
  23686. format &= 0x7f;
  23687. return new CFFEncoding(predefined, format, encoding, raw);
  23688. }
  23689. parseFDSelect(pos, length) {
  23690. const bytes = this.bytes;
  23691. const format = bytes[pos++];
  23692. const fdSelect = [];
  23693. let i;
  23694. switch (format) {
  23695. case 0:
  23696. for (i = 0; i < length; ++i) {
  23697. const id = bytes[pos++];
  23698. fdSelect.push(id);
  23699. }
  23700. break;
  23701. case 3:
  23702. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  23703. for (i = 0; i < rangesCount; ++i) {
  23704. let first = bytes[pos++] << 8 | bytes[pos++];
  23705. if (i === 0 && first !== 0) {
  23706. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  23707. first = 0;
  23708. }
  23709. const fdIndex = bytes[pos++];
  23710. const next = bytes[pos] << 8 | bytes[pos + 1];
  23711. for (let j = first; j < next; ++j) {
  23712. fdSelect.push(fdIndex);
  23713. }
  23714. }
  23715. pos += 2;
  23716. break;
  23717. default:
  23718. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  23719. }
  23720. if (fdSelect.length !== length) {
  23721. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  23722. }
  23723. return new CFFFDSelect(format, fdSelect);
  23724. }
  23725. }
  23726. exports.CFFParser = CFFParser;
  23727. class CFF {
  23728. constructor() {
  23729. this.header = null;
  23730. this.names = [];
  23731. this.topDict = null;
  23732. this.strings = new CFFStrings();
  23733. this.globalSubrIndex = null;
  23734. this.encoding = null;
  23735. this.charset = null;
  23736. this.charStrings = null;
  23737. this.fdArray = [];
  23738. this.fdSelect = null;
  23739. this.isCIDFont = false;
  23740. }
  23741. duplicateFirstGlyph() {
  23742. if (this.charStrings.count >= 65535) {
  23743. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  23744. return;
  23745. }
  23746. const glyphZero = this.charStrings.get(0);
  23747. this.charStrings.add(glyphZero);
  23748. if (this.isCIDFont) {
  23749. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  23750. }
  23751. }
  23752. hasGlyphId(id) {
  23753. if (id < 0 || id >= this.charStrings.count) {
  23754. return false;
  23755. }
  23756. const glyph = this.charStrings.get(id);
  23757. return glyph.length > 0;
  23758. }
  23759. }
  23760. exports.CFF = CFF;
  23761. class CFFHeader {
  23762. constructor(major, minor, hdrSize, offSize) {
  23763. this.major = major;
  23764. this.minor = minor;
  23765. this.hdrSize = hdrSize;
  23766. this.offSize = offSize;
  23767. }
  23768. }
  23769. exports.CFFHeader = CFFHeader;
  23770. class CFFStrings {
  23771. constructor() {
  23772. this.strings = [];
  23773. }
  23774. get(index) {
  23775. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  23776. return CFFStandardStrings[index];
  23777. }
  23778. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  23779. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  23780. }
  23781. return CFFStandardStrings[0];
  23782. }
  23783. getSID(str) {
  23784. let index = CFFStandardStrings.indexOf(str);
  23785. if (index !== -1) {
  23786. return index;
  23787. }
  23788. index = this.strings.indexOf(str);
  23789. if (index !== -1) {
  23790. return index + NUM_STANDARD_CFF_STRINGS;
  23791. }
  23792. return -1;
  23793. }
  23794. add(value) {
  23795. this.strings.push(value);
  23796. }
  23797. get count() {
  23798. return this.strings.length;
  23799. }
  23800. }
  23801. exports.CFFStrings = CFFStrings;
  23802. class CFFIndex {
  23803. constructor() {
  23804. this.objects = [];
  23805. this.length = 0;
  23806. }
  23807. add(data) {
  23808. this.length += data.length;
  23809. this.objects.push(data);
  23810. }
  23811. set(index, data) {
  23812. this.length += data.length - this.objects[index].length;
  23813. this.objects[index] = data;
  23814. }
  23815. get(index) {
  23816. return this.objects[index];
  23817. }
  23818. get count() {
  23819. return this.objects.length;
  23820. }
  23821. }
  23822. exports.CFFIndex = CFFIndex;
  23823. class CFFDict {
  23824. constructor(tables, strings) {
  23825. this.keyToNameMap = tables.keyToNameMap;
  23826. this.nameToKeyMap = tables.nameToKeyMap;
  23827. this.defaults = tables.defaults;
  23828. this.types = tables.types;
  23829. this.opcodes = tables.opcodes;
  23830. this.order = tables.order;
  23831. this.strings = strings;
  23832. this.values = Object.create(null);
  23833. }
  23834. setByKey(key, value) {
  23835. if (!(key in this.keyToNameMap)) {
  23836. return false;
  23837. }
  23838. if (value.length === 0) {
  23839. return true;
  23840. }
  23841. for (const val of value) {
  23842. if (isNaN(val)) {
  23843. (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
  23844. return true;
  23845. }
  23846. }
  23847. const type = this.types[key];
  23848. if (type === "num" || type === "sid" || type === "offset") {
  23849. value = value[0];
  23850. }
  23851. this.values[key] = value;
  23852. return true;
  23853. }
  23854. setByName(name, value) {
  23855. if (!(name in this.nameToKeyMap)) {
  23856. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  23857. }
  23858. this.values[this.nameToKeyMap[name]] = value;
  23859. }
  23860. hasName(name) {
  23861. return this.nameToKeyMap[name] in this.values;
  23862. }
  23863. getByName(name) {
  23864. if (!(name in this.nameToKeyMap)) {
  23865. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  23866. }
  23867. const key = this.nameToKeyMap[name];
  23868. if (!(key in this.values)) {
  23869. return this.defaults[key];
  23870. }
  23871. return this.values[key];
  23872. }
  23873. removeByName(name) {
  23874. delete this.values[this.nameToKeyMap[name]];
  23875. }
  23876. static createTables(layout) {
  23877. const tables = {
  23878. keyToNameMap: {},
  23879. nameToKeyMap: {},
  23880. defaults: {},
  23881. types: {},
  23882. opcodes: {},
  23883. order: []
  23884. };
  23885. for (const entry of layout) {
  23886. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  23887. tables.keyToNameMap[key] = entry[1];
  23888. tables.nameToKeyMap[entry[1]] = key;
  23889. tables.types[key] = entry[2];
  23890. tables.defaults[key] = entry[3];
  23891. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  23892. tables.order.push(key);
  23893. }
  23894. return tables;
  23895. }
  23896. }
  23897. const CFFTopDictLayout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
  23898. class CFFTopDict extends CFFDict {
  23899. static get tables() {
  23900. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  23901. }
  23902. constructor(strings) {
  23903. super(CFFTopDict.tables, strings);
  23904. this.privateDict = null;
  23905. }
  23906. }
  23907. exports.CFFTopDict = CFFTopDict;
  23908. const CFFPrivateDictLayout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
  23909. class CFFPrivateDict extends CFFDict {
  23910. static get tables() {
  23911. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  23912. }
  23913. constructor(strings) {
  23914. super(CFFPrivateDict.tables, strings);
  23915. this.subrsIndex = null;
  23916. }
  23917. }
  23918. exports.CFFPrivateDict = CFFPrivateDict;
  23919. const CFFCharsetPredefinedTypes = {
  23920. ISO_ADOBE: 0,
  23921. EXPERT: 1,
  23922. EXPERT_SUBSET: 2
  23923. };
  23924. class CFFCharset {
  23925. constructor(predefined, format, charset, raw) {
  23926. this.predefined = predefined;
  23927. this.format = format;
  23928. this.charset = charset;
  23929. this.raw = raw;
  23930. }
  23931. }
  23932. exports.CFFCharset = CFFCharset;
  23933. class CFFEncoding {
  23934. constructor(predefined, format, encoding, raw) {
  23935. this.predefined = predefined;
  23936. this.format = format;
  23937. this.encoding = encoding;
  23938. this.raw = raw;
  23939. }
  23940. }
  23941. class CFFFDSelect {
  23942. constructor(format, fdSelect) {
  23943. this.format = format;
  23944. this.fdSelect = fdSelect;
  23945. }
  23946. getFDIndex(glyphIndex) {
  23947. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  23948. return -1;
  23949. }
  23950. return this.fdSelect[glyphIndex];
  23951. }
  23952. }
  23953. exports.CFFFDSelect = CFFFDSelect;
  23954. class CFFOffsetTracker {
  23955. constructor() {
  23956. this.offsets = Object.create(null);
  23957. }
  23958. isTracking(key) {
  23959. return key in this.offsets;
  23960. }
  23961. track(key, location) {
  23962. if (key in this.offsets) {
  23963. throw new _util.FormatError(`Already tracking location of ${key}`);
  23964. }
  23965. this.offsets[key] = location;
  23966. }
  23967. offset(value) {
  23968. for (const key in this.offsets) {
  23969. this.offsets[key] += value;
  23970. }
  23971. }
  23972. setEntryLocation(key, values, output) {
  23973. if (!(key in this.offsets)) {
  23974. throw new _util.FormatError(`Not tracking location of ${key}`);
  23975. }
  23976. const data = output.data;
  23977. const dataOffset = this.offsets[key];
  23978. const size = 5;
  23979. for (let i = 0, ii = values.length; i < ii; ++i) {
  23980. const offset0 = i * size + dataOffset;
  23981. const offset1 = offset0 + 1;
  23982. const offset2 = offset0 + 2;
  23983. const offset3 = offset0 + 3;
  23984. const offset4 = offset0 + 4;
  23985. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  23986. throw new _util.FormatError("writing to an offset that is not empty");
  23987. }
  23988. const value = values[i];
  23989. data[offset0] = 0x1d;
  23990. data[offset1] = value >> 24 & 0xff;
  23991. data[offset2] = value >> 16 & 0xff;
  23992. data[offset3] = value >> 8 & 0xff;
  23993. data[offset4] = value & 0xff;
  23994. }
  23995. }
  23996. }
  23997. class CFFCompiler {
  23998. constructor(cff) {
  23999. this.cff = cff;
  24000. }
  24001. compile() {
  24002. const cff = this.cff;
  24003. const output = {
  24004. data: [],
  24005. length: 0,
  24006. add(data) {
  24007. this.data = this.data.concat(data);
  24008. this.length = this.data.length;
  24009. }
  24010. };
  24011. const header = this.compileHeader(cff.header);
  24012. output.add(header);
  24013. const nameIndex = this.compileNameIndex(cff.names);
  24014. output.add(nameIndex);
  24015. if (cff.isCIDFont) {
  24016. if (cff.topDict.hasName("FontMatrix")) {
  24017. const base = cff.topDict.getByName("FontMatrix");
  24018. cff.topDict.removeByName("FontMatrix");
  24019. for (const subDict of cff.fdArray) {
  24020. let matrix = base.slice(0);
  24021. if (subDict.hasName("FontMatrix")) {
  24022. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  24023. }
  24024. subDict.setByName("FontMatrix", matrix);
  24025. }
  24026. }
  24027. }
  24028. const xuid = cff.topDict.getByName("XUID");
  24029. if (xuid && xuid.length > 16) {
  24030. cff.topDict.removeByName("XUID");
  24031. }
  24032. cff.topDict.setByName("charset", 0);
  24033. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  24034. output.add(compiled.output);
  24035. const topDictTracker = compiled.trackers[0];
  24036. const stringIndex = this.compileStringIndex(cff.strings.strings);
  24037. output.add(stringIndex);
  24038. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  24039. output.add(globalSubrIndex);
  24040. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  24041. if (cff.encoding.predefined) {
  24042. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  24043. } else {
  24044. const encoding = this.compileEncoding(cff.encoding);
  24045. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  24046. output.add(encoding);
  24047. }
  24048. }
  24049. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  24050. topDictTracker.setEntryLocation("charset", [output.length], output);
  24051. output.add(charset);
  24052. const charStrings = this.compileCharStrings(cff.charStrings);
  24053. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  24054. output.add(charStrings);
  24055. if (cff.isCIDFont) {
  24056. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  24057. const fdSelect = this.compileFDSelect(cff.fdSelect);
  24058. output.add(fdSelect);
  24059. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  24060. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  24061. output.add(compiled.output);
  24062. const fontDictTrackers = compiled.trackers;
  24063. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  24064. }
  24065. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  24066. output.add([0]);
  24067. return output.data;
  24068. }
  24069. encodeNumber(value) {
  24070. if (Number.isInteger(value)) {
  24071. return this.encodeInteger(value);
  24072. }
  24073. return this.encodeFloat(value);
  24074. }
  24075. static get EncodeFloatRegExp() {
  24076. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  24077. }
  24078. encodeFloat(num) {
  24079. let value = num.toString();
  24080. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  24081. if (m) {
  24082. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  24083. value = (Math.round(num * epsilon) / epsilon).toString();
  24084. }
  24085. let nibbles = "";
  24086. let i, ii;
  24087. for (i = 0, ii = value.length; i < ii; ++i) {
  24088. const a = value[i];
  24089. if (a === "e") {
  24090. nibbles += value[++i] === "-" ? "c" : "b";
  24091. } else if (a === ".") {
  24092. nibbles += "a";
  24093. } else if (a === "-") {
  24094. nibbles += "e";
  24095. } else {
  24096. nibbles += a;
  24097. }
  24098. }
  24099. nibbles += nibbles.length & 1 ? "f" : "ff";
  24100. const out = [30];
  24101. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  24102. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  24103. }
  24104. return out;
  24105. }
  24106. encodeInteger(value) {
  24107. let code;
  24108. if (value >= -107 && value <= 107) {
  24109. code = [value + 139];
  24110. } else if (value >= 108 && value <= 1131) {
  24111. value -= 108;
  24112. code = [(value >> 8) + 247, value & 0xff];
  24113. } else if (value >= -1131 && value <= -108) {
  24114. value = -value - 108;
  24115. code = [(value >> 8) + 251, value & 0xff];
  24116. } else if (value >= -32768 && value <= 32767) {
  24117. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  24118. } else {
  24119. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  24120. }
  24121. return code;
  24122. }
  24123. compileHeader(header) {
  24124. return [header.major, header.minor, 4, header.offSize];
  24125. }
  24126. compileNameIndex(names) {
  24127. const nameIndex = new CFFIndex();
  24128. for (const name of names) {
  24129. const length = Math.min(name.length, 127);
  24130. let sanitizedName = new Array(length);
  24131. for (let j = 0; j < length; j++) {
  24132. let char = name[j];
  24133. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  24134. char = "_";
  24135. }
  24136. sanitizedName[j] = char;
  24137. }
  24138. sanitizedName = sanitizedName.join("");
  24139. if (sanitizedName === "") {
  24140. sanitizedName = "Bad_Font_Name";
  24141. }
  24142. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  24143. }
  24144. return this.compileIndex(nameIndex);
  24145. }
  24146. compileTopDicts(dicts, length, removeCidKeys) {
  24147. const fontDictTrackers = [];
  24148. let fdArrayIndex = new CFFIndex();
  24149. for (const fontDict of dicts) {
  24150. if (removeCidKeys) {
  24151. fontDict.removeByName("CIDFontVersion");
  24152. fontDict.removeByName("CIDFontRevision");
  24153. fontDict.removeByName("CIDFontType");
  24154. fontDict.removeByName("CIDCount");
  24155. fontDict.removeByName("UIDBase");
  24156. }
  24157. const fontDictTracker = new CFFOffsetTracker();
  24158. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  24159. fontDictTrackers.push(fontDictTracker);
  24160. fdArrayIndex.add(fontDictData);
  24161. fontDictTracker.offset(length);
  24162. }
  24163. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  24164. return {
  24165. trackers: fontDictTrackers,
  24166. output: fdArrayIndex
  24167. };
  24168. }
  24169. compilePrivateDicts(dicts, trackers, output) {
  24170. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  24171. const fontDict = dicts[i];
  24172. const privateDict = fontDict.privateDict;
  24173. if (!privateDict || !fontDict.hasName("Private")) {
  24174. throw new _util.FormatError("There must be a private dictionary.");
  24175. }
  24176. const privateDictTracker = new CFFOffsetTracker();
  24177. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  24178. let outputLength = output.length;
  24179. privateDictTracker.offset(outputLength);
  24180. if (!privateDictData.length) {
  24181. outputLength = 0;
  24182. }
  24183. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  24184. output.add(privateDictData);
  24185. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  24186. const subrs = this.compileIndex(privateDict.subrsIndex);
  24187. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  24188. output.add(subrs);
  24189. }
  24190. }
  24191. }
  24192. compileDict(dict, offsetTracker) {
  24193. const out = [];
  24194. for (const key of dict.order) {
  24195. if (!(key in dict.values)) {
  24196. continue;
  24197. }
  24198. let values = dict.values[key];
  24199. let types = dict.types[key];
  24200. if (!Array.isArray(types)) {
  24201. types = [types];
  24202. }
  24203. if (!Array.isArray(values)) {
  24204. values = [values];
  24205. }
  24206. if (values.length === 0) {
  24207. continue;
  24208. }
  24209. for (let j = 0, jj = types.length; j < jj; ++j) {
  24210. const type = types[j];
  24211. const value = values[j];
  24212. switch (type) {
  24213. case "num":
  24214. case "sid":
  24215. out.push(...this.encodeNumber(value));
  24216. break;
  24217. case "offset":
  24218. const name = dict.keyToNameMap[key];
  24219. if (!offsetTracker.isTracking(name)) {
  24220. offsetTracker.track(name, out.length);
  24221. }
  24222. out.push(0x1d, 0, 0, 0, 0);
  24223. break;
  24224. case "array":
  24225. case "delta":
  24226. out.push(...this.encodeNumber(value));
  24227. for (let k = 1, kk = values.length; k < kk; ++k) {
  24228. out.push(...this.encodeNumber(values[k]));
  24229. }
  24230. break;
  24231. default:
  24232. throw new _util.FormatError(`Unknown data type of ${type}`);
  24233. }
  24234. }
  24235. out.push(...dict.opcodes[key]);
  24236. }
  24237. return out;
  24238. }
  24239. compileStringIndex(strings) {
  24240. const stringIndex = new CFFIndex();
  24241. for (const string of strings) {
  24242. stringIndex.add((0, _util.stringToBytes)(string));
  24243. }
  24244. return this.compileIndex(stringIndex);
  24245. }
  24246. compileGlobalSubrIndex() {
  24247. const globalSubrIndex = this.cff.globalSubrIndex;
  24248. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  24249. }
  24250. compileCharStrings(charStrings) {
  24251. const charStringsIndex = new CFFIndex();
  24252. for (let i = 0; i < charStrings.count; i++) {
  24253. const glyph = charStrings.get(i);
  24254. if (glyph.length === 0) {
  24255. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  24256. continue;
  24257. }
  24258. charStringsIndex.add(glyph);
  24259. }
  24260. return this.compileIndex(charStringsIndex);
  24261. }
  24262. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  24263. let out;
  24264. const numGlyphsLessNotDef = numGlyphs - 1;
  24265. if (isCIDFont) {
  24266. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  24267. } else {
  24268. const length = 1 + numGlyphsLessNotDef * 2;
  24269. out = new Uint8Array(length);
  24270. out[0] = 0;
  24271. let charsetIndex = 0;
  24272. const numCharsets = charset.charset.length;
  24273. let warned = false;
  24274. for (let i = 1; i < out.length; i += 2) {
  24275. let sid = 0;
  24276. if (charsetIndex < numCharsets) {
  24277. const name = charset.charset[charsetIndex++];
  24278. sid = strings.getSID(name);
  24279. if (sid === -1) {
  24280. sid = 0;
  24281. if (!warned) {
  24282. warned = true;
  24283. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  24284. }
  24285. }
  24286. }
  24287. out[i] = sid >> 8 & 0xff;
  24288. out[i + 1] = sid & 0xff;
  24289. }
  24290. }
  24291. return this.compileTypedArray(out);
  24292. }
  24293. compileEncoding(encoding) {
  24294. return this.compileTypedArray(encoding.raw);
  24295. }
  24296. compileFDSelect(fdSelect) {
  24297. const format = fdSelect.format;
  24298. let out, i;
  24299. switch (format) {
  24300. case 0:
  24301. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  24302. out[0] = format;
  24303. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  24304. out[i + 1] = fdSelect.fdSelect[i];
  24305. }
  24306. break;
  24307. case 3:
  24308. const start = 0;
  24309. let lastFD = fdSelect.fdSelect[0];
  24310. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  24311. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  24312. const currentFD = fdSelect.fdSelect[i];
  24313. if (currentFD !== lastFD) {
  24314. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  24315. lastFD = currentFD;
  24316. }
  24317. }
  24318. const numRanges = (ranges.length - 3) / 3;
  24319. ranges[1] = numRanges >> 8 & 0xff;
  24320. ranges[2] = numRanges & 0xff;
  24321. ranges.push(i >> 8 & 0xff, i & 0xff);
  24322. out = new Uint8Array(ranges);
  24323. break;
  24324. }
  24325. return this.compileTypedArray(out);
  24326. }
  24327. compileTypedArray(data) {
  24328. const out = [];
  24329. for (let i = 0, ii = data.length; i < ii; ++i) {
  24330. out[i] = data[i];
  24331. }
  24332. return out;
  24333. }
  24334. compileIndex(index, trackers = []) {
  24335. const objects = index.objects;
  24336. const count = objects.length;
  24337. if (count === 0) {
  24338. return [0, 0];
  24339. }
  24340. const data = [count >> 8 & 0xff, count & 0xff];
  24341. let lastOffset = 1,
  24342. i;
  24343. for (i = 0; i < count; ++i) {
  24344. lastOffset += objects[i].length;
  24345. }
  24346. let offsetSize;
  24347. if (lastOffset < 0x100) {
  24348. offsetSize = 1;
  24349. } else if (lastOffset < 0x10000) {
  24350. offsetSize = 2;
  24351. } else if (lastOffset < 0x1000000) {
  24352. offsetSize = 3;
  24353. } else {
  24354. offsetSize = 4;
  24355. }
  24356. data.push(offsetSize);
  24357. let relativeOffset = 1;
  24358. for (i = 0; i < count + 1; i++) {
  24359. if (offsetSize === 1) {
  24360. data.push(relativeOffset & 0xff);
  24361. } else if (offsetSize === 2) {
  24362. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24363. } else if (offsetSize === 3) {
  24364. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24365. } else {
  24366. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24367. }
  24368. if (objects[i]) {
  24369. relativeOffset += objects[i].length;
  24370. }
  24371. }
  24372. for (i = 0; i < count; i++) {
  24373. if (trackers[i]) {
  24374. trackers[i].offset(data.length);
  24375. }
  24376. data.push(...objects[i]);
  24377. }
  24378. return data;
  24379. }
  24380. }
  24381. exports.CFFCompiler = CFFCompiler;
  24382. /***/ }),
  24383. /* 34 */
  24384. /***/ ((__unused_webpack_module, exports) => {
  24385. Object.defineProperty(exports, "__esModule", ({
  24386. value: true
  24387. }));
  24388. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  24389. 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"];
  24390. exports.ISOAdobeCharset = ISOAdobeCharset;
  24391. 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"];
  24392. exports.ExpertCharset = ExpertCharset;
  24393. 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"];
  24394. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  24395. /***/ }),
  24396. /* 35 */
  24397. /***/ ((__unused_webpack_module, exports) => {
  24398. Object.defineProperty(exports, "__esModule", ({
  24399. value: true
  24400. }));
  24401. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  24402. exports.getEncoding = getEncoding;
  24403. 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"];
  24404. exports.ExpertEncoding = ExpertEncoding;
  24405. 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", "", "", "", ""];
  24406. 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"];
  24407. exports.MacRomanEncoding = MacRomanEncoding;
  24408. 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", "", "", "", ""];
  24409. exports.StandardEncoding = StandardEncoding;
  24410. 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"];
  24411. exports.WinAnsiEncoding = WinAnsiEncoding;
  24412. 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", ""];
  24413. exports.SymbolSetEncoding = SymbolSetEncoding;
  24414. 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", ""];
  24415. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  24416. function getEncoding(encodingName) {
  24417. switch (encodingName) {
  24418. case "WinAnsiEncoding":
  24419. return WinAnsiEncoding;
  24420. case "StandardEncoding":
  24421. return StandardEncoding;
  24422. case "MacRomanEncoding":
  24423. return MacRomanEncoding;
  24424. case "SymbolSetEncoding":
  24425. return SymbolSetEncoding;
  24426. case "ZapfDingbatsEncoding":
  24427. return ZapfDingbatsEncoding;
  24428. case "ExpertEncoding":
  24429. return ExpertEncoding;
  24430. case "MacExpertEncoding":
  24431. return MacExpertEncoding;
  24432. default:
  24433. return null;
  24434. }
  24435. }
  24436. /***/ }),
  24437. /* 36 */
  24438. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24439. Object.defineProperty(exports, "__esModule", ({
  24440. value: true
  24441. }));
  24442. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  24443. exports.normalizeFontName = normalizeFontName;
  24444. exports.recoverGlyphName = recoverGlyphName;
  24445. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  24446. var _encodings = __w_pdfjs_require__(35);
  24447. var _glyphlist = __w_pdfjs_require__(37);
  24448. var _unicode = __w_pdfjs_require__(38);
  24449. var _util = __w_pdfjs_require__(2);
  24450. const SEAC_ANALYSIS_ENABLED = true;
  24451. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  24452. const FontFlags = {
  24453. FixedPitch: 1,
  24454. Serif: 2,
  24455. Symbolic: 4,
  24456. Script: 8,
  24457. Nonsymbolic: 32,
  24458. Italic: 64,
  24459. AllCap: 65536,
  24460. SmallCap: 131072,
  24461. ForceBold: 262144
  24462. };
  24463. exports.FontFlags = FontFlags;
  24464. 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"];
  24465. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  24466. function recoverGlyphName(name, glyphsUnicodeMap) {
  24467. if (glyphsUnicodeMap[name] !== undefined) {
  24468. return name;
  24469. }
  24470. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  24471. if (unicode !== -1) {
  24472. for (const key in glyphsUnicodeMap) {
  24473. if (glyphsUnicodeMap[key] === unicode) {
  24474. return key;
  24475. }
  24476. }
  24477. }
  24478. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  24479. return name;
  24480. }
  24481. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  24482. const charCodeToGlyphId = Object.create(null);
  24483. let glyphId, charCode, baseEncoding;
  24484. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  24485. if (properties.isInternalFont) {
  24486. baseEncoding = builtInEncoding;
  24487. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24488. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24489. if (glyphId >= 0) {
  24490. charCodeToGlyphId[charCode] = glyphId;
  24491. } else {
  24492. charCodeToGlyphId[charCode] = 0;
  24493. }
  24494. }
  24495. } else if (properties.baseEncodingName) {
  24496. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  24497. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24498. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24499. if (glyphId >= 0) {
  24500. charCodeToGlyphId[charCode] = glyphId;
  24501. } else {
  24502. charCodeToGlyphId[charCode] = 0;
  24503. }
  24504. }
  24505. } else if (isSymbolicFont) {
  24506. for (charCode in builtInEncoding) {
  24507. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  24508. }
  24509. } else {
  24510. baseEncoding = _encodings.StandardEncoding;
  24511. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24512. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24513. if (glyphId >= 0) {
  24514. charCodeToGlyphId[charCode] = glyphId;
  24515. } else {
  24516. charCodeToGlyphId[charCode] = 0;
  24517. }
  24518. }
  24519. }
  24520. const differences = properties.differences;
  24521. let glyphsUnicodeMap;
  24522. if (differences) {
  24523. for (charCode in differences) {
  24524. const glyphName = differences[charCode];
  24525. glyphId = glyphNames.indexOf(glyphName);
  24526. if (glyphId === -1) {
  24527. if (!glyphsUnicodeMap) {
  24528. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24529. }
  24530. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24531. if (standardGlyphName !== glyphName) {
  24532. glyphId = glyphNames.indexOf(standardGlyphName);
  24533. }
  24534. }
  24535. if (glyphId >= 0) {
  24536. charCodeToGlyphId[charCode] = glyphId;
  24537. } else {
  24538. charCodeToGlyphId[charCode] = 0;
  24539. }
  24540. }
  24541. }
  24542. return charCodeToGlyphId;
  24543. }
  24544. function normalizeFontName(name) {
  24545. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  24546. }
  24547. /***/ }),
  24548. /* 37 */
  24549. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  24550. __w_pdfjs_require__.r(__webpack_exports__);
  24551. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  24552. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  24553. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  24554. /* harmony export */ });
  24555. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(4);
  24556. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  24557. return [
  24558. "A",
  24559. 0x0041,
  24560. "AE",
  24561. 0x00c6,
  24562. "AEacute",
  24563. 0x01fc,
  24564. "AEmacron",
  24565. 0x01e2,
  24566. "AEsmall",
  24567. 0xf7e6,
  24568. "Aacute",
  24569. 0x00c1,
  24570. "Aacutesmall",
  24571. 0xf7e1,
  24572. "Abreve",
  24573. 0x0102,
  24574. "Abreveacute",
  24575. 0x1eae,
  24576. "Abrevecyrillic",
  24577. 0x04d0,
  24578. "Abrevedotbelow",
  24579. 0x1eb6,
  24580. "Abrevegrave",
  24581. 0x1eb0,
  24582. "Abrevehookabove",
  24583. 0x1eb2,
  24584. "Abrevetilde",
  24585. 0x1eb4,
  24586. "Acaron",
  24587. 0x01cd,
  24588. "Acircle",
  24589. 0x24b6,
  24590. "Acircumflex",
  24591. 0x00c2,
  24592. "Acircumflexacute",
  24593. 0x1ea4,
  24594. "Acircumflexdotbelow",
  24595. 0x1eac,
  24596. "Acircumflexgrave",
  24597. 0x1ea6,
  24598. "Acircumflexhookabove",
  24599. 0x1ea8,
  24600. "Acircumflexsmall",
  24601. 0xf7e2,
  24602. "Acircumflextilde",
  24603. 0x1eaa,
  24604. "Acute",
  24605. 0xf6c9,
  24606. "Acutesmall",
  24607. 0xf7b4,
  24608. "Acyrillic",
  24609. 0x0410,
  24610. "Adblgrave",
  24611. 0x0200,
  24612. "Adieresis",
  24613. 0x00c4,
  24614. "Adieresiscyrillic",
  24615. 0x04d2,
  24616. "Adieresismacron",
  24617. 0x01de,
  24618. "Adieresissmall",
  24619. 0xf7e4,
  24620. "Adotbelow",
  24621. 0x1ea0,
  24622. "Adotmacron",
  24623. 0x01e0,
  24624. "Agrave",
  24625. 0x00c0,
  24626. "Agravesmall",
  24627. 0xf7e0,
  24628. "Ahookabove",
  24629. 0x1ea2,
  24630. "Aiecyrillic",
  24631. 0x04d4,
  24632. "Ainvertedbreve",
  24633. 0x0202,
  24634. "Alpha",
  24635. 0x0391,
  24636. "Alphatonos",
  24637. 0x0386,
  24638. "Amacron",
  24639. 0x0100,
  24640. "Amonospace",
  24641. 0xff21,
  24642. "Aogonek",
  24643. 0x0104,
  24644. "Aring",
  24645. 0x00c5,
  24646. "Aringacute",
  24647. 0x01fa,
  24648. "Aringbelow",
  24649. 0x1e00,
  24650. "Aringsmall",
  24651. 0xf7e5,
  24652. "Asmall",
  24653. 0xf761,
  24654. "Atilde",
  24655. 0x00c3,
  24656. "Atildesmall",
  24657. 0xf7e3,
  24658. "Aybarmenian",
  24659. 0x0531,
  24660. "B",
  24661. 0x0042,
  24662. "Bcircle",
  24663. 0x24b7,
  24664. "Bdotaccent",
  24665. 0x1e02,
  24666. "Bdotbelow",
  24667. 0x1e04,
  24668. "Becyrillic",
  24669. 0x0411,
  24670. "Benarmenian",
  24671. 0x0532,
  24672. "Beta",
  24673. 0x0392,
  24674. "Bhook",
  24675. 0x0181,
  24676. "Blinebelow",
  24677. 0x1e06,
  24678. "Bmonospace",
  24679. 0xff22,
  24680. "Brevesmall",
  24681. 0xf6f4,
  24682. "Bsmall",
  24683. 0xf762,
  24684. "Btopbar",
  24685. 0x0182,
  24686. "C",
  24687. 0x0043,
  24688. "Caarmenian",
  24689. 0x053e,
  24690. "Cacute",
  24691. 0x0106,
  24692. "Caron",
  24693. 0xf6ca,
  24694. "Caronsmall",
  24695. 0xf6f5,
  24696. "Ccaron",
  24697. 0x010c,
  24698. "Ccedilla",
  24699. 0x00c7,
  24700. "Ccedillaacute",
  24701. 0x1e08,
  24702. "Ccedillasmall",
  24703. 0xf7e7,
  24704. "Ccircle",
  24705. 0x24b8,
  24706. "Ccircumflex",
  24707. 0x0108,
  24708. "Cdot",
  24709. 0x010a,
  24710. "Cdotaccent",
  24711. 0x010a,
  24712. "Cedillasmall",
  24713. 0xf7b8,
  24714. "Chaarmenian",
  24715. 0x0549,
  24716. "Cheabkhasiancyrillic",
  24717. 0x04bc,
  24718. "Checyrillic",
  24719. 0x0427,
  24720. "Chedescenderabkhasiancyrillic",
  24721. 0x04be,
  24722. "Chedescendercyrillic",
  24723. 0x04b6,
  24724. "Chedieresiscyrillic",
  24725. 0x04f4,
  24726. "Cheharmenian",
  24727. 0x0543,
  24728. "Chekhakassiancyrillic",
  24729. 0x04cb,
  24730. "Cheverticalstrokecyrillic",
  24731. 0x04b8,
  24732. "Chi",
  24733. 0x03a7,
  24734. "Chook",
  24735. 0x0187,
  24736. "Circumflexsmall",
  24737. 0xf6f6,
  24738. "Cmonospace",
  24739. 0xff23,
  24740. "Coarmenian",
  24741. 0x0551,
  24742. "Csmall",
  24743. 0xf763,
  24744. "D",
  24745. 0x0044,
  24746. "DZ",
  24747. 0x01f1,
  24748. "DZcaron",
  24749. 0x01c4,
  24750. "Daarmenian",
  24751. 0x0534,
  24752. "Dafrican",
  24753. 0x0189,
  24754. "Dcaron",
  24755. 0x010e,
  24756. "Dcedilla",
  24757. 0x1e10,
  24758. "Dcircle",
  24759. 0x24b9,
  24760. "Dcircumflexbelow",
  24761. 0x1e12,
  24762. "Dcroat",
  24763. 0x0110,
  24764. "Ddotaccent",
  24765. 0x1e0a,
  24766. "Ddotbelow",
  24767. 0x1e0c,
  24768. "Decyrillic",
  24769. 0x0414,
  24770. "Deicoptic",
  24771. 0x03ee,
  24772. "Delta",
  24773. 0x2206,
  24774. "Deltagreek",
  24775. 0x0394,
  24776. "Dhook",
  24777. 0x018a,
  24778. "Dieresis",
  24779. 0xf6cb,
  24780. "DieresisAcute",
  24781. 0xf6cc,
  24782. "DieresisGrave",
  24783. 0xf6cd,
  24784. "Dieresissmall",
  24785. 0xf7a8,
  24786. "Digammagreek",
  24787. 0x03dc,
  24788. "Djecyrillic",
  24789. 0x0402,
  24790. "Dlinebelow",
  24791. 0x1e0e,
  24792. "Dmonospace",
  24793. 0xff24,
  24794. "Dotaccentsmall",
  24795. 0xf6f7,
  24796. "Dslash",
  24797. 0x0110,
  24798. "Dsmall",
  24799. 0xf764,
  24800. "Dtopbar",
  24801. 0x018b,
  24802. "Dz",
  24803. 0x01f2,
  24804. "Dzcaron",
  24805. 0x01c5,
  24806. "Dzeabkhasiancyrillic",
  24807. 0x04e0,
  24808. "Dzecyrillic",
  24809. 0x0405,
  24810. "Dzhecyrillic",
  24811. 0x040f,
  24812. "E",
  24813. 0x0045,
  24814. "Eacute",
  24815. 0x00c9,
  24816. "Eacutesmall",
  24817. 0xf7e9,
  24818. "Ebreve",
  24819. 0x0114,
  24820. "Ecaron",
  24821. 0x011a,
  24822. "Ecedillabreve",
  24823. 0x1e1c,
  24824. "Echarmenian",
  24825. 0x0535,
  24826. "Ecircle",
  24827. 0x24ba,
  24828. "Ecircumflex",
  24829. 0x00ca,
  24830. "Ecircumflexacute",
  24831. 0x1ebe,
  24832. "Ecircumflexbelow",
  24833. 0x1e18,
  24834. "Ecircumflexdotbelow",
  24835. 0x1ec6,
  24836. "Ecircumflexgrave",
  24837. 0x1ec0,
  24838. "Ecircumflexhookabove",
  24839. 0x1ec2,
  24840. "Ecircumflexsmall",
  24841. 0xf7ea,
  24842. "Ecircumflextilde",
  24843. 0x1ec4,
  24844. "Ecyrillic",
  24845. 0x0404,
  24846. "Edblgrave",
  24847. 0x0204,
  24848. "Edieresis",
  24849. 0x00cb,
  24850. "Edieresissmall",
  24851. 0xf7eb,
  24852. "Edot",
  24853. 0x0116,
  24854. "Edotaccent",
  24855. 0x0116,
  24856. "Edotbelow",
  24857. 0x1eb8,
  24858. "Efcyrillic",
  24859. 0x0424,
  24860. "Egrave",
  24861. 0x00c8,
  24862. "Egravesmall",
  24863. 0xf7e8,
  24864. "Eharmenian",
  24865. 0x0537,
  24866. "Ehookabove",
  24867. 0x1eba,
  24868. "Eightroman",
  24869. 0x2167,
  24870. "Einvertedbreve",
  24871. 0x0206,
  24872. "Eiotifiedcyrillic",
  24873. 0x0464,
  24874. "Elcyrillic",
  24875. 0x041b,
  24876. "Elevenroman",
  24877. 0x216a,
  24878. "Emacron",
  24879. 0x0112,
  24880. "Emacronacute",
  24881. 0x1e16,
  24882. "Emacrongrave",
  24883. 0x1e14,
  24884. "Emcyrillic",
  24885. 0x041c,
  24886. "Emonospace",
  24887. 0xff25,
  24888. "Encyrillic",
  24889. 0x041d,
  24890. "Endescendercyrillic",
  24891. 0x04a2,
  24892. "Eng",
  24893. 0x014a,
  24894. "Enghecyrillic",
  24895. 0x04a4,
  24896. "Enhookcyrillic",
  24897. 0x04c7,
  24898. "Eogonek",
  24899. 0x0118,
  24900. "Eopen",
  24901. 0x0190,
  24902. "Epsilon",
  24903. 0x0395,
  24904. "Epsilontonos",
  24905. 0x0388,
  24906. "Ercyrillic",
  24907. 0x0420,
  24908. "Ereversed",
  24909. 0x018e,
  24910. "Ereversedcyrillic",
  24911. 0x042d,
  24912. "Escyrillic",
  24913. 0x0421,
  24914. "Esdescendercyrillic",
  24915. 0x04aa,
  24916. "Esh",
  24917. 0x01a9,
  24918. "Esmall",
  24919. 0xf765,
  24920. "Eta",
  24921. 0x0397,
  24922. "Etarmenian",
  24923. 0x0538,
  24924. "Etatonos",
  24925. 0x0389,
  24926. "Eth",
  24927. 0x00d0,
  24928. "Ethsmall",
  24929. 0xf7f0,
  24930. "Etilde",
  24931. 0x1ebc,
  24932. "Etildebelow",
  24933. 0x1e1a,
  24934. "Euro",
  24935. 0x20ac,
  24936. "Ezh",
  24937. 0x01b7,
  24938. "Ezhcaron",
  24939. 0x01ee,
  24940. "Ezhreversed",
  24941. 0x01b8,
  24942. "F",
  24943. 0x0046,
  24944. "Fcircle",
  24945. 0x24bb,
  24946. "Fdotaccent",
  24947. 0x1e1e,
  24948. "Feharmenian",
  24949. 0x0556,
  24950. "Feicoptic",
  24951. 0x03e4,
  24952. "Fhook",
  24953. 0x0191,
  24954. "Fitacyrillic",
  24955. 0x0472,
  24956. "Fiveroman",
  24957. 0x2164,
  24958. "Fmonospace",
  24959. 0xff26,
  24960. "Fourroman",
  24961. 0x2163,
  24962. "Fsmall",
  24963. 0xf766,
  24964. "G",
  24965. 0x0047,
  24966. "GBsquare",
  24967. 0x3387,
  24968. "Gacute",
  24969. 0x01f4,
  24970. "Gamma",
  24971. 0x0393,
  24972. "Gammaafrican",
  24973. 0x0194,
  24974. "Gangiacoptic",
  24975. 0x03ea,
  24976. "Gbreve",
  24977. 0x011e,
  24978. "Gcaron",
  24979. 0x01e6,
  24980. "Gcedilla",
  24981. 0x0122,
  24982. "Gcircle",
  24983. 0x24bc,
  24984. "Gcircumflex",
  24985. 0x011c,
  24986. "Gcommaaccent",
  24987. 0x0122,
  24988. "Gdot",
  24989. 0x0120,
  24990. "Gdotaccent",
  24991. 0x0120,
  24992. "Gecyrillic",
  24993. 0x0413,
  24994. "Ghadarmenian",
  24995. 0x0542,
  24996. "Ghemiddlehookcyrillic",
  24997. 0x0494,
  24998. "Ghestrokecyrillic",
  24999. 0x0492,
  25000. "Gheupturncyrillic",
  25001. 0x0490,
  25002. "Ghook",
  25003. 0x0193,
  25004. "Gimarmenian",
  25005. 0x0533,
  25006. "Gjecyrillic",
  25007. 0x0403,
  25008. "Gmacron",
  25009. 0x1e20,
  25010. "Gmonospace",
  25011. 0xff27,
  25012. "Grave",
  25013. 0xf6ce,
  25014. "Gravesmall",
  25015. 0xf760,
  25016. "Gsmall",
  25017. 0xf767,
  25018. "Gsmallhook",
  25019. 0x029b,
  25020. "Gstroke",
  25021. 0x01e4,
  25022. "H",
  25023. 0x0048,
  25024. "H18533",
  25025. 0x25cf,
  25026. "H18543",
  25027. 0x25aa,
  25028. "H18551",
  25029. 0x25ab,
  25030. "H22073",
  25031. 0x25a1,
  25032. "HPsquare",
  25033. 0x33cb,
  25034. "Haabkhasiancyrillic",
  25035. 0x04a8,
  25036. "Hadescendercyrillic",
  25037. 0x04b2,
  25038. "Hardsigncyrillic",
  25039. 0x042a,
  25040. "Hbar",
  25041. 0x0126,
  25042. "Hbrevebelow",
  25043. 0x1e2a,
  25044. "Hcedilla",
  25045. 0x1e28,
  25046. "Hcircle",
  25047. 0x24bd,
  25048. "Hcircumflex",
  25049. 0x0124,
  25050. "Hdieresis",
  25051. 0x1e26,
  25052. "Hdotaccent",
  25053. 0x1e22,
  25054. "Hdotbelow",
  25055. 0x1e24,
  25056. "Hmonospace",
  25057. 0xff28,
  25058. "Hoarmenian",
  25059. 0x0540,
  25060. "Horicoptic",
  25061. 0x03e8,
  25062. "Hsmall",
  25063. 0xf768,
  25064. "Hungarumlaut",
  25065. 0xf6cf,
  25066. "Hungarumlautsmall",
  25067. 0xf6f8,
  25068. "Hzsquare",
  25069. 0x3390,
  25070. "I",
  25071. 0x0049,
  25072. "IAcyrillic",
  25073. 0x042f,
  25074. "IJ",
  25075. 0x0132,
  25076. "IUcyrillic",
  25077. 0x042e,
  25078. "Iacute",
  25079. 0x00cd,
  25080. "Iacutesmall",
  25081. 0xf7ed,
  25082. "Ibreve",
  25083. 0x012c,
  25084. "Icaron",
  25085. 0x01cf,
  25086. "Icircle",
  25087. 0x24be,
  25088. "Icircumflex",
  25089. 0x00ce,
  25090. "Icircumflexsmall",
  25091. 0xf7ee,
  25092. "Icyrillic",
  25093. 0x0406,
  25094. "Idblgrave",
  25095. 0x0208,
  25096. "Idieresis",
  25097. 0x00cf,
  25098. "Idieresisacute",
  25099. 0x1e2e,
  25100. "Idieresiscyrillic",
  25101. 0x04e4,
  25102. "Idieresissmall",
  25103. 0xf7ef,
  25104. "Idot",
  25105. 0x0130,
  25106. "Idotaccent",
  25107. 0x0130,
  25108. "Idotbelow",
  25109. 0x1eca,
  25110. "Iebrevecyrillic",
  25111. 0x04d6,
  25112. "Iecyrillic",
  25113. 0x0415,
  25114. "Ifraktur",
  25115. 0x2111,
  25116. "Igrave",
  25117. 0x00cc,
  25118. "Igravesmall",
  25119. 0xf7ec,
  25120. "Ihookabove",
  25121. 0x1ec8,
  25122. "Iicyrillic",
  25123. 0x0418,
  25124. "Iinvertedbreve",
  25125. 0x020a,
  25126. "Iishortcyrillic",
  25127. 0x0419,
  25128. "Imacron",
  25129. 0x012a,
  25130. "Imacroncyrillic",
  25131. 0x04e2,
  25132. "Imonospace",
  25133. 0xff29,
  25134. "Iniarmenian",
  25135. 0x053b,
  25136. "Iocyrillic",
  25137. 0x0401,
  25138. "Iogonek",
  25139. 0x012e,
  25140. "Iota",
  25141. 0x0399,
  25142. "Iotaafrican",
  25143. 0x0196,
  25144. "Iotadieresis",
  25145. 0x03aa,
  25146. "Iotatonos",
  25147. 0x038a,
  25148. "Ismall",
  25149. 0xf769,
  25150. "Istroke",
  25151. 0x0197,
  25152. "Itilde",
  25153. 0x0128,
  25154. "Itildebelow",
  25155. 0x1e2c,
  25156. "Izhitsacyrillic",
  25157. 0x0474,
  25158. "Izhitsadblgravecyrillic",
  25159. 0x0476,
  25160. "J",
  25161. 0x004a,
  25162. "Jaarmenian",
  25163. 0x0541,
  25164. "Jcircle",
  25165. 0x24bf,
  25166. "Jcircumflex",
  25167. 0x0134,
  25168. "Jecyrillic",
  25169. 0x0408,
  25170. "Jheharmenian",
  25171. 0x054b,
  25172. "Jmonospace",
  25173. 0xff2a,
  25174. "Jsmall",
  25175. 0xf76a,
  25176. "K",
  25177. 0x004b,
  25178. "KBsquare",
  25179. 0x3385,
  25180. "KKsquare",
  25181. 0x33cd,
  25182. "Kabashkircyrillic",
  25183. 0x04a0,
  25184. "Kacute",
  25185. 0x1e30,
  25186. "Kacyrillic",
  25187. 0x041a,
  25188. "Kadescendercyrillic",
  25189. 0x049a,
  25190. "Kahookcyrillic",
  25191. 0x04c3,
  25192. "Kappa",
  25193. 0x039a,
  25194. "Kastrokecyrillic",
  25195. 0x049e,
  25196. "Kaverticalstrokecyrillic",
  25197. 0x049c,
  25198. "Kcaron",
  25199. 0x01e8,
  25200. "Kcedilla",
  25201. 0x0136,
  25202. "Kcircle",
  25203. 0x24c0,
  25204. "Kcommaaccent",
  25205. 0x0136,
  25206. "Kdotbelow",
  25207. 0x1e32,
  25208. "Keharmenian",
  25209. 0x0554,
  25210. "Kenarmenian",
  25211. 0x053f,
  25212. "Khacyrillic",
  25213. 0x0425,
  25214. "Kheicoptic",
  25215. 0x03e6,
  25216. "Khook",
  25217. 0x0198,
  25218. "Kjecyrillic",
  25219. 0x040c,
  25220. "Klinebelow",
  25221. 0x1e34,
  25222. "Kmonospace",
  25223. 0xff2b,
  25224. "Koppacyrillic",
  25225. 0x0480,
  25226. "Koppagreek",
  25227. 0x03de,
  25228. "Ksicyrillic",
  25229. 0x046e,
  25230. "Ksmall",
  25231. 0xf76b,
  25232. "L",
  25233. 0x004c,
  25234. "LJ",
  25235. 0x01c7,
  25236. "LL",
  25237. 0xf6bf,
  25238. "Lacute",
  25239. 0x0139,
  25240. "Lambda",
  25241. 0x039b,
  25242. "Lcaron",
  25243. 0x013d,
  25244. "Lcedilla",
  25245. 0x013b,
  25246. "Lcircle",
  25247. 0x24c1,
  25248. "Lcircumflexbelow",
  25249. 0x1e3c,
  25250. "Lcommaaccent",
  25251. 0x013b,
  25252. "Ldot",
  25253. 0x013f,
  25254. "Ldotaccent",
  25255. 0x013f,
  25256. "Ldotbelow",
  25257. 0x1e36,
  25258. "Ldotbelowmacron",
  25259. 0x1e38,
  25260. "Liwnarmenian",
  25261. 0x053c,
  25262. "Lj",
  25263. 0x01c8,
  25264. "Ljecyrillic",
  25265. 0x0409,
  25266. "Llinebelow",
  25267. 0x1e3a,
  25268. "Lmonospace",
  25269. 0xff2c,
  25270. "Lslash",
  25271. 0x0141,
  25272. "Lslashsmall",
  25273. 0xf6f9,
  25274. "Lsmall",
  25275. 0xf76c,
  25276. "M",
  25277. 0x004d,
  25278. "MBsquare",
  25279. 0x3386,
  25280. "Macron",
  25281. 0xf6d0,
  25282. "Macronsmall",
  25283. 0xf7af,
  25284. "Macute",
  25285. 0x1e3e,
  25286. "Mcircle",
  25287. 0x24c2,
  25288. "Mdotaccent",
  25289. 0x1e40,
  25290. "Mdotbelow",
  25291. 0x1e42,
  25292. "Menarmenian",
  25293. 0x0544,
  25294. "Mmonospace",
  25295. 0xff2d,
  25296. "Msmall",
  25297. 0xf76d,
  25298. "Mturned",
  25299. 0x019c,
  25300. "Mu",
  25301. 0x039c,
  25302. "N",
  25303. 0x004e,
  25304. "NJ",
  25305. 0x01ca,
  25306. "Nacute",
  25307. 0x0143,
  25308. "Ncaron",
  25309. 0x0147,
  25310. "Ncedilla",
  25311. 0x0145,
  25312. "Ncircle",
  25313. 0x24c3,
  25314. "Ncircumflexbelow",
  25315. 0x1e4a,
  25316. "Ncommaaccent",
  25317. 0x0145,
  25318. "Ndotaccent",
  25319. 0x1e44,
  25320. "Ndotbelow",
  25321. 0x1e46,
  25322. "Nhookleft",
  25323. 0x019d,
  25324. "Nineroman",
  25325. 0x2168,
  25326. "Nj",
  25327. 0x01cb,
  25328. "Njecyrillic",
  25329. 0x040a,
  25330. "Nlinebelow",
  25331. 0x1e48,
  25332. "Nmonospace",
  25333. 0xff2e,
  25334. "Nowarmenian",
  25335. 0x0546,
  25336. "Nsmall",
  25337. 0xf76e,
  25338. "Ntilde",
  25339. 0x00d1,
  25340. "Ntildesmall",
  25341. 0xf7f1,
  25342. "Nu",
  25343. 0x039d,
  25344. "O",
  25345. 0x004f,
  25346. "OE",
  25347. 0x0152,
  25348. "OEsmall",
  25349. 0xf6fa,
  25350. "Oacute",
  25351. 0x00d3,
  25352. "Oacutesmall",
  25353. 0xf7f3,
  25354. "Obarredcyrillic",
  25355. 0x04e8,
  25356. "Obarreddieresiscyrillic",
  25357. 0x04ea,
  25358. "Obreve",
  25359. 0x014e,
  25360. "Ocaron",
  25361. 0x01d1,
  25362. "Ocenteredtilde",
  25363. 0x019f,
  25364. "Ocircle",
  25365. 0x24c4,
  25366. "Ocircumflex",
  25367. 0x00d4,
  25368. "Ocircumflexacute",
  25369. 0x1ed0,
  25370. "Ocircumflexdotbelow",
  25371. 0x1ed8,
  25372. "Ocircumflexgrave",
  25373. 0x1ed2,
  25374. "Ocircumflexhookabove",
  25375. 0x1ed4,
  25376. "Ocircumflexsmall",
  25377. 0xf7f4,
  25378. "Ocircumflextilde",
  25379. 0x1ed6,
  25380. "Ocyrillic",
  25381. 0x041e,
  25382. "Odblacute",
  25383. 0x0150,
  25384. "Odblgrave",
  25385. 0x020c,
  25386. "Odieresis",
  25387. 0x00d6,
  25388. "Odieresiscyrillic",
  25389. 0x04e6,
  25390. "Odieresissmall",
  25391. 0xf7f6,
  25392. "Odotbelow",
  25393. 0x1ecc,
  25394. "Ogoneksmall",
  25395. 0xf6fb,
  25396. "Ograve",
  25397. 0x00d2,
  25398. "Ogravesmall",
  25399. 0xf7f2,
  25400. "Oharmenian",
  25401. 0x0555,
  25402. "Ohm",
  25403. 0x2126,
  25404. "Ohookabove",
  25405. 0x1ece,
  25406. "Ohorn",
  25407. 0x01a0,
  25408. "Ohornacute",
  25409. 0x1eda,
  25410. "Ohorndotbelow",
  25411. 0x1ee2,
  25412. "Ohorngrave",
  25413. 0x1edc,
  25414. "Ohornhookabove",
  25415. 0x1ede,
  25416. "Ohorntilde",
  25417. 0x1ee0,
  25418. "Ohungarumlaut",
  25419. 0x0150,
  25420. "Oi",
  25421. 0x01a2,
  25422. "Oinvertedbreve",
  25423. 0x020e,
  25424. "Omacron",
  25425. 0x014c,
  25426. "Omacronacute",
  25427. 0x1e52,
  25428. "Omacrongrave",
  25429. 0x1e50,
  25430. "Omega",
  25431. 0x2126,
  25432. "Omegacyrillic",
  25433. 0x0460,
  25434. "Omegagreek",
  25435. 0x03a9,
  25436. "Omegaroundcyrillic",
  25437. 0x047a,
  25438. "Omegatitlocyrillic",
  25439. 0x047c,
  25440. "Omegatonos",
  25441. 0x038f,
  25442. "Omicron",
  25443. 0x039f,
  25444. "Omicrontonos",
  25445. 0x038c,
  25446. "Omonospace",
  25447. 0xff2f,
  25448. "Oneroman",
  25449. 0x2160,
  25450. "Oogonek",
  25451. 0x01ea,
  25452. "Oogonekmacron",
  25453. 0x01ec,
  25454. "Oopen",
  25455. 0x0186,
  25456. "Oslash",
  25457. 0x00d8,
  25458. "Oslashacute",
  25459. 0x01fe,
  25460. "Oslashsmall",
  25461. 0xf7f8,
  25462. "Osmall",
  25463. 0xf76f,
  25464. "Ostrokeacute",
  25465. 0x01fe,
  25466. "Otcyrillic",
  25467. 0x047e,
  25468. "Otilde",
  25469. 0x00d5,
  25470. "Otildeacute",
  25471. 0x1e4c,
  25472. "Otildedieresis",
  25473. 0x1e4e,
  25474. "Otildesmall",
  25475. 0xf7f5,
  25476. "P",
  25477. 0x0050,
  25478. "Pacute",
  25479. 0x1e54,
  25480. "Pcircle",
  25481. 0x24c5,
  25482. "Pdotaccent",
  25483. 0x1e56,
  25484. "Pecyrillic",
  25485. 0x041f,
  25486. "Peharmenian",
  25487. 0x054a,
  25488. "Pemiddlehookcyrillic",
  25489. 0x04a6,
  25490. "Phi",
  25491. 0x03a6,
  25492. "Phook",
  25493. 0x01a4,
  25494. "Pi",
  25495. 0x03a0,
  25496. "Piwrarmenian",
  25497. 0x0553,
  25498. "Pmonospace",
  25499. 0xff30,
  25500. "Psi",
  25501. 0x03a8,
  25502. "Psicyrillic",
  25503. 0x0470,
  25504. "Psmall",
  25505. 0xf770,
  25506. "Q",
  25507. 0x0051,
  25508. "Qcircle",
  25509. 0x24c6,
  25510. "Qmonospace",
  25511. 0xff31,
  25512. "Qsmall",
  25513. 0xf771,
  25514. "R",
  25515. 0x0052,
  25516. "Raarmenian",
  25517. 0x054c,
  25518. "Racute",
  25519. 0x0154,
  25520. "Rcaron",
  25521. 0x0158,
  25522. "Rcedilla",
  25523. 0x0156,
  25524. "Rcircle",
  25525. 0x24c7,
  25526. "Rcommaaccent",
  25527. 0x0156,
  25528. "Rdblgrave",
  25529. 0x0210,
  25530. "Rdotaccent",
  25531. 0x1e58,
  25532. "Rdotbelow",
  25533. 0x1e5a,
  25534. "Rdotbelowmacron",
  25535. 0x1e5c,
  25536. "Reharmenian",
  25537. 0x0550,
  25538. "Rfraktur",
  25539. 0x211c,
  25540. "Rho",
  25541. 0x03a1,
  25542. "Ringsmall",
  25543. 0xf6fc,
  25544. "Rinvertedbreve",
  25545. 0x0212,
  25546. "Rlinebelow",
  25547. 0x1e5e,
  25548. "Rmonospace",
  25549. 0xff32,
  25550. "Rsmall",
  25551. 0xf772,
  25552. "Rsmallinverted",
  25553. 0x0281,
  25554. "Rsmallinvertedsuperior",
  25555. 0x02b6,
  25556. "S",
  25557. 0x0053,
  25558. "SF010000",
  25559. 0x250c,
  25560. "SF020000",
  25561. 0x2514,
  25562. "SF030000",
  25563. 0x2510,
  25564. "SF040000",
  25565. 0x2518,
  25566. "SF050000",
  25567. 0x253c,
  25568. "SF060000",
  25569. 0x252c,
  25570. "SF070000",
  25571. 0x2534,
  25572. "SF080000",
  25573. 0x251c,
  25574. "SF090000",
  25575. 0x2524,
  25576. "SF100000",
  25577. 0x2500,
  25578. "SF110000",
  25579. 0x2502,
  25580. "SF190000",
  25581. 0x2561,
  25582. "SF200000",
  25583. 0x2562,
  25584. "SF210000",
  25585. 0x2556,
  25586. "SF220000",
  25587. 0x2555,
  25588. "SF230000",
  25589. 0x2563,
  25590. "SF240000",
  25591. 0x2551,
  25592. "SF250000",
  25593. 0x2557,
  25594. "SF260000",
  25595. 0x255d,
  25596. "SF270000",
  25597. 0x255c,
  25598. "SF280000",
  25599. 0x255b,
  25600. "SF360000",
  25601. 0x255e,
  25602. "SF370000",
  25603. 0x255f,
  25604. "SF380000",
  25605. 0x255a,
  25606. "SF390000",
  25607. 0x2554,
  25608. "SF400000",
  25609. 0x2569,
  25610. "SF410000",
  25611. 0x2566,
  25612. "SF420000",
  25613. 0x2560,
  25614. "SF430000",
  25615. 0x2550,
  25616. "SF440000",
  25617. 0x256c,
  25618. "SF450000",
  25619. 0x2567,
  25620. "SF460000",
  25621. 0x2568,
  25622. "SF470000",
  25623. 0x2564,
  25624. "SF480000",
  25625. 0x2565,
  25626. "SF490000",
  25627. 0x2559,
  25628. "SF500000",
  25629. 0x2558,
  25630. "SF510000",
  25631. 0x2552,
  25632. "SF520000",
  25633. 0x2553,
  25634. "SF530000",
  25635. 0x256b,
  25636. "SF540000",
  25637. 0x256a,
  25638. "Sacute",
  25639. 0x015a,
  25640. "Sacutedotaccent",
  25641. 0x1e64,
  25642. "Sampigreek",
  25643. 0x03e0,
  25644. "Scaron",
  25645. 0x0160,
  25646. "Scarondotaccent",
  25647. 0x1e66,
  25648. "Scaronsmall",
  25649. 0xf6fd,
  25650. "Scedilla",
  25651. 0x015e,
  25652. "Schwa",
  25653. 0x018f,
  25654. "Schwacyrillic",
  25655. 0x04d8,
  25656. "Schwadieresiscyrillic",
  25657. 0x04da,
  25658. "Scircle",
  25659. 0x24c8,
  25660. "Scircumflex",
  25661. 0x015c,
  25662. "Scommaaccent",
  25663. 0x0218,
  25664. "Sdotaccent",
  25665. 0x1e60,
  25666. "Sdotbelow",
  25667. 0x1e62,
  25668. "Sdotbelowdotaccent",
  25669. 0x1e68,
  25670. "Seharmenian",
  25671. 0x054d,
  25672. "Sevenroman",
  25673. 0x2166,
  25674. "Shaarmenian",
  25675. 0x0547,
  25676. "Shacyrillic",
  25677. 0x0428,
  25678. "Shchacyrillic",
  25679. 0x0429,
  25680. "Sheicoptic",
  25681. 0x03e2,
  25682. "Shhacyrillic",
  25683. 0x04ba,
  25684. "Shimacoptic",
  25685. 0x03ec,
  25686. "Sigma",
  25687. 0x03a3,
  25688. "Sixroman",
  25689. 0x2165,
  25690. "Smonospace",
  25691. 0xff33,
  25692. "Softsigncyrillic",
  25693. 0x042c,
  25694. "Ssmall",
  25695. 0xf773,
  25696. "Stigmagreek",
  25697. 0x03da,
  25698. "T",
  25699. 0x0054,
  25700. "Tau",
  25701. 0x03a4,
  25702. "Tbar",
  25703. 0x0166,
  25704. "Tcaron",
  25705. 0x0164,
  25706. "Tcedilla",
  25707. 0x0162,
  25708. "Tcircle",
  25709. 0x24c9,
  25710. "Tcircumflexbelow",
  25711. 0x1e70,
  25712. "Tcommaaccent",
  25713. 0x0162,
  25714. "Tdotaccent",
  25715. 0x1e6a,
  25716. "Tdotbelow",
  25717. 0x1e6c,
  25718. "Tecyrillic",
  25719. 0x0422,
  25720. "Tedescendercyrillic",
  25721. 0x04ac,
  25722. "Tenroman",
  25723. 0x2169,
  25724. "Tetsecyrillic",
  25725. 0x04b4,
  25726. "Theta",
  25727. 0x0398,
  25728. "Thook",
  25729. 0x01ac,
  25730. "Thorn",
  25731. 0x00de,
  25732. "Thornsmall",
  25733. 0xf7fe,
  25734. "Threeroman",
  25735. 0x2162,
  25736. "Tildesmall",
  25737. 0xf6fe,
  25738. "Tiwnarmenian",
  25739. 0x054f,
  25740. "Tlinebelow",
  25741. 0x1e6e,
  25742. "Tmonospace",
  25743. 0xff34,
  25744. "Toarmenian",
  25745. 0x0539,
  25746. "Tonefive",
  25747. 0x01bc,
  25748. "Tonesix",
  25749. 0x0184,
  25750. "Tonetwo",
  25751. 0x01a7,
  25752. "Tretroflexhook",
  25753. 0x01ae,
  25754. "Tsecyrillic",
  25755. 0x0426,
  25756. "Tshecyrillic",
  25757. 0x040b,
  25758. "Tsmall",
  25759. 0xf774,
  25760. "Twelveroman",
  25761. 0x216b,
  25762. "Tworoman",
  25763. 0x2161,
  25764. "U",
  25765. 0x0055,
  25766. "Uacute",
  25767. 0x00da,
  25768. "Uacutesmall",
  25769. 0xf7fa,
  25770. "Ubreve",
  25771. 0x016c,
  25772. "Ucaron",
  25773. 0x01d3,
  25774. "Ucircle",
  25775. 0x24ca,
  25776. "Ucircumflex",
  25777. 0x00db,
  25778. "Ucircumflexbelow",
  25779. 0x1e76,
  25780. "Ucircumflexsmall",
  25781. 0xf7fb,
  25782. "Ucyrillic",
  25783. 0x0423,
  25784. "Udblacute",
  25785. 0x0170,
  25786. "Udblgrave",
  25787. 0x0214,
  25788. "Udieresis",
  25789. 0x00dc,
  25790. "Udieresisacute",
  25791. 0x01d7,
  25792. "Udieresisbelow",
  25793. 0x1e72,
  25794. "Udieresiscaron",
  25795. 0x01d9,
  25796. "Udieresiscyrillic",
  25797. 0x04f0,
  25798. "Udieresisgrave",
  25799. 0x01db,
  25800. "Udieresismacron",
  25801. 0x01d5,
  25802. "Udieresissmall",
  25803. 0xf7fc,
  25804. "Udotbelow",
  25805. 0x1ee4,
  25806. "Ugrave",
  25807. 0x00d9,
  25808. "Ugravesmall",
  25809. 0xf7f9,
  25810. "Uhookabove",
  25811. 0x1ee6,
  25812. "Uhorn",
  25813. 0x01af,
  25814. "Uhornacute",
  25815. 0x1ee8,
  25816. "Uhorndotbelow",
  25817. 0x1ef0,
  25818. "Uhorngrave",
  25819. 0x1eea,
  25820. "Uhornhookabove",
  25821. 0x1eec,
  25822. "Uhorntilde",
  25823. 0x1eee,
  25824. "Uhungarumlaut",
  25825. 0x0170,
  25826. "Uhungarumlautcyrillic",
  25827. 0x04f2,
  25828. "Uinvertedbreve",
  25829. 0x0216,
  25830. "Ukcyrillic",
  25831. 0x0478,
  25832. "Umacron",
  25833. 0x016a,
  25834. "Umacroncyrillic",
  25835. 0x04ee,
  25836. "Umacrondieresis",
  25837. 0x1e7a,
  25838. "Umonospace",
  25839. 0xff35,
  25840. "Uogonek",
  25841. 0x0172,
  25842. "Upsilon",
  25843. 0x03a5,
  25844. "Upsilon1",
  25845. 0x03d2,
  25846. "Upsilonacutehooksymbolgreek",
  25847. 0x03d3,
  25848. "Upsilonafrican",
  25849. 0x01b1,
  25850. "Upsilondieresis",
  25851. 0x03ab,
  25852. "Upsilondieresishooksymbolgreek",
  25853. 0x03d4,
  25854. "Upsilonhooksymbol",
  25855. 0x03d2,
  25856. "Upsilontonos",
  25857. 0x038e,
  25858. "Uring",
  25859. 0x016e,
  25860. "Ushortcyrillic",
  25861. 0x040e,
  25862. "Usmall",
  25863. 0xf775,
  25864. "Ustraightcyrillic",
  25865. 0x04ae,
  25866. "Ustraightstrokecyrillic",
  25867. 0x04b0,
  25868. "Utilde",
  25869. 0x0168,
  25870. "Utildeacute",
  25871. 0x1e78,
  25872. "Utildebelow",
  25873. 0x1e74,
  25874. "V",
  25875. 0x0056,
  25876. "Vcircle",
  25877. 0x24cb,
  25878. "Vdotbelow",
  25879. 0x1e7e,
  25880. "Vecyrillic",
  25881. 0x0412,
  25882. "Vewarmenian",
  25883. 0x054e,
  25884. "Vhook",
  25885. 0x01b2,
  25886. "Vmonospace",
  25887. 0xff36,
  25888. "Voarmenian",
  25889. 0x0548,
  25890. "Vsmall",
  25891. 0xf776,
  25892. "Vtilde",
  25893. 0x1e7c,
  25894. "W",
  25895. 0x0057,
  25896. "Wacute",
  25897. 0x1e82,
  25898. "Wcircle",
  25899. 0x24cc,
  25900. "Wcircumflex",
  25901. 0x0174,
  25902. "Wdieresis",
  25903. 0x1e84,
  25904. "Wdotaccent",
  25905. 0x1e86,
  25906. "Wdotbelow",
  25907. 0x1e88,
  25908. "Wgrave",
  25909. 0x1e80,
  25910. "Wmonospace",
  25911. 0xff37,
  25912. "Wsmall",
  25913. 0xf777,
  25914. "X",
  25915. 0x0058,
  25916. "Xcircle",
  25917. 0x24cd,
  25918. "Xdieresis",
  25919. 0x1e8c,
  25920. "Xdotaccent",
  25921. 0x1e8a,
  25922. "Xeharmenian",
  25923. 0x053d,
  25924. "Xi",
  25925. 0x039e,
  25926. "Xmonospace",
  25927. 0xff38,
  25928. "Xsmall",
  25929. 0xf778,
  25930. "Y",
  25931. 0x0059,
  25932. "Yacute",
  25933. 0x00dd,
  25934. "Yacutesmall",
  25935. 0xf7fd,
  25936. "Yatcyrillic",
  25937. 0x0462,
  25938. "Ycircle",
  25939. 0x24ce,
  25940. "Ycircumflex",
  25941. 0x0176,
  25942. "Ydieresis",
  25943. 0x0178,
  25944. "Ydieresissmall",
  25945. 0xf7ff,
  25946. "Ydotaccent",
  25947. 0x1e8e,
  25948. "Ydotbelow",
  25949. 0x1ef4,
  25950. "Yericyrillic",
  25951. 0x042b,
  25952. "Yerudieresiscyrillic",
  25953. 0x04f8,
  25954. "Ygrave",
  25955. 0x1ef2,
  25956. "Yhook",
  25957. 0x01b3,
  25958. "Yhookabove",
  25959. 0x1ef6,
  25960. "Yiarmenian",
  25961. 0x0545,
  25962. "Yicyrillic",
  25963. 0x0407,
  25964. "Yiwnarmenian",
  25965. 0x0552,
  25966. "Ymonospace",
  25967. 0xff39,
  25968. "Ysmall",
  25969. 0xf779,
  25970. "Ytilde",
  25971. 0x1ef8,
  25972. "Yusbigcyrillic",
  25973. 0x046a,
  25974. "Yusbigiotifiedcyrillic",
  25975. 0x046c,
  25976. "Yuslittlecyrillic",
  25977. 0x0466,
  25978. "Yuslittleiotifiedcyrillic",
  25979. 0x0468,
  25980. "Z",
  25981. 0x005a,
  25982. "Zaarmenian",
  25983. 0x0536,
  25984. "Zacute",
  25985. 0x0179,
  25986. "Zcaron",
  25987. 0x017d,
  25988. "Zcaronsmall",
  25989. 0xf6ff,
  25990. "Zcircle",
  25991. 0x24cf,
  25992. "Zcircumflex",
  25993. 0x1e90,
  25994. "Zdot",
  25995. 0x017b,
  25996. "Zdotaccent",
  25997. 0x017b,
  25998. "Zdotbelow",
  25999. 0x1e92,
  26000. "Zecyrillic",
  26001. 0x0417,
  26002. "Zedescendercyrillic",
  26003. 0x0498,
  26004. "Zedieresiscyrillic",
  26005. 0x04de,
  26006. "Zeta",
  26007. 0x0396,
  26008. "Zhearmenian",
  26009. 0x053a,
  26010. "Zhebrevecyrillic",
  26011. 0x04c1,
  26012. "Zhecyrillic",
  26013. 0x0416,
  26014. "Zhedescendercyrillic",
  26015. 0x0496,
  26016. "Zhedieresiscyrillic",
  26017. 0x04dc,
  26018. "Zlinebelow",
  26019. 0x1e94,
  26020. "Zmonospace",
  26021. 0xff3a,
  26022. "Zsmall",
  26023. 0xf77a,
  26024. "Zstroke",
  26025. 0x01b5,
  26026. "a",
  26027. 0x0061,
  26028. "aabengali",
  26029. 0x0986,
  26030. "aacute",
  26031. 0x00e1,
  26032. "aadeva",
  26033. 0x0906,
  26034. "aagujarati",
  26035. 0x0a86,
  26036. "aagurmukhi",
  26037. 0x0a06,
  26038. "aamatragurmukhi",
  26039. 0x0a3e,
  26040. "aarusquare",
  26041. 0x3303,
  26042. "aavowelsignbengali",
  26043. 0x09be,
  26044. "aavowelsigndeva",
  26045. 0x093e,
  26046. "aavowelsigngujarati",
  26047. 0x0abe,
  26048. "abbreviationmarkarmenian",
  26049. 0x055f,
  26050. "abbreviationsigndeva",
  26051. 0x0970,
  26052. "abengali",
  26053. 0x0985,
  26054. "abopomofo",
  26055. 0x311a,
  26056. "abreve",
  26057. 0x0103,
  26058. "abreveacute",
  26059. 0x1eaf,
  26060. "abrevecyrillic",
  26061. 0x04d1,
  26062. "abrevedotbelow",
  26063. 0x1eb7,
  26064. "abrevegrave",
  26065. 0x1eb1,
  26066. "abrevehookabove",
  26067. 0x1eb3,
  26068. "abrevetilde",
  26069. 0x1eb5,
  26070. "acaron",
  26071. 0x01ce,
  26072. "acircle",
  26073. 0x24d0,
  26074. "acircumflex",
  26075. 0x00e2,
  26076. "acircumflexacute",
  26077. 0x1ea5,
  26078. "acircumflexdotbelow",
  26079. 0x1ead,
  26080. "acircumflexgrave",
  26081. 0x1ea7,
  26082. "acircumflexhookabove",
  26083. 0x1ea9,
  26084. "acircumflextilde",
  26085. 0x1eab,
  26086. "acute",
  26087. 0x00b4,
  26088. "acutebelowcmb",
  26089. 0x0317,
  26090. "acutecmb",
  26091. 0x0301,
  26092. "acutecomb",
  26093. 0x0301,
  26094. "acutedeva",
  26095. 0x0954,
  26096. "acutelowmod",
  26097. 0x02cf,
  26098. "acutetonecmb",
  26099. 0x0341,
  26100. "acyrillic",
  26101. 0x0430,
  26102. "adblgrave",
  26103. 0x0201,
  26104. "addakgurmukhi",
  26105. 0x0a71,
  26106. "adeva",
  26107. 0x0905,
  26108. "adieresis",
  26109. 0x00e4,
  26110. "adieresiscyrillic",
  26111. 0x04d3,
  26112. "adieresismacron",
  26113. 0x01df,
  26114. "adotbelow",
  26115. 0x1ea1,
  26116. "adotmacron",
  26117. 0x01e1,
  26118. "ae",
  26119. 0x00e6,
  26120. "aeacute",
  26121. 0x01fd,
  26122. "aekorean",
  26123. 0x3150,
  26124. "aemacron",
  26125. 0x01e3,
  26126. "afii00208",
  26127. 0x2015,
  26128. "afii08941",
  26129. 0x20a4,
  26130. "afii10017",
  26131. 0x0410,
  26132. "afii10018",
  26133. 0x0411,
  26134. "afii10019",
  26135. 0x0412,
  26136. "afii10020",
  26137. 0x0413,
  26138. "afii10021",
  26139. 0x0414,
  26140. "afii10022",
  26141. 0x0415,
  26142. "afii10023",
  26143. 0x0401,
  26144. "afii10024",
  26145. 0x0416,
  26146. "afii10025",
  26147. 0x0417,
  26148. "afii10026",
  26149. 0x0418,
  26150. "afii10027",
  26151. 0x0419,
  26152. "afii10028",
  26153. 0x041a,
  26154. "afii10029",
  26155. 0x041b,
  26156. "afii10030",
  26157. 0x041c,
  26158. "afii10031",
  26159. 0x041d,
  26160. "afii10032",
  26161. 0x041e,
  26162. "afii10033",
  26163. 0x041f,
  26164. "afii10034",
  26165. 0x0420,
  26166. "afii10035",
  26167. 0x0421,
  26168. "afii10036",
  26169. 0x0422,
  26170. "afii10037",
  26171. 0x0423,
  26172. "afii10038",
  26173. 0x0424,
  26174. "afii10039",
  26175. 0x0425,
  26176. "afii10040",
  26177. 0x0426,
  26178. "afii10041",
  26179. 0x0427,
  26180. "afii10042",
  26181. 0x0428,
  26182. "afii10043",
  26183. 0x0429,
  26184. "afii10044",
  26185. 0x042a,
  26186. "afii10045",
  26187. 0x042b,
  26188. "afii10046",
  26189. 0x042c,
  26190. "afii10047",
  26191. 0x042d,
  26192. "afii10048",
  26193. 0x042e,
  26194. "afii10049",
  26195. 0x042f,
  26196. "afii10050",
  26197. 0x0490,
  26198. "afii10051",
  26199. 0x0402,
  26200. "afii10052",
  26201. 0x0403,
  26202. "afii10053",
  26203. 0x0404,
  26204. "afii10054",
  26205. 0x0405,
  26206. "afii10055",
  26207. 0x0406,
  26208. "afii10056",
  26209. 0x0407,
  26210. "afii10057",
  26211. 0x0408,
  26212. "afii10058",
  26213. 0x0409,
  26214. "afii10059",
  26215. 0x040a,
  26216. "afii10060",
  26217. 0x040b,
  26218. "afii10061",
  26219. 0x040c,
  26220. "afii10062",
  26221. 0x040e,
  26222. "afii10063",
  26223. 0xf6c4,
  26224. "afii10064",
  26225. 0xf6c5,
  26226. "afii10065",
  26227. 0x0430,
  26228. "afii10066",
  26229. 0x0431,
  26230. "afii10067",
  26231. 0x0432,
  26232. "afii10068",
  26233. 0x0433,
  26234. "afii10069",
  26235. 0x0434,
  26236. "afii10070",
  26237. 0x0435,
  26238. "afii10071",
  26239. 0x0451,
  26240. "afii10072",
  26241. 0x0436,
  26242. "afii10073",
  26243. 0x0437,
  26244. "afii10074",
  26245. 0x0438,
  26246. "afii10075",
  26247. 0x0439,
  26248. "afii10076",
  26249. 0x043a,
  26250. "afii10077",
  26251. 0x043b,
  26252. "afii10078",
  26253. 0x043c,
  26254. "afii10079",
  26255. 0x043d,
  26256. "afii10080",
  26257. 0x043e,
  26258. "afii10081",
  26259. 0x043f,
  26260. "afii10082",
  26261. 0x0440,
  26262. "afii10083",
  26263. 0x0441,
  26264. "afii10084",
  26265. 0x0442,
  26266. "afii10085",
  26267. 0x0443,
  26268. "afii10086",
  26269. 0x0444,
  26270. "afii10087",
  26271. 0x0445,
  26272. "afii10088",
  26273. 0x0446,
  26274. "afii10089",
  26275. 0x0447,
  26276. "afii10090",
  26277. 0x0448,
  26278. "afii10091",
  26279. 0x0449,
  26280. "afii10092",
  26281. 0x044a,
  26282. "afii10093",
  26283. 0x044b,
  26284. "afii10094",
  26285. 0x044c,
  26286. "afii10095",
  26287. 0x044d,
  26288. "afii10096",
  26289. 0x044e,
  26290. "afii10097",
  26291. 0x044f,
  26292. "afii10098",
  26293. 0x0491,
  26294. "afii10099",
  26295. 0x0452,
  26296. "afii10100",
  26297. 0x0453,
  26298. "afii10101",
  26299. 0x0454,
  26300. "afii10102",
  26301. 0x0455,
  26302. "afii10103",
  26303. 0x0456,
  26304. "afii10104",
  26305. 0x0457,
  26306. "afii10105",
  26307. 0x0458,
  26308. "afii10106",
  26309. 0x0459,
  26310. "afii10107",
  26311. 0x045a,
  26312. "afii10108",
  26313. 0x045b,
  26314. "afii10109",
  26315. 0x045c,
  26316. "afii10110",
  26317. 0x045e,
  26318. "afii10145",
  26319. 0x040f,
  26320. "afii10146",
  26321. 0x0462,
  26322. "afii10147",
  26323. 0x0472,
  26324. "afii10148",
  26325. 0x0474,
  26326. "afii10192",
  26327. 0xf6c6,
  26328. "afii10193",
  26329. 0x045f,
  26330. "afii10194",
  26331. 0x0463,
  26332. "afii10195",
  26333. 0x0473,
  26334. "afii10196",
  26335. 0x0475,
  26336. "afii10831",
  26337. 0xf6c7,
  26338. "afii10832",
  26339. 0xf6c8,
  26340. "afii10846",
  26341. 0x04d9,
  26342. "afii299",
  26343. 0x200e,
  26344. "afii300",
  26345. 0x200f,
  26346. "afii301",
  26347. 0x200d,
  26348. "afii57381",
  26349. 0x066a,
  26350. "afii57388",
  26351. 0x060c,
  26352. "afii57392",
  26353. 0x0660,
  26354. "afii57393",
  26355. 0x0661,
  26356. "afii57394",
  26357. 0x0662,
  26358. "afii57395",
  26359. 0x0663,
  26360. "afii57396",
  26361. 0x0664,
  26362. "afii57397",
  26363. 0x0665,
  26364. "afii57398",
  26365. 0x0666,
  26366. "afii57399",
  26367. 0x0667,
  26368. "afii57400",
  26369. 0x0668,
  26370. "afii57401",
  26371. 0x0669,
  26372. "afii57403",
  26373. 0x061b,
  26374. "afii57407",
  26375. 0x061f,
  26376. "afii57409",
  26377. 0x0621,
  26378. "afii57410",
  26379. 0x0622,
  26380. "afii57411",
  26381. 0x0623,
  26382. "afii57412",
  26383. 0x0624,
  26384. "afii57413",
  26385. 0x0625,
  26386. "afii57414",
  26387. 0x0626,
  26388. "afii57415",
  26389. 0x0627,
  26390. "afii57416",
  26391. 0x0628,
  26392. "afii57417",
  26393. 0x0629,
  26394. "afii57418",
  26395. 0x062a,
  26396. "afii57419",
  26397. 0x062b,
  26398. "afii57420",
  26399. 0x062c,
  26400. "afii57421",
  26401. 0x062d,
  26402. "afii57422",
  26403. 0x062e,
  26404. "afii57423",
  26405. 0x062f,
  26406. "afii57424",
  26407. 0x0630,
  26408. "afii57425",
  26409. 0x0631,
  26410. "afii57426",
  26411. 0x0632,
  26412. "afii57427",
  26413. 0x0633,
  26414. "afii57428",
  26415. 0x0634,
  26416. "afii57429",
  26417. 0x0635,
  26418. "afii57430",
  26419. 0x0636,
  26420. "afii57431",
  26421. 0x0637,
  26422. "afii57432",
  26423. 0x0638,
  26424. "afii57433",
  26425. 0x0639,
  26426. "afii57434",
  26427. 0x063a,
  26428. "afii57440",
  26429. 0x0640,
  26430. "afii57441",
  26431. 0x0641,
  26432. "afii57442",
  26433. 0x0642,
  26434. "afii57443",
  26435. 0x0643,
  26436. "afii57444",
  26437. 0x0644,
  26438. "afii57445",
  26439. 0x0645,
  26440. "afii57446",
  26441. 0x0646,
  26442. "afii57448",
  26443. 0x0648,
  26444. "afii57449",
  26445. 0x0649,
  26446. "afii57450",
  26447. 0x064a,
  26448. "afii57451",
  26449. 0x064b,
  26450. "afii57452",
  26451. 0x064c,
  26452. "afii57453",
  26453. 0x064d,
  26454. "afii57454",
  26455. 0x064e,
  26456. "afii57455",
  26457. 0x064f,
  26458. "afii57456",
  26459. 0x0650,
  26460. "afii57457",
  26461. 0x0651,
  26462. "afii57458",
  26463. 0x0652,
  26464. "afii57470",
  26465. 0x0647,
  26466. "afii57505",
  26467. 0x06a4,
  26468. "afii57506",
  26469. 0x067e,
  26470. "afii57507",
  26471. 0x0686,
  26472. "afii57508",
  26473. 0x0698,
  26474. "afii57509",
  26475. 0x06af,
  26476. "afii57511",
  26477. 0x0679,
  26478. "afii57512",
  26479. 0x0688,
  26480. "afii57513",
  26481. 0x0691,
  26482. "afii57514",
  26483. 0x06ba,
  26484. "afii57519",
  26485. 0x06d2,
  26486. "afii57534",
  26487. 0x06d5,
  26488. "afii57636",
  26489. 0x20aa,
  26490. "afii57645",
  26491. 0x05be,
  26492. "afii57658",
  26493. 0x05c3,
  26494. "afii57664",
  26495. 0x05d0,
  26496. "afii57665",
  26497. 0x05d1,
  26498. "afii57666",
  26499. 0x05d2,
  26500. "afii57667",
  26501. 0x05d3,
  26502. "afii57668",
  26503. 0x05d4,
  26504. "afii57669",
  26505. 0x05d5,
  26506. "afii57670",
  26507. 0x05d6,
  26508. "afii57671",
  26509. 0x05d7,
  26510. "afii57672",
  26511. 0x05d8,
  26512. "afii57673",
  26513. 0x05d9,
  26514. "afii57674",
  26515. 0x05da,
  26516. "afii57675",
  26517. 0x05db,
  26518. "afii57676",
  26519. 0x05dc,
  26520. "afii57677",
  26521. 0x05dd,
  26522. "afii57678",
  26523. 0x05de,
  26524. "afii57679",
  26525. 0x05df,
  26526. "afii57680",
  26527. 0x05e0,
  26528. "afii57681",
  26529. 0x05e1,
  26530. "afii57682",
  26531. 0x05e2,
  26532. "afii57683",
  26533. 0x05e3,
  26534. "afii57684",
  26535. 0x05e4,
  26536. "afii57685",
  26537. 0x05e5,
  26538. "afii57686",
  26539. 0x05e6,
  26540. "afii57687",
  26541. 0x05e7,
  26542. "afii57688",
  26543. 0x05e8,
  26544. "afii57689",
  26545. 0x05e9,
  26546. "afii57690",
  26547. 0x05ea,
  26548. "afii57694",
  26549. 0xfb2a,
  26550. "afii57695",
  26551. 0xfb2b,
  26552. "afii57700",
  26553. 0xfb4b,
  26554. "afii57705",
  26555. 0xfb1f,
  26556. "afii57716",
  26557. 0x05f0,
  26558. "afii57717",
  26559. 0x05f1,
  26560. "afii57718",
  26561. 0x05f2,
  26562. "afii57723",
  26563. 0xfb35,
  26564. "afii57793",
  26565. 0x05b4,
  26566. "afii57794",
  26567. 0x05b5,
  26568. "afii57795",
  26569. 0x05b6,
  26570. "afii57796",
  26571. 0x05bb,
  26572. "afii57797",
  26573. 0x05b8,
  26574. "afii57798",
  26575. 0x05b7,
  26576. "afii57799",
  26577. 0x05b0,
  26578. "afii57800",
  26579. 0x05b2,
  26580. "afii57801",
  26581. 0x05b1,
  26582. "afii57802",
  26583. 0x05b3,
  26584. "afii57803",
  26585. 0x05c2,
  26586. "afii57804",
  26587. 0x05c1,
  26588. "afii57806",
  26589. 0x05b9,
  26590. "afii57807",
  26591. 0x05bc,
  26592. "afii57839",
  26593. 0x05bd,
  26594. "afii57841",
  26595. 0x05bf,
  26596. "afii57842",
  26597. 0x05c0,
  26598. "afii57929",
  26599. 0x02bc,
  26600. "afii61248",
  26601. 0x2105,
  26602. "afii61289",
  26603. 0x2113,
  26604. "afii61352",
  26605. 0x2116,
  26606. "afii61573",
  26607. 0x202c,
  26608. "afii61574",
  26609. 0x202d,
  26610. "afii61575",
  26611. 0x202e,
  26612. "afii61664",
  26613. 0x200c,
  26614. "afii63167",
  26615. 0x066d,
  26616. "afii64937",
  26617. 0x02bd,
  26618. "agrave",
  26619. 0x00e0,
  26620. "agujarati",
  26621. 0x0a85,
  26622. "agurmukhi",
  26623. 0x0a05,
  26624. "ahiragana",
  26625. 0x3042,
  26626. "ahookabove",
  26627. 0x1ea3,
  26628. "aibengali",
  26629. 0x0990,
  26630. "aibopomofo",
  26631. 0x311e,
  26632. "aideva",
  26633. 0x0910,
  26634. "aiecyrillic",
  26635. 0x04d5,
  26636. "aigujarati",
  26637. 0x0a90,
  26638. "aigurmukhi",
  26639. 0x0a10,
  26640. "aimatragurmukhi",
  26641. 0x0a48,
  26642. "ainarabic",
  26643. 0x0639,
  26644. "ainfinalarabic",
  26645. 0xfeca,
  26646. "aininitialarabic",
  26647. 0xfecb,
  26648. "ainmedialarabic",
  26649. 0xfecc,
  26650. "ainvertedbreve",
  26651. 0x0203,
  26652. "aivowelsignbengali",
  26653. 0x09c8,
  26654. "aivowelsigndeva",
  26655. 0x0948,
  26656. "aivowelsigngujarati",
  26657. 0x0ac8,
  26658. "akatakana",
  26659. 0x30a2,
  26660. "akatakanahalfwidth",
  26661. 0xff71,
  26662. "akorean",
  26663. 0x314f,
  26664. "alef",
  26665. 0x05d0,
  26666. "alefarabic",
  26667. 0x0627,
  26668. "alefdageshhebrew",
  26669. 0xfb30,
  26670. "aleffinalarabic",
  26671. 0xfe8e,
  26672. "alefhamzaabovearabic",
  26673. 0x0623,
  26674. "alefhamzaabovefinalarabic",
  26675. 0xfe84,
  26676. "alefhamzabelowarabic",
  26677. 0x0625,
  26678. "alefhamzabelowfinalarabic",
  26679. 0xfe88,
  26680. "alefhebrew",
  26681. 0x05d0,
  26682. "aleflamedhebrew",
  26683. 0xfb4f,
  26684. "alefmaddaabovearabic",
  26685. 0x0622,
  26686. "alefmaddaabovefinalarabic",
  26687. 0xfe82,
  26688. "alefmaksuraarabic",
  26689. 0x0649,
  26690. "alefmaksurafinalarabic",
  26691. 0xfef0,
  26692. "alefmaksurainitialarabic",
  26693. 0xfef3,
  26694. "alefmaksuramedialarabic",
  26695. 0xfef4,
  26696. "alefpatahhebrew",
  26697. 0xfb2e,
  26698. "alefqamatshebrew",
  26699. 0xfb2f,
  26700. "aleph",
  26701. 0x2135,
  26702. "allequal",
  26703. 0x224c,
  26704. "alpha",
  26705. 0x03b1,
  26706. "alphatonos",
  26707. 0x03ac,
  26708. "amacron",
  26709. 0x0101,
  26710. "amonospace",
  26711. 0xff41,
  26712. "ampersand",
  26713. 0x0026,
  26714. "ampersandmonospace",
  26715. 0xff06,
  26716. "ampersandsmall",
  26717. 0xf726,
  26718. "amsquare",
  26719. 0x33c2,
  26720. "anbopomofo",
  26721. 0x3122,
  26722. "angbopomofo",
  26723. 0x3124,
  26724. "angbracketleft",
  26725. 0x3008,
  26726. "angbracketright",
  26727. 0x3009,
  26728. "angkhankhuthai",
  26729. 0x0e5a,
  26730. "angle",
  26731. 0x2220,
  26732. "anglebracketleft",
  26733. 0x3008,
  26734. "anglebracketleftvertical",
  26735. 0xfe3f,
  26736. "anglebracketright",
  26737. 0x3009,
  26738. "anglebracketrightvertical",
  26739. 0xfe40,
  26740. "angleleft",
  26741. 0x2329,
  26742. "angleright",
  26743. 0x232a,
  26744. "angstrom",
  26745. 0x212b,
  26746. "anoteleia",
  26747. 0x0387,
  26748. "anudattadeva",
  26749. 0x0952,
  26750. "anusvarabengali",
  26751. 0x0982,
  26752. "anusvaradeva",
  26753. 0x0902,
  26754. "anusvaragujarati",
  26755. 0x0a82,
  26756. "aogonek",
  26757. 0x0105,
  26758. "apaatosquare",
  26759. 0x3300,
  26760. "aparen",
  26761. 0x249c,
  26762. "apostrophearmenian",
  26763. 0x055a,
  26764. "apostrophemod",
  26765. 0x02bc,
  26766. "apple",
  26767. 0xf8ff,
  26768. "approaches",
  26769. 0x2250,
  26770. "approxequal",
  26771. 0x2248,
  26772. "approxequalorimage",
  26773. 0x2252,
  26774. "approximatelyequal",
  26775. 0x2245,
  26776. "araeaekorean",
  26777. 0x318e,
  26778. "araeakorean",
  26779. 0x318d,
  26780. "arc",
  26781. 0x2312,
  26782. "arighthalfring",
  26783. 0x1e9a,
  26784. "aring",
  26785. 0x00e5,
  26786. "aringacute",
  26787. 0x01fb,
  26788. "aringbelow",
  26789. 0x1e01,
  26790. "arrowboth",
  26791. 0x2194,
  26792. "arrowdashdown",
  26793. 0x21e3,
  26794. "arrowdashleft",
  26795. 0x21e0,
  26796. "arrowdashright",
  26797. 0x21e2,
  26798. "arrowdashup",
  26799. 0x21e1,
  26800. "arrowdblboth",
  26801. 0x21d4,
  26802. "arrowdbldown",
  26803. 0x21d3,
  26804. "arrowdblleft",
  26805. 0x21d0,
  26806. "arrowdblright",
  26807. 0x21d2,
  26808. "arrowdblup",
  26809. 0x21d1,
  26810. "arrowdown",
  26811. 0x2193,
  26812. "arrowdownleft",
  26813. 0x2199,
  26814. "arrowdownright",
  26815. 0x2198,
  26816. "arrowdownwhite",
  26817. 0x21e9,
  26818. "arrowheaddownmod",
  26819. 0x02c5,
  26820. "arrowheadleftmod",
  26821. 0x02c2,
  26822. "arrowheadrightmod",
  26823. 0x02c3,
  26824. "arrowheadupmod",
  26825. 0x02c4,
  26826. "arrowhorizex",
  26827. 0xf8e7,
  26828. "arrowleft",
  26829. 0x2190,
  26830. "arrowleftdbl",
  26831. 0x21d0,
  26832. "arrowleftdblstroke",
  26833. 0x21cd,
  26834. "arrowleftoverright",
  26835. 0x21c6,
  26836. "arrowleftwhite",
  26837. 0x21e6,
  26838. "arrowright",
  26839. 0x2192,
  26840. "arrowrightdblstroke",
  26841. 0x21cf,
  26842. "arrowrightheavy",
  26843. 0x279e,
  26844. "arrowrightoverleft",
  26845. 0x21c4,
  26846. "arrowrightwhite",
  26847. 0x21e8,
  26848. "arrowtableft",
  26849. 0x21e4,
  26850. "arrowtabright",
  26851. 0x21e5,
  26852. "arrowup",
  26853. 0x2191,
  26854. "arrowupdn",
  26855. 0x2195,
  26856. "arrowupdnbse",
  26857. 0x21a8,
  26858. "arrowupdownbase",
  26859. 0x21a8,
  26860. "arrowupleft",
  26861. 0x2196,
  26862. "arrowupleftofdown",
  26863. 0x21c5,
  26864. "arrowupright",
  26865. 0x2197,
  26866. "arrowupwhite",
  26867. 0x21e7,
  26868. "arrowvertex",
  26869. 0xf8e6,
  26870. "asciicircum",
  26871. 0x005e,
  26872. "asciicircummonospace",
  26873. 0xff3e,
  26874. "asciitilde",
  26875. 0x007e,
  26876. "asciitildemonospace",
  26877. 0xff5e,
  26878. "ascript",
  26879. 0x0251,
  26880. "ascriptturned",
  26881. 0x0252,
  26882. "asmallhiragana",
  26883. 0x3041,
  26884. "asmallkatakana",
  26885. 0x30a1,
  26886. "asmallkatakanahalfwidth",
  26887. 0xff67,
  26888. "asterisk",
  26889. 0x002a,
  26890. "asteriskaltonearabic",
  26891. 0x066d,
  26892. "asteriskarabic",
  26893. 0x066d,
  26894. "asteriskmath",
  26895. 0x2217,
  26896. "asteriskmonospace",
  26897. 0xff0a,
  26898. "asterisksmall",
  26899. 0xfe61,
  26900. "asterism",
  26901. 0x2042,
  26902. "asuperior",
  26903. 0xf6e9,
  26904. "asymptoticallyequal",
  26905. 0x2243,
  26906. "at",
  26907. 0x0040,
  26908. "atilde",
  26909. 0x00e3,
  26910. "atmonospace",
  26911. 0xff20,
  26912. "atsmall",
  26913. 0xfe6b,
  26914. "aturned",
  26915. 0x0250,
  26916. "aubengali",
  26917. 0x0994,
  26918. "aubopomofo",
  26919. 0x3120,
  26920. "audeva",
  26921. 0x0914,
  26922. "augujarati",
  26923. 0x0a94,
  26924. "augurmukhi",
  26925. 0x0a14,
  26926. "aulengthmarkbengali",
  26927. 0x09d7,
  26928. "aumatragurmukhi",
  26929. 0x0a4c,
  26930. "auvowelsignbengali",
  26931. 0x09cc,
  26932. "auvowelsigndeva",
  26933. 0x094c,
  26934. "auvowelsigngujarati",
  26935. 0x0acc,
  26936. "avagrahadeva",
  26937. 0x093d,
  26938. "aybarmenian",
  26939. 0x0561,
  26940. "ayin",
  26941. 0x05e2,
  26942. "ayinaltonehebrew",
  26943. 0xfb20,
  26944. "ayinhebrew",
  26945. 0x05e2,
  26946. "b",
  26947. 0x0062,
  26948. "babengali",
  26949. 0x09ac,
  26950. "backslash",
  26951. 0x005c,
  26952. "backslashmonospace",
  26953. 0xff3c,
  26954. "badeva",
  26955. 0x092c,
  26956. "bagujarati",
  26957. 0x0aac,
  26958. "bagurmukhi",
  26959. 0x0a2c,
  26960. "bahiragana",
  26961. 0x3070,
  26962. "bahtthai",
  26963. 0x0e3f,
  26964. "bakatakana",
  26965. 0x30d0,
  26966. "bar",
  26967. 0x007c,
  26968. "barmonospace",
  26969. 0xff5c,
  26970. "bbopomofo",
  26971. 0x3105,
  26972. "bcircle",
  26973. 0x24d1,
  26974. "bdotaccent",
  26975. 0x1e03,
  26976. "bdotbelow",
  26977. 0x1e05,
  26978. "beamedsixteenthnotes",
  26979. 0x266c,
  26980. "because",
  26981. 0x2235,
  26982. "becyrillic",
  26983. 0x0431,
  26984. "beharabic",
  26985. 0x0628,
  26986. "behfinalarabic",
  26987. 0xfe90,
  26988. "behinitialarabic",
  26989. 0xfe91,
  26990. "behiragana",
  26991. 0x3079,
  26992. "behmedialarabic",
  26993. 0xfe92,
  26994. "behmeeminitialarabic",
  26995. 0xfc9f,
  26996. "behmeemisolatedarabic",
  26997. 0xfc08,
  26998. "behnoonfinalarabic",
  26999. 0xfc6d,
  27000. "bekatakana",
  27001. 0x30d9,
  27002. "benarmenian",
  27003. 0x0562,
  27004. "bet",
  27005. 0x05d1,
  27006. "beta",
  27007. 0x03b2,
  27008. "betasymbolgreek",
  27009. 0x03d0,
  27010. "betdagesh",
  27011. 0xfb31,
  27012. "betdageshhebrew",
  27013. 0xfb31,
  27014. "bethebrew",
  27015. 0x05d1,
  27016. "betrafehebrew",
  27017. 0xfb4c,
  27018. "bhabengali",
  27019. 0x09ad,
  27020. "bhadeva",
  27021. 0x092d,
  27022. "bhagujarati",
  27023. 0x0aad,
  27024. "bhagurmukhi",
  27025. 0x0a2d,
  27026. "bhook",
  27027. 0x0253,
  27028. "bihiragana",
  27029. 0x3073,
  27030. "bikatakana",
  27031. 0x30d3,
  27032. "bilabialclick",
  27033. 0x0298,
  27034. "bindigurmukhi",
  27035. 0x0a02,
  27036. "birusquare",
  27037. 0x3331,
  27038. "blackcircle",
  27039. 0x25cf,
  27040. "blackdiamond",
  27041. 0x25c6,
  27042. "blackdownpointingtriangle",
  27043. 0x25bc,
  27044. "blackleftpointingpointer",
  27045. 0x25c4,
  27046. "blackleftpointingtriangle",
  27047. 0x25c0,
  27048. "blacklenticularbracketleft",
  27049. 0x3010,
  27050. "blacklenticularbracketleftvertical",
  27051. 0xfe3b,
  27052. "blacklenticularbracketright",
  27053. 0x3011,
  27054. "blacklenticularbracketrightvertical",
  27055. 0xfe3c,
  27056. "blacklowerlefttriangle",
  27057. 0x25e3,
  27058. "blacklowerrighttriangle",
  27059. 0x25e2,
  27060. "blackrectangle",
  27061. 0x25ac,
  27062. "blackrightpointingpointer",
  27063. 0x25ba,
  27064. "blackrightpointingtriangle",
  27065. 0x25b6,
  27066. "blacksmallsquare",
  27067. 0x25aa,
  27068. "blacksmilingface",
  27069. 0x263b,
  27070. "blacksquare",
  27071. 0x25a0,
  27072. "blackstar",
  27073. 0x2605,
  27074. "blackupperlefttriangle",
  27075. 0x25e4,
  27076. "blackupperrighttriangle",
  27077. 0x25e5,
  27078. "blackuppointingsmalltriangle",
  27079. 0x25b4,
  27080. "blackuppointingtriangle",
  27081. 0x25b2,
  27082. "blank",
  27083. 0x2423,
  27084. "blinebelow",
  27085. 0x1e07,
  27086. "block",
  27087. 0x2588,
  27088. "bmonospace",
  27089. 0xff42,
  27090. "bobaimaithai",
  27091. 0x0e1a,
  27092. "bohiragana",
  27093. 0x307c,
  27094. "bokatakana",
  27095. 0x30dc,
  27096. "bparen",
  27097. 0x249d,
  27098. "bqsquare",
  27099. 0x33c3,
  27100. "braceex",
  27101. 0xf8f4,
  27102. "braceleft",
  27103. 0x007b,
  27104. "braceleftbt",
  27105. 0xf8f3,
  27106. "braceleftmid",
  27107. 0xf8f2,
  27108. "braceleftmonospace",
  27109. 0xff5b,
  27110. "braceleftsmall",
  27111. 0xfe5b,
  27112. "bracelefttp",
  27113. 0xf8f1,
  27114. "braceleftvertical",
  27115. 0xfe37,
  27116. "braceright",
  27117. 0x007d,
  27118. "bracerightbt",
  27119. 0xf8fe,
  27120. "bracerightmid",
  27121. 0xf8fd,
  27122. "bracerightmonospace",
  27123. 0xff5d,
  27124. "bracerightsmall",
  27125. 0xfe5c,
  27126. "bracerighttp",
  27127. 0xf8fc,
  27128. "bracerightvertical",
  27129. 0xfe38,
  27130. "bracketleft",
  27131. 0x005b,
  27132. "bracketleftbt",
  27133. 0xf8f0,
  27134. "bracketleftex",
  27135. 0xf8ef,
  27136. "bracketleftmonospace",
  27137. 0xff3b,
  27138. "bracketlefttp",
  27139. 0xf8ee,
  27140. "bracketright",
  27141. 0x005d,
  27142. "bracketrightbt",
  27143. 0xf8fb,
  27144. "bracketrightex",
  27145. 0xf8fa,
  27146. "bracketrightmonospace",
  27147. 0xff3d,
  27148. "bracketrighttp",
  27149. 0xf8f9,
  27150. "breve",
  27151. 0x02d8,
  27152. "brevebelowcmb",
  27153. 0x032e,
  27154. "brevecmb",
  27155. 0x0306,
  27156. "breveinvertedbelowcmb",
  27157. 0x032f,
  27158. "breveinvertedcmb",
  27159. 0x0311,
  27160. "breveinverteddoublecmb",
  27161. 0x0361,
  27162. "bridgebelowcmb",
  27163. 0x032a,
  27164. "bridgeinvertedbelowcmb",
  27165. 0x033a,
  27166. "brokenbar",
  27167. 0x00a6,
  27168. "bstroke",
  27169. 0x0180,
  27170. "bsuperior",
  27171. 0xf6ea,
  27172. "btopbar",
  27173. 0x0183,
  27174. "buhiragana",
  27175. 0x3076,
  27176. "bukatakana",
  27177. 0x30d6,
  27178. "bullet",
  27179. 0x2022,
  27180. "bulletinverse",
  27181. 0x25d8,
  27182. "bulletoperator",
  27183. 0x2219,
  27184. "bullseye",
  27185. 0x25ce,
  27186. "c",
  27187. 0x0063,
  27188. "caarmenian",
  27189. 0x056e,
  27190. "cabengali",
  27191. 0x099a,
  27192. "cacute",
  27193. 0x0107,
  27194. "cadeva",
  27195. 0x091a,
  27196. "cagujarati",
  27197. 0x0a9a,
  27198. "cagurmukhi",
  27199. 0x0a1a,
  27200. "calsquare",
  27201. 0x3388,
  27202. "candrabindubengali",
  27203. 0x0981,
  27204. "candrabinducmb",
  27205. 0x0310,
  27206. "candrabindudeva",
  27207. 0x0901,
  27208. "candrabindugujarati",
  27209. 0x0a81,
  27210. "capslock",
  27211. 0x21ea,
  27212. "careof",
  27213. 0x2105,
  27214. "caron",
  27215. 0x02c7,
  27216. "caronbelowcmb",
  27217. 0x032c,
  27218. "caroncmb",
  27219. 0x030c,
  27220. "carriagereturn",
  27221. 0x21b5,
  27222. "cbopomofo",
  27223. 0x3118,
  27224. "ccaron",
  27225. 0x010d,
  27226. "ccedilla",
  27227. 0x00e7,
  27228. "ccedillaacute",
  27229. 0x1e09,
  27230. "ccircle",
  27231. 0x24d2,
  27232. "ccircumflex",
  27233. 0x0109,
  27234. "ccurl",
  27235. 0x0255,
  27236. "cdot",
  27237. 0x010b,
  27238. "cdotaccent",
  27239. 0x010b,
  27240. "cdsquare",
  27241. 0x33c5,
  27242. "cedilla",
  27243. 0x00b8,
  27244. "cedillacmb",
  27245. 0x0327,
  27246. "cent",
  27247. 0x00a2,
  27248. "centigrade",
  27249. 0x2103,
  27250. "centinferior",
  27251. 0xf6df,
  27252. "centmonospace",
  27253. 0xffe0,
  27254. "centoldstyle",
  27255. 0xf7a2,
  27256. "centsuperior",
  27257. 0xf6e0,
  27258. "chaarmenian",
  27259. 0x0579,
  27260. "chabengali",
  27261. 0x099b,
  27262. "chadeva",
  27263. 0x091b,
  27264. "chagujarati",
  27265. 0x0a9b,
  27266. "chagurmukhi",
  27267. 0x0a1b,
  27268. "chbopomofo",
  27269. 0x3114,
  27270. "cheabkhasiancyrillic",
  27271. 0x04bd,
  27272. "checkmark",
  27273. 0x2713,
  27274. "checyrillic",
  27275. 0x0447,
  27276. "chedescenderabkhasiancyrillic",
  27277. 0x04bf,
  27278. "chedescendercyrillic",
  27279. 0x04b7,
  27280. "chedieresiscyrillic",
  27281. 0x04f5,
  27282. "cheharmenian",
  27283. 0x0573,
  27284. "chekhakassiancyrillic",
  27285. 0x04cc,
  27286. "cheverticalstrokecyrillic",
  27287. 0x04b9,
  27288. "chi",
  27289. 0x03c7,
  27290. "chieuchacirclekorean",
  27291. 0x3277,
  27292. "chieuchaparenkorean",
  27293. 0x3217,
  27294. "chieuchcirclekorean",
  27295. 0x3269,
  27296. "chieuchkorean",
  27297. 0x314a,
  27298. "chieuchparenkorean",
  27299. 0x3209,
  27300. "chochangthai",
  27301. 0x0e0a,
  27302. "chochanthai",
  27303. 0x0e08,
  27304. "chochingthai",
  27305. 0x0e09,
  27306. "chochoethai",
  27307. 0x0e0c,
  27308. "chook",
  27309. 0x0188,
  27310. "cieucacirclekorean",
  27311. 0x3276,
  27312. "cieucaparenkorean",
  27313. 0x3216,
  27314. "cieuccirclekorean",
  27315. 0x3268,
  27316. "cieuckorean",
  27317. 0x3148,
  27318. "cieucparenkorean",
  27319. 0x3208,
  27320. "cieucuparenkorean",
  27321. 0x321c,
  27322. "circle",
  27323. 0x25cb,
  27324. "circlecopyrt",
  27325. 0x00a9,
  27326. "circlemultiply",
  27327. 0x2297,
  27328. "circleot",
  27329. 0x2299,
  27330. "circleplus",
  27331. 0x2295,
  27332. "circlepostalmark",
  27333. 0x3036,
  27334. "circlewithlefthalfblack",
  27335. 0x25d0,
  27336. "circlewithrighthalfblack",
  27337. 0x25d1,
  27338. "circumflex",
  27339. 0x02c6,
  27340. "circumflexbelowcmb",
  27341. 0x032d,
  27342. "circumflexcmb",
  27343. 0x0302,
  27344. "clear",
  27345. 0x2327,
  27346. "clickalveolar",
  27347. 0x01c2,
  27348. "clickdental",
  27349. 0x01c0,
  27350. "clicklateral",
  27351. 0x01c1,
  27352. "clickretroflex",
  27353. 0x01c3,
  27354. "club",
  27355. 0x2663,
  27356. "clubsuitblack",
  27357. 0x2663,
  27358. "clubsuitwhite",
  27359. 0x2667,
  27360. "cmcubedsquare",
  27361. 0x33a4,
  27362. "cmonospace",
  27363. 0xff43,
  27364. "cmsquaredsquare",
  27365. 0x33a0,
  27366. "coarmenian",
  27367. 0x0581,
  27368. "colon",
  27369. 0x003a,
  27370. "colonmonetary",
  27371. 0x20a1,
  27372. "colonmonospace",
  27373. 0xff1a,
  27374. "colonsign",
  27375. 0x20a1,
  27376. "colonsmall",
  27377. 0xfe55,
  27378. "colontriangularhalfmod",
  27379. 0x02d1,
  27380. "colontriangularmod",
  27381. 0x02d0,
  27382. "comma",
  27383. 0x002c,
  27384. "commaabovecmb",
  27385. 0x0313,
  27386. "commaaboverightcmb",
  27387. 0x0315,
  27388. "commaaccent",
  27389. 0xf6c3,
  27390. "commaarabic",
  27391. 0x060c,
  27392. "commaarmenian",
  27393. 0x055d,
  27394. "commainferior",
  27395. 0xf6e1,
  27396. "commamonospace",
  27397. 0xff0c,
  27398. "commareversedabovecmb",
  27399. 0x0314,
  27400. "commareversedmod",
  27401. 0x02bd,
  27402. "commasmall",
  27403. 0xfe50,
  27404. "commasuperior",
  27405. 0xf6e2,
  27406. "commaturnedabovecmb",
  27407. 0x0312,
  27408. "commaturnedmod",
  27409. 0x02bb,
  27410. "compass",
  27411. 0x263c,
  27412. "congruent",
  27413. 0x2245,
  27414. "contourintegral",
  27415. 0x222e,
  27416. "control",
  27417. 0x2303,
  27418. "controlACK",
  27419. 0x0006,
  27420. "controlBEL",
  27421. 0x0007,
  27422. "controlBS",
  27423. 0x0008,
  27424. "controlCAN",
  27425. 0x0018,
  27426. "controlCR",
  27427. 0x000d,
  27428. "controlDC1",
  27429. 0x0011,
  27430. "controlDC2",
  27431. 0x0012,
  27432. "controlDC3",
  27433. 0x0013,
  27434. "controlDC4",
  27435. 0x0014,
  27436. "controlDEL",
  27437. 0x007f,
  27438. "controlDLE",
  27439. 0x0010,
  27440. "controlEM",
  27441. 0x0019,
  27442. "controlENQ",
  27443. 0x0005,
  27444. "controlEOT",
  27445. 0x0004,
  27446. "controlESC",
  27447. 0x001b,
  27448. "controlETB",
  27449. 0x0017,
  27450. "controlETX",
  27451. 0x0003,
  27452. "controlFF",
  27453. 0x000c,
  27454. "controlFS",
  27455. 0x001c,
  27456. "controlGS",
  27457. 0x001d,
  27458. "controlHT",
  27459. 0x0009,
  27460. "controlLF",
  27461. 0x000a,
  27462. "controlNAK",
  27463. 0x0015,
  27464. "controlNULL",
  27465. 0x0000,
  27466. "controlRS",
  27467. 0x001e,
  27468. "controlSI",
  27469. 0x000f,
  27470. "controlSO",
  27471. 0x000e,
  27472. "controlSOT",
  27473. 0x0002,
  27474. "controlSTX",
  27475. 0x0001,
  27476. "controlSUB",
  27477. 0x001a,
  27478. "controlSYN",
  27479. 0x0016,
  27480. "controlUS",
  27481. 0x001f,
  27482. "controlVT",
  27483. 0x000b,
  27484. "copyright",
  27485. 0x00a9,
  27486. "copyrightsans",
  27487. 0xf8e9,
  27488. "copyrightserif",
  27489. 0xf6d9,
  27490. "cornerbracketleft",
  27491. 0x300c,
  27492. "cornerbracketlefthalfwidth",
  27493. 0xff62,
  27494. "cornerbracketleftvertical",
  27495. 0xfe41,
  27496. "cornerbracketright",
  27497. 0x300d,
  27498. "cornerbracketrighthalfwidth",
  27499. 0xff63,
  27500. "cornerbracketrightvertical",
  27501. 0xfe42,
  27502. "corporationsquare",
  27503. 0x337f,
  27504. "cosquare",
  27505. 0x33c7,
  27506. "coverkgsquare",
  27507. 0x33c6,
  27508. "cparen",
  27509. 0x249e,
  27510. "cruzeiro",
  27511. 0x20a2,
  27512. "cstretched",
  27513. 0x0297,
  27514. "curlyand",
  27515. 0x22cf,
  27516. "curlyor",
  27517. 0x22ce,
  27518. "currency",
  27519. 0x00a4,
  27520. "cyrBreve",
  27521. 0xf6d1,
  27522. "cyrFlex",
  27523. 0xf6d2,
  27524. "cyrbreve",
  27525. 0xf6d4,
  27526. "cyrflex",
  27527. 0xf6d5,
  27528. "d",
  27529. 0x0064,
  27530. "daarmenian",
  27531. 0x0564,
  27532. "dabengali",
  27533. 0x09a6,
  27534. "dadarabic",
  27535. 0x0636,
  27536. "dadeva",
  27537. 0x0926,
  27538. "dadfinalarabic",
  27539. 0xfebe,
  27540. "dadinitialarabic",
  27541. 0xfebf,
  27542. "dadmedialarabic",
  27543. 0xfec0,
  27544. "dagesh",
  27545. 0x05bc,
  27546. "dageshhebrew",
  27547. 0x05bc,
  27548. "dagger",
  27549. 0x2020,
  27550. "daggerdbl",
  27551. 0x2021,
  27552. "dagujarati",
  27553. 0x0aa6,
  27554. "dagurmukhi",
  27555. 0x0a26,
  27556. "dahiragana",
  27557. 0x3060,
  27558. "dakatakana",
  27559. 0x30c0,
  27560. "dalarabic",
  27561. 0x062f,
  27562. "dalet",
  27563. 0x05d3,
  27564. "daletdagesh",
  27565. 0xfb33,
  27566. "daletdageshhebrew",
  27567. 0xfb33,
  27568. "dalethebrew",
  27569. 0x05d3,
  27570. "dalfinalarabic",
  27571. 0xfeaa,
  27572. "dammaarabic",
  27573. 0x064f,
  27574. "dammalowarabic",
  27575. 0x064f,
  27576. "dammatanaltonearabic",
  27577. 0x064c,
  27578. "dammatanarabic",
  27579. 0x064c,
  27580. "danda",
  27581. 0x0964,
  27582. "dargahebrew",
  27583. 0x05a7,
  27584. "dargalefthebrew",
  27585. 0x05a7,
  27586. "dasiapneumatacyrilliccmb",
  27587. 0x0485,
  27588. "dblGrave",
  27589. 0xf6d3,
  27590. "dblanglebracketleft",
  27591. 0x300a,
  27592. "dblanglebracketleftvertical",
  27593. 0xfe3d,
  27594. "dblanglebracketright",
  27595. 0x300b,
  27596. "dblanglebracketrightvertical",
  27597. 0xfe3e,
  27598. "dblarchinvertedbelowcmb",
  27599. 0x032b,
  27600. "dblarrowleft",
  27601. 0x21d4,
  27602. "dblarrowright",
  27603. 0x21d2,
  27604. "dbldanda",
  27605. 0x0965,
  27606. "dblgrave",
  27607. 0xf6d6,
  27608. "dblgravecmb",
  27609. 0x030f,
  27610. "dblintegral",
  27611. 0x222c,
  27612. "dbllowline",
  27613. 0x2017,
  27614. "dbllowlinecmb",
  27615. 0x0333,
  27616. "dbloverlinecmb",
  27617. 0x033f,
  27618. "dblprimemod",
  27619. 0x02ba,
  27620. "dblverticalbar",
  27621. 0x2016,
  27622. "dblverticallineabovecmb",
  27623. 0x030e,
  27624. "dbopomofo",
  27625. 0x3109,
  27626. "dbsquare",
  27627. 0x33c8,
  27628. "dcaron",
  27629. 0x010f,
  27630. "dcedilla",
  27631. 0x1e11,
  27632. "dcircle",
  27633. 0x24d3,
  27634. "dcircumflexbelow",
  27635. 0x1e13,
  27636. "dcroat",
  27637. 0x0111,
  27638. "ddabengali",
  27639. 0x09a1,
  27640. "ddadeva",
  27641. 0x0921,
  27642. "ddagujarati",
  27643. 0x0aa1,
  27644. "ddagurmukhi",
  27645. 0x0a21,
  27646. "ddalarabic",
  27647. 0x0688,
  27648. "ddalfinalarabic",
  27649. 0xfb89,
  27650. "dddhadeva",
  27651. 0x095c,
  27652. "ddhabengali",
  27653. 0x09a2,
  27654. "ddhadeva",
  27655. 0x0922,
  27656. "ddhagujarati",
  27657. 0x0aa2,
  27658. "ddhagurmukhi",
  27659. 0x0a22,
  27660. "ddotaccent",
  27661. 0x1e0b,
  27662. "ddotbelow",
  27663. 0x1e0d,
  27664. "decimalseparatorarabic",
  27665. 0x066b,
  27666. "decimalseparatorpersian",
  27667. 0x066b,
  27668. "decyrillic",
  27669. 0x0434,
  27670. "degree",
  27671. 0x00b0,
  27672. "dehihebrew",
  27673. 0x05ad,
  27674. "dehiragana",
  27675. 0x3067,
  27676. "deicoptic",
  27677. 0x03ef,
  27678. "dekatakana",
  27679. 0x30c7,
  27680. "deleteleft",
  27681. 0x232b,
  27682. "deleteright",
  27683. 0x2326,
  27684. "delta",
  27685. 0x03b4,
  27686. "deltaturned",
  27687. 0x018d,
  27688. "denominatorminusonenumeratorbengali",
  27689. 0x09f8,
  27690. "dezh",
  27691. 0x02a4,
  27692. "dhabengali",
  27693. 0x09a7,
  27694. "dhadeva",
  27695. 0x0927,
  27696. "dhagujarati",
  27697. 0x0aa7,
  27698. "dhagurmukhi",
  27699. 0x0a27,
  27700. "dhook",
  27701. 0x0257,
  27702. "dialytikatonos",
  27703. 0x0385,
  27704. "dialytikatonoscmb",
  27705. 0x0344,
  27706. "diamond",
  27707. 0x2666,
  27708. "diamondsuitwhite",
  27709. 0x2662,
  27710. "dieresis",
  27711. 0x00a8,
  27712. "dieresisacute",
  27713. 0xf6d7,
  27714. "dieresisbelowcmb",
  27715. 0x0324,
  27716. "dieresiscmb",
  27717. 0x0308,
  27718. "dieresisgrave",
  27719. 0xf6d8,
  27720. "dieresistonos",
  27721. 0x0385,
  27722. "dihiragana",
  27723. 0x3062,
  27724. "dikatakana",
  27725. 0x30c2,
  27726. "dittomark",
  27727. 0x3003,
  27728. "divide",
  27729. 0x00f7,
  27730. "divides",
  27731. 0x2223,
  27732. "divisionslash",
  27733. 0x2215,
  27734. "djecyrillic",
  27735. 0x0452,
  27736. "dkshade",
  27737. 0x2593,
  27738. "dlinebelow",
  27739. 0x1e0f,
  27740. "dlsquare",
  27741. 0x3397,
  27742. "dmacron",
  27743. 0x0111,
  27744. "dmonospace",
  27745. 0xff44,
  27746. "dnblock",
  27747. 0x2584,
  27748. "dochadathai",
  27749. 0x0e0e,
  27750. "dodekthai",
  27751. 0x0e14,
  27752. "dohiragana",
  27753. 0x3069,
  27754. "dokatakana",
  27755. 0x30c9,
  27756. "dollar",
  27757. 0x0024,
  27758. "dollarinferior",
  27759. 0xf6e3,
  27760. "dollarmonospace",
  27761. 0xff04,
  27762. "dollaroldstyle",
  27763. 0xf724,
  27764. "dollarsmall",
  27765. 0xfe69,
  27766. "dollarsuperior",
  27767. 0xf6e4,
  27768. "dong",
  27769. 0x20ab,
  27770. "dorusquare",
  27771. 0x3326,
  27772. "dotaccent",
  27773. 0x02d9,
  27774. "dotaccentcmb",
  27775. 0x0307,
  27776. "dotbelowcmb",
  27777. 0x0323,
  27778. "dotbelowcomb",
  27779. 0x0323,
  27780. "dotkatakana",
  27781. 0x30fb,
  27782. "dotlessi",
  27783. 0x0131,
  27784. "dotlessj",
  27785. 0xf6be,
  27786. "dotlessjstrokehook",
  27787. 0x0284,
  27788. "dotmath",
  27789. 0x22c5,
  27790. "dottedcircle",
  27791. 0x25cc,
  27792. "doubleyodpatah",
  27793. 0xfb1f,
  27794. "doubleyodpatahhebrew",
  27795. 0xfb1f,
  27796. "downtackbelowcmb",
  27797. 0x031e,
  27798. "downtackmod",
  27799. 0x02d5,
  27800. "dparen",
  27801. 0x249f,
  27802. "dsuperior",
  27803. 0xf6eb,
  27804. "dtail",
  27805. 0x0256,
  27806. "dtopbar",
  27807. 0x018c,
  27808. "duhiragana",
  27809. 0x3065,
  27810. "dukatakana",
  27811. 0x30c5,
  27812. "dz",
  27813. 0x01f3,
  27814. "dzaltone",
  27815. 0x02a3,
  27816. "dzcaron",
  27817. 0x01c6,
  27818. "dzcurl",
  27819. 0x02a5,
  27820. "dzeabkhasiancyrillic",
  27821. 0x04e1,
  27822. "dzecyrillic",
  27823. 0x0455,
  27824. "dzhecyrillic",
  27825. 0x045f,
  27826. "e",
  27827. 0x0065,
  27828. "eacute",
  27829. 0x00e9,
  27830. "earth",
  27831. 0x2641,
  27832. "ebengali",
  27833. 0x098f,
  27834. "ebopomofo",
  27835. 0x311c,
  27836. "ebreve",
  27837. 0x0115,
  27838. "ecandradeva",
  27839. 0x090d,
  27840. "ecandragujarati",
  27841. 0x0a8d,
  27842. "ecandravowelsigndeva",
  27843. 0x0945,
  27844. "ecandravowelsigngujarati",
  27845. 0x0ac5,
  27846. "ecaron",
  27847. 0x011b,
  27848. "ecedillabreve",
  27849. 0x1e1d,
  27850. "echarmenian",
  27851. 0x0565,
  27852. "echyiwnarmenian",
  27853. 0x0587,
  27854. "ecircle",
  27855. 0x24d4,
  27856. "ecircumflex",
  27857. 0x00ea,
  27858. "ecircumflexacute",
  27859. 0x1ebf,
  27860. "ecircumflexbelow",
  27861. 0x1e19,
  27862. "ecircumflexdotbelow",
  27863. 0x1ec7,
  27864. "ecircumflexgrave",
  27865. 0x1ec1,
  27866. "ecircumflexhookabove",
  27867. 0x1ec3,
  27868. "ecircumflextilde",
  27869. 0x1ec5,
  27870. "ecyrillic",
  27871. 0x0454,
  27872. "edblgrave",
  27873. 0x0205,
  27874. "edeva",
  27875. 0x090f,
  27876. "edieresis",
  27877. 0x00eb,
  27878. "edot",
  27879. 0x0117,
  27880. "edotaccent",
  27881. 0x0117,
  27882. "edotbelow",
  27883. 0x1eb9,
  27884. "eegurmukhi",
  27885. 0x0a0f,
  27886. "eematragurmukhi",
  27887. 0x0a47,
  27888. "efcyrillic",
  27889. 0x0444,
  27890. "egrave",
  27891. 0x00e8,
  27892. "egujarati",
  27893. 0x0a8f,
  27894. "eharmenian",
  27895. 0x0567,
  27896. "ehbopomofo",
  27897. 0x311d,
  27898. "ehiragana",
  27899. 0x3048,
  27900. "ehookabove",
  27901. 0x1ebb,
  27902. "eibopomofo",
  27903. 0x311f,
  27904. "eight",
  27905. 0x0038,
  27906. "eightarabic",
  27907. 0x0668,
  27908. "eightbengali",
  27909. 0x09ee,
  27910. "eightcircle",
  27911. 0x2467,
  27912. "eightcircleinversesansserif",
  27913. 0x2791,
  27914. "eightdeva",
  27915. 0x096e,
  27916. "eighteencircle",
  27917. 0x2471,
  27918. "eighteenparen",
  27919. 0x2485,
  27920. "eighteenperiod",
  27921. 0x2499,
  27922. "eightgujarati",
  27923. 0x0aee,
  27924. "eightgurmukhi",
  27925. 0x0a6e,
  27926. "eighthackarabic",
  27927. 0x0668,
  27928. "eighthangzhou",
  27929. 0x3028,
  27930. "eighthnotebeamed",
  27931. 0x266b,
  27932. "eightideographicparen",
  27933. 0x3227,
  27934. "eightinferior",
  27935. 0x2088,
  27936. "eightmonospace",
  27937. 0xff18,
  27938. "eightoldstyle",
  27939. 0xf738,
  27940. "eightparen",
  27941. 0x247b,
  27942. "eightperiod",
  27943. 0x248f,
  27944. "eightpersian",
  27945. 0x06f8,
  27946. "eightroman",
  27947. 0x2177,
  27948. "eightsuperior",
  27949. 0x2078,
  27950. "eightthai",
  27951. 0x0e58,
  27952. "einvertedbreve",
  27953. 0x0207,
  27954. "eiotifiedcyrillic",
  27955. 0x0465,
  27956. "ekatakana",
  27957. 0x30a8,
  27958. "ekatakanahalfwidth",
  27959. 0xff74,
  27960. "ekonkargurmukhi",
  27961. 0x0a74,
  27962. "ekorean",
  27963. 0x3154,
  27964. "elcyrillic",
  27965. 0x043b,
  27966. "element",
  27967. 0x2208,
  27968. "elevencircle",
  27969. 0x246a,
  27970. "elevenparen",
  27971. 0x247e,
  27972. "elevenperiod",
  27973. 0x2492,
  27974. "elevenroman",
  27975. 0x217a,
  27976. "ellipsis",
  27977. 0x2026,
  27978. "ellipsisvertical",
  27979. 0x22ee,
  27980. "emacron",
  27981. 0x0113,
  27982. "emacronacute",
  27983. 0x1e17,
  27984. "emacrongrave",
  27985. 0x1e15,
  27986. "emcyrillic",
  27987. 0x043c,
  27988. "emdash",
  27989. 0x2014,
  27990. "emdashvertical",
  27991. 0xfe31,
  27992. "emonospace",
  27993. 0xff45,
  27994. "emphasismarkarmenian",
  27995. 0x055b,
  27996. "emptyset",
  27997. 0x2205,
  27998. "enbopomofo",
  27999. 0x3123,
  28000. "encyrillic",
  28001. 0x043d,
  28002. "endash",
  28003. 0x2013,
  28004. "endashvertical",
  28005. 0xfe32,
  28006. "endescendercyrillic",
  28007. 0x04a3,
  28008. "eng",
  28009. 0x014b,
  28010. "engbopomofo",
  28011. 0x3125,
  28012. "enghecyrillic",
  28013. 0x04a5,
  28014. "enhookcyrillic",
  28015. 0x04c8,
  28016. "enspace",
  28017. 0x2002,
  28018. "eogonek",
  28019. 0x0119,
  28020. "eokorean",
  28021. 0x3153,
  28022. "eopen",
  28023. 0x025b,
  28024. "eopenclosed",
  28025. 0x029a,
  28026. "eopenreversed",
  28027. 0x025c,
  28028. "eopenreversedclosed",
  28029. 0x025e,
  28030. "eopenreversedhook",
  28031. 0x025d,
  28032. "eparen",
  28033. 0x24a0,
  28034. "epsilon",
  28035. 0x03b5,
  28036. "epsilontonos",
  28037. 0x03ad,
  28038. "equal",
  28039. 0x003d,
  28040. "equalmonospace",
  28041. 0xff1d,
  28042. "equalsmall",
  28043. 0xfe66,
  28044. "equalsuperior",
  28045. 0x207c,
  28046. "equivalence",
  28047. 0x2261,
  28048. "erbopomofo",
  28049. 0x3126,
  28050. "ercyrillic",
  28051. 0x0440,
  28052. "ereversed",
  28053. 0x0258,
  28054. "ereversedcyrillic",
  28055. 0x044d,
  28056. "escyrillic",
  28057. 0x0441,
  28058. "esdescendercyrillic",
  28059. 0x04ab,
  28060. "esh",
  28061. 0x0283,
  28062. "eshcurl",
  28063. 0x0286,
  28064. "eshortdeva",
  28065. 0x090e,
  28066. "eshortvowelsigndeva",
  28067. 0x0946,
  28068. "eshreversedloop",
  28069. 0x01aa,
  28070. "eshsquatreversed",
  28071. 0x0285,
  28072. "esmallhiragana",
  28073. 0x3047,
  28074. "esmallkatakana",
  28075. 0x30a7,
  28076. "esmallkatakanahalfwidth",
  28077. 0xff6a,
  28078. "estimated",
  28079. 0x212e,
  28080. "esuperior",
  28081. 0xf6ec,
  28082. "eta",
  28083. 0x03b7,
  28084. "etarmenian",
  28085. 0x0568,
  28086. "etatonos",
  28087. 0x03ae,
  28088. "eth",
  28089. 0x00f0,
  28090. "etilde",
  28091. 0x1ebd,
  28092. "etildebelow",
  28093. 0x1e1b,
  28094. "etnahtafoukhhebrew",
  28095. 0x0591,
  28096. "etnahtafoukhlefthebrew",
  28097. 0x0591,
  28098. "etnahtahebrew",
  28099. 0x0591,
  28100. "etnahtalefthebrew",
  28101. 0x0591,
  28102. "eturned",
  28103. 0x01dd,
  28104. "eukorean",
  28105. 0x3161,
  28106. "euro",
  28107. 0x20ac,
  28108. "evowelsignbengali",
  28109. 0x09c7,
  28110. "evowelsigndeva",
  28111. 0x0947,
  28112. "evowelsigngujarati",
  28113. 0x0ac7,
  28114. "exclam",
  28115. 0x0021,
  28116. "exclamarmenian",
  28117. 0x055c,
  28118. "exclamdbl",
  28119. 0x203c,
  28120. "exclamdown",
  28121. 0x00a1,
  28122. "exclamdownsmall",
  28123. 0xf7a1,
  28124. "exclammonospace",
  28125. 0xff01,
  28126. "exclamsmall",
  28127. 0xf721,
  28128. "existential",
  28129. 0x2203,
  28130. "ezh",
  28131. 0x0292,
  28132. "ezhcaron",
  28133. 0x01ef,
  28134. "ezhcurl",
  28135. 0x0293,
  28136. "ezhreversed",
  28137. 0x01b9,
  28138. "ezhtail",
  28139. 0x01ba,
  28140. "f",
  28141. 0x0066,
  28142. "fadeva",
  28143. 0x095e,
  28144. "fagurmukhi",
  28145. 0x0a5e,
  28146. "fahrenheit",
  28147. 0x2109,
  28148. "fathaarabic",
  28149. 0x064e,
  28150. "fathalowarabic",
  28151. 0x064e,
  28152. "fathatanarabic",
  28153. 0x064b,
  28154. "fbopomofo",
  28155. 0x3108,
  28156. "fcircle",
  28157. 0x24d5,
  28158. "fdotaccent",
  28159. 0x1e1f,
  28160. "feharabic",
  28161. 0x0641,
  28162. "feharmenian",
  28163. 0x0586,
  28164. "fehfinalarabic",
  28165. 0xfed2,
  28166. "fehinitialarabic",
  28167. 0xfed3,
  28168. "fehmedialarabic",
  28169. 0xfed4,
  28170. "feicoptic",
  28171. 0x03e5,
  28172. "female",
  28173. 0x2640,
  28174. "ff",
  28175. 0xfb00,
  28176. "f_f",
  28177. 0xfb00,
  28178. "ffi",
  28179. 0xfb03,
  28180. "f_f_i",
  28181. 0xfb03,
  28182. "ffl",
  28183. 0xfb04,
  28184. "f_f_l",
  28185. 0xfb04,
  28186. "fi",
  28187. 0xfb01,
  28188. "f_i",
  28189. 0xfb01,
  28190. "fifteencircle",
  28191. 0x246e,
  28192. "fifteenparen",
  28193. 0x2482,
  28194. "fifteenperiod",
  28195. 0x2496,
  28196. "figuredash",
  28197. 0x2012,
  28198. "filledbox",
  28199. 0x25a0,
  28200. "filledrect",
  28201. 0x25ac,
  28202. "finalkaf",
  28203. 0x05da,
  28204. "finalkafdagesh",
  28205. 0xfb3a,
  28206. "finalkafdageshhebrew",
  28207. 0xfb3a,
  28208. "finalkafhebrew",
  28209. 0x05da,
  28210. "finalmem",
  28211. 0x05dd,
  28212. "finalmemhebrew",
  28213. 0x05dd,
  28214. "finalnun",
  28215. 0x05df,
  28216. "finalnunhebrew",
  28217. 0x05df,
  28218. "finalpe",
  28219. 0x05e3,
  28220. "finalpehebrew",
  28221. 0x05e3,
  28222. "finaltsadi",
  28223. 0x05e5,
  28224. "finaltsadihebrew",
  28225. 0x05e5,
  28226. "firsttonechinese",
  28227. 0x02c9,
  28228. "fisheye",
  28229. 0x25c9,
  28230. "fitacyrillic",
  28231. 0x0473,
  28232. "five",
  28233. 0x0035,
  28234. "fivearabic",
  28235. 0x0665,
  28236. "fivebengali",
  28237. 0x09eb,
  28238. "fivecircle",
  28239. 0x2464,
  28240. "fivecircleinversesansserif",
  28241. 0x278e,
  28242. "fivedeva",
  28243. 0x096b,
  28244. "fiveeighths",
  28245. 0x215d,
  28246. "fivegujarati",
  28247. 0x0aeb,
  28248. "fivegurmukhi",
  28249. 0x0a6b,
  28250. "fivehackarabic",
  28251. 0x0665,
  28252. "fivehangzhou",
  28253. 0x3025,
  28254. "fiveideographicparen",
  28255. 0x3224,
  28256. "fiveinferior",
  28257. 0x2085,
  28258. "fivemonospace",
  28259. 0xff15,
  28260. "fiveoldstyle",
  28261. 0xf735,
  28262. "fiveparen",
  28263. 0x2478,
  28264. "fiveperiod",
  28265. 0x248c,
  28266. "fivepersian",
  28267. 0x06f5,
  28268. "fiveroman",
  28269. 0x2174,
  28270. "fivesuperior",
  28271. 0x2075,
  28272. "fivethai",
  28273. 0x0e55,
  28274. "fl",
  28275. 0xfb02,
  28276. "f_l",
  28277. 0xfb02,
  28278. "florin",
  28279. 0x0192,
  28280. "fmonospace",
  28281. 0xff46,
  28282. "fmsquare",
  28283. 0x3399,
  28284. "fofanthai",
  28285. 0x0e1f,
  28286. "fofathai",
  28287. 0x0e1d,
  28288. "fongmanthai",
  28289. 0x0e4f,
  28290. "forall",
  28291. 0x2200,
  28292. "four",
  28293. 0x0034,
  28294. "fourarabic",
  28295. 0x0664,
  28296. "fourbengali",
  28297. 0x09ea,
  28298. "fourcircle",
  28299. 0x2463,
  28300. "fourcircleinversesansserif",
  28301. 0x278d,
  28302. "fourdeva",
  28303. 0x096a,
  28304. "fourgujarati",
  28305. 0x0aea,
  28306. "fourgurmukhi",
  28307. 0x0a6a,
  28308. "fourhackarabic",
  28309. 0x0664,
  28310. "fourhangzhou",
  28311. 0x3024,
  28312. "fourideographicparen",
  28313. 0x3223,
  28314. "fourinferior",
  28315. 0x2084,
  28316. "fourmonospace",
  28317. 0xff14,
  28318. "fournumeratorbengali",
  28319. 0x09f7,
  28320. "fouroldstyle",
  28321. 0xf734,
  28322. "fourparen",
  28323. 0x2477,
  28324. "fourperiod",
  28325. 0x248b,
  28326. "fourpersian",
  28327. 0x06f4,
  28328. "fourroman",
  28329. 0x2173,
  28330. "foursuperior",
  28331. 0x2074,
  28332. "fourteencircle",
  28333. 0x246d,
  28334. "fourteenparen",
  28335. 0x2481,
  28336. "fourteenperiod",
  28337. 0x2495,
  28338. "fourthai",
  28339. 0x0e54,
  28340. "fourthtonechinese",
  28341. 0x02cb,
  28342. "fparen",
  28343. 0x24a1,
  28344. "fraction",
  28345. 0x2044,
  28346. "franc",
  28347. 0x20a3,
  28348. "g",
  28349. 0x0067,
  28350. "gabengali",
  28351. 0x0997,
  28352. "gacute",
  28353. 0x01f5,
  28354. "gadeva",
  28355. 0x0917,
  28356. "gafarabic",
  28357. 0x06af,
  28358. "gaffinalarabic",
  28359. 0xfb93,
  28360. "gafinitialarabic",
  28361. 0xfb94,
  28362. "gafmedialarabic",
  28363. 0xfb95,
  28364. "gagujarati",
  28365. 0x0a97,
  28366. "gagurmukhi",
  28367. 0x0a17,
  28368. "gahiragana",
  28369. 0x304c,
  28370. "gakatakana",
  28371. 0x30ac,
  28372. "gamma",
  28373. 0x03b3,
  28374. "gammalatinsmall",
  28375. 0x0263,
  28376. "gammasuperior",
  28377. 0x02e0,
  28378. "gangiacoptic",
  28379. 0x03eb,
  28380. "gbopomofo",
  28381. 0x310d,
  28382. "gbreve",
  28383. 0x011f,
  28384. "gcaron",
  28385. 0x01e7,
  28386. "gcedilla",
  28387. 0x0123,
  28388. "gcircle",
  28389. 0x24d6,
  28390. "gcircumflex",
  28391. 0x011d,
  28392. "gcommaaccent",
  28393. 0x0123,
  28394. "gdot",
  28395. 0x0121,
  28396. "gdotaccent",
  28397. 0x0121,
  28398. "gecyrillic",
  28399. 0x0433,
  28400. "gehiragana",
  28401. 0x3052,
  28402. "gekatakana",
  28403. 0x30b2,
  28404. "geometricallyequal",
  28405. 0x2251,
  28406. "gereshaccenthebrew",
  28407. 0x059c,
  28408. "gereshhebrew",
  28409. 0x05f3,
  28410. "gereshmuqdamhebrew",
  28411. 0x059d,
  28412. "germandbls",
  28413. 0x00df,
  28414. "gershayimaccenthebrew",
  28415. 0x059e,
  28416. "gershayimhebrew",
  28417. 0x05f4,
  28418. "getamark",
  28419. 0x3013,
  28420. "ghabengali",
  28421. 0x0998,
  28422. "ghadarmenian",
  28423. 0x0572,
  28424. "ghadeva",
  28425. 0x0918,
  28426. "ghagujarati",
  28427. 0x0a98,
  28428. "ghagurmukhi",
  28429. 0x0a18,
  28430. "ghainarabic",
  28431. 0x063a,
  28432. "ghainfinalarabic",
  28433. 0xfece,
  28434. "ghaininitialarabic",
  28435. 0xfecf,
  28436. "ghainmedialarabic",
  28437. 0xfed0,
  28438. "ghemiddlehookcyrillic",
  28439. 0x0495,
  28440. "ghestrokecyrillic",
  28441. 0x0493,
  28442. "gheupturncyrillic",
  28443. 0x0491,
  28444. "ghhadeva",
  28445. 0x095a,
  28446. "ghhagurmukhi",
  28447. 0x0a5a,
  28448. "ghook",
  28449. 0x0260,
  28450. "ghzsquare",
  28451. 0x3393,
  28452. "gihiragana",
  28453. 0x304e,
  28454. "gikatakana",
  28455. 0x30ae,
  28456. "gimarmenian",
  28457. 0x0563,
  28458. "gimel",
  28459. 0x05d2,
  28460. "gimeldagesh",
  28461. 0xfb32,
  28462. "gimeldageshhebrew",
  28463. 0xfb32,
  28464. "gimelhebrew",
  28465. 0x05d2,
  28466. "gjecyrillic",
  28467. 0x0453,
  28468. "glottalinvertedstroke",
  28469. 0x01be,
  28470. "glottalstop",
  28471. 0x0294,
  28472. "glottalstopinverted",
  28473. 0x0296,
  28474. "glottalstopmod",
  28475. 0x02c0,
  28476. "glottalstopreversed",
  28477. 0x0295,
  28478. "glottalstopreversedmod",
  28479. 0x02c1,
  28480. "glottalstopreversedsuperior",
  28481. 0x02e4,
  28482. "glottalstopstroke",
  28483. 0x02a1,
  28484. "glottalstopstrokereversed",
  28485. 0x02a2,
  28486. "gmacron",
  28487. 0x1e21,
  28488. "gmonospace",
  28489. 0xff47,
  28490. "gohiragana",
  28491. 0x3054,
  28492. "gokatakana",
  28493. 0x30b4,
  28494. "gparen",
  28495. 0x24a2,
  28496. "gpasquare",
  28497. 0x33ac,
  28498. "gradient",
  28499. 0x2207,
  28500. "grave",
  28501. 0x0060,
  28502. "gravebelowcmb",
  28503. 0x0316,
  28504. "gravecmb",
  28505. 0x0300,
  28506. "gravecomb",
  28507. 0x0300,
  28508. "gravedeva",
  28509. 0x0953,
  28510. "gravelowmod",
  28511. 0x02ce,
  28512. "gravemonospace",
  28513. 0xff40,
  28514. "gravetonecmb",
  28515. 0x0340,
  28516. "greater",
  28517. 0x003e,
  28518. "greaterequal",
  28519. 0x2265,
  28520. "greaterequalorless",
  28521. 0x22db,
  28522. "greatermonospace",
  28523. 0xff1e,
  28524. "greaterorequivalent",
  28525. 0x2273,
  28526. "greaterorless",
  28527. 0x2277,
  28528. "greateroverequal",
  28529. 0x2267,
  28530. "greatersmall",
  28531. 0xfe65,
  28532. "gscript",
  28533. 0x0261,
  28534. "gstroke",
  28535. 0x01e5,
  28536. "guhiragana",
  28537. 0x3050,
  28538. "guillemotleft",
  28539. 0x00ab,
  28540. "guillemotright",
  28541. 0x00bb,
  28542. "guilsinglleft",
  28543. 0x2039,
  28544. "guilsinglright",
  28545. 0x203a,
  28546. "gukatakana",
  28547. 0x30b0,
  28548. "guramusquare",
  28549. 0x3318,
  28550. "gysquare",
  28551. 0x33c9,
  28552. "h",
  28553. 0x0068,
  28554. "haabkhasiancyrillic",
  28555. 0x04a9,
  28556. "haaltonearabic",
  28557. 0x06c1,
  28558. "habengali",
  28559. 0x09b9,
  28560. "hadescendercyrillic",
  28561. 0x04b3,
  28562. "hadeva",
  28563. 0x0939,
  28564. "hagujarati",
  28565. 0x0ab9,
  28566. "hagurmukhi",
  28567. 0x0a39,
  28568. "haharabic",
  28569. 0x062d,
  28570. "hahfinalarabic",
  28571. 0xfea2,
  28572. "hahinitialarabic",
  28573. 0xfea3,
  28574. "hahiragana",
  28575. 0x306f,
  28576. "hahmedialarabic",
  28577. 0xfea4,
  28578. "haitusquare",
  28579. 0x332a,
  28580. "hakatakana",
  28581. 0x30cf,
  28582. "hakatakanahalfwidth",
  28583. 0xff8a,
  28584. "halantgurmukhi",
  28585. 0x0a4d,
  28586. "hamzaarabic",
  28587. 0x0621,
  28588. "hamzalowarabic",
  28589. 0x0621,
  28590. "hangulfiller",
  28591. 0x3164,
  28592. "hardsigncyrillic",
  28593. 0x044a,
  28594. "harpoonleftbarbup",
  28595. 0x21bc,
  28596. "harpoonrightbarbup",
  28597. 0x21c0,
  28598. "hasquare",
  28599. 0x33ca,
  28600. "hatafpatah",
  28601. 0x05b2,
  28602. "hatafpatah16",
  28603. 0x05b2,
  28604. "hatafpatah23",
  28605. 0x05b2,
  28606. "hatafpatah2f",
  28607. 0x05b2,
  28608. "hatafpatahhebrew",
  28609. 0x05b2,
  28610. "hatafpatahnarrowhebrew",
  28611. 0x05b2,
  28612. "hatafpatahquarterhebrew",
  28613. 0x05b2,
  28614. "hatafpatahwidehebrew",
  28615. 0x05b2,
  28616. "hatafqamats",
  28617. 0x05b3,
  28618. "hatafqamats1b",
  28619. 0x05b3,
  28620. "hatafqamats28",
  28621. 0x05b3,
  28622. "hatafqamats34",
  28623. 0x05b3,
  28624. "hatafqamatshebrew",
  28625. 0x05b3,
  28626. "hatafqamatsnarrowhebrew",
  28627. 0x05b3,
  28628. "hatafqamatsquarterhebrew",
  28629. 0x05b3,
  28630. "hatafqamatswidehebrew",
  28631. 0x05b3,
  28632. "hatafsegol",
  28633. 0x05b1,
  28634. "hatafsegol17",
  28635. 0x05b1,
  28636. "hatafsegol24",
  28637. 0x05b1,
  28638. "hatafsegol30",
  28639. 0x05b1,
  28640. "hatafsegolhebrew",
  28641. 0x05b1,
  28642. "hatafsegolnarrowhebrew",
  28643. 0x05b1,
  28644. "hatafsegolquarterhebrew",
  28645. 0x05b1,
  28646. "hatafsegolwidehebrew",
  28647. 0x05b1,
  28648. "hbar",
  28649. 0x0127,
  28650. "hbopomofo",
  28651. 0x310f,
  28652. "hbrevebelow",
  28653. 0x1e2b,
  28654. "hcedilla",
  28655. 0x1e29,
  28656. "hcircle",
  28657. 0x24d7,
  28658. "hcircumflex",
  28659. 0x0125,
  28660. "hdieresis",
  28661. 0x1e27,
  28662. "hdotaccent",
  28663. 0x1e23,
  28664. "hdotbelow",
  28665. 0x1e25,
  28666. "he",
  28667. 0x05d4,
  28668. "heart",
  28669. 0x2665,
  28670. "heartsuitblack",
  28671. 0x2665,
  28672. "heartsuitwhite",
  28673. 0x2661,
  28674. "hedagesh",
  28675. 0xfb34,
  28676. "hedageshhebrew",
  28677. 0xfb34,
  28678. "hehaltonearabic",
  28679. 0x06c1,
  28680. "heharabic",
  28681. 0x0647,
  28682. "hehebrew",
  28683. 0x05d4,
  28684. "hehfinalaltonearabic",
  28685. 0xfba7,
  28686. "hehfinalalttwoarabic",
  28687. 0xfeea,
  28688. "hehfinalarabic",
  28689. 0xfeea,
  28690. "hehhamzaabovefinalarabic",
  28691. 0xfba5,
  28692. "hehhamzaaboveisolatedarabic",
  28693. 0xfba4,
  28694. "hehinitialaltonearabic",
  28695. 0xfba8,
  28696. "hehinitialarabic",
  28697. 0xfeeb,
  28698. "hehiragana",
  28699. 0x3078,
  28700. "hehmedialaltonearabic",
  28701. 0xfba9,
  28702. "hehmedialarabic",
  28703. 0xfeec,
  28704. "heiseierasquare",
  28705. 0x337b,
  28706. "hekatakana",
  28707. 0x30d8,
  28708. "hekatakanahalfwidth",
  28709. 0xff8d,
  28710. "hekutaarusquare",
  28711. 0x3336,
  28712. "henghook",
  28713. 0x0267,
  28714. "herutusquare",
  28715. 0x3339,
  28716. "het",
  28717. 0x05d7,
  28718. "hethebrew",
  28719. 0x05d7,
  28720. "hhook",
  28721. 0x0266,
  28722. "hhooksuperior",
  28723. 0x02b1,
  28724. "hieuhacirclekorean",
  28725. 0x327b,
  28726. "hieuhaparenkorean",
  28727. 0x321b,
  28728. "hieuhcirclekorean",
  28729. 0x326d,
  28730. "hieuhkorean",
  28731. 0x314e,
  28732. "hieuhparenkorean",
  28733. 0x320d,
  28734. "hihiragana",
  28735. 0x3072,
  28736. "hikatakana",
  28737. 0x30d2,
  28738. "hikatakanahalfwidth",
  28739. 0xff8b,
  28740. "hiriq",
  28741. 0x05b4,
  28742. "hiriq14",
  28743. 0x05b4,
  28744. "hiriq21",
  28745. 0x05b4,
  28746. "hiriq2d",
  28747. 0x05b4,
  28748. "hiriqhebrew",
  28749. 0x05b4,
  28750. "hiriqnarrowhebrew",
  28751. 0x05b4,
  28752. "hiriqquarterhebrew",
  28753. 0x05b4,
  28754. "hiriqwidehebrew",
  28755. 0x05b4,
  28756. "hlinebelow",
  28757. 0x1e96,
  28758. "hmonospace",
  28759. 0xff48,
  28760. "hoarmenian",
  28761. 0x0570,
  28762. "hohipthai",
  28763. 0x0e2b,
  28764. "hohiragana",
  28765. 0x307b,
  28766. "hokatakana",
  28767. 0x30db,
  28768. "hokatakanahalfwidth",
  28769. 0xff8e,
  28770. "holam",
  28771. 0x05b9,
  28772. "holam19",
  28773. 0x05b9,
  28774. "holam26",
  28775. 0x05b9,
  28776. "holam32",
  28777. 0x05b9,
  28778. "holamhebrew",
  28779. 0x05b9,
  28780. "holamnarrowhebrew",
  28781. 0x05b9,
  28782. "holamquarterhebrew",
  28783. 0x05b9,
  28784. "holamwidehebrew",
  28785. 0x05b9,
  28786. "honokhukthai",
  28787. 0x0e2e,
  28788. "hookabovecomb",
  28789. 0x0309,
  28790. "hookcmb",
  28791. 0x0309,
  28792. "hookpalatalizedbelowcmb",
  28793. 0x0321,
  28794. "hookretroflexbelowcmb",
  28795. 0x0322,
  28796. "hoonsquare",
  28797. 0x3342,
  28798. "horicoptic",
  28799. 0x03e9,
  28800. "horizontalbar",
  28801. 0x2015,
  28802. "horncmb",
  28803. 0x031b,
  28804. "hotsprings",
  28805. 0x2668,
  28806. "house",
  28807. 0x2302,
  28808. "hparen",
  28809. 0x24a3,
  28810. "hsuperior",
  28811. 0x02b0,
  28812. "hturned",
  28813. 0x0265,
  28814. "huhiragana",
  28815. 0x3075,
  28816. "huiitosquare",
  28817. 0x3333,
  28818. "hukatakana",
  28819. 0x30d5,
  28820. "hukatakanahalfwidth",
  28821. 0xff8c,
  28822. "hungarumlaut",
  28823. 0x02dd,
  28824. "hungarumlautcmb",
  28825. 0x030b,
  28826. "hv",
  28827. 0x0195,
  28828. "hyphen",
  28829. 0x002d,
  28830. "hypheninferior",
  28831. 0xf6e5,
  28832. "hyphenmonospace",
  28833. 0xff0d,
  28834. "hyphensmall",
  28835. 0xfe63,
  28836. "hyphensuperior",
  28837. 0xf6e6,
  28838. "hyphentwo",
  28839. 0x2010,
  28840. "i",
  28841. 0x0069,
  28842. "iacute",
  28843. 0x00ed,
  28844. "iacyrillic",
  28845. 0x044f,
  28846. "ibengali",
  28847. 0x0987,
  28848. "ibopomofo",
  28849. 0x3127,
  28850. "ibreve",
  28851. 0x012d,
  28852. "icaron",
  28853. 0x01d0,
  28854. "icircle",
  28855. 0x24d8,
  28856. "icircumflex",
  28857. 0x00ee,
  28858. "icyrillic",
  28859. 0x0456,
  28860. "idblgrave",
  28861. 0x0209,
  28862. "ideographearthcircle",
  28863. 0x328f,
  28864. "ideographfirecircle",
  28865. 0x328b,
  28866. "ideographicallianceparen",
  28867. 0x323f,
  28868. "ideographiccallparen",
  28869. 0x323a,
  28870. "ideographiccentrecircle",
  28871. 0x32a5,
  28872. "ideographicclose",
  28873. 0x3006,
  28874. "ideographiccomma",
  28875. 0x3001,
  28876. "ideographiccommaleft",
  28877. 0xff64,
  28878. "ideographiccongratulationparen",
  28879. 0x3237,
  28880. "ideographiccorrectcircle",
  28881. 0x32a3,
  28882. "ideographicearthparen",
  28883. 0x322f,
  28884. "ideographicenterpriseparen",
  28885. 0x323d,
  28886. "ideographicexcellentcircle",
  28887. 0x329d,
  28888. "ideographicfestivalparen",
  28889. 0x3240,
  28890. "ideographicfinancialcircle",
  28891. 0x3296,
  28892. "ideographicfinancialparen",
  28893. 0x3236,
  28894. "ideographicfireparen",
  28895. 0x322b,
  28896. "ideographichaveparen",
  28897. 0x3232,
  28898. "ideographichighcircle",
  28899. 0x32a4,
  28900. "ideographiciterationmark",
  28901. 0x3005,
  28902. "ideographiclaborcircle",
  28903. 0x3298,
  28904. "ideographiclaborparen",
  28905. 0x3238,
  28906. "ideographicleftcircle",
  28907. 0x32a7,
  28908. "ideographiclowcircle",
  28909. 0x32a6,
  28910. "ideographicmedicinecircle",
  28911. 0x32a9,
  28912. "ideographicmetalparen",
  28913. 0x322e,
  28914. "ideographicmoonparen",
  28915. 0x322a,
  28916. "ideographicnameparen",
  28917. 0x3234,
  28918. "ideographicperiod",
  28919. 0x3002,
  28920. "ideographicprintcircle",
  28921. 0x329e,
  28922. "ideographicreachparen",
  28923. 0x3243,
  28924. "ideographicrepresentparen",
  28925. 0x3239,
  28926. "ideographicresourceparen",
  28927. 0x323e,
  28928. "ideographicrightcircle",
  28929. 0x32a8,
  28930. "ideographicsecretcircle",
  28931. 0x3299,
  28932. "ideographicselfparen",
  28933. 0x3242,
  28934. "ideographicsocietyparen",
  28935. 0x3233,
  28936. "ideographicspace",
  28937. 0x3000,
  28938. "ideographicspecialparen",
  28939. 0x3235,
  28940. "ideographicstockparen",
  28941. 0x3231,
  28942. "ideographicstudyparen",
  28943. 0x323b,
  28944. "ideographicsunparen",
  28945. 0x3230,
  28946. "ideographicsuperviseparen",
  28947. 0x323c,
  28948. "ideographicwaterparen",
  28949. 0x322c,
  28950. "ideographicwoodparen",
  28951. 0x322d,
  28952. "ideographiczero",
  28953. 0x3007,
  28954. "ideographmetalcircle",
  28955. 0x328e,
  28956. "ideographmooncircle",
  28957. 0x328a,
  28958. "ideographnamecircle",
  28959. 0x3294,
  28960. "ideographsuncircle",
  28961. 0x3290,
  28962. "ideographwatercircle",
  28963. 0x328c,
  28964. "ideographwoodcircle",
  28965. 0x328d,
  28966. "ideva",
  28967. 0x0907,
  28968. "idieresis",
  28969. 0x00ef,
  28970. "idieresisacute",
  28971. 0x1e2f,
  28972. "idieresiscyrillic",
  28973. 0x04e5,
  28974. "idotbelow",
  28975. 0x1ecb,
  28976. "iebrevecyrillic",
  28977. 0x04d7,
  28978. "iecyrillic",
  28979. 0x0435,
  28980. "ieungacirclekorean",
  28981. 0x3275,
  28982. "ieungaparenkorean",
  28983. 0x3215,
  28984. "ieungcirclekorean",
  28985. 0x3267,
  28986. "ieungkorean",
  28987. 0x3147,
  28988. "ieungparenkorean",
  28989. 0x3207,
  28990. "igrave",
  28991. 0x00ec,
  28992. "igujarati",
  28993. 0x0a87,
  28994. "igurmukhi",
  28995. 0x0a07,
  28996. "ihiragana",
  28997. 0x3044,
  28998. "ihookabove",
  28999. 0x1ec9,
  29000. "iibengali",
  29001. 0x0988,
  29002. "iicyrillic",
  29003. 0x0438,
  29004. "iideva",
  29005. 0x0908,
  29006. "iigujarati",
  29007. 0x0a88,
  29008. "iigurmukhi",
  29009. 0x0a08,
  29010. "iimatragurmukhi",
  29011. 0x0a40,
  29012. "iinvertedbreve",
  29013. 0x020b,
  29014. "iishortcyrillic",
  29015. 0x0439,
  29016. "iivowelsignbengali",
  29017. 0x09c0,
  29018. "iivowelsigndeva",
  29019. 0x0940,
  29020. "iivowelsigngujarati",
  29021. 0x0ac0,
  29022. "ij",
  29023. 0x0133,
  29024. "ikatakana",
  29025. 0x30a4,
  29026. "ikatakanahalfwidth",
  29027. 0xff72,
  29028. "ikorean",
  29029. 0x3163,
  29030. "ilde",
  29031. 0x02dc,
  29032. "iluyhebrew",
  29033. 0x05ac,
  29034. "imacron",
  29035. 0x012b,
  29036. "imacroncyrillic",
  29037. 0x04e3,
  29038. "imageorapproximatelyequal",
  29039. 0x2253,
  29040. "imatragurmukhi",
  29041. 0x0a3f,
  29042. "imonospace",
  29043. 0xff49,
  29044. "increment",
  29045. 0x2206,
  29046. "infinity",
  29047. 0x221e,
  29048. "iniarmenian",
  29049. 0x056b,
  29050. "integral",
  29051. 0x222b,
  29052. "integralbottom",
  29053. 0x2321,
  29054. "integralbt",
  29055. 0x2321,
  29056. "integralex",
  29057. 0xf8f5,
  29058. "integraltop",
  29059. 0x2320,
  29060. "integraltp",
  29061. 0x2320,
  29062. "intersection",
  29063. 0x2229,
  29064. "intisquare",
  29065. 0x3305,
  29066. "invbullet",
  29067. 0x25d8,
  29068. "invcircle",
  29069. 0x25d9,
  29070. "invsmileface",
  29071. 0x263b,
  29072. "iocyrillic",
  29073. 0x0451,
  29074. "iogonek",
  29075. 0x012f,
  29076. "iota",
  29077. 0x03b9,
  29078. "iotadieresis",
  29079. 0x03ca,
  29080. "iotadieresistonos",
  29081. 0x0390,
  29082. "iotalatin",
  29083. 0x0269,
  29084. "iotatonos",
  29085. 0x03af,
  29086. "iparen",
  29087. 0x24a4,
  29088. "irigurmukhi",
  29089. 0x0a72,
  29090. "ismallhiragana",
  29091. 0x3043,
  29092. "ismallkatakana",
  29093. 0x30a3,
  29094. "ismallkatakanahalfwidth",
  29095. 0xff68,
  29096. "issharbengali",
  29097. 0x09fa,
  29098. "istroke",
  29099. 0x0268,
  29100. "isuperior",
  29101. 0xf6ed,
  29102. "iterationhiragana",
  29103. 0x309d,
  29104. "iterationkatakana",
  29105. 0x30fd,
  29106. "itilde",
  29107. 0x0129,
  29108. "itildebelow",
  29109. 0x1e2d,
  29110. "iubopomofo",
  29111. 0x3129,
  29112. "iucyrillic",
  29113. 0x044e,
  29114. "ivowelsignbengali",
  29115. 0x09bf,
  29116. "ivowelsigndeva",
  29117. 0x093f,
  29118. "ivowelsigngujarati",
  29119. 0x0abf,
  29120. "izhitsacyrillic",
  29121. 0x0475,
  29122. "izhitsadblgravecyrillic",
  29123. 0x0477,
  29124. "j",
  29125. 0x006a,
  29126. "jaarmenian",
  29127. 0x0571,
  29128. "jabengali",
  29129. 0x099c,
  29130. "jadeva",
  29131. 0x091c,
  29132. "jagujarati",
  29133. 0x0a9c,
  29134. "jagurmukhi",
  29135. 0x0a1c,
  29136. "jbopomofo",
  29137. 0x3110,
  29138. "jcaron",
  29139. 0x01f0,
  29140. "jcircle",
  29141. 0x24d9,
  29142. "jcircumflex",
  29143. 0x0135,
  29144. "jcrossedtail",
  29145. 0x029d,
  29146. "jdotlessstroke",
  29147. 0x025f,
  29148. "jecyrillic",
  29149. 0x0458,
  29150. "jeemarabic",
  29151. 0x062c,
  29152. "jeemfinalarabic",
  29153. 0xfe9e,
  29154. "jeeminitialarabic",
  29155. 0xfe9f,
  29156. "jeemmedialarabic",
  29157. 0xfea0,
  29158. "jeharabic",
  29159. 0x0698,
  29160. "jehfinalarabic",
  29161. 0xfb8b,
  29162. "jhabengali",
  29163. 0x099d,
  29164. "jhadeva",
  29165. 0x091d,
  29166. "jhagujarati",
  29167. 0x0a9d,
  29168. "jhagurmukhi",
  29169. 0x0a1d,
  29170. "jheharmenian",
  29171. 0x057b,
  29172. "jis",
  29173. 0x3004,
  29174. "jmonospace",
  29175. 0xff4a,
  29176. "jparen",
  29177. 0x24a5,
  29178. "jsuperior",
  29179. 0x02b2,
  29180. "k",
  29181. 0x006b,
  29182. "kabashkircyrillic",
  29183. 0x04a1,
  29184. "kabengali",
  29185. 0x0995,
  29186. "kacute",
  29187. 0x1e31,
  29188. "kacyrillic",
  29189. 0x043a,
  29190. "kadescendercyrillic",
  29191. 0x049b,
  29192. "kadeva",
  29193. 0x0915,
  29194. "kaf",
  29195. 0x05db,
  29196. "kafarabic",
  29197. 0x0643,
  29198. "kafdagesh",
  29199. 0xfb3b,
  29200. "kafdageshhebrew",
  29201. 0xfb3b,
  29202. "kaffinalarabic",
  29203. 0xfeda,
  29204. "kafhebrew",
  29205. 0x05db,
  29206. "kafinitialarabic",
  29207. 0xfedb,
  29208. "kafmedialarabic",
  29209. 0xfedc,
  29210. "kafrafehebrew",
  29211. 0xfb4d,
  29212. "kagujarati",
  29213. 0x0a95,
  29214. "kagurmukhi",
  29215. 0x0a15,
  29216. "kahiragana",
  29217. 0x304b,
  29218. "kahookcyrillic",
  29219. 0x04c4,
  29220. "kakatakana",
  29221. 0x30ab,
  29222. "kakatakanahalfwidth",
  29223. 0xff76,
  29224. "kappa",
  29225. 0x03ba,
  29226. "kappasymbolgreek",
  29227. 0x03f0,
  29228. "kapyeounmieumkorean",
  29229. 0x3171,
  29230. "kapyeounphieuphkorean",
  29231. 0x3184,
  29232. "kapyeounpieupkorean",
  29233. 0x3178,
  29234. "kapyeounssangpieupkorean",
  29235. 0x3179,
  29236. "karoriisquare",
  29237. 0x330d,
  29238. "kashidaautoarabic",
  29239. 0x0640,
  29240. "kashidaautonosidebearingarabic",
  29241. 0x0640,
  29242. "kasmallkatakana",
  29243. 0x30f5,
  29244. "kasquare",
  29245. 0x3384,
  29246. "kasraarabic",
  29247. 0x0650,
  29248. "kasratanarabic",
  29249. 0x064d,
  29250. "kastrokecyrillic",
  29251. 0x049f,
  29252. "katahiraprolongmarkhalfwidth",
  29253. 0xff70,
  29254. "kaverticalstrokecyrillic",
  29255. 0x049d,
  29256. "kbopomofo",
  29257. 0x310e,
  29258. "kcalsquare",
  29259. 0x3389,
  29260. "kcaron",
  29261. 0x01e9,
  29262. "kcedilla",
  29263. 0x0137,
  29264. "kcircle",
  29265. 0x24da,
  29266. "kcommaaccent",
  29267. 0x0137,
  29268. "kdotbelow",
  29269. 0x1e33,
  29270. "keharmenian",
  29271. 0x0584,
  29272. "kehiragana",
  29273. 0x3051,
  29274. "kekatakana",
  29275. 0x30b1,
  29276. "kekatakanahalfwidth",
  29277. 0xff79,
  29278. "kenarmenian",
  29279. 0x056f,
  29280. "kesmallkatakana",
  29281. 0x30f6,
  29282. "kgreenlandic",
  29283. 0x0138,
  29284. "khabengali",
  29285. 0x0996,
  29286. "khacyrillic",
  29287. 0x0445,
  29288. "khadeva",
  29289. 0x0916,
  29290. "khagujarati",
  29291. 0x0a96,
  29292. "khagurmukhi",
  29293. 0x0a16,
  29294. "khaharabic",
  29295. 0x062e,
  29296. "khahfinalarabic",
  29297. 0xfea6,
  29298. "khahinitialarabic",
  29299. 0xfea7,
  29300. "khahmedialarabic",
  29301. 0xfea8,
  29302. "kheicoptic",
  29303. 0x03e7,
  29304. "khhadeva",
  29305. 0x0959,
  29306. "khhagurmukhi",
  29307. 0x0a59,
  29308. "khieukhacirclekorean",
  29309. 0x3278,
  29310. "khieukhaparenkorean",
  29311. 0x3218,
  29312. "khieukhcirclekorean",
  29313. 0x326a,
  29314. "khieukhkorean",
  29315. 0x314b,
  29316. "khieukhparenkorean",
  29317. 0x320a,
  29318. "khokhaithai",
  29319. 0x0e02,
  29320. "khokhonthai",
  29321. 0x0e05,
  29322. "khokhuatthai",
  29323. 0x0e03,
  29324. "khokhwaithai",
  29325. 0x0e04,
  29326. "khomutthai",
  29327. 0x0e5b,
  29328. "khook",
  29329. 0x0199,
  29330. "khorakhangthai",
  29331. 0x0e06,
  29332. "khzsquare",
  29333. 0x3391,
  29334. "kihiragana",
  29335. 0x304d,
  29336. "kikatakana",
  29337. 0x30ad,
  29338. "kikatakanahalfwidth",
  29339. 0xff77,
  29340. "kiroguramusquare",
  29341. 0x3315,
  29342. "kiromeetorusquare",
  29343. 0x3316,
  29344. "kirosquare",
  29345. 0x3314,
  29346. "kiyeokacirclekorean",
  29347. 0x326e,
  29348. "kiyeokaparenkorean",
  29349. 0x320e,
  29350. "kiyeokcirclekorean",
  29351. 0x3260,
  29352. "kiyeokkorean",
  29353. 0x3131,
  29354. "kiyeokparenkorean",
  29355. 0x3200,
  29356. "kiyeoksioskorean",
  29357. 0x3133,
  29358. "kjecyrillic",
  29359. 0x045c,
  29360. "klinebelow",
  29361. 0x1e35,
  29362. "klsquare",
  29363. 0x3398,
  29364. "kmcubedsquare",
  29365. 0x33a6,
  29366. "kmonospace",
  29367. 0xff4b,
  29368. "kmsquaredsquare",
  29369. 0x33a2,
  29370. "kohiragana",
  29371. 0x3053,
  29372. "kohmsquare",
  29373. 0x33c0,
  29374. "kokaithai",
  29375. 0x0e01,
  29376. "kokatakana",
  29377. 0x30b3,
  29378. "kokatakanahalfwidth",
  29379. 0xff7a,
  29380. "kooposquare",
  29381. 0x331e,
  29382. "koppacyrillic",
  29383. 0x0481,
  29384. "koreanstandardsymbol",
  29385. 0x327f,
  29386. "koroniscmb",
  29387. 0x0343,
  29388. "kparen",
  29389. 0x24a6,
  29390. "kpasquare",
  29391. 0x33aa,
  29392. "ksicyrillic",
  29393. 0x046f,
  29394. "ktsquare",
  29395. 0x33cf,
  29396. "kturned",
  29397. 0x029e,
  29398. "kuhiragana",
  29399. 0x304f,
  29400. "kukatakana",
  29401. 0x30af,
  29402. "kukatakanahalfwidth",
  29403. 0xff78,
  29404. "kvsquare",
  29405. 0x33b8,
  29406. "kwsquare",
  29407. 0x33be,
  29408. "l",
  29409. 0x006c,
  29410. "labengali",
  29411. 0x09b2,
  29412. "lacute",
  29413. 0x013a,
  29414. "ladeva",
  29415. 0x0932,
  29416. "lagujarati",
  29417. 0x0ab2,
  29418. "lagurmukhi",
  29419. 0x0a32,
  29420. "lakkhangyaothai",
  29421. 0x0e45,
  29422. "lamaleffinalarabic",
  29423. 0xfefc,
  29424. "lamalefhamzaabovefinalarabic",
  29425. 0xfef8,
  29426. "lamalefhamzaaboveisolatedarabic",
  29427. 0xfef7,
  29428. "lamalefhamzabelowfinalarabic",
  29429. 0xfefa,
  29430. "lamalefhamzabelowisolatedarabic",
  29431. 0xfef9,
  29432. "lamalefisolatedarabic",
  29433. 0xfefb,
  29434. "lamalefmaddaabovefinalarabic",
  29435. 0xfef6,
  29436. "lamalefmaddaaboveisolatedarabic",
  29437. 0xfef5,
  29438. "lamarabic",
  29439. 0x0644,
  29440. "lambda",
  29441. 0x03bb,
  29442. "lambdastroke",
  29443. 0x019b,
  29444. "lamed",
  29445. 0x05dc,
  29446. "lameddagesh",
  29447. 0xfb3c,
  29448. "lameddageshhebrew",
  29449. 0xfb3c,
  29450. "lamedhebrew",
  29451. 0x05dc,
  29452. "lamfinalarabic",
  29453. 0xfede,
  29454. "lamhahinitialarabic",
  29455. 0xfcca,
  29456. "laminitialarabic",
  29457. 0xfedf,
  29458. "lamjeeminitialarabic",
  29459. 0xfcc9,
  29460. "lamkhahinitialarabic",
  29461. 0xfccb,
  29462. "lamlamhehisolatedarabic",
  29463. 0xfdf2,
  29464. "lammedialarabic",
  29465. 0xfee0,
  29466. "lammeemhahinitialarabic",
  29467. 0xfd88,
  29468. "lammeeminitialarabic",
  29469. 0xfccc,
  29470. "largecircle",
  29471. 0x25ef,
  29472. "lbar",
  29473. 0x019a,
  29474. "lbelt",
  29475. 0x026c,
  29476. "lbopomofo",
  29477. 0x310c,
  29478. "lcaron",
  29479. 0x013e,
  29480. "lcedilla",
  29481. 0x013c,
  29482. "lcircle",
  29483. 0x24db,
  29484. "lcircumflexbelow",
  29485. 0x1e3d,
  29486. "lcommaaccent",
  29487. 0x013c,
  29488. "ldot",
  29489. 0x0140,
  29490. "ldotaccent",
  29491. 0x0140,
  29492. "ldotbelow",
  29493. 0x1e37,
  29494. "ldotbelowmacron",
  29495. 0x1e39,
  29496. "leftangleabovecmb",
  29497. 0x031a,
  29498. "lefttackbelowcmb",
  29499. 0x0318,
  29500. "less",
  29501. 0x003c,
  29502. "lessequal",
  29503. 0x2264,
  29504. "lessequalorgreater",
  29505. 0x22da,
  29506. "lessmonospace",
  29507. 0xff1c,
  29508. "lessorequivalent",
  29509. 0x2272,
  29510. "lessorgreater",
  29511. 0x2276,
  29512. "lessoverequal",
  29513. 0x2266,
  29514. "lesssmall",
  29515. 0xfe64,
  29516. "lezh",
  29517. 0x026e,
  29518. "lfblock",
  29519. 0x258c,
  29520. "lhookretroflex",
  29521. 0x026d,
  29522. "lira",
  29523. 0x20a4,
  29524. "liwnarmenian",
  29525. 0x056c,
  29526. "lj",
  29527. 0x01c9,
  29528. "ljecyrillic",
  29529. 0x0459,
  29530. "ll",
  29531. 0xf6c0,
  29532. "lladeva",
  29533. 0x0933,
  29534. "llagujarati",
  29535. 0x0ab3,
  29536. "llinebelow",
  29537. 0x1e3b,
  29538. "llladeva",
  29539. 0x0934,
  29540. "llvocalicbengali",
  29541. 0x09e1,
  29542. "llvocalicdeva",
  29543. 0x0961,
  29544. "llvocalicvowelsignbengali",
  29545. 0x09e3,
  29546. "llvocalicvowelsigndeva",
  29547. 0x0963,
  29548. "lmiddletilde",
  29549. 0x026b,
  29550. "lmonospace",
  29551. 0xff4c,
  29552. "lmsquare",
  29553. 0x33d0,
  29554. "lochulathai",
  29555. 0x0e2c,
  29556. "logicaland",
  29557. 0x2227,
  29558. "logicalnot",
  29559. 0x00ac,
  29560. "logicalnotreversed",
  29561. 0x2310,
  29562. "logicalor",
  29563. 0x2228,
  29564. "lolingthai",
  29565. 0x0e25,
  29566. "longs",
  29567. 0x017f,
  29568. "lowlinecenterline",
  29569. 0xfe4e,
  29570. "lowlinecmb",
  29571. 0x0332,
  29572. "lowlinedashed",
  29573. 0xfe4d,
  29574. "lozenge",
  29575. 0x25ca,
  29576. "lparen",
  29577. 0x24a7,
  29578. "lslash",
  29579. 0x0142,
  29580. "lsquare",
  29581. 0x2113,
  29582. "lsuperior",
  29583. 0xf6ee,
  29584. "ltshade",
  29585. 0x2591,
  29586. "luthai",
  29587. 0x0e26,
  29588. "lvocalicbengali",
  29589. 0x098c,
  29590. "lvocalicdeva",
  29591. 0x090c,
  29592. "lvocalicvowelsignbengali",
  29593. 0x09e2,
  29594. "lvocalicvowelsigndeva",
  29595. 0x0962,
  29596. "lxsquare",
  29597. 0x33d3,
  29598. "m",
  29599. 0x006d,
  29600. "mabengali",
  29601. 0x09ae,
  29602. "macron",
  29603. 0x00af,
  29604. "macronbelowcmb",
  29605. 0x0331,
  29606. "macroncmb",
  29607. 0x0304,
  29608. "macronlowmod",
  29609. 0x02cd,
  29610. "macronmonospace",
  29611. 0xffe3,
  29612. "macute",
  29613. 0x1e3f,
  29614. "madeva",
  29615. 0x092e,
  29616. "magujarati",
  29617. 0x0aae,
  29618. "magurmukhi",
  29619. 0x0a2e,
  29620. "mahapakhhebrew",
  29621. 0x05a4,
  29622. "mahapakhlefthebrew",
  29623. 0x05a4,
  29624. "mahiragana",
  29625. 0x307e,
  29626. "maichattawalowleftthai",
  29627. 0xf895,
  29628. "maichattawalowrightthai",
  29629. 0xf894,
  29630. "maichattawathai",
  29631. 0x0e4b,
  29632. "maichattawaupperleftthai",
  29633. 0xf893,
  29634. "maieklowleftthai",
  29635. 0xf88c,
  29636. "maieklowrightthai",
  29637. 0xf88b,
  29638. "maiekthai",
  29639. 0x0e48,
  29640. "maiekupperleftthai",
  29641. 0xf88a,
  29642. "maihanakatleftthai",
  29643. 0xf884,
  29644. "maihanakatthai",
  29645. 0x0e31,
  29646. "maitaikhuleftthai",
  29647. 0xf889,
  29648. "maitaikhuthai",
  29649. 0x0e47,
  29650. "maitholowleftthai",
  29651. 0xf88f,
  29652. "maitholowrightthai",
  29653. 0xf88e,
  29654. "maithothai",
  29655. 0x0e49,
  29656. "maithoupperleftthai",
  29657. 0xf88d,
  29658. "maitrilowleftthai",
  29659. 0xf892,
  29660. "maitrilowrightthai",
  29661. 0xf891,
  29662. "maitrithai",
  29663. 0x0e4a,
  29664. "maitriupperleftthai",
  29665. 0xf890,
  29666. "maiyamokthai",
  29667. 0x0e46,
  29668. "makatakana",
  29669. 0x30de,
  29670. "makatakanahalfwidth",
  29671. 0xff8f,
  29672. "male",
  29673. 0x2642,
  29674. "mansyonsquare",
  29675. 0x3347,
  29676. "maqafhebrew",
  29677. 0x05be,
  29678. "mars",
  29679. 0x2642,
  29680. "masoracirclehebrew",
  29681. 0x05af,
  29682. "masquare",
  29683. 0x3383,
  29684. "mbopomofo",
  29685. 0x3107,
  29686. "mbsquare",
  29687. 0x33d4,
  29688. "mcircle",
  29689. 0x24dc,
  29690. "mcubedsquare",
  29691. 0x33a5,
  29692. "mdotaccent",
  29693. 0x1e41,
  29694. "mdotbelow",
  29695. 0x1e43,
  29696. "meemarabic",
  29697. 0x0645,
  29698. "meemfinalarabic",
  29699. 0xfee2,
  29700. "meeminitialarabic",
  29701. 0xfee3,
  29702. "meemmedialarabic",
  29703. 0xfee4,
  29704. "meemmeeminitialarabic",
  29705. 0xfcd1,
  29706. "meemmeemisolatedarabic",
  29707. 0xfc48,
  29708. "meetorusquare",
  29709. 0x334d,
  29710. "mehiragana",
  29711. 0x3081,
  29712. "meizierasquare",
  29713. 0x337e,
  29714. "mekatakana",
  29715. 0x30e1,
  29716. "mekatakanahalfwidth",
  29717. 0xff92,
  29718. "mem",
  29719. 0x05de,
  29720. "memdagesh",
  29721. 0xfb3e,
  29722. "memdageshhebrew",
  29723. 0xfb3e,
  29724. "memhebrew",
  29725. 0x05de,
  29726. "menarmenian",
  29727. 0x0574,
  29728. "merkhahebrew",
  29729. 0x05a5,
  29730. "merkhakefulahebrew",
  29731. 0x05a6,
  29732. "merkhakefulalefthebrew",
  29733. 0x05a6,
  29734. "merkhalefthebrew",
  29735. 0x05a5,
  29736. "mhook",
  29737. 0x0271,
  29738. "mhzsquare",
  29739. 0x3392,
  29740. "middledotkatakanahalfwidth",
  29741. 0xff65,
  29742. "middot",
  29743. 0x00b7,
  29744. "mieumacirclekorean",
  29745. 0x3272,
  29746. "mieumaparenkorean",
  29747. 0x3212,
  29748. "mieumcirclekorean",
  29749. 0x3264,
  29750. "mieumkorean",
  29751. 0x3141,
  29752. "mieumpansioskorean",
  29753. 0x3170,
  29754. "mieumparenkorean",
  29755. 0x3204,
  29756. "mieumpieupkorean",
  29757. 0x316e,
  29758. "mieumsioskorean",
  29759. 0x316f,
  29760. "mihiragana",
  29761. 0x307f,
  29762. "mikatakana",
  29763. 0x30df,
  29764. "mikatakanahalfwidth",
  29765. 0xff90,
  29766. "minus",
  29767. 0x2212,
  29768. "minusbelowcmb",
  29769. 0x0320,
  29770. "minuscircle",
  29771. 0x2296,
  29772. "minusmod",
  29773. 0x02d7,
  29774. "minusplus",
  29775. 0x2213,
  29776. "minute",
  29777. 0x2032,
  29778. "miribaarusquare",
  29779. 0x334a,
  29780. "mirisquare",
  29781. 0x3349,
  29782. "mlonglegturned",
  29783. 0x0270,
  29784. "mlsquare",
  29785. 0x3396,
  29786. "mmcubedsquare",
  29787. 0x33a3,
  29788. "mmonospace",
  29789. 0xff4d,
  29790. "mmsquaredsquare",
  29791. 0x339f,
  29792. "mohiragana",
  29793. 0x3082,
  29794. "mohmsquare",
  29795. 0x33c1,
  29796. "mokatakana",
  29797. 0x30e2,
  29798. "mokatakanahalfwidth",
  29799. 0xff93,
  29800. "molsquare",
  29801. 0x33d6,
  29802. "momathai",
  29803. 0x0e21,
  29804. "moverssquare",
  29805. 0x33a7,
  29806. "moverssquaredsquare",
  29807. 0x33a8,
  29808. "mparen",
  29809. 0x24a8,
  29810. "mpasquare",
  29811. 0x33ab,
  29812. "mssquare",
  29813. 0x33b3,
  29814. "msuperior",
  29815. 0xf6ef,
  29816. "mturned",
  29817. 0x026f,
  29818. "mu",
  29819. 0x00b5,
  29820. "mu1",
  29821. 0x00b5,
  29822. "muasquare",
  29823. 0x3382,
  29824. "muchgreater",
  29825. 0x226b,
  29826. "muchless",
  29827. 0x226a,
  29828. "mufsquare",
  29829. 0x338c,
  29830. "mugreek",
  29831. 0x03bc,
  29832. "mugsquare",
  29833. 0x338d,
  29834. "muhiragana",
  29835. 0x3080,
  29836. "mukatakana",
  29837. 0x30e0,
  29838. "mukatakanahalfwidth",
  29839. 0xff91,
  29840. "mulsquare",
  29841. 0x3395,
  29842. "multiply",
  29843. 0x00d7,
  29844. "mumsquare",
  29845. 0x339b,
  29846. "munahhebrew",
  29847. 0x05a3,
  29848. "munahlefthebrew",
  29849. 0x05a3,
  29850. "musicalnote",
  29851. 0x266a,
  29852. "musicalnotedbl",
  29853. 0x266b,
  29854. "musicflatsign",
  29855. 0x266d,
  29856. "musicsharpsign",
  29857. 0x266f,
  29858. "mussquare",
  29859. 0x33b2,
  29860. "muvsquare",
  29861. 0x33b6,
  29862. "muwsquare",
  29863. 0x33bc,
  29864. "mvmegasquare",
  29865. 0x33b9,
  29866. "mvsquare",
  29867. 0x33b7,
  29868. "mwmegasquare",
  29869. 0x33bf,
  29870. "mwsquare",
  29871. 0x33bd,
  29872. "n",
  29873. 0x006e,
  29874. "nabengali",
  29875. 0x09a8,
  29876. "nabla",
  29877. 0x2207,
  29878. "nacute",
  29879. 0x0144,
  29880. "nadeva",
  29881. 0x0928,
  29882. "nagujarati",
  29883. 0x0aa8,
  29884. "nagurmukhi",
  29885. 0x0a28,
  29886. "nahiragana",
  29887. 0x306a,
  29888. "nakatakana",
  29889. 0x30ca,
  29890. "nakatakanahalfwidth",
  29891. 0xff85,
  29892. "napostrophe",
  29893. 0x0149,
  29894. "nasquare",
  29895. 0x3381,
  29896. "nbopomofo",
  29897. 0x310b,
  29898. "nbspace",
  29899. 0x00a0,
  29900. "ncaron",
  29901. 0x0148,
  29902. "ncedilla",
  29903. 0x0146,
  29904. "ncircle",
  29905. 0x24dd,
  29906. "ncircumflexbelow",
  29907. 0x1e4b,
  29908. "ncommaaccent",
  29909. 0x0146,
  29910. "ndotaccent",
  29911. 0x1e45,
  29912. "ndotbelow",
  29913. 0x1e47,
  29914. "nehiragana",
  29915. 0x306d,
  29916. "nekatakana",
  29917. 0x30cd,
  29918. "nekatakanahalfwidth",
  29919. 0xff88,
  29920. "newsheqelsign",
  29921. 0x20aa,
  29922. "nfsquare",
  29923. 0x338b,
  29924. "ngabengali",
  29925. 0x0999,
  29926. "ngadeva",
  29927. 0x0919,
  29928. "ngagujarati",
  29929. 0x0a99,
  29930. "ngagurmukhi",
  29931. 0x0a19,
  29932. "ngonguthai",
  29933. 0x0e07,
  29934. "nhiragana",
  29935. 0x3093,
  29936. "nhookleft",
  29937. 0x0272,
  29938. "nhookretroflex",
  29939. 0x0273,
  29940. "nieunacirclekorean",
  29941. 0x326f,
  29942. "nieunaparenkorean",
  29943. 0x320f,
  29944. "nieuncieuckorean",
  29945. 0x3135,
  29946. "nieuncirclekorean",
  29947. 0x3261,
  29948. "nieunhieuhkorean",
  29949. 0x3136,
  29950. "nieunkorean",
  29951. 0x3134,
  29952. "nieunpansioskorean",
  29953. 0x3168,
  29954. "nieunparenkorean",
  29955. 0x3201,
  29956. "nieunsioskorean",
  29957. 0x3167,
  29958. "nieuntikeutkorean",
  29959. 0x3166,
  29960. "nihiragana",
  29961. 0x306b,
  29962. "nikatakana",
  29963. 0x30cb,
  29964. "nikatakanahalfwidth",
  29965. 0xff86,
  29966. "nikhahitleftthai",
  29967. 0xf899,
  29968. "nikhahitthai",
  29969. 0x0e4d,
  29970. "nine",
  29971. 0x0039,
  29972. "ninearabic",
  29973. 0x0669,
  29974. "ninebengali",
  29975. 0x09ef,
  29976. "ninecircle",
  29977. 0x2468,
  29978. "ninecircleinversesansserif",
  29979. 0x2792,
  29980. "ninedeva",
  29981. 0x096f,
  29982. "ninegujarati",
  29983. 0x0aef,
  29984. "ninegurmukhi",
  29985. 0x0a6f,
  29986. "ninehackarabic",
  29987. 0x0669,
  29988. "ninehangzhou",
  29989. 0x3029,
  29990. "nineideographicparen",
  29991. 0x3228,
  29992. "nineinferior",
  29993. 0x2089,
  29994. "ninemonospace",
  29995. 0xff19,
  29996. "nineoldstyle",
  29997. 0xf739,
  29998. "nineparen",
  29999. 0x247c,
  30000. "nineperiod",
  30001. 0x2490,
  30002. "ninepersian",
  30003. 0x06f9,
  30004. "nineroman",
  30005. 0x2178,
  30006. "ninesuperior",
  30007. 0x2079,
  30008. "nineteencircle",
  30009. 0x2472,
  30010. "nineteenparen",
  30011. 0x2486,
  30012. "nineteenperiod",
  30013. 0x249a,
  30014. "ninethai",
  30015. 0x0e59,
  30016. "nj",
  30017. 0x01cc,
  30018. "njecyrillic",
  30019. 0x045a,
  30020. "nkatakana",
  30021. 0x30f3,
  30022. "nkatakanahalfwidth",
  30023. 0xff9d,
  30024. "nlegrightlong",
  30025. 0x019e,
  30026. "nlinebelow",
  30027. 0x1e49,
  30028. "nmonospace",
  30029. 0xff4e,
  30030. "nmsquare",
  30031. 0x339a,
  30032. "nnabengali",
  30033. 0x09a3,
  30034. "nnadeva",
  30035. 0x0923,
  30036. "nnagujarati",
  30037. 0x0aa3,
  30038. "nnagurmukhi",
  30039. 0x0a23,
  30040. "nnnadeva",
  30041. 0x0929,
  30042. "nohiragana",
  30043. 0x306e,
  30044. "nokatakana",
  30045. 0x30ce,
  30046. "nokatakanahalfwidth",
  30047. 0xff89,
  30048. "nonbreakingspace",
  30049. 0x00a0,
  30050. "nonenthai",
  30051. 0x0e13,
  30052. "nonuthai",
  30053. 0x0e19,
  30054. "noonarabic",
  30055. 0x0646,
  30056. "noonfinalarabic",
  30057. 0xfee6,
  30058. "noonghunnaarabic",
  30059. 0x06ba,
  30060. "noonghunnafinalarabic",
  30061. 0xfb9f,
  30062. "nooninitialarabic",
  30063. 0xfee7,
  30064. "noonjeeminitialarabic",
  30065. 0xfcd2,
  30066. "noonjeemisolatedarabic",
  30067. 0xfc4b,
  30068. "noonmedialarabic",
  30069. 0xfee8,
  30070. "noonmeeminitialarabic",
  30071. 0xfcd5,
  30072. "noonmeemisolatedarabic",
  30073. 0xfc4e,
  30074. "noonnoonfinalarabic",
  30075. 0xfc8d,
  30076. "notcontains",
  30077. 0x220c,
  30078. "notelement",
  30079. 0x2209,
  30080. "notelementof",
  30081. 0x2209,
  30082. "notequal",
  30083. 0x2260,
  30084. "notgreater",
  30085. 0x226f,
  30086. "notgreaternorequal",
  30087. 0x2271,
  30088. "notgreaternorless",
  30089. 0x2279,
  30090. "notidentical",
  30091. 0x2262,
  30092. "notless",
  30093. 0x226e,
  30094. "notlessnorequal",
  30095. 0x2270,
  30096. "notparallel",
  30097. 0x2226,
  30098. "notprecedes",
  30099. 0x2280,
  30100. "notsubset",
  30101. 0x2284,
  30102. "notsucceeds",
  30103. 0x2281,
  30104. "notsuperset",
  30105. 0x2285,
  30106. "nowarmenian",
  30107. 0x0576,
  30108. "nparen",
  30109. 0x24a9,
  30110. "nssquare",
  30111. 0x33b1,
  30112. "nsuperior",
  30113. 0x207f,
  30114. "ntilde",
  30115. 0x00f1,
  30116. "nu",
  30117. 0x03bd,
  30118. "nuhiragana",
  30119. 0x306c,
  30120. "nukatakana",
  30121. 0x30cc,
  30122. "nukatakanahalfwidth",
  30123. 0xff87,
  30124. "nuktabengali",
  30125. 0x09bc,
  30126. "nuktadeva",
  30127. 0x093c,
  30128. "nuktagujarati",
  30129. 0x0abc,
  30130. "nuktagurmukhi",
  30131. 0x0a3c,
  30132. "numbersign",
  30133. 0x0023,
  30134. "numbersignmonospace",
  30135. 0xff03,
  30136. "numbersignsmall",
  30137. 0xfe5f,
  30138. "numeralsigngreek",
  30139. 0x0374,
  30140. "numeralsignlowergreek",
  30141. 0x0375,
  30142. "numero",
  30143. 0x2116,
  30144. "nun",
  30145. 0x05e0,
  30146. "nundagesh",
  30147. 0xfb40,
  30148. "nundageshhebrew",
  30149. 0xfb40,
  30150. "nunhebrew",
  30151. 0x05e0,
  30152. "nvsquare",
  30153. 0x33b5,
  30154. "nwsquare",
  30155. 0x33bb,
  30156. "nyabengali",
  30157. 0x099e,
  30158. "nyadeva",
  30159. 0x091e,
  30160. "nyagujarati",
  30161. 0x0a9e,
  30162. "nyagurmukhi",
  30163. 0x0a1e,
  30164. "o",
  30165. 0x006f,
  30166. "oacute",
  30167. 0x00f3,
  30168. "oangthai",
  30169. 0x0e2d,
  30170. "obarred",
  30171. 0x0275,
  30172. "obarredcyrillic",
  30173. 0x04e9,
  30174. "obarreddieresiscyrillic",
  30175. 0x04eb,
  30176. "obengali",
  30177. 0x0993,
  30178. "obopomofo",
  30179. 0x311b,
  30180. "obreve",
  30181. 0x014f,
  30182. "ocandradeva",
  30183. 0x0911,
  30184. "ocandragujarati",
  30185. 0x0a91,
  30186. "ocandravowelsigndeva",
  30187. 0x0949,
  30188. "ocandravowelsigngujarati",
  30189. 0x0ac9,
  30190. "ocaron",
  30191. 0x01d2,
  30192. "ocircle",
  30193. 0x24de,
  30194. "ocircumflex",
  30195. 0x00f4,
  30196. "ocircumflexacute",
  30197. 0x1ed1,
  30198. "ocircumflexdotbelow",
  30199. 0x1ed9,
  30200. "ocircumflexgrave",
  30201. 0x1ed3,
  30202. "ocircumflexhookabove",
  30203. 0x1ed5,
  30204. "ocircumflextilde",
  30205. 0x1ed7,
  30206. "ocyrillic",
  30207. 0x043e,
  30208. "odblacute",
  30209. 0x0151,
  30210. "odblgrave",
  30211. 0x020d,
  30212. "odeva",
  30213. 0x0913,
  30214. "odieresis",
  30215. 0x00f6,
  30216. "odieresiscyrillic",
  30217. 0x04e7,
  30218. "odotbelow",
  30219. 0x1ecd,
  30220. "oe",
  30221. 0x0153,
  30222. "oekorean",
  30223. 0x315a,
  30224. "ogonek",
  30225. 0x02db,
  30226. "ogonekcmb",
  30227. 0x0328,
  30228. "ograve",
  30229. 0x00f2,
  30230. "ogujarati",
  30231. 0x0a93,
  30232. "oharmenian",
  30233. 0x0585,
  30234. "ohiragana",
  30235. 0x304a,
  30236. "ohookabove",
  30237. 0x1ecf,
  30238. "ohorn",
  30239. 0x01a1,
  30240. "ohornacute",
  30241. 0x1edb,
  30242. "ohorndotbelow",
  30243. 0x1ee3,
  30244. "ohorngrave",
  30245. 0x1edd,
  30246. "ohornhookabove",
  30247. 0x1edf,
  30248. "ohorntilde",
  30249. 0x1ee1,
  30250. "ohungarumlaut",
  30251. 0x0151,
  30252. "oi",
  30253. 0x01a3,
  30254. "oinvertedbreve",
  30255. 0x020f,
  30256. "okatakana",
  30257. 0x30aa,
  30258. "okatakanahalfwidth",
  30259. 0xff75,
  30260. "okorean",
  30261. 0x3157,
  30262. "olehebrew",
  30263. 0x05ab,
  30264. "omacron",
  30265. 0x014d,
  30266. "omacronacute",
  30267. 0x1e53,
  30268. "omacrongrave",
  30269. 0x1e51,
  30270. "omdeva",
  30271. 0x0950,
  30272. "omega",
  30273. 0x03c9,
  30274. "omega1",
  30275. 0x03d6,
  30276. "omegacyrillic",
  30277. 0x0461,
  30278. "omegalatinclosed",
  30279. 0x0277,
  30280. "omegaroundcyrillic",
  30281. 0x047b,
  30282. "omegatitlocyrillic",
  30283. 0x047d,
  30284. "omegatonos",
  30285. 0x03ce,
  30286. "omgujarati",
  30287. 0x0ad0,
  30288. "omicron",
  30289. 0x03bf,
  30290. "omicrontonos",
  30291. 0x03cc,
  30292. "omonospace",
  30293. 0xff4f,
  30294. "one",
  30295. 0x0031,
  30296. "onearabic",
  30297. 0x0661,
  30298. "onebengali",
  30299. 0x09e7,
  30300. "onecircle",
  30301. 0x2460,
  30302. "onecircleinversesansserif",
  30303. 0x278a,
  30304. "onedeva",
  30305. 0x0967,
  30306. "onedotenleader",
  30307. 0x2024,
  30308. "oneeighth",
  30309. 0x215b,
  30310. "onefitted",
  30311. 0xf6dc,
  30312. "onegujarati",
  30313. 0x0ae7,
  30314. "onegurmukhi",
  30315. 0x0a67,
  30316. "onehackarabic",
  30317. 0x0661,
  30318. "onehalf",
  30319. 0x00bd,
  30320. "onehangzhou",
  30321. 0x3021,
  30322. "oneideographicparen",
  30323. 0x3220,
  30324. "oneinferior",
  30325. 0x2081,
  30326. "onemonospace",
  30327. 0xff11,
  30328. "onenumeratorbengali",
  30329. 0x09f4,
  30330. "oneoldstyle",
  30331. 0xf731,
  30332. "oneparen",
  30333. 0x2474,
  30334. "oneperiod",
  30335. 0x2488,
  30336. "onepersian",
  30337. 0x06f1,
  30338. "onequarter",
  30339. 0x00bc,
  30340. "oneroman",
  30341. 0x2170,
  30342. "onesuperior",
  30343. 0x00b9,
  30344. "onethai",
  30345. 0x0e51,
  30346. "onethird",
  30347. 0x2153,
  30348. "oogonek",
  30349. 0x01eb,
  30350. "oogonekmacron",
  30351. 0x01ed,
  30352. "oogurmukhi",
  30353. 0x0a13,
  30354. "oomatragurmukhi",
  30355. 0x0a4b,
  30356. "oopen",
  30357. 0x0254,
  30358. "oparen",
  30359. 0x24aa,
  30360. "openbullet",
  30361. 0x25e6,
  30362. "option",
  30363. 0x2325,
  30364. "ordfeminine",
  30365. 0x00aa,
  30366. "ordmasculine",
  30367. 0x00ba,
  30368. "orthogonal",
  30369. 0x221f,
  30370. "oshortdeva",
  30371. 0x0912,
  30372. "oshortvowelsigndeva",
  30373. 0x094a,
  30374. "oslash",
  30375. 0x00f8,
  30376. "oslashacute",
  30377. 0x01ff,
  30378. "osmallhiragana",
  30379. 0x3049,
  30380. "osmallkatakana",
  30381. 0x30a9,
  30382. "osmallkatakanahalfwidth",
  30383. 0xff6b,
  30384. "ostrokeacute",
  30385. 0x01ff,
  30386. "osuperior",
  30387. 0xf6f0,
  30388. "otcyrillic",
  30389. 0x047f,
  30390. "otilde",
  30391. 0x00f5,
  30392. "otildeacute",
  30393. 0x1e4d,
  30394. "otildedieresis",
  30395. 0x1e4f,
  30396. "oubopomofo",
  30397. 0x3121,
  30398. "overline",
  30399. 0x203e,
  30400. "overlinecenterline",
  30401. 0xfe4a,
  30402. "overlinecmb",
  30403. 0x0305,
  30404. "overlinedashed",
  30405. 0xfe49,
  30406. "overlinedblwavy",
  30407. 0xfe4c,
  30408. "overlinewavy",
  30409. 0xfe4b,
  30410. "overscore",
  30411. 0x00af,
  30412. "ovowelsignbengali",
  30413. 0x09cb,
  30414. "ovowelsigndeva",
  30415. 0x094b,
  30416. "ovowelsigngujarati",
  30417. 0x0acb,
  30418. "p",
  30419. 0x0070,
  30420. "paampssquare",
  30421. 0x3380,
  30422. "paasentosquare",
  30423. 0x332b,
  30424. "pabengali",
  30425. 0x09aa,
  30426. "pacute",
  30427. 0x1e55,
  30428. "padeva",
  30429. 0x092a,
  30430. "pagedown",
  30431. 0x21df,
  30432. "pageup",
  30433. 0x21de,
  30434. "pagujarati",
  30435. 0x0aaa,
  30436. "pagurmukhi",
  30437. 0x0a2a,
  30438. "pahiragana",
  30439. 0x3071,
  30440. "paiyannoithai",
  30441. 0x0e2f,
  30442. "pakatakana",
  30443. 0x30d1,
  30444. "palatalizationcyrilliccmb",
  30445. 0x0484,
  30446. "palochkacyrillic",
  30447. 0x04c0,
  30448. "pansioskorean",
  30449. 0x317f,
  30450. "paragraph",
  30451. 0x00b6,
  30452. "parallel",
  30453. 0x2225,
  30454. "parenleft",
  30455. 0x0028,
  30456. "parenleftaltonearabic",
  30457. 0xfd3e,
  30458. "parenleftbt",
  30459. 0xf8ed,
  30460. "parenleftex",
  30461. 0xf8ec,
  30462. "parenleftinferior",
  30463. 0x208d,
  30464. "parenleftmonospace",
  30465. 0xff08,
  30466. "parenleftsmall",
  30467. 0xfe59,
  30468. "parenleftsuperior",
  30469. 0x207d,
  30470. "parenlefttp",
  30471. 0xf8eb,
  30472. "parenleftvertical",
  30473. 0xfe35,
  30474. "parenright",
  30475. 0x0029,
  30476. "parenrightaltonearabic",
  30477. 0xfd3f,
  30478. "parenrightbt",
  30479. 0xf8f8,
  30480. "parenrightex",
  30481. 0xf8f7,
  30482. "parenrightinferior",
  30483. 0x208e,
  30484. "parenrightmonospace",
  30485. 0xff09,
  30486. "parenrightsmall",
  30487. 0xfe5a,
  30488. "parenrightsuperior",
  30489. 0x207e,
  30490. "parenrighttp",
  30491. 0xf8f6,
  30492. "parenrightvertical",
  30493. 0xfe36,
  30494. "partialdiff",
  30495. 0x2202,
  30496. "paseqhebrew",
  30497. 0x05c0,
  30498. "pashtahebrew",
  30499. 0x0599,
  30500. "pasquare",
  30501. 0x33a9,
  30502. "patah",
  30503. 0x05b7,
  30504. "patah11",
  30505. 0x05b7,
  30506. "patah1d",
  30507. 0x05b7,
  30508. "patah2a",
  30509. 0x05b7,
  30510. "patahhebrew",
  30511. 0x05b7,
  30512. "patahnarrowhebrew",
  30513. 0x05b7,
  30514. "patahquarterhebrew",
  30515. 0x05b7,
  30516. "patahwidehebrew",
  30517. 0x05b7,
  30518. "pazerhebrew",
  30519. 0x05a1,
  30520. "pbopomofo",
  30521. 0x3106,
  30522. "pcircle",
  30523. 0x24df,
  30524. "pdotaccent",
  30525. 0x1e57,
  30526. "pe",
  30527. 0x05e4,
  30528. "pecyrillic",
  30529. 0x043f,
  30530. "pedagesh",
  30531. 0xfb44,
  30532. "pedageshhebrew",
  30533. 0xfb44,
  30534. "peezisquare",
  30535. 0x333b,
  30536. "pefinaldageshhebrew",
  30537. 0xfb43,
  30538. "peharabic",
  30539. 0x067e,
  30540. "peharmenian",
  30541. 0x057a,
  30542. "pehebrew",
  30543. 0x05e4,
  30544. "pehfinalarabic",
  30545. 0xfb57,
  30546. "pehinitialarabic",
  30547. 0xfb58,
  30548. "pehiragana",
  30549. 0x307a,
  30550. "pehmedialarabic",
  30551. 0xfb59,
  30552. "pekatakana",
  30553. 0x30da,
  30554. "pemiddlehookcyrillic",
  30555. 0x04a7,
  30556. "perafehebrew",
  30557. 0xfb4e,
  30558. "percent",
  30559. 0x0025,
  30560. "percentarabic",
  30561. 0x066a,
  30562. "percentmonospace",
  30563. 0xff05,
  30564. "percentsmall",
  30565. 0xfe6a,
  30566. "period",
  30567. 0x002e,
  30568. "periodarmenian",
  30569. 0x0589,
  30570. "periodcentered",
  30571. 0x00b7,
  30572. "periodhalfwidth",
  30573. 0xff61,
  30574. "periodinferior",
  30575. 0xf6e7,
  30576. "periodmonospace",
  30577. 0xff0e,
  30578. "periodsmall",
  30579. 0xfe52,
  30580. "periodsuperior",
  30581. 0xf6e8,
  30582. "perispomenigreekcmb",
  30583. 0x0342,
  30584. "perpendicular",
  30585. 0x22a5,
  30586. "perthousand",
  30587. 0x2030,
  30588. "peseta",
  30589. 0x20a7,
  30590. "pfsquare",
  30591. 0x338a,
  30592. "phabengali",
  30593. 0x09ab,
  30594. "phadeva",
  30595. 0x092b,
  30596. "phagujarati",
  30597. 0x0aab,
  30598. "phagurmukhi",
  30599. 0x0a2b,
  30600. "phi",
  30601. 0x03c6,
  30602. "phi1",
  30603. 0x03d5,
  30604. "phieuphacirclekorean",
  30605. 0x327a,
  30606. "phieuphaparenkorean",
  30607. 0x321a,
  30608. "phieuphcirclekorean",
  30609. 0x326c,
  30610. "phieuphkorean",
  30611. 0x314d,
  30612. "phieuphparenkorean",
  30613. 0x320c,
  30614. "philatin",
  30615. 0x0278,
  30616. "phinthuthai",
  30617. 0x0e3a,
  30618. "phisymbolgreek",
  30619. 0x03d5,
  30620. "phook",
  30621. 0x01a5,
  30622. "phophanthai",
  30623. 0x0e1e,
  30624. "phophungthai",
  30625. 0x0e1c,
  30626. "phosamphaothai",
  30627. 0x0e20,
  30628. "pi",
  30629. 0x03c0,
  30630. "pieupacirclekorean",
  30631. 0x3273,
  30632. "pieupaparenkorean",
  30633. 0x3213,
  30634. "pieupcieuckorean",
  30635. 0x3176,
  30636. "pieupcirclekorean",
  30637. 0x3265,
  30638. "pieupkiyeokkorean",
  30639. 0x3172,
  30640. "pieupkorean",
  30641. 0x3142,
  30642. "pieupparenkorean",
  30643. 0x3205,
  30644. "pieupsioskiyeokkorean",
  30645. 0x3174,
  30646. "pieupsioskorean",
  30647. 0x3144,
  30648. "pieupsiostikeutkorean",
  30649. 0x3175,
  30650. "pieupthieuthkorean",
  30651. 0x3177,
  30652. "pieuptikeutkorean",
  30653. 0x3173,
  30654. "pihiragana",
  30655. 0x3074,
  30656. "pikatakana",
  30657. 0x30d4,
  30658. "pisymbolgreek",
  30659. 0x03d6,
  30660. "piwrarmenian",
  30661. 0x0583,
  30662. "plus",
  30663. 0x002b,
  30664. "plusbelowcmb",
  30665. 0x031f,
  30666. "pluscircle",
  30667. 0x2295,
  30668. "plusminus",
  30669. 0x00b1,
  30670. "plusmod",
  30671. 0x02d6,
  30672. "plusmonospace",
  30673. 0xff0b,
  30674. "plussmall",
  30675. 0xfe62,
  30676. "plussuperior",
  30677. 0x207a,
  30678. "pmonospace",
  30679. 0xff50,
  30680. "pmsquare",
  30681. 0x33d8,
  30682. "pohiragana",
  30683. 0x307d,
  30684. "pointingindexdownwhite",
  30685. 0x261f,
  30686. "pointingindexleftwhite",
  30687. 0x261c,
  30688. "pointingindexrightwhite",
  30689. 0x261e,
  30690. "pointingindexupwhite",
  30691. 0x261d,
  30692. "pokatakana",
  30693. 0x30dd,
  30694. "poplathai",
  30695. 0x0e1b,
  30696. "postalmark",
  30697. 0x3012,
  30698. "postalmarkface",
  30699. 0x3020,
  30700. "pparen",
  30701. 0x24ab,
  30702. "precedes",
  30703. 0x227a,
  30704. "prescription",
  30705. 0x211e,
  30706. "primemod",
  30707. 0x02b9,
  30708. "primereversed",
  30709. 0x2035,
  30710. "product",
  30711. 0x220f,
  30712. "projective",
  30713. 0x2305,
  30714. "prolongedkana",
  30715. 0x30fc,
  30716. "propellor",
  30717. 0x2318,
  30718. "propersubset",
  30719. 0x2282,
  30720. "propersuperset",
  30721. 0x2283,
  30722. "proportion",
  30723. 0x2237,
  30724. "proportional",
  30725. 0x221d,
  30726. "psi",
  30727. 0x03c8,
  30728. "psicyrillic",
  30729. 0x0471,
  30730. "psilipneumatacyrilliccmb",
  30731. 0x0486,
  30732. "pssquare",
  30733. 0x33b0,
  30734. "puhiragana",
  30735. 0x3077,
  30736. "pukatakana",
  30737. 0x30d7,
  30738. "pvsquare",
  30739. 0x33b4,
  30740. "pwsquare",
  30741. 0x33ba,
  30742. "q",
  30743. 0x0071,
  30744. "qadeva",
  30745. 0x0958,
  30746. "qadmahebrew",
  30747. 0x05a8,
  30748. "qafarabic",
  30749. 0x0642,
  30750. "qaffinalarabic",
  30751. 0xfed6,
  30752. "qafinitialarabic",
  30753. 0xfed7,
  30754. "qafmedialarabic",
  30755. 0xfed8,
  30756. "qamats",
  30757. 0x05b8,
  30758. "qamats10",
  30759. 0x05b8,
  30760. "qamats1a",
  30761. 0x05b8,
  30762. "qamats1c",
  30763. 0x05b8,
  30764. "qamats27",
  30765. 0x05b8,
  30766. "qamats29",
  30767. 0x05b8,
  30768. "qamats33",
  30769. 0x05b8,
  30770. "qamatsde",
  30771. 0x05b8,
  30772. "qamatshebrew",
  30773. 0x05b8,
  30774. "qamatsnarrowhebrew",
  30775. 0x05b8,
  30776. "qamatsqatanhebrew",
  30777. 0x05b8,
  30778. "qamatsqatannarrowhebrew",
  30779. 0x05b8,
  30780. "qamatsqatanquarterhebrew",
  30781. 0x05b8,
  30782. "qamatsqatanwidehebrew",
  30783. 0x05b8,
  30784. "qamatsquarterhebrew",
  30785. 0x05b8,
  30786. "qamatswidehebrew",
  30787. 0x05b8,
  30788. "qarneyparahebrew",
  30789. 0x059f,
  30790. "qbopomofo",
  30791. 0x3111,
  30792. "qcircle",
  30793. 0x24e0,
  30794. "qhook",
  30795. 0x02a0,
  30796. "qmonospace",
  30797. 0xff51,
  30798. "qof",
  30799. 0x05e7,
  30800. "qofdagesh",
  30801. 0xfb47,
  30802. "qofdageshhebrew",
  30803. 0xfb47,
  30804. "qofhebrew",
  30805. 0x05e7,
  30806. "qparen",
  30807. 0x24ac,
  30808. "quarternote",
  30809. 0x2669,
  30810. "qubuts",
  30811. 0x05bb,
  30812. "qubuts18",
  30813. 0x05bb,
  30814. "qubuts25",
  30815. 0x05bb,
  30816. "qubuts31",
  30817. 0x05bb,
  30818. "qubutshebrew",
  30819. 0x05bb,
  30820. "qubutsnarrowhebrew",
  30821. 0x05bb,
  30822. "qubutsquarterhebrew",
  30823. 0x05bb,
  30824. "qubutswidehebrew",
  30825. 0x05bb,
  30826. "question",
  30827. 0x003f,
  30828. "questionarabic",
  30829. 0x061f,
  30830. "questionarmenian",
  30831. 0x055e,
  30832. "questiondown",
  30833. 0x00bf,
  30834. "questiondownsmall",
  30835. 0xf7bf,
  30836. "questiongreek",
  30837. 0x037e,
  30838. "questionmonospace",
  30839. 0xff1f,
  30840. "questionsmall",
  30841. 0xf73f,
  30842. "quotedbl",
  30843. 0x0022,
  30844. "quotedblbase",
  30845. 0x201e,
  30846. "quotedblleft",
  30847. 0x201c,
  30848. "quotedblmonospace",
  30849. 0xff02,
  30850. "quotedblprime",
  30851. 0x301e,
  30852. "quotedblprimereversed",
  30853. 0x301d,
  30854. "quotedblright",
  30855. 0x201d,
  30856. "quoteleft",
  30857. 0x2018,
  30858. "quoteleftreversed",
  30859. 0x201b,
  30860. "quotereversed",
  30861. 0x201b,
  30862. "quoteright",
  30863. 0x2019,
  30864. "quoterightn",
  30865. 0x0149,
  30866. "quotesinglbase",
  30867. 0x201a,
  30868. "quotesingle",
  30869. 0x0027,
  30870. "quotesinglemonospace",
  30871. 0xff07,
  30872. "r",
  30873. 0x0072,
  30874. "raarmenian",
  30875. 0x057c,
  30876. "rabengali",
  30877. 0x09b0,
  30878. "racute",
  30879. 0x0155,
  30880. "radeva",
  30881. 0x0930,
  30882. "radical",
  30883. 0x221a,
  30884. "radicalex",
  30885. 0xf8e5,
  30886. "radoverssquare",
  30887. 0x33ae,
  30888. "radoverssquaredsquare",
  30889. 0x33af,
  30890. "radsquare",
  30891. 0x33ad,
  30892. "rafe",
  30893. 0x05bf,
  30894. "rafehebrew",
  30895. 0x05bf,
  30896. "ragujarati",
  30897. 0x0ab0,
  30898. "ragurmukhi",
  30899. 0x0a30,
  30900. "rahiragana",
  30901. 0x3089,
  30902. "rakatakana",
  30903. 0x30e9,
  30904. "rakatakanahalfwidth",
  30905. 0xff97,
  30906. "ralowerdiagonalbengali",
  30907. 0x09f1,
  30908. "ramiddlediagonalbengali",
  30909. 0x09f0,
  30910. "ramshorn",
  30911. 0x0264,
  30912. "ratio",
  30913. 0x2236,
  30914. "rbopomofo",
  30915. 0x3116,
  30916. "rcaron",
  30917. 0x0159,
  30918. "rcedilla",
  30919. 0x0157,
  30920. "rcircle",
  30921. 0x24e1,
  30922. "rcommaaccent",
  30923. 0x0157,
  30924. "rdblgrave",
  30925. 0x0211,
  30926. "rdotaccent",
  30927. 0x1e59,
  30928. "rdotbelow",
  30929. 0x1e5b,
  30930. "rdotbelowmacron",
  30931. 0x1e5d,
  30932. "referencemark",
  30933. 0x203b,
  30934. "reflexsubset",
  30935. 0x2286,
  30936. "reflexsuperset",
  30937. 0x2287,
  30938. "registered",
  30939. 0x00ae,
  30940. "registersans",
  30941. 0xf8e8,
  30942. "registerserif",
  30943. 0xf6da,
  30944. "reharabic",
  30945. 0x0631,
  30946. "reharmenian",
  30947. 0x0580,
  30948. "rehfinalarabic",
  30949. 0xfeae,
  30950. "rehiragana",
  30951. 0x308c,
  30952. "rekatakana",
  30953. 0x30ec,
  30954. "rekatakanahalfwidth",
  30955. 0xff9a,
  30956. "resh",
  30957. 0x05e8,
  30958. "reshdageshhebrew",
  30959. 0xfb48,
  30960. "reshhebrew",
  30961. 0x05e8,
  30962. "reversedtilde",
  30963. 0x223d,
  30964. "reviahebrew",
  30965. 0x0597,
  30966. "reviamugrashhebrew",
  30967. 0x0597,
  30968. "revlogicalnot",
  30969. 0x2310,
  30970. "rfishhook",
  30971. 0x027e,
  30972. "rfishhookreversed",
  30973. 0x027f,
  30974. "rhabengali",
  30975. 0x09dd,
  30976. "rhadeva",
  30977. 0x095d,
  30978. "rho",
  30979. 0x03c1,
  30980. "rhook",
  30981. 0x027d,
  30982. "rhookturned",
  30983. 0x027b,
  30984. "rhookturnedsuperior",
  30985. 0x02b5,
  30986. "rhosymbolgreek",
  30987. 0x03f1,
  30988. "rhotichookmod",
  30989. 0x02de,
  30990. "rieulacirclekorean",
  30991. 0x3271,
  30992. "rieulaparenkorean",
  30993. 0x3211,
  30994. "rieulcirclekorean",
  30995. 0x3263,
  30996. "rieulhieuhkorean",
  30997. 0x3140,
  30998. "rieulkiyeokkorean",
  30999. 0x313a,
  31000. "rieulkiyeoksioskorean",
  31001. 0x3169,
  31002. "rieulkorean",
  31003. 0x3139,
  31004. "rieulmieumkorean",
  31005. 0x313b,
  31006. "rieulpansioskorean",
  31007. 0x316c,
  31008. "rieulparenkorean",
  31009. 0x3203,
  31010. "rieulphieuphkorean",
  31011. 0x313f,
  31012. "rieulpieupkorean",
  31013. 0x313c,
  31014. "rieulpieupsioskorean",
  31015. 0x316b,
  31016. "rieulsioskorean",
  31017. 0x313d,
  31018. "rieulthieuthkorean",
  31019. 0x313e,
  31020. "rieultikeutkorean",
  31021. 0x316a,
  31022. "rieulyeorinhieuhkorean",
  31023. 0x316d,
  31024. "rightangle",
  31025. 0x221f,
  31026. "righttackbelowcmb",
  31027. 0x0319,
  31028. "righttriangle",
  31029. 0x22bf,
  31030. "rihiragana",
  31031. 0x308a,
  31032. "rikatakana",
  31033. 0x30ea,
  31034. "rikatakanahalfwidth",
  31035. 0xff98,
  31036. "ring",
  31037. 0x02da,
  31038. "ringbelowcmb",
  31039. 0x0325,
  31040. "ringcmb",
  31041. 0x030a,
  31042. "ringhalfleft",
  31043. 0x02bf,
  31044. "ringhalfleftarmenian",
  31045. 0x0559,
  31046. "ringhalfleftbelowcmb",
  31047. 0x031c,
  31048. "ringhalfleftcentered",
  31049. 0x02d3,
  31050. "ringhalfright",
  31051. 0x02be,
  31052. "ringhalfrightbelowcmb",
  31053. 0x0339,
  31054. "ringhalfrightcentered",
  31055. 0x02d2,
  31056. "rinvertedbreve",
  31057. 0x0213,
  31058. "rittorusquare",
  31059. 0x3351,
  31060. "rlinebelow",
  31061. 0x1e5f,
  31062. "rlongleg",
  31063. 0x027c,
  31064. "rlonglegturned",
  31065. 0x027a,
  31066. "rmonospace",
  31067. 0xff52,
  31068. "rohiragana",
  31069. 0x308d,
  31070. "rokatakana",
  31071. 0x30ed,
  31072. "rokatakanahalfwidth",
  31073. 0xff9b,
  31074. "roruathai",
  31075. 0x0e23,
  31076. "rparen",
  31077. 0x24ad,
  31078. "rrabengali",
  31079. 0x09dc,
  31080. "rradeva",
  31081. 0x0931,
  31082. "rragurmukhi",
  31083. 0x0a5c,
  31084. "rreharabic",
  31085. 0x0691,
  31086. "rrehfinalarabic",
  31087. 0xfb8d,
  31088. "rrvocalicbengali",
  31089. 0x09e0,
  31090. "rrvocalicdeva",
  31091. 0x0960,
  31092. "rrvocalicgujarati",
  31093. 0x0ae0,
  31094. "rrvocalicvowelsignbengali",
  31095. 0x09c4,
  31096. "rrvocalicvowelsigndeva",
  31097. 0x0944,
  31098. "rrvocalicvowelsigngujarati",
  31099. 0x0ac4,
  31100. "rsuperior",
  31101. 0xf6f1,
  31102. "rtblock",
  31103. 0x2590,
  31104. "rturned",
  31105. 0x0279,
  31106. "rturnedsuperior",
  31107. 0x02b4,
  31108. "ruhiragana",
  31109. 0x308b,
  31110. "rukatakana",
  31111. 0x30eb,
  31112. "rukatakanahalfwidth",
  31113. 0xff99,
  31114. "rupeemarkbengali",
  31115. 0x09f2,
  31116. "rupeesignbengali",
  31117. 0x09f3,
  31118. "rupiah",
  31119. 0xf6dd,
  31120. "ruthai",
  31121. 0x0e24,
  31122. "rvocalicbengali",
  31123. 0x098b,
  31124. "rvocalicdeva",
  31125. 0x090b,
  31126. "rvocalicgujarati",
  31127. 0x0a8b,
  31128. "rvocalicvowelsignbengali",
  31129. 0x09c3,
  31130. "rvocalicvowelsigndeva",
  31131. 0x0943,
  31132. "rvocalicvowelsigngujarati",
  31133. 0x0ac3,
  31134. "s",
  31135. 0x0073,
  31136. "sabengali",
  31137. 0x09b8,
  31138. "sacute",
  31139. 0x015b,
  31140. "sacutedotaccent",
  31141. 0x1e65,
  31142. "sadarabic",
  31143. 0x0635,
  31144. "sadeva",
  31145. 0x0938,
  31146. "sadfinalarabic",
  31147. 0xfeba,
  31148. "sadinitialarabic",
  31149. 0xfebb,
  31150. "sadmedialarabic",
  31151. 0xfebc,
  31152. "sagujarati",
  31153. 0x0ab8,
  31154. "sagurmukhi",
  31155. 0x0a38,
  31156. "sahiragana",
  31157. 0x3055,
  31158. "sakatakana",
  31159. 0x30b5,
  31160. "sakatakanahalfwidth",
  31161. 0xff7b,
  31162. "sallallahoualayhewasallamarabic",
  31163. 0xfdfa,
  31164. "samekh",
  31165. 0x05e1,
  31166. "samekhdagesh",
  31167. 0xfb41,
  31168. "samekhdageshhebrew",
  31169. 0xfb41,
  31170. "samekhhebrew",
  31171. 0x05e1,
  31172. "saraaathai",
  31173. 0x0e32,
  31174. "saraaethai",
  31175. 0x0e41,
  31176. "saraaimaimalaithai",
  31177. 0x0e44,
  31178. "saraaimaimuanthai",
  31179. 0x0e43,
  31180. "saraamthai",
  31181. 0x0e33,
  31182. "saraathai",
  31183. 0x0e30,
  31184. "saraethai",
  31185. 0x0e40,
  31186. "saraiileftthai",
  31187. 0xf886,
  31188. "saraiithai",
  31189. 0x0e35,
  31190. "saraileftthai",
  31191. 0xf885,
  31192. "saraithai",
  31193. 0x0e34,
  31194. "saraothai",
  31195. 0x0e42,
  31196. "saraueeleftthai",
  31197. 0xf888,
  31198. "saraueethai",
  31199. 0x0e37,
  31200. "saraueleftthai",
  31201. 0xf887,
  31202. "sarauethai",
  31203. 0x0e36,
  31204. "sarauthai",
  31205. 0x0e38,
  31206. "sarauuthai",
  31207. 0x0e39,
  31208. "sbopomofo",
  31209. 0x3119,
  31210. "scaron",
  31211. 0x0161,
  31212. "scarondotaccent",
  31213. 0x1e67,
  31214. "scedilla",
  31215. 0x015f,
  31216. "schwa",
  31217. 0x0259,
  31218. "schwacyrillic",
  31219. 0x04d9,
  31220. "schwadieresiscyrillic",
  31221. 0x04db,
  31222. "schwahook",
  31223. 0x025a,
  31224. "scircle",
  31225. 0x24e2,
  31226. "scircumflex",
  31227. 0x015d,
  31228. "scommaaccent",
  31229. 0x0219,
  31230. "sdotaccent",
  31231. 0x1e61,
  31232. "sdotbelow",
  31233. 0x1e63,
  31234. "sdotbelowdotaccent",
  31235. 0x1e69,
  31236. "seagullbelowcmb",
  31237. 0x033c,
  31238. "second",
  31239. 0x2033,
  31240. "secondtonechinese",
  31241. 0x02ca,
  31242. "section",
  31243. 0x00a7,
  31244. "seenarabic",
  31245. 0x0633,
  31246. "seenfinalarabic",
  31247. 0xfeb2,
  31248. "seeninitialarabic",
  31249. 0xfeb3,
  31250. "seenmedialarabic",
  31251. 0xfeb4,
  31252. "segol",
  31253. 0x05b6,
  31254. "segol13",
  31255. 0x05b6,
  31256. "segol1f",
  31257. 0x05b6,
  31258. "segol2c",
  31259. 0x05b6,
  31260. "segolhebrew",
  31261. 0x05b6,
  31262. "segolnarrowhebrew",
  31263. 0x05b6,
  31264. "segolquarterhebrew",
  31265. 0x05b6,
  31266. "segoltahebrew",
  31267. 0x0592,
  31268. "segolwidehebrew",
  31269. 0x05b6,
  31270. "seharmenian",
  31271. 0x057d,
  31272. "sehiragana",
  31273. 0x305b,
  31274. "sekatakana",
  31275. 0x30bb,
  31276. "sekatakanahalfwidth",
  31277. 0xff7e,
  31278. "semicolon",
  31279. 0x003b,
  31280. "semicolonarabic",
  31281. 0x061b,
  31282. "semicolonmonospace",
  31283. 0xff1b,
  31284. "semicolonsmall",
  31285. 0xfe54,
  31286. "semivoicedmarkkana",
  31287. 0x309c,
  31288. "semivoicedmarkkanahalfwidth",
  31289. 0xff9f,
  31290. "sentisquare",
  31291. 0x3322,
  31292. "sentosquare",
  31293. 0x3323,
  31294. "seven",
  31295. 0x0037,
  31296. "sevenarabic",
  31297. 0x0667,
  31298. "sevenbengali",
  31299. 0x09ed,
  31300. "sevencircle",
  31301. 0x2466,
  31302. "sevencircleinversesansserif",
  31303. 0x2790,
  31304. "sevendeva",
  31305. 0x096d,
  31306. "seveneighths",
  31307. 0x215e,
  31308. "sevengujarati",
  31309. 0x0aed,
  31310. "sevengurmukhi",
  31311. 0x0a6d,
  31312. "sevenhackarabic",
  31313. 0x0667,
  31314. "sevenhangzhou",
  31315. 0x3027,
  31316. "sevenideographicparen",
  31317. 0x3226,
  31318. "seveninferior",
  31319. 0x2087,
  31320. "sevenmonospace",
  31321. 0xff17,
  31322. "sevenoldstyle",
  31323. 0xf737,
  31324. "sevenparen",
  31325. 0x247a,
  31326. "sevenperiod",
  31327. 0x248e,
  31328. "sevenpersian",
  31329. 0x06f7,
  31330. "sevenroman",
  31331. 0x2176,
  31332. "sevensuperior",
  31333. 0x2077,
  31334. "seventeencircle",
  31335. 0x2470,
  31336. "seventeenparen",
  31337. 0x2484,
  31338. "seventeenperiod",
  31339. 0x2498,
  31340. "seventhai",
  31341. 0x0e57,
  31342. "sfthyphen",
  31343. 0x00ad,
  31344. "shaarmenian",
  31345. 0x0577,
  31346. "shabengali",
  31347. 0x09b6,
  31348. "shacyrillic",
  31349. 0x0448,
  31350. "shaddaarabic",
  31351. 0x0651,
  31352. "shaddadammaarabic",
  31353. 0xfc61,
  31354. "shaddadammatanarabic",
  31355. 0xfc5e,
  31356. "shaddafathaarabic",
  31357. 0xfc60,
  31358. "shaddakasraarabic",
  31359. 0xfc62,
  31360. "shaddakasratanarabic",
  31361. 0xfc5f,
  31362. "shade",
  31363. 0x2592,
  31364. "shadedark",
  31365. 0x2593,
  31366. "shadelight",
  31367. 0x2591,
  31368. "shademedium",
  31369. 0x2592,
  31370. "shadeva",
  31371. 0x0936,
  31372. "shagujarati",
  31373. 0x0ab6,
  31374. "shagurmukhi",
  31375. 0x0a36,
  31376. "shalshelethebrew",
  31377. 0x0593,
  31378. "shbopomofo",
  31379. 0x3115,
  31380. "shchacyrillic",
  31381. 0x0449,
  31382. "sheenarabic",
  31383. 0x0634,
  31384. "sheenfinalarabic",
  31385. 0xfeb6,
  31386. "sheeninitialarabic",
  31387. 0xfeb7,
  31388. "sheenmedialarabic",
  31389. 0xfeb8,
  31390. "sheicoptic",
  31391. 0x03e3,
  31392. "sheqel",
  31393. 0x20aa,
  31394. "sheqelhebrew",
  31395. 0x20aa,
  31396. "sheva",
  31397. 0x05b0,
  31398. "sheva115",
  31399. 0x05b0,
  31400. "sheva15",
  31401. 0x05b0,
  31402. "sheva22",
  31403. 0x05b0,
  31404. "sheva2e",
  31405. 0x05b0,
  31406. "shevahebrew",
  31407. 0x05b0,
  31408. "shevanarrowhebrew",
  31409. 0x05b0,
  31410. "shevaquarterhebrew",
  31411. 0x05b0,
  31412. "shevawidehebrew",
  31413. 0x05b0,
  31414. "shhacyrillic",
  31415. 0x04bb,
  31416. "shimacoptic",
  31417. 0x03ed,
  31418. "shin",
  31419. 0x05e9,
  31420. "shindagesh",
  31421. 0xfb49,
  31422. "shindageshhebrew",
  31423. 0xfb49,
  31424. "shindageshshindot",
  31425. 0xfb2c,
  31426. "shindageshshindothebrew",
  31427. 0xfb2c,
  31428. "shindageshsindot",
  31429. 0xfb2d,
  31430. "shindageshsindothebrew",
  31431. 0xfb2d,
  31432. "shindothebrew",
  31433. 0x05c1,
  31434. "shinhebrew",
  31435. 0x05e9,
  31436. "shinshindot",
  31437. 0xfb2a,
  31438. "shinshindothebrew",
  31439. 0xfb2a,
  31440. "shinsindot",
  31441. 0xfb2b,
  31442. "shinsindothebrew",
  31443. 0xfb2b,
  31444. "shook",
  31445. 0x0282,
  31446. "sigma",
  31447. 0x03c3,
  31448. "sigma1",
  31449. 0x03c2,
  31450. "sigmafinal",
  31451. 0x03c2,
  31452. "sigmalunatesymbolgreek",
  31453. 0x03f2,
  31454. "sihiragana",
  31455. 0x3057,
  31456. "sikatakana",
  31457. 0x30b7,
  31458. "sikatakanahalfwidth",
  31459. 0xff7c,
  31460. "siluqhebrew",
  31461. 0x05bd,
  31462. "siluqlefthebrew",
  31463. 0x05bd,
  31464. "similar",
  31465. 0x223c,
  31466. "sindothebrew",
  31467. 0x05c2,
  31468. "siosacirclekorean",
  31469. 0x3274,
  31470. "siosaparenkorean",
  31471. 0x3214,
  31472. "sioscieuckorean",
  31473. 0x317e,
  31474. "sioscirclekorean",
  31475. 0x3266,
  31476. "sioskiyeokkorean",
  31477. 0x317a,
  31478. "sioskorean",
  31479. 0x3145,
  31480. "siosnieunkorean",
  31481. 0x317b,
  31482. "siosparenkorean",
  31483. 0x3206,
  31484. "siospieupkorean",
  31485. 0x317d,
  31486. "siostikeutkorean",
  31487. 0x317c,
  31488. "six",
  31489. 0x0036,
  31490. "sixarabic",
  31491. 0x0666,
  31492. "sixbengali",
  31493. 0x09ec,
  31494. "sixcircle",
  31495. 0x2465,
  31496. "sixcircleinversesansserif",
  31497. 0x278f,
  31498. "sixdeva",
  31499. 0x096c,
  31500. "sixgujarati",
  31501. 0x0aec,
  31502. "sixgurmukhi",
  31503. 0x0a6c,
  31504. "sixhackarabic",
  31505. 0x0666,
  31506. "sixhangzhou",
  31507. 0x3026,
  31508. "sixideographicparen",
  31509. 0x3225,
  31510. "sixinferior",
  31511. 0x2086,
  31512. "sixmonospace",
  31513. 0xff16,
  31514. "sixoldstyle",
  31515. 0xf736,
  31516. "sixparen",
  31517. 0x2479,
  31518. "sixperiod",
  31519. 0x248d,
  31520. "sixpersian",
  31521. 0x06f6,
  31522. "sixroman",
  31523. 0x2175,
  31524. "sixsuperior",
  31525. 0x2076,
  31526. "sixteencircle",
  31527. 0x246f,
  31528. "sixteencurrencydenominatorbengali",
  31529. 0x09f9,
  31530. "sixteenparen",
  31531. 0x2483,
  31532. "sixteenperiod",
  31533. 0x2497,
  31534. "sixthai",
  31535. 0x0e56,
  31536. "slash",
  31537. 0x002f,
  31538. "slashmonospace",
  31539. 0xff0f,
  31540. "slong",
  31541. 0x017f,
  31542. "slongdotaccent",
  31543. 0x1e9b,
  31544. "smileface",
  31545. 0x263a,
  31546. "smonospace",
  31547. 0xff53,
  31548. "sofpasuqhebrew",
  31549. 0x05c3,
  31550. "softhyphen",
  31551. 0x00ad,
  31552. "softsigncyrillic",
  31553. 0x044c,
  31554. "sohiragana",
  31555. 0x305d,
  31556. "sokatakana",
  31557. 0x30bd,
  31558. "sokatakanahalfwidth",
  31559. 0xff7f,
  31560. "soliduslongoverlaycmb",
  31561. 0x0338,
  31562. "solidusshortoverlaycmb",
  31563. 0x0337,
  31564. "sorusithai",
  31565. 0x0e29,
  31566. "sosalathai",
  31567. 0x0e28,
  31568. "sosothai",
  31569. 0x0e0b,
  31570. "sosuathai",
  31571. 0x0e2a,
  31572. "space",
  31573. 0x0020,
  31574. "spacehackarabic",
  31575. 0x0020,
  31576. "spade",
  31577. 0x2660,
  31578. "spadesuitblack",
  31579. 0x2660,
  31580. "spadesuitwhite",
  31581. 0x2664,
  31582. "sparen",
  31583. 0x24ae,
  31584. "squarebelowcmb",
  31585. 0x033b,
  31586. "squarecc",
  31587. 0x33c4,
  31588. "squarecm",
  31589. 0x339d,
  31590. "squarediagonalcrosshatchfill",
  31591. 0x25a9,
  31592. "squarehorizontalfill",
  31593. 0x25a4,
  31594. "squarekg",
  31595. 0x338f,
  31596. "squarekm",
  31597. 0x339e,
  31598. "squarekmcapital",
  31599. 0x33ce,
  31600. "squareln",
  31601. 0x33d1,
  31602. "squarelog",
  31603. 0x33d2,
  31604. "squaremg",
  31605. 0x338e,
  31606. "squaremil",
  31607. 0x33d5,
  31608. "squaremm",
  31609. 0x339c,
  31610. "squaremsquared",
  31611. 0x33a1,
  31612. "squareorthogonalcrosshatchfill",
  31613. 0x25a6,
  31614. "squareupperlefttolowerrightfill",
  31615. 0x25a7,
  31616. "squareupperrighttolowerleftfill",
  31617. 0x25a8,
  31618. "squareverticalfill",
  31619. 0x25a5,
  31620. "squarewhitewithsmallblack",
  31621. 0x25a3,
  31622. "srsquare",
  31623. 0x33db,
  31624. "ssabengali",
  31625. 0x09b7,
  31626. "ssadeva",
  31627. 0x0937,
  31628. "ssagujarati",
  31629. 0x0ab7,
  31630. "ssangcieuckorean",
  31631. 0x3149,
  31632. "ssanghieuhkorean",
  31633. 0x3185,
  31634. "ssangieungkorean",
  31635. 0x3180,
  31636. "ssangkiyeokkorean",
  31637. 0x3132,
  31638. "ssangnieunkorean",
  31639. 0x3165,
  31640. "ssangpieupkorean",
  31641. 0x3143,
  31642. "ssangsioskorean",
  31643. 0x3146,
  31644. "ssangtikeutkorean",
  31645. 0x3138,
  31646. "ssuperior",
  31647. 0xf6f2,
  31648. "sterling",
  31649. 0x00a3,
  31650. "sterlingmonospace",
  31651. 0xffe1,
  31652. "strokelongoverlaycmb",
  31653. 0x0336,
  31654. "strokeshortoverlaycmb",
  31655. 0x0335,
  31656. "subset",
  31657. 0x2282,
  31658. "subsetnotequal",
  31659. 0x228a,
  31660. "subsetorequal",
  31661. 0x2286,
  31662. "succeeds",
  31663. 0x227b,
  31664. "suchthat",
  31665. 0x220b,
  31666. "suhiragana",
  31667. 0x3059,
  31668. "sukatakana",
  31669. 0x30b9,
  31670. "sukatakanahalfwidth",
  31671. 0xff7d,
  31672. "sukunarabic",
  31673. 0x0652,
  31674. "summation",
  31675. 0x2211,
  31676. "sun",
  31677. 0x263c,
  31678. "superset",
  31679. 0x2283,
  31680. "supersetnotequal",
  31681. 0x228b,
  31682. "supersetorequal",
  31683. 0x2287,
  31684. "svsquare",
  31685. 0x33dc,
  31686. "syouwaerasquare",
  31687. 0x337c,
  31688. "t",
  31689. 0x0074,
  31690. "tabengali",
  31691. 0x09a4,
  31692. "tackdown",
  31693. 0x22a4,
  31694. "tackleft",
  31695. 0x22a3,
  31696. "tadeva",
  31697. 0x0924,
  31698. "tagujarati",
  31699. 0x0aa4,
  31700. "tagurmukhi",
  31701. 0x0a24,
  31702. "taharabic",
  31703. 0x0637,
  31704. "tahfinalarabic",
  31705. 0xfec2,
  31706. "tahinitialarabic",
  31707. 0xfec3,
  31708. "tahiragana",
  31709. 0x305f,
  31710. "tahmedialarabic",
  31711. 0xfec4,
  31712. "taisyouerasquare",
  31713. 0x337d,
  31714. "takatakana",
  31715. 0x30bf,
  31716. "takatakanahalfwidth",
  31717. 0xff80,
  31718. "tatweelarabic",
  31719. 0x0640,
  31720. "tau",
  31721. 0x03c4,
  31722. "tav",
  31723. 0x05ea,
  31724. "tavdages",
  31725. 0xfb4a,
  31726. "tavdagesh",
  31727. 0xfb4a,
  31728. "tavdageshhebrew",
  31729. 0xfb4a,
  31730. "tavhebrew",
  31731. 0x05ea,
  31732. "tbar",
  31733. 0x0167,
  31734. "tbopomofo",
  31735. 0x310a,
  31736. "tcaron",
  31737. 0x0165,
  31738. "tccurl",
  31739. 0x02a8,
  31740. "tcedilla",
  31741. 0x0163,
  31742. "tcheharabic",
  31743. 0x0686,
  31744. "tchehfinalarabic",
  31745. 0xfb7b,
  31746. "tchehinitialarabic",
  31747. 0xfb7c,
  31748. "tchehmedialarabic",
  31749. 0xfb7d,
  31750. "tcircle",
  31751. 0x24e3,
  31752. "tcircumflexbelow",
  31753. 0x1e71,
  31754. "tcommaaccent",
  31755. 0x0163,
  31756. "tdieresis",
  31757. 0x1e97,
  31758. "tdotaccent",
  31759. 0x1e6b,
  31760. "tdotbelow",
  31761. 0x1e6d,
  31762. "tecyrillic",
  31763. 0x0442,
  31764. "tedescendercyrillic",
  31765. 0x04ad,
  31766. "teharabic",
  31767. 0x062a,
  31768. "tehfinalarabic",
  31769. 0xfe96,
  31770. "tehhahinitialarabic",
  31771. 0xfca2,
  31772. "tehhahisolatedarabic",
  31773. 0xfc0c,
  31774. "tehinitialarabic",
  31775. 0xfe97,
  31776. "tehiragana",
  31777. 0x3066,
  31778. "tehjeeminitialarabic",
  31779. 0xfca1,
  31780. "tehjeemisolatedarabic",
  31781. 0xfc0b,
  31782. "tehmarbutaarabic",
  31783. 0x0629,
  31784. "tehmarbutafinalarabic",
  31785. 0xfe94,
  31786. "tehmedialarabic",
  31787. 0xfe98,
  31788. "tehmeeminitialarabic",
  31789. 0xfca4,
  31790. "tehmeemisolatedarabic",
  31791. 0xfc0e,
  31792. "tehnoonfinalarabic",
  31793. 0xfc73,
  31794. "tekatakana",
  31795. 0x30c6,
  31796. "tekatakanahalfwidth",
  31797. 0xff83,
  31798. "telephone",
  31799. 0x2121,
  31800. "telephoneblack",
  31801. 0x260e,
  31802. "telishagedolahebrew",
  31803. 0x05a0,
  31804. "telishaqetanahebrew",
  31805. 0x05a9,
  31806. "tencircle",
  31807. 0x2469,
  31808. "tenideographicparen",
  31809. 0x3229,
  31810. "tenparen",
  31811. 0x247d,
  31812. "tenperiod",
  31813. 0x2491,
  31814. "tenroman",
  31815. 0x2179,
  31816. "tesh",
  31817. 0x02a7,
  31818. "tet",
  31819. 0x05d8,
  31820. "tetdagesh",
  31821. 0xfb38,
  31822. "tetdageshhebrew",
  31823. 0xfb38,
  31824. "tethebrew",
  31825. 0x05d8,
  31826. "tetsecyrillic",
  31827. 0x04b5,
  31828. "tevirhebrew",
  31829. 0x059b,
  31830. "tevirlefthebrew",
  31831. 0x059b,
  31832. "thabengali",
  31833. 0x09a5,
  31834. "thadeva",
  31835. 0x0925,
  31836. "thagujarati",
  31837. 0x0aa5,
  31838. "thagurmukhi",
  31839. 0x0a25,
  31840. "thalarabic",
  31841. 0x0630,
  31842. "thalfinalarabic",
  31843. 0xfeac,
  31844. "thanthakhatlowleftthai",
  31845. 0xf898,
  31846. "thanthakhatlowrightthai",
  31847. 0xf897,
  31848. "thanthakhatthai",
  31849. 0x0e4c,
  31850. "thanthakhatupperleftthai",
  31851. 0xf896,
  31852. "theharabic",
  31853. 0x062b,
  31854. "thehfinalarabic",
  31855. 0xfe9a,
  31856. "thehinitialarabic",
  31857. 0xfe9b,
  31858. "thehmedialarabic",
  31859. 0xfe9c,
  31860. "thereexists",
  31861. 0x2203,
  31862. "therefore",
  31863. 0x2234,
  31864. "theta",
  31865. 0x03b8,
  31866. "theta1",
  31867. 0x03d1,
  31868. "thetasymbolgreek",
  31869. 0x03d1,
  31870. "thieuthacirclekorean",
  31871. 0x3279,
  31872. "thieuthaparenkorean",
  31873. 0x3219,
  31874. "thieuthcirclekorean",
  31875. 0x326b,
  31876. "thieuthkorean",
  31877. 0x314c,
  31878. "thieuthparenkorean",
  31879. 0x320b,
  31880. "thirteencircle",
  31881. 0x246c,
  31882. "thirteenparen",
  31883. 0x2480,
  31884. "thirteenperiod",
  31885. 0x2494,
  31886. "thonangmonthothai",
  31887. 0x0e11,
  31888. "thook",
  31889. 0x01ad,
  31890. "thophuthaothai",
  31891. 0x0e12,
  31892. "thorn",
  31893. 0x00fe,
  31894. "thothahanthai",
  31895. 0x0e17,
  31896. "thothanthai",
  31897. 0x0e10,
  31898. "thothongthai",
  31899. 0x0e18,
  31900. "thothungthai",
  31901. 0x0e16,
  31902. "thousandcyrillic",
  31903. 0x0482,
  31904. "thousandsseparatorarabic",
  31905. 0x066c,
  31906. "thousandsseparatorpersian",
  31907. 0x066c,
  31908. "three",
  31909. 0x0033,
  31910. "threearabic",
  31911. 0x0663,
  31912. "threebengali",
  31913. 0x09e9,
  31914. "threecircle",
  31915. 0x2462,
  31916. "threecircleinversesansserif",
  31917. 0x278c,
  31918. "threedeva",
  31919. 0x0969,
  31920. "threeeighths",
  31921. 0x215c,
  31922. "threegujarati",
  31923. 0x0ae9,
  31924. "threegurmukhi",
  31925. 0x0a69,
  31926. "threehackarabic",
  31927. 0x0663,
  31928. "threehangzhou",
  31929. 0x3023,
  31930. "threeideographicparen",
  31931. 0x3222,
  31932. "threeinferior",
  31933. 0x2083,
  31934. "threemonospace",
  31935. 0xff13,
  31936. "threenumeratorbengali",
  31937. 0x09f6,
  31938. "threeoldstyle",
  31939. 0xf733,
  31940. "threeparen",
  31941. 0x2476,
  31942. "threeperiod",
  31943. 0x248a,
  31944. "threepersian",
  31945. 0x06f3,
  31946. "threequarters",
  31947. 0x00be,
  31948. "threequartersemdash",
  31949. 0xf6de,
  31950. "threeroman",
  31951. 0x2172,
  31952. "threesuperior",
  31953. 0x00b3,
  31954. "threethai",
  31955. 0x0e53,
  31956. "thzsquare",
  31957. 0x3394,
  31958. "tihiragana",
  31959. 0x3061,
  31960. "tikatakana",
  31961. 0x30c1,
  31962. "tikatakanahalfwidth",
  31963. 0xff81,
  31964. "tikeutacirclekorean",
  31965. 0x3270,
  31966. "tikeutaparenkorean",
  31967. 0x3210,
  31968. "tikeutcirclekorean",
  31969. 0x3262,
  31970. "tikeutkorean",
  31971. 0x3137,
  31972. "tikeutparenkorean",
  31973. 0x3202,
  31974. "tilde",
  31975. 0x02dc,
  31976. "tildebelowcmb",
  31977. 0x0330,
  31978. "tildecmb",
  31979. 0x0303,
  31980. "tildecomb",
  31981. 0x0303,
  31982. "tildedoublecmb",
  31983. 0x0360,
  31984. "tildeoperator",
  31985. 0x223c,
  31986. "tildeoverlaycmb",
  31987. 0x0334,
  31988. "tildeverticalcmb",
  31989. 0x033e,
  31990. "timescircle",
  31991. 0x2297,
  31992. "tipehahebrew",
  31993. 0x0596,
  31994. "tipehalefthebrew",
  31995. 0x0596,
  31996. "tippigurmukhi",
  31997. 0x0a70,
  31998. "titlocyrilliccmb",
  31999. 0x0483,
  32000. "tiwnarmenian",
  32001. 0x057f,
  32002. "tlinebelow",
  32003. 0x1e6f,
  32004. "tmonospace",
  32005. 0xff54,
  32006. "toarmenian",
  32007. 0x0569,
  32008. "tohiragana",
  32009. 0x3068,
  32010. "tokatakana",
  32011. 0x30c8,
  32012. "tokatakanahalfwidth",
  32013. 0xff84,
  32014. "tonebarextrahighmod",
  32015. 0x02e5,
  32016. "tonebarextralowmod",
  32017. 0x02e9,
  32018. "tonebarhighmod",
  32019. 0x02e6,
  32020. "tonebarlowmod",
  32021. 0x02e8,
  32022. "tonebarmidmod",
  32023. 0x02e7,
  32024. "tonefive",
  32025. 0x01bd,
  32026. "tonesix",
  32027. 0x0185,
  32028. "tonetwo",
  32029. 0x01a8,
  32030. "tonos",
  32031. 0x0384,
  32032. "tonsquare",
  32033. 0x3327,
  32034. "topatakthai",
  32035. 0x0e0f,
  32036. "tortoiseshellbracketleft",
  32037. 0x3014,
  32038. "tortoiseshellbracketleftsmall",
  32039. 0xfe5d,
  32040. "tortoiseshellbracketleftvertical",
  32041. 0xfe39,
  32042. "tortoiseshellbracketright",
  32043. 0x3015,
  32044. "tortoiseshellbracketrightsmall",
  32045. 0xfe5e,
  32046. "tortoiseshellbracketrightvertical",
  32047. 0xfe3a,
  32048. "totaothai",
  32049. 0x0e15,
  32050. "tpalatalhook",
  32051. 0x01ab,
  32052. "tparen",
  32053. 0x24af,
  32054. "trademark",
  32055. 0x2122,
  32056. "trademarksans",
  32057. 0xf8ea,
  32058. "trademarkserif",
  32059. 0xf6db,
  32060. "tretroflexhook",
  32061. 0x0288,
  32062. "triagdn",
  32063. 0x25bc,
  32064. "triaglf",
  32065. 0x25c4,
  32066. "triagrt",
  32067. 0x25ba,
  32068. "triagup",
  32069. 0x25b2,
  32070. "ts",
  32071. 0x02a6,
  32072. "tsadi",
  32073. 0x05e6,
  32074. "tsadidagesh",
  32075. 0xfb46,
  32076. "tsadidageshhebrew",
  32077. 0xfb46,
  32078. "tsadihebrew",
  32079. 0x05e6,
  32080. "tsecyrillic",
  32081. 0x0446,
  32082. "tsere",
  32083. 0x05b5,
  32084. "tsere12",
  32085. 0x05b5,
  32086. "tsere1e",
  32087. 0x05b5,
  32088. "tsere2b",
  32089. 0x05b5,
  32090. "tserehebrew",
  32091. 0x05b5,
  32092. "tserenarrowhebrew",
  32093. 0x05b5,
  32094. "tserequarterhebrew",
  32095. 0x05b5,
  32096. "tserewidehebrew",
  32097. 0x05b5,
  32098. "tshecyrillic",
  32099. 0x045b,
  32100. "tsuperior",
  32101. 0xf6f3,
  32102. "ttabengali",
  32103. 0x099f,
  32104. "ttadeva",
  32105. 0x091f,
  32106. "ttagujarati",
  32107. 0x0a9f,
  32108. "ttagurmukhi",
  32109. 0x0a1f,
  32110. "tteharabic",
  32111. 0x0679,
  32112. "ttehfinalarabic",
  32113. 0xfb67,
  32114. "ttehinitialarabic",
  32115. 0xfb68,
  32116. "ttehmedialarabic",
  32117. 0xfb69,
  32118. "tthabengali",
  32119. 0x09a0,
  32120. "tthadeva",
  32121. 0x0920,
  32122. "tthagujarati",
  32123. 0x0aa0,
  32124. "tthagurmukhi",
  32125. 0x0a20,
  32126. "tturned",
  32127. 0x0287,
  32128. "tuhiragana",
  32129. 0x3064,
  32130. "tukatakana",
  32131. 0x30c4,
  32132. "tukatakanahalfwidth",
  32133. 0xff82,
  32134. "tusmallhiragana",
  32135. 0x3063,
  32136. "tusmallkatakana",
  32137. 0x30c3,
  32138. "tusmallkatakanahalfwidth",
  32139. 0xff6f,
  32140. "twelvecircle",
  32141. 0x246b,
  32142. "twelveparen",
  32143. 0x247f,
  32144. "twelveperiod",
  32145. 0x2493,
  32146. "twelveroman",
  32147. 0x217b,
  32148. "twentycircle",
  32149. 0x2473,
  32150. "twentyhangzhou",
  32151. 0x5344,
  32152. "twentyparen",
  32153. 0x2487,
  32154. "twentyperiod",
  32155. 0x249b,
  32156. "two",
  32157. 0x0032,
  32158. "twoarabic",
  32159. 0x0662,
  32160. "twobengali",
  32161. 0x09e8,
  32162. "twocircle",
  32163. 0x2461,
  32164. "twocircleinversesansserif",
  32165. 0x278b,
  32166. "twodeva",
  32167. 0x0968,
  32168. "twodotenleader",
  32169. 0x2025,
  32170. "twodotleader",
  32171. 0x2025,
  32172. "twodotleadervertical",
  32173. 0xfe30,
  32174. "twogujarati",
  32175. 0x0ae8,
  32176. "twogurmukhi",
  32177. 0x0a68,
  32178. "twohackarabic",
  32179. 0x0662,
  32180. "twohangzhou",
  32181. 0x3022,
  32182. "twoideographicparen",
  32183. 0x3221,
  32184. "twoinferior",
  32185. 0x2082,
  32186. "twomonospace",
  32187. 0xff12,
  32188. "twonumeratorbengali",
  32189. 0x09f5,
  32190. "twooldstyle",
  32191. 0xf732,
  32192. "twoparen",
  32193. 0x2475,
  32194. "twoperiod",
  32195. 0x2489,
  32196. "twopersian",
  32197. 0x06f2,
  32198. "tworoman",
  32199. 0x2171,
  32200. "twostroke",
  32201. 0x01bb,
  32202. "twosuperior",
  32203. 0x00b2,
  32204. "twothai",
  32205. 0x0e52,
  32206. "twothirds",
  32207. 0x2154,
  32208. "u",
  32209. 0x0075,
  32210. "uacute",
  32211. 0x00fa,
  32212. "ubar",
  32213. 0x0289,
  32214. "ubengali",
  32215. 0x0989,
  32216. "ubopomofo",
  32217. 0x3128,
  32218. "ubreve",
  32219. 0x016d,
  32220. "ucaron",
  32221. 0x01d4,
  32222. "ucircle",
  32223. 0x24e4,
  32224. "ucircumflex",
  32225. 0x00fb,
  32226. "ucircumflexbelow",
  32227. 0x1e77,
  32228. "ucyrillic",
  32229. 0x0443,
  32230. "udattadeva",
  32231. 0x0951,
  32232. "udblacute",
  32233. 0x0171,
  32234. "udblgrave",
  32235. 0x0215,
  32236. "udeva",
  32237. 0x0909,
  32238. "udieresis",
  32239. 0x00fc,
  32240. "udieresisacute",
  32241. 0x01d8,
  32242. "udieresisbelow",
  32243. 0x1e73,
  32244. "udieresiscaron",
  32245. 0x01da,
  32246. "udieresiscyrillic",
  32247. 0x04f1,
  32248. "udieresisgrave",
  32249. 0x01dc,
  32250. "udieresismacron",
  32251. 0x01d6,
  32252. "udotbelow",
  32253. 0x1ee5,
  32254. "ugrave",
  32255. 0x00f9,
  32256. "ugujarati",
  32257. 0x0a89,
  32258. "ugurmukhi",
  32259. 0x0a09,
  32260. "uhiragana",
  32261. 0x3046,
  32262. "uhookabove",
  32263. 0x1ee7,
  32264. "uhorn",
  32265. 0x01b0,
  32266. "uhornacute",
  32267. 0x1ee9,
  32268. "uhorndotbelow",
  32269. 0x1ef1,
  32270. "uhorngrave",
  32271. 0x1eeb,
  32272. "uhornhookabove",
  32273. 0x1eed,
  32274. "uhorntilde",
  32275. 0x1eef,
  32276. "uhungarumlaut",
  32277. 0x0171,
  32278. "uhungarumlautcyrillic",
  32279. 0x04f3,
  32280. "uinvertedbreve",
  32281. 0x0217,
  32282. "ukatakana",
  32283. 0x30a6,
  32284. "ukatakanahalfwidth",
  32285. 0xff73,
  32286. "ukcyrillic",
  32287. 0x0479,
  32288. "ukorean",
  32289. 0x315c,
  32290. "umacron",
  32291. 0x016b,
  32292. "umacroncyrillic",
  32293. 0x04ef,
  32294. "umacrondieresis",
  32295. 0x1e7b,
  32296. "umatragurmukhi",
  32297. 0x0a41,
  32298. "umonospace",
  32299. 0xff55,
  32300. "underscore",
  32301. 0x005f,
  32302. "underscoredbl",
  32303. 0x2017,
  32304. "underscoremonospace",
  32305. 0xff3f,
  32306. "underscorevertical",
  32307. 0xfe33,
  32308. "underscorewavy",
  32309. 0xfe4f,
  32310. "union",
  32311. 0x222a,
  32312. "universal",
  32313. 0x2200,
  32314. "uogonek",
  32315. 0x0173,
  32316. "uparen",
  32317. 0x24b0,
  32318. "upblock",
  32319. 0x2580,
  32320. "upperdothebrew",
  32321. 0x05c4,
  32322. "upsilon",
  32323. 0x03c5,
  32324. "upsilondieresis",
  32325. 0x03cb,
  32326. "upsilondieresistonos",
  32327. 0x03b0,
  32328. "upsilonlatin",
  32329. 0x028a,
  32330. "upsilontonos",
  32331. 0x03cd,
  32332. "uptackbelowcmb",
  32333. 0x031d,
  32334. "uptackmod",
  32335. 0x02d4,
  32336. "uragurmukhi",
  32337. 0x0a73,
  32338. "uring",
  32339. 0x016f,
  32340. "ushortcyrillic",
  32341. 0x045e,
  32342. "usmallhiragana",
  32343. 0x3045,
  32344. "usmallkatakana",
  32345. 0x30a5,
  32346. "usmallkatakanahalfwidth",
  32347. 0xff69,
  32348. "ustraightcyrillic",
  32349. 0x04af,
  32350. "ustraightstrokecyrillic",
  32351. 0x04b1,
  32352. "utilde",
  32353. 0x0169,
  32354. "utildeacute",
  32355. 0x1e79,
  32356. "utildebelow",
  32357. 0x1e75,
  32358. "uubengali",
  32359. 0x098a,
  32360. "uudeva",
  32361. 0x090a,
  32362. "uugujarati",
  32363. 0x0a8a,
  32364. "uugurmukhi",
  32365. 0x0a0a,
  32366. "uumatragurmukhi",
  32367. 0x0a42,
  32368. "uuvowelsignbengali",
  32369. 0x09c2,
  32370. "uuvowelsigndeva",
  32371. 0x0942,
  32372. "uuvowelsigngujarati",
  32373. 0x0ac2,
  32374. "uvowelsignbengali",
  32375. 0x09c1,
  32376. "uvowelsigndeva",
  32377. 0x0941,
  32378. "uvowelsigngujarati",
  32379. 0x0ac1,
  32380. "v",
  32381. 0x0076,
  32382. "vadeva",
  32383. 0x0935,
  32384. "vagujarati",
  32385. 0x0ab5,
  32386. "vagurmukhi",
  32387. 0x0a35,
  32388. "vakatakana",
  32389. 0x30f7,
  32390. "vav",
  32391. 0x05d5,
  32392. "vavdagesh",
  32393. 0xfb35,
  32394. "vavdagesh65",
  32395. 0xfb35,
  32396. "vavdageshhebrew",
  32397. 0xfb35,
  32398. "vavhebrew",
  32399. 0x05d5,
  32400. "vavholam",
  32401. 0xfb4b,
  32402. "vavholamhebrew",
  32403. 0xfb4b,
  32404. "vavvavhebrew",
  32405. 0x05f0,
  32406. "vavyodhebrew",
  32407. 0x05f1,
  32408. "vcircle",
  32409. 0x24e5,
  32410. "vdotbelow",
  32411. 0x1e7f,
  32412. "vecyrillic",
  32413. 0x0432,
  32414. "veharabic",
  32415. 0x06a4,
  32416. "vehfinalarabic",
  32417. 0xfb6b,
  32418. "vehinitialarabic",
  32419. 0xfb6c,
  32420. "vehmedialarabic",
  32421. 0xfb6d,
  32422. "vekatakana",
  32423. 0x30f9,
  32424. "venus",
  32425. 0x2640,
  32426. "verticalbar",
  32427. 0x007c,
  32428. "verticallineabovecmb",
  32429. 0x030d,
  32430. "verticallinebelowcmb",
  32431. 0x0329,
  32432. "verticallinelowmod",
  32433. 0x02cc,
  32434. "verticallinemod",
  32435. 0x02c8,
  32436. "vewarmenian",
  32437. 0x057e,
  32438. "vhook",
  32439. 0x028b,
  32440. "vikatakana",
  32441. 0x30f8,
  32442. "viramabengali",
  32443. 0x09cd,
  32444. "viramadeva",
  32445. 0x094d,
  32446. "viramagujarati",
  32447. 0x0acd,
  32448. "visargabengali",
  32449. 0x0983,
  32450. "visargadeva",
  32451. 0x0903,
  32452. "visargagujarati",
  32453. 0x0a83,
  32454. "vmonospace",
  32455. 0xff56,
  32456. "voarmenian",
  32457. 0x0578,
  32458. "voicediterationhiragana",
  32459. 0x309e,
  32460. "voicediterationkatakana",
  32461. 0x30fe,
  32462. "voicedmarkkana",
  32463. 0x309b,
  32464. "voicedmarkkanahalfwidth",
  32465. 0xff9e,
  32466. "vokatakana",
  32467. 0x30fa,
  32468. "vparen",
  32469. 0x24b1,
  32470. "vtilde",
  32471. 0x1e7d,
  32472. "vturned",
  32473. 0x028c,
  32474. "vuhiragana",
  32475. 0x3094,
  32476. "vukatakana",
  32477. 0x30f4,
  32478. "w",
  32479. 0x0077,
  32480. "wacute",
  32481. 0x1e83,
  32482. "waekorean",
  32483. 0x3159,
  32484. "wahiragana",
  32485. 0x308f,
  32486. "wakatakana",
  32487. 0x30ef,
  32488. "wakatakanahalfwidth",
  32489. 0xff9c,
  32490. "wakorean",
  32491. 0x3158,
  32492. "wasmallhiragana",
  32493. 0x308e,
  32494. "wasmallkatakana",
  32495. 0x30ee,
  32496. "wattosquare",
  32497. 0x3357,
  32498. "wavedash",
  32499. 0x301c,
  32500. "wavyunderscorevertical",
  32501. 0xfe34,
  32502. "wawarabic",
  32503. 0x0648,
  32504. "wawfinalarabic",
  32505. 0xfeee,
  32506. "wawhamzaabovearabic",
  32507. 0x0624,
  32508. "wawhamzaabovefinalarabic",
  32509. 0xfe86,
  32510. "wbsquare",
  32511. 0x33dd,
  32512. "wcircle",
  32513. 0x24e6,
  32514. "wcircumflex",
  32515. 0x0175,
  32516. "wdieresis",
  32517. 0x1e85,
  32518. "wdotaccent",
  32519. 0x1e87,
  32520. "wdotbelow",
  32521. 0x1e89,
  32522. "wehiragana",
  32523. 0x3091,
  32524. "weierstrass",
  32525. 0x2118,
  32526. "wekatakana",
  32527. 0x30f1,
  32528. "wekorean",
  32529. 0x315e,
  32530. "weokorean",
  32531. 0x315d,
  32532. "wgrave",
  32533. 0x1e81,
  32534. "whitebullet",
  32535. 0x25e6,
  32536. "whitecircle",
  32537. 0x25cb,
  32538. "whitecircleinverse",
  32539. 0x25d9,
  32540. "whitecornerbracketleft",
  32541. 0x300e,
  32542. "whitecornerbracketleftvertical",
  32543. 0xfe43,
  32544. "whitecornerbracketright",
  32545. 0x300f,
  32546. "whitecornerbracketrightvertical",
  32547. 0xfe44,
  32548. "whitediamond",
  32549. 0x25c7,
  32550. "whitediamondcontainingblacksmalldiamond",
  32551. 0x25c8,
  32552. "whitedownpointingsmalltriangle",
  32553. 0x25bf,
  32554. "whitedownpointingtriangle",
  32555. 0x25bd,
  32556. "whiteleftpointingsmalltriangle",
  32557. 0x25c3,
  32558. "whiteleftpointingtriangle",
  32559. 0x25c1,
  32560. "whitelenticularbracketleft",
  32561. 0x3016,
  32562. "whitelenticularbracketright",
  32563. 0x3017,
  32564. "whiterightpointingsmalltriangle",
  32565. 0x25b9,
  32566. "whiterightpointingtriangle",
  32567. 0x25b7,
  32568. "whitesmallsquare",
  32569. 0x25ab,
  32570. "whitesmilingface",
  32571. 0x263a,
  32572. "whitesquare",
  32573. 0x25a1,
  32574. "whitestar",
  32575. 0x2606,
  32576. "whitetelephone",
  32577. 0x260f,
  32578. "whitetortoiseshellbracketleft",
  32579. 0x3018,
  32580. "whitetortoiseshellbracketright",
  32581. 0x3019,
  32582. "whiteuppointingsmalltriangle",
  32583. 0x25b5,
  32584. "whiteuppointingtriangle",
  32585. 0x25b3,
  32586. "wihiragana",
  32587. 0x3090,
  32588. "wikatakana",
  32589. 0x30f0,
  32590. "wikorean",
  32591. 0x315f,
  32592. "wmonospace",
  32593. 0xff57,
  32594. "wohiragana",
  32595. 0x3092,
  32596. "wokatakana",
  32597. 0x30f2,
  32598. "wokatakanahalfwidth",
  32599. 0xff66,
  32600. "won",
  32601. 0x20a9,
  32602. "wonmonospace",
  32603. 0xffe6,
  32604. "wowaenthai",
  32605. 0x0e27,
  32606. "wparen",
  32607. 0x24b2,
  32608. "wring",
  32609. 0x1e98,
  32610. "wsuperior",
  32611. 0x02b7,
  32612. "wturned",
  32613. 0x028d,
  32614. "wynn",
  32615. 0x01bf,
  32616. "x",
  32617. 0x0078,
  32618. "xabovecmb",
  32619. 0x033d,
  32620. "xbopomofo",
  32621. 0x3112,
  32622. "xcircle",
  32623. 0x24e7,
  32624. "xdieresis",
  32625. 0x1e8d,
  32626. "xdotaccent",
  32627. 0x1e8b,
  32628. "xeharmenian",
  32629. 0x056d,
  32630. "xi",
  32631. 0x03be,
  32632. "xmonospace",
  32633. 0xff58,
  32634. "xparen",
  32635. 0x24b3,
  32636. "xsuperior",
  32637. 0x02e3,
  32638. "y",
  32639. 0x0079,
  32640. "yaadosquare",
  32641. 0x334e,
  32642. "yabengali",
  32643. 0x09af,
  32644. "yacute",
  32645. 0x00fd,
  32646. "yadeva",
  32647. 0x092f,
  32648. "yaekorean",
  32649. 0x3152,
  32650. "yagujarati",
  32651. 0x0aaf,
  32652. "yagurmukhi",
  32653. 0x0a2f,
  32654. "yahiragana",
  32655. 0x3084,
  32656. "yakatakana",
  32657. 0x30e4,
  32658. "yakatakanahalfwidth",
  32659. 0xff94,
  32660. "yakorean",
  32661. 0x3151,
  32662. "yamakkanthai",
  32663. 0x0e4e,
  32664. "yasmallhiragana",
  32665. 0x3083,
  32666. "yasmallkatakana",
  32667. 0x30e3,
  32668. "yasmallkatakanahalfwidth",
  32669. 0xff6c,
  32670. "yatcyrillic",
  32671. 0x0463,
  32672. "ycircle",
  32673. 0x24e8,
  32674. "ycircumflex",
  32675. 0x0177,
  32676. "ydieresis",
  32677. 0x00ff,
  32678. "ydotaccent",
  32679. 0x1e8f,
  32680. "ydotbelow",
  32681. 0x1ef5,
  32682. "yeharabic",
  32683. 0x064a,
  32684. "yehbarreearabic",
  32685. 0x06d2,
  32686. "yehbarreefinalarabic",
  32687. 0xfbaf,
  32688. "yehfinalarabic",
  32689. 0xfef2,
  32690. "yehhamzaabovearabic",
  32691. 0x0626,
  32692. "yehhamzaabovefinalarabic",
  32693. 0xfe8a,
  32694. "yehhamzaaboveinitialarabic",
  32695. 0xfe8b,
  32696. "yehhamzaabovemedialarabic",
  32697. 0xfe8c,
  32698. "yehinitialarabic",
  32699. 0xfef3,
  32700. "yehmedialarabic",
  32701. 0xfef4,
  32702. "yehmeeminitialarabic",
  32703. 0xfcdd,
  32704. "yehmeemisolatedarabic",
  32705. 0xfc58,
  32706. "yehnoonfinalarabic",
  32707. 0xfc94,
  32708. "yehthreedotsbelowarabic",
  32709. 0x06d1,
  32710. "yekorean",
  32711. 0x3156,
  32712. "yen",
  32713. 0x00a5,
  32714. "yenmonospace",
  32715. 0xffe5,
  32716. "yeokorean",
  32717. 0x3155,
  32718. "yeorinhieuhkorean",
  32719. 0x3186,
  32720. "yerahbenyomohebrew",
  32721. 0x05aa,
  32722. "yerahbenyomolefthebrew",
  32723. 0x05aa,
  32724. "yericyrillic",
  32725. 0x044b,
  32726. "yerudieresiscyrillic",
  32727. 0x04f9,
  32728. "yesieungkorean",
  32729. 0x3181,
  32730. "yesieungpansioskorean",
  32731. 0x3183,
  32732. "yesieungsioskorean",
  32733. 0x3182,
  32734. "yetivhebrew",
  32735. 0x059a,
  32736. "ygrave",
  32737. 0x1ef3,
  32738. "yhook",
  32739. 0x01b4,
  32740. "yhookabove",
  32741. 0x1ef7,
  32742. "yiarmenian",
  32743. 0x0575,
  32744. "yicyrillic",
  32745. 0x0457,
  32746. "yikorean",
  32747. 0x3162,
  32748. "yinyang",
  32749. 0x262f,
  32750. "yiwnarmenian",
  32751. 0x0582,
  32752. "ymonospace",
  32753. 0xff59,
  32754. "yod",
  32755. 0x05d9,
  32756. "yoddagesh",
  32757. 0xfb39,
  32758. "yoddageshhebrew",
  32759. 0xfb39,
  32760. "yodhebrew",
  32761. 0x05d9,
  32762. "yodyodhebrew",
  32763. 0x05f2,
  32764. "yodyodpatahhebrew",
  32765. 0xfb1f,
  32766. "yohiragana",
  32767. 0x3088,
  32768. "yoikorean",
  32769. 0x3189,
  32770. "yokatakana",
  32771. 0x30e8,
  32772. "yokatakanahalfwidth",
  32773. 0xff96,
  32774. "yokorean",
  32775. 0x315b,
  32776. "yosmallhiragana",
  32777. 0x3087,
  32778. "yosmallkatakana",
  32779. 0x30e7,
  32780. "yosmallkatakanahalfwidth",
  32781. 0xff6e,
  32782. "yotgreek",
  32783. 0x03f3,
  32784. "yoyaekorean",
  32785. 0x3188,
  32786. "yoyakorean",
  32787. 0x3187,
  32788. "yoyakthai",
  32789. 0x0e22,
  32790. "yoyingthai",
  32791. 0x0e0d,
  32792. "yparen",
  32793. 0x24b4,
  32794. "ypogegrammeni",
  32795. 0x037a,
  32796. "ypogegrammenigreekcmb",
  32797. 0x0345,
  32798. "yr",
  32799. 0x01a6,
  32800. "yring",
  32801. 0x1e99,
  32802. "ysuperior",
  32803. 0x02b8,
  32804. "ytilde",
  32805. 0x1ef9,
  32806. "yturned",
  32807. 0x028e,
  32808. "yuhiragana",
  32809. 0x3086,
  32810. "yuikorean",
  32811. 0x318c,
  32812. "yukatakana",
  32813. 0x30e6,
  32814. "yukatakanahalfwidth",
  32815. 0xff95,
  32816. "yukorean",
  32817. 0x3160,
  32818. "yusbigcyrillic",
  32819. 0x046b,
  32820. "yusbigiotifiedcyrillic",
  32821. 0x046d,
  32822. "yuslittlecyrillic",
  32823. 0x0467,
  32824. "yuslittleiotifiedcyrillic",
  32825. 0x0469,
  32826. "yusmallhiragana",
  32827. 0x3085,
  32828. "yusmallkatakana",
  32829. 0x30e5,
  32830. "yusmallkatakanahalfwidth",
  32831. 0xff6d,
  32832. "yuyekorean",
  32833. 0x318b,
  32834. "yuyeokorean",
  32835. 0x318a,
  32836. "yyabengali",
  32837. 0x09df,
  32838. "yyadeva",
  32839. 0x095f,
  32840. "z",
  32841. 0x007a,
  32842. "zaarmenian",
  32843. 0x0566,
  32844. "zacute",
  32845. 0x017a,
  32846. "zadeva",
  32847. 0x095b,
  32848. "zagurmukhi",
  32849. 0x0a5b,
  32850. "zaharabic",
  32851. 0x0638,
  32852. "zahfinalarabic",
  32853. 0xfec6,
  32854. "zahinitialarabic",
  32855. 0xfec7,
  32856. "zahiragana",
  32857. 0x3056,
  32858. "zahmedialarabic",
  32859. 0xfec8,
  32860. "zainarabic",
  32861. 0x0632,
  32862. "zainfinalarabic",
  32863. 0xfeb0,
  32864. "zakatakana",
  32865. 0x30b6,
  32866. "zaqefgadolhebrew",
  32867. 0x0595,
  32868. "zaqefqatanhebrew",
  32869. 0x0594,
  32870. "zarqahebrew",
  32871. 0x0598,
  32872. "zayin",
  32873. 0x05d6,
  32874. "zayindagesh",
  32875. 0xfb36,
  32876. "zayindageshhebrew",
  32877. 0xfb36,
  32878. "zayinhebrew",
  32879. 0x05d6,
  32880. "zbopomofo",
  32881. 0x3117,
  32882. "zcaron",
  32883. 0x017e,
  32884. "zcircle",
  32885. 0x24e9,
  32886. "zcircumflex",
  32887. 0x1e91,
  32888. "zcurl",
  32889. 0x0291,
  32890. "zdot",
  32891. 0x017c,
  32892. "zdotaccent",
  32893. 0x017c,
  32894. "zdotbelow",
  32895. 0x1e93,
  32896. "zecyrillic",
  32897. 0x0437,
  32898. "zedescendercyrillic",
  32899. 0x0499,
  32900. "zedieresiscyrillic",
  32901. 0x04df,
  32902. "zehiragana",
  32903. 0x305c,
  32904. "zekatakana",
  32905. 0x30bc,
  32906. "zero",
  32907. 0x0030,
  32908. "zeroarabic",
  32909. 0x0660,
  32910. "zerobengali",
  32911. 0x09e6,
  32912. "zerodeva",
  32913. 0x0966,
  32914. "zerogujarati",
  32915. 0x0ae6,
  32916. "zerogurmukhi",
  32917. 0x0a66,
  32918. "zerohackarabic",
  32919. 0x0660,
  32920. "zeroinferior",
  32921. 0x2080,
  32922. "zeromonospace",
  32923. 0xff10,
  32924. "zerooldstyle",
  32925. 0xf730,
  32926. "zeropersian",
  32927. 0x06f0,
  32928. "zerosuperior",
  32929. 0x2070,
  32930. "zerothai",
  32931. 0x0e50,
  32932. "zerowidthjoiner",
  32933. 0xfeff,
  32934. "zerowidthnonjoiner",
  32935. 0x200c,
  32936. "zerowidthspace",
  32937. 0x200b,
  32938. "zeta",
  32939. 0x03b6,
  32940. "zhbopomofo",
  32941. 0x3113,
  32942. "zhearmenian",
  32943. 0x056a,
  32944. "zhebrevecyrillic",
  32945. 0x04c2,
  32946. "zhecyrillic",
  32947. 0x0436,
  32948. "zhedescendercyrillic",
  32949. 0x0497,
  32950. "zhedieresiscyrillic",
  32951. 0x04dd,
  32952. "zihiragana",
  32953. 0x3058,
  32954. "zikatakana",
  32955. 0x30b8,
  32956. "zinorhebrew",
  32957. 0x05ae,
  32958. "zlinebelow",
  32959. 0x1e95,
  32960. "zmonospace",
  32961. 0xff5a,
  32962. "zohiragana",
  32963. 0x305e,
  32964. "zokatakana",
  32965. 0x30be,
  32966. "zparen",
  32967. 0x24b5,
  32968. "zretroflexhook",
  32969. 0x0290,
  32970. "zstroke",
  32971. 0x01b6,
  32972. "zuhiragana",
  32973. 0x305a,
  32974. "zukatakana",
  32975. 0x30ba,
  32976. ".notdef",
  32977. 0x0000,
  32978. "angbracketleftbig",
  32979. 0x2329,
  32980. "angbracketleftBig",
  32981. 0x2329,
  32982. "angbracketleftbigg",
  32983. 0x2329,
  32984. "angbracketleftBigg",
  32985. 0x2329,
  32986. "angbracketrightBig",
  32987. 0x232a,
  32988. "angbracketrightbig",
  32989. 0x232a,
  32990. "angbracketrightBigg",
  32991. 0x232a,
  32992. "angbracketrightbigg",
  32993. 0x232a,
  32994. "arrowhookleft",
  32995. 0x21aa,
  32996. "arrowhookright",
  32997. 0x21a9,
  32998. "arrowlefttophalf",
  32999. 0x21bc,
  33000. "arrowleftbothalf",
  33001. 0x21bd,
  33002. "arrownortheast",
  33003. 0x2197,
  33004. "arrownorthwest",
  33005. 0x2196,
  33006. "arrowrighttophalf",
  33007. 0x21c0,
  33008. "arrowrightbothalf",
  33009. 0x21c1,
  33010. "arrowsoutheast",
  33011. 0x2198,
  33012. "arrowsouthwest",
  33013. 0x2199,
  33014. "backslashbig",
  33015. 0x2216,
  33016. "backslashBig",
  33017. 0x2216,
  33018. "backslashBigg",
  33019. 0x2216,
  33020. "backslashbigg",
  33021. 0x2216,
  33022. "bardbl",
  33023. 0x2016,
  33024. "bracehtipdownleft",
  33025. 0xfe37,
  33026. "bracehtipdownright",
  33027. 0xfe37,
  33028. "bracehtipupleft",
  33029. 0xfe38,
  33030. "bracehtipupright",
  33031. 0xfe38,
  33032. "braceleftBig",
  33033. 0x007b,
  33034. "braceleftbig",
  33035. 0x007b,
  33036. "braceleftbigg",
  33037. 0x007b,
  33038. "braceleftBigg",
  33039. 0x007b,
  33040. "bracerightBig",
  33041. 0x007d,
  33042. "bracerightbig",
  33043. 0x007d,
  33044. "bracerightbigg",
  33045. 0x007d,
  33046. "bracerightBigg",
  33047. 0x007d,
  33048. "bracketleftbig",
  33049. 0x005b,
  33050. "bracketleftBig",
  33051. 0x005b,
  33052. "bracketleftbigg",
  33053. 0x005b,
  33054. "bracketleftBigg",
  33055. 0x005b,
  33056. "bracketrightBig",
  33057. 0x005d,
  33058. "bracketrightbig",
  33059. 0x005d,
  33060. "bracketrightbigg",
  33061. 0x005d,
  33062. "bracketrightBigg",
  33063. 0x005d,
  33064. "ceilingleftbig",
  33065. 0x2308,
  33066. "ceilingleftBig",
  33067. 0x2308,
  33068. "ceilingleftBigg",
  33069. 0x2308,
  33070. "ceilingleftbigg",
  33071. 0x2308,
  33072. "ceilingrightbig",
  33073. 0x2309,
  33074. "ceilingrightBig",
  33075. 0x2309,
  33076. "ceilingrightbigg",
  33077. 0x2309,
  33078. "ceilingrightBigg",
  33079. 0x2309,
  33080. "circledotdisplay",
  33081. 0x2299,
  33082. "circledottext",
  33083. 0x2299,
  33084. "circlemultiplydisplay",
  33085. 0x2297,
  33086. "circlemultiplytext",
  33087. 0x2297,
  33088. "circleplusdisplay",
  33089. 0x2295,
  33090. "circleplustext",
  33091. 0x2295,
  33092. "contintegraldisplay",
  33093. 0x222e,
  33094. "contintegraltext",
  33095. 0x222e,
  33096. "coproductdisplay",
  33097. 0x2210,
  33098. "coproducttext",
  33099. 0x2210,
  33100. "floorleftBig",
  33101. 0x230a,
  33102. "floorleftbig",
  33103. 0x230a,
  33104. "floorleftbigg",
  33105. 0x230a,
  33106. "floorleftBigg",
  33107. 0x230a,
  33108. "floorrightbig",
  33109. 0x230b,
  33110. "floorrightBig",
  33111. 0x230b,
  33112. "floorrightBigg",
  33113. 0x230b,
  33114. "floorrightbigg",
  33115. 0x230b,
  33116. "hatwide",
  33117. 0x0302,
  33118. "hatwider",
  33119. 0x0302,
  33120. "hatwidest",
  33121. 0x0302,
  33122. "intercal",
  33123. 0x1d40,
  33124. "integraldisplay",
  33125. 0x222b,
  33126. "integraltext",
  33127. 0x222b,
  33128. "intersectiondisplay",
  33129. 0x22c2,
  33130. "intersectiontext",
  33131. 0x22c2,
  33132. "logicalanddisplay",
  33133. 0x2227,
  33134. "logicalandtext",
  33135. 0x2227,
  33136. "logicalordisplay",
  33137. 0x2228,
  33138. "logicalortext",
  33139. 0x2228,
  33140. "parenleftBig",
  33141. 0x0028,
  33142. "parenleftbig",
  33143. 0x0028,
  33144. "parenleftBigg",
  33145. 0x0028,
  33146. "parenleftbigg",
  33147. 0x0028,
  33148. "parenrightBig",
  33149. 0x0029,
  33150. "parenrightbig",
  33151. 0x0029,
  33152. "parenrightBigg",
  33153. 0x0029,
  33154. "parenrightbigg",
  33155. 0x0029,
  33156. "prime",
  33157. 0x2032,
  33158. "productdisplay",
  33159. 0x220f,
  33160. "producttext",
  33161. 0x220f,
  33162. "radicalbig",
  33163. 0x221a,
  33164. "radicalBig",
  33165. 0x221a,
  33166. "radicalBigg",
  33167. 0x221a,
  33168. "radicalbigg",
  33169. 0x221a,
  33170. "radicalbt",
  33171. 0x221a,
  33172. "radicaltp",
  33173. 0x221a,
  33174. "radicalvertex",
  33175. 0x221a,
  33176. "slashbig",
  33177. 0x002f,
  33178. "slashBig",
  33179. 0x002f,
  33180. "slashBigg",
  33181. 0x002f,
  33182. "slashbigg",
  33183. 0x002f,
  33184. "summationdisplay",
  33185. 0x2211,
  33186. "summationtext",
  33187. 0x2211,
  33188. "tildewide",
  33189. 0x02dc,
  33190. "tildewider",
  33191. 0x02dc,
  33192. "tildewidest",
  33193. 0x02dc,
  33194. "uniondisplay",
  33195. 0x22c3,
  33196. "unionmultidisplay",
  33197. 0x228e,
  33198. "unionmultitext",
  33199. 0x228e,
  33200. "unionsqdisplay",
  33201. 0x2294,
  33202. "unionsqtext",
  33203. 0x2294,
  33204. "uniontext",
  33205. 0x22c3,
  33206. "vextenddouble",
  33207. 0x2225,
  33208. "vextendsingle",
  33209. 0x2223
  33210. ];
  33211. });
  33212. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  33213. return [
  33214. "space",
  33215. 0x0020,
  33216. "a1",
  33217. 0x2701,
  33218. "a2",
  33219. 0x2702,
  33220. "a202",
  33221. 0x2703,
  33222. "a3",
  33223. 0x2704,
  33224. "a4",
  33225. 0x260e,
  33226. "a5",
  33227. 0x2706,
  33228. "a119",
  33229. 0x2707,
  33230. "a118",
  33231. 0x2708,
  33232. "a117",
  33233. 0x2709,
  33234. "a11",
  33235. 0x261b,
  33236. "a12",
  33237. 0x261e,
  33238. "a13",
  33239. 0x270c,
  33240. "a14",
  33241. 0x270d,
  33242. "a15",
  33243. 0x270e,
  33244. "a16",
  33245. 0x270f,
  33246. "a105",
  33247. 0x2710,
  33248. "a17",
  33249. 0x2711,
  33250. "a18",
  33251. 0x2712,
  33252. "a19",
  33253. 0x2713,
  33254. "a20",
  33255. 0x2714,
  33256. "a21",
  33257. 0x2715,
  33258. "a22",
  33259. 0x2716,
  33260. "a23",
  33261. 0x2717,
  33262. "a24",
  33263. 0x2718,
  33264. "a25",
  33265. 0x2719,
  33266. "a26",
  33267. 0x271a,
  33268. "a27",
  33269. 0x271b,
  33270. "a28",
  33271. 0x271c,
  33272. "a6",
  33273. 0x271d,
  33274. "a7",
  33275. 0x271e,
  33276. "a8",
  33277. 0x271f,
  33278. "a9",
  33279. 0x2720,
  33280. "a10",
  33281. 0x2721,
  33282. "a29",
  33283. 0x2722,
  33284. "a30",
  33285. 0x2723,
  33286. "a31",
  33287. 0x2724,
  33288. "a32",
  33289. 0x2725,
  33290. "a33",
  33291. 0x2726,
  33292. "a34",
  33293. 0x2727,
  33294. "a35",
  33295. 0x2605,
  33296. "a36",
  33297. 0x2729,
  33298. "a37",
  33299. 0x272a,
  33300. "a38",
  33301. 0x272b,
  33302. "a39",
  33303. 0x272c,
  33304. "a40",
  33305. 0x272d,
  33306. "a41",
  33307. 0x272e,
  33308. "a42",
  33309. 0x272f,
  33310. "a43",
  33311. 0x2730,
  33312. "a44",
  33313. 0x2731,
  33314. "a45",
  33315. 0x2732,
  33316. "a46",
  33317. 0x2733,
  33318. "a47",
  33319. 0x2734,
  33320. "a48",
  33321. 0x2735,
  33322. "a49",
  33323. 0x2736,
  33324. "a50",
  33325. 0x2737,
  33326. "a51",
  33327. 0x2738,
  33328. "a52",
  33329. 0x2739,
  33330. "a53",
  33331. 0x273a,
  33332. "a54",
  33333. 0x273b,
  33334. "a55",
  33335. 0x273c,
  33336. "a56",
  33337. 0x273d,
  33338. "a57",
  33339. 0x273e,
  33340. "a58",
  33341. 0x273f,
  33342. "a59",
  33343. 0x2740,
  33344. "a60",
  33345. 0x2741,
  33346. "a61",
  33347. 0x2742,
  33348. "a62",
  33349. 0x2743,
  33350. "a63",
  33351. 0x2744,
  33352. "a64",
  33353. 0x2745,
  33354. "a65",
  33355. 0x2746,
  33356. "a66",
  33357. 0x2747,
  33358. "a67",
  33359. 0x2748,
  33360. "a68",
  33361. 0x2749,
  33362. "a69",
  33363. 0x274a,
  33364. "a70",
  33365. 0x274b,
  33366. "a71",
  33367. 0x25cf,
  33368. "a72",
  33369. 0x274d,
  33370. "a73",
  33371. 0x25a0,
  33372. "a74",
  33373. 0x274f,
  33374. "a203",
  33375. 0x2750,
  33376. "a75",
  33377. 0x2751,
  33378. "a204",
  33379. 0x2752,
  33380. "a76",
  33381. 0x25b2,
  33382. "a77",
  33383. 0x25bc,
  33384. "a78",
  33385. 0x25c6,
  33386. "a79",
  33387. 0x2756,
  33388. "a81",
  33389. 0x25d7,
  33390. "a82",
  33391. 0x2758,
  33392. "a83",
  33393. 0x2759,
  33394. "a84",
  33395. 0x275a,
  33396. "a97",
  33397. 0x275b,
  33398. "a98",
  33399. 0x275c,
  33400. "a99",
  33401. 0x275d,
  33402. "a100",
  33403. 0x275e,
  33404. "a101",
  33405. 0x2761,
  33406. "a102",
  33407. 0x2762,
  33408. "a103",
  33409. 0x2763,
  33410. "a104",
  33411. 0x2764,
  33412. "a106",
  33413. 0x2765,
  33414. "a107",
  33415. 0x2766,
  33416. "a108",
  33417. 0x2767,
  33418. "a112",
  33419. 0x2663,
  33420. "a111",
  33421. 0x2666,
  33422. "a110",
  33423. 0x2665,
  33424. "a109",
  33425. 0x2660,
  33426. "a120",
  33427. 0x2460,
  33428. "a121",
  33429. 0x2461,
  33430. "a122",
  33431. 0x2462,
  33432. "a123",
  33433. 0x2463,
  33434. "a124",
  33435. 0x2464,
  33436. "a125",
  33437. 0x2465,
  33438. "a126",
  33439. 0x2466,
  33440. "a127",
  33441. 0x2467,
  33442. "a128",
  33443. 0x2468,
  33444. "a129",
  33445. 0x2469,
  33446. "a130",
  33447. 0x2776,
  33448. "a131",
  33449. 0x2777,
  33450. "a132",
  33451. 0x2778,
  33452. "a133",
  33453. 0x2779,
  33454. "a134",
  33455. 0x277a,
  33456. "a135",
  33457. 0x277b,
  33458. "a136",
  33459. 0x277c,
  33460. "a137",
  33461. 0x277d,
  33462. "a138",
  33463. 0x277e,
  33464. "a139",
  33465. 0x277f,
  33466. "a140",
  33467. 0x2780,
  33468. "a141",
  33469. 0x2781,
  33470. "a142",
  33471. 0x2782,
  33472. "a143",
  33473. 0x2783,
  33474. "a144",
  33475. 0x2784,
  33476. "a145",
  33477. 0x2785,
  33478. "a146",
  33479. 0x2786,
  33480. "a147",
  33481. 0x2787,
  33482. "a148",
  33483. 0x2788,
  33484. "a149",
  33485. 0x2789,
  33486. "a150",
  33487. 0x278a,
  33488. "a151",
  33489. 0x278b,
  33490. "a152",
  33491. 0x278c,
  33492. "a153",
  33493. 0x278d,
  33494. "a154",
  33495. 0x278e,
  33496. "a155",
  33497. 0x278f,
  33498. "a156",
  33499. 0x2790,
  33500. "a157",
  33501. 0x2791,
  33502. "a158",
  33503. 0x2792,
  33504. "a159",
  33505. 0x2793,
  33506. "a160",
  33507. 0x2794,
  33508. "a161",
  33509. 0x2192,
  33510. "a163",
  33511. 0x2194,
  33512. "a164",
  33513. 0x2195,
  33514. "a196",
  33515. 0x2798,
  33516. "a165",
  33517. 0x2799,
  33518. "a192",
  33519. 0x279a,
  33520. "a166",
  33521. 0x279b,
  33522. "a167",
  33523. 0x279c,
  33524. "a168",
  33525. 0x279d,
  33526. "a169",
  33527. 0x279e,
  33528. "a170",
  33529. 0x279f,
  33530. "a171",
  33531. 0x27a0,
  33532. "a172",
  33533. 0x27a1,
  33534. "a173",
  33535. 0x27a2,
  33536. "a162",
  33537. 0x27a3,
  33538. "a174",
  33539. 0x27a4,
  33540. "a175",
  33541. 0x27a5,
  33542. "a176",
  33543. 0x27a6,
  33544. "a177",
  33545. 0x27a7,
  33546. "a178",
  33547. 0x27a8,
  33548. "a179",
  33549. 0x27a9,
  33550. "a193",
  33551. 0x27aa,
  33552. "a180",
  33553. 0x27ab,
  33554. "a199",
  33555. 0x27ac,
  33556. "a181",
  33557. 0x27ad,
  33558. "a200",
  33559. 0x27ae,
  33560. "a182",
  33561. 0x27af,
  33562. "a201",
  33563. 0x27b1,
  33564. "a183",
  33565. 0x27b2,
  33566. "a184",
  33567. 0x27b3,
  33568. "a197",
  33569. 0x27b4,
  33570. "a185",
  33571. 0x27b5,
  33572. "a194",
  33573. 0x27b6,
  33574. "a198",
  33575. 0x27b7,
  33576. "a186",
  33577. 0x27b8,
  33578. "a195",
  33579. 0x27b9,
  33580. "a187",
  33581. 0x27ba,
  33582. "a188",
  33583. 0x27bb,
  33584. "a189",
  33585. 0x27bc,
  33586. "a190",
  33587. 0x27bd,
  33588. "a191",
  33589. 0x27be,
  33590. "a89",
  33591. 0x2768,
  33592. "a90",
  33593. 0x2769,
  33594. "a93",
  33595. 0x276a,
  33596. "a94",
  33597. 0x276b,
  33598. "a91",
  33599. 0x276c,
  33600. "a92",
  33601. 0x276d,
  33602. "a205",
  33603. 0x276e,
  33604. "a85",
  33605. 0x276f,
  33606. "a206",
  33607. 0x2770,
  33608. "a86",
  33609. 0x2771,
  33610. "a87",
  33611. 0x2772,
  33612. "a88",
  33613. 0x2773,
  33614. "a95",
  33615. 0x2774,
  33616. "a96",
  33617. 0x2775,
  33618. ".notdef",
  33619. 0x0000
  33620. ];
  33621. });
  33622. /***/ }),
  33623. /* 38 */
  33624. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  33625. __w_pdfjs_require__.r(__webpack_exports__);
  33626. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  33627. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  33628. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  33629. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  33630. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  33631. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  33632. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  33633. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  33634. /* harmony export */ });
  33635. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(4);
  33636. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  33637. t[63721] = 0x00a9;
  33638. t[63193] = 0x00a9;
  33639. t[63720] = 0x00ae;
  33640. t[63194] = 0x00ae;
  33641. t[63722] = 0x2122;
  33642. t[63195] = 0x2122;
  33643. t[63729] = 0x23a7;
  33644. t[63730] = 0x23a8;
  33645. t[63731] = 0x23a9;
  33646. t[63740] = 0x23ab;
  33647. t[63741] = 0x23ac;
  33648. t[63742] = 0x23ad;
  33649. t[63726] = 0x23a1;
  33650. t[63727] = 0x23a2;
  33651. t[63728] = 0x23a3;
  33652. t[63737] = 0x23a4;
  33653. t[63738] = 0x23a5;
  33654. t[63739] = 0x23a6;
  33655. t[63723] = 0x239b;
  33656. t[63724] = 0x239c;
  33657. t[63725] = 0x239d;
  33658. t[63734] = 0x239e;
  33659. t[63735] = 0x239f;
  33660. t[63736] = 0x23a0;
  33661. });
  33662. function mapSpecialUnicodeValues(code) {
  33663. if (code >= 0xfff0 && code <= 0xffff) {
  33664. return 0;
  33665. } else if (code >= 0xf600 && code <= 0xf8ff) {
  33666. return getSpecialPUASymbols()[code] || code;
  33667. } else if (code === 0x00ad) {
  33668. return 0x002d;
  33669. }
  33670. return code;
  33671. }
  33672. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33673. let unicode = glyphsUnicodeMap[name];
  33674. if (unicode !== undefined) {
  33675. return unicode;
  33676. }
  33677. if (!name) {
  33678. return -1;
  33679. }
  33680. if (name[0] === "u") {
  33681. const nameLen = name.length;
  33682. let hexStr;
  33683. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  33684. hexStr = name.substring(3);
  33685. } else if (nameLen >= 5 && nameLen <= 7) {
  33686. hexStr = name.substring(1);
  33687. } else {
  33688. return -1;
  33689. }
  33690. if (hexStr === hexStr.toUpperCase()) {
  33691. unicode = parseInt(hexStr, 16);
  33692. if (unicode >= 0) {
  33693. return unicode;
  33694. }
  33695. }
  33696. }
  33697. return -1;
  33698. }
  33699. const UnicodeRanges = [
  33700. {
  33701. begin: 0x0000,
  33702. end: 0x007f
  33703. },
  33704. {
  33705. begin: 0x0080,
  33706. end: 0x00ff
  33707. },
  33708. {
  33709. begin: 0x0100,
  33710. end: 0x017f
  33711. },
  33712. {
  33713. begin: 0x0180,
  33714. end: 0x024f
  33715. },
  33716. {
  33717. begin: 0x0250,
  33718. end: 0x02af
  33719. },
  33720. {
  33721. begin: 0x02b0,
  33722. end: 0x02ff
  33723. },
  33724. {
  33725. begin: 0x0300,
  33726. end: 0x036f
  33727. },
  33728. {
  33729. begin: 0x0370,
  33730. end: 0x03ff
  33731. },
  33732. {
  33733. begin: 0x2c80,
  33734. end: 0x2cff
  33735. },
  33736. {
  33737. begin: 0x0400,
  33738. end: 0x04ff
  33739. },
  33740. {
  33741. begin: 0x0530,
  33742. end: 0x058f
  33743. },
  33744. {
  33745. begin: 0x0590,
  33746. end: 0x05ff
  33747. },
  33748. {
  33749. begin: 0xa500,
  33750. end: 0xa63f
  33751. },
  33752. {
  33753. begin: 0x0600,
  33754. end: 0x06ff
  33755. },
  33756. {
  33757. begin: 0x07c0,
  33758. end: 0x07ff
  33759. },
  33760. {
  33761. begin: 0x0900,
  33762. end: 0x097f
  33763. },
  33764. {
  33765. begin: 0x0980,
  33766. end: 0x09ff
  33767. },
  33768. {
  33769. begin: 0x0a00,
  33770. end: 0x0a7f
  33771. },
  33772. {
  33773. begin: 0x0a80,
  33774. end: 0x0aff
  33775. },
  33776. {
  33777. begin: 0x0b00,
  33778. end: 0x0b7f
  33779. },
  33780. {
  33781. begin: 0x0b80,
  33782. end: 0x0bff
  33783. },
  33784. {
  33785. begin: 0x0c00,
  33786. end: 0x0c7f
  33787. },
  33788. {
  33789. begin: 0x0c80,
  33790. end: 0x0cff
  33791. },
  33792. {
  33793. begin: 0x0d00,
  33794. end: 0x0d7f
  33795. },
  33796. {
  33797. begin: 0x0e00,
  33798. end: 0x0e7f
  33799. },
  33800. {
  33801. begin: 0x0e80,
  33802. end: 0x0eff
  33803. },
  33804. {
  33805. begin: 0x10a0,
  33806. end: 0x10ff
  33807. },
  33808. {
  33809. begin: 0x1b00,
  33810. end: 0x1b7f
  33811. },
  33812. {
  33813. begin: 0x1100,
  33814. end: 0x11ff
  33815. },
  33816. {
  33817. begin: 0x1e00,
  33818. end: 0x1eff
  33819. },
  33820. {
  33821. begin: 0x1f00,
  33822. end: 0x1fff
  33823. },
  33824. {
  33825. begin: 0x2000,
  33826. end: 0x206f
  33827. },
  33828. {
  33829. begin: 0x2070,
  33830. end: 0x209f
  33831. },
  33832. {
  33833. begin: 0x20a0,
  33834. end: 0x20cf
  33835. },
  33836. {
  33837. begin: 0x20d0,
  33838. end: 0x20ff
  33839. },
  33840. {
  33841. begin: 0x2100,
  33842. end: 0x214f
  33843. },
  33844. {
  33845. begin: 0x2150,
  33846. end: 0x218f
  33847. },
  33848. {
  33849. begin: 0x2190,
  33850. end: 0x21ff
  33851. },
  33852. {
  33853. begin: 0x2200,
  33854. end: 0x22ff
  33855. },
  33856. {
  33857. begin: 0x2300,
  33858. end: 0x23ff
  33859. },
  33860. {
  33861. begin: 0x2400,
  33862. end: 0x243f
  33863. },
  33864. {
  33865. begin: 0x2440,
  33866. end: 0x245f
  33867. },
  33868. {
  33869. begin: 0x2460,
  33870. end: 0x24ff
  33871. },
  33872. {
  33873. begin: 0x2500,
  33874. end: 0x257f
  33875. },
  33876. {
  33877. begin: 0x2580,
  33878. end: 0x259f
  33879. },
  33880. {
  33881. begin: 0x25a0,
  33882. end: 0x25ff
  33883. },
  33884. {
  33885. begin: 0x2600,
  33886. end: 0x26ff
  33887. },
  33888. {
  33889. begin: 0x2700,
  33890. end: 0x27bf
  33891. },
  33892. {
  33893. begin: 0x3000,
  33894. end: 0x303f
  33895. },
  33896. {
  33897. begin: 0x3040,
  33898. end: 0x309f
  33899. },
  33900. {
  33901. begin: 0x30a0,
  33902. end: 0x30ff
  33903. },
  33904. {
  33905. begin: 0x3100,
  33906. end: 0x312f
  33907. },
  33908. {
  33909. begin: 0x3130,
  33910. end: 0x318f
  33911. },
  33912. {
  33913. begin: 0xa840,
  33914. end: 0xa87f
  33915. },
  33916. {
  33917. begin: 0x3200,
  33918. end: 0x32ff
  33919. },
  33920. {
  33921. begin: 0x3300,
  33922. end: 0x33ff
  33923. },
  33924. {
  33925. begin: 0xac00,
  33926. end: 0xd7af
  33927. },
  33928. {
  33929. begin: 0xd800,
  33930. end: 0xdfff
  33931. },
  33932. {
  33933. begin: 0x10900,
  33934. end: 0x1091f
  33935. },
  33936. {
  33937. begin: 0x4e00,
  33938. end: 0x9fff
  33939. },
  33940. {
  33941. begin: 0xe000,
  33942. end: 0xf8ff
  33943. },
  33944. {
  33945. begin: 0x31c0,
  33946. end: 0x31ef
  33947. },
  33948. {
  33949. begin: 0xfb00,
  33950. end: 0xfb4f
  33951. },
  33952. {
  33953. begin: 0xfb50,
  33954. end: 0xfdff
  33955. },
  33956. {
  33957. begin: 0xfe20,
  33958. end: 0xfe2f
  33959. },
  33960. {
  33961. begin: 0xfe10,
  33962. end: 0xfe1f
  33963. },
  33964. {
  33965. begin: 0xfe50,
  33966. end: 0xfe6f
  33967. },
  33968. {
  33969. begin: 0xfe70,
  33970. end: 0xfeff
  33971. },
  33972. {
  33973. begin: 0xff00,
  33974. end: 0xffef
  33975. },
  33976. {
  33977. begin: 0xfff0,
  33978. end: 0xffff
  33979. },
  33980. {
  33981. begin: 0x0f00,
  33982. end: 0x0fff
  33983. },
  33984. {
  33985. begin: 0x0700,
  33986. end: 0x074f
  33987. },
  33988. {
  33989. begin: 0x0780,
  33990. end: 0x07bf
  33991. },
  33992. {
  33993. begin: 0x0d80,
  33994. end: 0x0dff
  33995. },
  33996. {
  33997. begin: 0x1000,
  33998. end: 0x109f
  33999. },
  34000. {
  34001. begin: 0x1200,
  34002. end: 0x137f
  34003. },
  34004. {
  34005. begin: 0x13a0,
  34006. end: 0x13ff
  34007. },
  34008. {
  34009. begin: 0x1400,
  34010. end: 0x167f
  34011. },
  34012. {
  34013. begin: 0x1680,
  34014. end: 0x169f
  34015. },
  34016. {
  34017. begin: 0x16a0,
  34018. end: 0x16ff
  34019. },
  34020. {
  34021. begin: 0x1780,
  34022. end: 0x17ff
  34023. },
  34024. {
  34025. begin: 0x1800,
  34026. end: 0x18af
  34027. },
  34028. {
  34029. begin: 0x2800,
  34030. end: 0x28ff
  34031. },
  34032. {
  34033. begin: 0xa000,
  34034. end: 0xa48f
  34035. },
  34036. {
  34037. begin: 0x1700,
  34038. end: 0x171f
  34039. },
  34040. {
  34041. begin: 0x10300,
  34042. end: 0x1032f
  34043. },
  34044. {
  34045. begin: 0x10330,
  34046. end: 0x1034f
  34047. },
  34048. {
  34049. begin: 0x10400,
  34050. end: 0x1044f
  34051. },
  34052. {
  34053. begin: 0x1d000,
  34054. end: 0x1d0ff
  34055. },
  34056. {
  34057. begin: 0x1d400,
  34058. end: 0x1d7ff
  34059. },
  34060. {
  34061. begin: 0xff000,
  34062. end: 0xffffd
  34063. },
  34064. {
  34065. begin: 0xfe00,
  34066. end: 0xfe0f
  34067. },
  34068. {
  34069. begin: 0xe0000,
  34070. end: 0xe007f
  34071. },
  34072. {
  34073. begin: 0x1900,
  34074. end: 0x194f
  34075. },
  34076. {
  34077. begin: 0x1950,
  34078. end: 0x197f
  34079. },
  34080. {
  34081. begin: 0x1980,
  34082. end: 0x19df
  34083. },
  34084. {
  34085. begin: 0x1a00,
  34086. end: 0x1a1f
  34087. },
  34088. {
  34089. begin: 0x2c00,
  34090. end: 0x2c5f
  34091. },
  34092. {
  34093. begin: 0x2d30,
  34094. end: 0x2d7f
  34095. },
  34096. {
  34097. begin: 0x4dc0,
  34098. end: 0x4dff
  34099. },
  34100. {
  34101. begin: 0xa800,
  34102. end: 0xa82f
  34103. },
  34104. {
  34105. begin: 0x10000,
  34106. end: 0x1007f
  34107. },
  34108. {
  34109. begin: 0x10140,
  34110. end: 0x1018f
  34111. },
  34112. {
  34113. begin: 0x10380,
  34114. end: 0x1039f
  34115. },
  34116. {
  34117. begin: 0x103a0,
  34118. end: 0x103df
  34119. },
  34120. {
  34121. begin: 0x10450,
  34122. end: 0x1047f
  34123. },
  34124. {
  34125. begin: 0x10480,
  34126. end: 0x104af
  34127. },
  34128. {
  34129. begin: 0x10800,
  34130. end: 0x1083f
  34131. },
  34132. {
  34133. begin: 0x10a00,
  34134. end: 0x10a5f
  34135. },
  34136. {
  34137. begin: 0x1d300,
  34138. end: 0x1d35f
  34139. },
  34140. {
  34141. begin: 0x12000,
  34142. end: 0x123ff
  34143. },
  34144. {
  34145. begin: 0x1d360,
  34146. end: 0x1d37f
  34147. },
  34148. {
  34149. begin: 0x1b80,
  34150. end: 0x1bbf
  34151. },
  34152. {
  34153. begin: 0x1c00,
  34154. end: 0x1c4f
  34155. },
  34156. {
  34157. begin: 0x1c50,
  34158. end: 0x1c7f
  34159. },
  34160. {
  34161. begin: 0xa880,
  34162. end: 0xa8df
  34163. },
  34164. {
  34165. begin: 0xa900,
  34166. end: 0xa92f
  34167. },
  34168. {
  34169. begin: 0xa930,
  34170. end: 0xa95f
  34171. },
  34172. {
  34173. begin: 0xaa00,
  34174. end: 0xaa5f
  34175. },
  34176. {
  34177. begin: 0x10190,
  34178. end: 0x101cf
  34179. },
  34180. {
  34181. begin: 0x101d0,
  34182. end: 0x101ff
  34183. },
  34184. {
  34185. begin: 0x102a0,
  34186. end: 0x102df
  34187. },
  34188. {
  34189. begin: 0x1f030,
  34190. end: 0x1f09f
  34191. }
  34192. ];
  34193. function getUnicodeRangeFor(value) {
  34194. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  34195. const range = UnicodeRanges[i];
  34196. if (value >= range.begin && value < range.end) {
  34197. return i;
  34198. }
  34199. }
  34200. return -1;
  34201. }
  34202. function isRTLRangeFor(value) {
  34203. let range = UnicodeRanges[13];
  34204. if (value >= range.begin && value < range.end) {
  34205. return true;
  34206. }
  34207. range = UnicodeRanges[11];
  34208. if (value >= range.begin && value < range.end) {
  34209. return true;
  34210. }
  34211. return false;
  34212. }
  34213. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  34214. return [
  34215. "\u00A8",
  34216. "\u0020\u0308",
  34217. "\u00AF",
  34218. "\u0020\u0304",
  34219. "\u00B4",
  34220. "\u0020\u0301",
  34221. "\u00B5",
  34222. "\u03BC",
  34223. "\u00B8",
  34224. "\u0020\u0327",
  34225. "\u0132",
  34226. "\u0049\u004A",
  34227. "\u0133",
  34228. "\u0069\u006A",
  34229. "\u013F",
  34230. "\u004C\u00B7",
  34231. "\u0140",
  34232. "\u006C\u00B7",
  34233. "\u0149",
  34234. "\u02BC\u006E",
  34235. "\u017F",
  34236. "\u0073",
  34237. "\u01C4",
  34238. "\u0044\u017D",
  34239. "\u01C5",
  34240. "\u0044\u017E",
  34241. "\u01C6",
  34242. "\u0064\u017E",
  34243. "\u01C7",
  34244. "\u004C\u004A",
  34245. "\u01C8",
  34246. "\u004C\u006A",
  34247. "\u01C9",
  34248. "\u006C\u006A",
  34249. "\u01CA",
  34250. "\u004E\u004A",
  34251. "\u01CB",
  34252. "\u004E\u006A",
  34253. "\u01CC",
  34254. "\u006E\u006A",
  34255. "\u01F1",
  34256. "\u0044\u005A",
  34257. "\u01F2",
  34258. "\u0044\u007A",
  34259. "\u01F3",
  34260. "\u0064\u007A",
  34261. "\u02D8",
  34262. "\u0020\u0306",
  34263. "\u02D9",
  34264. "\u0020\u0307",
  34265. "\u02DA",
  34266. "\u0020\u030A",
  34267. "\u02DB",
  34268. "\u0020\u0328",
  34269. "\u02DC",
  34270. "\u0020\u0303",
  34271. "\u02DD",
  34272. "\u0020\u030B",
  34273. "\u037A",
  34274. "\u0020\u0345",
  34275. "\u0384",
  34276. "\u0020\u0301",
  34277. "\u03D0",
  34278. "\u03B2",
  34279. "\u03D1",
  34280. "\u03B8",
  34281. "\u03D2",
  34282. "\u03A5",
  34283. "\u03D5",
  34284. "\u03C6",
  34285. "\u03D6",
  34286. "\u03C0",
  34287. "\u03F0",
  34288. "\u03BA",
  34289. "\u03F1",
  34290. "\u03C1",
  34291. "\u03F2",
  34292. "\u03C2",
  34293. "\u03F4",
  34294. "\u0398",
  34295. "\u03F5",
  34296. "\u03B5",
  34297. "\u03F9",
  34298. "\u03A3",
  34299. "\u0587",
  34300. "\u0565\u0582",
  34301. "\u0675",
  34302. "\u0627\u0674",
  34303. "\u0676",
  34304. "\u0648\u0674",
  34305. "\u0677",
  34306. "\u06C7\u0674",
  34307. "\u0678",
  34308. "\u064A\u0674",
  34309. "\u0E33",
  34310. "\u0E4D\u0E32",
  34311. "\u0EB3",
  34312. "\u0ECD\u0EB2",
  34313. "\u0EDC",
  34314. "\u0EAB\u0E99",
  34315. "\u0EDD",
  34316. "\u0EAB\u0EA1",
  34317. "\u0F77",
  34318. "\u0FB2\u0F81",
  34319. "\u0F79",
  34320. "\u0FB3\u0F81",
  34321. "\u1E9A",
  34322. "\u0061\u02BE",
  34323. "\u1FBD",
  34324. "\u0020\u0313",
  34325. "\u1FBF",
  34326. "\u0020\u0313",
  34327. "\u1FC0",
  34328. "\u0020\u0342",
  34329. "\u1FFE",
  34330. "\u0020\u0314",
  34331. "\u2002",
  34332. "\u0020",
  34333. "\u2003",
  34334. "\u0020",
  34335. "\u2004",
  34336. "\u0020",
  34337. "\u2005",
  34338. "\u0020",
  34339. "\u2006",
  34340. "\u0020",
  34341. "\u2008",
  34342. "\u0020",
  34343. "\u2009",
  34344. "\u0020",
  34345. "\u200A",
  34346. "\u0020",
  34347. "\u2017",
  34348. "\u0020\u0333",
  34349. "\u2024",
  34350. "\u002E",
  34351. "\u2025",
  34352. "\u002E\u002E",
  34353. "\u2026",
  34354. "\u002E\u002E\u002E",
  34355. "\u2033",
  34356. "\u2032\u2032",
  34357. "\u2034",
  34358. "\u2032\u2032\u2032",
  34359. "\u2036",
  34360. "\u2035\u2035",
  34361. "\u2037",
  34362. "\u2035\u2035\u2035",
  34363. "\u203C",
  34364. "\u0021\u0021",
  34365. "\u203E",
  34366. "\u0020\u0305",
  34367. "\u2047",
  34368. "\u003F\u003F",
  34369. "\u2048",
  34370. "\u003F\u0021",
  34371. "\u2049",
  34372. "\u0021\u003F",
  34373. "\u2057",
  34374. "\u2032\u2032\u2032\u2032",
  34375. "\u205F",
  34376. "\u0020",
  34377. "\u20A8",
  34378. "\u0052\u0073",
  34379. "\u2100",
  34380. "\u0061\u002F\u0063",
  34381. "\u2101",
  34382. "\u0061\u002F\u0073",
  34383. "\u2103",
  34384. "\u00B0\u0043",
  34385. "\u2105",
  34386. "\u0063\u002F\u006F",
  34387. "\u2106",
  34388. "\u0063\u002F\u0075",
  34389. "\u2107",
  34390. "\u0190",
  34391. "\u2109",
  34392. "\u00B0\u0046",
  34393. "\u2116",
  34394. "\u004E\u006F",
  34395. "\u2121",
  34396. "\u0054\u0045\u004C",
  34397. "\u2135",
  34398. "\u05D0",
  34399. "\u2136",
  34400. "\u05D1",
  34401. "\u2137",
  34402. "\u05D2",
  34403. "\u2138",
  34404. "\u05D3",
  34405. "\u213B",
  34406. "\u0046\u0041\u0058",
  34407. "\u2160",
  34408. "\u0049",
  34409. "\u2161",
  34410. "\u0049\u0049",
  34411. "\u2162",
  34412. "\u0049\u0049\u0049",
  34413. "\u2163",
  34414. "\u0049\u0056",
  34415. "\u2164",
  34416. "\u0056",
  34417. "\u2165",
  34418. "\u0056\u0049",
  34419. "\u2166",
  34420. "\u0056\u0049\u0049",
  34421. "\u2167",
  34422. "\u0056\u0049\u0049\u0049",
  34423. "\u2168",
  34424. "\u0049\u0058",
  34425. "\u2169",
  34426. "\u0058",
  34427. "\u216A",
  34428. "\u0058\u0049",
  34429. "\u216B",
  34430. "\u0058\u0049\u0049",
  34431. "\u216C",
  34432. "\u004C",
  34433. "\u216D",
  34434. "\u0043",
  34435. "\u216E",
  34436. "\u0044",
  34437. "\u216F",
  34438. "\u004D",
  34439. "\u2170",
  34440. "\u0069",
  34441. "\u2171",
  34442. "\u0069\u0069",
  34443. "\u2172",
  34444. "\u0069\u0069\u0069",
  34445. "\u2173",
  34446. "\u0069\u0076",
  34447. "\u2174",
  34448. "\u0076",
  34449. "\u2175",
  34450. "\u0076\u0069",
  34451. "\u2176",
  34452. "\u0076\u0069\u0069",
  34453. "\u2177",
  34454. "\u0076\u0069\u0069\u0069",
  34455. "\u2178",
  34456. "\u0069\u0078",
  34457. "\u2179",
  34458. "\u0078",
  34459. "\u217A",
  34460. "\u0078\u0069",
  34461. "\u217B",
  34462. "\u0078\u0069\u0069",
  34463. "\u217C",
  34464. "\u006C",
  34465. "\u217D",
  34466. "\u0063",
  34467. "\u217E",
  34468. "\u0064",
  34469. "\u217F",
  34470. "\u006D",
  34471. "\u222C",
  34472. "\u222B\u222B",
  34473. "\u222D",
  34474. "\u222B\u222B\u222B",
  34475. "\u222F",
  34476. "\u222E\u222E",
  34477. "\u2230",
  34478. "\u222E\u222E\u222E",
  34479. "\u2474",
  34480. "\u0028\u0031\u0029",
  34481. "\u2475",
  34482. "\u0028\u0032\u0029",
  34483. "\u2476",
  34484. "\u0028\u0033\u0029",
  34485. "\u2477",
  34486. "\u0028\u0034\u0029",
  34487. "\u2478",
  34488. "\u0028\u0035\u0029",
  34489. "\u2479",
  34490. "\u0028\u0036\u0029",
  34491. "\u247A",
  34492. "\u0028\u0037\u0029",
  34493. "\u247B",
  34494. "\u0028\u0038\u0029",
  34495. "\u247C",
  34496. "\u0028\u0039\u0029",
  34497. "\u247D",
  34498. "\u0028\u0031\u0030\u0029",
  34499. "\u247E",
  34500. "\u0028\u0031\u0031\u0029",
  34501. "\u247F",
  34502. "\u0028\u0031\u0032\u0029",
  34503. "\u2480",
  34504. "\u0028\u0031\u0033\u0029",
  34505. "\u2481",
  34506. "\u0028\u0031\u0034\u0029",
  34507. "\u2482",
  34508. "\u0028\u0031\u0035\u0029",
  34509. "\u2483",
  34510. "\u0028\u0031\u0036\u0029",
  34511. "\u2484",
  34512. "\u0028\u0031\u0037\u0029",
  34513. "\u2485",
  34514. "\u0028\u0031\u0038\u0029",
  34515. "\u2486",
  34516. "\u0028\u0031\u0039\u0029",
  34517. "\u2487",
  34518. "\u0028\u0032\u0030\u0029",
  34519. "\u2488",
  34520. "\u0031\u002E",
  34521. "\u2489",
  34522. "\u0032\u002E",
  34523. "\u248A",
  34524. "\u0033\u002E",
  34525. "\u248B",
  34526. "\u0034\u002E",
  34527. "\u248C",
  34528. "\u0035\u002E",
  34529. "\u248D",
  34530. "\u0036\u002E",
  34531. "\u248E",
  34532. "\u0037\u002E",
  34533. "\u248F",
  34534. "\u0038\u002E",
  34535. "\u2490",
  34536. "\u0039\u002E",
  34537. "\u2491",
  34538. "\u0031\u0030\u002E",
  34539. "\u2492",
  34540. "\u0031\u0031\u002E",
  34541. "\u2493",
  34542. "\u0031\u0032\u002E",
  34543. "\u2494",
  34544. "\u0031\u0033\u002E",
  34545. "\u2495",
  34546. "\u0031\u0034\u002E",
  34547. "\u2496",
  34548. "\u0031\u0035\u002E",
  34549. "\u2497",
  34550. "\u0031\u0036\u002E",
  34551. "\u2498",
  34552. "\u0031\u0037\u002E",
  34553. "\u2499",
  34554. "\u0031\u0038\u002E",
  34555. "\u249A",
  34556. "\u0031\u0039\u002E",
  34557. "\u249B",
  34558. "\u0032\u0030\u002E",
  34559. "\u249C",
  34560. "\u0028\u0061\u0029",
  34561. "\u249D",
  34562. "\u0028\u0062\u0029",
  34563. "\u249E",
  34564. "\u0028\u0063\u0029",
  34565. "\u249F",
  34566. "\u0028\u0064\u0029",
  34567. "\u24A0",
  34568. "\u0028\u0065\u0029",
  34569. "\u24A1",
  34570. "\u0028\u0066\u0029",
  34571. "\u24A2",
  34572. "\u0028\u0067\u0029",
  34573. "\u24A3",
  34574. "\u0028\u0068\u0029",
  34575. "\u24A4",
  34576. "\u0028\u0069\u0029",
  34577. "\u24A5",
  34578. "\u0028\u006A\u0029",
  34579. "\u24A6",
  34580. "\u0028\u006B\u0029",
  34581. "\u24A7",
  34582. "\u0028\u006C\u0029",
  34583. "\u24A8",
  34584. "\u0028\u006D\u0029",
  34585. "\u24A9",
  34586. "\u0028\u006E\u0029",
  34587. "\u24AA",
  34588. "\u0028\u006F\u0029",
  34589. "\u24AB",
  34590. "\u0028\u0070\u0029",
  34591. "\u24AC",
  34592. "\u0028\u0071\u0029",
  34593. "\u24AD",
  34594. "\u0028\u0072\u0029",
  34595. "\u24AE",
  34596. "\u0028\u0073\u0029",
  34597. "\u24AF",
  34598. "\u0028\u0074\u0029",
  34599. "\u24B0",
  34600. "\u0028\u0075\u0029",
  34601. "\u24B1",
  34602. "\u0028\u0076\u0029",
  34603. "\u24B2",
  34604. "\u0028\u0077\u0029",
  34605. "\u24B3",
  34606. "\u0028\u0078\u0029",
  34607. "\u24B4",
  34608. "\u0028\u0079\u0029",
  34609. "\u24B5",
  34610. "\u0028\u007A\u0029",
  34611. "\u2A0C",
  34612. "\u222B\u222B\u222B\u222B",
  34613. "\u2A74",
  34614. "\u003A\u003A\u003D",
  34615. "\u2A75",
  34616. "\u003D\u003D",
  34617. "\u2A76",
  34618. "\u003D\u003D\u003D",
  34619. "\u2E9F",
  34620. "\u6BCD",
  34621. "\u2EF3",
  34622. "\u9F9F",
  34623. "\u2F00",
  34624. "\u4E00",
  34625. "\u2F01",
  34626. "\u4E28",
  34627. "\u2F02",
  34628. "\u4E36",
  34629. "\u2F03",
  34630. "\u4E3F",
  34631. "\u2F04",
  34632. "\u4E59",
  34633. "\u2F05",
  34634. "\u4E85",
  34635. "\u2F06",
  34636. "\u4E8C",
  34637. "\u2F07",
  34638. "\u4EA0",
  34639. "\u2F08",
  34640. "\u4EBA",
  34641. "\u2F09",
  34642. "\u513F",
  34643. "\u2F0A",
  34644. "\u5165",
  34645. "\u2F0B",
  34646. "\u516B",
  34647. "\u2F0C",
  34648. "\u5182",
  34649. "\u2F0D",
  34650. "\u5196",
  34651. "\u2F0E",
  34652. "\u51AB",
  34653. "\u2F0F",
  34654. "\u51E0",
  34655. "\u2F10",
  34656. "\u51F5",
  34657. "\u2F11",
  34658. "\u5200",
  34659. "\u2F12",
  34660. "\u529B",
  34661. "\u2F13",
  34662. "\u52F9",
  34663. "\u2F14",
  34664. "\u5315",
  34665. "\u2F15",
  34666. "\u531A",
  34667. "\u2F16",
  34668. "\u5338",
  34669. "\u2F17",
  34670. "\u5341",
  34671. "\u2F18",
  34672. "\u535C",
  34673. "\u2F19",
  34674. "\u5369",
  34675. "\u2F1A",
  34676. "\u5382",
  34677. "\u2F1B",
  34678. "\u53B6",
  34679. "\u2F1C",
  34680. "\u53C8",
  34681. "\u2F1D",
  34682. "\u53E3",
  34683. "\u2F1E",
  34684. "\u56D7",
  34685. "\u2F1F",
  34686. "\u571F",
  34687. "\u2F20",
  34688. "\u58EB",
  34689. "\u2F21",
  34690. "\u5902",
  34691. "\u2F22",
  34692. "\u590A",
  34693. "\u2F23",
  34694. "\u5915",
  34695. "\u2F24",
  34696. "\u5927",
  34697. "\u2F25",
  34698. "\u5973",
  34699. "\u2F26",
  34700. "\u5B50",
  34701. "\u2F27",
  34702. "\u5B80",
  34703. "\u2F28",
  34704. "\u5BF8",
  34705. "\u2F29",
  34706. "\u5C0F",
  34707. "\u2F2A",
  34708. "\u5C22",
  34709. "\u2F2B",
  34710. "\u5C38",
  34711. "\u2F2C",
  34712. "\u5C6E",
  34713. "\u2F2D",
  34714. "\u5C71",
  34715. "\u2F2E",
  34716. "\u5DDB",
  34717. "\u2F2F",
  34718. "\u5DE5",
  34719. "\u2F30",
  34720. "\u5DF1",
  34721. "\u2F31",
  34722. "\u5DFE",
  34723. "\u2F32",
  34724. "\u5E72",
  34725. "\u2F33",
  34726. "\u5E7A",
  34727. "\u2F34",
  34728. "\u5E7F",
  34729. "\u2F35",
  34730. "\u5EF4",
  34731. "\u2F36",
  34732. "\u5EFE",
  34733. "\u2F37",
  34734. "\u5F0B",
  34735. "\u2F38",
  34736. "\u5F13",
  34737. "\u2F39",
  34738. "\u5F50",
  34739. "\u2F3A",
  34740. "\u5F61",
  34741. "\u2F3B",
  34742. "\u5F73",
  34743. "\u2F3C",
  34744. "\u5FC3",
  34745. "\u2F3D",
  34746. "\u6208",
  34747. "\u2F3E",
  34748. "\u6236",
  34749. "\u2F3F",
  34750. "\u624B",
  34751. "\u2F40",
  34752. "\u652F",
  34753. "\u2F41",
  34754. "\u6534",
  34755. "\u2F42",
  34756. "\u6587",
  34757. "\u2F43",
  34758. "\u6597",
  34759. "\u2F44",
  34760. "\u65A4",
  34761. "\u2F45",
  34762. "\u65B9",
  34763. "\u2F46",
  34764. "\u65E0",
  34765. "\u2F47",
  34766. "\u65E5",
  34767. "\u2F48",
  34768. "\u66F0",
  34769. "\u2F49",
  34770. "\u6708",
  34771. "\u2F4A",
  34772. "\u6728",
  34773. "\u2F4B",
  34774. "\u6B20",
  34775. "\u2F4C",
  34776. "\u6B62",
  34777. "\u2F4D",
  34778. "\u6B79",
  34779. "\u2F4E",
  34780. "\u6BB3",
  34781. "\u2F4F",
  34782. "\u6BCB",
  34783. "\u2F50",
  34784. "\u6BD4",
  34785. "\u2F51",
  34786. "\u6BDB",
  34787. "\u2F52",
  34788. "\u6C0F",
  34789. "\u2F53",
  34790. "\u6C14",
  34791. "\u2F54",
  34792. "\u6C34",
  34793. "\u2F55",
  34794. "\u706B",
  34795. "\u2F56",
  34796. "\u722A",
  34797. "\u2F57",
  34798. "\u7236",
  34799. "\u2F58",
  34800. "\u723B",
  34801. "\u2F59",
  34802. "\u723F",
  34803. "\u2F5A",
  34804. "\u7247",
  34805. "\u2F5B",
  34806. "\u7259",
  34807. "\u2F5C",
  34808. "\u725B",
  34809. "\u2F5D",
  34810. "\u72AC",
  34811. "\u2F5E",
  34812. "\u7384",
  34813. "\u2F5F",
  34814. "\u7389",
  34815. "\u2F60",
  34816. "\u74DC",
  34817. "\u2F61",
  34818. "\u74E6",
  34819. "\u2F62",
  34820. "\u7518",
  34821. "\u2F63",
  34822. "\u751F",
  34823. "\u2F64",
  34824. "\u7528",
  34825. "\u2F65",
  34826. "\u7530",
  34827. "\u2F66",
  34828. "\u758B",
  34829. "\u2F67",
  34830. "\u7592",
  34831. "\u2F68",
  34832. "\u7676",
  34833. "\u2F69",
  34834. "\u767D",
  34835. "\u2F6A",
  34836. "\u76AE",
  34837. "\u2F6B",
  34838. "\u76BF",
  34839. "\u2F6C",
  34840. "\u76EE",
  34841. "\u2F6D",
  34842. "\u77DB",
  34843. "\u2F6E",
  34844. "\u77E2",
  34845. "\u2F6F",
  34846. "\u77F3",
  34847. "\u2F70",
  34848. "\u793A",
  34849. "\u2F71",
  34850. "\u79B8",
  34851. "\u2F72",
  34852. "\u79BE",
  34853. "\u2F73",
  34854. "\u7A74",
  34855. "\u2F74",
  34856. "\u7ACB",
  34857. "\u2F75",
  34858. "\u7AF9",
  34859. "\u2F76",
  34860. "\u7C73",
  34861. "\u2F77",
  34862. "\u7CF8",
  34863. "\u2F78",
  34864. "\u7F36",
  34865. "\u2F79",
  34866. "\u7F51",
  34867. "\u2F7A",
  34868. "\u7F8A",
  34869. "\u2F7B",
  34870. "\u7FBD",
  34871. "\u2F7C",
  34872. "\u8001",
  34873. "\u2F7D",
  34874. "\u800C",
  34875. "\u2F7E",
  34876. "\u8012",
  34877. "\u2F7F",
  34878. "\u8033",
  34879. "\u2F80",
  34880. "\u807F",
  34881. "\u2F81",
  34882. "\u8089",
  34883. "\u2F82",
  34884. "\u81E3",
  34885. "\u2F83",
  34886. "\u81EA",
  34887. "\u2F84",
  34888. "\u81F3",
  34889. "\u2F85",
  34890. "\u81FC",
  34891. "\u2F86",
  34892. "\u820C",
  34893. "\u2F87",
  34894. "\u821B",
  34895. "\u2F88",
  34896. "\u821F",
  34897. "\u2F89",
  34898. "\u826E",
  34899. "\u2F8A",
  34900. "\u8272",
  34901. "\u2F8B",
  34902. "\u8278",
  34903. "\u2F8C",
  34904. "\u864D",
  34905. "\u2F8D",
  34906. "\u866B",
  34907. "\u2F8E",
  34908. "\u8840",
  34909. "\u2F8F",
  34910. "\u884C",
  34911. "\u2F90",
  34912. "\u8863",
  34913. "\u2F91",
  34914. "\u897E",
  34915. "\u2F92",
  34916. "\u898B",
  34917. "\u2F93",
  34918. "\u89D2",
  34919. "\u2F94",
  34920. "\u8A00",
  34921. "\u2F95",
  34922. "\u8C37",
  34923. "\u2F96",
  34924. "\u8C46",
  34925. "\u2F97",
  34926. "\u8C55",
  34927. "\u2F98",
  34928. "\u8C78",
  34929. "\u2F99",
  34930. "\u8C9D",
  34931. "\u2F9A",
  34932. "\u8D64",
  34933. "\u2F9B",
  34934. "\u8D70",
  34935. "\u2F9C",
  34936. "\u8DB3",
  34937. "\u2F9D",
  34938. "\u8EAB",
  34939. "\u2F9E",
  34940. "\u8ECA",
  34941. "\u2F9F",
  34942. "\u8F9B",
  34943. "\u2FA0",
  34944. "\u8FB0",
  34945. "\u2FA1",
  34946. "\u8FB5",
  34947. "\u2FA2",
  34948. "\u9091",
  34949. "\u2FA3",
  34950. "\u9149",
  34951. "\u2FA4",
  34952. "\u91C6",
  34953. "\u2FA5",
  34954. "\u91CC",
  34955. "\u2FA6",
  34956. "\u91D1",
  34957. "\u2FA7",
  34958. "\u9577",
  34959. "\u2FA8",
  34960. "\u9580",
  34961. "\u2FA9",
  34962. "\u961C",
  34963. "\u2FAA",
  34964. "\u96B6",
  34965. "\u2FAB",
  34966. "\u96B9",
  34967. "\u2FAC",
  34968. "\u96E8",
  34969. "\u2FAD",
  34970. "\u9751",
  34971. "\u2FAE",
  34972. "\u975E",
  34973. "\u2FAF",
  34974. "\u9762",
  34975. "\u2FB0",
  34976. "\u9769",
  34977. "\u2FB1",
  34978. "\u97CB",
  34979. "\u2FB2",
  34980. "\u97ED",
  34981. "\u2FB3",
  34982. "\u97F3",
  34983. "\u2FB4",
  34984. "\u9801",
  34985. "\u2FB5",
  34986. "\u98A8",
  34987. "\u2FB6",
  34988. "\u98DB",
  34989. "\u2FB7",
  34990. "\u98DF",
  34991. "\u2FB8",
  34992. "\u9996",
  34993. "\u2FB9",
  34994. "\u9999",
  34995. "\u2FBA",
  34996. "\u99AC",
  34997. "\u2FBB",
  34998. "\u9AA8",
  34999. "\u2FBC",
  35000. "\u9AD8",
  35001. "\u2FBD",
  35002. "\u9ADF",
  35003. "\u2FBE",
  35004. "\u9B25",
  35005. "\u2FBF",
  35006. "\u9B2F",
  35007. "\u2FC0",
  35008. "\u9B32",
  35009. "\u2FC1",
  35010. "\u9B3C",
  35011. "\u2FC2",
  35012. "\u9B5A",
  35013. "\u2FC3",
  35014. "\u9CE5",
  35015. "\u2FC4",
  35016. "\u9E75",
  35017. "\u2FC5",
  35018. "\u9E7F",
  35019. "\u2FC6",
  35020. "\u9EA5",
  35021. "\u2FC7",
  35022. "\u9EBB",
  35023. "\u2FC8",
  35024. "\u9EC3",
  35025. "\u2FC9",
  35026. "\u9ECD",
  35027. "\u2FCA",
  35028. "\u9ED1",
  35029. "\u2FCB",
  35030. "\u9EF9",
  35031. "\u2FCC",
  35032. "\u9EFD",
  35033. "\u2FCD",
  35034. "\u9F0E",
  35035. "\u2FCE",
  35036. "\u9F13",
  35037. "\u2FCF",
  35038. "\u9F20",
  35039. "\u2FD0",
  35040. "\u9F3B",
  35041. "\u2FD1",
  35042. "\u9F4A",
  35043. "\u2FD2",
  35044. "\u9F52",
  35045. "\u2FD3",
  35046. "\u9F8D",
  35047. "\u2FD4",
  35048. "\u9F9C",
  35049. "\u2FD5",
  35050. "\u9FA0",
  35051. "\u3036",
  35052. "\u3012",
  35053. "\u3038",
  35054. "\u5341",
  35055. "\u3039",
  35056. "\u5344",
  35057. "\u303A",
  35058. "\u5345",
  35059. "\u309B",
  35060. "\u0020\u3099",
  35061. "\u309C",
  35062. "\u0020\u309A",
  35063. "\u3131",
  35064. "\u1100",
  35065. "\u3132",
  35066. "\u1101",
  35067. "\u3133",
  35068. "\u11AA",
  35069. "\u3134",
  35070. "\u1102",
  35071. "\u3135",
  35072. "\u11AC",
  35073. "\u3136",
  35074. "\u11AD",
  35075. "\u3137",
  35076. "\u1103",
  35077. "\u3138",
  35078. "\u1104",
  35079. "\u3139",
  35080. "\u1105",
  35081. "\u313A",
  35082. "\u11B0",
  35083. "\u313B",
  35084. "\u11B1",
  35085. "\u313C",
  35086. "\u11B2",
  35087. "\u313D",
  35088. "\u11B3",
  35089. "\u313E",
  35090. "\u11B4",
  35091. "\u313F",
  35092. "\u11B5",
  35093. "\u3140",
  35094. "\u111A",
  35095. "\u3141",
  35096. "\u1106",
  35097. "\u3142",
  35098. "\u1107",
  35099. "\u3143",
  35100. "\u1108",
  35101. "\u3144",
  35102. "\u1121",
  35103. "\u3145",
  35104. "\u1109",
  35105. "\u3146",
  35106. "\u110A",
  35107. "\u3147",
  35108. "\u110B",
  35109. "\u3148",
  35110. "\u110C",
  35111. "\u3149",
  35112. "\u110D",
  35113. "\u314A",
  35114. "\u110E",
  35115. "\u314B",
  35116. "\u110F",
  35117. "\u314C",
  35118. "\u1110",
  35119. "\u314D",
  35120. "\u1111",
  35121. "\u314E",
  35122. "\u1112",
  35123. "\u314F",
  35124. "\u1161",
  35125. "\u3150",
  35126. "\u1162",
  35127. "\u3151",
  35128. "\u1163",
  35129. "\u3152",
  35130. "\u1164",
  35131. "\u3153",
  35132. "\u1165",
  35133. "\u3154",
  35134. "\u1166",
  35135. "\u3155",
  35136. "\u1167",
  35137. "\u3156",
  35138. "\u1168",
  35139. "\u3157",
  35140. "\u1169",
  35141. "\u3158",
  35142. "\u116A",
  35143. "\u3159",
  35144. "\u116B",
  35145. "\u315A",
  35146. "\u116C",
  35147. "\u315B",
  35148. "\u116D",
  35149. "\u315C",
  35150. "\u116E",
  35151. "\u315D",
  35152. "\u116F",
  35153. "\u315E",
  35154. "\u1170",
  35155. "\u315F",
  35156. "\u1171",
  35157. "\u3160",
  35158. "\u1172",
  35159. "\u3161",
  35160. "\u1173",
  35161. "\u3162",
  35162. "\u1174",
  35163. "\u3163",
  35164. "\u1175",
  35165. "\u3164",
  35166. "\u1160",
  35167. "\u3165",
  35168. "\u1114",
  35169. "\u3166",
  35170. "\u1115",
  35171. "\u3167",
  35172. "\u11C7",
  35173. "\u3168",
  35174. "\u11C8",
  35175. "\u3169",
  35176. "\u11CC",
  35177. "\u316A",
  35178. "\u11CE",
  35179. "\u316B",
  35180. "\u11D3",
  35181. "\u316C",
  35182. "\u11D7",
  35183. "\u316D",
  35184. "\u11D9",
  35185. "\u316E",
  35186. "\u111C",
  35187. "\u316F",
  35188. "\u11DD",
  35189. "\u3170",
  35190. "\u11DF",
  35191. "\u3171",
  35192. "\u111D",
  35193. "\u3172",
  35194. "\u111E",
  35195. "\u3173",
  35196. "\u1120",
  35197. "\u3174",
  35198. "\u1122",
  35199. "\u3175",
  35200. "\u1123",
  35201. "\u3176",
  35202. "\u1127",
  35203. "\u3177",
  35204. "\u1129",
  35205. "\u3178",
  35206. "\u112B",
  35207. "\u3179",
  35208. "\u112C",
  35209. "\u317A",
  35210. "\u112D",
  35211. "\u317B",
  35212. "\u112E",
  35213. "\u317C",
  35214. "\u112F",
  35215. "\u317D",
  35216. "\u1132",
  35217. "\u317E",
  35218. "\u1136",
  35219. "\u317F",
  35220. "\u1140",
  35221. "\u3180",
  35222. "\u1147",
  35223. "\u3181",
  35224. "\u114C",
  35225. "\u3182",
  35226. "\u11F1",
  35227. "\u3183",
  35228. "\u11F2",
  35229. "\u3184",
  35230. "\u1157",
  35231. "\u3185",
  35232. "\u1158",
  35233. "\u3186",
  35234. "\u1159",
  35235. "\u3187",
  35236. "\u1184",
  35237. "\u3188",
  35238. "\u1185",
  35239. "\u3189",
  35240. "\u1188",
  35241. "\u318A",
  35242. "\u1191",
  35243. "\u318B",
  35244. "\u1192",
  35245. "\u318C",
  35246. "\u1194",
  35247. "\u318D",
  35248. "\u119E",
  35249. "\u318E",
  35250. "\u11A1",
  35251. "\u3200",
  35252. "\u0028\u1100\u0029",
  35253. "\u3201",
  35254. "\u0028\u1102\u0029",
  35255. "\u3202",
  35256. "\u0028\u1103\u0029",
  35257. "\u3203",
  35258. "\u0028\u1105\u0029",
  35259. "\u3204",
  35260. "\u0028\u1106\u0029",
  35261. "\u3205",
  35262. "\u0028\u1107\u0029",
  35263. "\u3206",
  35264. "\u0028\u1109\u0029",
  35265. "\u3207",
  35266. "\u0028\u110B\u0029",
  35267. "\u3208",
  35268. "\u0028\u110C\u0029",
  35269. "\u3209",
  35270. "\u0028\u110E\u0029",
  35271. "\u320A",
  35272. "\u0028\u110F\u0029",
  35273. "\u320B",
  35274. "\u0028\u1110\u0029",
  35275. "\u320C",
  35276. "\u0028\u1111\u0029",
  35277. "\u320D",
  35278. "\u0028\u1112\u0029",
  35279. "\u320E",
  35280. "\u0028\u1100\u1161\u0029",
  35281. "\u320F",
  35282. "\u0028\u1102\u1161\u0029",
  35283. "\u3210",
  35284. "\u0028\u1103\u1161\u0029",
  35285. "\u3211",
  35286. "\u0028\u1105\u1161\u0029",
  35287. "\u3212",
  35288. "\u0028\u1106\u1161\u0029",
  35289. "\u3213",
  35290. "\u0028\u1107\u1161\u0029",
  35291. "\u3214",
  35292. "\u0028\u1109\u1161\u0029",
  35293. "\u3215",
  35294. "\u0028\u110B\u1161\u0029",
  35295. "\u3216",
  35296. "\u0028\u110C\u1161\u0029",
  35297. "\u3217",
  35298. "\u0028\u110E\u1161\u0029",
  35299. "\u3218",
  35300. "\u0028\u110F\u1161\u0029",
  35301. "\u3219",
  35302. "\u0028\u1110\u1161\u0029",
  35303. "\u321A",
  35304. "\u0028\u1111\u1161\u0029",
  35305. "\u321B",
  35306. "\u0028\u1112\u1161\u0029",
  35307. "\u321C",
  35308. "\u0028\u110C\u116E\u0029",
  35309. "\u321D",
  35310. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  35311. "\u321E",
  35312. "\u0028\u110B\u1169\u1112\u116E\u0029",
  35313. "\u3220",
  35314. "\u0028\u4E00\u0029",
  35315. "\u3221",
  35316. "\u0028\u4E8C\u0029",
  35317. "\u3222",
  35318. "\u0028\u4E09\u0029",
  35319. "\u3223",
  35320. "\u0028\u56DB\u0029",
  35321. "\u3224",
  35322. "\u0028\u4E94\u0029",
  35323. "\u3225",
  35324. "\u0028\u516D\u0029",
  35325. "\u3226",
  35326. "\u0028\u4E03\u0029",
  35327. "\u3227",
  35328. "\u0028\u516B\u0029",
  35329. "\u3228",
  35330. "\u0028\u4E5D\u0029",
  35331. "\u3229",
  35332. "\u0028\u5341\u0029",
  35333. "\u322A",
  35334. "\u0028\u6708\u0029",
  35335. "\u322B",
  35336. "\u0028\u706B\u0029",
  35337. "\u322C",
  35338. "\u0028\u6C34\u0029",
  35339. "\u322D",
  35340. "\u0028\u6728\u0029",
  35341. "\u322E",
  35342. "\u0028\u91D1\u0029",
  35343. "\u322F",
  35344. "\u0028\u571F\u0029",
  35345. "\u3230",
  35346. "\u0028\u65E5\u0029",
  35347. "\u3231",
  35348. "\u0028\u682A\u0029",
  35349. "\u3232",
  35350. "\u0028\u6709\u0029",
  35351. "\u3233",
  35352. "\u0028\u793E\u0029",
  35353. "\u3234",
  35354. "\u0028\u540D\u0029",
  35355. "\u3235",
  35356. "\u0028\u7279\u0029",
  35357. "\u3236",
  35358. "\u0028\u8CA1\u0029",
  35359. "\u3237",
  35360. "\u0028\u795D\u0029",
  35361. "\u3238",
  35362. "\u0028\u52B4\u0029",
  35363. "\u3239",
  35364. "\u0028\u4EE3\u0029",
  35365. "\u323A",
  35366. "\u0028\u547C\u0029",
  35367. "\u323B",
  35368. "\u0028\u5B66\u0029",
  35369. "\u323C",
  35370. "\u0028\u76E3\u0029",
  35371. "\u323D",
  35372. "\u0028\u4F01\u0029",
  35373. "\u323E",
  35374. "\u0028\u8CC7\u0029",
  35375. "\u323F",
  35376. "\u0028\u5354\u0029",
  35377. "\u3240",
  35378. "\u0028\u796D\u0029",
  35379. "\u3241",
  35380. "\u0028\u4F11\u0029",
  35381. "\u3242",
  35382. "\u0028\u81EA\u0029",
  35383. "\u3243",
  35384. "\u0028\u81F3\u0029",
  35385. "\u32C0",
  35386. "\u0031\u6708",
  35387. "\u32C1",
  35388. "\u0032\u6708",
  35389. "\u32C2",
  35390. "\u0033\u6708",
  35391. "\u32C3",
  35392. "\u0034\u6708",
  35393. "\u32C4",
  35394. "\u0035\u6708",
  35395. "\u32C5",
  35396. "\u0036\u6708",
  35397. "\u32C6",
  35398. "\u0037\u6708",
  35399. "\u32C7",
  35400. "\u0038\u6708",
  35401. "\u32C8",
  35402. "\u0039\u6708",
  35403. "\u32C9",
  35404. "\u0031\u0030\u6708",
  35405. "\u32CA",
  35406. "\u0031\u0031\u6708",
  35407. "\u32CB",
  35408. "\u0031\u0032\u6708",
  35409. "\u3358",
  35410. "\u0030\u70B9",
  35411. "\u3359",
  35412. "\u0031\u70B9",
  35413. "\u335A",
  35414. "\u0032\u70B9",
  35415. "\u335B",
  35416. "\u0033\u70B9",
  35417. "\u335C",
  35418. "\u0034\u70B9",
  35419. "\u335D",
  35420. "\u0035\u70B9",
  35421. "\u335E",
  35422. "\u0036\u70B9",
  35423. "\u335F",
  35424. "\u0037\u70B9",
  35425. "\u3360",
  35426. "\u0038\u70B9",
  35427. "\u3361",
  35428. "\u0039\u70B9",
  35429. "\u3362",
  35430. "\u0031\u0030\u70B9",
  35431. "\u3363",
  35432. "\u0031\u0031\u70B9",
  35433. "\u3364",
  35434. "\u0031\u0032\u70B9",
  35435. "\u3365",
  35436. "\u0031\u0033\u70B9",
  35437. "\u3366",
  35438. "\u0031\u0034\u70B9",
  35439. "\u3367",
  35440. "\u0031\u0035\u70B9",
  35441. "\u3368",
  35442. "\u0031\u0036\u70B9",
  35443. "\u3369",
  35444. "\u0031\u0037\u70B9",
  35445. "\u336A",
  35446. "\u0031\u0038\u70B9",
  35447. "\u336B",
  35448. "\u0031\u0039\u70B9",
  35449. "\u336C",
  35450. "\u0032\u0030\u70B9",
  35451. "\u336D",
  35452. "\u0032\u0031\u70B9",
  35453. "\u336E",
  35454. "\u0032\u0032\u70B9",
  35455. "\u336F",
  35456. "\u0032\u0033\u70B9",
  35457. "\u3370",
  35458. "\u0032\u0034\u70B9",
  35459. "\u33E0",
  35460. "\u0031\u65E5",
  35461. "\u33E1",
  35462. "\u0032\u65E5",
  35463. "\u33E2",
  35464. "\u0033\u65E5",
  35465. "\u33E3",
  35466. "\u0034\u65E5",
  35467. "\u33E4",
  35468. "\u0035\u65E5",
  35469. "\u33E5",
  35470. "\u0036\u65E5",
  35471. "\u33E6",
  35472. "\u0037\u65E5",
  35473. "\u33E7",
  35474. "\u0038\u65E5",
  35475. "\u33E8",
  35476. "\u0039\u65E5",
  35477. "\u33E9",
  35478. "\u0031\u0030\u65E5",
  35479. "\u33EA",
  35480. "\u0031\u0031\u65E5",
  35481. "\u33EB",
  35482. "\u0031\u0032\u65E5",
  35483. "\u33EC",
  35484. "\u0031\u0033\u65E5",
  35485. "\u33ED",
  35486. "\u0031\u0034\u65E5",
  35487. "\u33EE",
  35488. "\u0031\u0035\u65E5",
  35489. "\u33EF",
  35490. "\u0031\u0036\u65E5",
  35491. "\u33F0",
  35492. "\u0031\u0037\u65E5",
  35493. "\u33F1",
  35494. "\u0031\u0038\u65E5",
  35495. "\u33F2",
  35496. "\u0031\u0039\u65E5",
  35497. "\u33F3",
  35498. "\u0032\u0030\u65E5",
  35499. "\u33F4",
  35500. "\u0032\u0031\u65E5",
  35501. "\u33F5",
  35502. "\u0032\u0032\u65E5",
  35503. "\u33F6",
  35504. "\u0032\u0033\u65E5",
  35505. "\u33F7",
  35506. "\u0032\u0034\u65E5",
  35507. "\u33F8",
  35508. "\u0032\u0035\u65E5",
  35509. "\u33F9",
  35510. "\u0032\u0036\u65E5",
  35511. "\u33FA",
  35512. "\u0032\u0037\u65E5",
  35513. "\u33FB",
  35514. "\u0032\u0038\u65E5",
  35515. "\u33FC",
  35516. "\u0032\u0039\u65E5",
  35517. "\u33FD",
  35518. "\u0033\u0030\u65E5",
  35519. "\u33FE",
  35520. "\u0033\u0031\u65E5",
  35521. "\uFB00",
  35522. "\u0066\u0066",
  35523. "\uFB01",
  35524. "\u0066\u0069",
  35525. "\uFB02",
  35526. "\u0066\u006C",
  35527. "\uFB03",
  35528. "\u0066\u0066\u0069",
  35529. "\uFB04",
  35530. "\u0066\u0066\u006C",
  35531. "\uFB05",
  35532. "\u017F\u0074",
  35533. "\uFB06",
  35534. "\u0073\u0074",
  35535. "\uFB13",
  35536. "\u0574\u0576",
  35537. "\uFB14",
  35538. "\u0574\u0565",
  35539. "\uFB15",
  35540. "\u0574\u056B",
  35541. "\uFB16",
  35542. "\u057E\u0576",
  35543. "\uFB17",
  35544. "\u0574\u056D",
  35545. "\uFB4F",
  35546. "\u05D0\u05DC",
  35547. "\uFB50",
  35548. "\u0671",
  35549. "\uFB51",
  35550. "\u0671",
  35551. "\uFB52",
  35552. "\u067B",
  35553. "\uFB53",
  35554. "\u067B",
  35555. "\uFB54",
  35556. "\u067B",
  35557. "\uFB55",
  35558. "\u067B",
  35559. "\uFB56",
  35560. "\u067E",
  35561. "\uFB57",
  35562. "\u067E",
  35563. "\uFB58",
  35564. "\u067E",
  35565. "\uFB59",
  35566. "\u067E",
  35567. "\uFB5A",
  35568. "\u0680",
  35569. "\uFB5B",
  35570. "\u0680",
  35571. "\uFB5C",
  35572. "\u0680",
  35573. "\uFB5D",
  35574. "\u0680",
  35575. "\uFB5E",
  35576. "\u067A",
  35577. "\uFB5F",
  35578. "\u067A",
  35579. "\uFB60",
  35580. "\u067A",
  35581. "\uFB61",
  35582. "\u067A",
  35583. "\uFB62",
  35584. "\u067F",
  35585. "\uFB63",
  35586. "\u067F",
  35587. "\uFB64",
  35588. "\u067F",
  35589. "\uFB65",
  35590. "\u067F",
  35591. "\uFB66",
  35592. "\u0679",
  35593. "\uFB67",
  35594. "\u0679",
  35595. "\uFB68",
  35596. "\u0679",
  35597. "\uFB69",
  35598. "\u0679",
  35599. "\uFB6A",
  35600. "\u06A4",
  35601. "\uFB6B",
  35602. "\u06A4",
  35603. "\uFB6C",
  35604. "\u06A4",
  35605. "\uFB6D",
  35606. "\u06A4",
  35607. "\uFB6E",
  35608. "\u06A6",
  35609. "\uFB6F",
  35610. "\u06A6",
  35611. "\uFB70",
  35612. "\u06A6",
  35613. "\uFB71",
  35614. "\u06A6",
  35615. "\uFB72",
  35616. "\u0684",
  35617. "\uFB73",
  35618. "\u0684",
  35619. "\uFB74",
  35620. "\u0684",
  35621. "\uFB75",
  35622. "\u0684",
  35623. "\uFB76",
  35624. "\u0683",
  35625. "\uFB77",
  35626. "\u0683",
  35627. "\uFB78",
  35628. "\u0683",
  35629. "\uFB79",
  35630. "\u0683",
  35631. "\uFB7A",
  35632. "\u0686",
  35633. "\uFB7B",
  35634. "\u0686",
  35635. "\uFB7C",
  35636. "\u0686",
  35637. "\uFB7D",
  35638. "\u0686",
  35639. "\uFB7E",
  35640. "\u0687",
  35641. "\uFB7F",
  35642. "\u0687",
  35643. "\uFB80",
  35644. "\u0687",
  35645. "\uFB81",
  35646. "\u0687",
  35647. "\uFB82",
  35648. "\u068D",
  35649. "\uFB83",
  35650. "\u068D",
  35651. "\uFB84",
  35652. "\u068C",
  35653. "\uFB85",
  35654. "\u068C",
  35655. "\uFB86",
  35656. "\u068E",
  35657. "\uFB87",
  35658. "\u068E",
  35659. "\uFB88",
  35660. "\u0688",
  35661. "\uFB89",
  35662. "\u0688",
  35663. "\uFB8A",
  35664. "\u0698",
  35665. "\uFB8B",
  35666. "\u0698",
  35667. "\uFB8C",
  35668. "\u0691",
  35669. "\uFB8D",
  35670. "\u0691",
  35671. "\uFB8E",
  35672. "\u06A9",
  35673. "\uFB8F",
  35674. "\u06A9",
  35675. "\uFB90",
  35676. "\u06A9",
  35677. "\uFB91",
  35678. "\u06A9",
  35679. "\uFB92",
  35680. "\u06AF",
  35681. "\uFB93",
  35682. "\u06AF",
  35683. "\uFB94",
  35684. "\u06AF",
  35685. "\uFB95",
  35686. "\u06AF",
  35687. "\uFB96",
  35688. "\u06B3",
  35689. "\uFB97",
  35690. "\u06B3",
  35691. "\uFB98",
  35692. "\u06B3",
  35693. "\uFB99",
  35694. "\u06B3",
  35695. "\uFB9A",
  35696. "\u06B1",
  35697. "\uFB9B",
  35698. "\u06B1",
  35699. "\uFB9C",
  35700. "\u06B1",
  35701. "\uFB9D",
  35702. "\u06B1",
  35703. "\uFB9E",
  35704. "\u06BA",
  35705. "\uFB9F",
  35706. "\u06BA",
  35707. "\uFBA0",
  35708. "\u06BB",
  35709. "\uFBA1",
  35710. "\u06BB",
  35711. "\uFBA2",
  35712. "\u06BB",
  35713. "\uFBA3",
  35714. "\u06BB",
  35715. "\uFBA4",
  35716. "\u06C0",
  35717. "\uFBA5",
  35718. "\u06C0",
  35719. "\uFBA6",
  35720. "\u06C1",
  35721. "\uFBA7",
  35722. "\u06C1",
  35723. "\uFBA8",
  35724. "\u06C1",
  35725. "\uFBA9",
  35726. "\u06C1",
  35727. "\uFBAA",
  35728. "\u06BE",
  35729. "\uFBAB",
  35730. "\u06BE",
  35731. "\uFBAC",
  35732. "\u06BE",
  35733. "\uFBAD",
  35734. "\u06BE",
  35735. "\uFBAE",
  35736. "\u06D2",
  35737. "\uFBAF",
  35738. "\u06D2",
  35739. "\uFBB0",
  35740. "\u06D3",
  35741. "\uFBB1",
  35742. "\u06D3",
  35743. "\uFBD3",
  35744. "\u06AD",
  35745. "\uFBD4",
  35746. "\u06AD",
  35747. "\uFBD5",
  35748. "\u06AD",
  35749. "\uFBD6",
  35750. "\u06AD",
  35751. "\uFBD7",
  35752. "\u06C7",
  35753. "\uFBD8",
  35754. "\u06C7",
  35755. "\uFBD9",
  35756. "\u06C6",
  35757. "\uFBDA",
  35758. "\u06C6",
  35759. "\uFBDB",
  35760. "\u06C8",
  35761. "\uFBDC",
  35762. "\u06C8",
  35763. "\uFBDD",
  35764. "\u0677",
  35765. "\uFBDE",
  35766. "\u06CB",
  35767. "\uFBDF",
  35768. "\u06CB",
  35769. "\uFBE0",
  35770. "\u06C5",
  35771. "\uFBE1",
  35772. "\u06C5",
  35773. "\uFBE2",
  35774. "\u06C9",
  35775. "\uFBE3",
  35776. "\u06C9",
  35777. "\uFBE4",
  35778. "\u06D0",
  35779. "\uFBE5",
  35780. "\u06D0",
  35781. "\uFBE6",
  35782. "\u06D0",
  35783. "\uFBE7",
  35784. "\u06D0",
  35785. "\uFBE8",
  35786. "\u0649",
  35787. "\uFBE9",
  35788. "\u0649",
  35789. "\uFBEA",
  35790. "\u0626\u0627",
  35791. "\uFBEB",
  35792. "\u0626\u0627",
  35793. "\uFBEC",
  35794. "\u0626\u06D5",
  35795. "\uFBED",
  35796. "\u0626\u06D5",
  35797. "\uFBEE",
  35798. "\u0626\u0648",
  35799. "\uFBEF",
  35800. "\u0626\u0648",
  35801. "\uFBF0",
  35802. "\u0626\u06C7",
  35803. "\uFBF1",
  35804. "\u0626\u06C7",
  35805. "\uFBF2",
  35806. "\u0626\u06C6",
  35807. "\uFBF3",
  35808. "\u0626\u06C6",
  35809. "\uFBF4",
  35810. "\u0626\u06C8",
  35811. "\uFBF5",
  35812. "\u0626\u06C8",
  35813. "\uFBF6",
  35814. "\u0626\u06D0",
  35815. "\uFBF7",
  35816. "\u0626\u06D0",
  35817. "\uFBF8",
  35818. "\u0626\u06D0",
  35819. "\uFBF9",
  35820. "\u0626\u0649",
  35821. "\uFBFA",
  35822. "\u0626\u0649",
  35823. "\uFBFB",
  35824. "\u0626\u0649",
  35825. "\uFBFC",
  35826. "\u06CC",
  35827. "\uFBFD",
  35828. "\u06CC",
  35829. "\uFBFE",
  35830. "\u06CC",
  35831. "\uFBFF",
  35832. "\u06CC",
  35833. "\uFC00",
  35834. "\u0626\u062C",
  35835. "\uFC01",
  35836. "\u0626\u062D",
  35837. "\uFC02",
  35838. "\u0626\u0645",
  35839. "\uFC03",
  35840. "\u0626\u0649",
  35841. "\uFC04",
  35842. "\u0626\u064A",
  35843. "\uFC05",
  35844. "\u0628\u062C",
  35845. "\uFC06",
  35846. "\u0628\u062D",
  35847. "\uFC07",
  35848. "\u0628\u062E",
  35849. "\uFC08",
  35850. "\u0628\u0645",
  35851. "\uFC09",
  35852. "\u0628\u0649",
  35853. "\uFC0A",
  35854. "\u0628\u064A",
  35855. "\uFC0B",
  35856. "\u062A\u062C",
  35857. "\uFC0C",
  35858. "\u062A\u062D",
  35859. "\uFC0D",
  35860. "\u062A\u062E",
  35861. "\uFC0E",
  35862. "\u062A\u0645",
  35863. "\uFC0F",
  35864. "\u062A\u0649",
  35865. "\uFC10",
  35866. "\u062A\u064A",
  35867. "\uFC11",
  35868. "\u062B\u062C",
  35869. "\uFC12",
  35870. "\u062B\u0645",
  35871. "\uFC13",
  35872. "\u062B\u0649",
  35873. "\uFC14",
  35874. "\u062B\u064A",
  35875. "\uFC15",
  35876. "\u062C\u062D",
  35877. "\uFC16",
  35878. "\u062C\u0645",
  35879. "\uFC17",
  35880. "\u062D\u062C",
  35881. "\uFC18",
  35882. "\u062D\u0645",
  35883. "\uFC19",
  35884. "\u062E\u062C",
  35885. "\uFC1A",
  35886. "\u062E\u062D",
  35887. "\uFC1B",
  35888. "\u062E\u0645",
  35889. "\uFC1C",
  35890. "\u0633\u062C",
  35891. "\uFC1D",
  35892. "\u0633\u062D",
  35893. "\uFC1E",
  35894. "\u0633\u062E",
  35895. "\uFC1F",
  35896. "\u0633\u0645",
  35897. "\uFC20",
  35898. "\u0635\u062D",
  35899. "\uFC21",
  35900. "\u0635\u0645",
  35901. "\uFC22",
  35902. "\u0636\u062C",
  35903. "\uFC23",
  35904. "\u0636\u062D",
  35905. "\uFC24",
  35906. "\u0636\u062E",
  35907. "\uFC25",
  35908. "\u0636\u0645",
  35909. "\uFC26",
  35910. "\u0637\u062D",
  35911. "\uFC27",
  35912. "\u0637\u0645",
  35913. "\uFC28",
  35914. "\u0638\u0645",
  35915. "\uFC29",
  35916. "\u0639\u062C",
  35917. "\uFC2A",
  35918. "\u0639\u0645",
  35919. "\uFC2B",
  35920. "\u063A\u062C",
  35921. "\uFC2C",
  35922. "\u063A\u0645",
  35923. "\uFC2D",
  35924. "\u0641\u062C",
  35925. "\uFC2E",
  35926. "\u0641\u062D",
  35927. "\uFC2F",
  35928. "\u0641\u062E",
  35929. "\uFC30",
  35930. "\u0641\u0645",
  35931. "\uFC31",
  35932. "\u0641\u0649",
  35933. "\uFC32",
  35934. "\u0641\u064A",
  35935. "\uFC33",
  35936. "\u0642\u062D",
  35937. "\uFC34",
  35938. "\u0642\u0645",
  35939. "\uFC35",
  35940. "\u0642\u0649",
  35941. "\uFC36",
  35942. "\u0642\u064A",
  35943. "\uFC37",
  35944. "\u0643\u0627",
  35945. "\uFC38",
  35946. "\u0643\u062C",
  35947. "\uFC39",
  35948. "\u0643\u062D",
  35949. "\uFC3A",
  35950. "\u0643\u062E",
  35951. "\uFC3B",
  35952. "\u0643\u0644",
  35953. "\uFC3C",
  35954. "\u0643\u0645",
  35955. "\uFC3D",
  35956. "\u0643\u0649",
  35957. "\uFC3E",
  35958. "\u0643\u064A",
  35959. "\uFC3F",
  35960. "\u0644\u062C",
  35961. "\uFC40",
  35962. "\u0644\u062D",
  35963. "\uFC41",
  35964. "\u0644\u062E",
  35965. "\uFC42",
  35966. "\u0644\u0645",
  35967. "\uFC43",
  35968. "\u0644\u0649",
  35969. "\uFC44",
  35970. "\u0644\u064A",
  35971. "\uFC45",
  35972. "\u0645\u062C",
  35973. "\uFC46",
  35974. "\u0645\u062D",
  35975. "\uFC47",
  35976. "\u0645\u062E",
  35977. "\uFC48",
  35978. "\u0645\u0645",
  35979. "\uFC49",
  35980. "\u0645\u0649",
  35981. "\uFC4A",
  35982. "\u0645\u064A",
  35983. "\uFC4B",
  35984. "\u0646\u062C",
  35985. "\uFC4C",
  35986. "\u0646\u062D",
  35987. "\uFC4D",
  35988. "\u0646\u062E",
  35989. "\uFC4E",
  35990. "\u0646\u0645",
  35991. "\uFC4F",
  35992. "\u0646\u0649",
  35993. "\uFC50",
  35994. "\u0646\u064A",
  35995. "\uFC51",
  35996. "\u0647\u062C",
  35997. "\uFC52",
  35998. "\u0647\u0645",
  35999. "\uFC53",
  36000. "\u0647\u0649",
  36001. "\uFC54",
  36002. "\u0647\u064A",
  36003. "\uFC55",
  36004. "\u064A\u062C",
  36005. "\uFC56",
  36006. "\u064A\u062D",
  36007. "\uFC57",
  36008. "\u064A\u062E",
  36009. "\uFC58",
  36010. "\u064A\u0645",
  36011. "\uFC59",
  36012. "\u064A\u0649",
  36013. "\uFC5A",
  36014. "\u064A\u064A",
  36015. "\uFC5B",
  36016. "\u0630\u0670",
  36017. "\uFC5C",
  36018. "\u0631\u0670",
  36019. "\uFC5D",
  36020. "\u0649\u0670",
  36021. "\uFC5E",
  36022. "\u0020\u064C\u0651",
  36023. "\uFC5F",
  36024. "\u0020\u064D\u0651",
  36025. "\uFC60",
  36026. "\u0020\u064E\u0651",
  36027. "\uFC61",
  36028. "\u0020\u064F\u0651",
  36029. "\uFC62",
  36030. "\u0020\u0650\u0651",
  36031. "\uFC63",
  36032. "\u0020\u0651\u0670",
  36033. "\uFC64",
  36034. "\u0626\u0631",
  36035. "\uFC65",
  36036. "\u0626\u0632",
  36037. "\uFC66",
  36038. "\u0626\u0645",
  36039. "\uFC67",
  36040. "\u0626\u0646",
  36041. "\uFC68",
  36042. "\u0626\u0649",
  36043. "\uFC69",
  36044. "\u0626\u064A",
  36045. "\uFC6A",
  36046. "\u0628\u0631",
  36047. "\uFC6B",
  36048. "\u0628\u0632",
  36049. "\uFC6C",
  36050. "\u0628\u0645",
  36051. "\uFC6D",
  36052. "\u0628\u0646",
  36053. "\uFC6E",
  36054. "\u0628\u0649",
  36055. "\uFC6F",
  36056. "\u0628\u064A",
  36057. "\uFC70",
  36058. "\u062A\u0631",
  36059. "\uFC71",
  36060. "\u062A\u0632",
  36061. "\uFC72",
  36062. "\u062A\u0645",
  36063. "\uFC73",
  36064. "\u062A\u0646",
  36065. "\uFC74",
  36066. "\u062A\u0649",
  36067. "\uFC75",
  36068. "\u062A\u064A",
  36069. "\uFC76",
  36070. "\u062B\u0631",
  36071. "\uFC77",
  36072. "\u062B\u0632",
  36073. "\uFC78",
  36074. "\u062B\u0645",
  36075. "\uFC79",
  36076. "\u062B\u0646",
  36077. "\uFC7A",
  36078. "\u062B\u0649",
  36079. "\uFC7B",
  36080. "\u062B\u064A",
  36081. "\uFC7C",
  36082. "\u0641\u0649",
  36083. "\uFC7D",
  36084. "\u0641\u064A",
  36085. "\uFC7E",
  36086. "\u0642\u0649",
  36087. "\uFC7F",
  36088. "\u0642\u064A",
  36089. "\uFC80",
  36090. "\u0643\u0627",
  36091. "\uFC81",
  36092. "\u0643\u0644",
  36093. "\uFC82",
  36094. "\u0643\u0645",
  36095. "\uFC83",
  36096. "\u0643\u0649",
  36097. "\uFC84",
  36098. "\u0643\u064A",
  36099. "\uFC85",
  36100. "\u0644\u0645",
  36101. "\uFC86",
  36102. "\u0644\u0649",
  36103. "\uFC87",
  36104. "\u0644\u064A",
  36105. "\uFC88",
  36106. "\u0645\u0627",
  36107. "\uFC89",
  36108. "\u0645\u0645",
  36109. "\uFC8A",
  36110. "\u0646\u0631",
  36111. "\uFC8B",
  36112. "\u0646\u0632",
  36113. "\uFC8C",
  36114. "\u0646\u0645",
  36115. "\uFC8D",
  36116. "\u0646\u0646",
  36117. "\uFC8E",
  36118. "\u0646\u0649",
  36119. "\uFC8F",
  36120. "\u0646\u064A",
  36121. "\uFC90",
  36122. "\u0649\u0670",
  36123. "\uFC91",
  36124. "\u064A\u0631",
  36125. "\uFC92",
  36126. "\u064A\u0632",
  36127. "\uFC93",
  36128. "\u064A\u0645",
  36129. "\uFC94",
  36130. "\u064A\u0646",
  36131. "\uFC95",
  36132. "\u064A\u0649",
  36133. "\uFC96",
  36134. "\u064A\u064A",
  36135. "\uFC97",
  36136. "\u0626\u062C",
  36137. "\uFC98",
  36138. "\u0626\u062D",
  36139. "\uFC99",
  36140. "\u0626\u062E",
  36141. "\uFC9A",
  36142. "\u0626\u0645",
  36143. "\uFC9B",
  36144. "\u0626\u0647",
  36145. "\uFC9C",
  36146. "\u0628\u062C",
  36147. "\uFC9D",
  36148. "\u0628\u062D",
  36149. "\uFC9E",
  36150. "\u0628\u062E",
  36151. "\uFC9F",
  36152. "\u0628\u0645",
  36153. "\uFCA0",
  36154. "\u0628\u0647",
  36155. "\uFCA1",
  36156. "\u062A\u062C",
  36157. "\uFCA2",
  36158. "\u062A\u062D",
  36159. "\uFCA3",
  36160. "\u062A\u062E",
  36161. "\uFCA4",
  36162. "\u062A\u0645",
  36163. "\uFCA5",
  36164. "\u062A\u0647",
  36165. "\uFCA6",
  36166. "\u062B\u0645",
  36167. "\uFCA7",
  36168. "\u062C\u062D",
  36169. "\uFCA8",
  36170. "\u062C\u0645",
  36171. "\uFCA9",
  36172. "\u062D\u062C",
  36173. "\uFCAA",
  36174. "\u062D\u0645",
  36175. "\uFCAB",
  36176. "\u062E\u062C",
  36177. "\uFCAC",
  36178. "\u062E\u0645",
  36179. "\uFCAD",
  36180. "\u0633\u062C",
  36181. "\uFCAE",
  36182. "\u0633\u062D",
  36183. "\uFCAF",
  36184. "\u0633\u062E",
  36185. "\uFCB0",
  36186. "\u0633\u0645",
  36187. "\uFCB1",
  36188. "\u0635\u062D",
  36189. "\uFCB2",
  36190. "\u0635\u062E",
  36191. "\uFCB3",
  36192. "\u0635\u0645",
  36193. "\uFCB4",
  36194. "\u0636\u062C",
  36195. "\uFCB5",
  36196. "\u0636\u062D",
  36197. "\uFCB6",
  36198. "\u0636\u062E",
  36199. "\uFCB7",
  36200. "\u0636\u0645",
  36201. "\uFCB8",
  36202. "\u0637\u062D",
  36203. "\uFCB9",
  36204. "\u0638\u0645",
  36205. "\uFCBA",
  36206. "\u0639\u062C",
  36207. "\uFCBB",
  36208. "\u0639\u0645",
  36209. "\uFCBC",
  36210. "\u063A\u062C",
  36211. "\uFCBD",
  36212. "\u063A\u0645",
  36213. "\uFCBE",
  36214. "\u0641\u062C",
  36215. "\uFCBF",
  36216. "\u0641\u062D",
  36217. "\uFCC0",
  36218. "\u0641\u062E",
  36219. "\uFCC1",
  36220. "\u0641\u0645",
  36221. "\uFCC2",
  36222. "\u0642\u062D",
  36223. "\uFCC3",
  36224. "\u0642\u0645",
  36225. "\uFCC4",
  36226. "\u0643\u062C",
  36227. "\uFCC5",
  36228. "\u0643\u062D",
  36229. "\uFCC6",
  36230. "\u0643\u062E",
  36231. "\uFCC7",
  36232. "\u0643\u0644",
  36233. "\uFCC8",
  36234. "\u0643\u0645",
  36235. "\uFCC9",
  36236. "\u0644\u062C",
  36237. "\uFCCA",
  36238. "\u0644\u062D",
  36239. "\uFCCB",
  36240. "\u0644\u062E",
  36241. "\uFCCC",
  36242. "\u0644\u0645",
  36243. "\uFCCD",
  36244. "\u0644\u0647",
  36245. "\uFCCE",
  36246. "\u0645\u062C",
  36247. "\uFCCF",
  36248. "\u0645\u062D",
  36249. "\uFCD0",
  36250. "\u0645\u062E",
  36251. "\uFCD1",
  36252. "\u0645\u0645",
  36253. "\uFCD2",
  36254. "\u0646\u062C",
  36255. "\uFCD3",
  36256. "\u0646\u062D",
  36257. "\uFCD4",
  36258. "\u0646\u062E",
  36259. "\uFCD5",
  36260. "\u0646\u0645",
  36261. "\uFCD6",
  36262. "\u0646\u0647",
  36263. "\uFCD7",
  36264. "\u0647\u062C",
  36265. "\uFCD8",
  36266. "\u0647\u0645",
  36267. "\uFCD9",
  36268. "\u0647\u0670",
  36269. "\uFCDA",
  36270. "\u064A\u062C",
  36271. "\uFCDB",
  36272. "\u064A\u062D",
  36273. "\uFCDC",
  36274. "\u064A\u062E",
  36275. "\uFCDD",
  36276. "\u064A\u0645",
  36277. "\uFCDE",
  36278. "\u064A\u0647",
  36279. "\uFCDF",
  36280. "\u0626\u0645",
  36281. "\uFCE0",
  36282. "\u0626\u0647",
  36283. "\uFCE1",
  36284. "\u0628\u0645",
  36285. "\uFCE2",
  36286. "\u0628\u0647",
  36287. "\uFCE3",
  36288. "\u062A\u0645",
  36289. "\uFCE4",
  36290. "\u062A\u0647",
  36291. "\uFCE5",
  36292. "\u062B\u0645",
  36293. "\uFCE6",
  36294. "\u062B\u0647",
  36295. "\uFCE7",
  36296. "\u0633\u0645",
  36297. "\uFCE8",
  36298. "\u0633\u0647",
  36299. "\uFCE9",
  36300. "\u0634\u0645",
  36301. "\uFCEA",
  36302. "\u0634\u0647",
  36303. "\uFCEB",
  36304. "\u0643\u0644",
  36305. "\uFCEC",
  36306. "\u0643\u0645",
  36307. "\uFCED",
  36308. "\u0644\u0645",
  36309. "\uFCEE",
  36310. "\u0646\u0645",
  36311. "\uFCEF",
  36312. "\u0646\u0647",
  36313. "\uFCF0",
  36314. "\u064A\u0645",
  36315. "\uFCF1",
  36316. "\u064A\u0647",
  36317. "\uFCF2",
  36318. "\u0640\u064E\u0651",
  36319. "\uFCF3",
  36320. "\u0640\u064F\u0651",
  36321. "\uFCF4",
  36322. "\u0640\u0650\u0651",
  36323. "\uFCF5",
  36324. "\u0637\u0649",
  36325. "\uFCF6",
  36326. "\u0637\u064A",
  36327. "\uFCF7",
  36328. "\u0639\u0649",
  36329. "\uFCF8",
  36330. "\u0639\u064A",
  36331. "\uFCF9",
  36332. "\u063A\u0649",
  36333. "\uFCFA",
  36334. "\u063A\u064A",
  36335. "\uFCFB",
  36336. "\u0633\u0649",
  36337. "\uFCFC",
  36338. "\u0633\u064A",
  36339. "\uFCFD",
  36340. "\u0634\u0649",
  36341. "\uFCFE",
  36342. "\u0634\u064A",
  36343. "\uFCFF",
  36344. "\u062D\u0649",
  36345. "\uFD00",
  36346. "\u062D\u064A",
  36347. "\uFD01",
  36348. "\u062C\u0649",
  36349. "\uFD02",
  36350. "\u062C\u064A",
  36351. "\uFD03",
  36352. "\u062E\u0649",
  36353. "\uFD04",
  36354. "\u062E\u064A",
  36355. "\uFD05",
  36356. "\u0635\u0649",
  36357. "\uFD06",
  36358. "\u0635\u064A",
  36359. "\uFD07",
  36360. "\u0636\u0649",
  36361. "\uFD08",
  36362. "\u0636\u064A",
  36363. "\uFD09",
  36364. "\u0634\u062C",
  36365. "\uFD0A",
  36366. "\u0634\u062D",
  36367. "\uFD0B",
  36368. "\u0634\u062E",
  36369. "\uFD0C",
  36370. "\u0634\u0645",
  36371. "\uFD0D",
  36372. "\u0634\u0631",
  36373. "\uFD0E",
  36374. "\u0633\u0631",
  36375. "\uFD0F",
  36376. "\u0635\u0631",
  36377. "\uFD10",
  36378. "\u0636\u0631",
  36379. "\uFD11",
  36380. "\u0637\u0649",
  36381. "\uFD12",
  36382. "\u0637\u064A",
  36383. "\uFD13",
  36384. "\u0639\u0649",
  36385. "\uFD14",
  36386. "\u0639\u064A",
  36387. "\uFD15",
  36388. "\u063A\u0649",
  36389. "\uFD16",
  36390. "\u063A\u064A",
  36391. "\uFD17",
  36392. "\u0633\u0649",
  36393. "\uFD18",
  36394. "\u0633\u064A",
  36395. "\uFD19",
  36396. "\u0634\u0649",
  36397. "\uFD1A",
  36398. "\u0634\u064A",
  36399. "\uFD1B",
  36400. "\u062D\u0649",
  36401. "\uFD1C",
  36402. "\u062D\u064A",
  36403. "\uFD1D",
  36404. "\u062C\u0649",
  36405. "\uFD1E",
  36406. "\u062C\u064A",
  36407. "\uFD1F",
  36408. "\u062E\u0649",
  36409. "\uFD20",
  36410. "\u062E\u064A",
  36411. "\uFD21",
  36412. "\u0635\u0649",
  36413. "\uFD22",
  36414. "\u0635\u064A",
  36415. "\uFD23",
  36416. "\u0636\u0649",
  36417. "\uFD24",
  36418. "\u0636\u064A",
  36419. "\uFD25",
  36420. "\u0634\u062C",
  36421. "\uFD26",
  36422. "\u0634\u062D",
  36423. "\uFD27",
  36424. "\u0634\u062E",
  36425. "\uFD28",
  36426. "\u0634\u0645",
  36427. "\uFD29",
  36428. "\u0634\u0631",
  36429. "\uFD2A",
  36430. "\u0633\u0631",
  36431. "\uFD2B",
  36432. "\u0635\u0631",
  36433. "\uFD2C",
  36434. "\u0636\u0631",
  36435. "\uFD2D",
  36436. "\u0634\u062C",
  36437. "\uFD2E",
  36438. "\u0634\u062D",
  36439. "\uFD2F",
  36440. "\u0634\u062E",
  36441. "\uFD30",
  36442. "\u0634\u0645",
  36443. "\uFD31",
  36444. "\u0633\u0647",
  36445. "\uFD32",
  36446. "\u0634\u0647",
  36447. "\uFD33",
  36448. "\u0637\u0645",
  36449. "\uFD34",
  36450. "\u0633\u062C",
  36451. "\uFD35",
  36452. "\u0633\u062D",
  36453. "\uFD36",
  36454. "\u0633\u062E",
  36455. "\uFD37",
  36456. "\u0634\u062C",
  36457. "\uFD38",
  36458. "\u0634\u062D",
  36459. "\uFD39",
  36460. "\u0634\u062E",
  36461. "\uFD3A",
  36462. "\u0637\u0645",
  36463. "\uFD3B",
  36464. "\u0638\u0645",
  36465. "\uFD3C",
  36466. "\u0627\u064B",
  36467. "\uFD3D",
  36468. "\u0627\u064B",
  36469. "\uFD50",
  36470. "\u062A\u062C\u0645",
  36471. "\uFD51",
  36472. "\u062A\u062D\u062C",
  36473. "\uFD52",
  36474. "\u062A\u062D\u062C",
  36475. "\uFD53",
  36476. "\u062A\u062D\u0645",
  36477. "\uFD54",
  36478. "\u062A\u062E\u0645",
  36479. "\uFD55",
  36480. "\u062A\u0645\u062C",
  36481. "\uFD56",
  36482. "\u062A\u0645\u062D",
  36483. "\uFD57",
  36484. "\u062A\u0645\u062E",
  36485. "\uFD58",
  36486. "\u062C\u0645\u062D",
  36487. "\uFD59",
  36488. "\u062C\u0645\u062D",
  36489. "\uFD5A",
  36490. "\u062D\u0645\u064A",
  36491. "\uFD5B",
  36492. "\u062D\u0645\u0649",
  36493. "\uFD5C",
  36494. "\u0633\u062D\u062C",
  36495. "\uFD5D",
  36496. "\u0633\u062C\u062D",
  36497. "\uFD5E",
  36498. "\u0633\u062C\u0649",
  36499. "\uFD5F",
  36500. "\u0633\u0645\u062D",
  36501. "\uFD60",
  36502. "\u0633\u0645\u062D",
  36503. "\uFD61",
  36504. "\u0633\u0645\u062C",
  36505. "\uFD62",
  36506. "\u0633\u0645\u0645",
  36507. "\uFD63",
  36508. "\u0633\u0645\u0645",
  36509. "\uFD64",
  36510. "\u0635\u062D\u062D",
  36511. "\uFD65",
  36512. "\u0635\u062D\u062D",
  36513. "\uFD66",
  36514. "\u0635\u0645\u0645",
  36515. "\uFD67",
  36516. "\u0634\u062D\u0645",
  36517. "\uFD68",
  36518. "\u0634\u062D\u0645",
  36519. "\uFD69",
  36520. "\u0634\u062C\u064A",
  36521. "\uFD6A",
  36522. "\u0634\u0645\u062E",
  36523. "\uFD6B",
  36524. "\u0634\u0645\u062E",
  36525. "\uFD6C",
  36526. "\u0634\u0645\u0645",
  36527. "\uFD6D",
  36528. "\u0634\u0645\u0645",
  36529. "\uFD6E",
  36530. "\u0636\u062D\u0649",
  36531. "\uFD6F",
  36532. "\u0636\u062E\u0645",
  36533. "\uFD70",
  36534. "\u0636\u062E\u0645",
  36535. "\uFD71",
  36536. "\u0637\u0645\u062D",
  36537. "\uFD72",
  36538. "\u0637\u0645\u062D",
  36539. "\uFD73",
  36540. "\u0637\u0645\u0645",
  36541. "\uFD74",
  36542. "\u0637\u0645\u064A",
  36543. "\uFD75",
  36544. "\u0639\u062C\u0645",
  36545. "\uFD76",
  36546. "\u0639\u0645\u0645",
  36547. "\uFD77",
  36548. "\u0639\u0645\u0645",
  36549. "\uFD78",
  36550. "\u0639\u0645\u0649",
  36551. "\uFD79",
  36552. "\u063A\u0645\u0645",
  36553. "\uFD7A",
  36554. "\u063A\u0645\u064A",
  36555. "\uFD7B",
  36556. "\u063A\u0645\u0649",
  36557. "\uFD7C",
  36558. "\u0641\u062E\u0645",
  36559. "\uFD7D",
  36560. "\u0641\u062E\u0645",
  36561. "\uFD7E",
  36562. "\u0642\u0645\u062D",
  36563. "\uFD7F",
  36564. "\u0642\u0645\u0645",
  36565. "\uFD80",
  36566. "\u0644\u062D\u0645",
  36567. "\uFD81",
  36568. "\u0644\u062D\u064A",
  36569. "\uFD82",
  36570. "\u0644\u062D\u0649",
  36571. "\uFD83",
  36572. "\u0644\u062C\u062C",
  36573. "\uFD84",
  36574. "\u0644\u062C\u062C",
  36575. "\uFD85",
  36576. "\u0644\u062E\u0645",
  36577. "\uFD86",
  36578. "\u0644\u062E\u0645",
  36579. "\uFD87",
  36580. "\u0644\u0645\u062D",
  36581. "\uFD88",
  36582. "\u0644\u0645\u062D",
  36583. "\uFD89",
  36584. "\u0645\u062D\u062C",
  36585. "\uFD8A",
  36586. "\u0645\u062D\u0645",
  36587. "\uFD8B",
  36588. "\u0645\u062D\u064A",
  36589. "\uFD8C",
  36590. "\u0645\u062C\u062D",
  36591. "\uFD8D",
  36592. "\u0645\u062C\u0645",
  36593. "\uFD8E",
  36594. "\u0645\u062E\u062C",
  36595. "\uFD8F",
  36596. "\u0645\u062E\u0645",
  36597. "\uFD92",
  36598. "\u0645\u062C\u062E",
  36599. "\uFD93",
  36600. "\u0647\u0645\u062C",
  36601. "\uFD94",
  36602. "\u0647\u0645\u0645",
  36603. "\uFD95",
  36604. "\u0646\u062D\u0645",
  36605. "\uFD96",
  36606. "\u0646\u062D\u0649",
  36607. "\uFD97",
  36608. "\u0646\u062C\u0645",
  36609. "\uFD98",
  36610. "\u0646\u062C\u0645",
  36611. "\uFD99",
  36612. "\u0646\u062C\u0649",
  36613. "\uFD9A",
  36614. "\u0646\u0645\u064A",
  36615. "\uFD9B",
  36616. "\u0646\u0645\u0649",
  36617. "\uFD9C",
  36618. "\u064A\u0645\u0645",
  36619. "\uFD9D",
  36620. "\u064A\u0645\u0645",
  36621. "\uFD9E",
  36622. "\u0628\u062E\u064A",
  36623. "\uFD9F",
  36624. "\u062A\u062C\u064A",
  36625. "\uFDA0",
  36626. "\u062A\u062C\u0649",
  36627. "\uFDA1",
  36628. "\u062A\u062E\u064A",
  36629. "\uFDA2",
  36630. "\u062A\u062E\u0649",
  36631. "\uFDA3",
  36632. "\u062A\u0645\u064A",
  36633. "\uFDA4",
  36634. "\u062A\u0645\u0649",
  36635. "\uFDA5",
  36636. "\u062C\u0645\u064A",
  36637. "\uFDA6",
  36638. "\u062C\u062D\u0649",
  36639. "\uFDA7",
  36640. "\u062C\u0645\u0649",
  36641. "\uFDA8",
  36642. "\u0633\u062E\u0649",
  36643. "\uFDA9",
  36644. "\u0635\u062D\u064A",
  36645. "\uFDAA",
  36646. "\u0634\u062D\u064A",
  36647. "\uFDAB",
  36648. "\u0636\u062D\u064A",
  36649. "\uFDAC",
  36650. "\u0644\u062C\u064A",
  36651. "\uFDAD",
  36652. "\u0644\u0645\u064A",
  36653. "\uFDAE",
  36654. "\u064A\u062D\u064A",
  36655. "\uFDAF",
  36656. "\u064A\u062C\u064A",
  36657. "\uFDB0",
  36658. "\u064A\u0645\u064A",
  36659. "\uFDB1",
  36660. "\u0645\u0645\u064A",
  36661. "\uFDB2",
  36662. "\u0642\u0645\u064A",
  36663. "\uFDB3",
  36664. "\u0646\u062D\u064A",
  36665. "\uFDB4",
  36666. "\u0642\u0645\u062D",
  36667. "\uFDB5",
  36668. "\u0644\u062D\u0645",
  36669. "\uFDB6",
  36670. "\u0639\u0645\u064A",
  36671. "\uFDB7",
  36672. "\u0643\u0645\u064A",
  36673. "\uFDB8",
  36674. "\u0646\u062C\u062D",
  36675. "\uFDB9",
  36676. "\u0645\u062E\u064A",
  36677. "\uFDBA",
  36678. "\u0644\u062C\u0645",
  36679. "\uFDBB",
  36680. "\u0643\u0645\u0645",
  36681. "\uFDBC",
  36682. "\u0644\u062C\u0645",
  36683. "\uFDBD",
  36684. "\u0646\u062C\u062D",
  36685. "\uFDBE",
  36686. "\u062C\u062D\u064A",
  36687. "\uFDBF",
  36688. "\u062D\u062C\u064A",
  36689. "\uFDC0",
  36690. "\u0645\u062C\u064A",
  36691. "\uFDC1",
  36692. "\u0641\u0645\u064A",
  36693. "\uFDC2",
  36694. "\u0628\u062D\u064A",
  36695. "\uFDC3",
  36696. "\u0643\u0645\u0645",
  36697. "\uFDC4",
  36698. "\u0639\u062C\u0645",
  36699. "\uFDC5",
  36700. "\u0635\u0645\u0645",
  36701. "\uFDC6",
  36702. "\u0633\u062E\u064A",
  36703. "\uFDC7",
  36704. "\u0646\u062C\u064A",
  36705. "\uFE49",
  36706. "\u203E",
  36707. "\uFE4A",
  36708. "\u203E",
  36709. "\uFE4B",
  36710. "\u203E",
  36711. "\uFE4C",
  36712. "\u203E",
  36713. "\uFE4D",
  36714. "\u005F",
  36715. "\uFE4E",
  36716. "\u005F",
  36717. "\uFE4F",
  36718. "\u005F",
  36719. "\uFE80",
  36720. "\u0621",
  36721. "\uFE81",
  36722. "\u0622",
  36723. "\uFE82",
  36724. "\u0622",
  36725. "\uFE83",
  36726. "\u0623",
  36727. "\uFE84",
  36728. "\u0623",
  36729. "\uFE85",
  36730. "\u0624",
  36731. "\uFE86",
  36732. "\u0624",
  36733. "\uFE87",
  36734. "\u0625",
  36735. "\uFE88",
  36736. "\u0625",
  36737. "\uFE89",
  36738. "\u0626",
  36739. "\uFE8A",
  36740. "\u0626",
  36741. "\uFE8B",
  36742. "\u0626",
  36743. "\uFE8C",
  36744. "\u0626",
  36745. "\uFE8D",
  36746. "\u0627",
  36747. "\uFE8E",
  36748. "\u0627",
  36749. "\uFE8F",
  36750. "\u0628",
  36751. "\uFE90",
  36752. "\u0628",
  36753. "\uFE91",
  36754. "\u0628",
  36755. "\uFE92",
  36756. "\u0628",
  36757. "\uFE93",
  36758. "\u0629",
  36759. "\uFE94",
  36760. "\u0629",
  36761. "\uFE95",
  36762. "\u062A",
  36763. "\uFE96",
  36764. "\u062A",
  36765. "\uFE97",
  36766. "\u062A",
  36767. "\uFE98",
  36768. "\u062A",
  36769. "\uFE99",
  36770. "\u062B",
  36771. "\uFE9A",
  36772. "\u062B",
  36773. "\uFE9B",
  36774. "\u062B",
  36775. "\uFE9C",
  36776. "\u062B",
  36777. "\uFE9D",
  36778. "\u062C",
  36779. "\uFE9E",
  36780. "\u062C",
  36781. "\uFE9F",
  36782. "\u062C",
  36783. "\uFEA0",
  36784. "\u062C",
  36785. "\uFEA1",
  36786. "\u062D",
  36787. "\uFEA2",
  36788. "\u062D",
  36789. "\uFEA3",
  36790. "\u062D",
  36791. "\uFEA4",
  36792. "\u062D",
  36793. "\uFEA5",
  36794. "\u062E",
  36795. "\uFEA6",
  36796. "\u062E",
  36797. "\uFEA7",
  36798. "\u062E",
  36799. "\uFEA8",
  36800. "\u062E",
  36801. "\uFEA9",
  36802. "\u062F",
  36803. "\uFEAA",
  36804. "\u062F",
  36805. "\uFEAB",
  36806. "\u0630",
  36807. "\uFEAC",
  36808. "\u0630",
  36809. "\uFEAD",
  36810. "\u0631",
  36811. "\uFEAE",
  36812. "\u0631",
  36813. "\uFEAF",
  36814. "\u0632",
  36815. "\uFEB0",
  36816. "\u0632",
  36817. "\uFEB1",
  36818. "\u0633",
  36819. "\uFEB2",
  36820. "\u0633",
  36821. "\uFEB3",
  36822. "\u0633",
  36823. "\uFEB4",
  36824. "\u0633",
  36825. "\uFEB5",
  36826. "\u0634",
  36827. "\uFEB6",
  36828. "\u0634",
  36829. "\uFEB7",
  36830. "\u0634",
  36831. "\uFEB8",
  36832. "\u0634",
  36833. "\uFEB9",
  36834. "\u0635",
  36835. "\uFEBA",
  36836. "\u0635",
  36837. "\uFEBB",
  36838. "\u0635",
  36839. "\uFEBC",
  36840. "\u0635",
  36841. "\uFEBD",
  36842. "\u0636",
  36843. "\uFEBE",
  36844. "\u0636",
  36845. "\uFEBF",
  36846. "\u0636",
  36847. "\uFEC0",
  36848. "\u0636",
  36849. "\uFEC1",
  36850. "\u0637",
  36851. "\uFEC2",
  36852. "\u0637",
  36853. "\uFEC3",
  36854. "\u0637",
  36855. "\uFEC4",
  36856. "\u0637",
  36857. "\uFEC5",
  36858. "\u0638",
  36859. "\uFEC6",
  36860. "\u0638",
  36861. "\uFEC7",
  36862. "\u0638",
  36863. "\uFEC8",
  36864. "\u0638",
  36865. "\uFEC9",
  36866. "\u0639",
  36867. "\uFECA",
  36868. "\u0639",
  36869. "\uFECB",
  36870. "\u0639",
  36871. "\uFECC",
  36872. "\u0639",
  36873. "\uFECD",
  36874. "\u063A",
  36875. "\uFECE",
  36876. "\u063A",
  36877. "\uFECF",
  36878. "\u063A",
  36879. "\uFED0",
  36880. "\u063A",
  36881. "\uFED1",
  36882. "\u0641",
  36883. "\uFED2",
  36884. "\u0641",
  36885. "\uFED3",
  36886. "\u0641",
  36887. "\uFED4",
  36888. "\u0641",
  36889. "\uFED5",
  36890. "\u0642",
  36891. "\uFED6",
  36892. "\u0642",
  36893. "\uFED7",
  36894. "\u0642",
  36895. "\uFED8",
  36896. "\u0642",
  36897. "\uFED9",
  36898. "\u0643",
  36899. "\uFEDA",
  36900. "\u0643",
  36901. "\uFEDB",
  36902. "\u0643",
  36903. "\uFEDC",
  36904. "\u0643",
  36905. "\uFEDD",
  36906. "\u0644",
  36907. "\uFEDE",
  36908. "\u0644",
  36909. "\uFEDF",
  36910. "\u0644",
  36911. "\uFEE0",
  36912. "\u0644",
  36913. "\uFEE1",
  36914. "\u0645",
  36915. "\uFEE2",
  36916. "\u0645",
  36917. "\uFEE3",
  36918. "\u0645",
  36919. "\uFEE4",
  36920. "\u0645",
  36921. "\uFEE5",
  36922. "\u0646",
  36923. "\uFEE6",
  36924. "\u0646",
  36925. "\uFEE7",
  36926. "\u0646",
  36927. "\uFEE8",
  36928. "\u0646",
  36929. "\uFEE9",
  36930. "\u0647",
  36931. "\uFEEA",
  36932. "\u0647",
  36933. "\uFEEB",
  36934. "\u0647",
  36935. "\uFEEC",
  36936. "\u0647",
  36937. "\uFEED",
  36938. "\u0648",
  36939. "\uFEEE",
  36940. "\u0648",
  36941. "\uFEEF",
  36942. "\u0649",
  36943. "\uFEF0",
  36944. "\u0649",
  36945. "\uFEF1",
  36946. "\u064A",
  36947. "\uFEF2",
  36948. "\u064A",
  36949. "\uFEF3",
  36950. "\u064A",
  36951. "\uFEF4",
  36952. "\u064A",
  36953. "\uFEF5",
  36954. "\u0644\u0622",
  36955. "\uFEF6",
  36956. "\u0644\u0622",
  36957. "\uFEF7",
  36958. "\u0644\u0623",
  36959. "\uFEF8",
  36960. "\u0644\u0623",
  36961. "\uFEF9",
  36962. "\u0644\u0625",
  36963. "\uFEFA",
  36964. "\u0644\u0625",
  36965. "\uFEFB",
  36966. "\u0644\u0627",
  36967. "\uFEFC",
  36968. "\u0644\u0627"
  36969. ];
  36970. });
  36971. function reverseIfRtl(chars) {
  36972. const charsLength = chars.length;
  36973. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  36974. return chars;
  36975. }
  36976. const buf = [];
  36977. for (let ii = charsLength - 1; ii >= 0; ii--) {
  36978. buf.push(chars[ii]);
  36979. }
  36980. return buf.join("");
  36981. }
  36982. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  36983. const CategoryCache = new Map();
  36984. function getCharUnicodeCategory(char) {
  36985. const cachedCategory = CategoryCache.get(char);
  36986. if (cachedCategory) {
  36987. return cachedCategory;
  36988. }
  36989. const groups = char.match(SpecialCharRegExp);
  36990. const category = {
  36991. isWhitespace: !!(groups && groups[1]),
  36992. isZeroWidthDiacritic: !!(groups && groups[2]),
  36993. isInvisibleFormatMark: !!(groups && groups[3])
  36994. };
  36995. CategoryCache.set(char, category);
  36996. return category;
  36997. }
  36998. function clearUnicodeCaches() {
  36999. CategoryCache.clear();
  37000. }
  37001. /***/ }),
  37002. /* 39 */
  37003. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37004. Object.defineProperty(exports, "__esModule", ({
  37005. value: true
  37006. }));
  37007. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  37008. exports.getStandardFontName = getStandardFontName;
  37009. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  37010. var _core_utils = __w_pdfjs_require__(4);
  37011. var _fonts_utils = __w_pdfjs_require__(36);
  37012. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37013. t["Times-Roman"] = "Times-Roman";
  37014. t.Helvetica = "Helvetica";
  37015. t.Courier = "Courier";
  37016. t.Symbol = "Symbol";
  37017. t["Times-Bold"] = "Times-Bold";
  37018. t["Helvetica-Bold"] = "Helvetica-Bold";
  37019. t["Courier-Bold"] = "Courier-Bold";
  37020. t.ZapfDingbats = "ZapfDingbats";
  37021. t["Times-Italic"] = "Times-Italic";
  37022. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  37023. t["Courier-Oblique"] = "Courier-Oblique";
  37024. t["Times-BoldItalic"] = "Times-BoldItalic";
  37025. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  37026. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  37027. t.ArialNarrow = "Helvetica";
  37028. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  37029. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  37030. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  37031. t.ArialBlack = "Helvetica";
  37032. t["ArialBlack-Bold"] = "Helvetica-Bold";
  37033. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  37034. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  37035. t["Arial-Black"] = "Helvetica";
  37036. t["Arial-Black-Bold"] = "Helvetica-Bold";
  37037. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  37038. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  37039. t.Arial = "Helvetica";
  37040. t["Arial-Bold"] = "Helvetica-Bold";
  37041. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  37042. t["Arial-Italic"] = "Helvetica-Oblique";
  37043. t.ArialMT = "Helvetica";
  37044. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  37045. t["Arial-BoldMT"] = "Helvetica-Bold";
  37046. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  37047. t.ArialUnicodeMS = "Helvetica";
  37048. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  37049. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  37050. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  37051. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  37052. t["Courier-Italic"] = "Courier-Oblique";
  37053. t.CourierNew = "Courier";
  37054. t["CourierNew-Bold"] = "Courier-Bold";
  37055. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  37056. t["CourierNew-Italic"] = "Courier-Oblique";
  37057. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  37058. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  37059. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  37060. t.CourierNewPSMT = "Courier";
  37061. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  37062. t["Helvetica-Italic"] = "Helvetica-Oblique";
  37063. t["Symbol-Bold"] = "Symbol";
  37064. t["Symbol-BoldItalic"] = "Symbol";
  37065. t["Symbol-Italic"] = "Symbol";
  37066. t.TimesNewRoman = "Times-Roman";
  37067. t["TimesNewRoman-Bold"] = "Times-Bold";
  37068. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  37069. t["TimesNewRoman-Italic"] = "Times-Italic";
  37070. t.TimesNewRomanPS = "Times-Roman";
  37071. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  37072. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  37073. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  37074. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  37075. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  37076. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  37077. t.TimesNewRomanPSMT = "Times-Roman";
  37078. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  37079. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  37080. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  37081. });
  37082. exports.getStdFontMap = getStdFontMap;
  37083. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37084. t.Courier = "FoxitFixed.pfb";
  37085. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  37086. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  37087. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  37088. t.Helvetica = "FoxitSans.pfb";
  37089. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  37090. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  37091. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  37092. t["Times-Roman"] = "FoxitSerif.pfb";
  37093. t["Times-Bold"] = "FoxitSerifBold.pfb";
  37094. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  37095. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  37096. t.Symbol = "FoxitSymbol.pfb";
  37097. t.ZapfDingbats = "FoxitDingbats.pfb";
  37098. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  37099. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  37100. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  37101. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  37102. });
  37103. exports.getFontNameToFileMap = getFontNameToFileMap;
  37104. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  37105. t.Calibri = "Helvetica";
  37106. t["Calibri-Bold"] = "Helvetica-Bold";
  37107. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  37108. t["Calibri-Italic"] = "Helvetica-Oblique";
  37109. t.CenturyGothic = "Helvetica";
  37110. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  37111. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  37112. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  37113. t.ComicSansMS = "Comic Sans MS";
  37114. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  37115. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  37116. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  37117. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  37118. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  37119. t["ItcSymbol-Book"] = "Helvetica";
  37120. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  37121. t["ItcSymbol-Medium"] = "Helvetica";
  37122. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  37123. t.LucidaConsole = "Courier";
  37124. t["LucidaConsole-Bold"] = "Courier-Bold";
  37125. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  37126. t["LucidaConsole-Italic"] = "Courier-Oblique";
  37127. t["LucidaSans-Demi"] = "Helvetica-Bold";
  37128. t["MS-Gothic"] = "MS Gothic";
  37129. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  37130. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  37131. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  37132. t["MS-Mincho"] = "MS Mincho";
  37133. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  37134. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  37135. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  37136. t["MS-PGothic"] = "MS PGothic";
  37137. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  37138. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  37139. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  37140. t["MS-PMincho"] = "MS PMincho";
  37141. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  37142. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  37143. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  37144. t.NuptialScript = "Times-Italic";
  37145. t.SegoeUISymbol = "Helvetica";
  37146. t.Wingdings = "ZapfDingbats";
  37147. t["Wingdings-Regular"] = "ZapfDingbats";
  37148. });
  37149. exports.getNonStdFontMap = getNonStdFontMap;
  37150. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37151. t["Adobe Jenson"] = true;
  37152. t["Adobe Text"] = true;
  37153. t.Albertus = true;
  37154. t.Aldus = true;
  37155. t.Alexandria = true;
  37156. t.Algerian = true;
  37157. t["American Typewriter"] = true;
  37158. t.Antiqua = true;
  37159. t.Apex = true;
  37160. t.Arno = true;
  37161. t.Aster = true;
  37162. t.Aurora = true;
  37163. t.Baskerville = true;
  37164. t.Bell = true;
  37165. t.Bembo = true;
  37166. t["Bembo Schoolbook"] = true;
  37167. t.Benguiat = true;
  37168. t["Berkeley Old Style"] = true;
  37169. t["Bernhard Modern"] = true;
  37170. t["Berthold City"] = true;
  37171. t.Bodoni = true;
  37172. t["Bauer Bodoni"] = true;
  37173. t["Book Antiqua"] = true;
  37174. t.Bookman = true;
  37175. t["Bordeaux Roman"] = true;
  37176. t["Californian FB"] = true;
  37177. t.Calisto = true;
  37178. t.Calvert = true;
  37179. t.Capitals = true;
  37180. t.Cambria = true;
  37181. t.Cartier = true;
  37182. t.Caslon = true;
  37183. t.Catull = true;
  37184. t.Centaur = true;
  37185. t["Century Old Style"] = true;
  37186. t["Century Schoolbook"] = true;
  37187. t.Chaparral = true;
  37188. t["Charis SIL"] = true;
  37189. t.Cheltenham = true;
  37190. t["Cholla Slab"] = true;
  37191. t.Clarendon = true;
  37192. t.Clearface = true;
  37193. t.Cochin = true;
  37194. t.Colonna = true;
  37195. t["Computer Modern"] = true;
  37196. t["Concrete Roman"] = true;
  37197. t.Constantia = true;
  37198. t["Cooper Black"] = true;
  37199. t.Corona = true;
  37200. t.Ecotype = true;
  37201. t.Egyptienne = true;
  37202. t.Elephant = true;
  37203. t.Excelsior = true;
  37204. t.Fairfield = true;
  37205. t["FF Scala"] = true;
  37206. t.Folkard = true;
  37207. t.Footlight = true;
  37208. t.FreeSerif = true;
  37209. t["Friz Quadrata"] = true;
  37210. t.Garamond = true;
  37211. t.Gentium = true;
  37212. t.Georgia = true;
  37213. t.Gloucester = true;
  37214. t["Goudy Old Style"] = true;
  37215. t["Goudy Schoolbook"] = true;
  37216. t["Goudy Pro Font"] = true;
  37217. t.Granjon = true;
  37218. t["Guardian Egyptian"] = true;
  37219. t.Heather = true;
  37220. t.Hercules = true;
  37221. t["High Tower Text"] = true;
  37222. t.Hiroshige = true;
  37223. t["Hoefler Text"] = true;
  37224. t["Humana Serif"] = true;
  37225. t.Imprint = true;
  37226. t["Ionic No. 5"] = true;
  37227. t.Janson = true;
  37228. t.Joanna = true;
  37229. t.Korinna = true;
  37230. t.Lexicon = true;
  37231. t.LiberationSerif = true;
  37232. t["Liberation Serif"] = true;
  37233. t["Linux Libertine"] = true;
  37234. t.Literaturnaya = true;
  37235. t.Lucida = true;
  37236. t["Lucida Bright"] = true;
  37237. t.Melior = true;
  37238. t.Memphis = true;
  37239. t.Miller = true;
  37240. t.Minion = true;
  37241. t.Modern = true;
  37242. t["Mona Lisa"] = true;
  37243. t["Mrs Eaves"] = true;
  37244. t["MS Serif"] = true;
  37245. t["Museo Slab"] = true;
  37246. t["New York"] = true;
  37247. t["Nimbus Roman"] = true;
  37248. t["NPS Rawlinson Roadway"] = true;
  37249. t.NuptialScript = true;
  37250. t.Palatino = true;
  37251. t.Perpetua = true;
  37252. t.Plantin = true;
  37253. t["Plantin Schoolbook"] = true;
  37254. t.Playbill = true;
  37255. t["Poor Richard"] = true;
  37256. t["Rawlinson Roadway"] = true;
  37257. t.Renault = true;
  37258. t.Requiem = true;
  37259. t.Rockwell = true;
  37260. t.Roman = true;
  37261. t["Rotis Serif"] = true;
  37262. t.Sabon = true;
  37263. t.Scala = true;
  37264. t.Seagull = true;
  37265. t.Sistina = true;
  37266. t.Souvenir = true;
  37267. t.STIX = true;
  37268. t["Stone Informal"] = true;
  37269. t["Stone Serif"] = true;
  37270. t.Sylfaen = true;
  37271. t.Times = true;
  37272. t.Trajan = true;
  37273. t["Trinité"] = true;
  37274. t["Trump Mediaeval"] = true;
  37275. t.Utopia = true;
  37276. t["Vale Type"] = true;
  37277. t["Bitstream Vera"] = true;
  37278. t["Vera Serif"] = true;
  37279. t.Versailles = true;
  37280. t.Wanted = true;
  37281. t.Weiss = true;
  37282. t["Wide Latin"] = true;
  37283. t.Windsor = true;
  37284. t.XITS = true;
  37285. });
  37286. exports.getSerifFonts = getSerifFonts;
  37287. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37288. t.Dingbats = true;
  37289. t.Symbol = true;
  37290. t.ZapfDingbats = true;
  37291. });
  37292. exports.getSymbolsFonts = getSymbolsFonts;
  37293. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  37294. t[2] = 10;
  37295. t[3] = 32;
  37296. t[4] = 33;
  37297. t[5] = 34;
  37298. t[6] = 35;
  37299. t[7] = 36;
  37300. t[8] = 37;
  37301. t[9] = 38;
  37302. t[10] = 39;
  37303. t[11] = 40;
  37304. t[12] = 41;
  37305. t[13] = 42;
  37306. t[14] = 43;
  37307. t[15] = 44;
  37308. t[16] = 45;
  37309. t[17] = 46;
  37310. t[18] = 47;
  37311. t[19] = 48;
  37312. t[20] = 49;
  37313. t[21] = 50;
  37314. t[22] = 51;
  37315. t[23] = 52;
  37316. t[24] = 53;
  37317. t[25] = 54;
  37318. t[26] = 55;
  37319. t[27] = 56;
  37320. t[28] = 57;
  37321. t[29] = 58;
  37322. t[30] = 894;
  37323. t[31] = 60;
  37324. t[32] = 61;
  37325. t[33] = 62;
  37326. t[34] = 63;
  37327. t[35] = 64;
  37328. t[36] = 65;
  37329. t[37] = 66;
  37330. t[38] = 67;
  37331. t[39] = 68;
  37332. t[40] = 69;
  37333. t[41] = 70;
  37334. t[42] = 71;
  37335. t[43] = 72;
  37336. t[44] = 73;
  37337. t[45] = 74;
  37338. t[46] = 75;
  37339. t[47] = 76;
  37340. t[48] = 77;
  37341. t[49] = 78;
  37342. t[50] = 79;
  37343. t[51] = 80;
  37344. t[52] = 81;
  37345. t[53] = 82;
  37346. t[54] = 83;
  37347. t[55] = 84;
  37348. t[56] = 85;
  37349. t[57] = 86;
  37350. t[58] = 87;
  37351. t[59] = 88;
  37352. t[60] = 89;
  37353. t[61] = 90;
  37354. t[62] = 91;
  37355. t[63] = 92;
  37356. t[64] = 93;
  37357. t[65] = 94;
  37358. t[66] = 95;
  37359. t[67] = 96;
  37360. t[68] = 97;
  37361. t[69] = 98;
  37362. t[70] = 99;
  37363. t[71] = 100;
  37364. t[72] = 101;
  37365. t[73] = 102;
  37366. t[74] = 103;
  37367. t[75] = 104;
  37368. t[76] = 105;
  37369. t[77] = 106;
  37370. t[78] = 107;
  37371. t[79] = 108;
  37372. t[80] = 109;
  37373. t[81] = 110;
  37374. t[82] = 111;
  37375. t[83] = 112;
  37376. t[84] = 113;
  37377. t[85] = 114;
  37378. t[86] = 115;
  37379. t[87] = 116;
  37380. t[88] = 117;
  37381. t[89] = 118;
  37382. t[90] = 119;
  37383. t[91] = 120;
  37384. t[92] = 121;
  37385. t[93] = 122;
  37386. t[94] = 123;
  37387. t[95] = 124;
  37388. t[96] = 125;
  37389. t[97] = 126;
  37390. t[98] = 196;
  37391. t[99] = 197;
  37392. t[100] = 199;
  37393. t[101] = 201;
  37394. t[102] = 209;
  37395. t[103] = 214;
  37396. t[104] = 220;
  37397. t[105] = 225;
  37398. t[106] = 224;
  37399. t[107] = 226;
  37400. t[108] = 228;
  37401. t[109] = 227;
  37402. t[110] = 229;
  37403. t[111] = 231;
  37404. t[112] = 233;
  37405. t[113] = 232;
  37406. t[114] = 234;
  37407. t[115] = 235;
  37408. t[116] = 237;
  37409. t[117] = 236;
  37410. t[118] = 238;
  37411. t[119] = 239;
  37412. t[120] = 241;
  37413. t[121] = 243;
  37414. t[122] = 242;
  37415. t[123] = 244;
  37416. t[124] = 246;
  37417. t[125] = 245;
  37418. t[126] = 250;
  37419. t[127] = 249;
  37420. t[128] = 251;
  37421. t[129] = 252;
  37422. t[130] = 8224;
  37423. t[131] = 176;
  37424. t[132] = 162;
  37425. t[133] = 163;
  37426. t[134] = 167;
  37427. t[135] = 8226;
  37428. t[136] = 182;
  37429. t[137] = 223;
  37430. t[138] = 174;
  37431. t[139] = 169;
  37432. t[140] = 8482;
  37433. t[141] = 180;
  37434. t[142] = 168;
  37435. t[143] = 8800;
  37436. t[144] = 198;
  37437. t[145] = 216;
  37438. t[146] = 8734;
  37439. t[147] = 177;
  37440. t[148] = 8804;
  37441. t[149] = 8805;
  37442. t[150] = 165;
  37443. t[151] = 181;
  37444. t[152] = 8706;
  37445. t[153] = 8721;
  37446. t[154] = 8719;
  37447. t[156] = 8747;
  37448. t[157] = 170;
  37449. t[158] = 186;
  37450. t[159] = 8486;
  37451. t[160] = 230;
  37452. t[161] = 248;
  37453. t[162] = 191;
  37454. t[163] = 161;
  37455. t[164] = 172;
  37456. t[165] = 8730;
  37457. t[166] = 402;
  37458. t[167] = 8776;
  37459. t[168] = 8710;
  37460. t[169] = 171;
  37461. t[170] = 187;
  37462. t[171] = 8230;
  37463. t[179] = 8220;
  37464. t[180] = 8221;
  37465. t[181] = 8216;
  37466. t[182] = 8217;
  37467. t[200] = 193;
  37468. t[203] = 205;
  37469. t[210] = 218;
  37470. t[223] = 711;
  37471. t[224] = 321;
  37472. t[225] = 322;
  37473. t[226] = 352;
  37474. t[227] = 353;
  37475. t[228] = 381;
  37476. t[229] = 382;
  37477. t[233] = 221;
  37478. t[234] = 253;
  37479. t[252] = 263;
  37480. t[253] = 268;
  37481. t[254] = 269;
  37482. t[258] = 258;
  37483. t[260] = 260;
  37484. t[261] = 261;
  37485. t[265] = 280;
  37486. t[266] = 281;
  37487. t[267] = 282;
  37488. t[268] = 283;
  37489. t[269] = 313;
  37490. t[275] = 323;
  37491. t[276] = 324;
  37492. t[278] = 328;
  37493. t[283] = 344;
  37494. t[284] = 345;
  37495. t[285] = 346;
  37496. t[286] = 347;
  37497. t[292] = 367;
  37498. t[295] = 377;
  37499. t[296] = 378;
  37500. t[298] = 380;
  37501. t[305] = 963;
  37502. t[306] = 964;
  37503. t[307] = 966;
  37504. t[308] = 8215;
  37505. t[309] = 8252;
  37506. t[310] = 8319;
  37507. t[311] = 8359;
  37508. t[312] = 8592;
  37509. t[313] = 8593;
  37510. t[337] = 9552;
  37511. t[493] = 1039;
  37512. t[494] = 1040;
  37513. t[672] = 1488;
  37514. t[673] = 1489;
  37515. t[674] = 1490;
  37516. t[675] = 1491;
  37517. t[676] = 1492;
  37518. t[677] = 1493;
  37519. t[678] = 1494;
  37520. t[679] = 1495;
  37521. t[680] = 1496;
  37522. t[681] = 1497;
  37523. t[682] = 1498;
  37524. t[683] = 1499;
  37525. t[684] = 1500;
  37526. t[685] = 1501;
  37527. t[686] = 1502;
  37528. t[687] = 1503;
  37529. t[688] = 1504;
  37530. t[689] = 1505;
  37531. t[690] = 1506;
  37532. t[691] = 1507;
  37533. t[692] = 1508;
  37534. t[693] = 1509;
  37535. t[694] = 1510;
  37536. t[695] = 1511;
  37537. t[696] = 1512;
  37538. t[697] = 1513;
  37539. t[698] = 1514;
  37540. t[705] = 1524;
  37541. t[706] = 8362;
  37542. t[710] = 64288;
  37543. t[711] = 64298;
  37544. t[759] = 1617;
  37545. t[761] = 1776;
  37546. t[763] = 1778;
  37547. t[775] = 1652;
  37548. t[777] = 1764;
  37549. t[778] = 1780;
  37550. t[779] = 1781;
  37551. t[780] = 1782;
  37552. t[782] = 771;
  37553. t[783] = 64726;
  37554. t[786] = 8363;
  37555. t[788] = 8532;
  37556. t[790] = 768;
  37557. t[791] = 769;
  37558. t[792] = 768;
  37559. t[795] = 803;
  37560. t[797] = 64336;
  37561. t[798] = 64337;
  37562. t[799] = 64342;
  37563. t[800] = 64343;
  37564. t[801] = 64344;
  37565. t[802] = 64345;
  37566. t[803] = 64362;
  37567. t[804] = 64363;
  37568. t[805] = 64364;
  37569. t[2424] = 7821;
  37570. t[2425] = 7822;
  37571. t[2426] = 7823;
  37572. t[2427] = 7824;
  37573. t[2428] = 7825;
  37574. t[2429] = 7826;
  37575. t[2430] = 7827;
  37576. t[2433] = 7682;
  37577. t[2678] = 8045;
  37578. t[2679] = 8046;
  37579. t[2830] = 1552;
  37580. t[2838] = 686;
  37581. t[2840] = 751;
  37582. t[2842] = 753;
  37583. t[2843] = 754;
  37584. t[2844] = 755;
  37585. t[2846] = 757;
  37586. t[2856] = 767;
  37587. t[2857] = 848;
  37588. t[2858] = 849;
  37589. t[2862] = 853;
  37590. t[2863] = 854;
  37591. t[2864] = 855;
  37592. t[2865] = 861;
  37593. t[2866] = 862;
  37594. t[2906] = 7460;
  37595. t[2908] = 7462;
  37596. t[2909] = 7463;
  37597. t[2910] = 7464;
  37598. t[2912] = 7466;
  37599. t[2913] = 7467;
  37600. t[2914] = 7468;
  37601. t[2916] = 7470;
  37602. t[2917] = 7471;
  37603. t[2918] = 7472;
  37604. t[2920] = 7474;
  37605. t[2921] = 7475;
  37606. t[2922] = 7476;
  37607. t[2924] = 7478;
  37608. t[2925] = 7479;
  37609. t[2926] = 7480;
  37610. t[2928] = 7482;
  37611. t[2929] = 7483;
  37612. t[2930] = 7484;
  37613. t[2932] = 7486;
  37614. t[2933] = 7487;
  37615. t[2934] = 7488;
  37616. t[2936] = 7490;
  37617. t[2937] = 7491;
  37618. t[2938] = 7492;
  37619. t[2940] = 7494;
  37620. t[2941] = 7495;
  37621. t[2942] = 7496;
  37622. t[2944] = 7498;
  37623. t[2946] = 7500;
  37624. t[2948] = 7502;
  37625. t[2950] = 7504;
  37626. t[2951] = 7505;
  37627. t[2952] = 7506;
  37628. t[2954] = 7508;
  37629. t[2955] = 7509;
  37630. t[2956] = 7510;
  37631. t[2958] = 7512;
  37632. t[2959] = 7513;
  37633. t[2960] = 7514;
  37634. t[2962] = 7516;
  37635. t[2963] = 7517;
  37636. t[2964] = 7518;
  37637. t[2966] = 7520;
  37638. t[2967] = 7521;
  37639. t[2968] = 7522;
  37640. t[2970] = 7524;
  37641. t[2971] = 7525;
  37642. t[2972] = 7526;
  37643. t[2974] = 7528;
  37644. t[2975] = 7529;
  37645. t[2976] = 7530;
  37646. t[2978] = 1537;
  37647. t[2979] = 1538;
  37648. t[2980] = 1539;
  37649. t[2982] = 1549;
  37650. t[2983] = 1551;
  37651. t[2984] = 1552;
  37652. t[2986] = 1554;
  37653. t[2987] = 1555;
  37654. t[2988] = 1556;
  37655. t[2990] = 1623;
  37656. t[2991] = 1624;
  37657. t[2995] = 1775;
  37658. t[2999] = 1791;
  37659. t[3002] = 64290;
  37660. t[3003] = 64291;
  37661. t[3004] = 64292;
  37662. t[3006] = 64294;
  37663. t[3007] = 64295;
  37664. t[3008] = 64296;
  37665. t[3011] = 1900;
  37666. t[3014] = 8223;
  37667. t[3015] = 8244;
  37668. t[3017] = 7532;
  37669. t[3018] = 7533;
  37670. t[3019] = 7534;
  37671. t[3075] = 7590;
  37672. t[3076] = 7591;
  37673. t[3079] = 7594;
  37674. t[3080] = 7595;
  37675. t[3083] = 7598;
  37676. t[3084] = 7599;
  37677. t[3087] = 7602;
  37678. t[3088] = 7603;
  37679. t[3091] = 7606;
  37680. t[3092] = 7607;
  37681. t[3095] = 7610;
  37682. t[3096] = 7611;
  37683. t[3099] = 7614;
  37684. t[3100] = 7615;
  37685. t[3103] = 7618;
  37686. t[3104] = 7619;
  37687. t[3107] = 8337;
  37688. t[3108] = 8338;
  37689. t[3116] = 1884;
  37690. t[3119] = 1885;
  37691. t[3120] = 1885;
  37692. t[3123] = 1886;
  37693. t[3124] = 1886;
  37694. t[3127] = 1887;
  37695. t[3128] = 1887;
  37696. t[3131] = 1888;
  37697. t[3132] = 1888;
  37698. t[3135] = 1889;
  37699. t[3136] = 1889;
  37700. t[3139] = 1890;
  37701. t[3140] = 1890;
  37702. t[3143] = 1891;
  37703. t[3144] = 1891;
  37704. t[3147] = 1892;
  37705. t[3148] = 1892;
  37706. t[3153] = 580;
  37707. t[3154] = 581;
  37708. t[3157] = 584;
  37709. t[3158] = 585;
  37710. t[3161] = 588;
  37711. t[3162] = 589;
  37712. t[3165] = 891;
  37713. t[3166] = 892;
  37714. t[3169] = 1274;
  37715. t[3170] = 1275;
  37716. t[3173] = 1278;
  37717. t[3174] = 1279;
  37718. t[3181] = 7622;
  37719. t[3182] = 7623;
  37720. t[3282] = 11799;
  37721. t[3316] = 578;
  37722. t[3379] = 42785;
  37723. t[3393] = 1159;
  37724. t[3416] = 8377;
  37725. });
  37726. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  37727. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  37728. t[227] = 322;
  37729. t[264] = 261;
  37730. t[291] = 346;
  37731. });
  37732. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  37733. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  37734. t[1] = 32;
  37735. t[4] = 65;
  37736. t[5] = 192;
  37737. t[6] = 193;
  37738. t[9] = 196;
  37739. t[17] = 66;
  37740. t[18] = 67;
  37741. t[21] = 268;
  37742. t[24] = 68;
  37743. t[28] = 69;
  37744. t[29] = 200;
  37745. t[30] = 201;
  37746. t[32] = 282;
  37747. t[38] = 70;
  37748. t[39] = 71;
  37749. t[44] = 72;
  37750. t[47] = 73;
  37751. t[48] = 204;
  37752. t[49] = 205;
  37753. t[58] = 74;
  37754. t[60] = 75;
  37755. t[62] = 76;
  37756. t[68] = 77;
  37757. t[69] = 78;
  37758. t[75] = 79;
  37759. t[76] = 210;
  37760. t[80] = 214;
  37761. t[87] = 80;
  37762. t[89] = 81;
  37763. t[90] = 82;
  37764. t[92] = 344;
  37765. t[94] = 83;
  37766. t[97] = 352;
  37767. t[100] = 84;
  37768. t[104] = 85;
  37769. t[109] = 220;
  37770. t[115] = 86;
  37771. t[116] = 87;
  37772. t[121] = 88;
  37773. t[122] = 89;
  37774. t[124] = 221;
  37775. t[127] = 90;
  37776. t[129] = 381;
  37777. t[258] = 97;
  37778. t[259] = 224;
  37779. t[260] = 225;
  37780. t[263] = 228;
  37781. t[268] = 261;
  37782. t[271] = 98;
  37783. t[272] = 99;
  37784. t[273] = 263;
  37785. t[275] = 269;
  37786. t[282] = 100;
  37787. t[286] = 101;
  37788. t[287] = 232;
  37789. t[288] = 233;
  37790. t[290] = 283;
  37791. t[295] = 281;
  37792. t[296] = 102;
  37793. t[336] = 103;
  37794. t[346] = 104;
  37795. t[349] = 105;
  37796. t[350] = 236;
  37797. t[351] = 237;
  37798. t[361] = 106;
  37799. t[364] = 107;
  37800. t[367] = 108;
  37801. t[371] = 322;
  37802. t[373] = 109;
  37803. t[374] = 110;
  37804. t[381] = 111;
  37805. t[382] = 242;
  37806. t[383] = 243;
  37807. t[386] = 246;
  37808. t[393] = 112;
  37809. t[395] = 113;
  37810. t[396] = 114;
  37811. t[398] = 345;
  37812. t[400] = 115;
  37813. t[401] = 347;
  37814. t[403] = 353;
  37815. t[410] = 116;
  37816. t[437] = 117;
  37817. t[442] = 252;
  37818. t[448] = 118;
  37819. t[449] = 119;
  37820. t[454] = 120;
  37821. t[455] = 121;
  37822. t[457] = 253;
  37823. t[460] = 122;
  37824. t[462] = 382;
  37825. t[463] = 380;
  37826. t[853] = 44;
  37827. t[855] = 58;
  37828. t[856] = 46;
  37829. t[876] = 47;
  37830. t[878] = 45;
  37831. t[882] = 45;
  37832. t[894] = 40;
  37833. t[895] = 41;
  37834. t[896] = 91;
  37835. t[897] = 93;
  37836. t[923] = 64;
  37837. t[1004] = 48;
  37838. t[1005] = 49;
  37839. t[1006] = 50;
  37840. t[1007] = 51;
  37841. t[1008] = 52;
  37842. t[1009] = 53;
  37843. t[1010] = 54;
  37844. t[1011] = 55;
  37845. t[1012] = 56;
  37846. t[1013] = 57;
  37847. t[1081] = 37;
  37848. t[1085] = 43;
  37849. t[1086] = 45;
  37850. });
  37851. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  37852. function getStandardFontName(name) {
  37853. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  37854. const stdFontMap = getStdFontMap();
  37855. return stdFontMap[fontName];
  37856. }
  37857. /***/ }),
  37858. /* 40 */
  37859. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37860. Object.defineProperty(exports, "__esModule", ({
  37861. value: true
  37862. }));
  37863. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  37864. var _util = __w_pdfjs_require__(2);
  37865. class ToUnicodeMap {
  37866. constructor(cmap = []) {
  37867. this._map = cmap;
  37868. }
  37869. get length() {
  37870. return this._map.length;
  37871. }
  37872. forEach(callback) {
  37873. for (const charCode in this._map) {
  37874. callback(charCode, this._map[charCode].charCodeAt(0));
  37875. }
  37876. }
  37877. has(i) {
  37878. return this._map[i] !== undefined;
  37879. }
  37880. get(i) {
  37881. return this._map[i];
  37882. }
  37883. charCodeOf(value) {
  37884. const map = this._map;
  37885. if (map.length <= 0x10000) {
  37886. return map.indexOf(value);
  37887. }
  37888. for (const charCode in map) {
  37889. if (map[charCode] === value) {
  37890. return charCode | 0;
  37891. }
  37892. }
  37893. return -1;
  37894. }
  37895. amend(map) {
  37896. for (const charCode in map) {
  37897. this._map[charCode] = map[charCode];
  37898. }
  37899. }
  37900. }
  37901. exports.ToUnicodeMap = ToUnicodeMap;
  37902. class IdentityToUnicodeMap {
  37903. constructor(firstChar, lastChar) {
  37904. this.firstChar = firstChar;
  37905. this.lastChar = lastChar;
  37906. }
  37907. get length() {
  37908. return this.lastChar + 1 - this.firstChar;
  37909. }
  37910. forEach(callback) {
  37911. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  37912. callback(i, i);
  37913. }
  37914. }
  37915. has(i) {
  37916. return this.firstChar <= i && i <= this.lastChar;
  37917. }
  37918. get(i) {
  37919. if (this.firstChar <= i && i <= this.lastChar) {
  37920. return String.fromCharCode(i);
  37921. }
  37922. return undefined;
  37923. }
  37924. charCodeOf(v) {
  37925. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  37926. }
  37927. amend(map) {
  37928. (0, _util.unreachable)("Should not call amend()");
  37929. }
  37930. }
  37931. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  37932. /***/ }),
  37933. /* 41 */
  37934. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37935. Object.defineProperty(exports, "__esModule", ({
  37936. value: true
  37937. }));
  37938. exports.CFFFont = void 0;
  37939. var _cff_parser = __w_pdfjs_require__(33);
  37940. var _fonts_utils = __w_pdfjs_require__(36);
  37941. var _util = __w_pdfjs_require__(2);
  37942. class CFFFont {
  37943. constructor(file, properties) {
  37944. this.properties = properties;
  37945. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37946. this.cff = parser.parse();
  37947. this.cff.duplicateFirstGlyph();
  37948. const compiler = new _cff_parser.CFFCompiler(this.cff);
  37949. this.seacs = this.cff.seacs;
  37950. try {
  37951. this.data = compiler.compile();
  37952. } catch (e) {
  37953. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  37954. this.data = file;
  37955. }
  37956. this._createBuiltInEncoding();
  37957. }
  37958. get numGlyphs() {
  37959. return this.cff.charStrings.count;
  37960. }
  37961. getCharset() {
  37962. return this.cff.charset.charset;
  37963. }
  37964. getGlyphMapping() {
  37965. const cff = this.cff;
  37966. const properties = this.properties;
  37967. const {
  37968. cidToGidMap,
  37969. cMap
  37970. } = properties;
  37971. const charsets = cff.charset.charset;
  37972. let charCodeToGlyphId;
  37973. let glyphId;
  37974. if (properties.composite) {
  37975. let invCidToGidMap;
  37976. if (cidToGidMap && cidToGidMap.length > 0) {
  37977. invCidToGidMap = Object.create(null);
  37978. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  37979. const gid = cidToGidMap[i];
  37980. if (gid !== undefined) {
  37981. invCidToGidMap[gid] = i;
  37982. }
  37983. }
  37984. }
  37985. charCodeToGlyphId = Object.create(null);
  37986. let charCode;
  37987. if (cff.isCIDFont) {
  37988. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  37989. const cid = charsets[glyphId];
  37990. charCode = cMap.charCodeOf(cid);
  37991. if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
  37992. charCode = invCidToGidMap[charCode];
  37993. }
  37994. charCodeToGlyphId[charCode] = glyphId;
  37995. }
  37996. } else {
  37997. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  37998. charCode = cMap.charCodeOf(glyphId);
  37999. charCodeToGlyphId[charCode] = glyphId;
  38000. }
  38001. }
  38002. return charCodeToGlyphId;
  38003. }
  38004. let encoding = cff.encoding ? cff.encoding.encoding : null;
  38005. if (properties.isInternalFont) {
  38006. encoding = properties.defaultEncoding;
  38007. }
  38008. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  38009. return charCodeToGlyphId;
  38010. }
  38011. hasGlyphId(id) {
  38012. return this.cff.hasGlyphId(id);
  38013. }
  38014. _createBuiltInEncoding() {
  38015. const {
  38016. charset,
  38017. encoding
  38018. } = this.cff;
  38019. if (!charset || !encoding) {
  38020. return;
  38021. }
  38022. const charsets = charset.charset,
  38023. encodings = encoding.encoding;
  38024. const map = [];
  38025. for (const charCode in encodings) {
  38026. const glyphId = encodings[charCode];
  38027. if (glyphId >= 0) {
  38028. const glyphName = charsets[glyphId];
  38029. if (glyphName) {
  38030. map[charCode] = glyphName;
  38031. }
  38032. }
  38033. }
  38034. if (map.length > 0) {
  38035. this.properties.builtInEncoding = map;
  38036. }
  38037. }
  38038. }
  38039. exports.CFFFont = CFFFont;
  38040. /***/ }),
  38041. /* 42 */
  38042. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38043. Object.defineProperty(exports, "__esModule", ({
  38044. value: true
  38045. }));
  38046. exports.FontRendererFactory = void 0;
  38047. var _util = __w_pdfjs_require__(2);
  38048. var _cff_parser = __w_pdfjs_require__(33);
  38049. var _glyphlist = __w_pdfjs_require__(37);
  38050. var _encodings = __w_pdfjs_require__(35);
  38051. var _stream = __w_pdfjs_require__(8);
  38052. function getUint32(data, offset) {
  38053. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  38054. }
  38055. function getUint16(data, offset) {
  38056. return data[offset] << 8 | data[offset + 1];
  38057. }
  38058. function getInt16(data, offset) {
  38059. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  38060. }
  38061. function getInt8(data, offset) {
  38062. return data[offset] << 24 >> 24;
  38063. }
  38064. function getFloat214(data, offset) {
  38065. return getInt16(data, offset) / 16384;
  38066. }
  38067. function getSubroutineBias(subrs) {
  38068. const numSubrs = subrs.length;
  38069. let bias = 32768;
  38070. if (numSubrs < 1240) {
  38071. bias = 107;
  38072. } else if (numSubrs < 33900) {
  38073. bias = 1131;
  38074. }
  38075. return bias;
  38076. }
  38077. function parseCmap(data, start, end) {
  38078. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  38079. const format = getUint16(data, start + offset);
  38080. let ranges, p, i;
  38081. if (format === 4) {
  38082. getUint16(data, start + offset + 2);
  38083. const segCount = getUint16(data, start + offset + 6) >> 1;
  38084. p = start + offset + 14;
  38085. ranges = [];
  38086. for (i = 0; i < segCount; i++, p += 2) {
  38087. ranges[i] = {
  38088. end: getUint16(data, p)
  38089. };
  38090. }
  38091. p += 2;
  38092. for (i = 0; i < segCount; i++, p += 2) {
  38093. ranges[i].start = getUint16(data, p);
  38094. }
  38095. for (i = 0; i < segCount; i++, p += 2) {
  38096. ranges[i].idDelta = getUint16(data, p);
  38097. }
  38098. for (i = 0; i < segCount; i++, p += 2) {
  38099. let idOffset = getUint16(data, p);
  38100. if (idOffset === 0) {
  38101. continue;
  38102. }
  38103. ranges[i].ids = [];
  38104. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38105. ranges[i].ids[j] = getUint16(data, p + idOffset);
  38106. idOffset += 2;
  38107. }
  38108. }
  38109. return ranges;
  38110. } else if (format === 12) {
  38111. const groups = getUint32(data, start + offset + 12);
  38112. p = start + offset + 16;
  38113. ranges = [];
  38114. for (i = 0; i < groups; i++) {
  38115. start = getUint32(data, p);
  38116. ranges.push({
  38117. start,
  38118. end: getUint32(data, p + 4),
  38119. idDelta: getUint32(data, p + 8) - start
  38120. });
  38121. p += 12;
  38122. }
  38123. return ranges;
  38124. }
  38125. throw new _util.FormatError(`unsupported cmap: ${format}`);
  38126. }
  38127. function parseCff(data, start, end, seacAnalysisEnabled) {
  38128. const properties = {};
  38129. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38130. const cff = parser.parse();
  38131. return {
  38132. glyphs: cff.charStrings.objects,
  38133. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38134. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  38135. isCFFCIDFont: cff.isCIDFont,
  38136. fdSelect: cff.fdSelect,
  38137. fdArray: cff.fdArray
  38138. };
  38139. }
  38140. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38141. let itemSize, itemDecode;
  38142. if (isGlyphLocationsLong) {
  38143. itemSize = 4;
  38144. itemDecode = getUint32;
  38145. } else {
  38146. itemSize = 2;
  38147. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  38148. }
  38149. const glyphs = [];
  38150. let startOffset = itemDecode(loca, 0);
  38151. for (let j = itemSize; j < loca.length; j += itemSize) {
  38152. const endOffset = itemDecode(loca, j);
  38153. glyphs.push(glyf.subarray(startOffset, endOffset));
  38154. startOffset = endOffset;
  38155. }
  38156. return glyphs;
  38157. }
  38158. function lookupCmap(ranges, unicode) {
  38159. const code = unicode.codePointAt(0);
  38160. let gid = 0,
  38161. l = 0,
  38162. r = ranges.length - 1;
  38163. while (l < r) {
  38164. const c = l + r + 1 >> 1;
  38165. if (code < ranges[c].start) {
  38166. r = c - 1;
  38167. } else {
  38168. l = c;
  38169. }
  38170. }
  38171. if (ranges[l].start <= code && code <= ranges[l].end) {
  38172. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  38173. }
  38174. return {
  38175. charCode: code,
  38176. glyphId: gid
  38177. };
  38178. }
  38179. function compileGlyf(code, cmds, font) {
  38180. function moveTo(x, y) {
  38181. cmds.push({
  38182. cmd: "moveTo",
  38183. args: [x, y]
  38184. });
  38185. }
  38186. function lineTo(x, y) {
  38187. cmds.push({
  38188. cmd: "lineTo",
  38189. args: [x, y]
  38190. });
  38191. }
  38192. function quadraticCurveTo(xa, ya, x, y) {
  38193. cmds.push({
  38194. cmd: "quadraticCurveTo",
  38195. args: [xa, ya, x, y]
  38196. });
  38197. }
  38198. let i = 0;
  38199. const numberOfContours = getInt16(code, i);
  38200. let flags;
  38201. let x = 0,
  38202. y = 0;
  38203. i += 10;
  38204. if (numberOfContours < 0) {
  38205. do {
  38206. flags = getUint16(code, i);
  38207. const glyphIndex = getUint16(code, i + 2);
  38208. i += 4;
  38209. let arg1, arg2;
  38210. if (flags & 0x01) {
  38211. if (flags & 0x02) {
  38212. arg1 = getInt16(code, i);
  38213. arg2 = getInt16(code, i + 2);
  38214. } else {
  38215. arg1 = getUint16(code, i);
  38216. arg2 = getUint16(code, i + 2);
  38217. }
  38218. i += 4;
  38219. } else {
  38220. if (flags & 0x02) {
  38221. arg1 = getInt8(code, i++);
  38222. arg2 = getInt8(code, i++);
  38223. } else {
  38224. arg1 = code[i++];
  38225. arg2 = code[i++];
  38226. }
  38227. }
  38228. if (flags & 0x02) {
  38229. x = arg1;
  38230. y = arg2;
  38231. } else {
  38232. x = 0;
  38233. y = 0;
  38234. }
  38235. let scaleX = 1,
  38236. scaleY = 1,
  38237. scale01 = 0,
  38238. scale10 = 0;
  38239. if (flags & 0x08) {
  38240. scaleX = scaleY = getFloat214(code, i);
  38241. i += 2;
  38242. } else if (flags & 0x40) {
  38243. scaleX = getFloat214(code, i);
  38244. scaleY = getFloat214(code, i + 2);
  38245. i += 4;
  38246. } else if (flags & 0x80) {
  38247. scaleX = getFloat214(code, i);
  38248. scale01 = getFloat214(code, i + 2);
  38249. scale10 = getFloat214(code, i + 4);
  38250. scaleY = getFloat214(code, i + 6);
  38251. i += 8;
  38252. }
  38253. const subglyph = font.glyphs[glyphIndex];
  38254. if (subglyph) {
  38255. cmds.push({
  38256. cmd: "save"
  38257. }, {
  38258. cmd: "transform",
  38259. args: [scaleX, scale01, scale10, scaleY, x, y]
  38260. });
  38261. if (!(flags & 0x02)) {}
  38262. compileGlyf(subglyph, cmds, font);
  38263. cmds.push({
  38264. cmd: "restore"
  38265. });
  38266. }
  38267. } while (flags & 0x20);
  38268. } else {
  38269. const endPtsOfContours = [];
  38270. let j, jj;
  38271. for (j = 0; j < numberOfContours; j++) {
  38272. endPtsOfContours.push(getUint16(code, i));
  38273. i += 2;
  38274. }
  38275. const instructionLength = getUint16(code, i);
  38276. i += 2 + instructionLength;
  38277. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  38278. const points = [];
  38279. while (points.length < numberOfPoints) {
  38280. flags = code[i++];
  38281. let repeat = 1;
  38282. if (flags & 0x08) {
  38283. repeat += code[i++];
  38284. }
  38285. while (repeat-- > 0) {
  38286. points.push({
  38287. flags
  38288. });
  38289. }
  38290. }
  38291. for (j = 0; j < numberOfPoints; j++) {
  38292. switch (points[j].flags & 0x12) {
  38293. case 0x00:
  38294. x += getInt16(code, i);
  38295. i += 2;
  38296. break;
  38297. case 0x02:
  38298. x -= code[i++];
  38299. break;
  38300. case 0x12:
  38301. x += code[i++];
  38302. break;
  38303. }
  38304. points[j].x = x;
  38305. }
  38306. for (j = 0; j < numberOfPoints; j++) {
  38307. switch (points[j].flags & 0x24) {
  38308. case 0x00:
  38309. y += getInt16(code, i);
  38310. i += 2;
  38311. break;
  38312. case 0x04:
  38313. y -= code[i++];
  38314. break;
  38315. case 0x24:
  38316. y += code[i++];
  38317. break;
  38318. }
  38319. points[j].y = y;
  38320. }
  38321. let startPoint = 0;
  38322. for (i = 0; i < numberOfContours; i++) {
  38323. const endPoint = endPtsOfContours[i];
  38324. const contour = points.slice(startPoint, endPoint + 1);
  38325. if (contour[0].flags & 1) {
  38326. contour.push(contour[0]);
  38327. } else if (contour.at(-1).flags & 1) {
  38328. contour.unshift(contour.at(-1));
  38329. } else {
  38330. const p = {
  38331. flags: 1,
  38332. x: (contour[0].x + contour.at(-1).x) / 2,
  38333. y: (contour[0].y + contour.at(-1).y) / 2
  38334. };
  38335. contour.unshift(p);
  38336. contour.push(p);
  38337. }
  38338. moveTo(contour[0].x, contour[0].y);
  38339. for (j = 1, jj = contour.length; j < jj; j++) {
  38340. if (contour[j].flags & 1) {
  38341. lineTo(contour[j].x, contour[j].y);
  38342. } else if (contour[j + 1].flags & 1) {
  38343. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  38344. j++;
  38345. } else {
  38346. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  38347. }
  38348. }
  38349. startPoint = endPoint + 1;
  38350. }
  38351. }
  38352. }
  38353. function compileCharString(charStringCode, cmds, font, glyphId) {
  38354. function moveTo(x, y) {
  38355. cmds.push({
  38356. cmd: "moveTo",
  38357. args: [x, y]
  38358. });
  38359. }
  38360. function lineTo(x, y) {
  38361. cmds.push({
  38362. cmd: "lineTo",
  38363. args: [x, y]
  38364. });
  38365. }
  38366. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  38367. cmds.push({
  38368. cmd: "bezierCurveTo",
  38369. args: [x1, y1, x2, y2, x, y]
  38370. });
  38371. }
  38372. const stack = [];
  38373. let x = 0,
  38374. y = 0;
  38375. let stems = 0;
  38376. function parse(code) {
  38377. let i = 0;
  38378. while (i < code.length) {
  38379. let stackClean = false;
  38380. let v = code[i++];
  38381. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38382. switch (v) {
  38383. case 1:
  38384. stems += stack.length >> 1;
  38385. stackClean = true;
  38386. break;
  38387. case 3:
  38388. stems += stack.length >> 1;
  38389. stackClean = true;
  38390. break;
  38391. case 4:
  38392. y += stack.pop();
  38393. moveTo(x, y);
  38394. stackClean = true;
  38395. break;
  38396. case 5:
  38397. while (stack.length > 0) {
  38398. x += stack.shift();
  38399. y += stack.shift();
  38400. lineTo(x, y);
  38401. }
  38402. break;
  38403. case 6:
  38404. while (stack.length > 0) {
  38405. x += stack.shift();
  38406. lineTo(x, y);
  38407. if (stack.length === 0) {
  38408. break;
  38409. }
  38410. y += stack.shift();
  38411. lineTo(x, y);
  38412. }
  38413. break;
  38414. case 7:
  38415. while (stack.length > 0) {
  38416. y += stack.shift();
  38417. lineTo(x, y);
  38418. if (stack.length === 0) {
  38419. break;
  38420. }
  38421. x += stack.shift();
  38422. lineTo(x, y);
  38423. }
  38424. break;
  38425. case 8:
  38426. while (stack.length > 0) {
  38427. xa = x + stack.shift();
  38428. ya = y + stack.shift();
  38429. xb = xa + stack.shift();
  38430. yb = ya + stack.shift();
  38431. x = xb + stack.shift();
  38432. y = yb + stack.shift();
  38433. bezierCurveTo(xa, ya, xb, yb, x, y);
  38434. }
  38435. break;
  38436. case 10:
  38437. n = stack.pop();
  38438. subrCode = null;
  38439. if (font.isCFFCIDFont) {
  38440. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  38441. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  38442. const fontDict = font.fdArray[fdIndex];
  38443. let subrs;
  38444. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  38445. subrs = fontDict.privateDict.subrsIndex.objects;
  38446. }
  38447. if (subrs) {
  38448. n += getSubroutineBias(subrs);
  38449. subrCode = subrs[n];
  38450. }
  38451. } else {
  38452. (0, _util.warn)("Invalid fd index for glyph index.");
  38453. }
  38454. } else {
  38455. subrCode = font.subrs[n + font.subrsBias];
  38456. }
  38457. if (subrCode) {
  38458. parse(subrCode);
  38459. }
  38460. break;
  38461. case 11:
  38462. return;
  38463. case 12:
  38464. v = code[i++];
  38465. switch (v) {
  38466. case 34:
  38467. xa = x + stack.shift();
  38468. xb = xa + stack.shift();
  38469. y1 = y + stack.shift();
  38470. x = xb + stack.shift();
  38471. bezierCurveTo(xa, y, xb, y1, x, y1);
  38472. xa = x + stack.shift();
  38473. xb = xa + stack.shift();
  38474. x = xb + stack.shift();
  38475. bezierCurveTo(xa, y1, xb, y, x, y);
  38476. break;
  38477. case 35:
  38478. xa = x + stack.shift();
  38479. ya = y + stack.shift();
  38480. xb = xa + stack.shift();
  38481. yb = ya + stack.shift();
  38482. x = xb + stack.shift();
  38483. y = yb + stack.shift();
  38484. bezierCurveTo(xa, ya, xb, yb, x, y);
  38485. xa = x + stack.shift();
  38486. ya = y + stack.shift();
  38487. xb = xa + stack.shift();
  38488. yb = ya + stack.shift();
  38489. x = xb + stack.shift();
  38490. y = yb + stack.shift();
  38491. bezierCurveTo(xa, ya, xb, yb, x, y);
  38492. stack.pop();
  38493. break;
  38494. case 36:
  38495. xa = x + stack.shift();
  38496. y1 = y + stack.shift();
  38497. xb = xa + stack.shift();
  38498. y2 = y1 + stack.shift();
  38499. x = xb + stack.shift();
  38500. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38501. xa = x + stack.shift();
  38502. xb = xa + stack.shift();
  38503. y3 = y2 + stack.shift();
  38504. x = xb + stack.shift();
  38505. bezierCurveTo(xa, y2, xb, y3, x, y);
  38506. break;
  38507. case 37:
  38508. const x0 = x,
  38509. y0 = y;
  38510. xa = x + stack.shift();
  38511. ya = y + stack.shift();
  38512. xb = xa + stack.shift();
  38513. yb = ya + stack.shift();
  38514. x = xb + stack.shift();
  38515. y = yb + stack.shift();
  38516. bezierCurveTo(xa, ya, xb, yb, x, y);
  38517. xa = x + stack.shift();
  38518. ya = y + stack.shift();
  38519. xb = xa + stack.shift();
  38520. yb = ya + stack.shift();
  38521. x = xb;
  38522. y = yb;
  38523. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38524. x += stack.shift();
  38525. } else {
  38526. y += stack.shift();
  38527. }
  38528. bezierCurveTo(xa, ya, xb, yb, x, y);
  38529. break;
  38530. default:
  38531. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  38532. }
  38533. break;
  38534. case 14:
  38535. if (stack.length >= 4) {
  38536. const achar = stack.pop();
  38537. const bchar = stack.pop();
  38538. y = stack.pop();
  38539. x = stack.pop();
  38540. cmds.push({
  38541. cmd: "save"
  38542. }, {
  38543. cmd: "translate",
  38544. args: [x, y]
  38545. });
  38546. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  38547. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38548. cmds.push({
  38549. cmd: "restore"
  38550. });
  38551. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  38552. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38553. }
  38554. return;
  38555. case 18:
  38556. stems += stack.length >> 1;
  38557. stackClean = true;
  38558. break;
  38559. case 19:
  38560. stems += stack.length >> 1;
  38561. i += stems + 7 >> 3;
  38562. stackClean = true;
  38563. break;
  38564. case 20:
  38565. stems += stack.length >> 1;
  38566. i += stems + 7 >> 3;
  38567. stackClean = true;
  38568. break;
  38569. case 21:
  38570. y += stack.pop();
  38571. x += stack.pop();
  38572. moveTo(x, y);
  38573. stackClean = true;
  38574. break;
  38575. case 22:
  38576. x += stack.pop();
  38577. moveTo(x, y);
  38578. stackClean = true;
  38579. break;
  38580. case 23:
  38581. stems += stack.length >> 1;
  38582. stackClean = true;
  38583. break;
  38584. case 24:
  38585. while (stack.length > 2) {
  38586. xa = x + stack.shift();
  38587. ya = y + stack.shift();
  38588. xb = xa + stack.shift();
  38589. yb = ya + stack.shift();
  38590. x = xb + stack.shift();
  38591. y = yb + stack.shift();
  38592. bezierCurveTo(xa, ya, xb, yb, x, y);
  38593. }
  38594. x += stack.shift();
  38595. y += stack.shift();
  38596. lineTo(x, y);
  38597. break;
  38598. case 25:
  38599. while (stack.length > 6) {
  38600. x += stack.shift();
  38601. y += stack.shift();
  38602. lineTo(x, y);
  38603. }
  38604. xa = x + stack.shift();
  38605. ya = y + stack.shift();
  38606. xb = xa + stack.shift();
  38607. yb = ya + stack.shift();
  38608. x = xb + stack.shift();
  38609. y = yb + stack.shift();
  38610. bezierCurveTo(xa, ya, xb, yb, x, y);
  38611. break;
  38612. case 26:
  38613. if (stack.length % 2) {
  38614. x += stack.shift();
  38615. }
  38616. while (stack.length > 0) {
  38617. xa = x;
  38618. ya = y + stack.shift();
  38619. xb = xa + stack.shift();
  38620. yb = ya + stack.shift();
  38621. x = xb;
  38622. y = yb + stack.shift();
  38623. bezierCurveTo(xa, ya, xb, yb, x, y);
  38624. }
  38625. break;
  38626. case 27:
  38627. if (stack.length % 2) {
  38628. y += stack.shift();
  38629. }
  38630. while (stack.length > 0) {
  38631. xa = x + stack.shift();
  38632. ya = y;
  38633. xb = xa + stack.shift();
  38634. yb = ya + stack.shift();
  38635. x = xb + stack.shift();
  38636. y = yb;
  38637. bezierCurveTo(xa, ya, xb, yb, x, y);
  38638. }
  38639. break;
  38640. case 28:
  38641. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38642. i += 2;
  38643. break;
  38644. case 29:
  38645. n = stack.pop() + font.gsubrsBias;
  38646. subrCode = font.gsubrs[n];
  38647. if (subrCode) {
  38648. parse(subrCode);
  38649. }
  38650. break;
  38651. case 30:
  38652. while (stack.length > 0) {
  38653. xa = x;
  38654. ya = y + stack.shift();
  38655. xb = xa + stack.shift();
  38656. yb = ya + stack.shift();
  38657. x = xb + stack.shift();
  38658. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38659. bezierCurveTo(xa, ya, xb, yb, x, y);
  38660. if (stack.length === 0) {
  38661. break;
  38662. }
  38663. xa = x + stack.shift();
  38664. ya = y;
  38665. xb = xa + stack.shift();
  38666. yb = ya + stack.shift();
  38667. y = yb + stack.shift();
  38668. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38669. bezierCurveTo(xa, ya, xb, yb, x, y);
  38670. }
  38671. break;
  38672. case 31:
  38673. while (stack.length > 0) {
  38674. xa = x + stack.shift();
  38675. ya = y;
  38676. xb = xa + stack.shift();
  38677. yb = ya + stack.shift();
  38678. y = yb + stack.shift();
  38679. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38680. bezierCurveTo(xa, ya, xb, yb, x, y);
  38681. if (stack.length === 0) {
  38682. break;
  38683. }
  38684. xa = x;
  38685. ya = y + stack.shift();
  38686. xb = xa + stack.shift();
  38687. yb = ya + stack.shift();
  38688. x = xb + stack.shift();
  38689. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38690. bezierCurveTo(xa, ya, xb, yb, x, y);
  38691. }
  38692. break;
  38693. default:
  38694. if (v < 32) {
  38695. throw new _util.FormatError(`unknown operator: ${v}`);
  38696. }
  38697. if (v < 247) {
  38698. stack.push(v - 139);
  38699. } else if (v < 251) {
  38700. stack.push((v - 247) * 256 + code[i++] + 108);
  38701. } else if (v < 255) {
  38702. stack.push(-(v - 251) * 256 - code[i++] - 108);
  38703. } else {
  38704. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  38705. i += 4;
  38706. }
  38707. break;
  38708. }
  38709. if (stackClean) {
  38710. stack.length = 0;
  38711. }
  38712. }
  38713. }
  38714. parse(charStringCode);
  38715. }
  38716. const NOOP = [];
  38717. class CompiledFont {
  38718. constructor(fontMatrix) {
  38719. if (this.constructor === CompiledFont) {
  38720. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  38721. }
  38722. this.fontMatrix = fontMatrix;
  38723. this.compiledGlyphs = Object.create(null);
  38724. this.compiledCharCodeToGlyphId = Object.create(null);
  38725. }
  38726. getPathJs(unicode) {
  38727. const {
  38728. charCode,
  38729. glyphId
  38730. } = lookupCmap(this.cmap, unicode);
  38731. let fn = this.compiledGlyphs[glyphId];
  38732. if (!fn) {
  38733. try {
  38734. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  38735. this.compiledGlyphs[glyphId] = fn;
  38736. } catch (ex) {
  38737. this.compiledGlyphs[glyphId] = NOOP;
  38738. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38739. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38740. }
  38741. throw ex;
  38742. }
  38743. }
  38744. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38745. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38746. }
  38747. return fn;
  38748. }
  38749. compileGlyph(code, glyphId) {
  38750. if (!code || code.length === 0 || code[0] === 14) {
  38751. return NOOP;
  38752. }
  38753. let fontMatrix = this.fontMatrix;
  38754. if (this.isCFFCIDFont) {
  38755. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  38756. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  38757. const fontDict = this.fdArray[fdIndex];
  38758. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  38759. } else {
  38760. (0, _util.warn)("Invalid fd index for glyph index.");
  38761. }
  38762. }
  38763. const cmds = [{
  38764. cmd: "save"
  38765. }, {
  38766. cmd: "transform",
  38767. args: fontMatrix.slice()
  38768. }, {
  38769. cmd: "scale",
  38770. args: ["size", "-size"]
  38771. }];
  38772. this.compileGlyphImpl(code, cmds, glyphId);
  38773. cmds.push({
  38774. cmd: "restore"
  38775. });
  38776. return cmds;
  38777. }
  38778. compileGlyphImpl() {
  38779. (0, _util.unreachable)("Children classes should implement this.");
  38780. }
  38781. hasBuiltPath(unicode) {
  38782. const {
  38783. charCode,
  38784. glyphId
  38785. } = lookupCmap(this.cmap, unicode);
  38786. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  38787. }
  38788. }
  38789. class TrueTypeCompiled extends CompiledFont {
  38790. constructor(glyphs, cmap, fontMatrix) {
  38791. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  38792. this.glyphs = glyphs;
  38793. this.cmap = cmap;
  38794. }
  38795. compileGlyphImpl(code, cmds) {
  38796. compileGlyf(code, cmds, this);
  38797. }
  38798. }
  38799. class Type2Compiled extends CompiledFont {
  38800. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  38801. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  38802. this.glyphs = cffInfo.glyphs;
  38803. this.gsubrs = cffInfo.gsubrs || [];
  38804. this.subrs = cffInfo.subrs || [];
  38805. this.cmap = cmap;
  38806. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  38807. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  38808. this.subrsBias = getSubroutineBias(this.subrs);
  38809. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  38810. this.fdSelect = cffInfo.fdSelect;
  38811. this.fdArray = cffInfo.fdArray;
  38812. }
  38813. compileGlyphImpl(code, cmds, glyphId) {
  38814. compileCharString(code, cmds, this, glyphId);
  38815. }
  38816. }
  38817. class FontRendererFactory {
  38818. static create(font, seacAnalysisEnabled) {
  38819. const data = new Uint8Array(font.data);
  38820. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  38821. const numTables = getUint16(data, 4);
  38822. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  38823. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  38824. const offset = getUint32(data, p + 8);
  38825. const length = getUint32(data, p + 12);
  38826. switch (tag) {
  38827. case "cmap":
  38828. cmap = parseCmap(data, offset, offset + length);
  38829. break;
  38830. case "glyf":
  38831. glyf = data.subarray(offset, offset + length);
  38832. break;
  38833. case "loca":
  38834. loca = data.subarray(offset, offset + length);
  38835. break;
  38836. case "head":
  38837. unitsPerEm = getUint16(data, offset + 18);
  38838. indexToLocFormat = getUint16(data, offset + 50);
  38839. break;
  38840. case "CFF ":
  38841. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  38842. break;
  38843. }
  38844. }
  38845. if (glyf) {
  38846. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  38847. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  38848. }
  38849. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  38850. }
  38851. }
  38852. exports.FontRendererFactory = FontRendererFactory;
  38853. /***/ }),
  38854. /* 43 */
  38855. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38856. Object.defineProperty(exports, "__esModule", ({
  38857. value: true
  38858. }));
  38859. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  38860. var _core_utils = __w_pdfjs_require__(4);
  38861. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  38862. t.Courier = 600;
  38863. t["Courier-Bold"] = 600;
  38864. t["Courier-BoldOblique"] = 600;
  38865. t["Courier-Oblique"] = 600;
  38866. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  38867. t.space = 278;
  38868. t.exclam = 278;
  38869. t.quotedbl = 355;
  38870. t.numbersign = 556;
  38871. t.dollar = 556;
  38872. t.percent = 889;
  38873. t.ampersand = 667;
  38874. t.quoteright = 222;
  38875. t.parenleft = 333;
  38876. t.parenright = 333;
  38877. t.asterisk = 389;
  38878. t.plus = 584;
  38879. t.comma = 278;
  38880. t.hyphen = 333;
  38881. t.period = 278;
  38882. t.slash = 278;
  38883. t.zero = 556;
  38884. t.one = 556;
  38885. t.two = 556;
  38886. t.three = 556;
  38887. t.four = 556;
  38888. t.five = 556;
  38889. t.six = 556;
  38890. t.seven = 556;
  38891. t.eight = 556;
  38892. t.nine = 556;
  38893. t.colon = 278;
  38894. t.semicolon = 278;
  38895. t.less = 584;
  38896. t.equal = 584;
  38897. t.greater = 584;
  38898. t.question = 556;
  38899. t.at = 1015;
  38900. t.A = 667;
  38901. t.B = 667;
  38902. t.C = 722;
  38903. t.D = 722;
  38904. t.E = 667;
  38905. t.F = 611;
  38906. t.G = 778;
  38907. t.H = 722;
  38908. t.I = 278;
  38909. t.J = 500;
  38910. t.K = 667;
  38911. t.L = 556;
  38912. t.M = 833;
  38913. t.N = 722;
  38914. t.O = 778;
  38915. t.P = 667;
  38916. t.Q = 778;
  38917. t.R = 722;
  38918. t.S = 667;
  38919. t.T = 611;
  38920. t.U = 722;
  38921. t.V = 667;
  38922. t.W = 944;
  38923. t.X = 667;
  38924. t.Y = 667;
  38925. t.Z = 611;
  38926. t.bracketleft = 278;
  38927. t.backslash = 278;
  38928. t.bracketright = 278;
  38929. t.asciicircum = 469;
  38930. t.underscore = 556;
  38931. t.quoteleft = 222;
  38932. t.a = 556;
  38933. t.b = 556;
  38934. t.c = 500;
  38935. t.d = 556;
  38936. t.e = 556;
  38937. t.f = 278;
  38938. t.g = 556;
  38939. t.h = 556;
  38940. t.i = 222;
  38941. t.j = 222;
  38942. t.k = 500;
  38943. t.l = 222;
  38944. t.m = 833;
  38945. t.n = 556;
  38946. t.o = 556;
  38947. t.p = 556;
  38948. t.q = 556;
  38949. t.r = 333;
  38950. t.s = 500;
  38951. t.t = 278;
  38952. t.u = 556;
  38953. t.v = 500;
  38954. t.w = 722;
  38955. t.x = 500;
  38956. t.y = 500;
  38957. t.z = 500;
  38958. t.braceleft = 334;
  38959. t.bar = 260;
  38960. t.braceright = 334;
  38961. t.asciitilde = 584;
  38962. t.exclamdown = 333;
  38963. t.cent = 556;
  38964. t.sterling = 556;
  38965. t.fraction = 167;
  38966. t.yen = 556;
  38967. t.florin = 556;
  38968. t.section = 556;
  38969. t.currency = 556;
  38970. t.quotesingle = 191;
  38971. t.quotedblleft = 333;
  38972. t.guillemotleft = 556;
  38973. t.guilsinglleft = 333;
  38974. t.guilsinglright = 333;
  38975. t.fi = 500;
  38976. t.fl = 500;
  38977. t.endash = 556;
  38978. t.dagger = 556;
  38979. t.daggerdbl = 556;
  38980. t.periodcentered = 278;
  38981. t.paragraph = 537;
  38982. t.bullet = 350;
  38983. t.quotesinglbase = 222;
  38984. t.quotedblbase = 333;
  38985. t.quotedblright = 333;
  38986. t.guillemotright = 556;
  38987. t.ellipsis = 1000;
  38988. t.perthousand = 1000;
  38989. t.questiondown = 611;
  38990. t.grave = 333;
  38991. t.acute = 333;
  38992. t.circumflex = 333;
  38993. t.tilde = 333;
  38994. t.macron = 333;
  38995. t.breve = 333;
  38996. t.dotaccent = 333;
  38997. t.dieresis = 333;
  38998. t.ring = 333;
  38999. t.cedilla = 333;
  39000. t.hungarumlaut = 333;
  39001. t.ogonek = 333;
  39002. t.caron = 333;
  39003. t.emdash = 1000;
  39004. t.AE = 1000;
  39005. t.ordfeminine = 370;
  39006. t.Lslash = 556;
  39007. t.Oslash = 778;
  39008. t.OE = 1000;
  39009. t.ordmasculine = 365;
  39010. t.ae = 889;
  39011. t.dotlessi = 278;
  39012. t.lslash = 222;
  39013. t.oslash = 611;
  39014. t.oe = 944;
  39015. t.germandbls = 611;
  39016. t.Idieresis = 278;
  39017. t.eacute = 556;
  39018. t.abreve = 556;
  39019. t.uhungarumlaut = 556;
  39020. t.ecaron = 556;
  39021. t.Ydieresis = 667;
  39022. t.divide = 584;
  39023. t.Yacute = 667;
  39024. t.Acircumflex = 667;
  39025. t.aacute = 556;
  39026. t.Ucircumflex = 722;
  39027. t.yacute = 500;
  39028. t.scommaaccent = 500;
  39029. t.ecircumflex = 556;
  39030. t.Uring = 722;
  39031. t.Udieresis = 722;
  39032. t.aogonek = 556;
  39033. t.Uacute = 722;
  39034. t.uogonek = 556;
  39035. t.Edieresis = 667;
  39036. t.Dcroat = 722;
  39037. t.commaaccent = 250;
  39038. t.copyright = 737;
  39039. t.Emacron = 667;
  39040. t.ccaron = 500;
  39041. t.aring = 556;
  39042. t.Ncommaaccent = 722;
  39043. t.lacute = 222;
  39044. t.agrave = 556;
  39045. t.Tcommaaccent = 611;
  39046. t.Cacute = 722;
  39047. t.atilde = 556;
  39048. t.Edotaccent = 667;
  39049. t.scaron = 500;
  39050. t.scedilla = 500;
  39051. t.iacute = 278;
  39052. t.lozenge = 471;
  39053. t.Rcaron = 722;
  39054. t.Gcommaaccent = 778;
  39055. t.ucircumflex = 556;
  39056. t.acircumflex = 556;
  39057. t.Amacron = 667;
  39058. t.rcaron = 333;
  39059. t.ccedilla = 500;
  39060. t.Zdotaccent = 611;
  39061. t.Thorn = 667;
  39062. t.Omacron = 778;
  39063. t.Racute = 722;
  39064. t.Sacute = 667;
  39065. t.dcaron = 643;
  39066. t.Umacron = 722;
  39067. t.uring = 556;
  39068. t.threesuperior = 333;
  39069. t.Ograve = 778;
  39070. t.Agrave = 667;
  39071. t.Abreve = 667;
  39072. t.multiply = 584;
  39073. t.uacute = 556;
  39074. t.Tcaron = 611;
  39075. t.partialdiff = 476;
  39076. t.ydieresis = 500;
  39077. t.Nacute = 722;
  39078. t.icircumflex = 278;
  39079. t.Ecircumflex = 667;
  39080. t.adieresis = 556;
  39081. t.edieresis = 556;
  39082. t.cacute = 500;
  39083. t.nacute = 556;
  39084. t.umacron = 556;
  39085. t.Ncaron = 722;
  39086. t.Iacute = 278;
  39087. t.plusminus = 584;
  39088. t.brokenbar = 260;
  39089. t.registered = 737;
  39090. t.Gbreve = 778;
  39091. t.Idotaccent = 278;
  39092. t.summation = 600;
  39093. t.Egrave = 667;
  39094. t.racute = 333;
  39095. t.omacron = 556;
  39096. t.Zacute = 611;
  39097. t.Zcaron = 611;
  39098. t.greaterequal = 549;
  39099. t.Eth = 722;
  39100. t.Ccedilla = 722;
  39101. t.lcommaaccent = 222;
  39102. t.tcaron = 317;
  39103. t.eogonek = 556;
  39104. t.Uogonek = 722;
  39105. t.Aacute = 667;
  39106. t.Adieresis = 667;
  39107. t.egrave = 556;
  39108. t.zacute = 500;
  39109. t.iogonek = 222;
  39110. t.Oacute = 778;
  39111. t.oacute = 556;
  39112. t.amacron = 556;
  39113. t.sacute = 500;
  39114. t.idieresis = 278;
  39115. t.Ocircumflex = 778;
  39116. t.Ugrave = 722;
  39117. t.Delta = 612;
  39118. t.thorn = 556;
  39119. t.twosuperior = 333;
  39120. t.Odieresis = 778;
  39121. t.mu = 556;
  39122. t.igrave = 278;
  39123. t.ohungarumlaut = 556;
  39124. t.Eogonek = 667;
  39125. t.dcroat = 556;
  39126. t.threequarters = 834;
  39127. t.Scedilla = 667;
  39128. t.lcaron = 299;
  39129. t.Kcommaaccent = 667;
  39130. t.Lacute = 556;
  39131. t.trademark = 1000;
  39132. t.edotaccent = 556;
  39133. t.Igrave = 278;
  39134. t.Imacron = 278;
  39135. t.Lcaron = 556;
  39136. t.onehalf = 834;
  39137. t.lessequal = 549;
  39138. t.ocircumflex = 556;
  39139. t.ntilde = 556;
  39140. t.Uhungarumlaut = 722;
  39141. t.Eacute = 667;
  39142. t.emacron = 556;
  39143. t.gbreve = 556;
  39144. t.onequarter = 834;
  39145. t.Scaron = 667;
  39146. t.Scommaaccent = 667;
  39147. t.Ohungarumlaut = 778;
  39148. t.degree = 400;
  39149. t.ograve = 556;
  39150. t.Ccaron = 722;
  39151. t.ugrave = 556;
  39152. t.radical = 453;
  39153. t.Dcaron = 722;
  39154. t.rcommaaccent = 333;
  39155. t.Ntilde = 722;
  39156. t.otilde = 556;
  39157. t.Rcommaaccent = 722;
  39158. t.Lcommaaccent = 556;
  39159. t.Atilde = 667;
  39160. t.Aogonek = 667;
  39161. t.Aring = 667;
  39162. t.Otilde = 778;
  39163. t.zdotaccent = 500;
  39164. t.Ecaron = 667;
  39165. t.Iogonek = 278;
  39166. t.kcommaaccent = 500;
  39167. t.minus = 584;
  39168. t.Icircumflex = 278;
  39169. t.ncaron = 556;
  39170. t.tcommaaccent = 278;
  39171. t.logicalnot = 584;
  39172. t.odieresis = 556;
  39173. t.udieresis = 556;
  39174. t.notequal = 549;
  39175. t.gcommaaccent = 556;
  39176. t.eth = 556;
  39177. t.zcaron = 500;
  39178. t.ncommaaccent = 556;
  39179. t.onesuperior = 333;
  39180. t.imacron = 278;
  39181. t.Euro = 556;
  39182. });
  39183. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39184. t.space = 278;
  39185. t.exclam = 333;
  39186. t.quotedbl = 474;
  39187. t.numbersign = 556;
  39188. t.dollar = 556;
  39189. t.percent = 889;
  39190. t.ampersand = 722;
  39191. t.quoteright = 278;
  39192. t.parenleft = 333;
  39193. t.parenright = 333;
  39194. t.asterisk = 389;
  39195. t.plus = 584;
  39196. t.comma = 278;
  39197. t.hyphen = 333;
  39198. t.period = 278;
  39199. t.slash = 278;
  39200. t.zero = 556;
  39201. t.one = 556;
  39202. t.two = 556;
  39203. t.three = 556;
  39204. t.four = 556;
  39205. t.five = 556;
  39206. t.six = 556;
  39207. t.seven = 556;
  39208. t.eight = 556;
  39209. t.nine = 556;
  39210. t.colon = 333;
  39211. t.semicolon = 333;
  39212. t.less = 584;
  39213. t.equal = 584;
  39214. t.greater = 584;
  39215. t.question = 611;
  39216. t.at = 975;
  39217. t.A = 722;
  39218. t.B = 722;
  39219. t.C = 722;
  39220. t.D = 722;
  39221. t.E = 667;
  39222. t.F = 611;
  39223. t.G = 778;
  39224. t.H = 722;
  39225. t.I = 278;
  39226. t.J = 556;
  39227. t.K = 722;
  39228. t.L = 611;
  39229. t.M = 833;
  39230. t.N = 722;
  39231. t.O = 778;
  39232. t.P = 667;
  39233. t.Q = 778;
  39234. t.R = 722;
  39235. t.S = 667;
  39236. t.T = 611;
  39237. t.U = 722;
  39238. t.V = 667;
  39239. t.W = 944;
  39240. t.X = 667;
  39241. t.Y = 667;
  39242. t.Z = 611;
  39243. t.bracketleft = 333;
  39244. t.backslash = 278;
  39245. t.bracketright = 333;
  39246. t.asciicircum = 584;
  39247. t.underscore = 556;
  39248. t.quoteleft = 278;
  39249. t.a = 556;
  39250. t.b = 611;
  39251. t.c = 556;
  39252. t.d = 611;
  39253. t.e = 556;
  39254. t.f = 333;
  39255. t.g = 611;
  39256. t.h = 611;
  39257. t.i = 278;
  39258. t.j = 278;
  39259. t.k = 556;
  39260. t.l = 278;
  39261. t.m = 889;
  39262. t.n = 611;
  39263. t.o = 611;
  39264. t.p = 611;
  39265. t.q = 611;
  39266. t.r = 389;
  39267. t.s = 556;
  39268. t.t = 333;
  39269. t.u = 611;
  39270. t.v = 556;
  39271. t.w = 778;
  39272. t.x = 556;
  39273. t.y = 556;
  39274. t.z = 500;
  39275. t.braceleft = 389;
  39276. t.bar = 280;
  39277. t.braceright = 389;
  39278. t.asciitilde = 584;
  39279. t.exclamdown = 333;
  39280. t.cent = 556;
  39281. t.sterling = 556;
  39282. t.fraction = 167;
  39283. t.yen = 556;
  39284. t.florin = 556;
  39285. t.section = 556;
  39286. t.currency = 556;
  39287. t.quotesingle = 238;
  39288. t.quotedblleft = 500;
  39289. t.guillemotleft = 556;
  39290. t.guilsinglleft = 333;
  39291. t.guilsinglright = 333;
  39292. t.fi = 611;
  39293. t.fl = 611;
  39294. t.endash = 556;
  39295. t.dagger = 556;
  39296. t.daggerdbl = 556;
  39297. t.periodcentered = 278;
  39298. t.paragraph = 556;
  39299. t.bullet = 350;
  39300. t.quotesinglbase = 278;
  39301. t.quotedblbase = 500;
  39302. t.quotedblright = 500;
  39303. t.guillemotright = 556;
  39304. t.ellipsis = 1000;
  39305. t.perthousand = 1000;
  39306. t.questiondown = 611;
  39307. t.grave = 333;
  39308. t.acute = 333;
  39309. t.circumflex = 333;
  39310. t.tilde = 333;
  39311. t.macron = 333;
  39312. t.breve = 333;
  39313. t.dotaccent = 333;
  39314. t.dieresis = 333;
  39315. t.ring = 333;
  39316. t.cedilla = 333;
  39317. t.hungarumlaut = 333;
  39318. t.ogonek = 333;
  39319. t.caron = 333;
  39320. t.emdash = 1000;
  39321. t.AE = 1000;
  39322. t.ordfeminine = 370;
  39323. t.Lslash = 611;
  39324. t.Oslash = 778;
  39325. t.OE = 1000;
  39326. t.ordmasculine = 365;
  39327. t.ae = 889;
  39328. t.dotlessi = 278;
  39329. t.lslash = 278;
  39330. t.oslash = 611;
  39331. t.oe = 944;
  39332. t.germandbls = 611;
  39333. t.Idieresis = 278;
  39334. t.eacute = 556;
  39335. t.abreve = 556;
  39336. t.uhungarumlaut = 611;
  39337. t.ecaron = 556;
  39338. t.Ydieresis = 667;
  39339. t.divide = 584;
  39340. t.Yacute = 667;
  39341. t.Acircumflex = 722;
  39342. t.aacute = 556;
  39343. t.Ucircumflex = 722;
  39344. t.yacute = 556;
  39345. t.scommaaccent = 556;
  39346. t.ecircumflex = 556;
  39347. t.Uring = 722;
  39348. t.Udieresis = 722;
  39349. t.aogonek = 556;
  39350. t.Uacute = 722;
  39351. t.uogonek = 611;
  39352. t.Edieresis = 667;
  39353. t.Dcroat = 722;
  39354. t.commaaccent = 250;
  39355. t.copyright = 737;
  39356. t.Emacron = 667;
  39357. t.ccaron = 556;
  39358. t.aring = 556;
  39359. t.Ncommaaccent = 722;
  39360. t.lacute = 278;
  39361. t.agrave = 556;
  39362. t.Tcommaaccent = 611;
  39363. t.Cacute = 722;
  39364. t.atilde = 556;
  39365. t.Edotaccent = 667;
  39366. t.scaron = 556;
  39367. t.scedilla = 556;
  39368. t.iacute = 278;
  39369. t.lozenge = 494;
  39370. t.Rcaron = 722;
  39371. t.Gcommaaccent = 778;
  39372. t.ucircumflex = 611;
  39373. t.acircumflex = 556;
  39374. t.Amacron = 722;
  39375. t.rcaron = 389;
  39376. t.ccedilla = 556;
  39377. t.Zdotaccent = 611;
  39378. t.Thorn = 667;
  39379. t.Omacron = 778;
  39380. t.Racute = 722;
  39381. t.Sacute = 667;
  39382. t.dcaron = 743;
  39383. t.Umacron = 722;
  39384. t.uring = 611;
  39385. t.threesuperior = 333;
  39386. t.Ograve = 778;
  39387. t.Agrave = 722;
  39388. t.Abreve = 722;
  39389. t.multiply = 584;
  39390. t.uacute = 611;
  39391. t.Tcaron = 611;
  39392. t.partialdiff = 494;
  39393. t.ydieresis = 556;
  39394. t.Nacute = 722;
  39395. t.icircumflex = 278;
  39396. t.Ecircumflex = 667;
  39397. t.adieresis = 556;
  39398. t.edieresis = 556;
  39399. t.cacute = 556;
  39400. t.nacute = 611;
  39401. t.umacron = 611;
  39402. t.Ncaron = 722;
  39403. t.Iacute = 278;
  39404. t.plusminus = 584;
  39405. t.brokenbar = 280;
  39406. t.registered = 737;
  39407. t.Gbreve = 778;
  39408. t.Idotaccent = 278;
  39409. t.summation = 600;
  39410. t.Egrave = 667;
  39411. t.racute = 389;
  39412. t.omacron = 611;
  39413. t.Zacute = 611;
  39414. t.Zcaron = 611;
  39415. t.greaterequal = 549;
  39416. t.Eth = 722;
  39417. t.Ccedilla = 722;
  39418. t.lcommaaccent = 278;
  39419. t.tcaron = 389;
  39420. t.eogonek = 556;
  39421. t.Uogonek = 722;
  39422. t.Aacute = 722;
  39423. t.Adieresis = 722;
  39424. t.egrave = 556;
  39425. t.zacute = 500;
  39426. t.iogonek = 278;
  39427. t.Oacute = 778;
  39428. t.oacute = 611;
  39429. t.amacron = 556;
  39430. t.sacute = 556;
  39431. t.idieresis = 278;
  39432. t.Ocircumflex = 778;
  39433. t.Ugrave = 722;
  39434. t.Delta = 612;
  39435. t.thorn = 611;
  39436. t.twosuperior = 333;
  39437. t.Odieresis = 778;
  39438. t.mu = 611;
  39439. t.igrave = 278;
  39440. t.ohungarumlaut = 611;
  39441. t.Eogonek = 667;
  39442. t.dcroat = 611;
  39443. t.threequarters = 834;
  39444. t.Scedilla = 667;
  39445. t.lcaron = 400;
  39446. t.Kcommaaccent = 722;
  39447. t.Lacute = 611;
  39448. t.trademark = 1000;
  39449. t.edotaccent = 556;
  39450. t.Igrave = 278;
  39451. t.Imacron = 278;
  39452. t.Lcaron = 611;
  39453. t.onehalf = 834;
  39454. t.lessequal = 549;
  39455. t.ocircumflex = 611;
  39456. t.ntilde = 611;
  39457. t.Uhungarumlaut = 722;
  39458. t.Eacute = 667;
  39459. t.emacron = 556;
  39460. t.gbreve = 611;
  39461. t.onequarter = 834;
  39462. t.Scaron = 667;
  39463. t.Scommaaccent = 667;
  39464. t.Ohungarumlaut = 778;
  39465. t.degree = 400;
  39466. t.ograve = 611;
  39467. t.Ccaron = 722;
  39468. t.ugrave = 611;
  39469. t.radical = 549;
  39470. t.Dcaron = 722;
  39471. t.rcommaaccent = 389;
  39472. t.Ntilde = 722;
  39473. t.otilde = 611;
  39474. t.Rcommaaccent = 722;
  39475. t.Lcommaaccent = 611;
  39476. t.Atilde = 722;
  39477. t.Aogonek = 722;
  39478. t.Aring = 722;
  39479. t.Otilde = 778;
  39480. t.zdotaccent = 500;
  39481. t.Ecaron = 667;
  39482. t.Iogonek = 278;
  39483. t.kcommaaccent = 556;
  39484. t.minus = 584;
  39485. t.Icircumflex = 278;
  39486. t.ncaron = 611;
  39487. t.tcommaaccent = 333;
  39488. t.logicalnot = 584;
  39489. t.odieresis = 611;
  39490. t.udieresis = 611;
  39491. t.notequal = 549;
  39492. t.gcommaaccent = 611;
  39493. t.eth = 611;
  39494. t.zcaron = 500;
  39495. t.ncommaaccent = 611;
  39496. t.onesuperior = 333;
  39497. t.imacron = 278;
  39498. t.Euro = 556;
  39499. });
  39500. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39501. t.space = 278;
  39502. t.exclam = 333;
  39503. t.quotedbl = 474;
  39504. t.numbersign = 556;
  39505. t.dollar = 556;
  39506. t.percent = 889;
  39507. t.ampersand = 722;
  39508. t.quoteright = 278;
  39509. t.parenleft = 333;
  39510. t.parenright = 333;
  39511. t.asterisk = 389;
  39512. t.plus = 584;
  39513. t.comma = 278;
  39514. t.hyphen = 333;
  39515. t.period = 278;
  39516. t.slash = 278;
  39517. t.zero = 556;
  39518. t.one = 556;
  39519. t.two = 556;
  39520. t.three = 556;
  39521. t.four = 556;
  39522. t.five = 556;
  39523. t.six = 556;
  39524. t.seven = 556;
  39525. t.eight = 556;
  39526. t.nine = 556;
  39527. t.colon = 333;
  39528. t.semicolon = 333;
  39529. t.less = 584;
  39530. t.equal = 584;
  39531. t.greater = 584;
  39532. t.question = 611;
  39533. t.at = 975;
  39534. t.A = 722;
  39535. t.B = 722;
  39536. t.C = 722;
  39537. t.D = 722;
  39538. t.E = 667;
  39539. t.F = 611;
  39540. t.G = 778;
  39541. t.H = 722;
  39542. t.I = 278;
  39543. t.J = 556;
  39544. t.K = 722;
  39545. t.L = 611;
  39546. t.M = 833;
  39547. t.N = 722;
  39548. t.O = 778;
  39549. t.P = 667;
  39550. t.Q = 778;
  39551. t.R = 722;
  39552. t.S = 667;
  39553. t.T = 611;
  39554. t.U = 722;
  39555. t.V = 667;
  39556. t.W = 944;
  39557. t.X = 667;
  39558. t.Y = 667;
  39559. t.Z = 611;
  39560. t.bracketleft = 333;
  39561. t.backslash = 278;
  39562. t.bracketright = 333;
  39563. t.asciicircum = 584;
  39564. t.underscore = 556;
  39565. t.quoteleft = 278;
  39566. t.a = 556;
  39567. t.b = 611;
  39568. t.c = 556;
  39569. t.d = 611;
  39570. t.e = 556;
  39571. t.f = 333;
  39572. t.g = 611;
  39573. t.h = 611;
  39574. t.i = 278;
  39575. t.j = 278;
  39576. t.k = 556;
  39577. t.l = 278;
  39578. t.m = 889;
  39579. t.n = 611;
  39580. t.o = 611;
  39581. t.p = 611;
  39582. t.q = 611;
  39583. t.r = 389;
  39584. t.s = 556;
  39585. t.t = 333;
  39586. t.u = 611;
  39587. t.v = 556;
  39588. t.w = 778;
  39589. t.x = 556;
  39590. t.y = 556;
  39591. t.z = 500;
  39592. t.braceleft = 389;
  39593. t.bar = 280;
  39594. t.braceright = 389;
  39595. t.asciitilde = 584;
  39596. t.exclamdown = 333;
  39597. t.cent = 556;
  39598. t.sterling = 556;
  39599. t.fraction = 167;
  39600. t.yen = 556;
  39601. t.florin = 556;
  39602. t.section = 556;
  39603. t.currency = 556;
  39604. t.quotesingle = 238;
  39605. t.quotedblleft = 500;
  39606. t.guillemotleft = 556;
  39607. t.guilsinglleft = 333;
  39608. t.guilsinglright = 333;
  39609. t.fi = 611;
  39610. t.fl = 611;
  39611. t.endash = 556;
  39612. t.dagger = 556;
  39613. t.daggerdbl = 556;
  39614. t.periodcentered = 278;
  39615. t.paragraph = 556;
  39616. t.bullet = 350;
  39617. t.quotesinglbase = 278;
  39618. t.quotedblbase = 500;
  39619. t.quotedblright = 500;
  39620. t.guillemotright = 556;
  39621. t.ellipsis = 1000;
  39622. t.perthousand = 1000;
  39623. t.questiondown = 611;
  39624. t.grave = 333;
  39625. t.acute = 333;
  39626. t.circumflex = 333;
  39627. t.tilde = 333;
  39628. t.macron = 333;
  39629. t.breve = 333;
  39630. t.dotaccent = 333;
  39631. t.dieresis = 333;
  39632. t.ring = 333;
  39633. t.cedilla = 333;
  39634. t.hungarumlaut = 333;
  39635. t.ogonek = 333;
  39636. t.caron = 333;
  39637. t.emdash = 1000;
  39638. t.AE = 1000;
  39639. t.ordfeminine = 370;
  39640. t.Lslash = 611;
  39641. t.Oslash = 778;
  39642. t.OE = 1000;
  39643. t.ordmasculine = 365;
  39644. t.ae = 889;
  39645. t.dotlessi = 278;
  39646. t.lslash = 278;
  39647. t.oslash = 611;
  39648. t.oe = 944;
  39649. t.germandbls = 611;
  39650. t.Idieresis = 278;
  39651. t.eacute = 556;
  39652. t.abreve = 556;
  39653. t.uhungarumlaut = 611;
  39654. t.ecaron = 556;
  39655. t.Ydieresis = 667;
  39656. t.divide = 584;
  39657. t.Yacute = 667;
  39658. t.Acircumflex = 722;
  39659. t.aacute = 556;
  39660. t.Ucircumflex = 722;
  39661. t.yacute = 556;
  39662. t.scommaaccent = 556;
  39663. t.ecircumflex = 556;
  39664. t.Uring = 722;
  39665. t.Udieresis = 722;
  39666. t.aogonek = 556;
  39667. t.Uacute = 722;
  39668. t.uogonek = 611;
  39669. t.Edieresis = 667;
  39670. t.Dcroat = 722;
  39671. t.commaaccent = 250;
  39672. t.copyright = 737;
  39673. t.Emacron = 667;
  39674. t.ccaron = 556;
  39675. t.aring = 556;
  39676. t.Ncommaaccent = 722;
  39677. t.lacute = 278;
  39678. t.agrave = 556;
  39679. t.Tcommaaccent = 611;
  39680. t.Cacute = 722;
  39681. t.atilde = 556;
  39682. t.Edotaccent = 667;
  39683. t.scaron = 556;
  39684. t.scedilla = 556;
  39685. t.iacute = 278;
  39686. t.lozenge = 494;
  39687. t.Rcaron = 722;
  39688. t.Gcommaaccent = 778;
  39689. t.ucircumflex = 611;
  39690. t.acircumflex = 556;
  39691. t.Amacron = 722;
  39692. t.rcaron = 389;
  39693. t.ccedilla = 556;
  39694. t.Zdotaccent = 611;
  39695. t.Thorn = 667;
  39696. t.Omacron = 778;
  39697. t.Racute = 722;
  39698. t.Sacute = 667;
  39699. t.dcaron = 743;
  39700. t.Umacron = 722;
  39701. t.uring = 611;
  39702. t.threesuperior = 333;
  39703. t.Ograve = 778;
  39704. t.Agrave = 722;
  39705. t.Abreve = 722;
  39706. t.multiply = 584;
  39707. t.uacute = 611;
  39708. t.Tcaron = 611;
  39709. t.partialdiff = 494;
  39710. t.ydieresis = 556;
  39711. t.Nacute = 722;
  39712. t.icircumflex = 278;
  39713. t.Ecircumflex = 667;
  39714. t.adieresis = 556;
  39715. t.edieresis = 556;
  39716. t.cacute = 556;
  39717. t.nacute = 611;
  39718. t.umacron = 611;
  39719. t.Ncaron = 722;
  39720. t.Iacute = 278;
  39721. t.plusminus = 584;
  39722. t.brokenbar = 280;
  39723. t.registered = 737;
  39724. t.Gbreve = 778;
  39725. t.Idotaccent = 278;
  39726. t.summation = 600;
  39727. t.Egrave = 667;
  39728. t.racute = 389;
  39729. t.omacron = 611;
  39730. t.Zacute = 611;
  39731. t.Zcaron = 611;
  39732. t.greaterequal = 549;
  39733. t.Eth = 722;
  39734. t.Ccedilla = 722;
  39735. t.lcommaaccent = 278;
  39736. t.tcaron = 389;
  39737. t.eogonek = 556;
  39738. t.Uogonek = 722;
  39739. t.Aacute = 722;
  39740. t.Adieresis = 722;
  39741. t.egrave = 556;
  39742. t.zacute = 500;
  39743. t.iogonek = 278;
  39744. t.Oacute = 778;
  39745. t.oacute = 611;
  39746. t.amacron = 556;
  39747. t.sacute = 556;
  39748. t.idieresis = 278;
  39749. t.Ocircumflex = 778;
  39750. t.Ugrave = 722;
  39751. t.Delta = 612;
  39752. t.thorn = 611;
  39753. t.twosuperior = 333;
  39754. t.Odieresis = 778;
  39755. t.mu = 611;
  39756. t.igrave = 278;
  39757. t.ohungarumlaut = 611;
  39758. t.Eogonek = 667;
  39759. t.dcroat = 611;
  39760. t.threequarters = 834;
  39761. t.Scedilla = 667;
  39762. t.lcaron = 400;
  39763. t.Kcommaaccent = 722;
  39764. t.Lacute = 611;
  39765. t.trademark = 1000;
  39766. t.edotaccent = 556;
  39767. t.Igrave = 278;
  39768. t.Imacron = 278;
  39769. t.Lcaron = 611;
  39770. t.onehalf = 834;
  39771. t.lessequal = 549;
  39772. t.ocircumflex = 611;
  39773. t.ntilde = 611;
  39774. t.Uhungarumlaut = 722;
  39775. t.Eacute = 667;
  39776. t.emacron = 556;
  39777. t.gbreve = 611;
  39778. t.onequarter = 834;
  39779. t.Scaron = 667;
  39780. t.Scommaaccent = 667;
  39781. t.Ohungarumlaut = 778;
  39782. t.degree = 400;
  39783. t.ograve = 611;
  39784. t.Ccaron = 722;
  39785. t.ugrave = 611;
  39786. t.radical = 549;
  39787. t.Dcaron = 722;
  39788. t.rcommaaccent = 389;
  39789. t.Ntilde = 722;
  39790. t.otilde = 611;
  39791. t.Rcommaaccent = 722;
  39792. t.Lcommaaccent = 611;
  39793. t.Atilde = 722;
  39794. t.Aogonek = 722;
  39795. t.Aring = 722;
  39796. t.Otilde = 778;
  39797. t.zdotaccent = 500;
  39798. t.Ecaron = 667;
  39799. t.Iogonek = 278;
  39800. t.kcommaaccent = 556;
  39801. t.minus = 584;
  39802. t.Icircumflex = 278;
  39803. t.ncaron = 611;
  39804. t.tcommaaccent = 333;
  39805. t.logicalnot = 584;
  39806. t.odieresis = 611;
  39807. t.udieresis = 611;
  39808. t.notequal = 549;
  39809. t.gcommaaccent = 611;
  39810. t.eth = 611;
  39811. t.zcaron = 500;
  39812. t.ncommaaccent = 611;
  39813. t.onesuperior = 333;
  39814. t.imacron = 278;
  39815. t.Euro = 556;
  39816. });
  39817. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39818. t.space = 278;
  39819. t.exclam = 278;
  39820. t.quotedbl = 355;
  39821. t.numbersign = 556;
  39822. t.dollar = 556;
  39823. t.percent = 889;
  39824. t.ampersand = 667;
  39825. t.quoteright = 222;
  39826. t.parenleft = 333;
  39827. t.parenright = 333;
  39828. t.asterisk = 389;
  39829. t.plus = 584;
  39830. t.comma = 278;
  39831. t.hyphen = 333;
  39832. t.period = 278;
  39833. t.slash = 278;
  39834. t.zero = 556;
  39835. t.one = 556;
  39836. t.two = 556;
  39837. t.three = 556;
  39838. t.four = 556;
  39839. t.five = 556;
  39840. t.six = 556;
  39841. t.seven = 556;
  39842. t.eight = 556;
  39843. t.nine = 556;
  39844. t.colon = 278;
  39845. t.semicolon = 278;
  39846. t.less = 584;
  39847. t.equal = 584;
  39848. t.greater = 584;
  39849. t.question = 556;
  39850. t.at = 1015;
  39851. t.A = 667;
  39852. t.B = 667;
  39853. t.C = 722;
  39854. t.D = 722;
  39855. t.E = 667;
  39856. t.F = 611;
  39857. t.G = 778;
  39858. t.H = 722;
  39859. t.I = 278;
  39860. t.J = 500;
  39861. t.K = 667;
  39862. t.L = 556;
  39863. t.M = 833;
  39864. t.N = 722;
  39865. t.O = 778;
  39866. t.P = 667;
  39867. t.Q = 778;
  39868. t.R = 722;
  39869. t.S = 667;
  39870. t.T = 611;
  39871. t.U = 722;
  39872. t.V = 667;
  39873. t.W = 944;
  39874. t.X = 667;
  39875. t.Y = 667;
  39876. t.Z = 611;
  39877. t.bracketleft = 278;
  39878. t.backslash = 278;
  39879. t.bracketright = 278;
  39880. t.asciicircum = 469;
  39881. t.underscore = 556;
  39882. t.quoteleft = 222;
  39883. t.a = 556;
  39884. t.b = 556;
  39885. t.c = 500;
  39886. t.d = 556;
  39887. t.e = 556;
  39888. t.f = 278;
  39889. t.g = 556;
  39890. t.h = 556;
  39891. t.i = 222;
  39892. t.j = 222;
  39893. t.k = 500;
  39894. t.l = 222;
  39895. t.m = 833;
  39896. t.n = 556;
  39897. t.o = 556;
  39898. t.p = 556;
  39899. t.q = 556;
  39900. t.r = 333;
  39901. t.s = 500;
  39902. t.t = 278;
  39903. t.u = 556;
  39904. t.v = 500;
  39905. t.w = 722;
  39906. t.x = 500;
  39907. t.y = 500;
  39908. t.z = 500;
  39909. t.braceleft = 334;
  39910. t.bar = 260;
  39911. t.braceright = 334;
  39912. t.asciitilde = 584;
  39913. t.exclamdown = 333;
  39914. t.cent = 556;
  39915. t.sterling = 556;
  39916. t.fraction = 167;
  39917. t.yen = 556;
  39918. t.florin = 556;
  39919. t.section = 556;
  39920. t.currency = 556;
  39921. t.quotesingle = 191;
  39922. t.quotedblleft = 333;
  39923. t.guillemotleft = 556;
  39924. t.guilsinglleft = 333;
  39925. t.guilsinglright = 333;
  39926. t.fi = 500;
  39927. t.fl = 500;
  39928. t.endash = 556;
  39929. t.dagger = 556;
  39930. t.daggerdbl = 556;
  39931. t.periodcentered = 278;
  39932. t.paragraph = 537;
  39933. t.bullet = 350;
  39934. t.quotesinglbase = 222;
  39935. t.quotedblbase = 333;
  39936. t.quotedblright = 333;
  39937. t.guillemotright = 556;
  39938. t.ellipsis = 1000;
  39939. t.perthousand = 1000;
  39940. t.questiondown = 611;
  39941. t.grave = 333;
  39942. t.acute = 333;
  39943. t.circumflex = 333;
  39944. t.tilde = 333;
  39945. t.macron = 333;
  39946. t.breve = 333;
  39947. t.dotaccent = 333;
  39948. t.dieresis = 333;
  39949. t.ring = 333;
  39950. t.cedilla = 333;
  39951. t.hungarumlaut = 333;
  39952. t.ogonek = 333;
  39953. t.caron = 333;
  39954. t.emdash = 1000;
  39955. t.AE = 1000;
  39956. t.ordfeminine = 370;
  39957. t.Lslash = 556;
  39958. t.Oslash = 778;
  39959. t.OE = 1000;
  39960. t.ordmasculine = 365;
  39961. t.ae = 889;
  39962. t.dotlessi = 278;
  39963. t.lslash = 222;
  39964. t.oslash = 611;
  39965. t.oe = 944;
  39966. t.germandbls = 611;
  39967. t.Idieresis = 278;
  39968. t.eacute = 556;
  39969. t.abreve = 556;
  39970. t.uhungarumlaut = 556;
  39971. t.ecaron = 556;
  39972. t.Ydieresis = 667;
  39973. t.divide = 584;
  39974. t.Yacute = 667;
  39975. t.Acircumflex = 667;
  39976. t.aacute = 556;
  39977. t.Ucircumflex = 722;
  39978. t.yacute = 500;
  39979. t.scommaaccent = 500;
  39980. t.ecircumflex = 556;
  39981. t.Uring = 722;
  39982. t.Udieresis = 722;
  39983. t.aogonek = 556;
  39984. t.Uacute = 722;
  39985. t.uogonek = 556;
  39986. t.Edieresis = 667;
  39987. t.Dcroat = 722;
  39988. t.commaaccent = 250;
  39989. t.copyright = 737;
  39990. t.Emacron = 667;
  39991. t.ccaron = 500;
  39992. t.aring = 556;
  39993. t.Ncommaaccent = 722;
  39994. t.lacute = 222;
  39995. t.agrave = 556;
  39996. t.Tcommaaccent = 611;
  39997. t.Cacute = 722;
  39998. t.atilde = 556;
  39999. t.Edotaccent = 667;
  40000. t.scaron = 500;
  40001. t.scedilla = 500;
  40002. t.iacute = 278;
  40003. t.lozenge = 471;
  40004. t.Rcaron = 722;
  40005. t.Gcommaaccent = 778;
  40006. t.ucircumflex = 556;
  40007. t.acircumflex = 556;
  40008. t.Amacron = 667;
  40009. t.rcaron = 333;
  40010. t.ccedilla = 500;
  40011. t.Zdotaccent = 611;
  40012. t.Thorn = 667;
  40013. t.Omacron = 778;
  40014. t.Racute = 722;
  40015. t.Sacute = 667;
  40016. t.dcaron = 643;
  40017. t.Umacron = 722;
  40018. t.uring = 556;
  40019. t.threesuperior = 333;
  40020. t.Ograve = 778;
  40021. t.Agrave = 667;
  40022. t.Abreve = 667;
  40023. t.multiply = 584;
  40024. t.uacute = 556;
  40025. t.Tcaron = 611;
  40026. t.partialdiff = 476;
  40027. t.ydieresis = 500;
  40028. t.Nacute = 722;
  40029. t.icircumflex = 278;
  40030. t.Ecircumflex = 667;
  40031. t.adieresis = 556;
  40032. t.edieresis = 556;
  40033. t.cacute = 500;
  40034. t.nacute = 556;
  40035. t.umacron = 556;
  40036. t.Ncaron = 722;
  40037. t.Iacute = 278;
  40038. t.plusminus = 584;
  40039. t.brokenbar = 260;
  40040. t.registered = 737;
  40041. t.Gbreve = 778;
  40042. t.Idotaccent = 278;
  40043. t.summation = 600;
  40044. t.Egrave = 667;
  40045. t.racute = 333;
  40046. t.omacron = 556;
  40047. t.Zacute = 611;
  40048. t.Zcaron = 611;
  40049. t.greaterequal = 549;
  40050. t.Eth = 722;
  40051. t.Ccedilla = 722;
  40052. t.lcommaaccent = 222;
  40053. t.tcaron = 317;
  40054. t.eogonek = 556;
  40055. t.Uogonek = 722;
  40056. t.Aacute = 667;
  40057. t.Adieresis = 667;
  40058. t.egrave = 556;
  40059. t.zacute = 500;
  40060. t.iogonek = 222;
  40061. t.Oacute = 778;
  40062. t.oacute = 556;
  40063. t.amacron = 556;
  40064. t.sacute = 500;
  40065. t.idieresis = 278;
  40066. t.Ocircumflex = 778;
  40067. t.Ugrave = 722;
  40068. t.Delta = 612;
  40069. t.thorn = 556;
  40070. t.twosuperior = 333;
  40071. t.Odieresis = 778;
  40072. t.mu = 556;
  40073. t.igrave = 278;
  40074. t.ohungarumlaut = 556;
  40075. t.Eogonek = 667;
  40076. t.dcroat = 556;
  40077. t.threequarters = 834;
  40078. t.Scedilla = 667;
  40079. t.lcaron = 299;
  40080. t.Kcommaaccent = 667;
  40081. t.Lacute = 556;
  40082. t.trademark = 1000;
  40083. t.edotaccent = 556;
  40084. t.Igrave = 278;
  40085. t.Imacron = 278;
  40086. t.Lcaron = 556;
  40087. t.onehalf = 834;
  40088. t.lessequal = 549;
  40089. t.ocircumflex = 556;
  40090. t.ntilde = 556;
  40091. t.Uhungarumlaut = 722;
  40092. t.Eacute = 667;
  40093. t.emacron = 556;
  40094. t.gbreve = 556;
  40095. t.onequarter = 834;
  40096. t.Scaron = 667;
  40097. t.Scommaaccent = 667;
  40098. t.Ohungarumlaut = 778;
  40099. t.degree = 400;
  40100. t.ograve = 556;
  40101. t.Ccaron = 722;
  40102. t.ugrave = 556;
  40103. t.radical = 453;
  40104. t.Dcaron = 722;
  40105. t.rcommaaccent = 333;
  40106. t.Ntilde = 722;
  40107. t.otilde = 556;
  40108. t.Rcommaaccent = 722;
  40109. t.Lcommaaccent = 556;
  40110. t.Atilde = 667;
  40111. t.Aogonek = 667;
  40112. t.Aring = 667;
  40113. t.Otilde = 778;
  40114. t.zdotaccent = 500;
  40115. t.Ecaron = 667;
  40116. t.Iogonek = 278;
  40117. t.kcommaaccent = 500;
  40118. t.minus = 584;
  40119. t.Icircumflex = 278;
  40120. t.ncaron = 556;
  40121. t.tcommaaccent = 278;
  40122. t.logicalnot = 584;
  40123. t.odieresis = 556;
  40124. t.udieresis = 556;
  40125. t.notequal = 549;
  40126. t.gcommaaccent = 556;
  40127. t.eth = 556;
  40128. t.zcaron = 500;
  40129. t.ncommaaccent = 556;
  40130. t.onesuperior = 333;
  40131. t.imacron = 278;
  40132. t.Euro = 556;
  40133. });
  40134. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  40135. t.space = 250;
  40136. t.exclam = 333;
  40137. t.universal = 713;
  40138. t.numbersign = 500;
  40139. t.existential = 549;
  40140. t.percent = 833;
  40141. t.ampersand = 778;
  40142. t.suchthat = 439;
  40143. t.parenleft = 333;
  40144. t.parenright = 333;
  40145. t.asteriskmath = 500;
  40146. t.plus = 549;
  40147. t.comma = 250;
  40148. t.minus = 549;
  40149. t.period = 250;
  40150. t.slash = 278;
  40151. t.zero = 500;
  40152. t.one = 500;
  40153. t.two = 500;
  40154. t.three = 500;
  40155. t.four = 500;
  40156. t.five = 500;
  40157. t.six = 500;
  40158. t.seven = 500;
  40159. t.eight = 500;
  40160. t.nine = 500;
  40161. t.colon = 278;
  40162. t.semicolon = 278;
  40163. t.less = 549;
  40164. t.equal = 549;
  40165. t.greater = 549;
  40166. t.question = 444;
  40167. t.congruent = 549;
  40168. t.Alpha = 722;
  40169. t.Beta = 667;
  40170. t.Chi = 722;
  40171. t.Delta = 612;
  40172. t.Epsilon = 611;
  40173. t.Phi = 763;
  40174. t.Gamma = 603;
  40175. t.Eta = 722;
  40176. t.Iota = 333;
  40177. t.theta1 = 631;
  40178. t.Kappa = 722;
  40179. t.Lambda = 686;
  40180. t.Mu = 889;
  40181. t.Nu = 722;
  40182. t.Omicron = 722;
  40183. t.Pi = 768;
  40184. t.Theta = 741;
  40185. t.Rho = 556;
  40186. t.Sigma = 592;
  40187. t.Tau = 611;
  40188. t.Upsilon = 690;
  40189. t.sigma1 = 439;
  40190. t.Omega = 768;
  40191. t.Xi = 645;
  40192. t.Psi = 795;
  40193. t.Zeta = 611;
  40194. t.bracketleft = 333;
  40195. t.therefore = 863;
  40196. t.bracketright = 333;
  40197. t.perpendicular = 658;
  40198. t.underscore = 500;
  40199. t.radicalex = 500;
  40200. t.alpha = 631;
  40201. t.beta = 549;
  40202. t.chi = 549;
  40203. t.delta = 494;
  40204. t.epsilon = 439;
  40205. t.phi = 521;
  40206. t.gamma = 411;
  40207. t.eta = 603;
  40208. t.iota = 329;
  40209. t.phi1 = 603;
  40210. t.kappa = 549;
  40211. t.lambda = 549;
  40212. t.mu = 576;
  40213. t.nu = 521;
  40214. t.omicron = 549;
  40215. t.pi = 549;
  40216. t.theta = 521;
  40217. t.rho = 549;
  40218. t.sigma = 603;
  40219. t.tau = 439;
  40220. t.upsilon = 576;
  40221. t.omega1 = 713;
  40222. t.omega = 686;
  40223. t.xi = 493;
  40224. t.psi = 686;
  40225. t.zeta = 494;
  40226. t.braceleft = 480;
  40227. t.bar = 200;
  40228. t.braceright = 480;
  40229. t.similar = 549;
  40230. t.Euro = 750;
  40231. t.Upsilon1 = 620;
  40232. t.minute = 247;
  40233. t.lessequal = 549;
  40234. t.fraction = 167;
  40235. t.infinity = 713;
  40236. t.florin = 500;
  40237. t.club = 753;
  40238. t.diamond = 753;
  40239. t.heart = 753;
  40240. t.spade = 753;
  40241. t.arrowboth = 1042;
  40242. t.arrowleft = 987;
  40243. t.arrowup = 603;
  40244. t.arrowright = 987;
  40245. t.arrowdown = 603;
  40246. t.degree = 400;
  40247. t.plusminus = 549;
  40248. t.second = 411;
  40249. t.greaterequal = 549;
  40250. t.multiply = 549;
  40251. t.proportional = 713;
  40252. t.partialdiff = 494;
  40253. t.bullet = 460;
  40254. t.divide = 549;
  40255. t.notequal = 549;
  40256. t.equivalence = 549;
  40257. t.approxequal = 549;
  40258. t.ellipsis = 1000;
  40259. t.arrowvertex = 603;
  40260. t.arrowhorizex = 1000;
  40261. t.carriagereturn = 658;
  40262. t.aleph = 823;
  40263. t.Ifraktur = 686;
  40264. t.Rfraktur = 795;
  40265. t.weierstrass = 987;
  40266. t.circlemultiply = 768;
  40267. t.circleplus = 768;
  40268. t.emptyset = 823;
  40269. t.intersection = 768;
  40270. t.union = 768;
  40271. t.propersuperset = 713;
  40272. t.reflexsuperset = 713;
  40273. t.notsubset = 713;
  40274. t.propersubset = 713;
  40275. t.reflexsubset = 713;
  40276. t.element = 713;
  40277. t.notelement = 713;
  40278. t.angle = 768;
  40279. t.gradient = 713;
  40280. t.registerserif = 790;
  40281. t.copyrightserif = 790;
  40282. t.trademarkserif = 890;
  40283. t.product = 823;
  40284. t.radical = 549;
  40285. t.dotmath = 250;
  40286. t.logicalnot = 713;
  40287. t.logicaland = 603;
  40288. t.logicalor = 603;
  40289. t.arrowdblboth = 1042;
  40290. t.arrowdblleft = 987;
  40291. t.arrowdblup = 603;
  40292. t.arrowdblright = 987;
  40293. t.arrowdbldown = 603;
  40294. t.lozenge = 494;
  40295. t.angleleft = 329;
  40296. t.registersans = 790;
  40297. t.copyrightsans = 790;
  40298. t.trademarksans = 786;
  40299. t.summation = 713;
  40300. t.parenlefttp = 384;
  40301. t.parenleftex = 384;
  40302. t.parenleftbt = 384;
  40303. t.bracketlefttp = 384;
  40304. t.bracketleftex = 384;
  40305. t.bracketleftbt = 384;
  40306. t.bracelefttp = 494;
  40307. t.braceleftmid = 494;
  40308. t.braceleftbt = 494;
  40309. t.braceex = 494;
  40310. t.angleright = 329;
  40311. t.integral = 274;
  40312. t.integraltp = 686;
  40313. t.integralex = 686;
  40314. t.integralbt = 686;
  40315. t.parenrighttp = 384;
  40316. t.parenrightex = 384;
  40317. t.parenrightbt = 384;
  40318. t.bracketrighttp = 384;
  40319. t.bracketrightex = 384;
  40320. t.bracketrightbt = 384;
  40321. t.bracerighttp = 494;
  40322. t.bracerightmid = 494;
  40323. t.bracerightbt = 494;
  40324. t.apple = 790;
  40325. });
  40326. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40327. t.space = 250;
  40328. t.exclam = 333;
  40329. t.quotedbl = 408;
  40330. t.numbersign = 500;
  40331. t.dollar = 500;
  40332. t.percent = 833;
  40333. t.ampersand = 778;
  40334. t.quoteright = 333;
  40335. t.parenleft = 333;
  40336. t.parenright = 333;
  40337. t.asterisk = 500;
  40338. t.plus = 564;
  40339. t.comma = 250;
  40340. t.hyphen = 333;
  40341. t.period = 250;
  40342. t.slash = 278;
  40343. t.zero = 500;
  40344. t.one = 500;
  40345. t.two = 500;
  40346. t.three = 500;
  40347. t.four = 500;
  40348. t.five = 500;
  40349. t.six = 500;
  40350. t.seven = 500;
  40351. t.eight = 500;
  40352. t.nine = 500;
  40353. t.colon = 278;
  40354. t.semicolon = 278;
  40355. t.less = 564;
  40356. t.equal = 564;
  40357. t.greater = 564;
  40358. t.question = 444;
  40359. t.at = 921;
  40360. t.A = 722;
  40361. t.B = 667;
  40362. t.C = 667;
  40363. t.D = 722;
  40364. t.E = 611;
  40365. t.F = 556;
  40366. t.G = 722;
  40367. t.H = 722;
  40368. t.I = 333;
  40369. t.J = 389;
  40370. t.K = 722;
  40371. t.L = 611;
  40372. t.M = 889;
  40373. t.N = 722;
  40374. t.O = 722;
  40375. t.P = 556;
  40376. t.Q = 722;
  40377. t.R = 667;
  40378. t.S = 556;
  40379. t.T = 611;
  40380. t.U = 722;
  40381. t.V = 722;
  40382. t.W = 944;
  40383. t.X = 722;
  40384. t.Y = 722;
  40385. t.Z = 611;
  40386. t.bracketleft = 333;
  40387. t.backslash = 278;
  40388. t.bracketright = 333;
  40389. t.asciicircum = 469;
  40390. t.underscore = 500;
  40391. t.quoteleft = 333;
  40392. t.a = 444;
  40393. t.b = 500;
  40394. t.c = 444;
  40395. t.d = 500;
  40396. t.e = 444;
  40397. t.f = 333;
  40398. t.g = 500;
  40399. t.h = 500;
  40400. t.i = 278;
  40401. t.j = 278;
  40402. t.k = 500;
  40403. t.l = 278;
  40404. t.m = 778;
  40405. t.n = 500;
  40406. t.o = 500;
  40407. t.p = 500;
  40408. t.q = 500;
  40409. t.r = 333;
  40410. t.s = 389;
  40411. t.t = 278;
  40412. t.u = 500;
  40413. t.v = 500;
  40414. t.w = 722;
  40415. t.x = 500;
  40416. t.y = 500;
  40417. t.z = 444;
  40418. t.braceleft = 480;
  40419. t.bar = 200;
  40420. t.braceright = 480;
  40421. t.asciitilde = 541;
  40422. t.exclamdown = 333;
  40423. t.cent = 500;
  40424. t.sterling = 500;
  40425. t.fraction = 167;
  40426. t.yen = 500;
  40427. t.florin = 500;
  40428. t.section = 500;
  40429. t.currency = 500;
  40430. t.quotesingle = 180;
  40431. t.quotedblleft = 444;
  40432. t.guillemotleft = 500;
  40433. t.guilsinglleft = 333;
  40434. t.guilsinglright = 333;
  40435. t.fi = 556;
  40436. t.fl = 556;
  40437. t.endash = 500;
  40438. t.dagger = 500;
  40439. t.daggerdbl = 500;
  40440. t.periodcentered = 250;
  40441. t.paragraph = 453;
  40442. t.bullet = 350;
  40443. t.quotesinglbase = 333;
  40444. t.quotedblbase = 444;
  40445. t.quotedblright = 444;
  40446. t.guillemotright = 500;
  40447. t.ellipsis = 1000;
  40448. t.perthousand = 1000;
  40449. t.questiondown = 444;
  40450. t.grave = 333;
  40451. t.acute = 333;
  40452. t.circumflex = 333;
  40453. t.tilde = 333;
  40454. t.macron = 333;
  40455. t.breve = 333;
  40456. t.dotaccent = 333;
  40457. t.dieresis = 333;
  40458. t.ring = 333;
  40459. t.cedilla = 333;
  40460. t.hungarumlaut = 333;
  40461. t.ogonek = 333;
  40462. t.caron = 333;
  40463. t.emdash = 1000;
  40464. t.AE = 889;
  40465. t.ordfeminine = 276;
  40466. t.Lslash = 611;
  40467. t.Oslash = 722;
  40468. t.OE = 889;
  40469. t.ordmasculine = 310;
  40470. t.ae = 667;
  40471. t.dotlessi = 278;
  40472. t.lslash = 278;
  40473. t.oslash = 500;
  40474. t.oe = 722;
  40475. t.germandbls = 500;
  40476. t.Idieresis = 333;
  40477. t.eacute = 444;
  40478. t.abreve = 444;
  40479. t.uhungarumlaut = 500;
  40480. t.ecaron = 444;
  40481. t.Ydieresis = 722;
  40482. t.divide = 564;
  40483. t.Yacute = 722;
  40484. t.Acircumflex = 722;
  40485. t.aacute = 444;
  40486. t.Ucircumflex = 722;
  40487. t.yacute = 500;
  40488. t.scommaaccent = 389;
  40489. t.ecircumflex = 444;
  40490. t.Uring = 722;
  40491. t.Udieresis = 722;
  40492. t.aogonek = 444;
  40493. t.Uacute = 722;
  40494. t.uogonek = 500;
  40495. t.Edieresis = 611;
  40496. t.Dcroat = 722;
  40497. t.commaaccent = 250;
  40498. t.copyright = 760;
  40499. t.Emacron = 611;
  40500. t.ccaron = 444;
  40501. t.aring = 444;
  40502. t.Ncommaaccent = 722;
  40503. t.lacute = 278;
  40504. t.agrave = 444;
  40505. t.Tcommaaccent = 611;
  40506. t.Cacute = 667;
  40507. t.atilde = 444;
  40508. t.Edotaccent = 611;
  40509. t.scaron = 389;
  40510. t.scedilla = 389;
  40511. t.iacute = 278;
  40512. t.lozenge = 471;
  40513. t.Rcaron = 667;
  40514. t.Gcommaaccent = 722;
  40515. t.ucircumflex = 500;
  40516. t.acircumflex = 444;
  40517. t.Amacron = 722;
  40518. t.rcaron = 333;
  40519. t.ccedilla = 444;
  40520. t.Zdotaccent = 611;
  40521. t.Thorn = 556;
  40522. t.Omacron = 722;
  40523. t.Racute = 667;
  40524. t.Sacute = 556;
  40525. t.dcaron = 588;
  40526. t.Umacron = 722;
  40527. t.uring = 500;
  40528. t.threesuperior = 300;
  40529. t.Ograve = 722;
  40530. t.Agrave = 722;
  40531. t.Abreve = 722;
  40532. t.multiply = 564;
  40533. t.uacute = 500;
  40534. t.Tcaron = 611;
  40535. t.partialdiff = 476;
  40536. t.ydieresis = 500;
  40537. t.Nacute = 722;
  40538. t.icircumflex = 278;
  40539. t.Ecircumflex = 611;
  40540. t.adieresis = 444;
  40541. t.edieresis = 444;
  40542. t.cacute = 444;
  40543. t.nacute = 500;
  40544. t.umacron = 500;
  40545. t.Ncaron = 722;
  40546. t.Iacute = 333;
  40547. t.plusminus = 564;
  40548. t.brokenbar = 200;
  40549. t.registered = 760;
  40550. t.Gbreve = 722;
  40551. t.Idotaccent = 333;
  40552. t.summation = 600;
  40553. t.Egrave = 611;
  40554. t.racute = 333;
  40555. t.omacron = 500;
  40556. t.Zacute = 611;
  40557. t.Zcaron = 611;
  40558. t.greaterequal = 549;
  40559. t.Eth = 722;
  40560. t.Ccedilla = 667;
  40561. t.lcommaaccent = 278;
  40562. t.tcaron = 326;
  40563. t.eogonek = 444;
  40564. t.Uogonek = 722;
  40565. t.Aacute = 722;
  40566. t.Adieresis = 722;
  40567. t.egrave = 444;
  40568. t.zacute = 444;
  40569. t.iogonek = 278;
  40570. t.Oacute = 722;
  40571. t.oacute = 500;
  40572. t.amacron = 444;
  40573. t.sacute = 389;
  40574. t.idieresis = 278;
  40575. t.Ocircumflex = 722;
  40576. t.Ugrave = 722;
  40577. t.Delta = 612;
  40578. t.thorn = 500;
  40579. t.twosuperior = 300;
  40580. t.Odieresis = 722;
  40581. t.mu = 500;
  40582. t.igrave = 278;
  40583. t.ohungarumlaut = 500;
  40584. t.Eogonek = 611;
  40585. t.dcroat = 500;
  40586. t.threequarters = 750;
  40587. t.Scedilla = 556;
  40588. t.lcaron = 344;
  40589. t.Kcommaaccent = 722;
  40590. t.Lacute = 611;
  40591. t.trademark = 980;
  40592. t.edotaccent = 444;
  40593. t.Igrave = 333;
  40594. t.Imacron = 333;
  40595. t.Lcaron = 611;
  40596. t.onehalf = 750;
  40597. t.lessequal = 549;
  40598. t.ocircumflex = 500;
  40599. t.ntilde = 500;
  40600. t.Uhungarumlaut = 722;
  40601. t.Eacute = 611;
  40602. t.emacron = 444;
  40603. t.gbreve = 500;
  40604. t.onequarter = 750;
  40605. t.Scaron = 556;
  40606. t.Scommaaccent = 556;
  40607. t.Ohungarumlaut = 722;
  40608. t.degree = 400;
  40609. t.ograve = 500;
  40610. t.Ccaron = 667;
  40611. t.ugrave = 500;
  40612. t.radical = 453;
  40613. t.Dcaron = 722;
  40614. t.rcommaaccent = 333;
  40615. t.Ntilde = 722;
  40616. t.otilde = 500;
  40617. t.Rcommaaccent = 667;
  40618. t.Lcommaaccent = 611;
  40619. t.Atilde = 722;
  40620. t.Aogonek = 722;
  40621. t.Aring = 722;
  40622. t.Otilde = 722;
  40623. t.zdotaccent = 444;
  40624. t.Ecaron = 611;
  40625. t.Iogonek = 333;
  40626. t.kcommaaccent = 500;
  40627. t.minus = 564;
  40628. t.Icircumflex = 333;
  40629. t.ncaron = 500;
  40630. t.tcommaaccent = 278;
  40631. t.logicalnot = 564;
  40632. t.odieresis = 500;
  40633. t.udieresis = 500;
  40634. t.notequal = 549;
  40635. t.gcommaaccent = 500;
  40636. t.eth = 500;
  40637. t.zcaron = 444;
  40638. t.ncommaaccent = 500;
  40639. t.onesuperior = 300;
  40640. t.imacron = 278;
  40641. t.Euro = 500;
  40642. });
  40643. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40644. t.space = 250;
  40645. t.exclam = 333;
  40646. t.quotedbl = 555;
  40647. t.numbersign = 500;
  40648. t.dollar = 500;
  40649. t.percent = 1000;
  40650. t.ampersand = 833;
  40651. t.quoteright = 333;
  40652. t.parenleft = 333;
  40653. t.parenright = 333;
  40654. t.asterisk = 500;
  40655. t.plus = 570;
  40656. t.comma = 250;
  40657. t.hyphen = 333;
  40658. t.period = 250;
  40659. t.slash = 278;
  40660. t.zero = 500;
  40661. t.one = 500;
  40662. t.two = 500;
  40663. t.three = 500;
  40664. t.four = 500;
  40665. t.five = 500;
  40666. t.six = 500;
  40667. t.seven = 500;
  40668. t.eight = 500;
  40669. t.nine = 500;
  40670. t.colon = 333;
  40671. t.semicolon = 333;
  40672. t.less = 570;
  40673. t.equal = 570;
  40674. t.greater = 570;
  40675. t.question = 500;
  40676. t.at = 930;
  40677. t.A = 722;
  40678. t.B = 667;
  40679. t.C = 722;
  40680. t.D = 722;
  40681. t.E = 667;
  40682. t.F = 611;
  40683. t.G = 778;
  40684. t.H = 778;
  40685. t.I = 389;
  40686. t.J = 500;
  40687. t.K = 778;
  40688. t.L = 667;
  40689. t.M = 944;
  40690. t.N = 722;
  40691. t.O = 778;
  40692. t.P = 611;
  40693. t.Q = 778;
  40694. t.R = 722;
  40695. t.S = 556;
  40696. t.T = 667;
  40697. t.U = 722;
  40698. t.V = 722;
  40699. t.W = 1000;
  40700. t.X = 722;
  40701. t.Y = 722;
  40702. t.Z = 667;
  40703. t.bracketleft = 333;
  40704. t.backslash = 278;
  40705. t.bracketright = 333;
  40706. t.asciicircum = 581;
  40707. t.underscore = 500;
  40708. t.quoteleft = 333;
  40709. t.a = 500;
  40710. t.b = 556;
  40711. t.c = 444;
  40712. t.d = 556;
  40713. t.e = 444;
  40714. t.f = 333;
  40715. t.g = 500;
  40716. t.h = 556;
  40717. t.i = 278;
  40718. t.j = 333;
  40719. t.k = 556;
  40720. t.l = 278;
  40721. t.m = 833;
  40722. t.n = 556;
  40723. t.o = 500;
  40724. t.p = 556;
  40725. t.q = 556;
  40726. t.r = 444;
  40727. t.s = 389;
  40728. t.t = 333;
  40729. t.u = 556;
  40730. t.v = 500;
  40731. t.w = 722;
  40732. t.x = 500;
  40733. t.y = 500;
  40734. t.z = 444;
  40735. t.braceleft = 394;
  40736. t.bar = 220;
  40737. t.braceright = 394;
  40738. t.asciitilde = 520;
  40739. t.exclamdown = 333;
  40740. t.cent = 500;
  40741. t.sterling = 500;
  40742. t.fraction = 167;
  40743. t.yen = 500;
  40744. t.florin = 500;
  40745. t.section = 500;
  40746. t.currency = 500;
  40747. t.quotesingle = 278;
  40748. t.quotedblleft = 500;
  40749. t.guillemotleft = 500;
  40750. t.guilsinglleft = 333;
  40751. t.guilsinglright = 333;
  40752. t.fi = 556;
  40753. t.fl = 556;
  40754. t.endash = 500;
  40755. t.dagger = 500;
  40756. t.daggerdbl = 500;
  40757. t.periodcentered = 250;
  40758. t.paragraph = 540;
  40759. t.bullet = 350;
  40760. t.quotesinglbase = 333;
  40761. t.quotedblbase = 500;
  40762. t.quotedblright = 500;
  40763. t.guillemotright = 500;
  40764. t.ellipsis = 1000;
  40765. t.perthousand = 1000;
  40766. t.questiondown = 500;
  40767. t.grave = 333;
  40768. t.acute = 333;
  40769. t.circumflex = 333;
  40770. t.tilde = 333;
  40771. t.macron = 333;
  40772. t.breve = 333;
  40773. t.dotaccent = 333;
  40774. t.dieresis = 333;
  40775. t.ring = 333;
  40776. t.cedilla = 333;
  40777. t.hungarumlaut = 333;
  40778. t.ogonek = 333;
  40779. t.caron = 333;
  40780. t.emdash = 1000;
  40781. t.AE = 1000;
  40782. t.ordfeminine = 300;
  40783. t.Lslash = 667;
  40784. t.Oslash = 778;
  40785. t.OE = 1000;
  40786. t.ordmasculine = 330;
  40787. t.ae = 722;
  40788. t.dotlessi = 278;
  40789. t.lslash = 278;
  40790. t.oslash = 500;
  40791. t.oe = 722;
  40792. t.germandbls = 556;
  40793. t.Idieresis = 389;
  40794. t.eacute = 444;
  40795. t.abreve = 500;
  40796. t.uhungarumlaut = 556;
  40797. t.ecaron = 444;
  40798. t.Ydieresis = 722;
  40799. t.divide = 570;
  40800. t.Yacute = 722;
  40801. t.Acircumflex = 722;
  40802. t.aacute = 500;
  40803. t.Ucircumflex = 722;
  40804. t.yacute = 500;
  40805. t.scommaaccent = 389;
  40806. t.ecircumflex = 444;
  40807. t.Uring = 722;
  40808. t.Udieresis = 722;
  40809. t.aogonek = 500;
  40810. t.Uacute = 722;
  40811. t.uogonek = 556;
  40812. t.Edieresis = 667;
  40813. t.Dcroat = 722;
  40814. t.commaaccent = 250;
  40815. t.copyright = 747;
  40816. t.Emacron = 667;
  40817. t.ccaron = 444;
  40818. t.aring = 500;
  40819. t.Ncommaaccent = 722;
  40820. t.lacute = 278;
  40821. t.agrave = 500;
  40822. t.Tcommaaccent = 667;
  40823. t.Cacute = 722;
  40824. t.atilde = 500;
  40825. t.Edotaccent = 667;
  40826. t.scaron = 389;
  40827. t.scedilla = 389;
  40828. t.iacute = 278;
  40829. t.lozenge = 494;
  40830. t.Rcaron = 722;
  40831. t.Gcommaaccent = 778;
  40832. t.ucircumflex = 556;
  40833. t.acircumflex = 500;
  40834. t.Amacron = 722;
  40835. t.rcaron = 444;
  40836. t.ccedilla = 444;
  40837. t.Zdotaccent = 667;
  40838. t.Thorn = 611;
  40839. t.Omacron = 778;
  40840. t.Racute = 722;
  40841. t.Sacute = 556;
  40842. t.dcaron = 672;
  40843. t.Umacron = 722;
  40844. t.uring = 556;
  40845. t.threesuperior = 300;
  40846. t.Ograve = 778;
  40847. t.Agrave = 722;
  40848. t.Abreve = 722;
  40849. t.multiply = 570;
  40850. t.uacute = 556;
  40851. t.Tcaron = 667;
  40852. t.partialdiff = 494;
  40853. t.ydieresis = 500;
  40854. t.Nacute = 722;
  40855. t.icircumflex = 278;
  40856. t.Ecircumflex = 667;
  40857. t.adieresis = 500;
  40858. t.edieresis = 444;
  40859. t.cacute = 444;
  40860. t.nacute = 556;
  40861. t.umacron = 556;
  40862. t.Ncaron = 722;
  40863. t.Iacute = 389;
  40864. t.plusminus = 570;
  40865. t.brokenbar = 220;
  40866. t.registered = 747;
  40867. t.Gbreve = 778;
  40868. t.Idotaccent = 389;
  40869. t.summation = 600;
  40870. t.Egrave = 667;
  40871. t.racute = 444;
  40872. t.omacron = 500;
  40873. t.Zacute = 667;
  40874. t.Zcaron = 667;
  40875. t.greaterequal = 549;
  40876. t.Eth = 722;
  40877. t.Ccedilla = 722;
  40878. t.lcommaaccent = 278;
  40879. t.tcaron = 416;
  40880. t.eogonek = 444;
  40881. t.Uogonek = 722;
  40882. t.Aacute = 722;
  40883. t.Adieresis = 722;
  40884. t.egrave = 444;
  40885. t.zacute = 444;
  40886. t.iogonek = 278;
  40887. t.Oacute = 778;
  40888. t.oacute = 500;
  40889. t.amacron = 500;
  40890. t.sacute = 389;
  40891. t.idieresis = 278;
  40892. t.Ocircumflex = 778;
  40893. t.Ugrave = 722;
  40894. t.Delta = 612;
  40895. t.thorn = 556;
  40896. t.twosuperior = 300;
  40897. t.Odieresis = 778;
  40898. t.mu = 556;
  40899. t.igrave = 278;
  40900. t.ohungarumlaut = 500;
  40901. t.Eogonek = 667;
  40902. t.dcroat = 556;
  40903. t.threequarters = 750;
  40904. t.Scedilla = 556;
  40905. t.lcaron = 394;
  40906. t.Kcommaaccent = 778;
  40907. t.Lacute = 667;
  40908. t.trademark = 1000;
  40909. t.edotaccent = 444;
  40910. t.Igrave = 389;
  40911. t.Imacron = 389;
  40912. t.Lcaron = 667;
  40913. t.onehalf = 750;
  40914. t.lessequal = 549;
  40915. t.ocircumflex = 500;
  40916. t.ntilde = 556;
  40917. t.Uhungarumlaut = 722;
  40918. t.Eacute = 667;
  40919. t.emacron = 444;
  40920. t.gbreve = 500;
  40921. t.onequarter = 750;
  40922. t.Scaron = 556;
  40923. t.Scommaaccent = 556;
  40924. t.Ohungarumlaut = 778;
  40925. t.degree = 400;
  40926. t.ograve = 500;
  40927. t.Ccaron = 722;
  40928. t.ugrave = 556;
  40929. t.radical = 549;
  40930. t.Dcaron = 722;
  40931. t.rcommaaccent = 444;
  40932. t.Ntilde = 722;
  40933. t.otilde = 500;
  40934. t.Rcommaaccent = 722;
  40935. t.Lcommaaccent = 667;
  40936. t.Atilde = 722;
  40937. t.Aogonek = 722;
  40938. t.Aring = 722;
  40939. t.Otilde = 778;
  40940. t.zdotaccent = 444;
  40941. t.Ecaron = 667;
  40942. t.Iogonek = 389;
  40943. t.kcommaaccent = 556;
  40944. t.minus = 570;
  40945. t.Icircumflex = 389;
  40946. t.ncaron = 556;
  40947. t.tcommaaccent = 333;
  40948. t.logicalnot = 570;
  40949. t.odieresis = 500;
  40950. t.udieresis = 556;
  40951. t.notequal = 549;
  40952. t.gcommaaccent = 500;
  40953. t.eth = 500;
  40954. t.zcaron = 444;
  40955. t.ncommaaccent = 556;
  40956. t.onesuperior = 300;
  40957. t.imacron = 278;
  40958. t.Euro = 500;
  40959. });
  40960. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40961. t.space = 250;
  40962. t.exclam = 389;
  40963. t.quotedbl = 555;
  40964. t.numbersign = 500;
  40965. t.dollar = 500;
  40966. t.percent = 833;
  40967. t.ampersand = 778;
  40968. t.quoteright = 333;
  40969. t.parenleft = 333;
  40970. t.parenright = 333;
  40971. t.asterisk = 500;
  40972. t.plus = 570;
  40973. t.comma = 250;
  40974. t.hyphen = 333;
  40975. t.period = 250;
  40976. t.slash = 278;
  40977. t.zero = 500;
  40978. t.one = 500;
  40979. t.two = 500;
  40980. t.three = 500;
  40981. t.four = 500;
  40982. t.five = 500;
  40983. t.six = 500;
  40984. t.seven = 500;
  40985. t.eight = 500;
  40986. t.nine = 500;
  40987. t.colon = 333;
  40988. t.semicolon = 333;
  40989. t.less = 570;
  40990. t.equal = 570;
  40991. t.greater = 570;
  40992. t.question = 500;
  40993. t.at = 832;
  40994. t.A = 667;
  40995. t.B = 667;
  40996. t.C = 667;
  40997. t.D = 722;
  40998. t.E = 667;
  40999. t.F = 667;
  41000. t.G = 722;
  41001. t.H = 778;
  41002. t.I = 389;
  41003. t.J = 500;
  41004. t.K = 667;
  41005. t.L = 611;
  41006. t.M = 889;
  41007. t.N = 722;
  41008. t.O = 722;
  41009. t.P = 611;
  41010. t.Q = 722;
  41011. t.R = 667;
  41012. t.S = 556;
  41013. t.T = 611;
  41014. t.U = 722;
  41015. t.V = 667;
  41016. t.W = 889;
  41017. t.X = 667;
  41018. t.Y = 611;
  41019. t.Z = 611;
  41020. t.bracketleft = 333;
  41021. t.backslash = 278;
  41022. t.bracketright = 333;
  41023. t.asciicircum = 570;
  41024. t.underscore = 500;
  41025. t.quoteleft = 333;
  41026. t.a = 500;
  41027. t.b = 500;
  41028. t.c = 444;
  41029. t.d = 500;
  41030. t.e = 444;
  41031. t.f = 333;
  41032. t.g = 500;
  41033. t.h = 556;
  41034. t.i = 278;
  41035. t.j = 278;
  41036. t.k = 500;
  41037. t.l = 278;
  41038. t.m = 778;
  41039. t.n = 556;
  41040. t.o = 500;
  41041. t.p = 500;
  41042. t.q = 500;
  41043. t.r = 389;
  41044. t.s = 389;
  41045. t.t = 278;
  41046. t.u = 556;
  41047. t.v = 444;
  41048. t.w = 667;
  41049. t.x = 500;
  41050. t.y = 444;
  41051. t.z = 389;
  41052. t.braceleft = 348;
  41053. t.bar = 220;
  41054. t.braceright = 348;
  41055. t.asciitilde = 570;
  41056. t.exclamdown = 389;
  41057. t.cent = 500;
  41058. t.sterling = 500;
  41059. t.fraction = 167;
  41060. t.yen = 500;
  41061. t.florin = 500;
  41062. t.section = 500;
  41063. t.currency = 500;
  41064. t.quotesingle = 278;
  41065. t.quotedblleft = 500;
  41066. t.guillemotleft = 500;
  41067. t.guilsinglleft = 333;
  41068. t.guilsinglright = 333;
  41069. t.fi = 556;
  41070. t.fl = 556;
  41071. t.endash = 500;
  41072. t.dagger = 500;
  41073. t.daggerdbl = 500;
  41074. t.periodcentered = 250;
  41075. t.paragraph = 500;
  41076. t.bullet = 350;
  41077. t.quotesinglbase = 333;
  41078. t.quotedblbase = 500;
  41079. t.quotedblright = 500;
  41080. t.guillemotright = 500;
  41081. t.ellipsis = 1000;
  41082. t.perthousand = 1000;
  41083. t.questiondown = 500;
  41084. t.grave = 333;
  41085. t.acute = 333;
  41086. t.circumflex = 333;
  41087. t.tilde = 333;
  41088. t.macron = 333;
  41089. t.breve = 333;
  41090. t.dotaccent = 333;
  41091. t.dieresis = 333;
  41092. t.ring = 333;
  41093. t.cedilla = 333;
  41094. t.hungarumlaut = 333;
  41095. t.ogonek = 333;
  41096. t.caron = 333;
  41097. t.emdash = 1000;
  41098. t.AE = 944;
  41099. t.ordfeminine = 266;
  41100. t.Lslash = 611;
  41101. t.Oslash = 722;
  41102. t.OE = 944;
  41103. t.ordmasculine = 300;
  41104. t.ae = 722;
  41105. t.dotlessi = 278;
  41106. t.lslash = 278;
  41107. t.oslash = 500;
  41108. t.oe = 722;
  41109. t.germandbls = 500;
  41110. t.Idieresis = 389;
  41111. t.eacute = 444;
  41112. t.abreve = 500;
  41113. t.uhungarumlaut = 556;
  41114. t.ecaron = 444;
  41115. t.Ydieresis = 611;
  41116. t.divide = 570;
  41117. t.Yacute = 611;
  41118. t.Acircumflex = 667;
  41119. t.aacute = 500;
  41120. t.Ucircumflex = 722;
  41121. t.yacute = 444;
  41122. t.scommaaccent = 389;
  41123. t.ecircumflex = 444;
  41124. t.Uring = 722;
  41125. t.Udieresis = 722;
  41126. t.aogonek = 500;
  41127. t.Uacute = 722;
  41128. t.uogonek = 556;
  41129. t.Edieresis = 667;
  41130. t.Dcroat = 722;
  41131. t.commaaccent = 250;
  41132. t.copyright = 747;
  41133. t.Emacron = 667;
  41134. t.ccaron = 444;
  41135. t.aring = 500;
  41136. t.Ncommaaccent = 722;
  41137. t.lacute = 278;
  41138. t.agrave = 500;
  41139. t.Tcommaaccent = 611;
  41140. t.Cacute = 667;
  41141. t.atilde = 500;
  41142. t.Edotaccent = 667;
  41143. t.scaron = 389;
  41144. t.scedilla = 389;
  41145. t.iacute = 278;
  41146. t.lozenge = 494;
  41147. t.Rcaron = 667;
  41148. t.Gcommaaccent = 722;
  41149. t.ucircumflex = 556;
  41150. t.acircumflex = 500;
  41151. t.Amacron = 667;
  41152. t.rcaron = 389;
  41153. t.ccedilla = 444;
  41154. t.Zdotaccent = 611;
  41155. t.Thorn = 611;
  41156. t.Omacron = 722;
  41157. t.Racute = 667;
  41158. t.Sacute = 556;
  41159. t.dcaron = 608;
  41160. t.Umacron = 722;
  41161. t.uring = 556;
  41162. t.threesuperior = 300;
  41163. t.Ograve = 722;
  41164. t.Agrave = 667;
  41165. t.Abreve = 667;
  41166. t.multiply = 570;
  41167. t.uacute = 556;
  41168. t.Tcaron = 611;
  41169. t.partialdiff = 494;
  41170. t.ydieresis = 444;
  41171. t.Nacute = 722;
  41172. t.icircumflex = 278;
  41173. t.Ecircumflex = 667;
  41174. t.adieresis = 500;
  41175. t.edieresis = 444;
  41176. t.cacute = 444;
  41177. t.nacute = 556;
  41178. t.umacron = 556;
  41179. t.Ncaron = 722;
  41180. t.Iacute = 389;
  41181. t.plusminus = 570;
  41182. t.brokenbar = 220;
  41183. t.registered = 747;
  41184. t.Gbreve = 722;
  41185. t.Idotaccent = 389;
  41186. t.summation = 600;
  41187. t.Egrave = 667;
  41188. t.racute = 389;
  41189. t.omacron = 500;
  41190. t.Zacute = 611;
  41191. t.Zcaron = 611;
  41192. t.greaterequal = 549;
  41193. t.Eth = 722;
  41194. t.Ccedilla = 667;
  41195. t.lcommaaccent = 278;
  41196. t.tcaron = 366;
  41197. t.eogonek = 444;
  41198. t.Uogonek = 722;
  41199. t.Aacute = 667;
  41200. t.Adieresis = 667;
  41201. t.egrave = 444;
  41202. t.zacute = 389;
  41203. t.iogonek = 278;
  41204. t.Oacute = 722;
  41205. t.oacute = 500;
  41206. t.amacron = 500;
  41207. t.sacute = 389;
  41208. t.idieresis = 278;
  41209. t.Ocircumflex = 722;
  41210. t.Ugrave = 722;
  41211. t.Delta = 612;
  41212. t.thorn = 500;
  41213. t.twosuperior = 300;
  41214. t.Odieresis = 722;
  41215. t.mu = 576;
  41216. t.igrave = 278;
  41217. t.ohungarumlaut = 500;
  41218. t.Eogonek = 667;
  41219. t.dcroat = 500;
  41220. t.threequarters = 750;
  41221. t.Scedilla = 556;
  41222. t.lcaron = 382;
  41223. t.Kcommaaccent = 667;
  41224. t.Lacute = 611;
  41225. t.trademark = 1000;
  41226. t.edotaccent = 444;
  41227. t.Igrave = 389;
  41228. t.Imacron = 389;
  41229. t.Lcaron = 611;
  41230. t.onehalf = 750;
  41231. t.lessequal = 549;
  41232. t.ocircumflex = 500;
  41233. t.ntilde = 556;
  41234. t.Uhungarumlaut = 722;
  41235. t.Eacute = 667;
  41236. t.emacron = 444;
  41237. t.gbreve = 500;
  41238. t.onequarter = 750;
  41239. t.Scaron = 556;
  41240. t.Scommaaccent = 556;
  41241. t.Ohungarumlaut = 722;
  41242. t.degree = 400;
  41243. t.ograve = 500;
  41244. t.Ccaron = 667;
  41245. t.ugrave = 556;
  41246. t.radical = 549;
  41247. t.Dcaron = 722;
  41248. t.rcommaaccent = 389;
  41249. t.Ntilde = 722;
  41250. t.otilde = 500;
  41251. t.Rcommaaccent = 667;
  41252. t.Lcommaaccent = 611;
  41253. t.Atilde = 667;
  41254. t.Aogonek = 667;
  41255. t.Aring = 667;
  41256. t.Otilde = 722;
  41257. t.zdotaccent = 389;
  41258. t.Ecaron = 667;
  41259. t.Iogonek = 389;
  41260. t.kcommaaccent = 500;
  41261. t.minus = 606;
  41262. t.Icircumflex = 389;
  41263. t.ncaron = 556;
  41264. t.tcommaaccent = 278;
  41265. t.logicalnot = 606;
  41266. t.odieresis = 500;
  41267. t.udieresis = 556;
  41268. t.notequal = 549;
  41269. t.gcommaaccent = 500;
  41270. t.eth = 500;
  41271. t.zcaron = 389;
  41272. t.ncommaaccent = 556;
  41273. t.onesuperior = 300;
  41274. t.imacron = 278;
  41275. t.Euro = 500;
  41276. });
  41277. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41278. t.space = 250;
  41279. t.exclam = 333;
  41280. t.quotedbl = 420;
  41281. t.numbersign = 500;
  41282. t.dollar = 500;
  41283. t.percent = 833;
  41284. t.ampersand = 778;
  41285. t.quoteright = 333;
  41286. t.parenleft = 333;
  41287. t.parenright = 333;
  41288. t.asterisk = 500;
  41289. t.plus = 675;
  41290. t.comma = 250;
  41291. t.hyphen = 333;
  41292. t.period = 250;
  41293. t.slash = 278;
  41294. t.zero = 500;
  41295. t.one = 500;
  41296. t.two = 500;
  41297. t.three = 500;
  41298. t.four = 500;
  41299. t.five = 500;
  41300. t.six = 500;
  41301. t.seven = 500;
  41302. t.eight = 500;
  41303. t.nine = 500;
  41304. t.colon = 333;
  41305. t.semicolon = 333;
  41306. t.less = 675;
  41307. t.equal = 675;
  41308. t.greater = 675;
  41309. t.question = 500;
  41310. t.at = 920;
  41311. t.A = 611;
  41312. t.B = 611;
  41313. t.C = 667;
  41314. t.D = 722;
  41315. t.E = 611;
  41316. t.F = 611;
  41317. t.G = 722;
  41318. t.H = 722;
  41319. t.I = 333;
  41320. t.J = 444;
  41321. t.K = 667;
  41322. t.L = 556;
  41323. t.M = 833;
  41324. t.N = 667;
  41325. t.O = 722;
  41326. t.P = 611;
  41327. t.Q = 722;
  41328. t.R = 611;
  41329. t.S = 500;
  41330. t.T = 556;
  41331. t.U = 722;
  41332. t.V = 611;
  41333. t.W = 833;
  41334. t.X = 611;
  41335. t.Y = 556;
  41336. t.Z = 556;
  41337. t.bracketleft = 389;
  41338. t.backslash = 278;
  41339. t.bracketright = 389;
  41340. t.asciicircum = 422;
  41341. t.underscore = 500;
  41342. t.quoteleft = 333;
  41343. t.a = 500;
  41344. t.b = 500;
  41345. t.c = 444;
  41346. t.d = 500;
  41347. t.e = 444;
  41348. t.f = 278;
  41349. t.g = 500;
  41350. t.h = 500;
  41351. t.i = 278;
  41352. t.j = 278;
  41353. t.k = 444;
  41354. t.l = 278;
  41355. t.m = 722;
  41356. t.n = 500;
  41357. t.o = 500;
  41358. t.p = 500;
  41359. t.q = 500;
  41360. t.r = 389;
  41361. t.s = 389;
  41362. t.t = 278;
  41363. t.u = 500;
  41364. t.v = 444;
  41365. t.w = 667;
  41366. t.x = 444;
  41367. t.y = 444;
  41368. t.z = 389;
  41369. t.braceleft = 400;
  41370. t.bar = 275;
  41371. t.braceright = 400;
  41372. t.asciitilde = 541;
  41373. t.exclamdown = 389;
  41374. t.cent = 500;
  41375. t.sterling = 500;
  41376. t.fraction = 167;
  41377. t.yen = 500;
  41378. t.florin = 500;
  41379. t.section = 500;
  41380. t.currency = 500;
  41381. t.quotesingle = 214;
  41382. t.quotedblleft = 556;
  41383. t.guillemotleft = 500;
  41384. t.guilsinglleft = 333;
  41385. t.guilsinglright = 333;
  41386. t.fi = 500;
  41387. t.fl = 500;
  41388. t.endash = 500;
  41389. t.dagger = 500;
  41390. t.daggerdbl = 500;
  41391. t.periodcentered = 250;
  41392. t.paragraph = 523;
  41393. t.bullet = 350;
  41394. t.quotesinglbase = 333;
  41395. t.quotedblbase = 556;
  41396. t.quotedblright = 556;
  41397. t.guillemotright = 500;
  41398. t.ellipsis = 889;
  41399. t.perthousand = 1000;
  41400. t.questiondown = 500;
  41401. t.grave = 333;
  41402. t.acute = 333;
  41403. t.circumflex = 333;
  41404. t.tilde = 333;
  41405. t.macron = 333;
  41406. t.breve = 333;
  41407. t.dotaccent = 333;
  41408. t.dieresis = 333;
  41409. t.ring = 333;
  41410. t.cedilla = 333;
  41411. t.hungarumlaut = 333;
  41412. t.ogonek = 333;
  41413. t.caron = 333;
  41414. t.emdash = 889;
  41415. t.AE = 889;
  41416. t.ordfeminine = 276;
  41417. t.Lslash = 556;
  41418. t.Oslash = 722;
  41419. t.OE = 944;
  41420. t.ordmasculine = 310;
  41421. t.ae = 667;
  41422. t.dotlessi = 278;
  41423. t.lslash = 278;
  41424. t.oslash = 500;
  41425. t.oe = 667;
  41426. t.germandbls = 500;
  41427. t.Idieresis = 333;
  41428. t.eacute = 444;
  41429. t.abreve = 500;
  41430. t.uhungarumlaut = 500;
  41431. t.ecaron = 444;
  41432. t.Ydieresis = 556;
  41433. t.divide = 675;
  41434. t.Yacute = 556;
  41435. t.Acircumflex = 611;
  41436. t.aacute = 500;
  41437. t.Ucircumflex = 722;
  41438. t.yacute = 444;
  41439. t.scommaaccent = 389;
  41440. t.ecircumflex = 444;
  41441. t.Uring = 722;
  41442. t.Udieresis = 722;
  41443. t.aogonek = 500;
  41444. t.Uacute = 722;
  41445. t.uogonek = 500;
  41446. t.Edieresis = 611;
  41447. t.Dcroat = 722;
  41448. t.commaaccent = 250;
  41449. t.copyright = 760;
  41450. t.Emacron = 611;
  41451. t.ccaron = 444;
  41452. t.aring = 500;
  41453. t.Ncommaaccent = 667;
  41454. t.lacute = 278;
  41455. t.agrave = 500;
  41456. t.Tcommaaccent = 556;
  41457. t.Cacute = 667;
  41458. t.atilde = 500;
  41459. t.Edotaccent = 611;
  41460. t.scaron = 389;
  41461. t.scedilla = 389;
  41462. t.iacute = 278;
  41463. t.lozenge = 471;
  41464. t.Rcaron = 611;
  41465. t.Gcommaaccent = 722;
  41466. t.ucircumflex = 500;
  41467. t.acircumflex = 500;
  41468. t.Amacron = 611;
  41469. t.rcaron = 389;
  41470. t.ccedilla = 444;
  41471. t.Zdotaccent = 556;
  41472. t.Thorn = 611;
  41473. t.Omacron = 722;
  41474. t.Racute = 611;
  41475. t.Sacute = 500;
  41476. t.dcaron = 544;
  41477. t.Umacron = 722;
  41478. t.uring = 500;
  41479. t.threesuperior = 300;
  41480. t.Ograve = 722;
  41481. t.Agrave = 611;
  41482. t.Abreve = 611;
  41483. t.multiply = 675;
  41484. t.uacute = 500;
  41485. t.Tcaron = 556;
  41486. t.partialdiff = 476;
  41487. t.ydieresis = 444;
  41488. t.Nacute = 667;
  41489. t.icircumflex = 278;
  41490. t.Ecircumflex = 611;
  41491. t.adieresis = 500;
  41492. t.edieresis = 444;
  41493. t.cacute = 444;
  41494. t.nacute = 500;
  41495. t.umacron = 500;
  41496. t.Ncaron = 667;
  41497. t.Iacute = 333;
  41498. t.plusminus = 675;
  41499. t.brokenbar = 275;
  41500. t.registered = 760;
  41501. t.Gbreve = 722;
  41502. t.Idotaccent = 333;
  41503. t.summation = 600;
  41504. t.Egrave = 611;
  41505. t.racute = 389;
  41506. t.omacron = 500;
  41507. t.Zacute = 556;
  41508. t.Zcaron = 556;
  41509. t.greaterequal = 549;
  41510. t.Eth = 722;
  41511. t.Ccedilla = 667;
  41512. t.lcommaaccent = 278;
  41513. t.tcaron = 300;
  41514. t.eogonek = 444;
  41515. t.Uogonek = 722;
  41516. t.Aacute = 611;
  41517. t.Adieresis = 611;
  41518. t.egrave = 444;
  41519. t.zacute = 389;
  41520. t.iogonek = 278;
  41521. t.Oacute = 722;
  41522. t.oacute = 500;
  41523. t.amacron = 500;
  41524. t.sacute = 389;
  41525. t.idieresis = 278;
  41526. t.Ocircumflex = 722;
  41527. t.Ugrave = 722;
  41528. t.Delta = 612;
  41529. t.thorn = 500;
  41530. t.twosuperior = 300;
  41531. t.Odieresis = 722;
  41532. t.mu = 500;
  41533. t.igrave = 278;
  41534. t.ohungarumlaut = 500;
  41535. t.Eogonek = 611;
  41536. t.dcroat = 500;
  41537. t.threequarters = 750;
  41538. t.Scedilla = 500;
  41539. t.lcaron = 300;
  41540. t.Kcommaaccent = 667;
  41541. t.Lacute = 556;
  41542. t.trademark = 980;
  41543. t.edotaccent = 444;
  41544. t.Igrave = 333;
  41545. t.Imacron = 333;
  41546. t.Lcaron = 611;
  41547. t.onehalf = 750;
  41548. t.lessequal = 549;
  41549. t.ocircumflex = 500;
  41550. t.ntilde = 500;
  41551. t.Uhungarumlaut = 722;
  41552. t.Eacute = 611;
  41553. t.emacron = 444;
  41554. t.gbreve = 500;
  41555. t.onequarter = 750;
  41556. t.Scaron = 500;
  41557. t.Scommaaccent = 500;
  41558. t.Ohungarumlaut = 722;
  41559. t.degree = 400;
  41560. t.ograve = 500;
  41561. t.Ccaron = 667;
  41562. t.ugrave = 500;
  41563. t.radical = 453;
  41564. t.Dcaron = 722;
  41565. t.rcommaaccent = 389;
  41566. t.Ntilde = 667;
  41567. t.otilde = 500;
  41568. t.Rcommaaccent = 611;
  41569. t.Lcommaaccent = 556;
  41570. t.Atilde = 611;
  41571. t.Aogonek = 611;
  41572. t.Aring = 611;
  41573. t.Otilde = 722;
  41574. t.zdotaccent = 389;
  41575. t.Ecaron = 611;
  41576. t.Iogonek = 333;
  41577. t.kcommaaccent = 444;
  41578. t.minus = 675;
  41579. t.Icircumflex = 333;
  41580. t.ncaron = 500;
  41581. t.tcommaaccent = 278;
  41582. t.logicalnot = 675;
  41583. t.odieresis = 500;
  41584. t.udieresis = 500;
  41585. t.notequal = 549;
  41586. t.gcommaaccent = 500;
  41587. t.eth = 500;
  41588. t.zcaron = 389;
  41589. t.ncommaaccent = 500;
  41590. t.onesuperior = 300;
  41591. t.imacron = 278;
  41592. t.Euro = 500;
  41593. });
  41594. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  41595. t.space = 278;
  41596. t.a1 = 974;
  41597. t.a2 = 961;
  41598. t.a202 = 974;
  41599. t.a3 = 980;
  41600. t.a4 = 719;
  41601. t.a5 = 789;
  41602. t.a119 = 790;
  41603. t.a118 = 791;
  41604. t.a117 = 690;
  41605. t.a11 = 960;
  41606. t.a12 = 939;
  41607. t.a13 = 549;
  41608. t.a14 = 855;
  41609. t.a15 = 911;
  41610. t.a16 = 933;
  41611. t.a105 = 911;
  41612. t.a17 = 945;
  41613. t.a18 = 974;
  41614. t.a19 = 755;
  41615. t.a20 = 846;
  41616. t.a21 = 762;
  41617. t.a22 = 761;
  41618. t.a23 = 571;
  41619. t.a24 = 677;
  41620. t.a25 = 763;
  41621. t.a26 = 760;
  41622. t.a27 = 759;
  41623. t.a28 = 754;
  41624. t.a6 = 494;
  41625. t.a7 = 552;
  41626. t.a8 = 537;
  41627. t.a9 = 577;
  41628. t.a10 = 692;
  41629. t.a29 = 786;
  41630. t.a30 = 788;
  41631. t.a31 = 788;
  41632. t.a32 = 790;
  41633. t.a33 = 793;
  41634. t.a34 = 794;
  41635. t.a35 = 816;
  41636. t.a36 = 823;
  41637. t.a37 = 789;
  41638. t.a38 = 841;
  41639. t.a39 = 823;
  41640. t.a40 = 833;
  41641. t.a41 = 816;
  41642. t.a42 = 831;
  41643. t.a43 = 923;
  41644. t.a44 = 744;
  41645. t.a45 = 723;
  41646. t.a46 = 749;
  41647. t.a47 = 790;
  41648. t.a48 = 792;
  41649. t.a49 = 695;
  41650. t.a50 = 776;
  41651. t.a51 = 768;
  41652. t.a52 = 792;
  41653. t.a53 = 759;
  41654. t.a54 = 707;
  41655. t.a55 = 708;
  41656. t.a56 = 682;
  41657. t.a57 = 701;
  41658. t.a58 = 826;
  41659. t.a59 = 815;
  41660. t.a60 = 789;
  41661. t.a61 = 789;
  41662. t.a62 = 707;
  41663. t.a63 = 687;
  41664. t.a64 = 696;
  41665. t.a65 = 689;
  41666. t.a66 = 786;
  41667. t.a67 = 787;
  41668. t.a68 = 713;
  41669. t.a69 = 791;
  41670. t.a70 = 785;
  41671. t.a71 = 791;
  41672. t.a72 = 873;
  41673. t.a73 = 761;
  41674. t.a74 = 762;
  41675. t.a203 = 762;
  41676. t.a75 = 759;
  41677. t.a204 = 759;
  41678. t.a76 = 892;
  41679. t.a77 = 892;
  41680. t.a78 = 788;
  41681. t.a79 = 784;
  41682. t.a81 = 438;
  41683. t.a82 = 138;
  41684. t.a83 = 277;
  41685. t.a84 = 415;
  41686. t.a97 = 392;
  41687. t.a98 = 392;
  41688. t.a99 = 668;
  41689. t.a100 = 668;
  41690. t.a89 = 390;
  41691. t.a90 = 390;
  41692. t.a93 = 317;
  41693. t.a94 = 317;
  41694. t.a91 = 276;
  41695. t.a92 = 276;
  41696. t.a205 = 509;
  41697. t.a85 = 509;
  41698. t.a206 = 410;
  41699. t.a86 = 410;
  41700. t.a87 = 234;
  41701. t.a88 = 234;
  41702. t.a95 = 334;
  41703. t.a96 = 334;
  41704. t.a101 = 732;
  41705. t.a102 = 544;
  41706. t.a103 = 544;
  41707. t.a104 = 910;
  41708. t.a106 = 667;
  41709. t.a107 = 760;
  41710. t.a108 = 760;
  41711. t.a112 = 776;
  41712. t.a111 = 595;
  41713. t.a110 = 694;
  41714. t.a109 = 626;
  41715. t.a120 = 788;
  41716. t.a121 = 788;
  41717. t.a122 = 788;
  41718. t.a123 = 788;
  41719. t.a124 = 788;
  41720. t.a125 = 788;
  41721. t.a126 = 788;
  41722. t.a127 = 788;
  41723. t.a128 = 788;
  41724. t.a129 = 788;
  41725. t.a130 = 788;
  41726. t.a131 = 788;
  41727. t.a132 = 788;
  41728. t.a133 = 788;
  41729. t.a134 = 788;
  41730. t.a135 = 788;
  41731. t.a136 = 788;
  41732. t.a137 = 788;
  41733. t.a138 = 788;
  41734. t.a139 = 788;
  41735. t.a140 = 788;
  41736. t.a141 = 788;
  41737. t.a142 = 788;
  41738. t.a143 = 788;
  41739. t.a144 = 788;
  41740. t.a145 = 788;
  41741. t.a146 = 788;
  41742. t.a147 = 788;
  41743. t.a148 = 788;
  41744. t.a149 = 788;
  41745. t.a150 = 788;
  41746. t.a151 = 788;
  41747. t.a152 = 788;
  41748. t.a153 = 788;
  41749. t.a154 = 788;
  41750. t.a155 = 788;
  41751. t.a156 = 788;
  41752. t.a157 = 788;
  41753. t.a158 = 788;
  41754. t.a159 = 788;
  41755. t.a160 = 894;
  41756. t.a161 = 838;
  41757. t.a163 = 1016;
  41758. t.a164 = 458;
  41759. t.a196 = 748;
  41760. t.a165 = 924;
  41761. t.a192 = 748;
  41762. t.a166 = 918;
  41763. t.a167 = 927;
  41764. t.a168 = 928;
  41765. t.a169 = 928;
  41766. t.a170 = 834;
  41767. t.a171 = 873;
  41768. t.a172 = 828;
  41769. t.a173 = 924;
  41770. t.a162 = 924;
  41771. t.a174 = 917;
  41772. t.a175 = 930;
  41773. t.a176 = 931;
  41774. t.a177 = 463;
  41775. t.a178 = 883;
  41776. t.a179 = 836;
  41777. t.a193 = 836;
  41778. t.a180 = 867;
  41779. t.a199 = 867;
  41780. t.a181 = 696;
  41781. t.a200 = 696;
  41782. t.a182 = 874;
  41783. t.a201 = 874;
  41784. t.a183 = 760;
  41785. t.a184 = 946;
  41786. t.a197 = 771;
  41787. t.a185 = 865;
  41788. t.a194 = 771;
  41789. t.a198 = 888;
  41790. t.a186 = 967;
  41791. t.a195 = 888;
  41792. t.a187 = 831;
  41793. t.a188 = 873;
  41794. t.a189 = 927;
  41795. t.a190 = 970;
  41796. t.a191 = 918;
  41797. });
  41798. });
  41799. exports.getMetrics = getMetrics;
  41800. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41801. t.Courier = {
  41802. ascent: 629,
  41803. descent: -157,
  41804. capHeight: 562,
  41805. xHeight: -426
  41806. };
  41807. t["Courier-Bold"] = {
  41808. ascent: 629,
  41809. descent: -157,
  41810. capHeight: 562,
  41811. xHeight: 439
  41812. };
  41813. t["Courier-Oblique"] = {
  41814. ascent: 629,
  41815. descent: -157,
  41816. capHeight: 562,
  41817. xHeight: 426
  41818. };
  41819. t["Courier-BoldOblique"] = {
  41820. ascent: 629,
  41821. descent: -157,
  41822. capHeight: 562,
  41823. xHeight: 426
  41824. };
  41825. t.Helvetica = {
  41826. ascent: 718,
  41827. descent: -207,
  41828. capHeight: 718,
  41829. xHeight: 523
  41830. };
  41831. t["Helvetica-Bold"] = {
  41832. ascent: 718,
  41833. descent: -207,
  41834. capHeight: 718,
  41835. xHeight: 532
  41836. };
  41837. t["Helvetica-Oblique"] = {
  41838. ascent: 718,
  41839. descent: -207,
  41840. capHeight: 718,
  41841. xHeight: 523
  41842. };
  41843. t["Helvetica-BoldOblique"] = {
  41844. ascent: 718,
  41845. descent: -207,
  41846. capHeight: 718,
  41847. xHeight: 532
  41848. };
  41849. t["Times-Roman"] = {
  41850. ascent: 683,
  41851. descent: -217,
  41852. capHeight: 662,
  41853. xHeight: 450
  41854. };
  41855. t["Times-Bold"] = {
  41856. ascent: 683,
  41857. descent: -217,
  41858. capHeight: 676,
  41859. xHeight: 461
  41860. };
  41861. t["Times-Italic"] = {
  41862. ascent: 683,
  41863. descent: -217,
  41864. capHeight: 653,
  41865. xHeight: 441
  41866. };
  41867. t["Times-BoldItalic"] = {
  41868. ascent: 683,
  41869. descent: -217,
  41870. capHeight: 669,
  41871. xHeight: 462
  41872. };
  41873. t.Symbol = {
  41874. ascent: Math.NaN,
  41875. descent: Math.NaN,
  41876. capHeight: Math.NaN,
  41877. xHeight: Math.NaN
  41878. };
  41879. t.ZapfDingbats = {
  41880. ascent: Math.NaN,
  41881. descent: Math.NaN,
  41882. capHeight: Math.NaN,
  41883. xHeight: Math.NaN
  41884. };
  41885. });
  41886. exports.getFontBasicMetrics = getFontBasicMetrics;
  41887. /***/ }),
  41888. /* 44 */
  41889. /***/ ((__unused_webpack_module, exports) => {
  41890. Object.defineProperty(exports, "__esModule", ({
  41891. value: true
  41892. }));
  41893. exports.GlyfTable = void 0;
  41894. const ON_CURVE_POINT = 1 << 0;
  41895. const X_SHORT_VECTOR = 1 << 1;
  41896. const Y_SHORT_VECTOR = 1 << 2;
  41897. const REPEAT_FLAG = 1 << 3;
  41898. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  41899. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  41900. const OVERLAP_SIMPLE = 1 << 6;
  41901. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  41902. const ARGS_ARE_XY_VALUES = 1 << 1;
  41903. const WE_HAVE_A_SCALE = 1 << 3;
  41904. const MORE_COMPONENTS = 1 << 5;
  41905. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  41906. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  41907. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  41908. class GlyfTable {
  41909. constructor({
  41910. glyfTable,
  41911. isGlyphLocationsLong,
  41912. locaTable,
  41913. numGlyphs
  41914. }) {
  41915. this.glyphs = [];
  41916. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  41917. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  41918. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  41919. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  41920. let pos = 0;
  41921. for (let i = 0; i < numGlyphs; i++) {
  41922. pos += offsetSize;
  41923. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  41924. if (next === prev) {
  41925. this.glyphs.push(new Glyph({}));
  41926. continue;
  41927. }
  41928. const glyph = Glyph.parse(prev, glyf);
  41929. this.glyphs.push(glyph);
  41930. prev = next;
  41931. }
  41932. }
  41933. getSize() {
  41934. return this.glyphs.reduce((a, g) => {
  41935. const size = g.getSize();
  41936. return a + (size + 3 & ~3);
  41937. }, 0);
  41938. }
  41939. write() {
  41940. const totalSize = this.getSize();
  41941. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  41942. const isLocationLong = totalSize > 0x1fffe;
  41943. const offsetSize = isLocationLong ? 4 : 2;
  41944. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  41945. if (isLocationLong) {
  41946. locaTable.setUint32(0, 0);
  41947. } else {
  41948. locaTable.setUint16(0, 0);
  41949. }
  41950. let pos = 0;
  41951. let locaIndex = 0;
  41952. for (const glyph of this.glyphs) {
  41953. pos += glyph.write(pos, glyfTable);
  41954. pos = pos + 3 & ~3;
  41955. locaIndex += offsetSize;
  41956. if (isLocationLong) {
  41957. locaTable.setUint32(locaIndex, pos);
  41958. } else {
  41959. locaTable.setUint16(locaIndex, pos >> 1);
  41960. }
  41961. }
  41962. return {
  41963. isLocationLong,
  41964. loca: new Uint8Array(locaTable.buffer),
  41965. glyf: new Uint8Array(glyfTable.buffer)
  41966. };
  41967. }
  41968. scale(factors) {
  41969. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  41970. this.glyphs[i].scale(factors[i]);
  41971. }
  41972. }
  41973. }
  41974. exports.GlyfTable = GlyfTable;
  41975. class Glyph {
  41976. constructor({
  41977. header = null,
  41978. simple = null,
  41979. composites = null
  41980. }) {
  41981. this.header = header;
  41982. this.simple = simple;
  41983. this.composites = composites;
  41984. }
  41985. static parse(pos, glyf) {
  41986. const [read, header] = GlyphHeader.parse(pos, glyf);
  41987. pos += read;
  41988. if (header.numberOfContours < 0) {
  41989. const composites = [];
  41990. while (true) {
  41991. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  41992. pos += n;
  41993. composites.push(composite);
  41994. if (!(composite.flags & MORE_COMPONENTS)) {
  41995. break;
  41996. }
  41997. }
  41998. return new Glyph({
  41999. header,
  42000. composites
  42001. });
  42002. }
  42003. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  42004. return new Glyph({
  42005. header,
  42006. simple
  42007. });
  42008. }
  42009. getSize() {
  42010. if (!this.header) {
  42011. return 0;
  42012. }
  42013. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  42014. return this.header.getSize() + size;
  42015. }
  42016. write(pos, buf) {
  42017. if (!this.header) {
  42018. return 0;
  42019. }
  42020. const spos = pos;
  42021. pos += this.header.write(pos, buf);
  42022. if (this.simple) {
  42023. pos += this.simple.write(pos, buf);
  42024. } else {
  42025. for (const composite of this.composites) {
  42026. pos += composite.write(pos, buf);
  42027. }
  42028. }
  42029. return pos - spos;
  42030. }
  42031. scale(factor) {
  42032. if (!this.header) {
  42033. return;
  42034. }
  42035. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  42036. this.header.scale(xMiddle, factor);
  42037. if (this.simple) {
  42038. this.simple.scale(xMiddle, factor);
  42039. } else {
  42040. for (const composite of this.composites) {
  42041. composite.scale(xMiddle, factor);
  42042. }
  42043. }
  42044. }
  42045. }
  42046. class GlyphHeader {
  42047. constructor({
  42048. numberOfContours,
  42049. xMin,
  42050. yMin,
  42051. xMax,
  42052. yMax
  42053. }) {
  42054. this.numberOfContours = numberOfContours;
  42055. this.xMin = xMin;
  42056. this.yMin = yMin;
  42057. this.xMax = xMax;
  42058. this.yMax = yMax;
  42059. }
  42060. static parse(pos, glyf) {
  42061. return [10, new GlyphHeader({
  42062. numberOfContours: glyf.getInt16(pos),
  42063. xMin: glyf.getInt16(pos + 2),
  42064. yMin: glyf.getInt16(pos + 4),
  42065. xMax: glyf.getInt16(pos + 6),
  42066. yMax: glyf.getInt16(pos + 8)
  42067. })];
  42068. }
  42069. getSize() {
  42070. return 10;
  42071. }
  42072. write(pos, buf) {
  42073. buf.setInt16(pos, this.numberOfContours);
  42074. buf.setInt16(pos + 2, this.xMin);
  42075. buf.setInt16(pos + 4, this.yMin);
  42076. buf.setInt16(pos + 6, this.xMax);
  42077. buf.setInt16(pos + 8, this.yMax);
  42078. return 10;
  42079. }
  42080. scale(x, factor) {
  42081. this.xMin = Math.round(x + (this.xMin - x) * factor);
  42082. this.xMax = Math.round(x + (this.xMax - x) * factor);
  42083. }
  42084. }
  42085. class Contour {
  42086. constructor({
  42087. flags,
  42088. xCoordinates,
  42089. yCoordinates
  42090. }) {
  42091. this.xCoordinates = xCoordinates;
  42092. this.yCoordinates = yCoordinates;
  42093. this.flags = flags;
  42094. }
  42095. }
  42096. class SimpleGlyph {
  42097. constructor({
  42098. contours,
  42099. instructions
  42100. }) {
  42101. this.contours = contours;
  42102. this.instructions = instructions;
  42103. }
  42104. static parse(pos, glyf, numberOfContours) {
  42105. const endPtsOfContours = [];
  42106. for (let i = 0; i < numberOfContours; i++) {
  42107. const endPt = glyf.getUint16(pos);
  42108. pos += 2;
  42109. endPtsOfContours.push(endPt);
  42110. }
  42111. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  42112. const instructionLength = glyf.getUint16(pos);
  42113. pos += 2;
  42114. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  42115. pos += instructionLength;
  42116. const flags = [];
  42117. for (let i = 0; i < numberOfPt; pos++, i++) {
  42118. let flag = glyf.getUint8(pos);
  42119. flags.push(flag);
  42120. if (flag & REPEAT_FLAG) {
  42121. const count = glyf.getUint8(++pos);
  42122. flag ^= REPEAT_FLAG;
  42123. for (let m = 0; m < count; m++) {
  42124. flags.push(flag);
  42125. }
  42126. i += count;
  42127. }
  42128. }
  42129. const allXCoordinates = [];
  42130. let xCoordinates = [];
  42131. let yCoordinates = [];
  42132. let pointFlags = [];
  42133. const contours = [];
  42134. let endPtsOfContoursIndex = 0;
  42135. let lastCoordinate = 0;
  42136. for (let i = 0; i < numberOfPt; i++) {
  42137. const flag = flags[i];
  42138. if (flag & X_SHORT_VECTOR) {
  42139. const x = glyf.getUint8(pos++);
  42140. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  42141. xCoordinates.push(lastCoordinate);
  42142. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  42143. xCoordinates.push(lastCoordinate);
  42144. } else {
  42145. lastCoordinate += glyf.getInt16(pos);
  42146. pos += 2;
  42147. xCoordinates.push(lastCoordinate);
  42148. }
  42149. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  42150. endPtsOfContoursIndex++;
  42151. allXCoordinates.push(xCoordinates);
  42152. xCoordinates = [];
  42153. }
  42154. }
  42155. lastCoordinate = 0;
  42156. endPtsOfContoursIndex = 0;
  42157. for (let i = 0; i < numberOfPt; i++) {
  42158. const flag = flags[i];
  42159. if (flag & Y_SHORT_VECTOR) {
  42160. const y = glyf.getUint8(pos++);
  42161. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  42162. yCoordinates.push(lastCoordinate);
  42163. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  42164. yCoordinates.push(lastCoordinate);
  42165. } else {
  42166. lastCoordinate += glyf.getInt16(pos);
  42167. pos += 2;
  42168. yCoordinates.push(lastCoordinate);
  42169. }
  42170. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  42171. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  42172. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  42173. endPtsOfContoursIndex++;
  42174. contours.push(new Contour({
  42175. flags: pointFlags,
  42176. xCoordinates,
  42177. yCoordinates
  42178. }));
  42179. yCoordinates = [];
  42180. pointFlags = [];
  42181. }
  42182. }
  42183. return new SimpleGlyph({
  42184. contours,
  42185. instructions
  42186. });
  42187. }
  42188. getSize() {
  42189. let size = this.contours.length * 2 + 2 + this.instructions.length;
  42190. let lastX = 0;
  42191. let lastY = 0;
  42192. for (const contour of this.contours) {
  42193. size += contour.flags.length;
  42194. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42195. const x = contour.xCoordinates[i];
  42196. const y = contour.yCoordinates[i];
  42197. let abs = Math.abs(x - lastX);
  42198. if (abs > 255) {
  42199. size += 2;
  42200. } else if (abs > 0) {
  42201. size += 1;
  42202. }
  42203. lastX = x;
  42204. abs = Math.abs(y - lastY);
  42205. if (abs > 255) {
  42206. size += 2;
  42207. } else if (abs > 0) {
  42208. size += 1;
  42209. }
  42210. lastY = y;
  42211. }
  42212. }
  42213. return size;
  42214. }
  42215. write(pos, buf) {
  42216. const spos = pos;
  42217. const xCoordinates = [];
  42218. const yCoordinates = [];
  42219. const flags = [];
  42220. let lastX = 0;
  42221. let lastY = 0;
  42222. for (const contour of this.contours) {
  42223. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42224. let flag = contour.flags[i];
  42225. const x = contour.xCoordinates[i];
  42226. let delta = x - lastX;
  42227. if (delta === 0) {
  42228. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  42229. xCoordinates.push(0);
  42230. } else {
  42231. const abs = Math.abs(delta);
  42232. if (abs <= 255) {
  42233. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  42234. xCoordinates.push(abs);
  42235. } else {
  42236. xCoordinates.push(delta);
  42237. }
  42238. }
  42239. lastX = x;
  42240. const y = contour.yCoordinates[i];
  42241. delta = y - lastY;
  42242. if (delta === 0) {
  42243. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  42244. yCoordinates.push(0);
  42245. } else {
  42246. const abs = Math.abs(delta);
  42247. if (abs <= 255) {
  42248. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  42249. yCoordinates.push(abs);
  42250. } else {
  42251. yCoordinates.push(delta);
  42252. }
  42253. }
  42254. lastY = y;
  42255. flags.push(flag);
  42256. }
  42257. buf.setUint16(pos, xCoordinates.length - 1);
  42258. pos += 2;
  42259. }
  42260. buf.setUint16(pos, this.instructions.length);
  42261. pos += 2;
  42262. if (this.instructions.length) {
  42263. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42264. pos += this.instructions.length;
  42265. }
  42266. for (const flag of flags) {
  42267. buf.setUint8(pos++, flag);
  42268. }
  42269. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  42270. const x = xCoordinates[i];
  42271. const flag = flags[i];
  42272. if (flag & X_SHORT_VECTOR) {
  42273. buf.setUint8(pos++, x);
  42274. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  42275. buf.setInt16(pos, x);
  42276. pos += 2;
  42277. }
  42278. }
  42279. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  42280. const y = yCoordinates[i];
  42281. const flag = flags[i];
  42282. if (flag & Y_SHORT_VECTOR) {
  42283. buf.setUint8(pos++, y);
  42284. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  42285. buf.setInt16(pos, y);
  42286. pos += 2;
  42287. }
  42288. }
  42289. return pos - spos;
  42290. }
  42291. scale(x, factor) {
  42292. for (const contour of this.contours) {
  42293. if (contour.xCoordinates.length === 0) {
  42294. continue;
  42295. }
  42296. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  42297. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  42298. }
  42299. }
  42300. }
  42301. }
  42302. class CompositeGlyph {
  42303. constructor({
  42304. flags,
  42305. glyphIndex,
  42306. argument1,
  42307. argument2,
  42308. transf,
  42309. instructions
  42310. }) {
  42311. this.flags = flags;
  42312. this.glyphIndex = glyphIndex;
  42313. this.argument1 = argument1;
  42314. this.argument2 = argument2;
  42315. this.transf = transf;
  42316. this.instructions = instructions;
  42317. }
  42318. static parse(pos, glyf) {
  42319. const spos = pos;
  42320. const transf = [];
  42321. let flags = glyf.getUint16(pos);
  42322. const glyphIndex = glyf.getUint16(pos + 2);
  42323. pos += 4;
  42324. let argument1, argument2;
  42325. if (flags & ARG_1_AND_2_ARE_WORDS) {
  42326. if (flags & ARGS_ARE_XY_VALUES) {
  42327. argument1 = glyf.getInt16(pos);
  42328. argument2 = glyf.getInt16(pos + 2);
  42329. } else {
  42330. argument1 = glyf.getUint16(pos);
  42331. argument2 = glyf.getUint16(pos + 2);
  42332. }
  42333. pos += 4;
  42334. flags ^= ARG_1_AND_2_ARE_WORDS;
  42335. } else {
  42336. if (flags & ARGS_ARE_XY_VALUES) {
  42337. argument1 = glyf.getInt8(pos);
  42338. argument2 = glyf.getInt8(pos + 1);
  42339. } else {
  42340. argument1 = glyf.getUint8(pos);
  42341. argument2 = glyf.getUint8(pos + 1);
  42342. }
  42343. pos += 2;
  42344. }
  42345. if (flags & WE_HAVE_A_SCALE) {
  42346. transf.push(glyf.getUint16(pos));
  42347. pos += 2;
  42348. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  42349. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  42350. pos += 4;
  42351. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  42352. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  42353. pos += 8;
  42354. }
  42355. let instructions = null;
  42356. if (flags & WE_HAVE_INSTRUCTIONS) {
  42357. const instructionLength = glyf.getUint16(pos);
  42358. pos += 2;
  42359. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  42360. pos += instructionLength;
  42361. }
  42362. return [pos - spos, new CompositeGlyph({
  42363. flags,
  42364. glyphIndex,
  42365. argument1,
  42366. argument2,
  42367. transf,
  42368. instructions
  42369. })];
  42370. }
  42371. getSize() {
  42372. let size = 2 + 2 + this.transf.length * 2;
  42373. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42374. size += 2 + this.instructions.length;
  42375. }
  42376. size += 2;
  42377. if (this.flags & 2) {
  42378. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42379. size += 2;
  42380. }
  42381. } else {
  42382. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42383. size += 2;
  42384. }
  42385. }
  42386. return size;
  42387. }
  42388. write(pos, buf) {
  42389. const spos = pos;
  42390. if (this.flags & ARGS_ARE_XY_VALUES) {
  42391. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42392. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42393. }
  42394. } else {
  42395. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42396. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42397. }
  42398. }
  42399. buf.setUint16(pos, this.flags);
  42400. buf.setUint16(pos + 2, this.glyphIndex);
  42401. pos += 4;
  42402. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  42403. if (this.flags & ARGS_ARE_XY_VALUES) {
  42404. buf.setInt16(pos, this.argument1);
  42405. buf.setInt16(pos + 2, this.argument2);
  42406. } else {
  42407. buf.setUint16(pos, this.argument1);
  42408. buf.setUint16(pos + 2, this.argument2);
  42409. }
  42410. pos += 4;
  42411. } else {
  42412. buf.setUint8(pos, this.argument1);
  42413. buf.setUint8(pos + 1, this.argument2);
  42414. pos += 2;
  42415. }
  42416. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42417. buf.setUint16(pos, this.instructions.length);
  42418. pos += 2;
  42419. if (this.instructions.length) {
  42420. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42421. pos += this.instructions.length;
  42422. }
  42423. }
  42424. return pos - spos;
  42425. }
  42426. scale(x, factor) {}
  42427. }
  42428. /***/ }),
  42429. /* 45 */
  42430. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42431. Object.defineProperty(exports, "__esModule", ({
  42432. value: true
  42433. }));
  42434. exports.OpenTypeFileBuilder = void 0;
  42435. var _core_utils = __w_pdfjs_require__(4);
  42436. var _util = __w_pdfjs_require__(2);
  42437. function writeInt16(dest, offset, num) {
  42438. dest[offset] = num >> 8 & 0xff;
  42439. dest[offset + 1] = num & 0xff;
  42440. }
  42441. function writeInt32(dest, offset, num) {
  42442. dest[offset] = num >> 24 & 0xff;
  42443. dest[offset + 1] = num >> 16 & 0xff;
  42444. dest[offset + 2] = num >> 8 & 0xff;
  42445. dest[offset + 3] = num & 0xff;
  42446. }
  42447. function writeData(dest, offset, data) {
  42448. if (data instanceof Uint8Array) {
  42449. dest.set(data, offset);
  42450. } else if (typeof data === "string") {
  42451. for (let i = 0, ii = data.length; i < ii; i++) {
  42452. dest[offset++] = data.charCodeAt(i) & 0xff;
  42453. }
  42454. } else {
  42455. for (const num of data) {
  42456. dest[offset++] = num & 0xff;
  42457. }
  42458. }
  42459. }
  42460. const OTF_HEADER_SIZE = 12;
  42461. const OTF_TABLE_ENTRY_SIZE = 16;
  42462. class OpenTypeFileBuilder {
  42463. constructor(sfnt) {
  42464. this.sfnt = sfnt;
  42465. this.tables = Object.create(null);
  42466. }
  42467. static getSearchParams(entriesCount, entrySize) {
  42468. let maxPower2 = 1,
  42469. log2 = 0;
  42470. while ((maxPower2 ^ entriesCount) > maxPower2) {
  42471. maxPower2 <<= 1;
  42472. log2++;
  42473. }
  42474. const searchRange = maxPower2 * entrySize;
  42475. return {
  42476. range: searchRange,
  42477. entry: log2,
  42478. rangeShift: entrySize * entriesCount - searchRange
  42479. };
  42480. }
  42481. toArray() {
  42482. let sfnt = this.sfnt;
  42483. const tables = this.tables;
  42484. const tablesNames = Object.keys(tables);
  42485. tablesNames.sort();
  42486. const numTables = tablesNames.length;
  42487. let i, j, jj, table, tableName;
  42488. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  42489. const tableOffsets = [offset];
  42490. for (i = 0; i < numTables; i++) {
  42491. table = tables[tablesNames[i]];
  42492. const paddedLength = (table.length + 3 & ~3) >>> 0;
  42493. offset += paddedLength;
  42494. tableOffsets.push(offset);
  42495. }
  42496. const file = new Uint8Array(offset);
  42497. for (i = 0; i < numTables; i++) {
  42498. table = tables[tablesNames[i]];
  42499. writeData(file, tableOffsets[i], table);
  42500. }
  42501. if (sfnt === "true") {
  42502. sfnt = (0, _util.string32)(0x00010000);
  42503. }
  42504. file[0] = sfnt.charCodeAt(0) & 0xff;
  42505. file[1] = sfnt.charCodeAt(1) & 0xff;
  42506. file[2] = sfnt.charCodeAt(2) & 0xff;
  42507. file[3] = sfnt.charCodeAt(3) & 0xff;
  42508. writeInt16(file, 4, numTables);
  42509. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  42510. writeInt16(file, 6, searchParams.range);
  42511. writeInt16(file, 8, searchParams.entry);
  42512. writeInt16(file, 10, searchParams.rangeShift);
  42513. offset = OTF_HEADER_SIZE;
  42514. for (i = 0; i < numTables; i++) {
  42515. tableName = tablesNames[i];
  42516. file[offset] = tableName.charCodeAt(0) & 0xff;
  42517. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  42518. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  42519. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  42520. let checksum = 0;
  42521. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  42522. const quad = (0, _core_utils.readUint32)(file, j);
  42523. checksum = checksum + quad >>> 0;
  42524. }
  42525. writeInt32(file, offset + 4, checksum);
  42526. writeInt32(file, offset + 8, tableOffsets[i]);
  42527. writeInt32(file, offset + 12, tables[tableName].length);
  42528. offset += OTF_TABLE_ENTRY_SIZE;
  42529. }
  42530. return file;
  42531. }
  42532. addTable(tag, data) {
  42533. if (tag in this.tables) {
  42534. throw new Error("Table " + tag + " already exists");
  42535. }
  42536. this.tables[tag] = data;
  42537. }
  42538. }
  42539. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  42540. /***/ }),
  42541. /* 46 */
  42542. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42543. Object.defineProperty(exports, "__esModule", ({
  42544. value: true
  42545. }));
  42546. exports.Type1Font = void 0;
  42547. var _cff_parser = __w_pdfjs_require__(33);
  42548. var _util = __w_pdfjs_require__(2);
  42549. var _fonts_utils = __w_pdfjs_require__(36);
  42550. var _core_utils = __w_pdfjs_require__(4);
  42551. var _stream = __w_pdfjs_require__(8);
  42552. var _type1_parser = __w_pdfjs_require__(47);
  42553. function findBlock(streamBytes, signature, startIndex) {
  42554. const streamBytesLength = streamBytes.length;
  42555. const signatureLength = signature.length;
  42556. const scanLength = streamBytesLength - signatureLength;
  42557. let i = startIndex,
  42558. found = false;
  42559. while (i < scanLength) {
  42560. let j = 0;
  42561. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42562. j++;
  42563. }
  42564. if (j >= signatureLength) {
  42565. i += j;
  42566. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  42567. i++;
  42568. }
  42569. found = true;
  42570. break;
  42571. }
  42572. i++;
  42573. }
  42574. return {
  42575. found,
  42576. length: i
  42577. };
  42578. }
  42579. function getHeaderBlock(stream, suggestedLength) {
  42580. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  42581. const streamStartPos = stream.pos;
  42582. let headerBytes, headerBytesLength, block;
  42583. try {
  42584. headerBytes = stream.getBytes(suggestedLength);
  42585. headerBytesLength = headerBytes.length;
  42586. } catch (ex) {}
  42587. if (headerBytesLength === suggestedLength) {
  42588. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42589. if (block.found && block.length === suggestedLength) {
  42590. return {
  42591. stream: new _stream.Stream(headerBytes),
  42592. length: suggestedLength
  42593. };
  42594. }
  42595. }
  42596. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  42597. stream.pos = streamStartPos;
  42598. const SCAN_BLOCK_LENGTH = 2048;
  42599. let actualLength;
  42600. while (true) {
  42601. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42602. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42603. if (block.length === 0) {
  42604. break;
  42605. }
  42606. stream.pos += block.length;
  42607. if (block.found) {
  42608. actualLength = stream.pos - streamStartPos;
  42609. break;
  42610. }
  42611. }
  42612. stream.pos = streamStartPos;
  42613. if (actualLength) {
  42614. return {
  42615. stream: new _stream.Stream(stream.getBytes(actualLength)),
  42616. length: actualLength
  42617. };
  42618. }
  42619. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  42620. return {
  42621. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  42622. length: suggestedLength
  42623. };
  42624. }
  42625. function getEexecBlock(stream, suggestedLength) {
  42626. const eexecBytes = stream.getBytes();
  42627. if (eexecBytes.length === 0) {
  42628. throw new _util.FormatError("getEexecBlock - no font program found.");
  42629. }
  42630. return {
  42631. stream: new _stream.Stream(eexecBytes),
  42632. length: eexecBytes.length
  42633. };
  42634. }
  42635. class Type1Font {
  42636. constructor(name, file, properties) {
  42637. const PFB_HEADER_SIZE = 6;
  42638. let headerBlockLength = properties.length1;
  42639. let eexecBlockLength = properties.length2;
  42640. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42641. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42642. if (pfbHeaderPresent) {
  42643. file.skip(PFB_HEADER_SIZE);
  42644. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42645. }
  42646. const headerBlock = getHeaderBlock(file, headerBlockLength);
  42647. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42648. headerBlockParser.extractFontHeader(properties);
  42649. if (pfbHeaderPresent) {
  42650. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42651. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42652. }
  42653. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  42654. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42655. const data = eexecBlockParser.extractFontProgram(properties);
  42656. for (const key in data.properties) {
  42657. properties[key] = data.properties[key];
  42658. }
  42659. const charstrings = data.charstrings;
  42660. const type2Charstrings = this.getType2Charstrings(charstrings);
  42661. const subrs = this.getType2Subrs(data.subrs);
  42662. this.charstrings = charstrings;
  42663. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42664. this.seacs = this.getSeacs(data.charstrings);
  42665. }
  42666. get numGlyphs() {
  42667. return this.charstrings.length + 1;
  42668. }
  42669. getCharset() {
  42670. const charset = [".notdef"];
  42671. for (const {
  42672. glyphName
  42673. } of this.charstrings) {
  42674. charset.push(glyphName);
  42675. }
  42676. return charset;
  42677. }
  42678. getGlyphMapping(properties) {
  42679. const charstrings = this.charstrings;
  42680. if (properties.composite) {
  42681. const charCodeToGlyphId = Object.create(null);
  42682. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  42683. const charCode = properties.cMap.charCodeOf(glyphId);
  42684. charCodeToGlyphId[charCode] = glyphId + 1;
  42685. }
  42686. return charCodeToGlyphId;
  42687. }
  42688. const glyphNames = [".notdef"];
  42689. let builtInEncoding, glyphId;
  42690. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42691. glyphNames.push(charstrings[glyphId].glyphName);
  42692. }
  42693. const encoding = properties.builtInEncoding;
  42694. if (encoding) {
  42695. builtInEncoding = Object.create(null);
  42696. for (const charCode in encoding) {
  42697. glyphId = glyphNames.indexOf(encoding[charCode]);
  42698. if (glyphId >= 0) {
  42699. builtInEncoding[charCode] = glyphId;
  42700. }
  42701. }
  42702. }
  42703. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  42704. }
  42705. hasGlyphId(id) {
  42706. if (id < 0 || id >= this.numGlyphs) {
  42707. return false;
  42708. }
  42709. if (id === 0) {
  42710. return true;
  42711. }
  42712. const glyph = this.charstrings[id - 1];
  42713. return glyph.charstring.length > 0;
  42714. }
  42715. getSeacs(charstrings) {
  42716. const seacMap = [];
  42717. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  42718. const charstring = charstrings[i];
  42719. if (charstring.seac) {
  42720. seacMap[i + 1] = charstring.seac;
  42721. }
  42722. }
  42723. return seacMap;
  42724. }
  42725. getType2Charstrings(type1Charstrings) {
  42726. const type2Charstrings = [];
  42727. for (const type1Charstring of type1Charstrings) {
  42728. type2Charstrings.push(type1Charstring.charstring);
  42729. }
  42730. return type2Charstrings;
  42731. }
  42732. getType2Subrs(type1Subrs) {
  42733. let bias = 0;
  42734. const count = type1Subrs.length;
  42735. if (count < 1133) {
  42736. bias = 107;
  42737. } else if (count < 33769) {
  42738. bias = 1131;
  42739. } else {
  42740. bias = 32768;
  42741. }
  42742. const type2Subrs = [];
  42743. let i;
  42744. for (i = 0; i < bias; i++) {
  42745. type2Subrs.push([0x0b]);
  42746. }
  42747. for (i = 0; i < count; i++) {
  42748. type2Subrs.push(type1Subrs[i]);
  42749. }
  42750. return type2Subrs;
  42751. }
  42752. wrap(name, glyphs, charstrings, subrs, properties) {
  42753. const cff = new _cff_parser.CFF();
  42754. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  42755. cff.names = [name];
  42756. const topDict = new _cff_parser.CFFTopDict();
  42757. topDict.setByName("version", 391);
  42758. topDict.setByName("Notice", 392);
  42759. topDict.setByName("FullName", 393);
  42760. topDict.setByName("FamilyName", 394);
  42761. topDict.setByName("Weight", 395);
  42762. topDict.setByName("Encoding", null);
  42763. topDict.setByName("FontMatrix", properties.fontMatrix);
  42764. topDict.setByName("FontBBox", properties.bbox);
  42765. topDict.setByName("charset", null);
  42766. topDict.setByName("CharStrings", null);
  42767. topDict.setByName("Private", null);
  42768. cff.topDict = topDict;
  42769. const strings = new _cff_parser.CFFStrings();
  42770. strings.add("Version 0.11");
  42771. strings.add("See original notice");
  42772. strings.add(name);
  42773. strings.add(name);
  42774. strings.add("Medium");
  42775. cff.strings = strings;
  42776. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  42777. const count = glyphs.length;
  42778. const charsetArray = [".notdef"];
  42779. let i, ii;
  42780. for (i = 0; i < count; i++) {
  42781. const glyphName = charstrings[i].glyphName;
  42782. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  42783. if (index === -1) {
  42784. strings.add(glyphName);
  42785. }
  42786. charsetArray.push(glyphName);
  42787. }
  42788. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  42789. const charStringsIndex = new _cff_parser.CFFIndex();
  42790. charStringsIndex.add([0x8b, 0x0e]);
  42791. for (i = 0; i < count; i++) {
  42792. charStringsIndex.add(glyphs[i]);
  42793. }
  42794. cff.charStrings = charStringsIndex;
  42795. const privateDict = new _cff_parser.CFFPrivateDict();
  42796. privateDict.setByName("Subrs", null);
  42797. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  42798. for (i = 0, ii = fields.length; i < ii; i++) {
  42799. const field = fields[i];
  42800. if (!(field in properties.privateData)) {
  42801. continue;
  42802. }
  42803. const value = properties.privateData[field];
  42804. if (Array.isArray(value)) {
  42805. for (let j = value.length - 1; j > 0; j--) {
  42806. value[j] -= value[j - 1];
  42807. }
  42808. }
  42809. privateDict.setByName(field, value);
  42810. }
  42811. cff.topDict.privateDict = privateDict;
  42812. const subrIndex = new _cff_parser.CFFIndex();
  42813. for (i = 0, ii = subrs.length; i < ii; i++) {
  42814. subrIndex.add(subrs[i]);
  42815. }
  42816. privateDict.subrsIndex = subrIndex;
  42817. const compiler = new _cff_parser.CFFCompiler(cff);
  42818. return compiler.compile();
  42819. }
  42820. }
  42821. exports.Type1Font = Type1Font;
  42822. /***/ }),
  42823. /* 47 */
  42824. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42825. Object.defineProperty(exports, "__esModule", ({
  42826. value: true
  42827. }));
  42828. exports.Type1Parser = void 0;
  42829. var _encodings = __w_pdfjs_require__(35);
  42830. var _core_utils = __w_pdfjs_require__(4);
  42831. var _stream = __w_pdfjs_require__(8);
  42832. var _util = __w_pdfjs_require__(2);
  42833. const HINTING_ENABLED = false;
  42834. const COMMAND_MAP = {
  42835. hstem: [1],
  42836. vstem: [3],
  42837. vmoveto: [4],
  42838. rlineto: [5],
  42839. hlineto: [6],
  42840. vlineto: [7],
  42841. rrcurveto: [8],
  42842. callsubr: [10],
  42843. flex: [12, 35],
  42844. drop: [12, 18],
  42845. endchar: [14],
  42846. rmoveto: [21],
  42847. hmoveto: [22],
  42848. vhcurveto: [30],
  42849. hvcurveto: [31]
  42850. };
  42851. class Type1CharString {
  42852. constructor() {
  42853. this.width = 0;
  42854. this.lsb = 0;
  42855. this.flexing = false;
  42856. this.output = [];
  42857. this.stack = [];
  42858. }
  42859. convert(encoded, subrs, seacAnalysisEnabled) {
  42860. const count = encoded.length;
  42861. let error = false;
  42862. let wx, sbx, subrNumber;
  42863. for (let i = 0; i < count; i++) {
  42864. let value = encoded[i];
  42865. if (value < 32) {
  42866. if (value === 12) {
  42867. value = (value << 8) + encoded[++i];
  42868. }
  42869. switch (value) {
  42870. case 1:
  42871. if (!HINTING_ENABLED) {
  42872. this.stack = [];
  42873. break;
  42874. }
  42875. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42876. break;
  42877. case 3:
  42878. if (!HINTING_ENABLED) {
  42879. this.stack = [];
  42880. break;
  42881. }
  42882. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42883. break;
  42884. case 4:
  42885. if (this.flexing) {
  42886. if (this.stack.length < 1) {
  42887. error = true;
  42888. break;
  42889. }
  42890. const dy = this.stack.pop();
  42891. this.stack.push(0, dy);
  42892. break;
  42893. }
  42894. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  42895. break;
  42896. case 5:
  42897. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  42898. break;
  42899. case 6:
  42900. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  42901. break;
  42902. case 7:
  42903. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  42904. break;
  42905. case 8:
  42906. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  42907. break;
  42908. case 9:
  42909. this.stack = [];
  42910. break;
  42911. case 10:
  42912. if (this.stack.length < 1) {
  42913. error = true;
  42914. break;
  42915. }
  42916. subrNumber = this.stack.pop();
  42917. if (!subrs[subrNumber]) {
  42918. error = true;
  42919. break;
  42920. }
  42921. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  42922. break;
  42923. case 11:
  42924. return error;
  42925. case 13:
  42926. if (this.stack.length < 2) {
  42927. error = true;
  42928. break;
  42929. }
  42930. wx = this.stack.pop();
  42931. sbx = this.stack.pop();
  42932. this.lsb = sbx;
  42933. this.width = wx;
  42934. this.stack.push(wx, sbx);
  42935. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  42936. break;
  42937. case 14:
  42938. this.output.push(COMMAND_MAP.endchar[0]);
  42939. break;
  42940. case 21:
  42941. if (this.flexing) {
  42942. break;
  42943. }
  42944. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  42945. break;
  42946. case 22:
  42947. if (this.flexing) {
  42948. this.stack.push(0);
  42949. break;
  42950. }
  42951. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  42952. break;
  42953. case 30:
  42954. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  42955. break;
  42956. case 31:
  42957. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  42958. break;
  42959. case (12 << 8) + 0:
  42960. this.stack = [];
  42961. break;
  42962. case (12 << 8) + 1:
  42963. if (!HINTING_ENABLED) {
  42964. this.stack = [];
  42965. break;
  42966. }
  42967. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42968. break;
  42969. case (12 << 8) + 2:
  42970. if (!HINTING_ENABLED) {
  42971. this.stack = [];
  42972. break;
  42973. }
  42974. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42975. break;
  42976. case (12 << 8) + 6:
  42977. if (seacAnalysisEnabled) {
  42978. const asb = this.stack.at(-5);
  42979. this.seac = this.stack.splice(-4, 4);
  42980. this.seac[0] += this.lsb - asb;
  42981. error = this.executeCommand(0, COMMAND_MAP.endchar);
  42982. } else {
  42983. error = this.executeCommand(4, COMMAND_MAP.endchar);
  42984. }
  42985. break;
  42986. case (12 << 8) + 7:
  42987. if (this.stack.length < 4) {
  42988. error = true;
  42989. break;
  42990. }
  42991. this.stack.pop();
  42992. wx = this.stack.pop();
  42993. const sby = this.stack.pop();
  42994. sbx = this.stack.pop();
  42995. this.lsb = sbx;
  42996. this.width = wx;
  42997. this.stack.push(wx, sbx, sby);
  42998. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  42999. break;
  43000. case (12 << 8) + 12:
  43001. if (this.stack.length < 2) {
  43002. error = true;
  43003. break;
  43004. }
  43005. const num2 = this.stack.pop();
  43006. const num1 = this.stack.pop();
  43007. this.stack.push(num1 / num2);
  43008. break;
  43009. case (12 << 8) + 16:
  43010. if (this.stack.length < 2) {
  43011. error = true;
  43012. break;
  43013. }
  43014. subrNumber = this.stack.pop();
  43015. const numArgs = this.stack.pop();
  43016. if (subrNumber === 0 && numArgs === 3) {
  43017. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  43018. 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]);
  43019. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  43020. this.flexing = false;
  43021. this.stack.push(flexArgs[15], flexArgs[16]);
  43022. } else if (subrNumber === 1 && numArgs === 0) {
  43023. this.flexing = true;
  43024. }
  43025. break;
  43026. case (12 << 8) + 17:
  43027. break;
  43028. case (12 << 8) + 33:
  43029. this.stack = [];
  43030. break;
  43031. default:
  43032. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  43033. break;
  43034. }
  43035. if (error) {
  43036. break;
  43037. }
  43038. continue;
  43039. } else if (value <= 246) {
  43040. value -= 139;
  43041. } else if (value <= 250) {
  43042. value = (value - 247) * 256 + encoded[++i] + 108;
  43043. } else if (value <= 254) {
  43044. value = -((value - 251) * 256) - encoded[++i] - 108;
  43045. } else {
  43046. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  43047. }
  43048. this.stack.push(value);
  43049. }
  43050. return error;
  43051. }
  43052. executeCommand(howManyArgs, command, keepStack) {
  43053. const stackLength = this.stack.length;
  43054. if (howManyArgs > stackLength) {
  43055. return true;
  43056. }
  43057. const start = stackLength - howManyArgs;
  43058. for (let i = start; i < stackLength; i++) {
  43059. let value = this.stack[i];
  43060. if (Number.isInteger(value)) {
  43061. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  43062. } else {
  43063. value = 65536 * value | 0;
  43064. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  43065. }
  43066. }
  43067. this.output.push(...command);
  43068. if (keepStack) {
  43069. this.stack.splice(start, howManyArgs);
  43070. } else {
  43071. this.stack.length = 0;
  43072. }
  43073. return false;
  43074. }
  43075. }
  43076. const EEXEC_ENCRYPT_KEY = 55665;
  43077. const CHAR_STRS_ENCRYPT_KEY = 4330;
  43078. function isHexDigit(code) {
  43079. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  43080. }
  43081. function decrypt(data, key, discardNumber) {
  43082. if (discardNumber >= data.length) {
  43083. return new Uint8Array(0);
  43084. }
  43085. const c1 = 52845,
  43086. c2 = 22719;
  43087. let r = key | 0,
  43088. i,
  43089. j;
  43090. for (i = 0; i < discardNumber; i++) {
  43091. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  43092. }
  43093. const count = data.length - discardNumber;
  43094. const decrypted = new Uint8Array(count);
  43095. for (i = discardNumber, j = 0; j < count; i++, j++) {
  43096. const value = data[i];
  43097. decrypted[j] = value ^ r >> 8;
  43098. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  43099. }
  43100. return decrypted;
  43101. }
  43102. function decryptAscii(data, key, discardNumber) {
  43103. const c1 = 52845,
  43104. c2 = 22719;
  43105. let r = key | 0;
  43106. const count = data.length,
  43107. maybeLength = count >>> 1;
  43108. const decrypted = new Uint8Array(maybeLength);
  43109. let i, j;
  43110. for (i = 0, j = 0; i < count; i++) {
  43111. const digit1 = data[i];
  43112. if (!isHexDigit(digit1)) {
  43113. continue;
  43114. }
  43115. i++;
  43116. let digit2;
  43117. while (i < count && !isHexDigit(digit2 = data[i])) {
  43118. i++;
  43119. }
  43120. if (i < count) {
  43121. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  43122. decrypted[j++] = value ^ r >> 8;
  43123. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  43124. }
  43125. }
  43126. return decrypted.slice(discardNumber, j);
  43127. }
  43128. function isSpecial(c) {
  43129. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  43130. }
  43131. class Type1Parser {
  43132. constructor(stream, encrypted, seacAnalysisEnabled) {
  43133. if (encrypted) {
  43134. const data = stream.getBytes();
  43135. 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]));
  43136. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  43137. }
  43138. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  43139. this.stream = stream;
  43140. this.nextChar();
  43141. }
  43142. readNumberArray() {
  43143. this.getToken();
  43144. const array = [];
  43145. while (true) {
  43146. const token = this.getToken();
  43147. if (token === null || token === "]" || token === "}") {
  43148. break;
  43149. }
  43150. array.push(parseFloat(token || 0));
  43151. }
  43152. return array;
  43153. }
  43154. readNumber() {
  43155. const token = this.getToken();
  43156. return parseFloat(token || 0);
  43157. }
  43158. readInt() {
  43159. const token = this.getToken();
  43160. return parseInt(token || 0, 10) | 0;
  43161. }
  43162. readBoolean() {
  43163. const token = this.getToken();
  43164. return token === "true" ? 1 : 0;
  43165. }
  43166. nextChar() {
  43167. return this.currentChar = this.stream.getByte();
  43168. }
  43169. prevChar() {
  43170. this.stream.skip(-2);
  43171. return this.currentChar = this.stream.getByte();
  43172. }
  43173. getToken() {
  43174. let comment = false;
  43175. let ch = this.currentChar;
  43176. while (true) {
  43177. if (ch === -1) {
  43178. return null;
  43179. }
  43180. if (comment) {
  43181. if (ch === 0x0a || ch === 0x0d) {
  43182. comment = false;
  43183. }
  43184. } else if (ch === 0x25) {
  43185. comment = true;
  43186. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  43187. break;
  43188. }
  43189. ch = this.nextChar();
  43190. }
  43191. if (isSpecial(ch)) {
  43192. this.nextChar();
  43193. return String.fromCharCode(ch);
  43194. }
  43195. let token = "";
  43196. do {
  43197. token += String.fromCharCode(ch);
  43198. ch = this.nextChar();
  43199. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  43200. return token;
  43201. }
  43202. readCharStrings(bytes, lenIV) {
  43203. if (lenIV === -1) {
  43204. return bytes;
  43205. }
  43206. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  43207. }
  43208. extractFontProgram(properties) {
  43209. const stream = this.stream;
  43210. const subrs = [],
  43211. charstrings = [];
  43212. const privateData = Object.create(null);
  43213. privateData.lenIV = 4;
  43214. const program = {
  43215. subrs: [],
  43216. charstrings: [],
  43217. properties: {
  43218. privateData
  43219. }
  43220. };
  43221. let token, length, data, lenIV;
  43222. while ((token = this.getToken()) !== null) {
  43223. if (token !== "/") {
  43224. continue;
  43225. }
  43226. token = this.getToken();
  43227. switch (token) {
  43228. case "CharStrings":
  43229. this.getToken();
  43230. this.getToken();
  43231. this.getToken();
  43232. this.getToken();
  43233. while (true) {
  43234. token = this.getToken();
  43235. if (token === null || token === "end") {
  43236. break;
  43237. }
  43238. if (token !== "/") {
  43239. continue;
  43240. }
  43241. const glyph = this.getToken();
  43242. length = this.readInt();
  43243. this.getToken();
  43244. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  43245. lenIV = program.properties.privateData.lenIV;
  43246. const encoded = this.readCharStrings(data, lenIV);
  43247. this.nextChar();
  43248. token = this.getToken();
  43249. if (token === "noaccess") {
  43250. this.getToken();
  43251. } else if (token === "/") {
  43252. this.prevChar();
  43253. }
  43254. charstrings.push({
  43255. glyph,
  43256. encoded
  43257. });
  43258. }
  43259. break;
  43260. case "Subrs":
  43261. this.readInt();
  43262. this.getToken();
  43263. while (this.getToken() === "dup") {
  43264. const index = this.readInt();
  43265. length = this.readInt();
  43266. this.getToken();
  43267. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  43268. lenIV = program.properties.privateData.lenIV;
  43269. const encoded = this.readCharStrings(data, lenIV);
  43270. this.nextChar();
  43271. token = this.getToken();
  43272. if (token === "noaccess") {
  43273. this.getToken();
  43274. }
  43275. subrs[index] = encoded;
  43276. }
  43277. break;
  43278. case "BlueValues":
  43279. case "OtherBlues":
  43280. case "FamilyBlues":
  43281. case "FamilyOtherBlues":
  43282. const blueArray = this.readNumberArray();
  43283. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  43284. program.properties.privateData[token] = blueArray;
  43285. }
  43286. break;
  43287. case "StemSnapH":
  43288. case "StemSnapV":
  43289. program.properties.privateData[token] = this.readNumberArray();
  43290. break;
  43291. case "StdHW":
  43292. case "StdVW":
  43293. program.properties.privateData[token] = this.readNumberArray()[0];
  43294. break;
  43295. case "BlueShift":
  43296. case "lenIV":
  43297. case "BlueFuzz":
  43298. case "BlueScale":
  43299. case "LanguageGroup":
  43300. program.properties.privateData[token] = this.readNumber();
  43301. break;
  43302. case "ExpansionFactor":
  43303. program.properties.privateData[token] = this.readNumber() || 0.06;
  43304. break;
  43305. case "ForceBold":
  43306. program.properties.privateData[token] = this.readBoolean();
  43307. break;
  43308. }
  43309. }
  43310. for (const {
  43311. encoded,
  43312. glyph
  43313. } of charstrings) {
  43314. const charString = new Type1CharString();
  43315. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  43316. let output = charString.output;
  43317. if (error) {
  43318. output = [14];
  43319. }
  43320. const charStringObject = {
  43321. glyphName: glyph,
  43322. charstring: output,
  43323. width: charString.width,
  43324. lsb: charString.lsb,
  43325. seac: charString.seac
  43326. };
  43327. if (glyph === ".notdef") {
  43328. program.charstrings.unshift(charStringObject);
  43329. } else {
  43330. program.charstrings.push(charStringObject);
  43331. }
  43332. if (properties.builtInEncoding) {
  43333. const index = properties.builtInEncoding.indexOf(glyph);
  43334. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  43335. properties.widths[index] = charString.width;
  43336. }
  43337. }
  43338. }
  43339. return program;
  43340. }
  43341. extractFontHeader(properties) {
  43342. let token;
  43343. while ((token = this.getToken()) !== null) {
  43344. if (token !== "/") {
  43345. continue;
  43346. }
  43347. token = this.getToken();
  43348. switch (token) {
  43349. case "FontMatrix":
  43350. const matrix = this.readNumberArray();
  43351. properties.fontMatrix = matrix;
  43352. break;
  43353. case "Encoding":
  43354. const encodingArg = this.getToken();
  43355. let encoding;
  43356. if (!/^\d+$/.test(encodingArg)) {
  43357. encoding = (0, _encodings.getEncoding)(encodingArg);
  43358. } else {
  43359. encoding = [];
  43360. const size = parseInt(encodingArg, 10) | 0;
  43361. this.getToken();
  43362. for (let j = 0; j < size; j++) {
  43363. token = this.getToken();
  43364. while (token !== "dup" && token !== "def") {
  43365. token = this.getToken();
  43366. if (token === null) {
  43367. return;
  43368. }
  43369. }
  43370. if (token === "def") {
  43371. break;
  43372. }
  43373. const index = this.readInt();
  43374. this.getToken();
  43375. const glyph = this.getToken();
  43376. encoding[index] = glyph;
  43377. this.getToken();
  43378. }
  43379. }
  43380. properties.builtInEncoding = encoding;
  43381. break;
  43382. case "FontBBox":
  43383. const fontBBox = this.readNumberArray();
  43384. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  43385. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  43386. properties.ascentScaled = true;
  43387. break;
  43388. }
  43389. }
  43390. }
  43391. }
  43392. exports.Type1Parser = Type1Parser;
  43393. /***/ }),
  43394. /* 48 */
  43395. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43396. Object.defineProperty(exports, "__esModule", ({
  43397. value: true
  43398. }));
  43399. exports.Pattern = void 0;
  43400. exports.getTilingPatternIR = getTilingPatternIR;
  43401. var _util = __w_pdfjs_require__(2);
  43402. var _base_stream = __w_pdfjs_require__(5);
  43403. var _colorspace = __w_pdfjs_require__(12);
  43404. var _core_utils = __w_pdfjs_require__(4);
  43405. const ShadingType = {
  43406. FUNCTION_BASED: 1,
  43407. AXIAL: 2,
  43408. RADIAL: 3,
  43409. FREE_FORM_MESH: 4,
  43410. LATTICE_FORM_MESH: 5,
  43411. COONS_PATCH_MESH: 6,
  43412. TENSOR_PATCH_MESH: 7
  43413. };
  43414. class Pattern {
  43415. constructor() {
  43416. (0, _util.unreachable)("Cannot initialize Pattern.");
  43417. }
  43418. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  43419. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  43420. const type = dict.get("ShadingType");
  43421. try {
  43422. switch (type) {
  43423. case ShadingType.AXIAL:
  43424. case ShadingType.RADIAL:
  43425. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43426. case ShadingType.FREE_FORM_MESH:
  43427. case ShadingType.LATTICE_FORM_MESH:
  43428. case ShadingType.COONS_PATCH_MESH:
  43429. case ShadingType.TENSOR_PATCH_MESH:
  43430. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43431. default:
  43432. throw new _util.FormatError("Unsupported ShadingType: " + type);
  43433. }
  43434. } catch (ex) {
  43435. if (ex instanceof _core_utils.MissingDataException) {
  43436. throw ex;
  43437. }
  43438. handler.send("UnsupportedFeature", {
  43439. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  43440. });
  43441. (0, _util.warn)(ex);
  43442. return new DummyShading();
  43443. }
  43444. }
  43445. }
  43446. exports.Pattern = Pattern;
  43447. class BaseShading {
  43448. static get SMALL_NUMBER() {
  43449. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  43450. }
  43451. constructor() {
  43452. if (this.constructor === BaseShading) {
  43453. (0, _util.unreachable)("Cannot initialize BaseShading.");
  43454. }
  43455. }
  43456. getIR() {
  43457. (0, _util.unreachable)("Abstract method `getIR` called.");
  43458. }
  43459. }
  43460. class RadialAxialShading extends BaseShading {
  43461. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43462. super();
  43463. this.coordsArr = dict.getArray("Coords");
  43464. this.shadingType = dict.get("ShadingType");
  43465. const cs = _colorspace.ColorSpace.parse({
  43466. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43467. xref,
  43468. resources,
  43469. pdfFunctionFactory,
  43470. localColorSpaceCache
  43471. });
  43472. const bbox = dict.getArray("BBox");
  43473. if (Array.isArray(bbox) && bbox.length === 4) {
  43474. this.bbox = _util.Util.normalizeRect(bbox);
  43475. } else {
  43476. this.bbox = null;
  43477. }
  43478. let t0 = 0.0,
  43479. t1 = 1.0;
  43480. if (dict.has("Domain")) {
  43481. const domainArr = dict.getArray("Domain");
  43482. t0 = domainArr[0];
  43483. t1 = domainArr[1];
  43484. }
  43485. let extendStart = false,
  43486. extendEnd = false;
  43487. if (dict.has("Extend")) {
  43488. const extendArr = dict.getArray("Extend");
  43489. extendStart = extendArr[0];
  43490. extendEnd = extendArr[1];
  43491. }
  43492. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  43493. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  43494. const distance = Math.hypot(x1 - x2, y1 - y2);
  43495. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  43496. (0, _util.warn)("Unsupported radial gradient.");
  43497. }
  43498. }
  43499. this.extendStart = extendStart;
  43500. this.extendEnd = extendEnd;
  43501. const fnObj = dict.getRaw("Function");
  43502. const fn = pdfFunctionFactory.createFromArray(fnObj);
  43503. const NUMBER_OF_SAMPLES = 10;
  43504. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  43505. const colorStops = this.colorStops = [];
  43506. if (t0 >= t1 || step <= 0) {
  43507. (0, _util.info)("Bad shading domain.");
  43508. return;
  43509. }
  43510. const color = new Float32Array(cs.numComps),
  43511. ratio = new Float32Array(1);
  43512. let rgbColor;
  43513. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  43514. ratio[0] = t0 + i * step;
  43515. fn(ratio, 0, color, 0);
  43516. rgbColor = cs.getRgb(color, 0);
  43517. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43518. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  43519. }
  43520. let background = "transparent";
  43521. if (dict.has("Background")) {
  43522. rgbColor = cs.getRgb(dict.get("Background"), 0);
  43523. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43524. }
  43525. if (!extendStart) {
  43526. colorStops.unshift([0, background]);
  43527. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  43528. }
  43529. if (!extendEnd) {
  43530. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  43531. colorStops.push([1, background]);
  43532. }
  43533. this.colorStops = colorStops;
  43534. }
  43535. getIR() {
  43536. const coordsArr = this.coordsArr;
  43537. const shadingType = this.shadingType;
  43538. let type, p0, p1, r0, r1;
  43539. if (shadingType === ShadingType.AXIAL) {
  43540. p0 = [coordsArr[0], coordsArr[1]];
  43541. p1 = [coordsArr[2], coordsArr[3]];
  43542. r0 = null;
  43543. r1 = null;
  43544. type = "axial";
  43545. } else if (shadingType === ShadingType.RADIAL) {
  43546. p0 = [coordsArr[0], coordsArr[1]];
  43547. p1 = [coordsArr[3], coordsArr[4]];
  43548. r0 = coordsArr[2];
  43549. r1 = coordsArr[5];
  43550. type = "radial";
  43551. } else {
  43552. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  43553. }
  43554. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  43555. }
  43556. }
  43557. class MeshStreamReader {
  43558. constructor(stream, context) {
  43559. this.stream = stream;
  43560. this.context = context;
  43561. this.buffer = 0;
  43562. this.bufferLength = 0;
  43563. const numComps = context.numComps;
  43564. this.tmpCompsBuf = new Float32Array(numComps);
  43565. const csNumComps = context.colorSpace.numComps;
  43566. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  43567. }
  43568. get hasData() {
  43569. if (this.stream.end) {
  43570. return this.stream.pos < this.stream.end;
  43571. }
  43572. if (this.bufferLength > 0) {
  43573. return true;
  43574. }
  43575. const nextByte = this.stream.getByte();
  43576. if (nextByte < 0) {
  43577. return false;
  43578. }
  43579. this.buffer = nextByte;
  43580. this.bufferLength = 8;
  43581. return true;
  43582. }
  43583. readBits(n) {
  43584. let buffer = this.buffer;
  43585. let bufferLength = this.bufferLength;
  43586. if (n === 32) {
  43587. if (bufferLength === 0) {
  43588. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  43589. }
  43590. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  43591. const nextByte = this.stream.getByte();
  43592. this.buffer = nextByte & (1 << bufferLength) - 1;
  43593. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  43594. }
  43595. if (n === 8 && bufferLength === 0) {
  43596. return this.stream.getByte();
  43597. }
  43598. while (bufferLength < n) {
  43599. buffer = buffer << 8 | this.stream.getByte();
  43600. bufferLength += 8;
  43601. }
  43602. bufferLength -= n;
  43603. this.bufferLength = bufferLength;
  43604. this.buffer = buffer & (1 << bufferLength) - 1;
  43605. return buffer >> bufferLength;
  43606. }
  43607. align() {
  43608. this.buffer = 0;
  43609. this.bufferLength = 0;
  43610. }
  43611. readFlag() {
  43612. return this.readBits(this.context.bitsPerFlag);
  43613. }
  43614. readCoordinate() {
  43615. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  43616. const xi = this.readBits(bitsPerCoordinate);
  43617. const yi = this.readBits(bitsPerCoordinate);
  43618. const decode = this.context.decode;
  43619. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  43620. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  43621. }
  43622. readComponents() {
  43623. const numComps = this.context.numComps;
  43624. const bitsPerComponent = this.context.bitsPerComponent;
  43625. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  43626. const decode = this.context.decode;
  43627. const components = this.tmpCompsBuf;
  43628. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  43629. const ci = this.readBits(bitsPerComponent);
  43630. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  43631. }
  43632. const color = this.tmpCsCompsBuf;
  43633. if (this.context.colorFn) {
  43634. this.context.colorFn(components, 0, color, 0);
  43635. }
  43636. return this.context.colorSpace.getRgb(color, 0);
  43637. }
  43638. }
  43639. const getB = function getBClosure() {
  43640. function buildB(count) {
  43641. const lut = [];
  43642. for (let i = 0; i <= count; i++) {
  43643. const t = i / count,
  43644. t_ = 1 - t;
  43645. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  43646. }
  43647. return lut;
  43648. }
  43649. const cache = [];
  43650. return function (count) {
  43651. if (!cache[count]) {
  43652. cache[count] = buildB(count);
  43653. }
  43654. return cache[count];
  43655. };
  43656. }();
  43657. class MeshShading extends BaseShading {
  43658. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43659. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  43660. }
  43661. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43662. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  43663. }
  43664. static get TRIANGLE_DENSITY() {
  43665. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  43666. }
  43667. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43668. super();
  43669. if (!(stream instanceof _base_stream.BaseStream)) {
  43670. throw new _util.FormatError("Mesh data is not a stream");
  43671. }
  43672. const dict = stream.dict;
  43673. this.shadingType = dict.get("ShadingType");
  43674. const bbox = dict.getArray("BBox");
  43675. if (Array.isArray(bbox) && bbox.length === 4) {
  43676. this.bbox = _util.Util.normalizeRect(bbox);
  43677. } else {
  43678. this.bbox = null;
  43679. }
  43680. const cs = _colorspace.ColorSpace.parse({
  43681. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43682. xref,
  43683. resources,
  43684. pdfFunctionFactory,
  43685. localColorSpaceCache
  43686. });
  43687. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  43688. const fnObj = dict.getRaw("Function");
  43689. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  43690. this.coords = [];
  43691. this.colors = [];
  43692. this.figures = [];
  43693. const decodeContext = {
  43694. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  43695. bitsPerComponent: dict.get("BitsPerComponent"),
  43696. bitsPerFlag: dict.get("BitsPerFlag"),
  43697. decode: dict.getArray("Decode"),
  43698. colorFn: fn,
  43699. colorSpace: cs,
  43700. numComps: fn ? 1 : cs.numComps
  43701. };
  43702. const reader = new MeshStreamReader(stream, decodeContext);
  43703. let patchMesh = false;
  43704. switch (this.shadingType) {
  43705. case ShadingType.FREE_FORM_MESH:
  43706. this._decodeType4Shading(reader);
  43707. break;
  43708. case ShadingType.LATTICE_FORM_MESH:
  43709. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  43710. if (verticesPerRow < 2) {
  43711. throw new _util.FormatError("Invalid VerticesPerRow");
  43712. }
  43713. this._decodeType5Shading(reader, verticesPerRow);
  43714. break;
  43715. case ShadingType.COONS_PATCH_MESH:
  43716. this._decodeType6Shading(reader);
  43717. patchMesh = true;
  43718. break;
  43719. case ShadingType.TENSOR_PATCH_MESH:
  43720. this._decodeType7Shading(reader);
  43721. patchMesh = true;
  43722. break;
  43723. default:
  43724. (0, _util.unreachable)("Unsupported mesh type.");
  43725. break;
  43726. }
  43727. if (patchMesh) {
  43728. this._updateBounds();
  43729. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  43730. this._buildFigureFromPatch(i);
  43731. }
  43732. }
  43733. this._updateBounds();
  43734. this._packData();
  43735. }
  43736. _decodeType4Shading(reader) {
  43737. const coords = this.coords;
  43738. const colors = this.colors;
  43739. const operators = [];
  43740. const ps = [];
  43741. let verticesLeft = 0;
  43742. while (reader.hasData) {
  43743. const f = reader.readFlag();
  43744. const coord = reader.readCoordinate();
  43745. const color = reader.readComponents();
  43746. if (verticesLeft === 0) {
  43747. if (!(0 <= f && f <= 2)) {
  43748. throw new _util.FormatError("Unknown type4 flag");
  43749. }
  43750. switch (f) {
  43751. case 0:
  43752. verticesLeft = 3;
  43753. break;
  43754. case 1:
  43755. ps.push(ps.at(-2), ps.at(-1));
  43756. verticesLeft = 1;
  43757. break;
  43758. case 2:
  43759. ps.push(ps.at(-3), ps.at(-1));
  43760. verticesLeft = 1;
  43761. break;
  43762. }
  43763. operators.push(f);
  43764. }
  43765. ps.push(coords.length);
  43766. coords.push(coord);
  43767. colors.push(color);
  43768. verticesLeft--;
  43769. reader.align();
  43770. }
  43771. this.figures.push({
  43772. type: "triangles",
  43773. coords: new Int32Array(ps),
  43774. colors: new Int32Array(ps)
  43775. });
  43776. }
  43777. _decodeType5Shading(reader, verticesPerRow) {
  43778. const coords = this.coords;
  43779. const colors = this.colors;
  43780. const ps = [];
  43781. while (reader.hasData) {
  43782. const coord = reader.readCoordinate();
  43783. const color = reader.readComponents();
  43784. ps.push(coords.length);
  43785. coords.push(coord);
  43786. colors.push(color);
  43787. }
  43788. this.figures.push({
  43789. type: "lattice",
  43790. coords: new Int32Array(ps),
  43791. colors: new Int32Array(ps),
  43792. verticesPerRow
  43793. });
  43794. }
  43795. _decodeType6Shading(reader) {
  43796. const coords = this.coords;
  43797. const colors = this.colors;
  43798. const ps = new Int32Array(16);
  43799. const cs = new Int32Array(4);
  43800. while (reader.hasData) {
  43801. const f = reader.readFlag();
  43802. if (!(0 <= f && f <= 3)) {
  43803. throw new _util.FormatError("Unknown type6 flag");
  43804. }
  43805. const pi = coords.length;
  43806. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  43807. coords.push(reader.readCoordinate());
  43808. }
  43809. const ci = colors.length;
  43810. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43811. colors.push(reader.readComponents());
  43812. }
  43813. let tmp1, tmp2, tmp3, tmp4;
  43814. switch (f) {
  43815. case 0:
  43816. ps[12] = pi + 3;
  43817. ps[13] = pi + 4;
  43818. ps[14] = pi + 5;
  43819. ps[15] = pi + 6;
  43820. ps[8] = pi + 2;
  43821. ps[11] = pi + 7;
  43822. ps[4] = pi + 1;
  43823. ps[7] = pi + 8;
  43824. ps[0] = pi;
  43825. ps[1] = pi + 11;
  43826. ps[2] = pi + 10;
  43827. ps[3] = pi + 9;
  43828. cs[2] = ci + 1;
  43829. cs[3] = ci + 2;
  43830. cs[0] = ci;
  43831. cs[1] = ci + 3;
  43832. break;
  43833. case 1:
  43834. tmp1 = ps[12];
  43835. tmp2 = ps[13];
  43836. tmp3 = ps[14];
  43837. tmp4 = ps[15];
  43838. ps[12] = tmp4;
  43839. ps[13] = pi + 0;
  43840. ps[14] = pi + 1;
  43841. ps[15] = pi + 2;
  43842. ps[8] = tmp3;
  43843. ps[11] = pi + 3;
  43844. ps[4] = tmp2;
  43845. ps[7] = pi + 4;
  43846. ps[0] = tmp1;
  43847. ps[1] = pi + 7;
  43848. ps[2] = pi + 6;
  43849. ps[3] = pi + 5;
  43850. tmp1 = cs[2];
  43851. tmp2 = cs[3];
  43852. cs[2] = tmp2;
  43853. cs[3] = ci;
  43854. cs[0] = tmp1;
  43855. cs[1] = ci + 1;
  43856. break;
  43857. case 2:
  43858. tmp1 = ps[15];
  43859. tmp2 = ps[11];
  43860. ps[12] = ps[3];
  43861. ps[13] = pi + 0;
  43862. ps[14] = pi + 1;
  43863. ps[15] = pi + 2;
  43864. ps[8] = ps[7];
  43865. ps[11] = pi + 3;
  43866. ps[4] = tmp2;
  43867. ps[7] = pi + 4;
  43868. ps[0] = tmp1;
  43869. ps[1] = pi + 7;
  43870. ps[2] = pi + 6;
  43871. ps[3] = pi + 5;
  43872. tmp1 = cs[3];
  43873. cs[2] = cs[1];
  43874. cs[3] = ci;
  43875. cs[0] = tmp1;
  43876. cs[1] = ci + 1;
  43877. break;
  43878. case 3:
  43879. ps[12] = ps[0];
  43880. ps[13] = pi + 0;
  43881. ps[14] = pi + 1;
  43882. ps[15] = pi + 2;
  43883. ps[8] = ps[1];
  43884. ps[11] = pi + 3;
  43885. ps[4] = ps[2];
  43886. ps[7] = pi + 4;
  43887. ps[0] = ps[3];
  43888. ps[1] = pi + 7;
  43889. ps[2] = pi + 6;
  43890. ps[3] = pi + 5;
  43891. cs[2] = cs[0];
  43892. cs[3] = ci;
  43893. cs[0] = cs[1];
  43894. cs[1] = ci + 1;
  43895. break;
  43896. }
  43897. ps[5] = coords.length;
  43898. 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]);
  43899. ps[6] = coords.length;
  43900. 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]);
  43901. ps[9] = coords.length;
  43902. 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]);
  43903. ps[10] = coords.length;
  43904. 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]);
  43905. this.figures.push({
  43906. type: "patch",
  43907. coords: new Int32Array(ps),
  43908. colors: new Int32Array(cs)
  43909. });
  43910. }
  43911. }
  43912. _decodeType7Shading(reader) {
  43913. const coords = this.coords;
  43914. const colors = this.colors;
  43915. const ps = new Int32Array(16);
  43916. const cs = new Int32Array(4);
  43917. while (reader.hasData) {
  43918. const f = reader.readFlag();
  43919. if (!(0 <= f && f <= 3)) {
  43920. throw new _util.FormatError("Unknown type7 flag");
  43921. }
  43922. const pi = coords.length;
  43923. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  43924. coords.push(reader.readCoordinate());
  43925. }
  43926. const ci = colors.length;
  43927. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43928. colors.push(reader.readComponents());
  43929. }
  43930. let tmp1, tmp2, tmp3, tmp4;
  43931. switch (f) {
  43932. case 0:
  43933. ps[12] = pi + 3;
  43934. ps[13] = pi + 4;
  43935. ps[14] = pi + 5;
  43936. ps[15] = pi + 6;
  43937. ps[8] = pi + 2;
  43938. ps[9] = pi + 13;
  43939. ps[10] = pi + 14;
  43940. ps[11] = pi + 7;
  43941. ps[4] = pi + 1;
  43942. ps[5] = pi + 12;
  43943. ps[6] = pi + 15;
  43944. ps[7] = pi + 8;
  43945. ps[0] = pi;
  43946. ps[1] = pi + 11;
  43947. ps[2] = pi + 10;
  43948. ps[3] = pi + 9;
  43949. cs[2] = ci + 1;
  43950. cs[3] = ci + 2;
  43951. cs[0] = ci;
  43952. cs[1] = ci + 3;
  43953. break;
  43954. case 1:
  43955. tmp1 = ps[12];
  43956. tmp2 = ps[13];
  43957. tmp3 = ps[14];
  43958. tmp4 = ps[15];
  43959. ps[12] = tmp4;
  43960. ps[13] = pi + 0;
  43961. ps[14] = pi + 1;
  43962. ps[15] = pi + 2;
  43963. ps[8] = tmp3;
  43964. ps[9] = pi + 9;
  43965. ps[10] = pi + 10;
  43966. ps[11] = pi + 3;
  43967. ps[4] = tmp2;
  43968. ps[5] = pi + 8;
  43969. ps[6] = pi + 11;
  43970. ps[7] = pi + 4;
  43971. ps[0] = tmp1;
  43972. ps[1] = pi + 7;
  43973. ps[2] = pi + 6;
  43974. ps[3] = pi + 5;
  43975. tmp1 = cs[2];
  43976. tmp2 = cs[3];
  43977. cs[2] = tmp2;
  43978. cs[3] = ci;
  43979. cs[0] = tmp1;
  43980. cs[1] = ci + 1;
  43981. break;
  43982. case 2:
  43983. tmp1 = ps[15];
  43984. tmp2 = ps[11];
  43985. ps[12] = ps[3];
  43986. ps[13] = pi + 0;
  43987. ps[14] = pi + 1;
  43988. ps[15] = pi + 2;
  43989. ps[8] = ps[7];
  43990. ps[9] = pi + 9;
  43991. ps[10] = pi + 10;
  43992. ps[11] = pi + 3;
  43993. ps[4] = tmp2;
  43994. ps[5] = pi + 8;
  43995. ps[6] = pi + 11;
  43996. ps[7] = pi + 4;
  43997. ps[0] = tmp1;
  43998. ps[1] = pi + 7;
  43999. ps[2] = pi + 6;
  44000. ps[3] = pi + 5;
  44001. tmp1 = cs[3];
  44002. cs[2] = cs[1];
  44003. cs[3] = ci;
  44004. cs[0] = tmp1;
  44005. cs[1] = ci + 1;
  44006. break;
  44007. case 3:
  44008. ps[12] = ps[0];
  44009. ps[13] = pi + 0;
  44010. ps[14] = pi + 1;
  44011. ps[15] = pi + 2;
  44012. ps[8] = ps[1];
  44013. ps[9] = pi + 9;
  44014. ps[10] = pi + 10;
  44015. ps[11] = pi + 3;
  44016. ps[4] = ps[2];
  44017. ps[5] = pi + 8;
  44018. ps[6] = pi + 11;
  44019. ps[7] = pi + 4;
  44020. ps[0] = ps[3];
  44021. ps[1] = pi + 7;
  44022. ps[2] = pi + 6;
  44023. ps[3] = pi + 5;
  44024. cs[2] = cs[0];
  44025. cs[3] = ci;
  44026. cs[0] = cs[1];
  44027. cs[1] = ci + 1;
  44028. break;
  44029. }
  44030. this.figures.push({
  44031. type: "patch",
  44032. coords: new Int32Array(ps),
  44033. colors: new Int32Array(cs)
  44034. });
  44035. }
  44036. }
  44037. _buildFigureFromPatch(index) {
  44038. const figure = this.figures[index];
  44039. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  44040. const coords = this.coords,
  44041. colors = this.colors;
  44042. const pi = figure.coords;
  44043. const ci = figure.colors;
  44044. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  44045. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  44046. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  44047. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  44048. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  44049. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  44050. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  44051. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  44052. const verticesPerRow = splitXBy + 1;
  44053. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  44054. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  44055. let k = 0;
  44056. const cl = new Uint8Array(3),
  44057. cr = new Uint8Array(3);
  44058. const c0 = colors[ci[0]],
  44059. c1 = colors[ci[1]],
  44060. c2 = colors[ci[2]],
  44061. c3 = colors[ci[3]];
  44062. const bRow = getB(splitYBy),
  44063. bCol = getB(splitXBy);
  44064. for (let row = 0; row <= splitYBy; row++) {
  44065. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  44066. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  44067. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  44068. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  44069. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  44070. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  44071. for (let col = 0; col <= splitXBy; col++, k++) {
  44072. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  44073. continue;
  44074. }
  44075. let x = 0,
  44076. y = 0;
  44077. let q = 0;
  44078. for (let i = 0; i <= 3; i++) {
  44079. for (let j = 0; j <= 3; j++, q++) {
  44080. const m = bRow[row][i] * bCol[col][j];
  44081. x += coords[pi[q]][0] * m;
  44082. y += coords[pi[q]][1] * m;
  44083. }
  44084. }
  44085. figureCoords[k] = coords.length;
  44086. coords.push([x, y]);
  44087. figureColors[k] = colors.length;
  44088. const newColor = new Uint8Array(3);
  44089. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  44090. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  44091. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  44092. colors.push(newColor);
  44093. }
  44094. }
  44095. figureCoords[0] = pi[0];
  44096. figureColors[0] = ci[0];
  44097. figureCoords[splitXBy] = pi[3];
  44098. figureColors[splitXBy] = ci[1];
  44099. figureCoords[verticesPerRow * splitYBy] = pi[12];
  44100. figureColors[verticesPerRow * splitYBy] = ci[2];
  44101. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  44102. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  44103. this.figures[index] = {
  44104. type: "lattice",
  44105. coords: figureCoords,
  44106. colors: figureColors,
  44107. verticesPerRow
  44108. };
  44109. }
  44110. _updateBounds() {
  44111. let minX = this.coords[0][0],
  44112. minY = this.coords[0][1],
  44113. maxX = minX,
  44114. maxY = minY;
  44115. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  44116. const x = this.coords[i][0],
  44117. y = this.coords[i][1];
  44118. minX = minX > x ? x : minX;
  44119. minY = minY > y ? y : minY;
  44120. maxX = maxX < x ? x : maxX;
  44121. maxY = maxY < y ? y : maxY;
  44122. }
  44123. this.bounds = [minX, minY, maxX, maxY];
  44124. }
  44125. _packData() {
  44126. let i, ii, j, jj;
  44127. const coords = this.coords;
  44128. const coordsPacked = new Float32Array(coords.length * 2);
  44129. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  44130. const xy = coords[i];
  44131. coordsPacked[j++] = xy[0];
  44132. coordsPacked[j++] = xy[1];
  44133. }
  44134. this.coords = coordsPacked;
  44135. const colors = this.colors;
  44136. const colorsPacked = new Uint8Array(colors.length * 3);
  44137. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  44138. const c = colors[i];
  44139. colorsPacked[j++] = c[0];
  44140. colorsPacked[j++] = c[1];
  44141. colorsPacked[j++] = c[2];
  44142. }
  44143. this.colors = colorsPacked;
  44144. const figures = this.figures;
  44145. for (i = 0, ii = figures.length; i < ii; i++) {
  44146. const figure = figures[i],
  44147. ps = figure.coords,
  44148. cs = figure.colors;
  44149. for (j = 0, jj = ps.length; j < jj; j++) {
  44150. ps[j] *= 2;
  44151. cs[j] *= 3;
  44152. }
  44153. }
  44154. }
  44155. getIR() {
  44156. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  44157. }
  44158. }
  44159. class DummyShading extends BaseShading {
  44160. getIR() {
  44161. return ["Dummy"];
  44162. }
  44163. }
  44164. function getTilingPatternIR(operatorList, dict, color) {
  44165. const matrix = dict.getArray("Matrix");
  44166. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  44167. const xstep = dict.get("XStep");
  44168. const ystep = dict.get("YStep");
  44169. const paintType = dict.get("PaintType");
  44170. const tilingType = dict.get("TilingType");
  44171. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  44172. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  44173. }
  44174. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  44175. }
  44176. /***/ }),
  44177. /* 49 */
  44178. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44179. Object.defineProperty(exports, "__esModule", ({
  44180. value: true
  44181. }));
  44182. exports.getXfaFontDict = getXfaFontDict;
  44183. exports.getXfaFontName = getXfaFontName;
  44184. var _calibri_factors = __w_pdfjs_require__(50);
  44185. var _primitives = __w_pdfjs_require__(3);
  44186. var _helvetica_factors = __w_pdfjs_require__(51);
  44187. var _liberationsans_widths = __w_pdfjs_require__(52);
  44188. var _myriadpro_factors = __w_pdfjs_require__(53);
  44189. var _segoeui_factors = __w_pdfjs_require__(54);
  44190. var _core_utils = __w_pdfjs_require__(4);
  44191. var _fonts_utils = __w_pdfjs_require__(36);
  44192. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  44193. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  44194. name: "LiberationSans-Regular",
  44195. factors: _myriadpro_factors.MyriadProRegularFactors,
  44196. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44197. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44198. metrics: _myriadpro_factors.MyriadProRegularMetrics
  44199. };
  44200. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  44201. name: "LiberationSans-Bold",
  44202. factors: _myriadpro_factors.MyriadProBoldFactors,
  44203. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44204. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44205. metrics: _myriadpro_factors.MyriadProBoldMetrics
  44206. };
  44207. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  44208. name: "LiberationSans-Italic",
  44209. factors: _myriadpro_factors.MyriadProItalicFactors,
  44210. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44211. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44212. metrics: _myriadpro_factors.MyriadProItalicMetrics
  44213. };
  44214. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  44215. name: "LiberationSans-BoldItalic",
  44216. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  44217. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44218. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44219. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  44220. };
  44221. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  44222. name: "LiberationSans-Regular",
  44223. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44224. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  44225. };
  44226. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  44227. name: "LiberationSans-Bold",
  44228. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44229. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  44230. };
  44231. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  44232. name: "LiberationSans-Italic",
  44233. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44234. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  44235. };
  44236. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  44237. name: "LiberationSans-BoldItalic",
  44238. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44239. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  44240. };
  44241. t["Calibri-Regular"] = {
  44242. name: "LiberationSans-Regular",
  44243. factors: _calibri_factors.CalibriRegularFactors,
  44244. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44245. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44246. metrics: _calibri_factors.CalibriRegularMetrics
  44247. };
  44248. t["Calibri-Bold"] = {
  44249. name: "LiberationSans-Bold",
  44250. factors: _calibri_factors.CalibriBoldFactors,
  44251. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44252. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44253. metrics: _calibri_factors.CalibriBoldMetrics
  44254. };
  44255. t["Calibri-Italic"] = {
  44256. name: "LiberationSans-Italic",
  44257. factors: _calibri_factors.CalibriItalicFactors,
  44258. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44259. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44260. metrics: _calibri_factors.CalibriItalicMetrics
  44261. };
  44262. t["Calibri-BoldItalic"] = {
  44263. name: "LiberationSans-BoldItalic",
  44264. factors: _calibri_factors.CalibriBoldItalicFactors,
  44265. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44266. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44267. metrics: _calibri_factors.CalibriBoldItalicMetrics
  44268. };
  44269. t["Segoeui-Regular"] = {
  44270. name: "LiberationSans-Regular",
  44271. factors: _segoeui_factors.SegoeuiRegularFactors,
  44272. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44273. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44274. metrics: _segoeui_factors.SegoeuiRegularMetrics
  44275. };
  44276. t["Segoeui-Bold"] = {
  44277. name: "LiberationSans-Bold",
  44278. factors: _segoeui_factors.SegoeuiBoldFactors,
  44279. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44280. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44281. metrics: _segoeui_factors.SegoeuiBoldMetrics
  44282. };
  44283. t["Segoeui-Italic"] = {
  44284. name: "LiberationSans-Italic",
  44285. factors: _segoeui_factors.SegoeuiItalicFactors,
  44286. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44287. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44288. metrics: _segoeui_factors.SegoeuiItalicMetrics
  44289. };
  44290. t["Segoeui-BoldItalic"] = {
  44291. name: "LiberationSans-BoldItalic",
  44292. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  44293. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44294. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44295. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  44296. };
  44297. t["Helvetica-Regular"] = t.Helvetica = {
  44298. name: "LiberationSans-Regular",
  44299. factors: _helvetica_factors.HelveticaRegularFactors,
  44300. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  44301. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  44302. metrics: _helvetica_factors.HelveticaRegularMetrics
  44303. };
  44304. t["Helvetica-Bold"] = {
  44305. name: "LiberationSans-Bold",
  44306. factors: _helvetica_factors.HelveticaBoldFactors,
  44307. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  44308. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  44309. metrics: _helvetica_factors.HelveticaBoldMetrics
  44310. };
  44311. t["Helvetica-Italic"] = {
  44312. name: "LiberationSans-Italic",
  44313. factors: _helvetica_factors.HelveticaItalicFactors,
  44314. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  44315. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  44316. metrics: _helvetica_factors.HelveticaItalicMetrics
  44317. };
  44318. t["Helvetica-BoldItalic"] = {
  44319. name: "LiberationSans-BoldItalic",
  44320. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  44321. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  44322. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  44323. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  44324. };
  44325. });
  44326. function getXfaFontName(name) {
  44327. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  44328. const fontMap = getXFAFontMap();
  44329. return fontMap[fontName];
  44330. }
  44331. function getXfaFontWidths(name) {
  44332. const info = getXfaFontName(name);
  44333. if (!info) {
  44334. return null;
  44335. }
  44336. const {
  44337. baseWidths,
  44338. baseMapping,
  44339. factors
  44340. } = info;
  44341. let rescaledBaseWidths;
  44342. if (!factors) {
  44343. rescaledBaseWidths = baseWidths;
  44344. } else {
  44345. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  44346. }
  44347. let currentCode = -2;
  44348. let currentArray;
  44349. const newWidths = [];
  44350. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  44351. if (unicode === -1) {
  44352. continue;
  44353. }
  44354. if (unicode === currentCode + 1) {
  44355. currentArray.push(rescaledBaseWidths[glyphIndex]);
  44356. currentCode += 1;
  44357. } else {
  44358. currentCode = unicode;
  44359. currentArray = [rescaledBaseWidths[glyphIndex]];
  44360. newWidths.push(unicode, currentArray);
  44361. }
  44362. }
  44363. return newWidths;
  44364. }
  44365. function getXfaFontDict(name) {
  44366. const widths = getXfaFontWidths(name);
  44367. const dict = new _primitives.Dict(null);
  44368. dict.set("BaseFont", _primitives.Name.get(name));
  44369. dict.set("Type", _primitives.Name.get("Font"));
  44370. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  44371. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  44372. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  44373. dict.set("W", widths);
  44374. dict.set("FirstChar", widths[0]);
  44375. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  44376. const descriptor = new _primitives.Dict(null);
  44377. dict.set("FontDescriptor", descriptor);
  44378. const systemInfo = new _primitives.Dict(null);
  44379. systemInfo.set("Ordering", "Identity");
  44380. systemInfo.set("Registry", "Adobe");
  44381. systemInfo.set("Supplement", 0);
  44382. dict.set("CIDSystemInfo", systemInfo);
  44383. return dict;
  44384. }
  44385. /***/ }),
  44386. /* 50 */
  44387. /***/ ((__unused_webpack_module, exports) => {
  44388. Object.defineProperty(exports, "__esModule", ({
  44389. value: true
  44390. }));
  44391. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  44392. 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];
  44393. exports.CalibriBoldFactors = CalibriBoldFactors;
  44394. const CalibriBoldMetrics = {
  44395. lineHeight: 1.2207,
  44396. lineGap: 0.2207
  44397. };
  44398. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  44399. 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];
  44400. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  44401. const CalibriBoldItalicMetrics = {
  44402. lineHeight: 1.2207,
  44403. lineGap: 0.2207
  44404. };
  44405. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  44406. 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];
  44407. exports.CalibriItalicFactors = CalibriItalicFactors;
  44408. const CalibriItalicMetrics = {
  44409. lineHeight: 1.2207,
  44410. lineGap: 0.2207
  44411. };
  44412. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  44413. 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];
  44414. exports.CalibriRegularFactors = CalibriRegularFactors;
  44415. const CalibriRegularMetrics = {
  44416. lineHeight: 1.2207,
  44417. lineGap: 0.2207
  44418. };
  44419. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  44420. /***/ }),
  44421. /* 51 */
  44422. /***/ ((__unused_webpack_module, exports) => {
  44423. Object.defineProperty(exports, "__esModule", ({
  44424. value: true
  44425. }));
  44426. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  44427. 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];
  44428. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  44429. const HelveticaBoldMetrics = {
  44430. lineHeight: 1.2,
  44431. lineGap: 0.2
  44432. };
  44433. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  44434. 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];
  44435. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  44436. const HelveticaBoldItalicMetrics = {
  44437. lineHeight: 1.35,
  44438. lineGap: 0.2
  44439. };
  44440. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  44441. 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];
  44442. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  44443. const HelveticaItalicMetrics = {
  44444. lineHeight: 1.35,
  44445. lineGap: 0.2
  44446. };
  44447. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  44448. 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];
  44449. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  44450. const HelveticaRegularMetrics = {
  44451. lineHeight: 1.2,
  44452. lineGap: 0.2
  44453. };
  44454. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  44455. /***/ }),
  44456. /* 52 */
  44457. /***/ ((__unused_webpack_module, exports) => {
  44458. Object.defineProperty(exports, "__esModule", ({
  44459. value: true
  44460. }));
  44461. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  44462. 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];
  44463. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  44464. 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];
  44465. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  44466. 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];
  44467. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  44468. 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];
  44469. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  44470. 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];
  44471. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  44472. 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];
  44473. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  44474. 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];
  44475. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  44476. 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];
  44477. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  44478. /***/ }),
  44479. /* 53 */
  44480. /***/ ((__unused_webpack_module, exports) => {
  44481. Object.defineProperty(exports, "__esModule", ({
  44482. value: true
  44483. }));
  44484. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  44485. 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];
  44486. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  44487. const MyriadProBoldMetrics = {
  44488. lineHeight: 1.2,
  44489. lineGap: 0.2
  44490. };
  44491. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  44492. 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];
  44493. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  44494. const MyriadProBoldItalicMetrics = {
  44495. lineHeight: 1.2,
  44496. lineGap: 0.2
  44497. };
  44498. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  44499. 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];
  44500. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  44501. const MyriadProItalicMetrics = {
  44502. lineHeight: 1.2,
  44503. lineGap: 0.2
  44504. };
  44505. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  44506. 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];
  44507. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  44508. const MyriadProRegularMetrics = {
  44509. lineHeight: 1.2,
  44510. lineGap: 0.2
  44511. };
  44512. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  44513. /***/ }),
  44514. /* 54 */
  44515. /***/ ((__unused_webpack_module, exports) => {
  44516. Object.defineProperty(exports, "__esModule", ({
  44517. value: true
  44518. }));
  44519. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  44520. 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];
  44521. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  44522. const SegoeuiBoldMetrics = {
  44523. lineHeight: 1.33008,
  44524. lineGap: 0
  44525. };
  44526. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  44527. 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];
  44528. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  44529. const SegoeuiBoldItalicMetrics = {
  44530. lineHeight: 1.33008,
  44531. lineGap: 0
  44532. };
  44533. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  44534. 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];
  44535. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  44536. const SegoeuiItalicMetrics = {
  44537. lineHeight: 1.33008,
  44538. lineGap: 0
  44539. };
  44540. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  44541. 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];
  44542. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  44543. const SegoeuiRegularMetrics = {
  44544. lineHeight: 1.33008,
  44545. lineGap: 0
  44546. };
  44547. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  44548. /***/ }),
  44549. /* 55 */
  44550. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44551. Object.defineProperty(exports, "__esModule", ({
  44552. value: true
  44553. }));
  44554. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  44555. exports.isPDFFunction = isPDFFunction;
  44556. var _primitives = __w_pdfjs_require__(3);
  44557. var _util = __w_pdfjs_require__(2);
  44558. var _ps_parser = __w_pdfjs_require__(56);
  44559. var _base_stream = __w_pdfjs_require__(5);
  44560. var _image_utils = __w_pdfjs_require__(57);
  44561. class PDFFunctionFactory {
  44562. constructor({
  44563. xref,
  44564. isEvalSupported = true
  44565. }) {
  44566. this.xref = xref;
  44567. this.isEvalSupported = isEvalSupported !== false;
  44568. }
  44569. create(fn) {
  44570. const cachedFunction = this.getCached(fn);
  44571. if (cachedFunction) {
  44572. return cachedFunction;
  44573. }
  44574. const parsedFunction = PDFFunction.parse({
  44575. xref: this.xref,
  44576. isEvalSupported: this.isEvalSupported,
  44577. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  44578. });
  44579. this._cache(fn, parsedFunction);
  44580. return parsedFunction;
  44581. }
  44582. createFromArray(fnObj) {
  44583. const cachedFunction = this.getCached(fnObj);
  44584. if (cachedFunction) {
  44585. return cachedFunction;
  44586. }
  44587. const parsedFunction = PDFFunction.parseArray({
  44588. xref: this.xref,
  44589. isEvalSupported: this.isEvalSupported,
  44590. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  44591. });
  44592. this._cache(fnObj, parsedFunction);
  44593. return parsedFunction;
  44594. }
  44595. getCached(cacheKey) {
  44596. let fnRef;
  44597. if (cacheKey instanceof _primitives.Ref) {
  44598. fnRef = cacheKey;
  44599. } else if (cacheKey instanceof _primitives.Dict) {
  44600. fnRef = cacheKey.objId;
  44601. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44602. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44603. }
  44604. if (fnRef) {
  44605. const localFunction = this._localFunctionCache.getByRef(fnRef);
  44606. if (localFunction) {
  44607. return localFunction;
  44608. }
  44609. }
  44610. return null;
  44611. }
  44612. _cache(cacheKey, parsedFunction) {
  44613. if (!parsedFunction) {
  44614. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  44615. }
  44616. let fnRef;
  44617. if (cacheKey instanceof _primitives.Ref) {
  44618. fnRef = cacheKey;
  44619. } else if (cacheKey instanceof _primitives.Dict) {
  44620. fnRef = cacheKey.objId;
  44621. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44622. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44623. }
  44624. if (fnRef) {
  44625. this._localFunctionCache.set(null, fnRef, parsedFunction);
  44626. }
  44627. }
  44628. get _localFunctionCache() {
  44629. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  44630. }
  44631. }
  44632. exports.PDFFunctionFactory = PDFFunctionFactory;
  44633. function toNumberArray(arr) {
  44634. if (!Array.isArray(arr)) {
  44635. return null;
  44636. }
  44637. const length = arr.length;
  44638. for (let i = 0; i < length; i++) {
  44639. if (typeof arr[i] !== "number") {
  44640. const result = new Array(length);
  44641. for (let j = 0; j < length; j++) {
  44642. result[j] = +arr[j];
  44643. }
  44644. return result;
  44645. }
  44646. }
  44647. return arr;
  44648. }
  44649. class PDFFunction {
  44650. static getSampleArray(size, outputSize, bps, stream) {
  44651. let i, ii;
  44652. let length = 1;
  44653. for (i = 0, ii = size.length; i < ii; i++) {
  44654. length *= size[i];
  44655. }
  44656. length *= outputSize;
  44657. const array = new Array(length);
  44658. let codeSize = 0;
  44659. let codeBuf = 0;
  44660. const sampleMul = 1.0 / (2.0 ** bps - 1);
  44661. const strBytes = stream.getBytes((length * bps + 7) / 8);
  44662. let strIdx = 0;
  44663. for (i = 0; i < length; i++) {
  44664. while (codeSize < bps) {
  44665. codeBuf <<= 8;
  44666. codeBuf |= strBytes[strIdx++];
  44667. codeSize += 8;
  44668. }
  44669. codeSize -= bps;
  44670. array[i] = (codeBuf >> codeSize) * sampleMul;
  44671. codeBuf &= (1 << codeSize) - 1;
  44672. }
  44673. return array;
  44674. }
  44675. static parse({
  44676. xref,
  44677. isEvalSupported,
  44678. fn
  44679. }) {
  44680. const dict = fn.dict || fn;
  44681. const typeNum = dict.get("FunctionType");
  44682. switch (typeNum) {
  44683. case 0:
  44684. return this.constructSampled({
  44685. xref,
  44686. isEvalSupported,
  44687. fn,
  44688. dict
  44689. });
  44690. case 1:
  44691. break;
  44692. case 2:
  44693. return this.constructInterpolated({
  44694. xref,
  44695. isEvalSupported,
  44696. dict
  44697. });
  44698. case 3:
  44699. return this.constructStiched({
  44700. xref,
  44701. isEvalSupported,
  44702. dict
  44703. });
  44704. case 4:
  44705. return this.constructPostScript({
  44706. xref,
  44707. isEvalSupported,
  44708. fn,
  44709. dict
  44710. });
  44711. }
  44712. throw new _util.FormatError("Unknown type of function");
  44713. }
  44714. static parseArray({
  44715. xref,
  44716. isEvalSupported,
  44717. fnObj
  44718. }) {
  44719. if (!Array.isArray(fnObj)) {
  44720. return this.parse({
  44721. xref,
  44722. isEvalSupported,
  44723. fn: fnObj
  44724. });
  44725. }
  44726. const fnArray = [];
  44727. for (const fn of fnObj) {
  44728. fnArray.push(this.parse({
  44729. xref,
  44730. isEvalSupported,
  44731. fn: xref.fetchIfRef(fn)
  44732. }));
  44733. }
  44734. return function (src, srcOffset, dest, destOffset) {
  44735. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  44736. fnArray[i](src, srcOffset, dest, destOffset + i);
  44737. }
  44738. };
  44739. }
  44740. static constructSampled({
  44741. xref,
  44742. isEvalSupported,
  44743. fn,
  44744. dict
  44745. }) {
  44746. function toMultiArray(arr) {
  44747. const inputLength = arr.length;
  44748. const out = [];
  44749. let index = 0;
  44750. for (let i = 0; i < inputLength; i += 2) {
  44751. out[index++] = [arr[i], arr[i + 1]];
  44752. }
  44753. return out;
  44754. }
  44755. function interpolate(x, xmin, xmax, ymin, ymax) {
  44756. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  44757. }
  44758. let domain = toNumberArray(dict.getArray("Domain"));
  44759. let range = toNumberArray(dict.getArray("Range"));
  44760. if (!domain || !range) {
  44761. throw new _util.FormatError("No domain or range");
  44762. }
  44763. const inputSize = domain.length / 2;
  44764. const outputSize = range.length / 2;
  44765. domain = toMultiArray(domain);
  44766. range = toMultiArray(range);
  44767. const size = toNumberArray(dict.getArray("Size"));
  44768. const bps = dict.get("BitsPerSample");
  44769. const order = dict.get("Order") || 1;
  44770. if (order !== 1) {
  44771. (0, _util.info)("No support for cubic spline interpolation: " + order);
  44772. }
  44773. let encode = toNumberArray(dict.getArray("Encode"));
  44774. if (!encode) {
  44775. encode = [];
  44776. for (let i = 0; i < inputSize; ++i) {
  44777. encode.push([0, size[i] - 1]);
  44778. }
  44779. } else {
  44780. encode = toMultiArray(encode);
  44781. }
  44782. let decode = toNumberArray(dict.getArray("Decode"));
  44783. if (!decode) {
  44784. decode = range;
  44785. } else {
  44786. decode = toMultiArray(decode);
  44787. }
  44788. const samples = this.getSampleArray(size, outputSize, bps, fn);
  44789. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  44790. const cubeVertices = 1 << inputSize;
  44791. const cubeN = new Float64Array(cubeVertices);
  44792. const cubeVertex = new Uint32Array(cubeVertices);
  44793. let i, j;
  44794. for (j = 0; j < cubeVertices; j++) {
  44795. cubeN[j] = 1;
  44796. }
  44797. let k = outputSize,
  44798. pos = 1;
  44799. for (i = 0; i < inputSize; ++i) {
  44800. const domain_2i = domain[i][0];
  44801. const domain_2i_1 = domain[i][1];
  44802. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  44803. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  44804. const size_i = size[i];
  44805. e = Math.min(Math.max(e, 0), size_i - 1);
  44806. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  44807. const n0 = e0 + 1 - e;
  44808. const n1 = e - e0;
  44809. const offset0 = e0 * k;
  44810. const offset1 = offset0 + k;
  44811. for (j = 0; j < cubeVertices; j++) {
  44812. if (j & pos) {
  44813. cubeN[j] *= n1;
  44814. cubeVertex[j] += offset1;
  44815. } else {
  44816. cubeN[j] *= n0;
  44817. cubeVertex[j] += offset0;
  44818. }
  44819. }
  44820. k *= size_i;
  44821. pos <<= 1;
  44822. }
  44823. for (j = 0; j < outputSize; ++j) {
  44824. let rj = 0;
  44825. for (i = 0; i < cubeVertices; i++) {
  44826. rj += samples[cubeVertex[i] + j] * cubeN[i];
  44827. }
  44828. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  44829. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  44830. }
  44831. };
  44832. }
  44833. static constructInterpolated({
  44834. xref,
  44835. isEvalSupported,
  44836. dict
  44837. }) {
  44838. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  44839. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  44840. const n = dict.get("N");
  44841. const diff = [];
  44842. for (let i = 0, ii = c0.length; i < ii; ++i) {
  44843. diff.push(c1[i] - c0[i]);
  44844. }
  44845. const length = diff.length;
  44846. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  44847. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  44848. for (let j = 0; j < length; ++j) {
  44849. dest[destOffset + j] = c0[j] + x * diff[j];
  44850. }
  44851. };
  44852. }
  44853. static constructStiched({
  44854. xref,
  44855. isEvalSupported,
  44856. dict
  44857. }) {
  44858. const domain = toNumberArray(dict.getArray("Domain"));
  44859. if (!domain) {
  44860. throw new _util.FormatError("No domain");
  44861. }
  44862. const inputSize = domain.length / 2;
  44863. if (inputSize !== 1) {
  44864. throw new _util.FormatError("Bad domain for stiched function");
  44865. }
  44866. const fns = [];
  44867. for (const fn of dict.get("Functions")) {
  44868. fns.push(this.parse({
  44869. xref,
  44870. isEvalSupported,
  44871. fn: xref.fetchIfRef(fn)
  44872. }));
  44873. }
  44874. const bounds = toNumberArray(dict.getArray("Bounds"));
  44875. const encode = toNumberArray(dict.getArray("Encode"));
  44876. const tmpBuf = new Float32Array(1);
  44877. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  44878. const clip = function constructStichedFromIRClip(v, min, max) {
  44879. if (v > max) {
  44880. v = max;
  44881. } else if (v < min) {
  44882. v = min;
  44883. }
  44884. return v;
  44885. };
  44886. const v = clip(src[srcOffset], domain[0], domain[1]);
  44887. const length = bounds.length;
  44888. let i;
  44889. for (i = 0; i < length; ++i) {
  44890. if (v < bounds[i]) {
  44891. break;
  44892. }
  44893. }
  44894. let dmin = domain[0];
  44895. if (i > 0) {
  44896. dmin = bounds[i - 1];
  44897. }
  44898. let dmax = domain[1];
  44899. if (i < bounds.length) {
  44900. dmax = bounds[i];
  44901. }
  44902. const rmin = encode[2 * i];
  44903. const rmax = encode[2 * i + 1];
  44904. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  44905. fns[i](tmpBuf, 0, dest, destOffset);
  44906. };
  44907. }
  44908. static constructPostScript({
  44909. xref,
  44910. isEvalSupported,
  44911. fn,
  44912. dict
  44913. }) {
  44914. const domain = toNumberArray(dict.getArray("Domain"));
  44915. const range = toNumberArray(dict.getArray("Range"));
  44916. if (!domain) {
  44917. throw new _util.FormatError("No domain.");
  44918. }
  44919. if (!range) {
  44920. throw new _util.FormatError("No range.");
  44921. }
  44922. const lexer = new _ps_parser.PostScriptLexer(fn);
  44923. const parser = new _ps_parser.PostScriptParser(lexer);
  44924. const code = parser.parse();
  44925. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  44926. const compiled = new PostScriptCompiler().compile(code, domain, range);
  44927. if (compiled) {
  44928. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  44929. }
  44930. }
  44931. (0, _util.info)("Unable to compile PS function");
  44932. const numOutputs = range.length >> 1;
  44933. const numInputs = domain.length >> 1;
  44934. const evaluator = new PostScriptEvaluator(code);
  44935. const cache = Object.create(null);
  44936. const MAX_CACHE_SIZE = 2048 * 4;
  44937. let cache_available = MAX_CACHE_SIZE;
  44938. const tmpBuf = new Float32Array(numInputs);
  44939. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  44940. let i, value;
  44941. let key = "";
  44942. const input = tmpBuf;
  44943. for (i = 0; i < numInputs; i++) {
  44944. value = src[srcOffset + i];
  44945. input[i] = value;
  44946. key += value + "_";
  44947. }
  44948. const cachedValue = cache[key];
  44949. if (cachedValue !== undefined) {
  44950. dest.set(cachedValue, destOffset);
  44951. return;
  44952. }
  44953. const output = new Float32Array(numOutputs);
  44954. const stack = evaluator.execute(input);
  44955. const stackIndex = stack.length - numOutputs;
  44956. for (i = 0; i < numOutputs; i++) {
  44957. value = stack[stackIndex + i];
  44958. let bound = range[i * 2];
  44959. if (value < bound) {
  44960. value = bound;
  44961. } else {
  44962. bound = range[i * 2 + 1];
  44963. if (value > bound) {
  44964. value = bound;
  44965. }
  44966. }
  44967. output[i] = value;
  44968. }
  44969. if (cache_available > 0) {
  44970. cache_available--;
  44971. cache[key] = output;
  44972. }
  44973. dest.set(output, destOffset);
  44974. };
  44975. }
  44976. }
  44977. function isPDFFunction(v) {
  44978. let fnDict;
  44979. if (typeof v !== "object") {
  44980. return false;
  44981. } else if (v instanceof _primitives.Dict) {
  44982. fnDict = v;
  44983. } else if (v instanceof _base_stream.BaseStream) {
  44984. fnDict = v.dict;
  44985. } else {
  44986. return false;
  44987. }
  44988. return fnDict.has("FunctionType");
  44989. }
  44990. class PostScriptStack {
  44991. static get MAX_STACK_SIZE() {
  44992. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  44993. }
  44994. constructor(initialStack) {
  44995. this.stack = initialStack ? Array.from(initialStack) : [];
  44996. }
  44997. push(value) {
  44998. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  44999. throw new Error("PostScript function stack overflow.");
  45000. }
  45001. this.stack.push(value);
  45002. }
  45003. pop() {
  45004. if (this.stack.length <= 0) {
  45005. throw new Error("PostScript function stack underflow.");
  45006. }
  45007. return this.stack.pop();
  45008. }
  45009. copy(n) {
  45010. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  45011. throw new Error("PostScript function stack overflow.");
  45012. }
  45013. const stack = this.stack;
  45014. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  45015. stack.push(stack[i]);
  45016. }
  45017. }
  45018. index(n) {
  45019. this.push(this.stack[this.stack.length - n - 1]);
  45020. }
  45021. roll(n, p) {
  45022. const stack = this.stack;
  45023. const l = stack.length - n;
  45024. const r = stack.length - 1;
  45025. const c = l + (p - Math.floor(p / n) * n);
  45026. for (let i = l, j = r; i < j; i++, j--) {
  45027. const t = stack[i];
  45028. stack[i] = stack[j];
  45029. stack[j] = t;
  45030. }
  45031. for (let i = l, j = c - 1; i < j; i++, j--) {
  45032. const t = stack[i];
  45033. stack[i] = stack[j];
  45034. stack[j] = t;
  45035. }
  45036. for (let i = c, j = r; i < j; i++, j--) {
  45037. const t = stack[i];
  45038. stack[i] = stack[j];
  45039. stack[j] = t;
  45040. }
  45041. }
  45042. }
  45043. class PostScriptEvaluator {
  45044. constructor(operators) {
  45045. this.operators = operators;
  45046. }
  45047. execute(initialStack) {
  45048. const stack = new PostScriptStack(initialStack);
  45049. let counter = 0;
  45050. const operators = this.operators;
  45051. const length = operators.length;
  45052. let operator, a, b;
  45053. while (counter < length) {
  45054. operator = operators[counter++];
  45055. if (typeof operator === "number") {
  45056. stack.push(operator);
  45057. continue;
  45058. }
  45059. switch (operator) {
  45060. case "jz":
  45061. b = stack.pop();
  45062. a = stack.pop();
  45063. if (!a) {
  45064. counter = b;
  45065. }
  45066. break;
  45067. case "j":
  45068. a = stack.pop();
  45069. counter = a;
  45070. break;
  45071. case "abs":
  45072. a = stack.pop();
  45073. stack.push(Math.abs(a));
  45074. break;
  45075. case "add":
  45076. b = stack.pop();
  45077. a = stack.pop();
  45078. stack.push(a + b);
  45079. break;
  45080. case "and":
  45081. b = stack.pop();
  45082. a = stack.pop();
  45083. if (typeof a === "boolean" && typeof b === "boolean") {
  45084. stack.push(a && b);
  45085. } else {
  45086. stack.push(a & b);
  45087. }
  45088. break;
  45089. case "atan":
  45090. a = stack.pop();
  45091. stack.push(Math.atan(a));
  45092. break;
  45093. case "bitshift":
  45094. b = stack.pop();
  45095. a = stack.pop();
  45096. if (a > 0) {
  45097. stack.push(a << b);
  45098. } else {
  45099. stack.push(a >> b);
  45100. }
  45101. break;
  45102. case "ceiling":
  45103. a = stack.pop();
  45104. stack.push(Math.ceil(a));
  45105. break;
  45106. case "copy":
  45107. a = stack.pop();
  45108. stack.copy(a);
  45109. break;
  45110. case "cos":
  45111. a = stack.pop();
  45112. stack.push(Math.cos(a));
  45113. break;
  45114. case "cvi":
  45115. a = stack.pop() | 0;
  45116. stack.push(a);
  45117. break;
  45118. case "cvr":
  45119. break;
  45120. case "div":
  45121. b = stack.pop();
  45122. a = stack.pop();
  45123. stack.push(a / b);
  45124. break;
  45125. case "dup":
  45126. stack.copy(1);
  45127. break;
  45128. case "eq":
  45129. b = stack.pop();
  45130. a = stack.pop();
  45131. stack.push(a === b);
  45132. break;
  45133. case "exch":
  45134. stack.roll(2, 1);
  45135. break;
  45136. case "exp":
  45137. b = stack.pop();
  45138. a = stack.pop();
  45139. stack.push(a ** b);
  45140. break;
  45141. case "false":
  45142. stack.push(false);
  45143. break;
  45144. case "floor":
  45145. a = stack.pop();
  45146. stack.push(Math.floor(a));
  45147. break;
  45148. case "ge":
  45149. b = stack.pop();
  45150. a = stack.pop();
  45151. stack.push(a >= b);
  45152. break;
  45153. case "gt":
  45154. b = stack.pop();
  45155. a = stack.pop();
  45156. stack.push(a > b);
  45157. break;
  45158. case "idiv":
  45159. b = stack.pop();
  45160. a = stack.pop();
  45161. stack.push(a / b | 0);
  45162. break;
  45163. case "index":
  45164. a = stack.pop();
  45165. stack.index(a);
  45166. break;
  45167. case "le":
  45168. b = stack.pop();
  45169. a = stack.pop();
  45170. stack.push(a <= b);
  45171. break;
  45172. case "ln":
  45173. a = stack.pop();
  45174. stack.push(Math.log(a));
  45175. break;
  45176. case "log":
  45177. a = stack.pop();
  45178. stack.push(Math.log(a) / Math.LN10);
  45179. break;
  45180. case "lt":
  45181. b = stack.pop();
  45182. a = stack.pop();
  45183. stack.push(a < b);
  45184. break;
  45185. case "mod":
  45186. b = stack.pop();
  45187. a = stack.pop();
  45188. stack.push(a % b);
  45189. break;
  45190. case "mul":
  45191. b = stack.pop();
  45192. a = stack.pop();
  45193. stack.push(a * b);
  45194. break;
  45195. case "ne":
  45196. b = stack.pop();
  45197. a = stack.pop();
  45198. stack.push(a !== b);
  45199. break;
  45200. case "neg":
  45201. a = stack.pop();
  45202. stack.push(-a);
  45203. break;
  45204. case "not":
  45205. a = stack.pop();
  45206. if (typeof a === "boolean") {
  45207. stack.push(!a);
  45208. } else {
  45209. stack.push(~a);
  45210. }
  45211. break;
  45212. case "or":
  45213. b = stack.pop();
  45214. a = stack.pop();
  45215. if (typeof a === "boolean" && typeof b === "boolean") {
  45216. stack.push(a || b);
  45217. } else {
  45218. stack.push(a | b);
  45219. }
  45220. break;
  45221. case "pop":
  45222. stack.pop();
  45223. break;
  45224. case "roll":
  45225. b = stack.pop();
  45226. a = stack.pop();
  45227. stack.roll(a, b);
  45228. break;
  45229. case "round":
  45230. a = stack.pop();
  45231. stack.push(Math.round(a));
  45232. break;
  45233. case "sin":
  45234. a = stack.pop();
  45235. stack.push(Math.sin(a));
  45236. break;
  45237. case "sqrt":
  45238. a = stack.pop();
  45239. stack.push(Math.sqrt(a));
  45240. break;
  45241. case "sub":
  45242. b = stack.pop();
  45243. a = stack.pop();
  45244. stack.push(a - b);
  45245. break;
  45246. case "true":
  45247. stack.push(true);
  45248. break;
  45249. case "truncate":
  45250. a = stack.pop();
  45251. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  45252. stack.push(a);
  45253. break;
  45254. case "xor":
  45255. b = stack.pop();
  45256. a = stack.pop();
  45257. if (typeof a === "boolean" && typeof b === "boolean") {
  45258. stack.push(a !== b);
  45259. } else {
  45260. stack.push(a ^ b);
  45261. }
  45262. break;
  45263. default:
  45264. throw new _util.FormatError(`Unknown operator ${operator}`);
  45265. }
  45266. }
  45267. return stack.stack;
  45268. }
  45269. }
  45270. exports.PostScriptEvaluator = PostScriptEvaluator;
  45271. class AstNode {
  45272. constructor(type) {
  45273. this.type = type;
  45274. }
  45275. visit(visitor) {
  45276. (0, _util.unreachable)("abstract method");
  45277. }
  45278. }
  45279. class AstArgument extends AstNode {
  45280. constructor(index, min, max) {
  45281. super("args");
  45282. this.index = index;
  45283. this.min = min;
  45284. this.max = max;
  45285. }
  45286. visit(visitor) {
  45287. visitor.visitArgument(this);
  45288. }
  45289. }
  45290. class AstLiteral extends AstNode {
  45291. constructor(number) {
  45292. super("literal");
  45293. this.number = number;
  45294. this.min = number;
  45295. this.max = number;
  45296. }
  45297. visit(visitor) {
  45298. visitor.visitLiteral(this);
  45299. }
  45300. }
  45301. class AstBinaryOperation extends AstNode {
  45302. constructor(op, arg1, arg2, min, max) {
  45303. super("binary");
  45304. this.op = op;
  45305. this.arg1 = arg1;
  45306. this.arg2 = arg2;
  45307. this.min = min;
  45308. this.max = max;
  45309. }
  45310. visit(visitor) {
  45311. visitor.visitBinaryOperation(this);
  45312. }
  45313. }
  45314. class AstMin extends AstNode {
  45315. constructor(arg, max) {
  45316. super("max");
  45317. this.arg = arg;
  45318. this.min = arg.min;
  45319. this.max = max;
  45320. }
  45321. visit(visitor) {
  45322. visitor.visitMin(this);
  45323. }
  45324. }
  45325. class AstVariable extends AstNode {
  45326. constructor(index, min, max) {
  45327. super("var");
  45328. this.index = index;
  45329. this.min = min;
  45330. this.max = max;
  45331. }
  45332. visit(visitor) {
  45333. visitor.visitVariable(this);
  45334. }
  45335. }
  45336. class AstVariableDefinition extends AstNode {
  45337. constructor(variable, arg) {
  45338. super("definition");
  45339. this.variable = variable;
  45340. this.arg = arg;
  45341. }
  45342. visit(visitor) {
  45343. visitor.visitVariableDefinition(this);
  45344. }
  45345. }
  45346. class ExpressionBuilderVisitor {
  45347. constructor() {
  45348. this.parts = [];
  45349. }
  45350. visitArgument(arg) {
  45351. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  45352. }
  45353. visitVariable(variable) {
  45354. this.parts.push("v", variable.index);
  45355. }
  45356. visitLiteral(literal) {
  45357. this.parts.push(literal.number);
  45358. }
  45359. visitBinaryOperation(operation) {
  45360. this.parts.push("(");
  45361. operation.arg1.visit(this);
  45362. this.parts.push(" ", operation.op, " ");
  45363. operation.arg2.visit(this);
  45364. this.parts.push(")");
  45365. }
  45366. visitVariableDefinition(definition) {
  45367. this.parts.push("var ");
  45368. definition.variable.visit(this);
  45369. this.parts.push(" = ");
  45370. definition.arg.visit(this);
  45371. this.parts.push(";");
  45372. }
  45373. visitMin(max) {
  45374. this.parts.push("Math.min(");
  45375. max.arg.visit(this);
  45376. this.parts.push(", ", max.max, ")");
  45377. }
  45378. toString() {
  45379. return this.parts.join("");
  45380. }
  45381. }
  45382. function buildAddOperation(num1, num2) {
  45383. if (num2.type === "literal" && num2.number === 0) {
  45384. return num1;
  45385. }
  45386. if (num1.type === "literal" && num1.number === 0) {
  45387. return num2;
  45388. }
  45389. if (num2.type === "literal" && num1.type === "literal") {
  45390. return new AstLiteral(num1.number + num2.number);
  45391. }
  45392. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  45393. }
  45394. function buildMulOperation(num1, num2) {
  45395. if (num2.type === "literal") {
  45396. if (num2.number === 0) {
  45397. return new AstLiteral(0);
  45398. } else if (num2.number === 1) {
  45399. return num1;
  45400. } else if (num1.type === "literal") {
  45401. return new AstLiteral(num1.number * num2.number);
  45402. }
  45403. }
  45404. if (num1.type === "literal") {
  45405. if (num1.number === 0) {
  45406. return new AstLiteral(0);
  45407. } else if (num1.number === 1) {
  45408. return num2;
  45409. }
  45410. }
  45411. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45412. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45413. return new AstBinaryOperation("*", num1, num2, min, max);
  45414. }
  45415. function buildSubOperation(num1, num2) {
  45416. if (num2.type === "literal") {
  45417. if (num2.number === 0) {
  45418. return num1;
  45419. } else if (num1.type === "literal") {
  45420. return new AstLiteral(num1.number - num2.number);
  45421. }
  45422. }
  45423. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  45424. return num2.arg2;
  45425. }
  45426. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  45427. }
  45428. function buildMinOperation(num1, max) {
  45429. if (num1.min >= max) {
  45430. return new AstLiteral(max);
  45431. } else if (num1.max <= max) {
  45432. return num1;
  45433. }
  45434. return new AstMin(num1, max);
  45435. }
  45436. class PostScriptCompiler {
  45437. compile(code, domain, range) {
  45438. const stack = [];
  45439. const instructions = [];
  45440. const inputSize = domain.length >> 1,
  45441. outputSize = range.length >> 1;
  45442. let lastRegister = 0;
  45443. let n, j;
  45444. let num1, num2, ast1, ast2, tmpVar, item;
  45445. for (let i = 0; i < inputSize; i++) {
  45446. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  45447. }
  45448. for (let i = 0, ii = code.length; i < ii; i++) {
  45449. item = code[i];
  45450. if (typeof item === "number") {
  45451. stack.push(new AstLiteral(item));
  45452. continue;
  45453. }
  45454. switch (item) {
  45455. case "add":
  45456. if (stack.length < 2) {
  45457. return null;
  45458. }
  45459. num2 = stack.pop();
  45460. num1 = stack.pop();
  45461. stack.push(buildAddOperation(num1, num2));
  45462. break;
  45463. case "cvr":
  45464. if (stack.length < 1) {
  45465. return null;
  45466. }
  45467. break;
  45468. case "mul":
  45469. if (stack.length < 2) {
  45470. return null;
  45471. }
  45472. num2 = stack.pop();
  45473. num1 = stack.pop();
  45474. stack.push(buildMulOperation(num1, num2));
  45475. break;
  45476. case "sub":
  45477. if (stack.length < 2) {
  45478. return null;
  45479. }
  45480. num2 = stack.pop();
  45481. num1 = stack.pop();
  45482. stack.push(buildSubOperation(num1, num2));
  45483. break;
  45484. case "exch":
  45485. if (stack.length < 2) {
  45486. return null;
  45487. }
  45488. ast1 = stack.pop();
  45489. ast2 = stack.pop();
  45490. stack.push(ast1, ast2);
  45491. break;
  45492. case "pop":
  45493. if (stack.length < 1) {
  45494. return null;
  45495. }
  45496. stack.pop();
  45497. break;
  45498. case "index":
  45499. if (stack.length < 1) {
  45500. return null;
  45501. }
  45502. num1 = stack.pop();
  45503. if (num1.type !== "literal") {
  45504. return null;
  45505. }
  45506. n = num1.number;
  45507. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  45508. return null;
  45509. }
  45510. ast1 = stack[stack.length - n - 1];
  45511. if (ast1.type === "literal" || ast1.type === "var") {
  45512. stack.push(ast1);
  45513. break;
  45514. }
  45515. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45516. stack[stack.length - n - 1] = tmpVar;
  45517. stack.push(tmpVar);
  45518. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45519. break;
  45520. case "dup":
  45521. if (stack.length < 1) {
  45522. return null;
  45523. }
  45524. 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]) {
  45525. num1 = stack.pop();
  45526. stack.push(buildMinOperation(num1, code[i + 1]));
  45527. i += 6;
  45528. break;
  45529. }
  45530. ast1 = stack.at(-1);
  45531. if (ast1.type === "literal" || ast1.type === "var") {
  45532. stack.push(ast1);
  45533. break;
  45534. }
  45535. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45536. stack[stack.length - 1] = tmpVar;
  45537. stack.push(tmpVar);
  45538. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45539. break;
  45540. case "roll":
  45541. if (stack.length < 2) {
  45542. return null;
  45543. }
  45544. num2 = stack.pop();
  45545. num1 = stack.pop();
  45546. if (num2.type !== "literal" || num1.type !== "literal") {
  45547. return null;
  45548. }
  45549. j = num2.number;
  45550. n = num1.number;
  45551. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  45552. return null;
  45553. }
  45554. j = (j % n + n) % n;
  45555. if (j === 0) {
  45556. break;
  45557. }
  45558. stack.push(...stack.splice(stack.length - n, n - j));
  45559. break;
  45560. default:
  45561. return null;
  45562. }
  45563. }
  45564. if (stack.length !== outputSize) {
  45565. return null;
  45566. }
  45567. const result = [];
  45568. for (const instruction of instructions) {
  45569. const statementBuilder = new ExpressionBuilderVisitor();
  45570. instruction.visit(statementBuilder);
  45571. result.push(statementBuilder.toString());
  45572. }
  45573. for (let i = 0, ii = stack.length; i < ii; i++) {
  45574. const expr = stack[i],
  45575. statementBuilder = new ExpressionBuilderVisitor();
  45576. expr.visit(statementBuilder);
  45577. const min = range[i * 2],
  45578. max = range[i * 2 + 1];
  45579. const out = [statementBuilder.toString()];
  45580. if (min > expr.min) {
  45581. out.unshift("Math.max(", min, ", ");
  45582. out.push(")");
  45583. }
  45584. if (max < expr.max) {
  45585. out.unshift("Math.min(", max, ", ");
  45586. out.push(")");
  45587. }
  45588. out.unshift("dest[destOffset + ", i, "] = ");
  45589. out.push(";");
  45590. result.push(out.join(""));
  45591. }
  45592. return result.join("\n");
  45593. }
  45594. }
  45595. exports.PostScriptCompiler = PostScriptCompiler;
  45596. /***/ }),
  45597. /* 56 */
  45598. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45599. Object.defineProperty(exports, "__esModule", ({
  45600. value: true
  45601. }));
  45602. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  45603. var _util = __w_pdfjs_require__(2);
  45604. var _primitives = __w_pdfjs_require__(3);
  45605. var _core_utils = __w_pdfjs_require__(4);
  45606. class PostScriptParser {
  45607. constructor(lexer) {
  45608. this.lexer = lexer;
  45609. this.operators = [];
  45610. this.token = null;
  45611. this.prev = null;
  45612. }
  45613. nextToken() {
  45614. this.prev = this.token;
  45615. this.token = this.lexer.getToken();
  45616. }
  45617. accept(type) {
  45618. if (this.token.type === type) {
  45619. this.nextToken();
  45620. return true;
  45621. }
  45622. return false;
  45623. }
  45624. expect(type) {
  45625. if (this.accept(type)) {
  45626. return true;
  45627. }
  45628. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  45629. }
  45630. parse() {
  45631. this.nextToken();
  45632. this.expect(PostScriptTokenTypes.LBRACE);
  45633. this.parseBlock();
  45634. this.expect(PostScriptTokenTypes.RBRACE);
  45635. return this.operators;
  45636. }
  45637. parseBlock() {
  45638. while (true) {
  45639. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  45640. this.operators.push(this.prev.value);
  45641. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  45642. this.operators.push(this.prev.value);
  45643. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45644. this.parseCondition();
  45645. } else {
  45646. return;
  45647. }
  45648. }
  45649. }
  45650. parseCondition() {
  45651. const conditionLocation = this.operators.length;
  45652. this.operators.push(null, null);
  45653. this.parseBlock();
  45654. this.expect(PostScriptTokenTypes.RBRACE);
  45655. if (this.accept(PostScriptTokenTypes.IF)) {
  45656. this.operators[conditionLocation] = this.operators.length;
  45657. this.operators[conditionLocation + 1] = "jz";
  45658. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45659. const jumpLocation = this.operators.length;
  45660. this.operators.push(null, null);
  45661. const endOfTrue = this.operators.length;
  45662. this.parseBlock();
  45663. this.expect(PostScriptTokenTypes.RBRACE);
  45664. this.expect(PostScriptTokenTypes.IFELSE);
  45665. this.operators[jumpLocation] = this.operators.length;
  45666. this.operators[jumpLocation + 1] = "j";
  45667. this.operators[conditionLocation] = endOfTrue;
  45668. this.operators[conditionLocation + 1] = "jz";
  45669. } else {
  45670. throw new _util.FormatError("PS Function: error parsing conditional.");
  45671. }
  45672. }
  45673. }
  45674. exports.PostScriptParser = PostScriptParser;
  45675. const PostScriptTokenTypes = {
  45676. LBRACE: 0,
  45677. RBRACE: 1,
  45678. NUMBER: 2,
  45679. OPERATOR: 3,
  45680. IF: 4,
  45681. IFELSE: 5
  45682. };
  45683. class PostScriptToken {
  45684. static get opCache() {
  45685. return (0, _util.shadow)(this, "opCache", Object.create(null));
  45686. }
  45687. constructor(type, value) {
  45688. this.type = type;
  45689. this.value = value;
  45690. }
  45691. static getOperator(op) {
  45692. const opValue = PostScriptToken.opCache[op];
  45693. if (opValue) {
  45694. return opValue;
  45695. }
  45696. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  45697. }
  45698. static get LBRACE() {
  45699. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  45700. }
  45701. static get RBRACE() {
  45702. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  45703. }
  45704. static get IF() {
  45705. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  45706. }
  45707. static get IFELSE() {
  45708. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  45709. }
  45710. }
  45711. class PostScriptLexer {
  45712. constructor(stream) {
  45713. this.stream = stream;
  45714. this.nextChar();
  45715. this.strBuf = [];
  45716. }
  45717. nextChar() {
  45718. return this.currentChar = this.stream.getByte();
  45719. }
  45720. getToken() {
  45721. let comment = false;
  45722. let ch = this.currentChar;
  45723. while (true) {
  45724. if (ch < 0) {
  45725. return _primitives.EOF;
  45726. }
  45727. if (comment) {
  45728. if (ch === 0x0a || ch === 0x0d) {
  45729. comment = false;
  45730. }
  45731. } else if (ch === 0x25) {
  45732. comment = true;
  45733. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  45734. break;
  45735. }
  45736. ch = this.nextChar();
  45737. }
  45738. switch (ch | 0) {
  45739. case 0x30:
  45740. case 0x31:
  45741. case 0x32:
  45742. case 0x33:
  45743. case 0x34:
  45744. case 0x35:
  45745. case 0x36:
  45746. case 0x37:
  45747. case 0x38:
  45748. case 0x39:
  45749. case 0x2b:
  45750. case 0x2d:
  45751. case 0x2e:
  45752. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  45753. case 0x7b:
  45754. this.nextChar();
  45755. return PostScriptToken.LBRACE;
  45756. case 0x7d:
  45757. this.nextChar();
  45758. return PostScriptToken.RBRACE;
  45759. }
  45760. const strBuf = this.strBuf;
  45761. strBuf.length = 0;
  45762. strBuf[0] = String.fromCharCode(ch);
  45763. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  45764. strBuf.push(String.fromCharCode(ch));
  45765. }
  45766. const str = strBuf.join("");
  45767. switch (str.toLowerCase()) {
  45768. case "if":
  45769. return PostScriptToken.IF;
  45770. case "ifelse":
  45771. return PostScriptToken.IFELSE;
  45772. default:
  45773. return PostScriptToken.getOperator(str);
  45774. }
  45775. }
  45776. getNumber() {
  45777. let ch = this.currentChar;
  45778. const strBuf = this.strBuf;
  45779. strBuf.length = 0;
  45780. strBuf[0] = String.fromCharCode(ch);
  45781. while ((ch = this.nextChar()) >= 0) {
  45782. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  45783. strBuf.push(String.fromCharCode(ch));
  45784. } else {
  45785. break;
  45786. }
  45787. }
  45788. const value = parseFloat(strBuf.join(""));
  45789. if (isNaN(value)) {
  45790. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  45791. }
  45792. return value;
  45793. }
  45794. }
  45795. exports.PostScriptLexer = PostScriptLexer;
  45796. /***/ }),
  45797. /* 57 */
  45798. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45799. Object.defineProperty(exports, "__esModule", ({
  45800. value: true
  45801. }));
  45802. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  45803. var _util = __w_pdfjs_require__(2);
  45804. var _primitives = __w_pdfjs_require__(3);
  45805. class BaseLocalCache {
  45806. constructor(options) {
  45807. if (this.constructor === BaseLocalCache) {
  45808. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  45809. }
  45810. this._onlyRefs = (options && options.onlyRefs) === true;
  45811. if (!this._onlyRefs) {
  45812. this._nameRefMap = new Map();
  45813. this._imageMap = new Map();
  45814. }
  45815. this._imageCache = new _primitives.RefSetCache();
  45816. }
  45817. getByName(name) {
  45818. if (this._onlyRefs) {
  45819. (0, _util.unreachable)("Should not call `getByName` method.");
  45820. }
  45821. const ref = this._nameRefMap.get(name);
  45822. if (ref) {
  45823. return this.getByRef(ref);
  45824. }
  45825. return this._imageMap.get(name) || null;
  45826. }
  45827. getByRef(ref) {
  45828. return this._imageCache.get(ref) || null;
  45829. }
  45830. set(name, ref, data) {
  45831. (0, _util.unreachable)("Abstract method `set` called.");
  45832. }
  45833. }
  45834. class LocalImageCache extends BaseLocalCache {
  45835. set(name, ref = null, data) {
  45836. if (typeof name !== "string") {
  45837. throw new Error('LocalImageCache.set - expected "name" argument.');
  45838. }
  45839. if (ref) {
  45840. if (this._imageCache.has(ref)) {
  45841. return;
  45842. }
  45843. this._nameRefMap.set(name, ref);
  45844. this._imageCache.put(ref, data);
  45845. return;
  45846. }
  45847. if (this._imageMap.has(name)) {
  45848. return;
  45849. }
  45850. this._imageMap.set(name, data);
  45851. }
  45852. }
  45853. exports.LocalImageCache = LocalImageCache;
  45854. class LocalColorSpaceCache extends BaseLocalCache {
  45855. set(name = null, ref = null, data) {
  45856. if (typeof name !== "string" && !ref) {
  45857. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  45858. }
  45859. if (ref) {
  45860. if (this._imageCache.has(ref)) {
  45861. return;
  45862. }
  45863. if (name !== null) {
  45864. this._nameRefMap.set(name, ref);
  45865. }
  45866. this._imageCache.put(ref, data);
  45867. return;
  45868. }
  45869. if (this._imageMap.has(name)) {
  45870. return;
  45871. }
  45872. this._imageMap.set(name, data);
  45873. }
  45874. }
  45875. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  45876. class LocalFunctionCache extends BaseLocalCache {
  45877. constructor(options) {
  45878. super({
  45879. onlyRefs: true
  45880. });
  45881. }
  45882. set(name = null, ref, data) {
  45883. if (!ref) {
  45884. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  45885. }
  45886. if (this._imageCache.has(ref)) {
  45887. return;
  45888. }
  45889. this._imageCache.put(ref, data);
  45890. }
  45891. }
  45892. exports.LocalFunctionCache = LocalFunctionCache;
  45893. class LocalGStateCache extends BaseLocalCache {
  45894. set(name, ref = null, data) {
  45895. if (typeof name !== "string") {
  45896. throw new Error('LocalGStateCache.set - expected "name" argument.');
  45897. }
  45898. if (ref) {
  45899. if (this._imageCache.has(ref)) {
  45900. return;
  45901. }
  45902. this._nameRefMap.set(name, ref);
  45903. this._imageCache.put(ref, data);
  45904. return;
  45905. }
  45906. if (this._imageMap.has(name)) {
  45907. return;
  45908. }
  45909. this._imageMap.set(name, data);
  45910. }
  45911. }
  45912. exports.LocalGStateCache = LocalGStateCache;
  45913. class LocalTilingPatternCache extends BaseLocalCache {
  45914. constructor(options) {
  45915. super({
  45916. onlyRefs: true
  45917. });
  45918. }
  45919. set(name = null, ref, data) {
  45920. if (!ref) {
  45921. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  45922. }
  45923. if (this._imageCache.has(ref)) {
  45924. return;
  45925. }
  45926. this._imageCache.put(ref, data);
  45927. }
  45928. }
  45929. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  45930. class GlobalImageCache {
  45931. static get NUM_PAGES_THRESHOLD() {
  45932. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  45933. }
  45934. static get MIN_IMAGES_TO_CACHE() {
  45935. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  45936. }
  45937. static get MAX_BYTE_SIZE() {
  45938. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  45939. }
  45940. constructor() {
  45941. this._refCache = new _primitives.RefSetCache();
  45942. this._imageCache = new _primitives.RefSetCache();
  45943. }
  45944. get _byteSize() {
  45945. let byteSize = 0;
  45946. for (const imageData of this._imageCache) {
  45947. byteSize += imageData.byteSize;
  45948. }
  45949. return byteSize;
  45950. }
  45951. get _cacheLimitReached() {
  45952. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  45953. return false;
  45954. }
  45955. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  45956. return false;
  45957. }
  45958. return true;
  45959. }
  45960. shouldCache(ref, pageIndex) {
  45961. const pageIndexSet = this._refCache.get(ref);
  45962. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  45963. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45964. return false;
  45965. }
  45966. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  45967. return false;
  45968. }
  45969. return true;
  45970. }
  45971. addPageIndex(ref, pageIndex) {
  45972. let pageIndexSet = this._refCache.get(ref);
  45973. if (!pageIndexSet) {
  45974. pageIndexSet = new Set();
  45975. this._refCache.put(ref, pageIndexSet);
  45976. }
  45977. pageIndexSet.add(pageIndex);
  45978. }
  45979. addByteSize(ref, byteSize) {
  45980. const imageData = this._imageCache.get(ref);
  45981. if (!imageData) {
  45982. return;
  45983. }
  45984. if (imageData.byteSize) {
  45985. return;
  45986. }
  45987. imageData.byteSize = byteSize;
  45988. }
  45989. getData(ref, pageIndex) {
  45990. const pageIndexSet = this._refCache.get(ref);
  45991. if (!pageIndexSet) {
  45992. return null;
  45993. }
  45994. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45995. return null;
  45996. }
  45997. const imageData = this._imageCache.get(ref);
  45998. if (!imageData) {
  45999. return null;
  46000. }
  46001. pageIndexSet.add(pageIndex);
  46002. return imageData;
  46003. }
  46004. setData(ref, data) {
  46005. if (!this._refCache.has(ref)) {
  46006. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  46007. }
  46008. if (this._imageCache.has(ref)) {
  46009. return;
  46010. }
  46011. if (this._cacheLimitReached) {
  46012. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  46013. return;
  46014. }
  46015. this._imageCache.put(ref, data);
  46016. }
  46017. clear(onlyData = false) {
  46018. if (!onlyData) {
  46019. this._refCache.clear();
  46020. }
  46021. this._imageCache.clear();
  46022. }
  46023. }
  46024. exports.GlobalImageCache = GlobalImageCache;
  46025. /***/ }),
  46026. /* 58 */
  46027. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46028. Object.defineProperty(exports, "__esModule", ({
  46029. value: true
  46030. }));
  46031. exports.bidi = bidi;
  46032. var _util = __w_pdfjs_require__(2);
  46033. 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"];
  46034. 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"];
  46035. function isOdd(i) {
  46036. return (i & 1) !== 0;
  46037. }
  46038. function isEven(i) {
  46039. return (i & 1) === 0;
  46040. }
  46041. function findUnequal(arr, start, value) {
  46042. let j, jj;
  46043. for (j = start, jj = arr.length; j < jj; ++j) {
  46044. if (arr[j] !== value) {
  46045. return j;
  46046. }
  46047. }
  46048. return j;
  46049. }
  46050. function setValues(arr, start, end, value) {
  46051. for (let j = start; j < end; ++j) {
  46052. arr[j] = value;
  46053. }
  46054. }
  46055. function reverseValues(arr, start, end) {
  46056. for (let i = start, j = end - 1; i < j; ++i, --j) {
  46057. const temp = arr[i];
  46058. arr[i] = arr[j];
  46059. arr[j] = temp;
  46060. }
  46061. }
  46062. function createBidiText(str, isLTR, vertical = false) {
  46063. let dir = "ltr";
  46064. if (vertical) {
  46065. dir = "ttb";
  46066. } else if (!isLTR) {
  46067. dir = "rtl";
  46068. }
  46069. return {
  46070. str,
  46071. dir
  46072. };
  46073. }
  46074. const chars = [];
  46075. const types = [];
  46076. function bidi(str, startLevel = -1, vertical = false) {
  46077. let isLTR = true;
  46078. const strLength = str.length;
  46079. if (strLength === 0 || vertical) {
  46080. return createBidiText(str, isLTR, vertical);
  46081. }
  46082. chars.length = strLength;
  46083. types.length = strLength;
  46084. let numBidi = 0;
  46085. let i, ii;
  46086. for (i = 0; i < strLength; ++i) {
  46087. chars[i] = str.charAt(i);
  46088. const charCode = str.charCodeAt(i);
  46089. let charType = "L";
  46090. if (charCode <= 0x00ff) {
  46091. charType = baseTypes[charCode];
  46092. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  46093. charType = "R";
  46094. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  46095. charType = arabicTypes[charCode & 0xff];
  46096. if (!charType) {
  46097. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  46098. }
  46099. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  46100. charType = "AL";
  46101. }
  46102. if (charType === "R" || charType === "AL" || charType === "AN") {
  46103. numBidi++;
  46104. }
  46105. types[i] = charType;
  46106. }
  46107. if (numBidi === 0) {
  46108. isLTR = true;
  46109. return createBidiText(str, isLTR);
  46110. }
  46111. if (startLevel === -1) {
  46112. if (numBidi / strLength < 0.3 && strLength > 4) {
  46113. isLTR = true;
  46114. startLevel = 0;
  46115. } else {
  46116. isLTR = false;
  46117. startLevel = 1;
  46118. }
  46119. }
  46120. const levels = [];
  46121. for (i = 0; i < strLength; ++i) {
  46122. levels[i] = startLevel;
  46123. }
  46124. const e = isOdd(startLevel) ? "R" : "L";
  46125. const sor = e;
  46126. const eor = sor;
  46127. let lastType = sor;
  46128. for (i = 0; i < strLength; ++i) {
  46129. if (types[i] === "NSM") {
  46130. types[i] = lastType;
  46131. } else {
  46132. lastType = types[i];
  46133. }
  46134. }
  46135. lastType = sor;
  46136. let t;
  46137. for (i = 0; i < strLength; ++i) {
  46138. t = types[i];
  46139. if (t === "EN") {
  46140. types[i] = lastType === "AL" ? "AN" : "EN";
  46141. } else if (t === "R" || t === "L" || t === "AL") {
  46142. lastType = t;
  46143. }
  46144. }
  46145. for (i = 0; i < strLength; ++i) {
  46146. t = types[i];
  46147. if (t === "AL") {
  46148. types[i] = "R";
  46149. }
  46150. }
  46151. for (i = 1; i < strLength - 1; ++i) {
  46152. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  46153. types[i] = "EN";
  46154. }
  46155. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  46156. types[i] = types[i - 1];
  46157. }
  46158. }
  46159. for (i = 0; i < strLength; ++i) {
  46160. if (types[i] === "EN") {
  46161. for (let j = i - 1; j >= 0; --j) {
  46162. if (types[j] !== "ET") {
  46163. break;
  46164. }
  46165. types[j] = "EN";
  46166. }
  46167. for (let j = i + 1; j < strLength; ++j) {
  46168. if (types[j] !== "ET") {
  46169. break;
  46170. }
  46171. types[j] = "EN";
  46172. }
  46173. }
  46174. }
  46175. for (i = 0; i < strLength; ++i) {
  46176. t = types[i];
  46177. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  46178. types[i] = "ON";
  46179. }
  46180. }
  46181. lastType = sor;
  46182. for (i = 0; i < strLength; ++i) {
  46183. t = types[i];
  46184. if (t === "EN") {
  46185. types[i] = lastType === "L" ? "L" : "EN";
  46186. } else if (t === "R" || t === "L") {
  46187. lastType = t;
  46188. }
  46189. }
  46190. for (i = 0; i < strLength; ++i) {
  46191. if (types[i] === "ON") {
  46192. const end = findUnequal(types, i + 1, "ON");
  46193. let before = sor;
  46194. if (i > 0) {
  46195. before = types[i - 1];
  46196. }
  46197. let after = eor;
  46198. if (end + 1 < strLength) {
  46199. after = types[end + 1];
  46200. }
  46201. if (before !== "L") {
  46202. before = "R";
  46203. }
  46204. if (after !== "L") {
  46205. after = "R";
  46206. }
  46207. if (before === after) {
  46208. setValues(types, i, end, before);
  46209. }
  46210. i = end - 1;
  46211. }
  46212. }
  46213. for (i = 0; i < strLength; ++i) {
  46214. if (types[i] === "ON") {
  46215. types[i] = e;
  46216. }
  46217. }
  46218. for (i = 0; i < strLength; ++i) {
  46219. t = types[i];
  46220. if (isEven(levels[i])) {
  46221. if (t === "R") {
  46222. levels[i] += 1;
  46223. } else if (t === "AN" || t === "EN") {
  46224. levels[i] += 2;
  46225. }
  46226. } else {
  46227. if (t === "L" || t === "AN" || t === "EN") {
  46228. levels[i] += 1;
  46229. }
  46230. }
  46231. }
  46232. let highestLevel = -1;
  46233. let lowestOddLevel = 99;
  46234. let level;
  46235. for (i = 0, ii = levels.length; i < ii; ++i) {
  46236. level = levels[i];
  46237. if (highestLevel < level) {
  46238. highestLevel = level;
  46239. }
  46240. if (lowestOddLevel > level && isOdd(level)) {
  46241. lowestOddLevel = level;
  46242. }
  46243. }
  46244. for (level = highestLevel; level >= lowestOddLevel; --level) {
  46245. let start = -1;
  46246. for (i = 0, ii = levels.length; i < ii; ++i) {
  46247. if (levels[i] < level) {
  46248. if (start >= 0) {
  46249. reverseValues(chars, start, i);
  46250. start = -1;
  46251. }
  46252. } else if (start < 0) {
  46253. start = i;
  46254. }
  46255. }
  46256. if (start >= 0) {
  46257. reverseValues(chars, start, levels.length);
  46258. }
  46259. }
  46260. for (i = 0, ii = chars.length; i < ii; ++i) {
  46261. const ch = chars[i];
  46262. if (ch === "<" || ch === ">") {
  46263. chars[i] = "";
  46264. }
  46265. }
  46266. return createBidiText(chars.join(""), isLTR);
  46267. }
  46268. /***/ }),
  46269. /* 59 */
  46270. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46271. Object.defineProperty(exports, "__esModule", ({
  46272. value: true
  46273. }));
  46274. exports.MurmurHash3_64 = void 0;
  46275. var _util = __w_pdfjs_require__(2);
  46276. const SEED = 0xc3d2e1f0;
  46277. const MASK_HIGH = 0xffff0000;
  46278. const MASK_LOW = 0xffff;
  46279. class MurmurHash3_64 {
  46280. constructor(seed) {
  46281. this.h1 = seed ? seed & 0xffffffff : SEED;
  46282. this.h2 = seed ? seed & 0xffffffff : SEED;
  46283. }
  46284. update(input) {
  46285. let data, length;
  46286. if (typeof input === "string") {
  46287. data = new Uint8Array(input.length * 2);
  46288. length = 0;
  46289. for (let i = 0, ii = input.length; i < ii; i++) {
  46290. const code = input.charCodeAt(i);
  46291. if (code <= 0xff) {
  46292. data[length++] = code;
  46293. } else {
  46294. data[length++] = code >>> 8;
  46295. data[length++] = code & 0xff;
  46296. }
  46297. }
  46298. } else if ((0, _util.isArrayBuffer)(input)) {
  46299. data = input.slice();
  46300. length = data.byteLength;
  46301. } else {
  46302. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  46303. }
  46304. const blockCounts = length >> 2;
  46305. const tailLength = length - blockCounts * 4;
  46306. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  46307. let k1 = 0,
  46308. k2 = 0;
  46309. let h1 = this.h1,
  46310. h2 = this.h2;
  46311. const C1 = 0xcc9e2d51,
  46312. C2 = 0x1b873593;
  46313. const C1_LOW = C1 & MASK_LOW,
  46314. C2_LOW = C2 & MASK_LOW;
  46315. for (let i = 0; i < blockCounts; i++) {
  46316. if (i & 1) {
  46317. k1 = dataUint32[i];
  46318. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  46319. k1 = k1 << 15 | k1 >>> 17;
  46320. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  46321. h1 ^= k1;
  46322. h1 = h1 << 13 | h1 >>> 19;
  46323. h1 = h1 * 5 + 0xe6546b64;
  46324. } else {
  46325. k2 = dataUint32[i];
  46326. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  46327. k2 = k2 << 15 | k2 >>> 17;
  46328. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  46329. h2 ^= k2;
  46330. h2 = h2 << 13 | h2 >>> 19;
  46331. h2 = h2 * 5 + 0xe6546b64;
  46332. }
  46333. }
  46334. k1 = 0;
  46335. switch (tailLength) {
  46336. case 3:
  46337. k1 ^= data[blockCounts * 4 + 2] << 16;
  46338. case 2:
  46339. k1 ^= data[blockCounts * 4 + 1] << 8;
  46340. case 1:
  46341. k1 ^= data[blockCounts * 4];
  46342. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  46343. k1 = k1 << 15 | k1 >>> 17;
  46344. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  46345. if (blockCounts & 1) {
  46346. h1 ^= k1;
  46347. } else {
  46348. h2 ^= k1;
  46349. }
  46350. }
  46351. this.h1 = h1;
  46352. this.h2 = h2;
  46353. }
  46354. hexdigest() {
  46355. let h1 = this.h1,
  46356. h2 = this.h2;
  46357. h1 ^= h2 >>> 1;
  46358. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  46359. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  46360. h1 ^= h2 >>> 1;
  46361. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  46362. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  46363. h1 ^= h2 >>> 1;
  46364. return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  46365. }
  46366. }
  46367. exports.MurmurHash3_64 = MurmurHash3_64;
  46368. /***/ }),
  46369. /* 60 */
  46370. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46371. Object.defineProperty(exports, "__esModule", ({
  46372. value: true
  46373. }));
  46374. exports.OperatorList = void 0;
  46375. var _util = __w_pdfjs_require__(2);
  46376. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  46377. let state = parentState;
  46378. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  46379. const item = pattern[i];
  46380. state = state[item] || (state[item] = []);
  46381. }
  46382. state[pattern.at(-1)] = {
  46383. checkFn,
  46384. iterateFn,
  46385. processFn
  46386. };
  46387. }
  46388. const InitialState = [];
  46389. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  46390. const fnArray = context.fnArray;
  46391. const iFirstSave = context.iCurr - 3;
  46392. const pos = (i - iFirstSave) % 4;
  46393. switch (pos) {
  46394. case 0:
  46395. return fnArray[i] === _util.OPS.save;
  46396. case 1:
  46397. return fnArray[i] === _util.OPS.transform;
  46398. case 2:
  46399. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  46400. case 3:
  46401. return fnArray[i] === _util.OPS.restore;
  46402. }
  46403. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  46404. }, function foundInlineImageGroup(context, i) {
  46405. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  46406. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  46407. const MAX_WIDTH = 1000;
  46408. const IMAGE_PADDING = 1;
  46409. const fnArray = context.fnArray,
  46410. argsArray = context.argsArray;
  46411. const curr = context.iCurr;
  46412. const iFirstSave = curr - 3;
  46413. const iFirstTransform = curr - 2;
  46414. const iFirstPIIXO = curr - 1;
  46415. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  46416. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  46417. return i - (i - iFirstSave) % 4;
  46418. }
  46419. let maxX = 0;
  46420. const map = [];
  46421. let maxLineHeight = 0;
  46422. let currentX = IMAGE_PADDING,
  46423. currentY = IMAGE_PADDING;
  46424. for (let q = 0; q < count; q++) {
  46425. const transform = argsArray[iFirstTransform + (q << 2)];
  46426. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  46427. if (currentX + img.width > MAX_WIDTH) {
  46428. maxX = Math.max(maxX, currentX);
  46429. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  46430. currentX = 0;
  46431. maxLineHeight = 0;
  46432. }
  46433. map.push({
  46434. transform,
  46435. x: currentX,
  46436. y: currentY,
  46437. w: img.width,
  46438. h: img.height
  46439. });
  46440. currentX += img.width + 2 * IMAGE_PADDING;
  46441. maxLineHeight = Math.max(maxLineHeight, img.height);
  46442. }
  46443. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  46444. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  46445. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  46446. const imgRowSize = imgWidth << 2;
  46447. for (let q = 0; q < count; q++) {
  46448. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  46449. const rowSize = map[q].w << 2;
  46450. let dataOffset = 0;
  46451. let offset = map[q].x + map[q].y * imgWidth << 2;
  46452. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  46453. for (let k = 0, kk = map[q].h; k < kk; k++) {
  46454. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  46455. dataOffset += rowSize;
  46456. offset += imgRowSize;
  46457. }
  46458. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  46459. while (offset >= 0) {
  46460. data[offset - 4] = data[offset];
  46461. data[offset - 3] = data[offset + 1];
  46462. data[offset - 2] = data[offset + 2];
  46463. data[offset - 1] = data[offset + 3];
  46464. data[offset + rowSize] = data[offset + rowSize - 4];
  46465. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  46466. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  46467. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  46468. offset -= imgRowSize;
  46469. }
  46470. }
  46471. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  46472. argsArray.splice(iFirstSave, count * 4, [{
  46473. width: imgWidth,
  46474. height: imgHeight,
  46475. kind: _util.ImageKind.RGBA_32BPP,
  46476. data: imgData
  46477. }, map]);
  46478. return iFirstSave + 1;
  46479. });
  46480. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  46481. const fnArray = context.fnArray;
  46482. const iFirstSave = context.iCurr - 3;
  46483. const pos = (i - iFirstSave) % 4;
  46484. switch (pos) {
  46485. case 0:
  46486. return fnArray[i] === _util.OPS.save;
  46487. case 1:
  46488. return fnArray[i] === _util.OPS.transform;
  46489. case 2:
  46490. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  46491. case 3:
  46492. return fnArray[i] === _util.OPS.restore;
  46493. }
  46494. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  46495. }, function foundImageMaskGroup(context, i) {
  46496. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  46497. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  46498. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  46499. const fnArray = context.fnArray,
  46500. argsArray = context.argsArray;
  46501. const curr = context.iCurr;
  46502. const iFirstSave = curr - 3;
  46503. const iFirstTransform = curr - 2;
  46504. const iFirstPIMXO = curr - 1;
  46505. let count = Math.floor((i - iFirstSave) / 4);
  46506. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  46507. return i - (i - iFirstSave) % 4;
  46508. }
  46509. let isSameImage = false;
  46510. let iTransform, transformArgs;
  46511. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  46512. const firstTransformArg0 = argsArray[iFirstTransform][0],
  46513. firstTransformArg1 = argsArray[iFirstTransform][1],
  46514. firstTransformArg2 = argsArray[iFirstTransform][2],
  46515. firstTransformArg3 = argsArray[iFirstTransform][3];
  46516. if (firstTransformArg1 === firstTransformArg2) {
  46517. isSameImage = true;
  46518. iTransform = iFirstTransform + 4;
  46519. let iPIMXO = iFirstPIMXO + 4;
  46520. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  46521. transformArgs = argsArray[iTransform];
  46522. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  46523. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  46524. isSameImage = false;
  46525. } else {
  46526. count = q;
  46527. }
  46528. break;
  46529. }
  46530. }
  46531. }
  46532. if (isSameImage) {
  46533. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  46534. const positions = new Float32Array(count * 2);
  46535. iTransform = iFirstTransform;
  46536. for (let q = 0; q < count; q++, iTransform += 4) {
  46537. transformArgs = argsArray[iTransform];
  46538. positions[q << 1] = transformArgs[4];
  46539. positions[(q << 1) + 1] = transformArgs[5];
  46540. }
  46541. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  46542. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  46543. } else {
  46544. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  46545. const images = [];
  46546. for (let q = 0; q < count; q++) {
  46547. transformArgs = argsArray[iFirstTransform + (q << 2)];
  46548. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  46549. images.push({
  46550. data: maskParams.data,
  46551. width: maskParams.width,
  46552. height: maskParams.height,
  46553. interpolate: maskParams.interpolate,
  46554. count: maskParams.count,
  46555. transform: transformArgs
  46556. });
  46557. }
  46558. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  46559. argsArray.splice(iFirstSave, count * 4, [images]);
  46560. }
  46561. return iFirstSave + 1;
  46562. });
  46563. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  46564. const argsArray = context.argsArray;
  46565. const iFirstTransform = context.iCurr - 2;
  46566. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  46567. }, function iterateImageGroup(context, i) {
  46568. const fnArray = context.fnArray,
  46569. argsArray = context.argsArray;
  46570. const iFirstSave = context.iCurr - 3;
  46571. const pos = (i - iFirstSave) % 4;
  46572. switch (pos) {
  46573. case 0:
  46574. return fnArray[i] === _util.OPS.save;
  46575. case 1:
  46576. if (fnArray[i] !== _util.OPS.transform) {
  46577. return false;
  46578. }
  46579. const iFirstTransform = context.iCurr - 2;
  46580. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46581. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46582. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  46583. return false;
  46584. }
  46585. return true;
  46586. case 2:
  46587. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  46588. return false;
  46589. }
  46590. const iFirstPIXO = context.iCurr - 1;
  46591. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46592. if (argsArray[i][0] !== firstPIXOArg0) {
  46593. return false;
  46594. }
  46595. return true;
  46596. case 3:
  46597. return fnArray[i] === _util.OPS.restore;
  46598. }
  46599. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  46600. }, function (context, i) {
  46601. const MIN_IMAGES_IN_BLOCK = 3;
  46602. const MAX_IMAGES_IN_BLOCK = 1000;
  46603. const fnArray = context.fnArray,
  46604. argsArray = context.argsArray;
  46605. const curr = context.iCurr;
  46606. const iFirstSave = curr - 3;
  46607. const iFirstTransform = curr - 2;
  46608. const iFirstPIXO = curr - 1;
  46609. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46610. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46611. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46612. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  46613. if (count < MIN_IMAGES_IN_BLOCK) {
  46614. return i - (i - iFirstSave) % 4;
  46615. }
  46616. const positions = new Float32Array(count * 2);
  46617. let iTransform = iFirstTransform;
  46618. for (let q = 0; q < count; q++, iTransform += 4) {
  46619. const transformArgs = argsArray[iTransform];
  46620. positions[q << 1] = transformArgs[4];
  46621. positions[(q << 1) + 1] = transformArgs[5];
  46622. }
  46623. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  46624. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  46625. argsArray.splice(iFirstSave, count * 4, args);
  46626. return iFirstSave + 1;
  46627. });
  46628. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  46629. const fnArray = context.fnArray,
  46630. argsArray = context.argsArray;
  46631. const iFirstSave = context.iCurr - 4;
  46632. const pos = (i - iFirstSave) % 5;
  46633. switch (pos) {
  46634. case 0:
  46635. return fnArray[i] === _util.OPS.beginText;
  46636. case 1:
  46637. return fnArray[i] === _util.OPS.setFont;
  46638. case 2:
  46639. return fnArray[i] === _util.OPS.setTextMatrix;
  46640. case 3:
  46641. if (fnArray[i] !== _util.OPS.showText) {
  46642. return false;
  46643. }
  46644. const iFirstSetFont = context.iCurr - 3;
  46645. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46646. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46647. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  46648. return false;
  46649. }
  46650. return true;
  46651. case 4:
  46652. return fnArray[i] === _util.OPS.endText;
  46653. }
  46654. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  46655. }, function (context, i) {
  46656. const MIN_CHARS_IN_BLOCK = 3;
  46657. const MAX_CHARS_IN_BLOCK = 1000;
  46658. const fnArray = context.fnArray,
  46659. argsArray = context.argsArray;
  46660. const curr = context.iCurr;
  46661. const iFirstBeginText = curr - 4;
  46662. const iFirstSetFont = curr - 3;
  46663. const iFirstSetTextMatrix = curr - 2;
  46664. const iFirstShowText = curr - 1;
  46665. const iFirstEndText = curr;
  46666. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46667. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46668. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  46669. if (count < MIN_CHARS_IN_BLOCK) {
  46670. return i - (i - iFirstBeginText) % 5;
  46671. }
  46672. let iFirst = iFirstBeginText;
  46673. 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) {
  46674. count++;
  46675. iFirst -= 5;
  46676. }
  46677. let iEndText = iFirst + 4;
  46678. for (let q = 1; q < count; q++) {
  46679. fnArray.splice(iEndText, 3);
  46680. argsArray.splice(iEndText, 3);
  46681. iEndText += 2;
  46682. }
  46683. return iEndText + 1;
  46684. });
  46685. class NullOptimizer {
  46686. constructor(queue) {
  46687. this.queue = queue;
  46688. }
  46689. _optimize() {}
  46690. push(fn, args) {
  46691. this.queue.fnArray.push(fn);
  46692. this.queue.argsArray.push(args);
  46693. this._optimize();
  46694. }
  46695. flush() {}
  46696. reset() {}
  46697. }
  46698. class QueueOptimizer extends NullOptimizer {
  46699. constructor(queue) {
  46700. super(queue);
  46701. this.state = null;
  46702. this.context = {
  46703. iCurr: 0,
  46704. fnArray: queue.fnArray,
  46705. argsArray: queue.argsArray
  46706. };
  46707. this.match = null;
  46708. this.lastProcessed = 0;
  46709. }
  46710. _optimize() {
  46711. const fnArray = this.queue.fnArray;
  46712. let i = this.lastProcessed,
  46713. ii = fnArray.length;
  46714. let state = this.state;
  46715. let match = this.match;
  46716. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  46717. this.lastProcessed = ii;
  46718. return;
  46719. }
  46720. const context = this.context;
  46721. while (i < ii) {
  46722. if (match) {
  46723. const iterate = (0, match.iterateFn)(context, i);
  46724. if (iterate) {
  46725. i++;
  46726. continue;
  46727. }
  46728. i = (0, match.processFn)(context, i + 1);
  46729. ii = fnArray.length;
  46730. match = null;
  46731. state = null;
  46732. if (i >= ii) {
  46733. break;
  46734. }
  46735. }
  46736. state = (state || InitialState)[fnArray[i]];
  46737. if (!state || Array.isArray(state)) {
  46738. i++;
  46739. continue;
  46740. }
  46741. context.iCurr = i;
  46742. i++;
  46743. if (state.checkFn && !(0, state.checkFn)(context)) {
  46744. state = null;
  46745. continue;
  46746. }
  46747. match = state;
  46748. state = null;
  46749. }
  46750. this.state = state;
  46751. this.match = match;
  46752. this.lastProcessed = i;
  46753. }
  46754. flush() {
  46755. while (this.match) {
  46756. const length = this.queue.fnArray.length;
  46757. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  46758. this.match = null;
  46759. this.state = null;
  46760. this._optimize();
  46761. }
  46762. }
  46763. reset() {
  46764. this.state = null;
  46765. this.match = null;
  46766. this.lastProcessed = 0;
  46767. }
  46768. }
  46769. class OperatorList {
  46770. static get CHUNK_SIZE() {
  46771. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  46772. }
  46773. static get CHUNK_SIZE_ABOUT() {
  46774. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  46775. }
  46776. constructor(intent = 0, streamSink) {
  46777. this._streamSink = streamSink;
  46778. this.fnArray = [];
  46779. this.argsArray = [];
  46780. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  46781. this.optimizer = new QueueOptimizer(this);
  46782. } else {
  46783. this.optimizer = new NullOptimizer(this);
  46784. }
  46785. this.dependencies = new Set();
  46786. this._totalLength = 0;
  46787. this.weight = 0;
  46788. this._resolved = streamSink ? null : Promise.resolve();
  46789. }
  46790. get length() {
  46791. return this.argsArray.length;
  46792. }
  46793. get ready() {
  46794. return this._resolved || this._streamSink.ready;
  46795. }
  46796. get totalLength() {
  46797. return this._totalLength + this.length;
  46798. }
  46799. addOp(fn, args) {
  46800. this.optimizer.push(fn, args);
  46801. this.weight++;
  46802. if (this._streamSink) {
  46803. if (this.weight >= OperatorList.CHUNK_SIZE) {
  46804. this.flush();
  46805. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  46806. this.flush();
  46807. }
  46808. }
  46809. }
  46810. addImageOps(fn, args, optionalContent) {
  46811. if (optionalContent !== undefined) {
  46812. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  46813. }
  46814. this.addOp(fn, args);
  46815. if (optionalContent !== undefined) {
  46816. this.addOp(_util.OPS.endMarkedContent, []);
  46817. }
  46818. }
  46819. addDependency(dependency) {
  46820. if (this.dependencies.has(dependency)) {
  46821. return;
  46822. }
  46823. this.dependencies.add(dependency);
  46824. this.addOp(_util.OPS.dependency, [dependency]);
  46825. }
  46826. addDependencies(dependencies) {
  46827. for (const dependency of dependencies) {
  46828. this.addDependency(dependency);
  46829. }
  46830. }
  46831. addOpList(opList) {
  46832. if (!(opList instanceof OperatorList)) {
  46833. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  46834. return;
  46835. }
  46836. for (const dependency of opList.dependencies) {
  46837. this.dependencies.add(dependency);
  46838. }
  46839. for (let i = 0, ii = opList.length; i < ii; i++) {
  46840. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  46841. }
  46842. }
  46843. getIR() {
  46844. return {
  46845. fnArray: this.fnArray,
  46846. argsArray: this.argsArray,
  46847. length: this.length
  46848. };
  46849. }
  46850. get _transfers() {
  46851. const transfers = [];
  46852. const {
  46853. fnArray,
  46854. argsArray,
  46855. length
  46856. } = this;
  46857. for (let i = 0; i < length; i++) {
  46858. switch (fnArray[i]) {
  46859. case _util.OPS.paintInlineImageXObject:
  46860. case _util.OPS.paintInlineImageXObjectGroup:
  46861. case _util.OPS.paintImageMaskXObject:
  46862. const arg = argsArray[i][0];
  46863. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  46864. transfers.push(arg.data.buffer);
  46865. }
  46866. break;
  46867. }
  46868. }
  46869. return transfers;
  46870. }
  46871. flush(lastChunk = false, separateAnnots = null) {
  46872. this.optimizer.flush();
  46873. const length = this.length;
  46874. this._totalLength += length;
  46875. this._streamSink.enqueue({
  46876. fnArray: this.fnArray,
  46877. argsArray: this.argsArray,
  46878. lastChunk,
  46879. separateAnnots,
  46880. length
  46881. }, 1, this._transfers);
  46882. this.dependencies.clear();
  46883. this.fnArray.length = 0;
  46884. this.argsArray.length = 0;
  46885. this.weight = 0;
  46886. this.optimizer.reset();
  46887. }
  46888. }
  46889. exports.OperatorList = OperatorList;
  46890. /***/ }),
  46891. /* 61 */
  46892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46893. Object.defineProperty(exports, "__esModule", ({
  46894. value: true
  46895. }));
  46896. exports.PDFImage = void 0;
  46897. var _util = __w_pdfjs_require__(2);
  46898. var _image_utils = __w_pdfjs_require__(62);
  46899. var _base_stream = __w_pdfjs_require__(5);
  46900. var _colorspace = __w_pdfjs_require__(12);
  46901. var _decode_stream = __w_pdfjs_require__(17);
  46902. var _jpeg_stream = __w_pdfjs_require__(25);
  46903. var _jpx = __w_pdfjs_require__(28);
  46904. var _primitives = __w_pdfjs_require__(3);
  46905. function decodeAndClamp(value, addend, coefficient, max) {
  46906. value = addend + value * coefficient;
  46907. if (value < 0) {
  46908. value = 0;
  46909. } else if (value > max) {
  46910. value = max;
  46911. }
  46912. return value;
  46913. }
  46914. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  46915. const length = w2 * h2;
  46916. let dest;
  46917. if (bpc <= 8) {
  46918. dest = new Uint8Array(length);
  46919. } else if (bpc <= 16) {
  46920. dest = new Uint16Array(length);
  46921. } else {
  46922. dest = new Uint32Array(length);
  46923. }
  46924. const xRatio = w1 / w2;
  46925. const yRatio = h1 / h2;
  46926. let i,
  46927. j,
  46928. py,
  46929. newIndex = 0,
  46930. oldIndex;
  46931. const xScaled = new Uint16Array(w2);
  46932. const w1Scanline = w1;
  46933. for (i = 0; i < w2; i++) {
  46934. xScaled[i] = Math.floor(i * xRatio);
  46935. }
  46936. for (i = 0; i < h2; i++) {
  46937. py = Math.floor(i * yRatio) * w1Scanline;
  46938. for (j = 0; j < w2; j++) {
  46939. oldIndex = py + xScaled[j];
  46940. dest[newIndex++] = src[oldIndex];
  46941. }
  46942. }
  46943. return dest;
  46944. }
  46945. class PDFImage {
  46946. constructor({
  46947. xref,
  46948. res,
  46949. image,
  46950. isInline = false,
  46951. smask = null,
  46952. mask = null,
  46953. isMask = false,
  46954. pdfFunctionFactory,
  46955. localColorSpaceCache
  46956. }) {
  46957. this.image = image;
  46958. const dict = image.dict;
  46959. const filter = dict.get("F", "Filter");
  46960. let filterName;
  46961. if (filter instanceof _primitives.Name) {
  46962. filterName = filter.name;
  46963. } else if (Array.isArray(filter)) {
  46964. const filterZero = xref.fetchIfRef(filter[0]);
  46965. if (filterZero instanceof _primitives.Name) {
  46966. filterName = filterZero.name;
  46967. }
  46968. }
  46969. switch (filterName) {
  46970. case "JPXDecode":
  46971. const jpxImage = new _jpx.JpxImage();
  46972. jpxImage.parseImageProperties(image.stream);
  46973. image.stream.reset();
  46974. image.width = jpxImage.width;
  46975. image.height = jpxImage.height;
  46976. image.bitsPerComponent = jpxImage.bitsPerComponent;
  46977. image.numComps = jpxImage.componentsCount;
  46978. break;
  46979. case "JBIG2Decode":
  46980. image.bitsPerComponent = 1;
  46981. image.numComps = 1;
  46982. break;
  46983. }
  46984. let width = dict.get("W", "Width");
  46985. let height = dict.get("H", "Height");
  46986. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  46987. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  46988. width = image.width;
  46989. height = image.height;
  46990. }
  46991. if (width < 1 || height < 1) {
  46992. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  46993. }
  46994. this.width = width;
  46995. this.height = height;
  46996. this.interpolate = dict.get("I", "Interpolate");
  46997. this.imageMask = dict.get("IM", "ImageMask") || false;
  46998. this.matte = dict.get("Matte") || false;
  46999. let bitsPerComponent = image.bitsPerComponent;
  47000. if (!bitsPerComponent) {
  47001. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  47002. if (!bitsPerComponent) {
  47003. if (this.imageMask) {
  47004. bitsPerComponent = 1;
  47005. } else {
  47006. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  47007. }
  47008. }
  47009. }
  47010. this.bpc = bitsPerComponent;
  47011. if (!this.imageMask) {
  47012. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  47013. if (!colorSpace) {
  47014. (0, _util.info)("JPX images (which do not require color spaces)");
  47015. switch (image.numComps) {
  47016. case 1:
  47017. colorSpace = _primitives.Name.get("DeviceGray");
  47018. break;
  47019. case 3:
  47020. colorSpace = _primitives.Name.get("DeviceRGB");
  47021. break;
  47022. case 4:
  47023. colorSpace = _primitives.Name.get("DeviceCMYK");
  47024. break;
  47025. default:
  47026. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  47027. }
  47028. }
  47029. this.colorSpace = _colorspace.ColorSpace.parse({
  47030. cs: colorSpace,
  47031. xref,
  47032. resources: isInline ? res : null,
  47033. pdfFunctionFactory,
  47034. localColorSpaceCache
  47035. });
  47036. this.numComps = this.colorSpace.numComps;
  47037. }
  47038. this.decode = dict.getArray("D", "Decode");
  47039. this.needsDecode = false;
  47040. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  47041. this.needsDecode = true;
  47042. const max = (1 << bitsPerComponent) - 1;
  47043. this.decodeCoefficients = [];
  47044. this.decodeAddends = [];
  47045. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  47046. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  47047. const dmin = this.decode[i];
  47048. const dmax = this.decode[i + 1];
  47049. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  47050. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  47051. }
  47052. }
  47053. if (smask) {
  47054. this.smask = new PDFImage({
  47055. xref,
  47056. res,
  47057. image: smask,
  47058. isInline,
  47059. pdfFunctionFactory,
  47060. localColorSpaceCache
  47061. });
  47062. } else if (mask) {
  47063. if (mask instanceof _base_stream.BaseStream) {
  47064. const maskDict = mask.dict,
  47065. imageMask = maskDict.get("IM", "ImageMask");
  47066. if (!imageMask) {
  47067. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  47068. } else {
  47069. this.mask = new PDFImage({
  47070. xref,
  47071. res,
  47072. image: mask,
  47073. isInline,
  47074. isMask: true,
  47075. pdfFunctionFactory,
  47076. localColorSpaceCache
  47077. });
  47078. }
  47079. } else {
  47080. this.mask = mask;
  47081. }
  47082. }
  47083. }
  47084. static async buildImage({
  47085. xref,
  47086. res,
  47087. image,
  47088. isInline = false,
  47089. pdfFunctionFactory,
  47090. localColorSpaceCache
  47091. }) {
  47092. const imageData = image;
  47093. let smaskData = null;
  47094. let maskData = null;
  47095. const smask = image.dict.get("SMask");
  47096. const mask = image.dict.get("Mask");
  47097. if (smask) {
  47098. if (smask instanceof _base_stream.BaseStream) {
  47099. smaskData = smask;
  47100. } else {
  47101. (0, _util.warn)("Unsupported /SMask format.");
  47102. }
  47103. } else if (mask) {
  47104. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  47105. maskData = mask;
  47106. } else {
  47107. (0, _util.warn)("Unsupported /Mask format.");
  47108. }
  47109. }
  47110. return new PDFImage({
  47111. xref,
  47112. res,
  47113. image: imageData,
  47114. isInline,
  47115. smask: smaskData,
  47116. mask: maskData,
  47117. pdfFunctionFactory,
  47118. localColorSpaceCache
  47119. });
  47120. }
  47121. static createRawMask({
  47122. imgArray,
  47123. width,
  47124. height,
  47125. imageIsFromDecodeStream,
  47126. inverseDecode,
  47127. interpolate
  47128. }) {
  47129. const computedLength = (width + 7 >> 3) * height;
  47130. const actualLength = imgArray.byteLength;
  47131. const haveFullData = computedLength === actualLength;
  47132. let data, i;
  47133. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  47134. data = imgArray;
  47135. } else if (!inverseDecode) {
  47136. data = new Uint8Array(imgArray);
  47137. } else {
  47138. data = new Uint8Array(computedLength);
  47139. data.set(imgArray);
  47140. data.fill(0xff, actualLength);
  47141. }
  47142. if (inverseDecode) {
  47143. for (i = 0; i < actualLength; i++) {
  47144. data[i] ^= 0xff;
  47145. }
  47146. }
  47147. return {
  47148. data,
  47149. width,
  47150. height,
  47151. interpolate
  47152. };
  47153. }
  47154. static createMask({
  47155. imgArray,
  47156. width,
  47157. height,
  47158. imageIsFromDecodeStream,
  47159. inverseDecode,
  47160. interpolate,
  47161. isOffscreenCanvasSupported = true
  47162. }) {
  47163. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  47164. if (isSingleOpaquePixel) {
  47165. return {
  47166. isSingleOpaquePixel
  47167. };
  47168. }
  47169. if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
  47170. const canvas = new OffscreenCanvas(width, height);
  47171. const ctx = canvas.getContext("2d");
  47172. const imgData = ctx.createImageData(width, height);
  47173. (0, _image_utils.applyMaskImageData)({
  47174. src: imgArray,
  47175. dest: imgData.data,
  47176. width,
  47177. height,
  47178. inverseDecode
  47179. });
  47180. ctx.putImageData(imgData, 0, 0);
  47181. const bitmap = canvas.transferToImageBitmap();
  47182. return {
  47183. data: null,
  47184. width,
  47185. height,
  47186. interpolate,
  47187. bitmap
  47188. };
  47189. }
  47190. return this.createRawMask({
  47191. imgArray,
  47192. width,
  47193. height,
  47194. inverseDecode,
  47195. imageIsFromDecodeStream,
  47196. interpolate
  47197. });
  47198. }
  47199. get drawWidth() {
  47200. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  47201. }
  47202. get drawHeight() {
  47203. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  47204. }
  47205. decodeBuffer(buffer) {
  47206. const bpc = this.bpc;
  47207. const numComps = this.numComps;
  47208. const decodeAddends = this.decodeAddends;
  47209. const decodeCoefficients = this.decodeCoefficients;
  47210. const max = (1 << bpc) - 1;
  47211. let i, ii;
  47212. if (bpc === 1) {
  47213. for (i = 0, ii = buffer.length; i < ii; i++) {
  47214. buffer[i] = +!buffer[i];
  47215. }
  47216. return;
  47217. }
  47218. let index = 0;
  47219. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  47220. for (let j = 0; j < numComps; j++) {
  47221. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  47222. index++;
  47223. }
  47224. }
  47225. }
  47226. getComponents(buffer) {
  47227. const bpc = this.bpc;
  47228. if (bpc === 8) {
  47229. return buffer;
  47230. }
  47231. const width = this.width;
  47232. const height = this.height;
  47233. const numComps = this.numComps;
  47234. const length = width * height * numComps;
  47235. let bufferPos = 0;
  47236. let output;
  47237. if (bpc <= 8) {
  47238. output = new Uint8Array(length);
  47239. } else if (bpc <= 16) {
  47240. output = new Uint16Array(length);
  47241. } else {
  47242. output = new Uint32Array(length);
  47243. }
  47244. const rowComps = width * numComps;
  47245. const max = (1 << bpc) - 1;
  47246. let i = 0,
  47247. ii,
  47248. buf;
  47249. if (bpc === 1) {
  47250. let mask, loop1End, loop2End;
  47251. for (let j = 0; j < height; j++) {
  47252. loop1End = i + (rowComps & ~7);
  47253. loop2End = i + rowComps;
  47254. while (i < loop1End) {
  47255. buf = buffer[bufferPos++];
  47256. output[i] = buf >> 7 & 1;
  47257. output[i + 1] = buf >> 6 & 1;
  47258. output[i + 2] = buf >> 5 & 1;
  47259. output[i + 3] = buf >> 4 & 1;
  47260. output[i + 4] = buf >> 3 & 1;
  47261. output[i + 5] = buf >> 2 & 1;
  47262. output[i + 6] = buf >> 1 & 1;
  47263. output[i + 7] = buf & 1;
  47264. i += 8;
  47265. }
  47266. if (i < loop2End) {
  47267. buf = buffer[bufferPos++];
  47268. mask = 128;
  47269. while (i < loop2End) {
  47270. output[i++] = +!!(buf & mask);
  47271. mask >>= 1;
  47272. }
  47273. }
  47274. }
  47275. } else {
  47276. let bits = 0;
  47277. buf = 0;
  47278. for (i = 0, ii = length; i < ii; ++i) {
  47279. if (i % rowComps === 0) {
  47280. buf = 0;
  47281. bits = 0;
  47282. }
  47283. while (bits < bpc) {
  47284. buf = buf << 8 | buffer[bufferPos++];
  47285. bits += 8;
  47286. }
  47287. const remainingBits = bits - bpc;
  47288. let value = buf >> remainingBits;
  47289. if (value < 0) {
  47290. value = 0;
  47291. } else if (value > max) {
  47292. value = max;
  47293. }
  47294. output[i] = value;
  47295. buf &= (1 << remainingBits) - 1;
  47296. bits = remainingBits;
  47297. }
  47298. }
  47299. return output;
  47300. }
  47301. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  47302. const smask = this.smask;
  47303. const mask = this.mask;
  47304. let alphaBuf, sw, sh, i, ii, j;
  47305. if (smask) {
  47306. sw = smask.width;
  47307. sh = smask.height;
  47308. alphaBuf = new Uint8ClampedArray(sw * sh);
  47309. smask.fillGrayBuffer(alphaBuf);
  47310. if (sw !== width || sh !== height) {
  47311. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  47312. }
  47313. } else if (mask) {
  47314. if (mask instanceof PDFImage) {
  47315. sw = mask.width;
  47316. sh = mask.height;
  47317. alphaBuf = new Uint8ClampedArray(sw * sh);
  47318. mask.numComps = 1;
  47319. mask.fillGrayBuffer(alphaBuf);
  47320. for (i = 0, ii = sw * sh; i < ii; ++i) {
  47321. alphaBuf[i] = 255 - alphaBuf[i];
  47322. }
  47323. if (sw !== width || sh !== height) {
  47324. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  47325. }
  47326. } else if (Array.isArray(mask)) {
  47327. alphaBuf = new Uint8ClampedArray(width * height);
  47328. const numComps = this.numComps;
  47329. for (i = 0, ii = width * height; i < ii; ++i) {
  47330. let opacity = 0;
  47331. const imageOffset = i * numComps;
  47332. for (j = 0; j < numComps; ++j) {
  47333. const color = image[imageOffset + j];
  47334. const maskOffset = j * 2;
  47335. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  47336. opacity = 255;
  47337. break;
  47338. }
  47339. }
  47340. alphaBuf[i] = opacity;
  47341. }
  47342. } else {
  47343. throw new _util.FormatError("Unknown mask format.");
  47344. }
  47345. }
  47346. if (alphaBuf) {
  47347. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  47348. rgbaBuf[j] = alphaBuf[i];
  47349. }
  47350. } else {
  47351. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  47352. rgbaBuf[j] = 255;
  47353. }
  47354. }
  47355. }
  47356. undoPreblend(buffer, width, height) {
  47357. const matte = this.smask && this.smask.matte;
  47358. if (!matte) {
  47359. return;
  47360. }
  47361. const matteRgb = this.colorSpace.getRgb(matte, 0);
  47362. const matteR = matteRgb[0];
  47363. const matteG = matteRgb[1];
  47364. const matteB = matteRgb[2];
  47365. const length = width * height * 4;
  47366. for (let i = 0; i < length; i += 4) {
  47367. const alpha = buffer[i + 3];
  47368. if (alpha === 0) {
  47369. buffer[i] = 255;
  47370. buffer[i + 1] = 255;
  47371. buffer[i + 2] = 255;
  47372. continue;
  47373. }
  47374. const k = 255 / alpha;
  47375. buffer[i] = (buffer[i] - matteR) * k + matteR;
  47376. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  47377. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  47378. }
  47379. }
  47380. createImageData(forceRGBA = false) {
  47381. const drawWidth = this.drawWidth;
  47382. const drawHeight = this.drawHeight;
  47383. const imgData = {
  47384. width: drawWidth,
  47385. height: drawHeight,
  47386. interpolate: this.interpolate,
  47387. kind: 0,
  47388. data: null
  47389. };
  47390. const numComps = this.numComps;
  47391. const originalWidth = this.width;
  47392. const originalHeight = this.height;
  47393. const bpc = this.bpc;
  47394. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  47395. if (!forceRGBA) {
  47396. let kind;
  47397. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  47398. kind = _util.ImageKind.GRAYSCALE_1BPP;
  47399. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  47400. kind = _util.ImageKind.RGB_24BPP;
  47401. }
  47402. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  47403. imgData.kind = kind;
  47404. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  47405. if (this.needsDecode) {
  47406. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  47407. const buffer = imgData.data;
  47408. for (let i = 0, ii = buffer.length; i < ii; i++) {
  47409. buffer[i] ^= 0xff;
  47410. }
  47411. }
  47412. return imgData;
  47413. }
  47414. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  47415. let imageLength = originalHeight * rowBytes;
  47416. switch (this.colorSpace.name) {
  47417. case "DeviceGray":
  47418. imageLength *= 3;
  47419. case "DeviceRGB":
  47420. case "DeviceCMYK":
  47421. imgData.kind = _util.ImageKind.RGB_24BPP;
  47422. imgData.data = this.getImageBytes(imageLength, {
  47423. drawWidth,
  47424. drawHeight,
  47425. forceRGB: true
  47426. });
  47427. return imgData;
  47428. }
  47429. }
  47430. }
  47431. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  47432. internal: true
  47433. });
  47434. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  47435. const comps = this.getComponents(imgArray);
  47436. let alpha01, maybeUndoPreblend;
  47437. if (!forceRGBA && !this.smask && !this.mask) {
  47438. imgData.kind = _util.ImageKind.RGB_24BPP;
  47439. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  47440. alpha01 = 0;
  47441. maybeUndoPreblend = false;
  47442. } else {
  47443. imgData.kind = _util.ImageKind.RGBA_32BPP;
  47444. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  47445. alpha01 = 1;
  47446. maybeUndoPreblend = true;
  47447. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  47448. }
  47449. if (this.needsDecode) {
  47450. this.decodeBuffer(comps);
  47451. }
  47452. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  47453. if (maybeUndoPreblend) {
  47454. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  47455. }
  47456. return imgData;
  47457. }
  47458. fillGrayBuffer(buffer) {
  47459. const numComps = this.numComps;
  47460. if (numComps !== 1) {
  47461. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  47462. }
  47463. const width = this.width;
  47464. const height = this.height;
  47465. const bpc = this.bpc;
  47466. const rowBytes = width * numComps * bpc + 7 >> 3;
  47467. const imgArray = this.getImageBytes(height * rowBytes, {
  47468. internal: true
  47469. });
  47470. const comps = this.getComponents(imgArray);
  47471. let i, length;
  47472. if (bpc === 1) {
  47473. length = width * height;
  47474. if (this.needsDecode) {
  47475. for (i = 0; i < length; ++i) {
  47476. buffer[i] = comps[i] - 1 & 255;
  47477. }
  47478. } else {
  47479. for (i = 0; i < length; ++i) {
  47480. buffer[i] = -comps[i] & 255;
  47481. }
  47482. }
  47483. return;
  47484. }
  47485. if (this.needsDecode) {
  47486. this.decodeBuffer(comps);
  47487. }
  47488. length = width * height;
  47489. const scale = 255 / ((1 << bpc) - 1);
  47490. for (i = 0; i < length; ++i) {
  47491. buffer[i] = scale * comps[i];
  47492. }
  47493. }
  47494. getImageBytes(length, {
  47495. drawWidth,
  47496. drawHeight,
  47497. forceRGB = false,
  47498. internal = false
  47499. }) {
  47500. this.image.reset();
  47501. this.image.drawWidth = drawWidth || this.width;
  47502. this.image.drawHeight = drawHeight || this.height;
  47503. this.image.forceRGB = !!forceRGB;
  47504. const imageBytes = this.image.getBytes(length);
  47505. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  47506. return imageBytes;
  47507. }
  47508. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  47509. return new Uint8Array(imageBytes);
  47510. }
  47511. }
  47512. exports.PDFImage = PDFImage;
  47513. /***/ }),
  47514. /* 62 */
  47515. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47516. Object.defineProperty(exports, "__esModule", ({
  47517. value: true
  47518. }));
  47519. exports.applyMaskImageData = applyMaskImageData;
  47520. var _util = __w_pdfjs_require__(2);
  47521. function applyMaskImageData({
  47522. src,
  47523. srcPos = 0,
  47524. dest,
  47525. destPos = 0,
  47526. width,
  47527. height,
  47528. inverseDecode = false
  47529. }) {
  47530. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  47531. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  47532. const widthInSource = width >> 3;
  47533. const widthRemainder = width & 7;
  47534. const srcLength = src.length;
  47535. dest = new Uint32Array(dest.buffer);
  47536. for (let i = 0; i < height; i++) {
  47537. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  47538. const elem = srcPos < srcLength ? src[srcPos] : 255;
  47539. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  47540. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  47541. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  47542. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  47543. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  47544. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  47545. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  47546. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  47547. }
  47548. if (widthRemainder === 0) {
  47549. continue;
  47550. }
  47551. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  47552. for (let j = 0; j < widthRemainder; j++) {
  47553. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  47554. }
  47555. }
  47556. return {
  47557. srcPos,
  47558. destPos
  47559. };
  47560. }
  47561. /***/ }),
  47562. /* 63 */
  47563. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47564. Object.defineProperty(exports, "__esModule", ({
  47565. value: true
  47566. }));
  47567. exports.incrementalUpdate = incrementalUpdate;
  47568. exports.writeDict = writeDict;
  47569. exports.writeObject = writeObject;
  47570. var _util = __w_pdfjs_require__(2);
  47571. var _primitives = __w_pdfjs_require__(3);
  47572. var _core_utils = __w_pdfjs_require__(4);
  47573. var _xml_parser = __w_pdfjs_require__(64);
  47574. var _base_stream = __w_pdfjs_require__(5);
  47575. var _crypto = __w_pdfjs_require__(65);
  47576. function writeObject(ref, obj, buffer, transform) {
  47577. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  47578. if (obj instanceof _primitives.Dict) {
  47579. writeDict(obj, buffer, transform);
  47580. } else if (obj instanceof _base_stream.BaseStream) {
  47581. writeStream(obj, buffer, transform);
  47582. }
  47583. buffer.push("\nendobj\n");
  47584. }
  47585. function writeDict(dict, buffer, transform) {
  47586. buffer.push("<<");
  47587. for (const key of dict.getKeys()) {
  47588. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47589. writeValue(dict.getRaw(key), buffer, transform);
  47590. }
  47591. buffer.push(">>");
  47592. }
  47593. function writeStream(stream, buffer, transform) {
  47594. writeDict(stream.dict, buffer, transform);
  47595. buffer.push(" stream\n");
  47596. let string = stream.getString();
  47597. if (transform !== null) {
  47598. string = transform.encryptString(string);
  47599. }
  47600. buffer.push(string, "\nendstream");
  47601. }
  47602. function writeArray(array, buffer, transform) {
  47603. buffer.push("[");
  47604. let first = true;
  47605. for (const val of array) {
  47606. if (!first) {
  47607. buffer.push(" ");
  47608. } else {
  47609. first = false;
  47610. }
  47611. writeValue(val, buffer, transform);
  47612. }
  47613. buffer.push("]");
  47614. }
  47615. function writeValue(value, buffer, transform) {
  47616. if (value instanceof _primitives.Name) {
  47617. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47618. } else if (value instanceof _primitives.Ref) {
  47619. buffer.push(`${value.num} ${value.gen} R`);
  47620. } else if (Array.isArray(value)) {
  47621. writeArray(value, buffer, transform);
  47622. } else if (typeof value === "string") {
  47623. if (transform !== null) {
  47624. value = transform.encryptString(value);
  47625. }
  47626. buffer.push(`(${(0, _core_utils.escapeString)(value)})`);
  47627. } else if (typeof value === "number") {
  47628. buffer.push((0, _core_utils.numberToString)(value));
  47629. } else if (typeof value === "boolean") {
  47630. buffer.push(value.toString());
  47631. } else if (value instanceof _primitives.Dict) {
  47632. writeDict(value, buffer, transform);
  47633. } else if (value instanceof _base_stream.BaseStream) {
  47634. writeStream(value, buffer, transform);
  47635. } else if (value === null) {
  47636. buffer.push("null");
  47637. } else {
  47638. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  47639. }
  47640. }
  47641. function writeInt(number, size, offset, buffer) {
  47642. for (let i = size + offset - 1; i > offset - 1; i--) {
  47643. buffer[i] = number & 0xff;
  47644. number >>= 8;
  47645. }
  47646. return offset + size;
  47647. }
  47648. function writeString(string, offset, buffer) {
  47649. for (let i = 0, len = string.length; i < len; i++) {
  47650. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47651. }
  47652. }
  47653. function computeMD5(filesize, xrefInfo) {
  47654. const time = Math.floor(Date.now() / 1000);
  47655. const filename = xrefInfo.filename || "";
  47656. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47657. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47658. for (const value of Object.values(xrefInfo.info)) {
  47659. md5Buffer.push(value);
  47660. md5BufferLen += value.length;
  47661. }
  47662. const array = new Uint8Array(md5BufferLen);
  47663. let offset = 0;
  47664. for (const str of md5Buffer) {
  47665. writeString(str, offset, array);
  47666. offset += str.length;
  47667. }
  47668. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47669. }
  47670. function writeXFADataForAcroform(str, newRefs) {
  47671. const xml = new _xml_parser.SimpleXMLParser({
  47672. hasAttributes: true
  47673. }).parseFromString(str);
  47674. for (const {
  47675. xfa
  47676. } of newRefs) {
  47677. if (!xfa) {
  47678. continue;
  47679. }
  47680. const {
  47681. path,
  47682. value
  47683. } = xfa;
  47684. if (!path) {
  47685. continue;
  47686. }
  47687. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  47688. if (node) {
  47689. if (Array.isArray(value)) {
  47690. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  47691. } else {
  47692. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  47693. }
  47694. } else {
  47695. (0, _util.warn)(`Node not found for path: ${path}`);
  47696. }
  47697. }
  47698. const buffer = [];
  47699. xml.documentElement.dump(buffer);
  47700. return buffer.join("");
  47701. }
  47702. function updateAcroform({
  47703. xref,
  47704. acroForm,
  47705. acroFormRef,
  47706. hasXfa,
  47707. hasXfaDatasetsEntry,
  47708. xfaDatasetsRef,
  47709. needAppearances,
  47710. newRefs
  47711. }) {
  47712. if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
  47713. (0, _util.warn)("XFA - Cannot save it");
  47714. }
  47715. if (!needAppearances && (!hasXfa || !xfaDatasetsRef)) {
  47716. return;
  47717. }
  47718. const dict = new _primitives.Dict(xref);
  47719. for (const key of acroForm.getKeys()) {
  47720. dict.set(key, acroForm.getRaw(key));
  47721. }
  47722. if (hasXfa && !hasXfaDatasetsEntry) {
  47723. const newXfa = acroForm.get("XFA").slice();
  47724. newXfa.splice(2, 0, "datasets");
  47725. newXfa.splice(3, 0, xfaDatasetsRef);
  47726. dict.set("XFA", newXfa);
  47727. }
  47728. if (needAppearances) {
  47729. dict.set("NeedAppearances", true);
  47730. }
  47731. const encrypt = xref.encrypt;
  47732. let transform = null;
  47733. if (encrypt) {
  47734. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  47735. }
  47736. const buffer = [];
  47737. writeObject(acroFormRef, dict, buffer, transform);
  47738. newRefs.push({
  47739. ref: acroFormRef,
  47740. data: buffer.join("")
  47741. });
  47742. }
  47743. function updateXFA({
  47744. xfaData,
  47745. xfaDatasetsRef,
  47746. newRefs,
  47747. xref
  47748. }) {
  47749. if (xfaData === null) {
  47750. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  47751. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  47752. }
  47753. const encrypt = xref.encrypt;
  47754. if (encrypt) {
  47755. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  47756. xfaData = transform.encryptString(xfaData);
  47757. }
  47758. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  47759. newRefs.push({
  47760. ref: xfaDatasetsRef,
  47761. data
  47762. });
  47763. }
  47764. function incrementalUpdate({
  47765. originalData,
  47766. xrefInfo,
  47767. newRefs,
  47768. xref = null,
  47769. hasXfa = false,
  47770. xfaDatasetsRef = null,
  47771. hasXfaDatasetsEntry = false,
  47772. needAppearances,
  47773. acroFormRef = null,
  47774. acroForm = null,
  47775. xfaData = null
  47776. }) {
  47777. updateAcroform({
  47778. xref,
  47779. acroForm,
  47780. acroFormRef,
  47781. hasXfa,
  47782. hasXfaDatasetsEntry,
  47783. xfaDatasetsRef,
  47784. needAppearances,
  47785. newRefs
  47786. });
  47787. if (hasXfa) {
  47788. updateXFA({
  47789. xfaData,
  47790. xfaDatasetsRef,
  47791. newRefs,
  47792. xref
  47793. });
  47794. }
  47795. const newXref = new _primitives.Dict(null);
  47796. const refForXrefTable = xrefInfo.newRef;
  47797. let buffer, baseOffset;
  47798. const lastByte = originalData.at(-1);
  47799. if (lastByte === 0x0a || lastByte === 0x0d) {
  47800. buffer = [];
  47801. baseOffset = originalData.length;
  47802. } else {
  47803. buffer = ["\n"];
  47804. baseOffset = originalData.length + 1;
  47805. }
  47806. newXref.set("Size", refForXrefTable.num + 1);
  47807. newXref.set("Prev", xrefInfo.startXRef);
  47808. newXref.set("Type", _primitives.Name.get("XRef"));
  47809. if (xrefInfo.rootRef !== null) {
  47810. newXref.set("Root", xrefInfo.rootRef);
  47811. }
  47812. if (xrefInfo.infoRef !== null) {
  47813. newXref.set("Info", xrefInfo.infoRef);
  47814. }
  47815. if (xrefInfo.encryptRef !== null) {
  47816. newXref.set("Encrypt", xrefInfo.encryptRef);
  47817. }
  47818. newRefs.push({
  47819. ref: refForXrefTable,
  47820. data: ""
  47821. });
  47822. newRefs = newRefs.sort((a, b) => {
  47823. return a.ref.num - b.ref.num;
  47824. });
  47825. const xrefTableData = [[0, 1, 0xffff]];
  47826. const indexes = [0, 1];
  47827. let maxOffset = 0;
  47828. for (const {
  47829. ref,
  47830. data
  47831. } of newRefs) {
  47832. maxOffset = Math.max(maxOffset, baseOffset);
  47833. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  47834. baseOffset += data.length;
  47835. indexes.push(ref.num, 1);
  47836. buffer.push(data);
  47837. }
  47838. newXref.set("Index", indexes);
  47839. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  47840. const md5 = computeMD5(baseOffset, xrefInfo);
  47841. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  47842. }
  47843. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  47844. const sizes = [1, offsetSize, 2];
  47845. const structSize = sizes[0] + sizes[1] + sizes[2];
  47846. const tableLength = structSize * xrefTableData.length;
  47847. newXref.set("W", sizes);
  47848. newXref.set("Length", tableLength);
  47849. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  47850. writeDict(newXref, buffer, null);
  47851. buffer.push(" stream\n");
  47852. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  47853. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  47854. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  47855. array.set(originalData);
  47856. let offset = originalData.length;
  47857. for (const str of buffer) {
  47858. writeString(str, offset, array);
  47859. offset += str.length;
  47860. }
  47861. for (const [type, objOffset, gen] of xrefTableData) {
  47862. offset = writeInt(type, sizes[0], offset, array);
  47863. offset = writeInt(objOffset, sizes[1], offset, array);
  47864. offset = writeInt(gen, sizes[2], offset, array);
  47865. }
  47866. writeString(footer, offset, array);
  47867. return array;
  47868. }
  47869. /***/ }),
  47870. /* 64 */
  47871. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47872. Object.defineProperty(exports, "__esModule", ({
  47873. value: true
  47874. }));
  47875. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47876. var _core_utils = __w_pdfjs_require__(4);
  47877. const XMLParserErrorCode = {
  47878. NoError: 0,
  47879. EndOfDocument: -1,
  47880. UnterminatedCdat: -2,
  47881. UnterminatedXmlDeclaration: -3,
  47882. UnterminatedDoctypeDeclaration: -4,
  47883. UnterminatedComment: -5,
  47884. MalformedElement: -6,
  47885. OutOfMemory: -7,
  47886. UnterminatedAttributeValue: -8,
  47887. UnterminatedElement: -9,
  47888. ElementNeverBegun: -10
  47889. };
  47890. exports.XMLParserErrorCode = XMLParserErrorCode;
  47891. function isWhitespace(s, index) {
  47892. const ch = s[index];
  47893. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47894. }
  47895. function isWhitespaceString(s) {
  47896. for (let i = 0, ii = s.length; i < ii; i++) {
  47897. if (!isWhitespace(s, i)) {
  47898. return false;
  47899. }
  47900. }
  47901. return true;
  47902. }
  47903. class XMLParserBase {
  47904. _resolveEntities(s) {
  47905. return s.replace(/&([^;]+);/g, (all, entity) => {
  47906. if (entity.substring(0, 2) === "#x") {
  47907. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47908. } else if (entity.substring(0, 1) === "#") {
  47909. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47910. }
  47911. switch (entity) {
  47912. case "lt":
  47913. return "<";
  47914. case "gt":
  47915. return ">";
  47916. case "amp":
  47917. return "&";
  47918. case "quot":
  47919. return '"';
  47920. case "apos":
  47921. return "'";
  47922. }
  47923. return this.onResolveEntity(entity);
  47924. });
  47925. }
  47926. _parseContent(s, start) {
  47927. const attributes = [];
  47928. let pos = start;
  47929. function skipWs() {
  47930. while (pos < s.length && isWhitespace(s, pos)) {
  47931. ++pos;
  47932. }
  47933. }
  47934. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47935. ++pos;
  47936. }
  47937. const name = s.substring(start, pos);
  47938. skipWs();
  47939. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47940. skipWs();
  47941. let attrName = "",
  47942. attrValue = "";
  47943. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47944. attrName += s[pos];
  47945. ++pos;
  47946. }
  47947. skipWs();
  47948. if (s[pos] !== "=") {
  47949. return null;
  47950. }
  47951. ++pos;
  47952. skipWs();
  47953. const attrEndChar = s[pos];
  47954. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47955. return null;
  47956. }
  47957. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47958. if (attrEndIndex < 0) {
  47959. return null;
  47960. }
  47961. attrValue = s.substring(pos, attrEndIndex);
  47962. attributes.push({
  47963. name: attrName,
  47964. value: this._resolveEntities(attrValue)
  47965. });
  47966. pos = attrEndIndex + 1;
  47967. skipWs();
  47968. }
  47969. return {
  47970. name,
  47971. attributes,
  47972. parsed: pos - start
  47973. };
  47974. }
  47975. _parseProcessingInstruction(s, start) {
  47976. let pos = start;
  47977. function skipWs() {
  47978. while (pos < s.length && isWhitespace(s, pos)) {
  47979. ++pos;
  47980. }
  47981. }
  47982. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  47983. ++pos;
  47984. }
  47985. const name = s.substring(start, pos);
  47986. skipWs();
  47987. const attrStart = pos;
  47988. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  47989. ++pos;
  47990. }
  47991. const value = s.substring(attrStart, pos);
  47992. return {
  47993. name,
  47994. value,
  47995. parsed: pos - start
  47996. };
  47997. }
  47998. parseXml(s) {
  47999. let i = 0;
  48000. while (i < s.length) {
  48001. const ch = s[i];
  48002. let j = i;
  48003. if (ch === "<") {
  48004. ++j;
  48005. const ch2 = s[j];
  48006. let q;
  48007. switch (ch2) {
  48008. case "/":
  48009. ++j;
  48010. q = s.indexOf(">", j);
  48011. if (q < 0) {
  48012. this.onError(XMLParserErrorCode.UnterminatedElement);
  48013. return;
  48014. }
  48015. this.onEndElement(s.substring(j, q));
  48016. j = q + 1;
  48017. break;
  48018. case "?":
  48019. ++j;
  48020. const pi = this._parseProcessingInstruction(s, j);
  48021. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  48022. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  48023. return;
  48024. }
  48025. this.onPi(pi.name, pi.value);
  48026. j += pi.parsed + 2;
  48027. break;
  48028. case "!":
  48029. if (s.substring(j + 1, j + 3) === "--") {
  48030. q = s.indexOf("-->", j + 3);
  48031. if (q < 0) {
  48032. this.onError(XMLParserErrorCode.UnterminatedComment);
  48033. return;
  48034. }
  48035. this.onComment(s.substring(j + 3, q));
  48036. j = q + 3;
  48037. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  48038. q = s.indexOf("]]>", j + 8);
  48039. if (q < 0) {
  48040. this.onError(XMLParserErrorCode.UnterminatedCdat);
  48041. return;
  48042. }
  48043. this.onCdata(s.substring(j + 8, q));
  48044. j = q + 3;
  48045. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  48046. const q2 = s.indexOf("[", j + 8);
  48047. let complexDoctype = false;
  48048. q = s.indexOf(">", j + 8);
  48049. if (q < 0) {
  48050. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48051. return;
  48052. }
  48053. if (q2 > 0 && q > q2) {
  48054. q = s.indexOf("]>", j + 8);
  48055. if (q < 0) {
  48056. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48057. return;
  48058. }
  48059. complexDoctype = true;
  48060. }
  48061. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  48062. this.onDoctype(doctypeContent);
  48063. j = q + (complexDoctype ? 2 : 1);
  48064. } else {
  48065. this.onError(XMLParserErrorCode.MalformedElement);
  48066. return;
  48067. }
  48068. break;
  48069. default:
  48070. const content = this._parseContent(s, j);
  48071. if (content === null) {
  48072. this.onError(XMLParserErrorCode.MalformedElement);
  48073. return;
  48074. }
  48075. let isClosed = false;
  48076. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  48077. isClosed = true;
  48078. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  48079. this.onError(XMLParserErrorCode.UnterminatedElement);
  48080. return;
  48081. }
  48082. this.onBeginElement(content.name, content.attributes, isClosed);
  48083. j += content.parsed + (isClosed ? 2 : 1);
  48084. break;
  48085. }
  48086. } else {
  48087. while (j < s.length && s[j] !== "<") {
  48088. j++;
  48089. }
  48090. const text = s.substring(i, j);
  48091. this.onText(this._resolveEntities(text));
  48092. }
  48093. i = j;
  48094. }
  48095. }
  48096. onResolveEntity(name) {
  48097. return `&${name};`;
  48098. }
  48099. onPi(name, value) {}
  48100. onComment(text) {}
  48101. onCdata(text) {}
  48102. onDoctype(doctypeContent) {}
  48103. onText(text) {}
  48104. onBeginElement(name, attributes, isEmpty) {}
  48105. onEndElement(name) {}
  48106. onError(code) {}
  48107. }
  48108. exports.XMLParserBase = XMLParserBase;
  48109. class SimpleDOMNode {
  48110. constructor(nodeName, nodeValue) {
  48111. this.nodeName = nodeName;
  48112. this.nodeValue = nodeValue;
  48113. Object.defineProperty(this, "parentNode", {
  48114. value: null,
  48115. writable: true
  48116. });
  48117. }
  48118. get firstChild() {
  48119. return this.childNodes && this.childNodes[0];
  48120. }
  48121. get nextSibling() {
  48122. const childNodes = this.parentNode.childNodes;
  48123. if (!childNodes) {
  48124. return undefined;
  48125. }
  48126. const index = childNodes.indexOf(this);
  48127. if (index === -1) {
  48128. return undefined;
  48129. }
  48130. return childNodes[index + 1];
  48131. }
  48132. get textContent() {
  48133. if (!this.childNodes) {
  48134. return this.nodeValue || "";
  48135. }
  48136. return this.childNodes.map(function (child) {
  48137. return child.textContent;
  48138. }).join("");
  48139. }
  48140. get children() {
  48141. return this.childNodes || [];
  48142. }
  48143. hasChildNodes() {
  48144. return this.childNodes && this.childNodes.length > 0;
  48145. }
  48146. searchNode(paths, pos) {
  48147. if (pos >= paths.length) {
  48148. return this;
  48149. }
  48150. const component = paths[pos];
  48151. const stack = [];
  48152. let node = this;
  48153. while (true) {
  48154. if (component.name === node.nodeName) {
  48155. if (component.pos === 0) {
  48156. const res = node.searchNode(paths, pos + 1);
  48157. if (res !== null) {
  48158. return res;
  48159. }
  48160. } else if (stack.length === 0) {
  48161. return null;
  48162. } else {
  48163. const [parent] = stack.pop();
  48164. let siblingPos = 0;
  48165. for (const child of parent.childNodes) {
  48166. if (component.name === child.nodeName) {
  48167. if (siblingPos === component.pos) {
  48168. return child.searchNode(paths, pos + 1);
  48169. }
  48170. siblingPos++;
  48171. }
  48172. }
  48173. return node.searchNode(paths, pos + 1);
  48174. }
  48175. }
  48176. if (node.childNodes && node.childNodes.length !== 0) {
  48177. stack.push([node, 0]);
  48178. node = node.childNodes[0];
  48179. } else if (stack.length === 0) {
  48180. return null;
  48181. } else {
  48182. while (stack.length !== 0) {
  48183. const [parent, currentPos] = stack.pop();
  48184. const newPos = currentPos + 1;
  48185. if (newPos < parent.childNodes.length) {
  48186. stack.push([parent, newPos]);
  48187. node = parent.childNodes[newPos];
  48188. break;
  48189. }
  48190. }
  48191. if (stack.length === 0) {
  48192. return null;
  48193. }
  48194. }
  48195. }
  48196. }
  48197. dump(buffer) {
  48198. if (this.nodeName === "#text") {
  48199. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  48200. return;
  48201. }
  48202. buffer.push(`<${this.nodeName}`);
  48203. if (this.attributes) {
  48204. for (const attribute of this.attributes) {
  48205. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  48206. }
  48207. }
  48208. if (this.hasChildNodes()) {
  48209. buffer.push(">");
  48210. for (const child of this.childNodes) {
  48211. child.dump(buffer);
  48212. }
  48213. buffer.push(`</${this.nodeName}>`);
  48214. } else if (this.nodeValue) {
  48215. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  48216. } else {
  48217. buffer.push("/>");
  48218. }
  48219. }
  48220. }
  48221. exports.SimpleDOMNode = SimpleDOMNode;
  48222. class SimpleXMLParser extends XMLParserBase {
  48223. constructor({
  48224. hasAttributes = false,
  48225. lowerCaseName = false
  48226. }) {
  48227. super();
  48228. this._currentFragment = null;
  48229. this._stack = null;
  48230. this._errorCode = XMLParserErrorCode.NoError;
  48231. this._hasAttributes = hasAttributes;
  48232. this._lowerCaseName = lowerCaseName;
  48233. }
  48234. parseFromString(data) {
  48235. this._currentFragment = [];
  48236. this._stack = [];
  48237. this._errorCode = XMLParserErrorCode.NoError;
  48238. this.parseXml(data);
  48239. if (this._errorCode !== XMLParserErrorCode.NoError) {
  48240. return undefined;
  48241. }
  48242. const [documentElement] = this._currentFragment;
  48243. if (!documentElement) {
  48244. return undefined;
  48245. }
  48246. return {
  48247. documentElement
  48248. };
  48249. }
  48250. onText(text) {
  48251. if (isWhitespaceString(text)) {
  48252. return;
  48253. }
  48254. const node = new SimpleDOMNode("#text", text);
  48255. this._currentFragment.push(node);
  48256. }
  48257. onCdata(text) {
  48258. const node = new SimpleDOMNode("#text", text);
  48259. this._currentFragment.push(node);
  48260. }
  48261. onBeginElement(name, attributes, isEmpty) {
  48262. if (this._lowerCaseName) {
  48263. name = name.toLowerCase();
  48264. }
  48265. const node = new SimpleDOMNode(name);
  48266. node.childNodes = [];
  48267. if (this._hasAttributes) {
  48268. node.attributes = attributes;
  48269. }
  48270. this._currentFragment.push(node);
  48271. if (isEmpty) {
  48272. return;
  48273. }
  48274. this._stack.push(this._currentFragment);
  48275. this._currentFragment = node.childNodes;
  48276. }
  48277. onEndElement(name) {
  48278. this._currentFragment = this._stack.pop() || [];
  48279. const lastElement = this._currentFragment.at(-1);
  48280. if (!lastElement) {
  48281. return null;
  48282. }
  48283. for (const childNode of lastElement.childNodes) {
  48284. childNode.parentNode = lastElement;
  48285. }
  48286. return lastElement;
  48287. }
  48288. onError(code) {
  48289. this._errorCode = code;
  48290. }
  48291. }
  48292. exports.SimpleXMLParser = SimpleXMLParser;
  48293. /***/ }),
  48294. /* 65 */
  48295. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48296. Object.defineProperty(exports, "__esModule", ({
  48297. value: true
  48298. }));
  48299. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  48300. exports.calculateSHA384 = calculateSHA384;
  48301. exports.calculateSHA512 = void 0;
  48302. var _util = __w_pdfjs_require__(2);
  48303. var _primitives = __w_pdfjs_require__(3);
  48304. var _decrypt_stream = __w_pdfjs_require__(66);
  48305. class ARCFourCipher {
  48306. constructor(key) {
  48307. this.a = 0;
  48308. this.b = 0;
  48309. const s = new Uint8Array(256);
  48310. const keyLength = key.length;
  48311. for (let i = 0; i < 256; ++i) {
  48312. s[i] = i;
  48313. }
  48314. for (let i = 0, j = 0; i < 256; ++i) {
  48315. const tmp = s[i];
  48316. j = j + tmp + key[i % keyLength] & 0xff;
  48317. s[i] = s[j];
  48318. s[j] = tmp;
  48319. }
  48320. this.s = s;
  48321. }
  48322. encryptBlock(data) {
  48323. let a = this.a,
  48324. b = this.b;
  48325. const s = this.s;
  48326. const n = data.length;
  48327. const output = new Uint8Array(n);
  48328. for (let i = 0; i < n; ++i) {
  48329. a = a + 1 & 0xff;
  48330. const tmp = s[a];
  48331. b = b + tmp & 0xff;
  48332. const tmp2 = s[b];
  48333. s[a] = tmp2;
  48334. s[b] = tmp;
  48335. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  48336. }
  48337. this.a = a;
  48338. this.b = b;
  48339. return output;
  48340. }
  48341. decryptBlock(data) {
  48342. return this.encryptBlock(data);
  48343. }
  48344. encrypt(data) {
  48345. return this.encryptBlock(data);
  48346. }
  48347. }
  48348. exports.ARCFourCipher = ARCFourCipher;
  48349. const calculateMD5 = function calculateMD5Closure() {
  48350. 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]);
  48351. 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]);
  48352. function hash(data, offset, length) {
  48353. let h0 = 1732584193,
  48354. h1 = -271733879,
  48355. h2 = -1732584194,
  48356. h3 = 271733878;
  48357. const paddedLength = length + 72 & ~63;
  48358. const padded = new Uint8Array(paddedLength);
  48359. let i, j;
  48360. for (i = 0; i < length; ++i) {
  48361. padded[i] = data[offset++];
  48362. }
  48363. padded[i++] = 0x80;
  48364. const n = paddedLength - 8;
  48365. while (i < n) {
  48366. padded[i++] = 0;
  48367. }
  48368. padded[i++] = length << 3 & 0xff;
  48369. padded[i++] = length >> 5 & 0xff;
  48370. padded[i++] = length >> 13 & 0xff;
  48371. padded[i++] = length >> 21 & 0xff;
  48372. padded[i++] = length >>> 29 & 0xff;
  48373. padded[i++] = 0;
  48374. padded[i++] = 0;
  48375. padded[i++] = 0;
  48376. const w = new Int32Array(16);
  48377. for (i = 0; i < paddedLength;) {
  48378. for (j = 0; j < 16; ++j, i += 4) {
  48379. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  48380. }
  48381. let a = h0,
  48382. b = h1,
  48383. c = h2,
  48384. d = h3,
  48385. f,
  48386. g;
  48387. for (j = 0; j < 64; ++j) {
  48388. if (j < 16) {
  48389. f = b & c | ~b & d;
  48390. g = j;
  48391. } else if (j < 32) {
  48392. f = d & b | ~d & c;
  48393. g = 5 * j + 1 & 15;
  48394. } else if (j < 48) {
  48395. f = b ^ c ^ d;
  48396. g = 3 * j + 5 & 15;
  48397. } else {
  48398. f = c ^ (b | ~d);
  48399. g = 7 * j & 15;
  48400. }
  48401. const tmp = d,
  48402. rotateArg = a + f + k[j] + w[g] | 0,
  48403. rotate = r[j];
  48404. d = c;
  48405. c = b;
  48406. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  48407. a = tmp;
  48408. }
  48409. h0 = h0 + a | 0;
  48410. h1 = h1 + b | 0;
  48411. h2 = h2 + c | 0;
  48412. h3 = h3 + d | 0;
  48413. }
  48414. 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]);
  48415. }
  48416. return hash;
  48417. }();
  48418. exports.calculateMD5 = calculateMD5;
  48419. class Word64 {
  48420. constructor(highInteger, lowInteger) {
  48421. this.high = highInteger | 0;
  48422. this.low = lowInteger | 0;
  48423. }
  48424. and(word) {
  48425. this.high &= word.high;
  48426. this.low &= word.low;
  48427. }
  48428. xor(word) {
  48429. this.high ^= word.high;
  48430. this.low ^= word.low;
  48431. }
  48432. or(word) {
  48433. this.high |= word.high;
  48434. this.low |= word.low;
  48435. }
  48436. shiftRight(places) {
  48437. if (places >= 32) {
  48438. this.low = this.high >>> places - 32 | 0;
  48439. this.high = 0;
  48440. } else {
  48441. this.low = this.low >>> places | this.high << 32 - places;
  48442. this.high = this.high >>> places | 0;
  48443. }
  48444. }
  48445. shiftLeft(places) {
  48446. if (places >= 32) {
  48447. this.high = this.low << places - 32;
  48448. this.low = 0;
  48449. } else {
  48450. this.high = this.high << places | this.low >>> 32 - places;
  48451. this.low <<= places;
  48452. }
  48453. }
  48454. rotateRight(places) {
  48455. let low, high;
  48456. if (places & 32) {
  48457. high = this.low;
  48458. low = this.high;
  48459. } else {
  48460. low = this.low;
  48461. high = this.high;
  48462. }
  48463. places &= 31;
  48464. this.low = low >>> places | high << 32 - places;
  48465. this.high = high >>> places | low << 32 - places;
  48466. }
  48467. not() {
  48468. this.high = ~this.high;
  48469. this.low = ~this.low;
  48470. }
  48471. add(word) {
  48472. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  48473. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48474. if (lowAdd > 0xffffffff) {
  48475. highAdd += 1;
  48476. }
  48477. this.low = lowAdd | 0;
  48478. this.high = highAdd | 0;
  48479. }
  48480. copyTo(bytes, offset) {
  48481. bytes[offset] = this.high >>> 24 & 0xff;
  48482. bytes[offset + 1] = this.high >> 16 & 0xff;
  48483. bytes[offset + 2] = this.high >> 8 & 0xff;
  48484. bytes[offset + 3] = this.high & 0xff;
  48485. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48486. bytes[offset + 5] = this.low >> 16 & 0xff;
  48487. bytes[offset + 6] = this.low >> 8 & 0xff;
  48488. bytes[offset + 7] = this.low & 0xff;
  48489. }
  48490. assign(word) {
  48491. this.high = word.high;
  48492. this.low = word.low;
  48493. }
  48494. }
  48495. const calculateSHA256 = function calculateSHA256Closure() {
  48496. function rotr(x, n) {
  48497. return x >>> n | x << 32 - n;
  48498. }
  48499. function ch(x, y, z) {
  48500. return x & y ^ ~x & z;
  48501. }
  48502. function maj(x, y, z) {
  48503. return x & y ^ x & z ^ y & z;
  48504. }
  48505. function sigma(x) {
  48506. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48507. }
  48508. function sigmaPrime(x) {
  48509. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48510. }
  48511. function littleSigma(x) {
  48512. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48513. }
  48514. function littleSigmaPrime(x) {
  48515. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48516. }
  48517. 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];
  48518. function hash(data, offset, length) {
  48519. let h0 = 0x6a09e667,
  48520. h1 = 0xbb67ae85,
  48521. h2 = 0x3c6ef372,
  48522. h3 = 0xa54ff53a,
  48523. h4 = 0x510e527f,
  48524. h5 = 0x9b05688c,
  48525. h6 = 0x1f83d9ab,
  48526. h7 = 0x5be0cd19;
  48527. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48528. const padded = new Uint8Array(paddedLength);
  48529. let i, j;
  48530. for (i = 0; i < length; ++i) {
  48531. padded[i] = data[offset++];
  48532. }
  48533. padded[i++] = 0x80;
  48534. const n = paddedLength - 8;
  48535. while (i < n) {
  48536. padded[i++] = 0;
  48537. }
  48538. padded[i++] = 0;
  48539. padded[i++] = 0;
  48540. padded[i++] = 0;
  48541. padded[i++] = length >>> 29 & 0xff;
  48542. padded[i++] = length >> 21 & 0xff;
  48543. padded[i++] = length >> 13 & 0xff;
  48544. padded[i++] = length >> 5 & 0xff;
  48545. padded[i++] = length << 3 & 0xff;
  48546. const w = new Uint32Array(64);
  48547. for (i = 0; i < paddedLength;) {
  48548. for (j = 0; j < 16; ++j) {
  48549. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48550. i += 4;
  48551. }
  48552. for (j = 16; j < 64; ++j) {
  48553. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48554. }
  48555. let a = h0,
  48556. b = h1,
  48557. c = h2,
  48558. d = h3,
  48559. e = h4,
  48560. f = h5,
  48561. g = h6,
  48562. h = h7,
  48563. t1,
  48564. t2;
  48565. for (j = 0; j < 64; ++j) {
  48566. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  48567. t2 = sigma(a) + maj(a, b, c);
  48568. h = g;
  48569. g = f;
  48570. f = e;
  48571. e = d + t1 | 0;
  48572. d = c;
  48573. c = b;
  48574. b = a;
  48575. a = t1 + t2 | 0;
  48576. }
  48577. h0 = h0 + a | 0;
  48578. h1 = h1 + b | 0;
  48579. h2 = h2 + c | 0;
  48580. h3 = h3 + d | 0;
  48581. h4 = h4 + e | 0;
  48582. h5 = h5 + f | 0;
  48583. h6 = h6 + g | 0;
  48584. h7 = h7 + h | 0;
  48585. }
  48586. 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]);
  48587. }
  48588. return hash;
  48589. }();
  48590. exports.calculateSHA256 = calculateSHA256;
  48591. const calculateSHA512 = function calculateSHA512Closure() {
  48592. function ch(result, x, y, z, tmp) {
  48593. result.assign(x);
  48594. result.and(y);
  48595. tmp.assign(x);
  48596. tmp.not();
  48597. tmp.and(z);
  48598. result.xor(tmp);
  48599. }
  48600. function maj(result, x, y, z, tmp) {
  48601. result.assign(x);
  48602. result.and(y);
  48603. tmp.assign(x);
  48604. tmp.and(z);
  48605. result.xor(tmp);
  48606. tmp.assign(y);
  48607. tmp.and(z);
  48608. result.xor(tmp);
  48609. }
  48610. function sigma(result, x, tmp) {
  48611. result.assign(x);
  48612. result.rotateRight(28);
  48613. tmp.assign(x);
  48614. tmp.rotateRight(34);
  48615. result.xor(tmp);
  48616. tmp.assign(x);
  48617. tmp.rotateRight(39);
  48618. result.xor(tmp);
  48619. }
  48620. function sigmaPrime(result, x, tmp) {
  48621. result.assign(x);
  48622. result.rotateRight(14);
  48623. tmp.assign(x);
  48624. tmp.rotateRight(18);
  48625. result.xor(tmp);
  48626. tmp.assign(x);
  48627. tmp.rotateRight(41);
  48628. result.xor(tmp);
  48629. }
  48630. function littleSigma(result, x, tmp) {
  48631. result.assign(x);
  48632. result.rotateRight(1);
  48633. tmp.assign(x);
  48634. tmp.rotateRight(8);
  48635. result.xor(tmp);
  48636. tmp.assign(x);
  48637. tmp.shiftRight(7);
  48638. result.xor(tmp);
  48639. }
  48640. function littleSigmaPrime(result, x, tmp) {
  48641. result.assign(x);
  48642. result.rotateRight(19);
  48643. tmp.assign(x);
  48644. tmp.rotateRight(61);
  48645. result.xor(tmp);
  48646. tmp.assign(x);
  48647. tmp.shiftRight(6);
  48648. result.xor(tmp);
  48649. }
  48650. 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)];
  48651. function hash(data, offset, length, mode384 = false) {
  48652. let h0, h1, h2, h3, h4, h5, h6, h7;
  48653. if (!mode384) {
  48654. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48655. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48656. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48657. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48658. h4 = new Word64(0x510e527f, 0xade682d1);
  48659. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48660. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48661. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48662. } else {
  48663. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48664. h1 = new Word64(0x629a292a, 0x367cd507);
  48665. h2 = new Word64(0x9159015a, 0x3070dd17);
  48666. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48667. h4 = new Word64(0x67332667, 0xffc00b31);
  48668. h5 = new Word64(0x8eb44a87, 0x68581511);
  48669. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48670. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48671. }
  48672. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48673. const padded = new Uint8Array(paddedLength);
  48674. let i, j;
  48675. for (i = 0; i < length; ++i) {
  48676. padded[i] = data[offset++];
  48677. }
  48678. padded[i++] = 0x80;
  48679. const n = paddedLength - 16;
  48680. while (i < n) {
  48681. padded[i++] = 0;
  48682. }
  48683. padded[i++] = 0;
  48684. padded[i++] = 0;
  48685. padded[i++] = 0;
  48686. padded[i++] = 0;
  48687. padded[i++] = 0;
  48688. padded[i++] = 0;
  48689. padded[i++] = 0;
  48690. padded[i++] = 0;
  48691. padded[i++] = 0;
  48692. padded[i++] = 0;
  48693. padded[i++] = 0;
  48694. padded[i++] = length >>> 29 & 0xff;
  48695. padded[i++] = length >> 21 & 0xff;
  48696. padded[i++] = length >> 13 & 0xff;
  48697. padded[i++] = length >> 5 & 0xff;
  48698. padded[i++] = length << 3 & 0xff;
  48699. const w = new Array(80);
  48700. for (i = 0; i < 80; i++) {
  48701. w[i] = new Word64(0, 0);
  48702. }
  48703. let a = new Word64(0, 0),
  48704. b = new Word64(0, 0),
  48705. c = new Word64(0, 0);
  48706. let d = new Word64(0, 0),
  48707. e = new Word64(0, 0),
  48708. f = new Word64(0, 0);
  48709. let g = new Word64(0, 0),
  48710. h = new Word64(0, 0);
  48711. const t1 = new Word64(0, 0),
  48712. t2 = new Word64(0, 0);
  48713. const tmp1 = new Word64(0, 0),
  48714. tmp2 = new Word64(0, 0);
  48715. let tmp3;
  48716. for (i = 0; i < paddedLength;) {
  48717. for (j = 0; j < 16; ++j) {
  48718. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48719. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48720. i += 8;
  48721. }
  48722. for (j = 16; j < 80; ++j) {
  48723. tmp3 = w[j];
  48724. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48725. tmp3.add(w[j - 7]);
  48726. littleSigma(tmp1, w[j - 15], tmp2);
  48727. tmp3.add(tmp1);
  48728. tmp3.add(w[j - 16]);
  48729. }
  48730. a.assign(h0);
  48731. b.assign(h1);
  48732. c.assign(h2);
  48733. d.assign(h3);
  48734. e.assign(h4);
  48735. f.assign(h5);
  48736. g.assign(h6);
  48737. h.assign(h7);
  48738. for (j = 0; j < 80; ++j) {
  48739. t1.assign(h);
  48740. sigmaPrime(tmp1, e, tmp2);
  48741. t1.add(tmp1);
  48742. ch(tmp1, e, f, g, tmp2);
  48743. t1.add(tmp1);
  48744. t1.add(k[j]);
  48745. t1.add(w[j]);
  48746. sigma(t2, a, tmp2);
  48747. maj(tmp1, a, b, c, tmp2);
  48748. t2.add(tmp1);
  48749. tmp3 = h;
  48750. h = g;
  48751. g = f;
  48752. f = e;
  48753. d.add(t1);
  48754. e = d;
  48755. d = c;
  48756. c = b;
  48757. b = a;
  48758. tmp3.assign(t1);
  48759. tmp3.add(t2);
  48760. a = tmp3;
  48761. }
  48762. h0.add(a);
  48763. h1.add(b);
  48764. h2.add(c);
  48765. h3.add(d);
  48766. h4.add(e);
  48767. h5.add(f);
  48768. h6.add(g);
  48769. h7.add(h);
  48770. }
  48771. let result;
  48772. if (!mode384) {
  48773. result = new Uint8Array(64);
  48774. h0.copyTo(result, 0);
  48775. h1.copyTo(result, 8);
  48776. h2.copyTo(result, 16);
  48777. h3.copyTo(result, 24);
  48778. h4.copyTo(result, 32);
  48779. h5.copyTo(result, 40);
  48780. h6.copyTo(result, 48);
  48781. h7.copyTo(result, 56);
  48782. } else {
  48783. result = new Uint8Array(48);
  48784. h0.copyTo(result, 0);
  48785. h1.copyTo(result, 8);
  48786. h2.copyTo(result, 16);
  48787. h3.copyTo(result, 24);
  48788. h4.copyTo(result, 32);
  48789. h5.copyTo(result, 40);
  48790. }
  48791. return result;
  48792. }
  48793. return hash;
  48794. }();
  48795. exports.calculateSHA512 = calculateSHA512;
  48796. function calculateSHA384(data, offset, length) {
  48797. return calculateSHA512(data, offset, length, true);
  48798. }
  48799. class NullCipher {
  48800. decryptBlock(data) {
  48801. return data;
  48802. }
  48803. encrypt(data) {
  48804. return data;
  48805. }
  48806. }
  48807. class AESBaseCipher {
  48808. constructor() {
  48809. if (this.constructor === AESBaseCipher) {
  48810. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  48811. }
  48812. 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]);
  48813. 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]);
  48814. 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]);
  48815. this._mixCol = new Uint8Array(256);
  48816. for (let i = 0; i < 256; i++) {
  48817. if (i < 128) {
  48818. this._mixCol[i] = i << 1;
  48819. } else {
  48820. this._mixCol[i] = i << 1 ^ 0x1b;
  48821. }
  48822. }
  48823. this.buffer = new Uint8Array(16);
  48824. this.bufferPosition = 0;
  48825. }
  48826. _expandKey(cipherKey) {
  48827. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  48828. }
  48829. _decrypt(input, key) {
  48830. let t, u, v;
  48831. const state = new Uint8Array(16);
  48832. state.set(input);
  48833. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48834. state[j] ^= key[k];
  48835. }
  48836. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  48837. t = state[13];
  48838. state[13] = state[9];
  48839. state[9] = state[5];
  48840. state[5] = state[1];
  48841. state[1] = t;
  48842. t = state[14];
  48843. u = state[10];
  48844. state[14] = state[6];
  48845. state[10] = state[2];
  48846. state[6] = t;
  48847. state[2] = u;
  48848. t = state[15];
  48849. u = state[11];
  48850. v = state[7];
  48851. state[15] = state[3];
  48852. state[11] = t;
  48853. state[7] = u;
  48854. state[3] = v;
  48855. for (let j = 0; j < 16; ++j) {
  48856. state[j] = this._inv_s[state[j]];
  48857. }
  48858. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48859. state[j] ^= key[k];
  48860. }
  48861. for (let j = 0; j < 16; j += 4) {
  48862. const s0 = this._mix[state[j]];
  48863. const s1 = this._mix[state[j + 1]];
  48864. const s2 = this._mix[state[j + 2]];
  48865. const s3 = this._mix[state[j + 3]];
  48866. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  48867. state[j] = t >>> 24 & 0xff;
  48868. state[j + 1] = t >> 16 & 0xff;
  48869. state[j + 2] = t >> 8 & 0xff;
  48870. state[j + 3] = t & 0xff;
  48871. }
  48872. }
  48873. t = state[13];
  48874. state[13] = state[9];
  48875. state[9] = state[5];
  48876. state[5] = state[1];
  48877. state[1] = t;
  48878. t = state[14];
  48879. u = state[10];
  48880. state[14] = state[6];
  48881. state[10] = state[2];
  48882. state[6] = t;
  48883. state[2] = u;
  48884. t = state[15];
  48885. u = state[11];
  48886. v = state[7];
  48887. state[15] = state[3];
  48888. state[11] = t;
  48889. state[7] = u;
  48890. state[3] = v;
  48891. for (let j = 0; j < 16; ++j) {
  48892. state[j] = this._inv_s[state[j]];
  48893. state[j] ^= key[j];
  48894. }
  48895. return state;
  48896. }
  48897. _encrypt(input, key) {
  48898. const s = this._s;
  48899. let t, u, v;
  48900. const state = new Uint8Array(16);
  48901. state.set(input);
  48902. for (let j = 0; j < 16; ++j) {
  48903. state[j] ^= key[j];
  48904. }
  48905. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  48906. for (let j = 0; j < 16; ++j) {
  48907. state[j] = s[state[j]];
  48908. }
  48909. v = state[1];
  48910. state[1] = state[5];
  48911. state[5] = state[9];
  48912. state[9] = state[13];
  48913. state[13] = v;
  48914. v = state[2];
  48915. u = state[6];
  48916. state[2] = state[10];
  48917. state[6] = state[14];
  48918. state[10] = v;
  48919. state[14] = u;
  48920. v = state[3];
  48921. u = state[7];
  48922. t = state[11];
  48923. state[3] = state[15];
  48924. state[7] = v;
  48925. state[11] = u;
  48926. state[15] = t;
  48927. for (let j = 0; j < 16; j += 4) {
  48928. const s0 = state[j + 0];
  48929. const s1 = state[j + 1];
  48930. const s2 = state[j + 2];
  48931. const s3 = state[j + 3];
  48932. t = s0 ^ s1 ^ s2 ^ s3;
  48933. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  48934. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  48935. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  48936. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  48937. }
  48938. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48939. state[j] ^= key[k];
  48940. }
  48941. }
  48942. for (let j = 0; j < 16; ++j) {
  48943. state[j] = s[state[j]];
  48944. }
  48945. v = state[1];
  48946. state[1] = state[5];
  48947. state[5] = state[9];
  48948. state[9] = state[13];
  48949. state[13] = v;
  48950. v = state[2];
  48951. u = state[6];
  48952. state[2] = state[10];
  48953. state[6] = state[14];
  48954. state[10] = v;
  48955. state[14] = u;
  48956. v = state[3];
  48957. u = state[7];
  48958. t = state[11];
  48959. state[3] = state[15];
  48960. state[7] = v;
  48961. state[11] = u;
  48962. state[15] = t;
  48963. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48964. state[j] ^= key[k];
  48965. }
  48966. return state;
  48967. }
  48968. _decryptBlock2(data, finalize) {
  48969. const sourceLength = data.length;
  48970. let buffer = this.buffer,
  48971. bufferLength = this.bufferPosition;
  48972. const result = [];
  48973. let iv = this.iv;
  48974. for (let i = 0; i < sourceLength; ++i) {
  48975. buffer[bufferLength] = data[i];
  48976. ++bufferLength;
  48977. if (bufferLength < 16) {
  48978. continue;
  48979. }
  48980. const plain = this._decrypt(buffer, this._key);
  48981. for (let j = 0; j < 16; ++j) {
  48982. plain[j] ^= iv[j];
  48983. }
  48984. iv = buffer;
  48985. result.push(plain);
  48986. buffer = new Uint8Array(16);
  48987. bufferLength = 0;
  48988. }
  48989. this.buffer = buffer;
  48990. this.bufferLength = bufferLength;
  48991. this.iv = iv;
  48992. if (result.length === 0) {
  48993. return new Uint8Array(0);
  48994. }
  48995. let outputLength = 16 * result.length;
  48996. if (finalize) {
  48997. const lastBlock = result.at(-1);
  48998. let psLen = lastBlock[15];
  48999. if (psLen <= 16) {
  49000. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  49001. if (lastBlock[i] !== psLen) {
  49002. psLen = 0;
  49003. break;
  49004. }
  49005. }
  49006. outputLength -= psLen;
  49007. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  49008. }
  49009. }
  49010. const output = new Uint8Array(outputLength);
  49011. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49012. output.set(result[i], j);
  49013. }
  49014. return output;
  49015. }
  49016. decryptBlock(data, finalize, iv = null) {
  49017. const sourceLength = data.length;
  49018. const buffer = this.buffer;
  49019. let bufferLength = this.bufferPosition;
  49020. if (iv) {
  49021. this.iv = iv;
  49022. } else {
  49023. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  49024. buffer[bufferLength] = data[i];
  49025. }
  49026. if (bufferLength < 16) {
  49027. this.bufferLength = bufferLength;
  49028. return new Uint8Array(0);
  49029. }
  49030. this.iv = buffer;
  49031. data = data.subarray(16);
  49032. }
  49033. this.buffer = new Uint8Array(16);
  49034. this.bufferLength = 0;
  49035. this.decryptBlock = this._decryptBlock2;
  49036. return this.decryptBlock(data, finalize);
  49037. }
  49038. encrypt(data, iv) {
  49039. const sourceLength = data.length;
  49040. let buffer = this.buffer,
  49041. bufferLength = this.bufferPosition;
  49042. const result = [];
  49043. if (!iv) {
  49044. iv = new Uint8Array(16);
  49045. }
  49046. for (let i = 0; i < sourceLength; ++i) {
  49047. buffer[bufferLength] = data[i];
  49048. ++bufferLength;
  49049. if (bufferLength < 16) {
  49050. continue;
  49051. }
  49052. for (let j = 0; j < 16; ++j) {
  49053. buffer[j] ^= iv[j];
  49054. }
  49055. const cipher = this._encrypt(buffer, this._key);
  49056. iv = cipher;
  49057. result.push(cipher);
  49058. buffer = new Uint8Array(16);
  49059. bufferLength = 0;
  49060. }
  49061. this.buffer = buffer;
  49062. this.bufferLength = bufferLength;
  49063. this.iv = iv;
  49064. if (result.length === 0) {
  49065. return new Uint8Array(0);
  49066. }
  49067. const outputLength = 16 * result.length;
  49068. const output = new Uint8Array(outputLength);
  49069. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49070. output.set(result[i], j);
  49071. }
  49072. return output;
  49073. }
  49074. }
  49075. class AES128Cipher extends AESBaseCipher {
  49076. constructor(key) {
  49077. super();
  49078. this._cyclesOfRepetition = 10;
  49079. this._keySize = 160;
  49080. 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]);
  49081. this._key = this._expandKey(key);
  49082. }
  49083. _expandKey(cipherKey) {
  49084. const b = 176;
  49085. const s = this._s;
  49086. const rcon = this._rcon;
  49087. const result = new Uint8Array(b);
  49088. result.set(cipherKey);
  49089. for (let j = 16, i = 1; j < b; ++i) {
  49090. let t1 = result[j - 3];
  49091. let t2 = result[j - 2];
  49092. let t3 = result[j - 1];
  49093. let t4 = result[j - 4];
  49094. t1 = s[t1];
  49095. t2 = s[t2];
  49096. t3 = s[t3];
  49097. t4 = s[t4];
  49098. t1 ^= rcon[i];
  49099. for (let n = 0; n < 4; ++n) {
  49100. result[j] = t1 ^= result[j - 16];
  49101. j++;
  49102. result[j] = t2 ^= result[j - 16];
  49103. j++;
  49104. result[j] = t3 ^= result[j - 16];
  49105. j++;
  49106. result[j] = t4 ^= result[j - 16];
  49107. j++;
  49108. }
  49109. }
  49110. return result;
  49111. }
  49112. }
  49113. exports.AES128Cipher = AES128Cipher;
  49114. class AES256Cipher extends AESBaseCipher {
  49115. constructor(key) {
  49116. super();
  49117. this._cyclesOfRepetition = 14;
  49118. this._keySize = 224;
  49119. this._key = this._expandKey(key);
  49120. }
  49121. _expandKey(cipherKey) {
  49122. const b = 240;
  49123. const s = this._s;
  49124. const result = new Uint8Array(b);
  49125. result.set(cipherKey);
  49126. let r = 1;
  49127. let t1, t2, t3, t4;
  49128. for (let j = 32, i = 1; j < b; ++i) {
  49129. if (j % 32 === 16) {
  49130. t1 = s[t1];
  49131. t2 = s[t2];
  49132. t3 = s[t3];
  49133. t4 = s[t4];
  49134. } else if (j % 32 === 0) {
  49135. t1 = result[j - 3];
  49136. t2 = result[j - 2];
  49137. t3 = result[j - 1];
  49138. t4 = result[j - 4];
  49139. t1 = s[t1];
  49140. t2 = s[t2];
  49141. t3 = s[t3];
  49142. t4 = s[t4];
  49143. t1 ^= r;
  49144. if ((r <<= 1) >= 256) {
  49145. r = (r ^ 0x1b) & 0xff;
  49146. }
  49147. }
  49148. for (let n = 0; n < 4; ++n) {
  49149. result[j] = t1 ^= result[j - 32];
  49150. j++;
  49151. result[j] = t2 ^= result[j - 32];
  49152. j++;
  49153. result[j] = t3 ^= result[j - 32];
  49154. j++;
  49155. result[j] = t4 ^= result[j - 32];
  49156. j++;
  49157. }
  49158. }
  49159. return result;
  49160. }
  49161. }
  49162. exports.AES256Cipher = AES256Cipher;
  49163. class PDF17 {
  49164. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49165. const hashData = new Uint8Array(password.length + 56);
  49166. hashData.set(password, 0);
  49167. hashData.set(ownerValidationSalt, password.length);
  49168. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49169. const result = calculateSHA256(hashData, 0, hashData.length);
  49170. return (0, _util.isArrayEqual)(result, ownerPassword);
  49171. }
  49172. checkUserPassword(password, userValidationSalt, userPassword) {
  49173. const hashData = new Uint8Array(password.length + 8);
  49174. hashData.set(password, 0);
  49175. hashData.set(userValidationSalt, password.length);
  49176. const result = calculateSHA256(hashData, 0, hashData.length);
  49177. return (0, _util.isArrayEqual)(result, userPassword);
  49178. }
  49179. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49180. const hashData = new Uint8Array(password.length + 56);
  49181. hashData.set(password, 0);
  49182. hashData.set(ownerKeySalt, password.length);
  49183. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49184. const key = calculateSHA256(hashData, 0, hashData.length);
  49185. const cipher = new AES256Cipher(key);
  49186. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49187. }
  49188. getUserKey(password, userKeySalt, userEncryption) {
  49189. const hashData = new Uint8Array(password.length + 8);
  49190. hashData.set(password, 0);
  49191. hashData.set(userKeySalt, password.length);
  49192. const key = calculateSHA256(hashData, 0, hashData.length);
  49193. const cipher = new AES256Cipher(key);
  49194. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49195. }
  49196. }
  49197. exports.PDF17 = PDF17;
  49198. const PDF20 = function PDF20Closure() {
  49199. function calculatePDF20Hash(password, input, userBytes) {
  49200. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  49201. let e = [0];
  49202. let i = 0;
  49203. while (i < 64 || e.at(-1) > i - 32) {
  49204. const combinedLength = password.length + k.length + userBytes.length,
  49205. combinedArray = new Uint8Array(combinedLength);
  49206. let writeOffset = 0;
  49207. combinedArray.set(password, writeOffset);
  49208. writeOffset += password.length;
  49209. combinedArray.set(k, writeOffset);
  49210. writeOffset += k.length;
  49211. combinedArray.set(userBytes, writeOffset);
  49212. const k1 = new Uint8Array(combinedLength * 64);
  49213. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  49214. k1.set(combinedArray, pos);
  49215. }
  49216. const cipher = new AES128Cipher(k.subarray(0, 16));
  49217. e = cipher.encrypt(k1, k.subarray(16, 32));
  49218. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  49219. if (remainder === 0) {
  49220. k = calculateSHA256(e, 0, e.length);
  49221. } else if (remainder === 1) {
  49222. k = calculateSHA384(e, 0, e.length);
  49223. } else if (remainder === 2) {
  49224. k = calculateSHA512(e, 0, e.length);
  49225. }
  49226. i++;
  49227. }
  49228. return k.subarray(0, 32);
  49229. }
  49230. class PDF20 {
  49231. hash(password, concatBytes, userBytes) {
  49232. return calculatePDF20Hash(password, concatBytes, userBytes);
  49233. }
  49234. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49235. const hashData = new Uint8Array(password.length + 56);
  49236. hashData.set(password, 0);
  49237. hashData.set(ownerValidationSalt, password.length);
  49238. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49239. const result = calculatePDF20Hash(password, hashData, userBytes);
  49240. return (0, _util.isArrayEqual)(result, ownerPassword);
  49241. }
  49242. checkUserPassword(password, userValidationSalt, userPassword) {
  49243. const hashData = new Uint8Array(password.length + 8);
  49244. hashData.set(password, 0);
  49245. hashData.set(userValidationSalt, password.length);
  49246. const result = calculatePDF20Hash(password, hashData, []);
  49247. return (0, _util.isArrayEqual)(result, userPassword);
  49248. }
  49249. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49250. const hashData = new Uint8Array(password.length + 56);
  49251. hashData.set(password, 0);
  49252. hashData.set(ownerKeySalt, password.length);
  49253. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49254. const key = calculatePDF20Hash(password, hashData, userBytes);
  49255. const cipher = new AES256Cipher(key);
  49256. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49257. }
  49258. getUserKey(password, userKeySalt, userEncryption) {
  49259. const hashData = new Uint8Array(password.length + 8);
  49260. hashData.set(password, 0);
  49261. hashData.set(userKeySalt, password.length);
  49262. const key = calculatePDF20Hash(password, hashData, []);
  49263. const cipher = new AES256Cipher(key);
  49264. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49265. }
  49266. }
  49267. return PDF20;
  49268. }();
  49269. exports.PDF20 = PDF20;
  49270. class CipherTransform {
  49271. constructor(stringCipherConstructor, streamCipherConstructor) {
  49272. this.StringCipherConstructor = stringCipherConstructor;
  49273. this.StreamCipherConstructor = streamCipherConstructor;
  49274. }
  49275. createStream(stream, length) {
  49276. const cipher = new this.StreamCipherConstructor();
  49277. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  49278. return cipher.decryptBlock(data, finalize);
  49279. });
  49280. }
  49281. decryptString(s) {
  49282. const cipher = new this.StringCipherConstructor();
  49283. let data = (0, _util.stringToBytes)(s);
  49284. data = cipher.decryptBlock(data, true);
  49285. return (0, _util.bytesToString)(data);
  49286. }
  49287. encryptString(s) {
  49288. const cipher = new this.StringCipherConstructor();
  49289. if (cipher instanceof AESBaseCipher) {
  49290. const strLen = s.length;
  49291. const pad = 16 - strLen % 16;
  49292. s += String.fromCharCode(pad).repeat(pad);
  49293. const iv = new Uint8Array(16);
  49294. if (typeof crypto !== "undefined") {
  49295. crypto.getRandomValues(iv);
  49296. } else {
  49297. for (let i = 0; i < 16; i++) {
  49298. iv[i] = Math.floor(256 * Math.random());
  49299. }
  49300. }
  49301. let data = (0, _util.stringToBytes)(s);
  49302. data = cipher.encrypt(data, iv);
  49303. const buf = new Uint8Array(16 + data.length);
  49304. buf.set(iv);
  49305. buf.set(data, 16);
  49306. return (0, _util.bytesToString)(buf);
  49307. }
  49308. let data = (0, _util.stringToBytes)(s);
  49309. data = cipher.encrypt(data);
  49310. return (0, _util.bytesToString)(data);
  49311. }
  49312. }
  49313. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  49314. 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]);
  49315. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  49316. if (password) {
  49317. const passwordLength = Math.min(127, password.length);
  49318. password = password.subarray(0, passwordLength);
  49319. } else {
  49320. password = [];
  49321. }
  49322. let pdfAlgorithm;
  49323. if (revision === 6) {
  49324. pdfAlgorithm = new PDF20();
  49325. } else {
  49326. pdfAlgorithm = new PDF17();
  49327. }
  49328. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  49329. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  49330. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  49331. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  49332. }
  49333. return null;
  49334. }
  49335. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  49336. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  49337. const hashData = new Uint8Array(hashDataSize);
  49338. let i = 0,
  49339. j,
  49340. n;
  49341. if (password) {
  49342. n = Math.min(32, password.length);
  49343. for (; i < n; ++i) {
  49344. hashData[i] = password[i];
  49345. }
  49346. }
  49347. j = 0;
  49348. while (i < 32) {
  49349. hashData[i++] = defaultPasswordBytes[j++];
  49350. }
  49351. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  49352. hashData[i++] = ownerPassword[j];
  49353. }
  49354. hashData[i++] = flags & 0xff;
  49355. hashData[i++] = flags >> 8 & 0xff;
  49356. hashData[i++] = flags >> 16 & 0xff;
  49357. hashData[i++] = flags >>> 24 & 0xff;
  49358. for (j = 0, n = fileId.length; j < n; ++j) {
  49359. hashData[i++] = fileId[j];
  49360. }
  49361. if (revision >= 4 && !encryptMetadata) {
  49362. hashData[i++] = 0xff;
  49363. hashData[i++] = 0xff;
  49364. hashData[i++] = 0xff;
  49365. hashData[i++] = 0xff;
  49366. }
  49367. let hash = calculateMD5(hashData, 0, i);
  49368. const keyLengthInBytes = keyLength >> 3;
  49369. if (revision >= 3) {
  49370. for (j = 0; j < 50; ++j) {
  49371. hash = calculateMD5(hash, 0, keyLengthInBytes);
  49372. }
  49373. }
  49374. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  49375. let cipher, checkData;
  49376. if (revision >= 3) {
  49377. for (i = 0; i < 32; ++i) {
  49378. hashData[i] = defaultPasswordBytes[i];
  49379. }
  49380. for (j = 0, n = fileId.length; j < n; ++j) {
  49381. hashData[i++] = fileId[j];
  49382. }
  49383. cipher = new ARCFourCipher(encryptionKey);
  49384. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  49385. n = encryptionKey.length;
  49386. const derivedKey = new Uint8Array(n);
  49387. for (j = 1; j <= 19; ++j) {
  49388. for (let k = 0; k < n; ++k) {
  49389. derivedKey[k] = encryptionKey[k] ^ j;
  49390. }
  49391. cipher = new ARCFourCipher(derivedKey);
  49392. checkData = cipher.encryptBlock(checkData);
  49393. }
  49394. for (j = 0, n = checkData.length; j < n; ++j) {
  49395. if (userPassword[j] !== checkData[j]) {
  49396. return null;
  49397. }
  49398. }
  49399. } else {
  49400. cipher = new ARCFourCipher(encryptionKey);
  49401. checkData = cipher.encryptBlock(defaultPasswordBytes);
  49402. for (j = 0, n = checkData.length; j < n; ++j) {
  49403. if (userPassword[j] !== checkData[j]) {
  49404. return null;
  49405. }
  49406. }
  49407. }
  49408. return encryptionKey;
  49409. }
  49410. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  49411. const hashData = new Uint8Array(32);
  49412. let i = 0;
  49413. const n = Math.min(32, password.length);
  49414. for (; i < n; ++i) {
  49415. hashData[i] = password[i];
  49416. }
  49417. let j = 0;
  49418. while (i < 32) {
  49419. hashData[i++] = defaultPasswordBytes[j++];
  49420. }
  49421. let hash = calculateMD5(hashData, 0, i);
  49422. const keyLengthInBytes = keyLength >> 3;
  49423. if (revision >= 3) {
  49424. for (j = 0; j < 50; ++j) {
  49425. hash = calculateMD5(hash, 0, hash.length);
  49426. }
  49427. }
  49428. let cipher, userPassword;
  49429. if (revision >= 3) {
  49430. userPassword = ownerPassword;
  49431. const derivedKey = new Uint8Array(keyLengthInBytes);
  49432. for (j = 19; j >= 0; j--) {
  49433. for (let k = 0; k < keyLengthInBytes; ++k) {
  49434. derivedKey[k] = hash[k] ^ j;
  49435. }
  49436. cipher = new ARCFourCipher(derivedKey);
  49437. userPassword = cipher.encryptBlock(userPassword);
  49438. }
  49439. } else {
  49440. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  49441. userPassword = cipher.encryptBlock(ownerPassword);
  49442. }
  49443. return userPassword;
  49444. }
  49445. const identityName = _primitives.Name.get("Identity");
  49446. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  49447. const key = new Uint8Array(encryptionKey.length + 9);
  49448. const n = encryptionKey.length;
  49449. let i;
  49450. for (i = 0; i < n; ++i) {
  49451. key[i] = encryptionKey[i];
  49452. }
  49453. key[i++] = num & 0xff;
  49454. key[i++] = num >> 8 & 0xff;
  49455. key[i++] = num >> 16 & 0xff;
  49456. key[i++] = gen & 0xff;
  49457. key[i++] = gen >> 8 & 0xff;
  49458. if (isAes) {
  49459. key[i++] = 0x73;
  49460. key[i++] = 0x41;
  49461. key[i++] = 0x6c;
  49462. key[i++] = 0x54;
  49463. }
  49464. const hash = calculateMD5(key, 0, i);
  49465. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  49466. }
  49467. function buildCipherConstructor(cf, name, num, gen, key) {
  49468. if (!(name instanceof _primitives.Name)) {
  49469. throw new _util.FormatError("Invalid crypt filter name.");
  49470. }
  49471. const cryptFilter = cf.get(name.name);
  49472. let cfm;
  49473. if (cryptFilter !== null && cryptFilter !== undefined) {
  49474. cfm = cryptFilter.get("CFM");
  49475. }
  49476. if (!cfm || cfm.name === "None") {
  49477. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49478. return new NullCipher();
  49479. };
  49480. }
  49481. if (cfm.name === "V2") {
  49482. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49483. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49484. };
  49485. }
  49486. if (cfm.name === "AESV2") {
  49487. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49488. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49489. };
  49490. }
  49491. if (cfm.name === "AESV3") {
  49492. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49493. return new AES256Cipher(key);
  49494. };
  49495. }
  49496. throw new _util.FormatError("Unknown crypto method");
  49497. }
  49498. class CipherTransformFactory {
  49499. constructor(dict, fileId, password) {
  49500. const filter = dict.get("Filter");
  49501. if (!(0, _primitives.isName)(filter, "Standard")) {
  49502. throw new _util.FormatError("unknown encryption method");
  49503. }
  49504. this.filterName = filter.name;
  49505. this.dict = dict;
  49506. const algorithm = dict.get("V");
  49507. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49508. throw new _util.FormatError("unsupported encryption algorithm");
  49509. }
  49510. this.algorithm = algorithm;
  49511. let keyLength = dict.get("Length");
  49512. if (!keyLength) {
  49513. if (algorithm <= 3) {
  49514. keyLength = 40;
  49515. } else {
  49516. const cfDict = dict.get("CF");
  49517. const streamCryptoName = dict.get("StmF");
  49518. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  49519. cfDict.suppressEncryption = true;
  49520. const handlerDict = cfDict.get(streamCryptoName.name);
  49521. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49522. if (keyLength < 40) {
  49523. keyLength <<= 3;
  49524. }
  49525. }
  49526. }
  49527. }
  49528. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49529. throw new _util.FormatError("invalid key length");
  49530. }
  49531. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49532. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49533. const flags = dict.get("P");
  49534. const revision = dict.get("R");
  49535. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49536. this.encryptMetadata = encryptMetadata;
  49537. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49538. let passwordBytes;
  49539. if (password) {
  49540. if (revision === 6) {
  49541. try {
  49542. password = (0, _util.utf8StringToString)(password);
  49543. } catch (ex) {
  49544. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49545. }
  49546. }
  49547. passwordBytes = (0, _util.stringToBytes)(password);
  49548. }
  49549. let encryptionKey;
  49550. if (algorithm !== 5) {
  49551. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49552. } else {
  49553. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49554. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49555. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49556. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49557. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49558. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49559. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  49560. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  49561. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  49562. }
  49563. if (!encryptionKey && !password) {
  49564. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  49565. } else if (!encryptionKey && password) {
  49566. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  49567. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49568. }
  49569. if (!encryptionKey) {
  49570. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  49571. }
  49572. this.encryptionKey = encryptionKey;
  49573. if (algorithm >= 4) {
  49574. const cf = dict.get("CF");
  49575. if (cf instanceof _primitives.Dict) {
  49576. cf.suppressEncryption = true;
  49577. }
  49578. this.cf = cf;
  49579. this.stmf = dict.get("StmF") || identityName;
  49580. this.strf = dict.get("StrF") || identityName;
  49581. this.eff = dict.get("EFF") || this.stmf;
  49582. }
  49583. }
  49584. createCipherTransform(num, gen) {
  49585. if (this.algorithm === 4 || this.algorithm === 5) {
  49586. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  49587. }
  49588. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  49589. const cipherConstructor = function buildCipherCipherConstructor() {
  49590. return new ARCFourCipher(key);
  49591. };
  49592. return new CipherTransform(cipherConstructor, cipherConstructor);
  49593. }
  49594. }
  49595. return CipherTransformFactory;
  49596. }();
  49597. exports.CipherTransformFactory = CipherTransformFactory;
  49598. /***/ }),
  49599. /* 66 */
  49600. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49601. Object.defineProperty(exports, "__esModule", ({
  49602. value: true
  49603. }));
  49604. exports.DecryptStream = void 0;
  49605. var _decode_stream = __w_pdfjs_require__(17);
  49606. const chunkSize = 512;
  49607. class DecryptStream extends _decode_stream.DecodeStream {
  49608. constructor(str, maybeLength, decrypt) {
  49609. super(maybeLength);
  49610. this.str = str;
  49611. this.dict = str.dict;
  49612. this.decrypt = decrypt;
  49613. this.nextChunk = null;
  49614. this.initialized = false;
  49615. }
  49616. readBlock() {
  49617. let chunk;
  49618. if (this.initialized) {
  49619. chunk = this.nextChunk;
  49620. } else {
  49621. chunk = this.str.getBytes(chunkSize);
  49622. this.initialized = true;
  49623. }
  49624. if (!chunk || chunk.length === 0) {
  49625. this.eof = true;
  49626. return;
  49627. }
  49628. this.nextChunk = this.str.getBytes(chunkSize);
  49629. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49630. const decrypt = this.decrypt;
  49631. chunk = decrypt(chunk, !hasMoreData);
  49632. const bufferLength = this.bufferLength,
  49633. newLength = bufferLength + chunk.length,
  49634. buffer = this.ensureBuffer(newLength);
  49635. buffer.set(chunk, bufferLength);
  49636. this.bufferLength = newLength;
  49637. }
  49638. }
  49639. exports.DecryptStream = DecryptStream;
  49640. /***/ }),
  49641. /* 67 */
  49642. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49643. Object.defineProperty(exports, "__esModule", ({
  49644. value: true
  49645. }));
  49646. exports.Catalog = void 0;
  49647. var _core_utils = __w_pdfjs_require__(4);
  49648. var _util = __w_pdfjs_require__(2);
  49649. var _primitives = __w_pdfjs_require__(3);
  49650. var _name_number_tree = __w_pdfjs_require__(68);
  49651. var _base_stream = __w_pdfjs_require__(5);
  49652. var _cleanup_helper = __w_pdfjs_require__(69);
  49653. var _colorspace = __w_pdfjs_require__(12);
  49654. var _file_spec = __w_pdfjs_require__(70);
  49655. var _image_utils = __w_pdfjs_require__(57);
  49656. var _metadata_parser = __w_pdfjs_require__(71);
  49657. var _struct_tree = __w_pdfjs_require__(72);
  49658. function fetchDestination(dest) {
  49659. if (dest instanceof _primitives.Dict) {
  49660. dest = dest.get("D");
  49661. }
  49662. return Array.isArray(dest) ? dest : null;
  49663. }
  49664. class Catalog {
  49665. constructor(pdfManager, xref) {
  49666. this.pdfManager = pdfManager;
  49667. this.xref = xref;
  49668. this._catDict = xref.getCatalogObj();
  49669. if (!(this._catDict instanceof _primitives.Dict)) {
  49670. throw new _util.FormatError("Catalog object is not a dictionary.");
  49671. }
  49672. this.toplevelPagesDict;
  49673. this._actualNumPages = null;
  49674. this.fontCache = new _primitives.RefSetCache();
  49675. this.builtInCMapCache = new Map();
  49676. this.standardFontDataCache = new Map();
  49677. this.globalImageCache = new _image_utils.GlobalImageCache();
  49678. this.pageKidsCountCache = new _primitives.RefSetCache();
  49679. this.pageIndexCache = new _primitives.RefSetCache();
  49680. this.nonBlendModesSet = new _primitives.RefSet();
  49681. }
  49682. get version() {
  49683. const version = this._catDict.get("Version");
  49684. if (version instanceof _primitives.Name) {
  49685. if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
  49686. return (0, _util.shadow)(this, "version", version.name);
  49687. }
  49688. (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
  49689. }
  49690. return (0, _util.shadow)(this, "version", null);
  49691. }
  49692. get lang() {
  49693. const lang = this._catDict.get("Lang");
  49694. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  49695. }
  49696. get needsRendering() {
  49697. const needsRendering = this._catDict.get("NeedsRendering");
  49698. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  49699. }
  49700. get collection() {
  49701. let collection = null;
  49702. try {
  49703. const obj = this._catDict.get("Collection");
  49704. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49705. collection = obj;
  49706. }
  49707. } catch (ex) {
  49708. if (ex instanceof _core_utils.MissingDataException) {
  49709. throw ex;
  49710. }
  49711. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  49712. }
  49713. return (0, _util.shadow)(this, "collection", collection);
  49714. }
  49715. get acroForm() {
  49716. let acroForm = null;
  49717. try {
  49718. const obj = this._catDict.get("AcroForm");
  49719. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49720. acroForm = obj;
  49721. }
  49722. } catch (ex) {
  49723. if (ex instanceof _core_utils.MissingDataException) {
  49724. throw ex;
  49725. }
  49726. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  49727. }
  49728. return (0, _util.shadow)(this, "acroForm", acroForm);
  49729. }
  49730. get acroFormRef() {
  49731. const value = this._catDict.getRaw("AcroForm");
  49732. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  49733. }
  49734. get metadata() {
  49735. const streamRef = this._catDict.getRaw("Metadata");
  49736. if (!(streamRef instanceof _primitives.Ref)) {
  49737. return (0, _util.shadow)(this, "metadata", null);
  49738. }
  49739. let metadata = null;
  49740. try {
  49741. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  49742. const stream = this.xref.fetch(streamRef, suppressEncryption);
  49743. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  49744. const type = stream.dict.get("Type");
  49745. const subtype = stream.dict.get("Subtype");
  49746. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  49747. const data = (0, _util.stringToUTF8String)(stream.getString());
  49748. if (data) {
  49749. metadata = new _metadata_parser.MetadataParser(data).serializable;
  49750. }
  49751. }
  49752. }
  49753. } catch (ex) {
  49754. if (ex instanceof _core_utils.MissingDataException) {
  49755. throw ex;
  49756. }
  49757. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  49758. }
  49759. return (0, _util.shadow)(this, "metadata", metadata);
  49760. }
  49761. get markInfo() {
  49762. let markInfo = null;
  49763. try {
  49764. markInfo = this._readMarkInfo();
  49765. } catch (ex) {
  49766. if (ex instanceof _core_utils.MissingDataException) {
  49767. throw ex;
  49768. }
  49769. (0, _util.warn)("Unable to read mark info.");
  49770. }
  49771. return (0, _util.shadow)(this, "markInfo", markInfo);
  49772. }
  49773. _readMarkInfo() {
  49774. const obj = this._catDict.get("MarkInfo");
  49775. if (!(obj instanceof _primitives.Dict)) {
  49776. return null;
  49777. }
  49778. const markInfo = {
  49779. Marked: false,
  49780. UserProperties: false,
  49781. Suspects: false
  49782. };
  49783. for (const key in markInfo) {
  49784. const value = obj.get(key);
  49785. if (typeof value === "boolean") {
  49786. markInfo[key] = value;
  49787. }
  49788. }
  49789. return markInfo;
  49790. }
  49791. get structTreeRoot() {
  49792. let structTree = null;
  49793. try {
  49794. structTree = this._readStructTreeRoot();
  49795. } catch (ex) {
  49796. if (ex instanceof _core_utils.MissingDataException) {
  49797. throw ex;
  49798. }
  49799. (0, _util.warn)("Unable read to structTreeRoot info.");
  49800. }
  49801. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  49802. }
  49803. _readStructTreeRoot() {
  49804. const obj = this._catDict.get("StructTreeRoot");
  49805. if (!(obj instanceof _primitives.Dict)) {
  49806. return null;
  49807. }
  49808. const root = new _struct_tree.StructTreeRoot(obj);
  49809. root.init();
  49810. return root;
  49811. }
  49812. get toplevelPagesDict() {
  49813. const pagesObj = this._catDict.get("Pages");
  49814. if (!(pagesObj instanceof _primitives.Dict)) {
  49815. throw new _util.FormatError("Invalid top-level pages dictionary.");
  49816. }
  49817. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  49818. }
  49819. get documentOutline() {
  49820. let obj = null;
  49821. try {
  49822. obj = this._readDocumentOutline();
  49823. } catch (ex) {
  49824. if (ex instanceof _core_utils.MissingDataException) {
  49825. throw ex;
  49826. }
  49827. (0, _util.warn)("Unable to read document outline.");
  49828. }
  49829. return (0, _util.shadow)(this, "documentOutline", obj);
  49830. }
  49831. _readDocumentOutline() {
  49832. let obj = this._catDict.get("Outlines");
  49833. if (!(obj instanceof _primitives.Dict)) {
  49834. return null;
  49835. }
  49836. obj = obj.getRaw("First");
  49837. if (!(obj instanceof _primitives.Ref)) {
  49838. return null;
  49839. }
  49840. const root = {
  49841. items: []
  49842. };
  49843. const queue = [{
  49844. obj,
  49845. parent: root
  49846. }];
  49847. const processed = new _primitives.RefSet();
  49848. processed.put(obj);
  49849. const xref = this.xref,
  49850. blackColor = new Uint8ClampedArray(3);
  49851. while (queue.length > 0) {
  49852. const i = queue.shift();
  49853. const outlineDict = xref.fetchIfRef(i.obj);
  49854. if (outlineDict === null) {
  49855. continue;
  49856. }
  49857. if (!outlineDict.has("Title")) {
  49858. throw new _util.FormatError("Invalid outline item encountered.");
  49859. }
  49860. const data = {
  49861. url: null,
  49862. dest: null,
  49863. action: null
  49864. };
  49865. Catalog.parseDestDictionary({
  49866. destDict: outlineDict,
  49867. resultObj: data,
  49868. docBaseUrl: this.pdfManager.docBaseUrl,
  49869. docAttachments: this.attachments
  49870. });
  49871. const title = outlineDict.get("Title");
  49872. const flags = outlineDict.get("F") || 0;
  49873. const color = outlineDict.getArray("C");
  49874. const count = outlineDict.get("Count");
  49875. let rgbColor = blackColor;
  49876. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  49877. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  49878. }
  49879. const outlineItem = {
  49880. action: data.action,
  49881. attachment: data.attachment,
  49882. dest: data.dest,
  49883. url: data.url,
  49884. unsafeUrl: data.unsafeUrl,
  49885. newWindow: data.newWindow,
  49886. setOCGState: data.setOCGState,
  49887. title: (0, _util.stringToPDFString)(title),
  49888. color: rgbColor,
  49889. count: Number.isInteger(count) ? count : undefined,
  49890. bold: !!(flags & 2),
  49891. italic: !!(flags & 1),
  49892. items: []
  49893. };
  49894. i.parent.items.push(outlineItem);
  49895. obj = outlineDict.getRaw("First");
  49896. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49897. queue.push({
  49898. obj,
  49899. parent: outlineItem
  49900. });
  49901. processed.put(obj);
  49902. }
  49903. obj = outlineDict.getRaw("Next");
  49904. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49905. queue.push({
  49906. obj,
  49907. parent: i.parent
  49908. });
  49909. processed.put(obj);
  49910. }
  49911. }
  49912. return root.items.length > 0 ? root.items : null;
  49913. }
  49914. get permissions() {
  49915. let permissions = null;
  49916. try {
  49917. permissions = this._readPermissions();
  49918. } catch (ex) {
  49919. if (ex instanceof _core_utils.MissingDataException) {
  49920. throw ex;
  49921. }
  49922. (0, _util.warn)("Unable to read permissions.");
  49923. }
  49924. return (0, _util.shadow)(this, "permissions", permissions);
  49925. }
  49926. _readPermissions() {
  49927. const encrypt = this.xref.trailer.get("Encrypt");
  49928. if (!(encrypt instanceof _primitives.Dict)) {
  49929. return null;
  49930. }
  49931. let flags = encrypt.get("P");
  49932. if (typeof flags !== "number") {
  49933. return null;
  49934. }
  49935. flags += 2 ** 32;
  49936. const permissions = [];
  49937. for (const key in _util.PermissionFlag) {
  49938. const value = _util.PermissionFlag[key];
  49939. if (flags & value) {
  49940. permissions.push(value);
  49941. }
  49942. }
  49943. return permissions;
  49944. }
  49945. get optionalContentConfig() {
  49946. let config = null;
  49947. try {
  49948. const properties = this._catDict.get("OCProperties");
  49949. if (!properties) {
  49950. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49951. }
  49952. const defaultConfig = properties.get("D");
  49953. if (!defaultConfig) {
  49954. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49955. }
  49956. const groupsData = properties.get("OCGs");
  49957. if (!Array.isArray(groupsData)) {
  49958. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49959. }
  49960. const groups = [];
  49961. const groupRefs = [];
  49962. for (const groupRef of groupsData) {
  49963. if (!(groupRef instanceof _primitives.Ref)) {
  49964. continue;
  49965. }
  49966. groupRefs.push(groupRef);
  49967. const group = this.xref.fetchIfRef(groupRef);
  49968. groups.push({
  49969. id: groupRef.toString(),
  49970. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  49971. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  49972. });
  49973. }
  49974. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  49975. config.groups = groups;
  49976. } catch (ex) {
  49977. if (ex instanceof _core_utils.MissingDataException) {
  49978. throw ex;
  49979. }
  49980. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  49981. }
  49982. return (0, _util.shadow)(this, "optionalContentConfig", config);
  49983. }
  49984. _readOptionalContentConfig(config, contentGroupRefs) {
  49985. function parseOnOff(refs) {
  49986. const onParsed = [];
  49987. if (Array.isArray(refs)) {
  49988. for (const value of refs) {
  49989. if (!(value instanceof _primitives.Ref)) {
  49990. continue;
  49991. }
  49992. if (contentGroupRefs.includes(value)) {
  49993. onParsed.push(value.toString());
  49994. }
  49995. }
  49996. }
  49997. return onParsed;
  49998. }
  49999. function parseOrder(refs, nestedLevels = 0) {
  50000. if (!Array.isArray(refs)) {
  50001. return null;
  50002. }
  50003. const order = [];
  50004. for (const value of refs) {
  50005. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  50006. parsedOrderRefs.put(value);
  50007. order.push(value.toString());
  50008. continue;
  50009. }
  50010. const nestedOrder = parseNestedOrder(value, nestedLevels);
  50011. if (nestedOrder) {
  50012. order.push(nestedOrder);
  50013. }
  50014. }
  50015. if (nestedLevels > 0) {
  50016. return order;
  50017. }
  50018. const hiddenGroups = [];
  50019. for (const groupRef of contentGroupRefs) {
  50020. if (parsedOrderRefs.has(groupRef)) {
  50021. continue;
  50022. }
  50023. hiddenGroups.push(groupRef.toString());
  50024. }
  50025. if (hiddenGroups.length) {
  50026. order.push({
  50027. name: null,
  50028. order: hiddenGroups
  50029. });
  50030. }
  50031. return order;
  50032. }
  50033. function parseNestedOrder(ref, nestedLevels) {
  50034. if (++nestedLevels > MAX_NESTED_LEVELS) {
  50035. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  50036. return null;
  50037. }
  50038. const value = xref.fetchIfRef(ref);
  50039. if (!Array.isArray(value)) {
  50040. return null;
  50041. }
  50042. const nestedName = xref.fetchIfRef(value[0]);
  50043. if (typeof nestedName !== "string") {
  50044. return null;
  50045. }
  50046. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  50047. if (!nestedOrder || !nestedOrder.length) {
  50048. return null;
  50049. }
  50050. return {
  50051. name: (0, _util.stringToPDFString)(nestedName),
  50052. order: nestedOrder
  50053. };
  50054. }
  50055. const xref = this.xref,
  50056. parsedOrderRefs = new _primitives.RefSet(),
  50057. MAX_NESTED_LEVELS = 10;
  50058. return {
  50059. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  50060. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  50061. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  50062. on: parseOnOff(config.get("ON")),
  50063. off: parseOnOff(config.get("OFF")),
  50064. order: parseOrder(config.get("Order")),
  50065. groups: null
  50066. };
  50067. }
  50068. setActualNumPages(num = null) {
  50069. this._actualNumPages = num;
  50070. }
  50071. get hasActualNumPages() {
  50072. return this._actualNumPages !== null;
  50073. }
  50074. get _pagesCount() {
  50075. const obj = this.toplevelPagesDict.get("Count");
  50076. if (!Number.isInteger(obj)) {
  50077. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  50078. }
  50079. return (0, _util.shadow)(this, "_pagesCount", obj);
  50080. }
  50081. get numPages() {
  50082. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  50083. }
  50084. get destinations() {
  50085. const obj = this._readDests(),
  50086. dests = Object.create(null);
  50087. if (obj instanceof _name_number_tree.NameTree) {
  50088. for (const [key, value] of obj.getAll()) {
  50089. const dest = fetchDestination(value);
  50090. if (dest) {
  50091. dests[(0, _util.stringToPDFString)(key)] = dest;
  50092. }
  50093. }
  50094. } else if (obj instanceof _primitives.Dict) {
  50095. obj.forEach(function (key, value) {
  50096. const dest = fetchDestination(value);
  50097. if (dest) {
  50098. dests[key] = dest;
  50099. }
  50100. });
  50101. }
  50102. return (0, _util.shadow)(this, "destinations", dests);
  50103. }
  50104. getDestination(id) {
  50105. const obj = this._readDests();
  50106. if (obj instanceof _name_number_tree.NameTree) {
  50107. const dest = fetchDestination(obj.get(id));
  50108. if (dest) {
  50109. return dest;
  50110. }
  50111. const allDest = this.destinations[id];
  50112. if (allDest) {
  50113. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  50114. return allDest;
  50115. }
  50116. } else if (obj instanceof _primitives.Dict) {
  50117. const dest = fetchDestination(obj.get(id));
  50118. if (dest) {
  50119. return dest;
  50120. }
  50121. }
  50122. return null;
  50123. }
  50124. _readDests() {
  50125. const obj = this._catDict.get("Names");
  50126. if (obj && obj.has("Dests")) {
  50127. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  50128. } else if (this._catDict.has("Dests")) {
  50129. return this._catDict.get("Dests");
  50130. }
  50131. return undefined;
  50132. }
  50133. get pageLabels() {
  50134. let obj = null;
  50135. try {
  50136. obj = this._readPageLabels();
  50137. } catch (ex) {
  50138. if (ex instanceof _core_utils.MissingDataException) {
  50139. throw ex;
  50140. }
  50141. (0, _util.warn)("Unable to read page labels.");
  50142. }
  50143. return (0, _util.shadow)(this, "pageLabels", obj);
  50144. }
  50145. _readPageLabels() {
  50146. const obj = this._catDict.getRaw("PageLabels");
  50147. if (!obj) {
  50148. return null;
  50149. }
  50150. const pageLabels = new Array(this.numPages);
  50151. let style = null,
  50152. prefix = "";
  50153. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  50154. const nums = numberTree.getAll();
  50155. let currentLabel = "",
  50156. currentIndex = 1;
  50157. for (let i = 0, ii = this.numPages; i < ii; i++) {
  50158. const labelDict = nums.get(i);
  50159. if (labelDict !== undefined) {
  50160. if (!(labelDict instanceof _primitives.Dict)) {
  50161. throw new _util.FormatError("PageLabel is not a dictionary.");
  50162. }
  50163. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  50164. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  50165. }
  50166. if (labelDict.has("S")) {
  50167. const s = labelDict.get("S");
  50168. if (!(s instanceof _primitives.Name)) {
  50169. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  50170. }
  50171. style = s.name;
  50172. } else {
  50173. style = null;
  50174. }
  50175. if (labelDict.has("P")) {
  50176. const p = labelDict.get("P");
  50177. if (typeof p !== "string") {
  50178. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  50179. }
  50180. prefix = (0, _util.stringToPDFString)(p);
  50181. } else {
  50182. prefix = "";
  50183. }
  50184. if (labelDict.has("St")) {
  50185. const st = labelDict.get("St");
  50186. if (!(Number.isInteger(st) && st >= 1)) {
  50187. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  50188. }
  50189. currentIndex = st;
  50190. } else {
  50191. currentIndex = 1;
  50192. }
  50193. }
  50194. switch (style) {
  50195. case "D":
  50196. currentLabel = currentIndex;
  50197. break;
  50198. case "R":
  50199. case "r":
  50200. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  50201. break;
  50202. case "A":
  50203. case "a":
  50204. const LIMIT = 26;
  50205. const A_UPPER_CASE = 0x41,
  50206. A_LOWER_CASE = 0x61;
  50207. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  50208. const letterIndex = currentIndex - 1;
  50209. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  50210. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  50211. break;
  50212. default:
  50213. if (style) {
  50214. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  50215. }
  50216. currentLabel = "";
  50217. }
  50218. pageLabels[i] = prefix + currentLabel;
  50219. currentIndex++;
  50220. }
  50221. return pageLabels;
  50222. }
  50223. get pageLayout() {
  50224. const obj = this._catDict.get("PageLayout");
  50225. let pageLayout = "";
  50226. if (obj instanceof _primitives.Name) {
  50227. switch (obj.name) {
  50228. case "SinglePage":
  50229. case "OneColumn":
  50230. case "TwoColumnLeft":
  50231. case "TwoColumnRight":
  50232. case "TwoPageLeft":
  50233. case "TwoPageRight":
  50234. pageLayout = obj.name;
  50235. }
  50236. }
  50237. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  50238. }
  50239. get pageMode() {
  50240. const obj = this._catDict.get("PageMode");
  50241. let pageMode = "UseNone";
  50242. if (obj instanceof _primitives.Name) {
  50243. switch (obj.name) {
  50244. case "UseNone":
  50245. case "UseOutlines":
  50246. case "UseThumbs":
  50247. case "FullScreen":
  50248. case "UseOC":
  50249. case "UseAttachments":
  50250. pageMode = obj.name;
  50251. }
  50252. }
  50253. return (0, _util.shadow)(this, "pageMode", pageMode);
  50254. }
  50255. get viewerPreferences() {
  50256. const obj = this._catDict.get("ViewerPreferences");
  50257. if (!(obj instanceof _primitives.Dict)) {
  50258. return (0, _util.shadow)(this, "viewerPreferences", null);
  50259. }
  50260. let prefs = null;
  50261. for (const key of obj.getKeys()) {
  50262. const value = obj.get(key);
  50263. let prefValue;
  50264. switch (key) {
  50265. case "HideToolbar":
  50266. case "HideMenubar":
  50267. case "HideWindowUI":
  50268. case "FitWindow":
  50269. case "CenterWindow":
  50270. case "DisplayDocTitle":
  50271. case "PickTrayByPDFSize":
  50272. if (typeof value === "boolean") {
  50273. prefValue = value;
  50274. }
  50275. break;
  50276. case "NonFullScreenPageMode":
  50277. if (value instanceof _primitives.Name) {
  50278. switch (value.name) {
  50279. case "UseNone":
  50280. case "UseOutlines":
  50281. case "UseThumbs":
  50282. case "UseOC":
  50283. prefValue = value.name;
  50284. break;
  50285. default:
  50286. prefValue = "UseNone";
  50287. }
  50288. }
  50289. break;
  50290. case "Direction":
  50291. if (value instanceof _primitives.Name) {
  50292. switch (value.name) {
  50293. case "L2R":
  50294. case "R2L":
  50295. prefValue = value.name;
  50296. break;
  50297. default:
  50298. prefValue = "L2R";
  50299. }
  50300. }
  50301. break;
  50302. case "ViewArea":
  50303. case "ViewClip":
  50304. case "PrintArea":
  50305. case "PrintClip":
  50306. if (value instanceof _primitives.Name) {
  50307. switch (value.name) {
  50308. case "MediaBox":
  50309. case "CropBox":
  50310. case "BleedBox":
  50311. case "TrimBox":
  50312. case "ArtBox":
  50313. prefValue = value.name;
  50314. break;
  50315. default:
  50316. prefValue = "CropBox";
  50317. }
  50318. }
  50319. break;
  50320. case "PrintScaling":
  50321. if (value instanceof _primitives.Name) {
  50322. switch (value.name) {
  50323. case "None":
  50324. case "AppDefault":
  50325. prefValue = value.name;
  50326. break;
  50327. default:
  50328. prefValue = "AppDefault";
  50329. }
  50330. }
  50331. break;
  50332. case "Duplex":
  50333. if (value instanceof _primitives.Name) {
  50334. switch (value.name) {
  50335. case "Simplex":
  50336. case "DuplexFlipShortEdge":
  50337. case "DuplexFlipLongEdge":
  50338. prefValue = value.name;
  50339. break;
  50340. default:
  50341. prefValue = "None";
  50342. }
  50343. }
  50344. break;
  50345. case "PrintPageRange":
  50346. if (Array.isArray(value) && value.length % 2 === 0) {
  50347. const isValid = value.every((page, i, arr) => {
  50348. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  50349. });
  50350. if (isValid) {
  50351. prefValue = value;
  50352. }
  50353. }
  50354. break;
  50355. case "NumCopies":
  50356. if (Number.isInteger(value) && value > 0) {
  50357. prefValue = value;
  50358. }
  50359. break;
  50360. default:
  50361. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  50362. continue;
  50363. }
  50364. if (prefValue === undefined) {
  50365. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  50366. continue;
  50367. }
  50368. if (!prefs) {
  50369. prefs = Object.create(null);
  50370. }
  50371. prefs[key] = prefValue;
  50372. }
  50373. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  50374. }
  50375. get openAction() {
  50376. const obj = this._catDict.get("OpenAction");
  50377. const openAction = Object.create(null);
  50378. if (obj instanceof _primitives.Dict) {
  50379. const destDict = new _primitives.Dict(this.xref);
  50380. destDict.set("A", obj);
  50381. const resultObj = {
  50382. url: null,
  50383. dest: null,
  50384. action: null
  50385. };
  50386. Catalog.parseDestDictionary({
  50387. destDict,
  50388. resultObj
  50389. });
  50390. if (Array.isArray(resultObj.dest)) {
  50391. openAction.dest = resultObj.dest;
  50392. } else if (resultObj.action) {
  50393. openAction.action = resultObj.action;
  50394. }
  50395. } else if (Array.isArray(obj)) {
  50396. openAction.dest = obj;
  50397. }
  50398. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  50399. }
  50400. get attachments() {
  50401. const obj = this._catDict.get("Names");
  50402. let attachments = null;
  50403. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  50404. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  50405. for (const [key, value] of nameTree.getAll()) {
  50406. const fs = new _file_spec.FileSpec(value, this.xref);
  50407. if (!attachments) {
  50408. attachments = Object.create(null);
  50409. }
  50410. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  50411. }
  50412. }
  50413. return (0, _util.shadow)(this, "attachments", attachments);
  50414. }
  50415. get xfaImages() {
  50416. const obj = this._catDict.get("Names");
  50417. let xfaImages = null;
  50418. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  50419. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  50420. for (const [key, value] of nameTree.getAll()) {
  50421. if (!xfaImages) {
  50422. xfaImages = new _primitives.Dict(this.xref);
  50423. }
  50424. xfaImages.set((0, _util.stringToPDFString)(key), value);
  50425. }
  50426. }
  50427. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  50428. }
  50429. _collectJavaScript() {
  50430. const obj = this._catDict.get("Names");
  50431. let javaScript = null;
  50432. function appendIfJavaScriptDict(name, jsDict) {
  50433. if (!(jsDict instanceof _primitives.Dict)) {
  50434. return;
  50435. }
  50436. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  50437. return;
  50438. }
  50439. let js = jsDict.get("JS");
  50440. if (js instanceof _base_stream.BaseStream) {
  50441. js = js.getString();
  50442. } else if (typeof js !== "string") {
  50443. return;
  50444. }
  50445. if (javaScript === null) {
  50446. javaScript = new Map();
  50447. }
  50448. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  50449. javaScript.set(name, js);
  50450. }
  50451. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  50452. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  50453. for (const [key, value] of nameTree.getAll()) {
  50454. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  50455. }
  50456. }
  50457. const openAction = this._catDict.get("OpenAction");
  50458. if (openAction) {
  50459. appendIfJavaScriptDict("OpenAction", openAction);
  50460. }
  50461. return javaScript;
  50462. }
  50463. get javaScript() {
  50464. const javaScript = this._collectJavaScript();
  50465. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  50466. }
  50467. get jsActions() {
  50468. const javaScript = this._collectJavaScript();
  50469. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  50470. if (javaScript) {
  50471. if (!actions) {
  50472. actions = Object.create(null);
  50473. }
  50474. for (const [key, val] of javaScript) {
  50475. if (key in actions) {
  50476. actions[key].push(val);
  50477. } else {
  50478. actions[key] = [val];
  50479. }
  50480. }
  50481. }
  50482. return (0, _util.shadow)(this, "jsActions", actions);
  50483. }
  50484. async fontFallback(id, handler) {
  50485. const translatedFonts = await Promise.all(this.fontCache);
  50486. for (const translatedFont of translatedFonts) {
  50487. if (translatedFont.loadedName === id) {
  50488. translatedFont.fallback(handler);
  50489. return;
  50490. }
  50491. }
  50492. }
  50493. async cleanup(manuallyTriggered = false) {
  50494. (0, _cleanup_helper.clearGlobalCaches)();
  50495. this.globalImageCache.clear(manuallyTriggered);
  50496. this.pageKidsCountCache.clear();
  50497. this.pageIndexCache.clear();
  50498. this.nonBlendModesSet.clear();
  50499. const translatedFonts = await Promise.all(this.fontCache);
  50500. for (const {
  50501. dict
  50502. } of translatedFonts) {
  50503. delete dict.cacheKey;
  50504. }
  50505. this.fontCache.clear();
  50506. this.builtInCMapCache.clear();
  50507. this.standardFontDataCache.clear();
  50508. }
  50509. async getPageDict(pageIndex) {
  50510. const nodesToVisit = [this.toplevelPagesDict];
  50511. const visitedNodes = new _primitives.RefSet();
  50512. const pagesRef = this._catDict.getRaw("Pages");
  50513. if (pagesRef instanceof _primitives.Ref) {
  50514. visitedNodes.put(pagesRef);
  50515. }
  50516. const xref = this.xref,
  50517. pageKidsCountCache = this.pageKidsCountCache,
  50518. pageIndexCache = this.pageIndexCache;
  50519. let currentPageIndex = 0;
  50520. while (nodesToVisit.length) {
  50521. const currentNode = nodesToVisit.pop();
  50522. if (currentNode instanceof _primitives.Ref) {
  50523. const count = pageKidsCountCache.get(currentNode);
  50524. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  50525. currentPageIndex += count;
  50526. continue;
  50527. }
  50528. if (visitedNodes.has(currentNode)) {
  50529. throw new _util.FormatError("Pages tree contains circular reference.");
  50530. }
  50531. visitedNodes.put(currentNode);
  50532. const obj = await xref.fetchAsync(currentNode);
  50533. if (obj instanceof _primitives.Dict) {
  50534. let type = obj.getRaw("Type");
  50535. if (type instanceof _primitives.Ref) {
  50536. type = await xref.fetchAsync(type);
  50537. }
  50538. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50539. if (!pageKidsCountCache.has(currentNode)) {
  50540. pageKidsCountCache.put(currentNode, 1);
  50541. }
  50542. if (!pageIndexCache.has(currentNode)) {
  50543. pageIndexCache.put(currentNode, currentPageIndex);
  50544. }
  50545. if (currentPageIndex === pageIndex) {
  50546. return [obj, currentNode];
  50547. }
  50548. currentPageIndex++;
  50549. continue;
  50550. }
  50551. }
  50552. nodesToVisit.push(obj);
  50553. continue;
  50554. }
  50555. if (!(currentNode instanceof _primitives.Dict)) {
  50556. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  50557. }
  50558. const {
  50559. objId
  50560. } = currentNode;
  50561. let count = currentNode.getRaw("Count");
  50562. if (count instanceof _primitives.Ref) {
  50563. count = await xref.fetchAsync(count);
  50564. }
  50565. if (Number.isInteger(count) && count >= 0) {
  50566. if (objId && !pageKidsCountCache.has(objId)) {
  50567. pageKidsCountCache.put(objId, count);
  50568. }
  50569. if (currentPageIndex + count <= pageIndex) {
  50570. currentPageIndex += count;
  50571. continue;
  50572. }
  50573. }
  50574. let kids = currentNode.getRaw("Kids");
  50575. if (kids instanceof _primitives.Ref) {
  50576. kids = await xref.fetchAsync(kids);
  50577. }
  50578. if (!Array.isArray(kids)) {
  50579. let type = currentNode.getRaw("Type");
  50580. if (type instanceof _primitives.Ref) {
  50581. type = await xref.fetchAsync(type);
  50582. }
  50583. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  50584. if (currentPageIndex === pageIndex) {
  50585. return [currentNode, null];
  50586. }
  50587. currentPageIndex++;
  50588. continue;
  50589. }
  50590. throw new _util.FormatError("Page dictionary kids object is not an array.");
  50591. }
  50592. for (let last = kids.length - 1; last >= 0; last--) {
  50593. nodesToVisit.push(kids[last]);
  50594. }
  50595. }
  50596. throw new Error(`Page index ${pageIndex} not found.`);
  50597. }
  50598. async getAllPageDicts(recoveryMode = false) {
  50599. const {
  50600. ignoreErrors
  50601. } = this.pdfManager.evaluatorOptions;
  50602. const queue = [{
  50603. currentNode: this.toplevelPagesDict,
  50604. posInKids: 0
  50605. }];
  50606. const visitedNodes = new _primitives.RefSet();
  50607. const pagesRef = this._catDict.getRaw("Pages");
  50608. if (pagesRef instanceof _primitives.Ref) {
  50609. visitedNodes.put(pagesRef);
  50610. }
  50611. const map = new Map(),
  50612. xref = this.xref,
  50613. pageIndexCache = this.pageIndexCache;
  50614. let pageIndex = 0;
  50615. function addPageDict(pageDict, pageRef) {
  50616. if (pageRef && !pageIndexCache.has(pageRef)) {
  50617. pageIndexCache.put(pageRef, pageIndex);
  50618. }
  50619. map.set(pageIndex++, [pageDict, pageRef]);
  50620. }
  50621. function addPageError(error) {
  50622. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  50623. throw error;
  50624. }
  50625. if (recoveryMode && ignoreErrors && pageIndex === 0) {
  50626. (0, _util.warn)(`getAllPageDicts - Skipping invalid first page: "${error}".`);
  50627. error = _primitives.Dict.empty;
  50628. }
  50629. map.set(pageIndex++, [error, null]);
  50630. }
  50631. while (queue.length > 0) {
  50632. const queueItem = queue.at(-1);
  50633. const {
  50634. currentNode,
  50635. posInKids
  50636. } = queueItem;
  50637. let kids = currentNode.getRaw("Kids");
  50638. if (kids instanceof _primitives.Ref) {
  50639. try {
  50640. kids = await xref.fetchAsync(kids);
  50641. } catch (ex) {
  50642. addPageError(ex);
  50643. break;
  50644. }
  50645. }
  50646. if (!Array.isArray(kids)) {
  50647. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  50648. break;
  50649. }
  50650. if (posInKids >= kids.length) {
  50651. queue.pop();
  50652. continue;
  50653. }
  50654. const kidObj = kids[posInKids];
  50655. let obj;
  50656. if (kidObj instanceof _primitives.Ref) {
  50657. if (visitedNodes.has(kidObj)) {
  50658. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  50659. break;
  50660. }
  50661. visitedNodes.put(kidObj);
  50662. try {
  50663. obj = await xref.fetchAsync(kidObj);
  50664. } catch (ex) {
  50665. addPageError(ex);
  50666. break;
  50667. }
  50668. } else {
  50669. obj = kidObj;
  50670. }
  50671. if (!(obj instanceof _primitives.Dict)) {
  50672. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  50673. break;
  50674. }
  50675. let type = obj.getRaw("Type");
  50676. if (type instanceof _primitives.Ref) {
  50677. try {
  50678. type = await xref.fetchAsync(type);
  50679. } catch (ex) {
  50680. addPageError(ex);
  50681. break;
  50682. }
  50683. }
  50684. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50685. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  50686. } else {
  50687. queue.push({
  50688. currentNode: obj,
  50689. posInKids: 0
  50690. });
  50691. }
  50692. queueItem.posInKids++;
  50693. }
  50694. return map;
  50695. }
  50696. getPageIndex(pageRef) {
  50697. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  50698. if (cachedPageIndex !== undefined) {
  50699. return Promise.resolve(cachedPageIndex);
  50700. }
  50701. const xref = this.xref;
  50702. function pagesBeforeRef(kidRef) {
  50703. let total = 0,
  50704. parentRef;
  50705. return xref.fetchAsync(kidRef).then(function (node) {
  50706. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  50707. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  50708. }
  50709. if (!node) {
  50710. return null;
  50711. }
  50712. if (!(node instanceof _primitives.Dict)) {
  50713. throw new _util.FormatError("Node must be a dictionary.");
  50714. }
  50715. parentRef = node.getRaw("Parent");
  50716. return node.getAsync("Parent");
  50717. }).then(function (parent) {
  50718. if (!parent) {
  50719. return null;
  50720. }
  50721. if (!(parent instanceof _primitives.Dict)) {
  50722. throw new _util.FormatError("Parent must be a dictionary.");
  50723. }
  50724. return parent.getAsync("Kids");
  50725. }).then(function (kids) {
  50726. if (!kids) {
  50727. return null;
  50728. }
  50729. const kidPromises = [];
  50730. let found = false;
  50731. for (const kid of kids) {
  50732. if (!(kid instanceof _primitives.Ref)) {
  50733. throw new _util.FormatError("Kid must be a reference.");
  50734. }
  50735. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  50736. found = true;
  50737. break;
  50738. }
  50739. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  50740. if (!(obj instanceof _primitives.Dict)) {
  50741. throw new _util.FormatError("Kid node must be a dictionary.");
  50742. }
  50743. if (obj.has("Count")) {
  50744. total += obj.get("Count");
  50745. } else {
  50746. total++;
  50747. }
  50748. }));
  50749. }
  50750. if (!found) {
  50751. throw new _util.FormatError("Kid reference not found in parent's kids.");
  50752. }
  50753. return Promise.all(kidPromises).then(function () {
  50754. return [total, parentRef];
  50755. });
  50756. });
  50757. }
  50758. let total = 0;
  50759. const next = ref => pagesBeforeRef(ref).then(args => {
  50760. if (!args) {
  50761. this.pageIndexCache.put(pageRef, total);
  50762. return total;
  50763. }
  50764. const [count, parentRef] = args;
  50765. total += count;
  50766. return next(parentRef);
  50767. });
  50768. return next(pageRef);
  50769. }
  50770. get baseUrl() {
  50771. const uri = this._catDict.get("URI");
  50772. if (uri instanceof _primitives.Dict) {
  50773. const base = uri.get("Base");
  50774. if (typeof base === "string") {
  50775. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  50776. tryConvertEncoding: true
  50777. });
  50778. if (absoluteUrl) {
  50779. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  50780. }
  50781. }
  50782. }
  50783. return (0, _util.shadow)(this, "baseUrl", null);
  50784. }
  50785. static parseDestDictionary(params) {
  50786. const destDict = params.destDict;
  50787. if (!(destDict instanceof _primitives.Dict)) {
  50788. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  50789. return;
  50790. }
  50791. const resultObj = params.resultObj;
  50792. if (typeof resultObj !== "object") {
  50793. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  50794. return;
  50795. }
  50796. const docBaseUrl = params.docBaseUrl || null;
  50797. const docAttachments = params.docAttachments || null;
  50798. let action = destDict.get("A"),
  50799. url,
  50800. dest;
  50801. if (!(action instanceof _primitives.Dict)) {
  50802. if (destDict.has("Dest")) {
  50803. action = destDict.get("Dest");
  50804. } else {
  50805. action = destDict.get("AA");
  50806. if (action instanceof _primitives.Dict) {
  50807. if (action.has("D")) {
  50808. action = action.get("D");
  50809. } else if (action.has("U")) {
  50810. action = action.get("U");
  50811. }
  50812. }
  50813. }
  50814. }
  50815. if (action instanceof _primitives.Dict) {
  50816. const actionType = action.get("S");
  50817. if (!(actionType instanceof _primitives.Name)) {
  50818. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  50819. return;
  50820. }
  50821. const actionName = actionType.name;
  50822. switch (actionName) {
  50823. case "ResetForm":
  50824. const flags = action.get("Flags");
  50825. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  50826. const fields = [];
  50827. const refs = [];
  50828. for (const obj of action.get("Fields") || []) {
  50829. if (obj instanceof _primitives.Ref) {
  50830. refs.push(obj.toString());
  50831. } else if (typeof obj === "string") {
  50832. fields.push((0, _util.stringToPDFString)(obj));
  50833. }
  50834. }
  50835. resultObj.resetForm = {
  50836. fields,
  50837. refs,
  50838. include
  50839. };
  50840. break;
  50841. case "URI":
  50842. url = action.get("URI");
  50843. if (url instanceof _primitives.Name) {
  50844. url = "/" + url.name;
  50845. }
  50846. break;
  50847. case "GoTo":
  50848. dest = action.get("D");
  50849. break;
  50850. case "Launch":
  50851. case "GoToR":
  50852. const urlDict = action.get("F");
  50853. if (urlDict instanceof _primitives.Dict) {
  50854. url = urlDict.get("F") || null;
  50855. } else if (typeof urlDict === "string") {
  50856. url = urlDict;
  50857. }
  50858. let remoteDest = action.get("D");
  50859. if (remoteDest) {
  50860. if (remoteDest instanceof _primitives.Name) {
  50861. remoteDest = remoteDest.name;
  50862. }
  50863. if (typeof url === "string") {
  50864. const baseUrl = url.split("#")[0];
  50865. if (typeof remoteDest === "string") {
  50866. url = baseUrl + "#" + remoteDest;
  50867. } else if (Array.isArray(remoteDest)) {
  50868. url = baseUrl + "#" + JSON.stringify(remoteDest);
  50869. }
  50870. }
  50871. }
  50872. const newWindow = action.get("NewWindow");
  50873. if (typeof newWindow === "boolean") {
  50874. resultObj.newWindow = newWindow;
  50875. }
  50876. break;
  50877. case "GoToE":
  50878. const target = action.get("T");
  50879. let attachment;
  50880. if (docAttachments && target instanceof _primitives.Dict) {
  50881. const relationship = target.get("R");
  50882. const name = target.get("N");
  50883. if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
  50884. attachment = docAttachments[(0, _util.stringToPDFString)(name)];
  50885. }
  50886. }
  50887. if (attachment) {
  50888. resultObj.attachment = attachment;
  50889. } else {
  50890. (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
  50891. }
  50892. break;
  50893. case "Named":
  50894. const namedAction = action.get("N");
  50895. if (namedAction instanceof _primitives.Name) {
  50896. resultObj.action = namedAction.name;
  50897. }
  50898. break;
  50899. case "SetOCGState":
  50900. const state = action.get("State");
  50901. const preserveRB = action.get("PreserveRB");
  50902. if (!Array.isArray(state) || state.length === 0) {
  50903. break;
  50904. }
  50905. const stateArr = [];
  50906. for (const elem of state) {
  50907. if (elem instanceof _primitives.Name) {
  50908. switch (elem.name) {
  50909. case "ON":
  50910. case "OFF":
  50911. case "Toggle":
  50912. stateArr.push(elem.name);
  50913. break;
  50914. }
  50915. } else if (elem instanceof _primitives.Ref) {
  50916. stateArr.push(elem.toString());
  50917. }
  50918. }
  50919. if (stateArr.length !== state.length) {
  50920. break;
  50921. }
  50922. resultObj.setOCGState = {
  50923. state: stateArr,
  50924. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  50925. };
  50926. break;
  50927. case "JavaScript":
  50928. const jsAction = action.get("JS");
  50929. let js;
  50930. if (jsAction instanceof _base_stream.BaseStream) {
  50931. js = jsAction.getString();
  50932. } else if (typeof jsAction === "string") {
  50933. js = jsAction;
  50934. }
  50935. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  50936. if (jsURL) {
  50937. url = jsURL.url;
  50938. resultObj.newWindow = jsURL.newWindow;
  50939. break;
  50940. }
  50941. default:
  50942. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  50943. break;
  50944. }
  50945. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  50946. break;
  50947. }
  50948. } else if (destDict.has("Dest")) {
  50949. dest = destDict.get("Dest");
  50950. }
  50951. if (typeof url === "string") {
  50952. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  50953. addDefaultProtocol: true,
  50954. tryConvertEncoding: true
  50955. });
  50956. if (absoluteUrl) {
  50957. resultObj.url = absoluteUrl.href;
  50958. }
  50959. resultObj.unsafeUrl = url;
  50960. }
  50961. if (dest) {
  50962. if (dest instanceof _primitives.Name) {
  50963. dest = dest.name;
  50964. }
  50965. if (typeof dest === "string") {
  50966. resultObj.dest = (0, _util.stringToPDFString)(dest);
  50967. } else if (Array.isArray(dest)) {
  50968. resultObj.dest = dest;
  50969. }
  50970. }
  50971. }
  50972. }
  50973. exports.Catalog = Catalog;
  50974. /***/ }),
  50975. /* 68 */
  50976. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50977. Object.defineProperty(exports, "__esModule", ({
  50978. value: true
  50979. }));
  50980. exports.NumberTree = exports.NameTree = void 0;
  50981. var _primitives = __w_pdfjs_require__(3);
  50982. var _util = __w_pdfjs_require__(2);
  50983. class NameOrNumberTree {
  50984. constructor(root, xref, type) {
  50985. if (this.constructor === NameOrNumberTree) {
  50986. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  50987. }
  50988. this.root = root;
  50989. this.xref = xref;
  50990. this._type = type;
  50991. }
  50992. getAll() {
  50993. const map = new Map();
  50994. if (!this.root) {
  50995. return map;
  50996. }
  50997. const xref = this.xref;
  50998. const processed = new _primitives.RefSet();
  50999. processed.put(this.root);
  51000. const queue = [this.root];
  51001. while (queue.length > 0) {
  51002. const obj = xref.fetchIfRef(queue.shift());
  51003. if (!(obj instanceof _primitives.Dict)) {
  51004. continue;
  51005. }
  51006. if (obj.has("Kids")) {
  51007. const kids = obj.get("Kids");
  51008. if (!Array.isArray(kids)) {
  51009. continue;
  51010. }
  51011. for (const kid of kids) {
  51012. if (processed.has(kid)) {
  51013. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  51014. }
  51015. queue.push(kid);
  51016. processed.put(kid);
  51017. }
  51018. continue;
  51019. }
  51020. const entries = obj.get(this._type);
  51021. if (!Array.isArray(entries)) {
  51022. continue;
  51023. }
  51024. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  51025. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  51026. }
  51027. }
  51028. return map;
  51029. }
  51030. get(key) {
  51031. if (!this.root) {
  51032. return null;
  51033. }
  51034. const xref = this.xref;
  51035. let kidsOrEntries = xref.fetchIfRef(this.root);
  51036. let loopCount = 0;
  51037. const MAX_LEVELS = 10;
  51038. while (kidsOrEntries.has("Kids")) {
  51039. if (++loopCount > MAX_LEVELS) {
  51040. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  51041. return null;
  51042. }
  51043. const kids = kidsOrEntries.get("Kids");
  51044. if (!Array.isArray(kids)) {
  51045. return null;
  51046. }
  51047. let l = 0,
  51048. r = kids.length - 1;
  51049. while (l <= r) {
  51050. const m = l + r >> 1;
  51051. const kid = xref.fetchIfRef(kids[m]);
  51052. const limits = kid.get("Limits");
  51053. if (key < xref.fetchIfRef(limits[0])) {
  51054. r = m - 1;
  51055. } else if (key > xref.fetchIfRef(limits[1])) {
  51056. l = m + 1;
  51057. } else {
  51058. kidsOrEntries = kid;
  51059. break;
  51060. }
  51061. }
  51062. if (l > r) {
  51063. return null;
  51064. }
  51065. }
  51066. const entries = kidsOrEntries.get(this._type);
  51067. if (Array.isArray(entries)) {
  51068. let l = 0,
  51069. r = entries.length - 2;
  51070. while (l <= r) {
  51071. const tmp = l + r >> 1,
  51072. m = tmp + (tmp & 1);
  51073. const currentKey = xref.fetchIfRef(entries[m]);
  51074. if (key < currentKey) {
  51075. r = m - 2;
  51076. } else if (key > currentKey) {
  51077. l = m + 2;
  51078. } else {
  51079. return xref.fetchIfRef(entries[m + 1]);
  51080. }
  51081. }
  51082. }
  51083. return null;
  51084. }
  51085. }
  51086. class NameTree extends NameOrNumberTree {
  51087. constructor(root, xref) {
  51088. super(root, xref, "Names");
  51089. }
  51090. }
  51091. exports.NameTree = NameTree;
  51092. class NumberTree extends NameOrNumberTree {
  51093. constructor(root, xref) {
  51094. super(root, xref, "Nums");
  51095. }
  51096. }
  51097. exports.NumberTree = NumberTree;
  51098. /***/ }),
  51099. /* 69 */
  51100. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51101. Object.defineProperty(exports, "__esModule", ({
  51102. value: true
  51103. }));
  51104. exports.clearGlobalCaches = clearGlobalCaches;
  51105. var _primitives = __w_pdfjs_require__(3);
  51106. var _unicode = __w_pdfjs_require__(38);
  51107. function clearGlobalCaches() {
  51108. (0, _primitives.clearPrimitiveCaches)();
  51109. (0, _unicode.clearUnicodeCaches)();
  51110. }
  51111. /***/ }),
  51112. /* 70 */
  51113. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51114. Object.defineProperty(exports, "__esModule", ({
  51115. value: true
  51116. }));
  51117. exports.FileSpec = void 0;
  51118. var _util = __w_pdfjs_require__(2);
  51119. var _base_stream = __w_pdfjs_require__(5);
  51120. var _primitives = __w_pdfjs_require__(3);
  51121. function pickPlatformItem(dict) {
  51122. if (dict.has("UF")) {
  51123. return dict.get("UF");
  51124. } else if (dict.has("F")) {
  51125. return dict.get("F");
  51126. } else if (dict.has("Unix")) {
  51127. return dict.get("Unix");
  51128. } else if (dict.has("Mac")) {
  51129. return dict.get("Mac");
  51130. } else if (dict.has("DOS")) {
  51131. return dict.get("DOS");
  51132. }
  51133. return null;
  51134. }
  51135. class FileSpec {
  51136. constructor(root, xref) {
  51137. if (!(root instanceof _primitives.Dict)) {
  51138. return;
  51139. }
  51140. this.xref = xref;
  51141. this.root = root;
  51142. if (root.has("FS")) {
  51143. this.fs = root.get("FS");
  51144. }
  51145. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  51146. if (root.has("RF")) {
  51147. (0, _util.warn)("Related file specifications are not supported");
  51148. }
  51149. this.contentAvailable = true;
  51150. if (!root.has("EF")) {
  51151. this.contentAvailable = false;
  51152. (0, _util.warn)("Non-embedded file specifications are not supported");
  51153. }
  51154. }
  51155. get filename() {
  51156. if (!this._filename && this.root) {
  51157. const filename = pickPlatformItem(this.root) || "unnamed";
  51158. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  51159. }
  51160. return this._filename;
  51161. }
  51162. get content() {
  51163. if (!this.contentAvailable) {
  51164. return null;
  51165. }
  51166. if (!this.contentRef && this.root) {
  51167. this.contentRef = pickPlatformItem(this.root.get("EF"));
  51168. }
  51169. let content = null;
  51170. if (this.contentRef) {
  51171. const fileObj = this.xref.fetchIfRef(this.contentRef);
  51172. if (fileObj instanceof _base_stream.BaseStream) {
  51173. content = fileObj.getBytes();
  51174. } else {
  51175. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  51176. }
  51177. } else {
  51178. (0, _util.warn)("Embedded file specification does not have a content");
  51179. }
  51180. return content;
  51181. }
  51182. get serializable() {
  51183. return {
  51184. filename: this.filename,
  51185. content: this.content
  51186. };
  51187. }
  51188. }
  51189. exports.FileSpec = FileSpec;
  51190. /***/ }),
  51191. /* 71 */
  51192. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51193. Object.defineProperty(exports, "__esModule", ({
  51194. value: true
  51195. }));
  51196. exports.MetadataParser = void 0;
  51197. var _xml_parser = __w_pdfjs_require__(64);
  51198. class MetadataParser {
  51199. constructor(data) {
  51200. data = this._repair(data);
  51201. const parser = new _xml_parser.SimpleXMLParser({
  51202. lowerCaseName: true
  51203. });
  51204. const xmlDocument = parser.parseFromString(data);
  51205. this._metadataMap = new Map();
  51206. this._data = data;
  51207. if (xmlDocument) {
  51208. this._parse(xmlDocument);
  51209. }
  51210. }
  51211. _repair(data) {
  51212. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  51213. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  51214. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  51215. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  51216. switch (name) {
  51217. case "amp":
  51218. return "&";
  51219. case "apos":
  51220. return "'";
  51221. case "gt":
  51222. return ">";
  51223. case "lt":
  51224. return "<";
  51225. case "quot":
  51226. return '"';
  51227. }
  51228. throw new Error(`_repair: ${name} isn't defined.`);
  51229. });
  51230. const charBuf = [];
  51231. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  51232. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  51233. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  51234. charBuf.push(String.fromCharCode(code));
  51235. } else {
  51236. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  51237. }
  51238. }
  51239. return ">" + charBuf.join("");
  51240. });
  51241. }
  51242. _getSequence(entry) {
  51243. const name = entry.nodeName;
  51244. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  51245. return null;
  51246. }
  51247. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  51248. }
  51249. _parseArray(entry) {
  51250. if (!entry.hasChildNodes()) {
  51251. return;
  51252. }
  51253. const [seqNode] = entry.childNodes;
  51254. const sequence = this._getSequence(seqNode) || [];
  51255. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  51256. }
  51257. _parse(xmlDocument) {
  51258. let rdf = xmlDocument.documentElement;
  51259. if (rdf.nodeName !== "rdf:rdf") {
  51260. rdf = rdf.firstChild;
  51261. while (rdf && rdf.nodeName !== "rdf:rdf") {
  51262. rdf = rdf.nextSibling;
  51263. }
  51264. }
  51265. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  51266. return;
  51267. }
  51268. for (const desc of rdf.childNodes) {
  51269. if (desc.nodeName !== "rdf:description") {
  51270. continue;
  51271. }
  51272. for (const entry of desc.childNodes) {
  51273. const name = entry.nodeName;
  51274. switch (name) {
  51275. case "#text":
  51276. continue;
  51277. case "dc:creator":
  51278. case "dc:subject":
  51279. this._parseArray(entry);
  51280. continue;
  51281. }
  51282. this._metadataMap.set(name, entry.textContent.trim());
  51283. }
  51284. }
  51285. }
  51286. get serializable() {
  51287. return {
  51288. parsedData: this._metadataMap,
  51289. rawData: this._data
  51290. };
  51291. }
  51292. }
  51293. exports.MetadataParser = MetadataParser;
  51294. /***/ }),
  51295. /* 72 */
  51296. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51297. Object.defineProperty(exports, "__esModule", ({
  51298. value: true
  51299. }));
  51300. exports.StructTreeRoot = exports.StructTreePage = void 0;
  51301. var _primitives = __w_pdfjs_require__(3);
  51302. var _util = __w_pdfjs_require__(2);
  51303. var _name_number_tree = __w_pdfjs_require__(68);
  51304. const MAX_DEPTH = 40;
  51305. const StructElementType = {
  51306. PAGE_CONTENT: "PAGE_CONTENT",
  51307. STREAM_CONTENT: "STREAM_CONTENT",
  51308. OBJECT: "OBJECT",
  51309. ELEMENT: "ELEMENT"
  51310. };
  51311. class StructTreeRoot {
  51312. constructor(rootDict) {
  51313. this.dict = rootDict;
  51314. this.roleMap = new Map();
  51315. }
  51316. init() {
  51317. this.readRoleMap();
  51318. }
  51319. readRoleMap() {
  51320. const roleMapDict = this.dict.get("RoleMap");
  51321. if (!(roleMapDict instanceof _primitives.Dict)) {
  51322. return;
  51323. }
  51324. roleMapDict.forEach((key, value) => {
  51325. if (!(value instanceof _primitives.Name)) {
  51326. return;
  51327. }
  51328. this.roleMap.set(key, value.name);
  51329. });
  51330. }
  51331. }
  51332. exports.StructTreeRoot = StructTreeRoot;
  51333. class StructElementNode {
  51334. constructor(tree, dict) {
  51335. this.tree = tree;
  51336. this.dict = dict;
  51337. this.kids = [];
  51338. this.parseKids();
  51339. }
  51340. get role() {
  51341. const nameObj = this.dict.get("S");
  51342. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  51343. const {
  51344. root
  51345. } = this.tree;
  51346. if (root.roleMap.has(name)) {
  51347. return root.roleMap.get(name);
  51348. }
  51349. return name;
  51350. }
  51351. parseKids() {
  51352. let pageObjId = null;
  51353. const objRef = this.dict.getRaw("Pg");
  51354. if (objRef instanceof _primitives.Ref) {
  51355. pageObjId = objRef.toString();
  51356. }
  51357. const kids = this.dict.get("K");
  51358. if (Array.isArray(kids)) {
  51359. for (const kid of kids) {
  51360. const element = this.parseKid(pageObjId, kid);
  51361. if (element) {
  51362. this.kids.push(element);
  51363. }
  51364. }
  51365. } else {
  51366. const element = this.parseKid(pageObjId, kids);
  51367. if (element) {
  51368. this.kids.push(element);
  51369. }
  51370. }
  51371. }
  51372. parseKid(pageObjId, kid) {
  51373. if (Number.isInteger(kid)) {
  51374. if (this.tree.pageDict.objId !== pageObjId) {
  51375. return null;
  51376. }
  51377. return new StructElement({
  51378. type: StructElementType.PAGE_CONTENT,
  51379. mcid: kid,
  51380. pageObjId
  51381. });
  51382. }
  51383. let kidDict = null;
  51384. if (kid instanceof _primitives.Ref) {
  51385. kidDict = this.dict.xref.fetch(kid);
  51386. } else if (kid instanceof _primitives.Dict) {
  51387. kidDict = kid;
  51388. }
  51389. if (!kidDict) {
  51390. return null;
  51391. }
  51392. const pageRef = kidDict.getRaw("Pg");
  51393. if (pageRef instanceof _primitives.Ref) {
  51394. pageObjId = pageRef.toString();
  51395. }
  51396. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  51397. if (type === "MCR") {
  51398. if (this.tree.pageDict.objId !== pageObjId) {
  51399. return null;
  51400. }
  51401. return new StructElement({
  51402. type: StructElementType.STREAM_CONTENT,
  51403. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  51404. pageObjId,
  51405. mcid: kidDict.get("MCID")
  51406. });
  51407. }
  51408. if (type === "OBJR") {
  51409. if (this.tree.pageDict.objId !== pageObjId) {
  51410. return null;
  51411. }
  51412. return new StructElement({
  51413. type: StructElementType.OBJECT,
  51414. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  51415. pageObjId
  51416. });
  51417. }
  51418. return new StructElement({
  51419. type: StructElementType.ELEMENT,
  51420. dict: kidDict
  51421. });
  51422. }
  51423. }
  51424. class StructElement {
  51425. constructor({
  51426. type,
  51427. dict = null,
  51428. mcid = null,
  51429. pageObjId = null,
  51430. refObjId = null
  51431. }) {
  51432. this.type = type;
  51433. this.dict = dict;
  51434. this.mcid = mcid;
  51435. this.pageObjId = pageObjId;
  51436. this.refObjId = refObjId;
  51437. this.parentNode = null;
  51438. }
  51439. }
  51440. class StructTreePage {
  51441. constructor(structTreeRoot, pageDict) {
  51442. this.root = structTreeRoot;
  51443. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  51444. this.pageDict = pageDict;
  51445. this.nodes = [];
  51446. }
  51447. parse() {
  51448. if (!this.root || !this.rootDict) {
  51449. return;
  51450. }
  51451. const parentTree = this.rootDict.get("ParentTree");
  51452. if (!parentTree) {
  51453. return;
  51454. }
  51455. const id = this.pageDict.get("StructParents");
  51456. if (!Number.isInteger(id)) {
  51457. return;
  51458. }
  51459. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  51460. const parentArray = numberTree.get(id);
  51461. if (!Array.isArray(parentArray)) {
  51462. return;
  51463. }
  51464. const map = new Map();
  51465. for (const ref of parentArray) {
  51466. if (ref instanceof _primitives.Ref) {
  51467. this.addNode(this.rootDict.xref.fetch(ref), map);
  51468. }
  51469. }
  51470. }
  51471. addNode(dict, map, level = 0) {
  51472. if (level > MAX_DEPTH) {
  51473. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  51474. return null;
  51475. }
  51476. if (map.has(dict)) {
  51477. return map.get(dict);
  51478. }
  51479. const element = new StructElementNode(this, dict);
  51480. map.set(dict, element);
  51481. const parent = dict.get("P");
  51482. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  51483. if (!this.addTopLevelNode(dict, element)) {
  51484. map.delete(dict);
  51485. }
  51486. return element;
  51487. }
  51488. const parentNode = this.addNode(parent, map, level + 1);
  51489. if (!parentNode) {
  51490. return element;
  51491. }
  51492. let save = false;
  51493. for (const kid of parentNode.kids) {
  51494. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  51495. kid.parentNode = element;
  51496. save = true;
  51497. }
  51498. }
  51499. if (!save) {
  51500. map.delete(dict);
  51501. }
  51502. return element;
  51503. }
  51504. addTopLevelNode(dict, element) {
  51505. const obj = this.rootDict.get("K");
  51506. if (!obj) {
  51507. return false;
  51508. }
  51509. if (obj instanceof _primitives.Dict) {
  51510. if (obj.objId !== dict.objId) {
  51511. return false;
  51512. }
  51513. this.nodes[0] = element;
  51514. return true;
  51515. }
  51516. if (!Array.isArray(obj)) {
  51517. return true;
  51518. }
  51519. let save = false;
  51520. for (let i = 0; i < obj.length; i++) {
  51521. const kidRef = obj[i];
  51522. if (kidRef && kidRef.toString() === dict.objId) {
  51523. this.nodes[i] = element;
  51524. save = true;
  51525. }
  51526. }
  51527. return save;
  51528. }
  51529. get serializable() {
  51530. function nodeToSerializable(node, parent, level = 0) {
  51531. if (level > MAX_DEPTH) {
  51532. (0, _util.warn)("StructTree too deep to be fully serialized.");
  51533. return;
  51534. }
  51535. const obj = Object.create(null);
  51536. obj.role = node.role;
  51537. obj.children = [];
  51538. parent.children.push(obj);
  51539. const alt = node.dict.get("Alt");
  51540. if (typeof alt === "string") {
  51541. obj.alt = (0, _util.stringToPDFString)(alt);
  51542. }
  51543. const lang = node.dict.get("Lang");
  51544. if (typeof lang === "string") {
  51545. obj.lang = (0, _util.stringToPDFString)(lang);
  51546. }
  51547. for (const kid of node.kids) {
  51548. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  51549. if (kidElement) {
  51550. nodeToSerializable(kidElement, obj, level + 1);
  51551. continue;
  51552. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  51553. obj.children.push({
  51554. type: "content",
  51555. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  51556. });
  51557. } else if (kid.type === StructElementType.OBJECT) {
  51558. obj.children.push({
  51559. type: "object",
  51560. id: kid.refObjId
  51561. });
  51562. }
  51563. }
  51564. }
  51565. const root = Object.create(null);
  51566. root.children = [];
  51567. root.role = "Root";
  51568. for (const child of this.nodes) {
  51569. if (!child) {
  51570. continue;
  51571. }
  51572. nodeToSerializable(child, root);
  51573. }
  51574. return root;
  51575. }
  51576. }
  51577. exports.StructTreePage = StructTreePage;
  51578. /***/ }),
  51579. /* 73 */
  51580. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51581. Object.defineProperty(exports, "__esModule", ({
  51582. value: true
  51583. }));
  51584. exports.ObjectLoader = void 0;
  51585. var _primitives = __w_pdfjs_require__(3);
  51586. var _base_stream = __w_pdfjs_require__(5);
  51587. var _core_utils = __w_pdfjs_require__(4);
  51588. var _util = __w_pdfjs_require__(2);
  51589. function mayHaveChildren(value) {
  51590. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  51591. }
  51592. function addChildren(node, nodesToVisit) {
  51593. if (node instanceof _primitives.Dict) {
  51594. node = node.getRawValues();
  51595. } else if (node instanceof _base_stream.BaseStream) {
  51596. node = node.dict.getRawValues();
  51597. } else if (!Array.isArray(node)) {
  51598. return;
  51599. }
  51600. for (const rawValue of node) {
  51601. if (mayHaveChildren(rawValue)) {
  51602. nodesToVisit.push(rawValue);
  51603. }
  51604. }
  51605. }
  51606. class ObjectLoader {
  51607. constructor(dict, keys, xref) {
  51608. this.dict = dict;
  51609. this.keys = keys;
  51610. this.xref = xref;
  51611. this.refSet = null;
  51612. }
  51613. async load() {
  51614. if (this.xref.stream.isDataLoaded) {
  51615. return undefined;
  51616. }
  51617. const {
  51618. keys,
  51619. dict
  51620. } = this;
  51621. this.refSet = new _primitives.RefSet();
  51622. const nodesToVisit = [];
  51623. for (const key of keys) {
  51624. const rawValue = dict.getRaw(key);
  51625. if (rawValue !== undefined) {
  51626. nodesToVisit.push(rawValue);
  51627. }
  51628. }
  51629. return this._walk(nodesToVisit);
  51630. }
  51631. async _walk(nodesToVisit) {
  51632. const nodesToRevisit = [];
  51633. const pendingRequests = [];
  51634. while (nodesToVisit.length) {
  51635. let currentNode = nodesToVisit.pop();
  51636. if (currentNode instanceof _primitives.Ref) {
  51637. if (this.refSet.has(currentNode)) {
  51638. continue;
  51639. }
  51640. try {
  51641. this.refSet.put(currentNode);
  51642. currentNode = this.xref.fetch(currentNode);
  51643. } catch (ex) {
  51644. if (!(ex instanceof _core_utils.MissingDataException)) {
  51645. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  51646. this.refSet = null;
  51647. const {
  51648. manager
  51649. } = this.xref.stream;
  51650. return manager.requestAllChunks();
  51651. }
  51652. nodesToRevisit.push(currentNode);
  51653. pendingRequests.push({
  51654. begin: ex.begin,
  51655. end: ex.end
  51656. });
  51657. }
  51658. }
  51659. if (currentNode instanceof _base_stream.BaseStream) {
  51660. const baseStreams = currentNode.getBaseStreams();
  51661. if (baseStreams) {
  51662. let foundMissingData = false;
  51663. for (const stream of baseStreams) {
  51664. if (stream.isDataLoaded) {
  51665. continue;
  51666. }
  51667. foundMissingData = true;
  51668. pendingRequests.push({
  51669. begin: stream.start,
  51670. end: stream.end
  51671. });
  51672. }
  51673. if (foundMissingData) {
  51674. nodesToRevisit.push(currentNode);
  51675. }
  51676. }
  51677. }
  51678. addChildren(currentNode, nodesToVisit);
  51679. }
  51680. if (pendingRequests.length) {
  51681. await this.xref.stream.manager.requestRanges(pendingRequests);
  51682. for (const node of nodesToRevisit) {
  51683. if (node instanceof _primitives.Ref) {
  51684. this.refSet.remove(node);
  51685. }
  51686. }
  51687. return this._walk(nodesToRevisit);
  51688. }
  51689. this.refSet = null;
  51690. return undefined;
  51691. }
  51692. }
  51693. exports.ObjectLoader = ObjectLoader;
  51694. /***/ }),
  51695. /* 74 */
  51696. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51697. Object.defineProperty(exports, "__esModule", ({
  51698. value: true
  51699. }));
  51700. exports.XFAFactory = void 0;
  51701. var _xfa_object = __w_pdfjs_require__(75);
  51702. var _bind = __w_pdfjs_require__(79);
  51703. var _data = __w_pdfjs_require__(85);
  51704. var _fonts = __w_pdfjs_require__(83);
  51705. var _utils = __w_pdfjs_require__(76);
  51706. var _util = __w_pdfjs_require__(2);
  51707. var _parser = __w_pdfjs_require__(86);
  51708. var _xhtml = __w_pdfjs_require__(96);
  51709. class XFAFactory {
  51710. constructor(data) {
  51711. try {
  51712. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  51713. const binder = new _bind.Binder(this.root);
  51714. this.form = binder.bind();
  51715. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  51716. this.form[_xfa_object.$globalData].template = this.form;
  51717. } catch (e) {
  51718. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  51719. }
  51720. }
  51721. isValid() {
  51722. return this.root && this.form;
  51723. }
  51724. _createPagesHelper() {
  51725. const iterator = this.form[_xfa_object.$toPages]();
  51726. return new Promise((resolve, reject) => {
  51727. const nextIteration = () => {
  51728. try {
  51729. const value = iterator.next();
  51730. if (value.done) {
  51731. resolve(value.value);
  51732. } else {
  51733. setTimeout(nextIteration, 0);
  51734. }
  51735. } catch (e) {
  51736. reject(e);
  51737. }
  51738. };
  51739. setTimeout(nextIteration, 0);
  51740. });
  51741. }
  51742. async _createPages() {
  51743. try {
  51744. this.pages = await this._createPagesHelper();
  51745. this.dims = this.pages.children.map(c => {
  51746. const {
  51747. width,
  51748. height
  51749. } = c.attributes.style;
  51750. return [0, 0, parseInt(width), parseInt(height)];
  51751. });
  51752. } catch (e) {
  51753. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  51754. }
  51755. }
  51756. getBoundingBox(pageIndex) {
  51757. return this.dims[pageIndex];
  51758. }
  51759. async getNumPages() {
  51760. if (!this.pages) {
  51761. await this._createPages();
  51762. }
  51763. return this.dims.length;
  51764. }
  51765. setImages(images) {
  51766. this.form[_xfa_object.$globalData].images = images;
  51767. }
  51768. setFonts(fonts) {
  51769. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  51770. const missingFonts = [];
  51771. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  51772. typeface = (0, _utils.stripQuotes)(typeface);
  51773. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  51774. if (!font) {
  51775. missingFonts.push(typeface);
  51776. }
  51777. }
  51778. if (missingFonts.length > 0) {
  51779. return missingFonts;
  51780. }
  51781. return null;
  51782. }
  51783. appendFonts(fonts, reallyMissingFonts) {
  51784. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  51785. }
  51786. async getPages() {
  51787. if (!this.pages) {
  51788. await this._createPages();
  51789. }
  51790. const pages = this.pages;
  51791. this.pages = null;
  51792. return pages;
  51793. }
  51794. serializeData(storage) {
  51795. return this.dataHandler.serialize(storage);
  51796. }
  51797. static _createDocument(data) {
  51798. if (!data["/xdp:xdp"]) {
  51799. return data["xdp:xdp"];
  51800. }
  51801. return Object.values(data).join("");
  51802. }
  51803. static getRichTextAsHtml(rc) {
  51804. if (!rc || typeof rc !== "string") {
  51805. return null;
  51806. }
  51807. try {
  51808. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  51809. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  51810. const newRoot = _xhtml.XhtmlNamespace.body({});
  51811. newRoot[_xfa_object.$appendChild](root);
  51812. root = newRoot;
  51813. }
  51814. const result = root[_xfa_object.$toHTML]();
  51815. if (!result.success) {
  51816. return null;
  51817. }
  51818. const {
  51819. html
  51820. } = result;
  51821. const {
  51822. attributes
  51823. } = html;
  51824. if (attributes) {
  51825. if (attributes.class) {
  51826. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  51827. }
  51828. attributes.dir = "auto";
  51829. }
  51830. return {
  51831. html,
  51832. str: root[_xfa_object.$text]()
  51833. };
  51834. } catch (e) {
  51835. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  51836. }
  51837. return null;
  51838. }
  51839. }
  51840. exports.XFAFactory = XFAFactory;
  51841. /***/ }),
  51842. /* 75 */
  51843. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51844. Object.defineProperty(exports, "__esModule", ({
  51845. value: true
  51846. }));
  51847. 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;
  51848. var _utils = __w_pdfjs_require__(76);
  51849. var _util = __w_pdfjs_require__(2);
  51850. var _core_utils = __w_pdfjs_require__(4);
  51851. var _namespaces = __w_pdfjs_require__(77);
  51852. var _som = __w_pdfjs_require__(78);
  51853. const $acceptWhitespace = Symbol();
  51854. exports.$acceptWhitespace = $acceptWhitespace;
  51855. const $addHTML = Symbol();
  51856. exports.$addHTML = $addHTML;
  51857. const $appendChild = Symbol();
  51858. exports.$appendChild = $appendChild;
  51859. const $childrenToHTML = Symbol();
  51860. exports.$childrenToHTML = $childrenToHTML;
  51861. const $clean = Symbol();
  51862. exports.$clean = $clean;
  51863. const $cleanPage = Symbol();
  51864. exports.$cleanPage = $cleanPage;
  51865. const $cleanup = Symbol();
  51866. exports.$cleanup = $cleanup;
  51867. const $clone = Symbol();
  51868. exports.$clone = $clone;
  51869. const $consumed = Symbol();
  51870. exports.$consumed = $consumed;
  51871. const $content = Symbol("content");
  51872. exports.$content = $content;
  51873. const $data = Symbol("data");
  51874. exports.$data = $data;
  51875. const $dump = Symbol();
  51876. exports.$dump = $dump;
  51877. const $extra = Symbol("extra");
  51878. exports.$extra = $extra;
  51879. const $finalize = Symbol();
  51880. exports.$finalize = $finalize;
  51881. const $flushHTML = Symbol();
  51882. exports.$flushHTML = $flushHTML;
  51883. const $getAttributeIt = Symbol();
  51884. exports.$getAttributeIt = $getAttributeIt;
  51885. const $getAttributes = Symbol();
  51886. exports.$getAttributes = $getAttributes;
  51887. const $getAvailableSpace = Symbol();
  51888. exports.$getAvailableSpace = $getAvailableSpace;
  51889. const $getChildrenByClass = Symbol();
  51890. exports.$getChildrenByClass = $getChildrenByClass;
  51891. const $getChildrenByName = Symbol();
  51892. exports.$getChildrenByName = $getChildrenByName;
  51893. const $getChildrenByNameIt = Symbol();
  51894. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  51895. const $getDataValue = Symbol();
  51896. exports.$getDataValue = $getDataValue;
  51897. const $getExtra = Symbol();
  51898. exports.$getExtra = $getExtra;
  51899. const $getRealChildrenByNameIt = Symbol();
  51900. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  51901. const $getChildren = Symbol();
  51902. exports.$getChildren = $getChildren;
  51903. const $getContainedChildren = Symbol();
  51904. exports.$getContainedChildren = $getContainedChildren;
  51905. const $getNextPage = Symbol();
  51906. exports.$getNextPage = $getNextPage;
  51907. const $getSubformParent = Symbol();
  51908. exports.$getSubformParent = $getSubformParent;
  51909. const $getParent = Symbol();
  51910. exports.$getParent = $getParent;
  51911. const $getTemplateRoot = Symbol();
  51912. exports.$getTemplateRoot = $getTemplateRoot;
  51913. const $globalData = Symbol();
  51914. exports.$globalData = $globalData;
  51915. const $hasSettableValue = Symbol();
  51916. exports.$hasSettableValue = $hasSettableValue;
  51917. const $ids = Symbol();
  51918. exports.$ids = $ids;
  51919. const $indexOf = Symbol();
  51920. exports.$indexOf = $indexOf;
  51921. const $insertAt = Symbol();
  51922. exports.$insertAt = $insertAt;
  51923. const $isCDATAXml = Symbol();
  51924. exports.$isCDATAXml = $isCDATAXml;
  51925. const $isBindable = Symbol();
  51926. exports.$isBindable = $isBindable;
  51927. const $isDataValue = Symbol();
  51928. exports.$isDataValue = $isDataValue;
  51929. const $isDescendent = Symbol();
  51930. exports.$isDescendent = $isDescendent;
  51931. const $isNsAgnostic = Symbol();
  51932. exports.$isNsAgnostic = $isNsAgnostic;
  51933. const $isSplittable = Symbol();
  51934. exports.$isSplittable = $isSplittable;
  51935. const $isThereMoreWidth = Symbol();
  51936. exports.$isThereMoreWidth = $isThereMoreWidth;
  51937. const $isTransparent = Symbol();
  51938. exports.$isTransparent = $isTransparent;
  51939. const $isUsable = Symbol();
  51940. exports.$isUsable = $isUsable;
  51941. const $lastAttribute = Symbol();
  51942. const $namespaceId = Symbol("namespaceId");
  51943. exports.$namespaceId = $namespaceId;
  51944. const $nodeName = Symbol("nodeName");
  51945. exports.$nodeName = $nodeName;
  51946. const $nsAttributes = Symbol();
  51947. exports.$nsAttributes = $nsAttributes;
  51948. const $onChild = Symbol();
  51949. exports.$onChild = $onChild;
  51950. const $onChildCheck = Symbol();
  51951. exports.$onChildCheck = $onChildCheck;
  51952. const $onText = Symbol();
  51953. exports.$onText = $onText;
  51954. const $pushGlyphs = Symbol();
  51955. exports.$pushGlyphs = $pushGlyphs;
  51956. const $popPara = Symbol();
  51957. exports.$popPara = $popPara;
  51958. const $pushPara = Symbol();
  51959. exports.$pushPara = $pushPara;
  51960. const $removeChild = Symbol();
  51961. exports.$removeChild = $removeChild;
  51962. const $root = Symbol("root");
  51963. exports.$root = $root;
  51964. const $resolvePrototypes = Symbol();
  51965. exports.$resolvePrototypes = $resolvePrototypes;
  51966. const $searchNode = Symbol();
  51967. exports.$searchNode = $searchNode;
  51968. const $setId = Symbol();
  51969. exports.$setId = $setId;
  51970. const $setSetAttributes = Symbol();
  51971. exports.$setSetAttributes = $setSetAttributes;
  51972. const $setValue = Symbol();
  51973. exports.$setValue = $setValue;
  51974. const $tabIndex = Symbol();
  51975. exports.$tabIndex = $tabIndex;
  51976. const $text = Symbol();
  51977. exports.$text = $text;
  51978. const $toPages = Symbol();
  51979. exports.$toPages = $toPages;
  51980. const $toHTML = Symbol();
  51981. exports.$toHTML = $toHTML;
  51982. const $toString = Symbol();
  51983. exports.$toString = $toString;
  51984. const $toStyle = Symbol();
  51985. exports.$toStyle = $toStyle;
  51986. const $uid = Symbol("uid");
  51987. exports.$uid = $uid;
  51988. const _applyPrototype = Symbol();
  51989. const _attributes = Symbol();
  51990. const _attributeNames = Symbol();
  51991. const _children = Symbol("_children");
  51992. const _cloneAttribute = Symbol();
  51993. const _dataValue = Symbol();
  51994. const _defaultValue = Symbol();
  51995. const _filteredChildrenGenerator = Symbol();
  51996. const _getPrototype = Symbol();
  51997. const _getUnsetAttributes = Symbol();
  51998. const _hasChildren = Symbol();
  51999. const _max = Symbol();
  52000. const _options = Symbol();
  52001. const _parent = Symbol("parent");
  52002. const _resolvePrototypesHelper = Symbol();
  52003. const _setAttributes = Symbol();
  52004. const _validator = Symbol();
  52005. let uid = 0;
  52006. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52007. class XFAObject {
  52008. constructor(nsId, name, hasChildren = false) {
  52009. this[$namespaceId] = nsId;
  52010. this[$nodeName] = name;
  52011. this[_hasChildren] = hasChildren;
  52012. this[_parent] = null;
  52013. this[_children] = [];
  52014. this[$uid] = `${name}${uid++}`;
  52015. this[$globalData] = null;
  52016. }
  52017. [$onChild](child) {
  52018. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  52019. return false;
  52020. }
  52021. const name = child[$nodeName];
  52022. const node = this[name];
  52023. if (node instanceof XFAObjectArray) {
  52024. if (node.push(child)) {
  52025. this[$appendChild](child);
  52026. return true;
  52027. }
  52028. } else {
  52029. if (node !== null) {
  52030. this[$removeChild](node);
  52031. }
  52032. this[name] = child;
  52033. this[$appendChild](child);
  52034. return true;
  52035. }
  52036. let id = "";
  52037. if (this.id) {
  52038. id = ` (id: ${this.id})`;
  52039. } else if (this.name) {
  52040. id = ` (name: ${this.name} ${this.h.value})`;
  52041. }
  52042. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  52043. return false;
  52044. }
  52045. [$onChildCheck](child) {
  52046. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  52047. }
  52048. [$isNsAgnostic]() {
  52049. return false;
  52050. }
  52051. [$acceptWhitespace]() {
  52052. return false;
  52053. }
  52054. [$isCDATAXml]() {
  52055. return false;
  52056. }
  52057. [$isBindable]() {
  52058. return false;
  52059. }
  52060. [$popPara]() {
  52061. if (this.para) {
  52062. this[$getTemplateRoot]()[$extra].paraStack.pop();
  52063. }
  52064. }
  52065. [$pushPara]() {
  52066. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  52067. }
  52068. [$setId](ids) {
  52069. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  52070. ids.set(this.id, this);
  52071. }
  52072. }
  52073. [$getTemplateRoot]() {
  52074. return this[$globalData].template;
  52075. }
  52076. [$isSplittable]() {
  52077. return false;
  52078. }
  52079. [$isThereMoreWidth]() {
  52080. return false;
  52081. }
  52082. [$appendChild](child) {
  52083. child[_parent] = this;
  52084. this[_children].push(child);
  52085. if (!child[$globalData] && this[$globalData]) {
  52086. child[$globalData] = this[$globalData];
  52087. }
  52088. }
  52089. [$removeChild](child) {
  52090. const i = this[_children].indexOf(child);
  52091. this[_children].splice(i, 1);
  52092. }
  52093. [$hasSettableValue]() {
  52094. return this.hasOwnProperty("value");
  52095. }
  52096. [$setValue](_) {}
  52097. [$onText](_) {}
  52098. [$finalize]() {}
  52099. [$clean](builder) {
  52100. delete this[_hasChildren];
  52101. if (this[$cleanup]) {
  52102. builder.clean(this[$cleanup]);
  52103. delete this[$cleanup];
  52104. }
  52105. }
  52106. [$indexOf](child) {
  52107. return this[_children].indexOf(child);
  52108. }
  52109. [$insertAt](i, child) {
  52110. child[_parent] = this;
  52111. this[_children].splice(i, 0, child);
  52112. if (!child[$globalData] && this[$globalData]) {
  52113. child[$globalData] = this[$globalData];
  52114. }
  52115. }
  52116. [$isTransparent]() {
  52117. return !this.name;
  52118. }
  52119. [$lastAttribute]() {
  52120. return "";
  52121. }
  52122. [$text]() {
  52123. if (this[_children].length === 0) {
  52124. return this[$content];
  52125. }
  52126. return this[_children].map(c => c[$text]()).join("");
  52127. }
  52128. get [_attributeNames]() {
  52129. const proto = Object.getPrototypeOf(this);
  52130. if (!proto._attributes) {
  52131. const attributes = proto._attributes = new Set();
  52132. for (const name of Object.getOwnPropertyNames(this)) {
  52133. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  52134. break;
  52135. }
  52136. attributes.add(name);
  52137. }
  52138. }
  52139. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  52140. }
  52141. [$isDescendent](parent) {
  52142. let node = this;
  52143. while (node) {
  52144. if (node === parent) {
  52145. return true;
  52146. }
  52147. node = node[$getParent]();
  52148. }
  52149. return false;
  52150. }
  52151. [$getParent]() {
  52152. return this[_parent];
  52153. }
  52154. [$getSubformParent]() {
  52155. return this[$getParent]();
  52156. }
  52157. [$getChildren](name = null) {
  52158. if (!name) {
  52159. return this[_children];
  52160. }
  52161. return this[name];
  52162. }
  52163. [$dump]() {
  52164. const dumped = Object.create(null);
  52165. if (this[$content]) {
  52166. dumped.$content = this[$content];
  52167. }
  52168. for (const name of Object.getOwnPropertyNames(this)) {
  52169. const value = this[name];
  52170. if (value === null) {
  52171. continue;
  52172. }
  52173. if (value instanceof XFAObject) {
  52174. dumped[name] = value[$dump]();
  52175. } else if (value instanceof XFAObjectArray) {
  52176. if (!value.isEmpty()) {
  52177. dumped[name] = value.dump();
  52178. }
  52179. } else {
  52180. dumped[name] = value;
  52181. }
  52182. }
  52183. return dumped;
  52184. }
  52185. [$toStyle]() {
  52186. return null;
  52187. }
  52188. [$toHTML]() {
  52189. return _utils.HTMLResult.EMPTY;
  52190. }
  52191. *[$getContainedChildren]() {
  52192. for (const node of this[$getChildren]()) {
  52193. yield node;
  52194. }
  52195. }
  52196. *[_filteredChildrenGenerator](filter, include) {
  52197. for (const node of this[$getContainedChildren]()) {
  52198. if (!filter || include === filter.has(node[$nodeName])) {
  52199. const availableSpace = this[$getAvailableSpace]();
  52200. const res = node[$toHTML](availableSpace);
  52201. if (!res.success) {
  52202. this[$extra].failingNode = node;
  52203. }
  52204. yield res;
  52205. }
  52206. }
  52207. }
  52208. [$flushHTML]() {
  52209. return null;
  52210. }
  52211. [$addHTML](html, bbox) {
  52212. this[$extra].children.push(html);
  52213. }
  52214. [$getAvailableSpace]() {}
  52215. [$childrenToHTML]({
  52216. filter = null,
  52217. include = true
  52218. }) {
  52219. if (!this[$extra].generator) {
  52220. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  52221. } else {
  52222. const availableSpace = this[$getAvailableSpace]();
  52223. const res = this[$extra].failingNode[$toHTML](availableSpace);
  52224. if (!res.success) {
  52225. return res;
  52226. }
  52227. if (res.html) {
  52228. this[$addHTML](res.html, res.bbox);
  52229. }
  52230. delete this[$extra].failingNode;
  52231. }
  52232. while (true) {
  52233. const gen = this[$extra].generator.next();
  52234. if (gen.done) {
  52235. break;
  52236. }
  52237. const res = gen.value;
  52238. if (!res.success) {
  52239. return res;
  52240. }
  52241. if (res.html) {
  52242. this[$addHTML](res.html, res.bbox);
  52243. }
  52244. }
  52245. this[$extra].generator = null;
  52246. return _utils.HTMLResult.EMPTY;
  52247. }
  52248. [$setSetAttributes](attributes) {
  52249. this[_setAttributes] = new Set(Object.keys(attributes));
  52250. }
  52251. [_getUnsetAttributes](protoAttributes) {
  52252. const allAttr = this[_attributeNames];
  52253. const setAttr = this[_setAttributes];
  52254. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  52255. }
  52256. [$resolvePrototypes](ids, ancestors = new Set()) {
  52257. for (const child of this[_children]) {
  52258. child[_resolvePrototypesHelper](ids, ancestors);
  52259. }
  52260. }
  52261. [_resolvePrototypesHelper](ids, ancestors) {
  52262. const proto = this[_getPrototype](ids, ancestors);
  52263. if (proto) {
  52264. this[_applyPrototype](proto, ids, ancestors);
  52265. } else {
  52266. this[$resolvePrototypes](ids, ancestors);
  52267. }
  52268. }
  52269. [_getPrototype](ids, ancestors) {
  52270. const {
  52271. use,
  52272. usehref
  52273. } = this;
  52274. if (!use && !usehref) {
  52275. return null;
  52276. }
  52277. let proto = null;
  52278. let somExpression = null;
  52279. let id = null;
  52280. let ref = use;
  52281. if (usehref) {
  52282. ref = usehref;
  52283. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  52284. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  52285. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  52286. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  52287. } else if (usehref.startsWith("#")) {
  52288. id = usehref.slice(1);
  52289. } else if (usehref.startsWith(".#")) {
  52290. id = usehref.slice(2);
  52291. }
  52292. } else if (use.startsWith("#")) {
  52293. id = use.slice(1);
  52294. } else {
  52295. somExpression = use;
  52296. }
  52297. this.use = this.usehref = "";
  52298. if (id) {
  52299. proto = ids.get(id);
  52300. } else {
  52301. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  52302. if (proto) {
  52303. proto = proto[0];
  52304. }
  52305. }
  52306. if (!proto) {
  52307. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  52308. return null;
  52309. }
  52310. if (proto[$nodeName] !== this[$nodeName]) {
  52311. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  52312. return null;
  52313. }
  52314. if (ancestors.has(proto)) {
  52315. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  52316. return null;
  52317. }
  52318. ancestors.add(proto);
  52319. const protoProto = proto[_getPrototype](ids, ancestors);
  52320. if (protoProto) {
  52321. proto[_applyPrototype](protoProto, ids, ancestors);
  52322. }
  52323. proto[$resolvePrototypes](ids, ancestors);
  52324. ancestors.delete(proto);
  52325. return proto;
  52326. }
  52327. [_applyPrototype](proto, ids, ancestors) {
  52328. if (ancestors.has(proto)) {
  52329. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  52330. return;
  52331. }
  52332. if (!this[$content] && proto[$content]) {
  52333. this[$content] = proto[$content];
  52334. }
  52335. const newAncestors = new Set(ancestors);
  52336. newAncestors.add(proto);
  52337. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  52338. this[unsetAttrName] = proto[unsetAttrName];
  52339. if (this[_setAttributes]) {
  52340. this[_setAttributes].add(unsetAttrName);
  52341. }
  52342. }
  52343. for (const name of Object.getOwnPropertyNames(this)) {
  52344. if (this[_attributeNames].has(name)) {
  52345. continue;
  52346. }
  52347. const value = this[name];
  52348. const protoValue = proto[name];
  52349. if (value instanceof XFAObjectArray) {
  52350. for (const child of value[_children]) {
  52351. child[_resolvePrototypesHelper](ids, ancestors);
  52352. }
  52353. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  52354. const child = proto[_children][i][$clone]();
  52355. if (value.push(child)) {
  52356. child[_parent] = this;
  52357. this[_children].push(child);
  52358. child[_resolvePrototypesHelper](ids, ancestors);
  52359. } else {
  52360. break;
  52361. }
  52362. }
  52363. continue;
  52364. }
  52365. if (value !== null) {
  52366. value[$resolvePrototypes](ids, ancestors);
  52367. if (protoValue) {
  52368. value[_applyPrototype](protoValue, ids, ancestors);
  52369. }
  52370. continue;
  52371. }
  52372. if (protoValue !== null) {
  52373. const child = protoValue[$clone]();
  52374. child[_parent] = this;
  52375. this[name] = child;
  52376. this[_children].push(child);
  52377. child[_resolvePrototypesHelper](ids, ancestors);
  52378. }
  52379. }
  52380. }
  52381. static [_cloneAttribute](obj) {
  52382. if (Array.isArray(obj)) {
  52383. return obj.map(x => XFAObject[_cloneAttribute](x));
  52384. }
  52385. if (typeof obj === "object" && obj !== null) {
  52386. return Object.assign({}, obj);
  52387. }
  52388. return obj;
  52389. }
  52390. [$clone]() {
  52391. const clone = Object.create(Object.getPrototypeOf(this));
  52392. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  52393. try {
  52394. clone[$symbol] = this[$symbol];
  52395. } catch (_) {
  52396. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  52397. }
  52398. }
  52399. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  52400. clone[_children] = [];
  52401. for (const name of Object.getOwnPropertyNames(this)) {
  52402. if (this[_attributeNames].has(name)) {
  52403. clone[name] = XFAObject[_cloneAttribute](this[name]);
  52404. continue;
  52405. }
  52406. const value = this[name];
  52407. if (value instanceof XFAObjectArray) {
  52408. clone[name] = new XFAObjectArray(value[_max]);
  52409. } else {
  52410. clone[name] = null;
  52411. }
  52412. }
  52413. for (const child of this[_children]) {
  52414. const name = child[$nodeName];
  52415. const clonedChild = child[$clone]();
  52416. clone[_children].push(clonedChild);
  52417. clonedChild[_parent] = clone;
  52418. if (clone[name] === null) {
  52419. clone[name] = clonedChild;
  52420. } else {
  52421. clone[name][_children].push(clonedChild);
  52422. }
  52423. }
  52424. return clone;
  52425. }
  52426. [$getChildren](name = null) {
  52427. if (!name) {
  52428. return this[_children];
  52429. }
  52430. return this[_children].filter(c => c[$nodeName] === name);
  52431. }
  52432. [$getChildrenByClass](name) {
  52433. return this[name];
  52434. }
  52435. [$getChildrenByName](name, allTransparent, first = true) {
  52436. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  52437. }
  52438. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  52439. if (name === "parent") {
  52440. yield this[_parent];
  52441. return;
  52442. }
  52443. for (const child of this[_children]) {
  52444. if (child[$nodeName] === name) {
  52445. yield child;
  52446. }
  52447. if (child.name === name) {
  52448. yield child;
  52449. }
  52450. if (allTransparent || child[$isTransparent]()) {
  52451. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  52452. }
  52453. }
  52454. if (first && this[_attributeNames].has(name)) {
  52455. yield new XFAAttribute(this, name, this[name]);
  52456. }
  52457. }
  52458. }
  52459. exports.XFAObject = XFAObject;
  52460. class XFAObjectArray {
  52461. constructor(max = Infinity) {
  52462. this[_max] = max;
  52463. this[_children] = [];
  52464. }
  52465. push(child) {
  52466. const len = this[_children].length;
  52467. if (len <= this[_max]) {
  52468. this[_children].push(child);
  52469. return true;
  52470. }
  52471. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  52472. return false;
  52473. }
  52474. isEmpty() {
  52475. return this[_children].length === 0;
  52476. }
  52477. dump() {
  52478. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  52479. }
  52480. [$clone]() {
  52481. const clone = new XFAObjectArray(this[_max]);
  52482. clone[_children] = this[_children].map(c => c[$clone]());
  52483. return clone;
  52484. }
  52485. get children() {
  52486. return this[_children];
  52487. }
  52488. clear() {
  52489. this[_children].length = 0;
  52490. }
  52491. }
  52492. exports.XFAObjectArray = XFAObjectArray;
  52493. class XFAAttribute {
  52494. constructor(node, name, value) {
  52495. this[_parent] = node;
  52496. this[$nodeName] = name;
  52497. this[$content] = value;
  52498. this[$consumed] = false;
  52499. this[$uid] = `attribute${uid++}`;
  52500. }
  52501. [$getParent]() {
  52502. return this[_parent];
  52503. }
  52504. [$isDataValue]() {
  52505. return true;
  52506. }
  52507. [$getDataValue]() {
  52508. return this[$content].trim();
  52509. }
  52510. [$setValue](value) {
  52511. value = value.value || "";
  52512. this[$content] = value.toString();
  52513. }
  52514. [$text]() {
  52515. return this[$content];
  52516. }
  52517. [$isDescendent](parent) {
  52518. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  52519. }
  52520. }
  52521. exports.XFAAttribute = XFAAttribute;
  52522. class XmlObject extends XFAObject {
  52523. constructor(nsId, name, attributes = {}) {
  52524. super(nsId, name);
  52525. this[$content] = "";
  52526. this[_dataValue] = null;
  52527. if (name !== "#text") {
  52528. const map = new Map();
  52529. this[_attributes] = map;
  52530. for (const [attrName, value] of Object.entries(attributes)) {
  52531. map.set(attrName, new XFAAttribute(this, attrName, value));
  52532. }
  52533. if (attributes.hasOwnProperty($nsAttributes)) {
  52534. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  52535. if (dataNode !== undefined) {
  52536. if (dataNode === "dataGroup") {
  52537. this[_dataValue] = false;
  52538. } else if (dataNode === "dataValue") {
  52539. this[_dataValue] = true;
  52540. }
  52541. }
  52542. }
  52543. }
  52544. this[$consumed] = false;
  52545. }
  52546. [$toString](buf) {
  52547. const tagName = this[$nodeName];
  52548. if (tagName === "#text") {
  52549. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52550. return;
  52551. }
  52552. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  52553. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  52554. buf.push(`<${prefix}${utf8TagName}`);
  52555. for (const [name, value] of this[_attributes].entries()) {
  52556. const utf8Name = (0, _util.utf8StringToString)(name);
  52557. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  52558. }
  52559. if (this[_dataValue] !== null) {
  52560. if (this[_dataValue]) {
  52561. buf.push(` xfa:dataNode="dataValue"`);
  52562. } else {
  52563. buf.push(` xfa:dataNode="dataGroup"`);
  52564. }
  52565. }
  52566. if (!this[$content] && this[_children].length === 0) {
  52567. buf.push("/>");
  52568. return;
  52569. }
  52570. buf.push(">");
  52571. if (this[$content]) {
  52572. if (typeof this[$content] === "string") {
  52573. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52574. } else {
  52575. this[$content][$toString](buf);
  52576. }
  52577. } else {
  52578. for (const child of this[_children]) {
  52579. child[$toString](buf);
  52580. }
  52581. }
  52582. buf.push(`</${prefix}${utf8TagName}>`);
  52583. }
  52584. [$onChild](child) {
  52585. if (this[$content]) {
  52586. const node = new XmlObject(this[$namespaceId], "#text");
  52587. this[$appendChild](node);
  52588. node[$content] = this[$content];
  52589. this[$content] = "";
  52590. }
  52591. this[$appendChild](child);
  52592. return true;
  52593. }
  52594. [$onText](str) {
  52595. this[$content] += str;
  52596. }
  52597. [$finalize]() {
  52598. if (this[$content] && this[_children].length > 0) {
  52599. const node = new XmlObject(this[$namespaceId], "#text");
  52600. this[$appendChild](node);
  52601. node[$content] = this[$content];
  52602. delete this[$content];
  52603. }
  52604. }
  52605. [$toHTML]() {
  52606. if (this[$nodeName] === "#text") {
  52607. return _utils.HTMLResult.success({
  52608. name: "#text",
  52609. value: this[$content]
  52610. });
  52611. }
  52612. return _utils.HTMLResult.EMPTY;
  52613. }
  52614. [$getChildren](name = null) {
  52615. if (!name) {
  52616. return this[_children];
  52617. }
  52618. return this[_children].filter(c => c[$nodeName] === name);
  52619. }
  52620. [$getAttributes]() {
  52621. return this[_attributes];
  52622. }
  52623. [$getChildrenByClass](name) {
  52624. const value = this[_attributes].get(name);
  52625. if (value !== undefined) {
  52626. return value;
  52627. }
  52628. return this[$getChildren](name);
  52629. }
  52630. *[$getChildrenByNameIt](name, allTransparent) {
  52631. const value = this[_attributes].get(name);
  52632. if (value) {
  52633. yield value;
  52634. }
  52635. for (const child of this[_children]) {
  52636. if (child[$nodeName] === name) {
  52637. yield child;
  52638. }
  52639. if (allTransparent) {
  52640. yield* child[$getChildrenByNameIt](name, allTransparent);
  52641. }
  52642. }
  52643. }
  52644. *[$getAttributeIt](name, skipConsumed) {
  52645. const value = this[_attributes].get(name);
  52646. if (value && (!skipConsumed || !value[$consumed])) {
  52647. yield value;
  52648. }
  52649. for (const child of this[_children]) {
  52650. yield* child[$getAttributeIt](name, skipConsumed);
  52651. }
  52652. }
  52653. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  52654. for (const child of this[_children]) {
  52655. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  52656. yield child;
  52657. }
  52658. if (allTransparent) {
  52659. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  52660. }
  52661. }
  52662. }
  52663. [$isDataValue]() {
  52664. if (this[_dataValue] === null) {
  52665. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  52666. }
  52667. return this[_dataValue];
  52668. }
  52669. [$getDataValue]() {
  52670. if (this[_dataValue] === null) {
  52671. if (this[_children].length === 0) {
  52672. return this[$content].trim();
  52673. }
  52674. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  52675. return this[_children][0][$text]().trim();
  52676. }
  52677. return null;
  52678. }
  52679. return this[$content].trim();
  52680. }
  52681. [$setValue](value) {
  52682. value = value.value || "";
  52683. this[$content] = value.toString();
  52684. }
  52685. [$dump](hasNS = false) {
  52686. const dumped = Object.create(null);
  52687. if (hasNS) {
  52688. dumped.$ns = this[$namespaceId];
  52689. }
  52690. if (this[$content]) {
  52691. dumped.$content = this[$content];
  52692. }
  52693. dumped.$name = this[$nodeName];
  52694. dumped.children = [];
  52695. for (const child of this[_children]) {
  52696. dumped.children.push(child[$dump](hasNS));
  52697. }
  52698. dumped.attributes = Object.create(null);
  52699. for (const [name, value] of this[_attributes]) {
  52700. dumped.attributes[name] = value[$content];
  52701. }
  52702. return dumped;
  52703. }
  52704. }
  52705. exports.XmlObject = XmlObject;
  52706. class ContentObject extends XFAObject {
  52707. constructor(nsId, name) {
  52708. super(nsId, name);
  52709. this[$content] = "";
  52710. }
  52711. [$onText](text) {
  52712. this[$content] += text;
  52713. }
  52714. [$finalize]() {}
  52715. }
  52716. exports.ContentObject = ContentObject;
  52717. class OptionObject extends ContentObject {
  52718. constructor(nsId, name, options) {
  52719. super(nsId, name);
  52720. this[_options] = options;
  52721. }
  52722. [$finalize]() {
  52723. this[$content] = (0, _utils.getKeyword)({
  52724. data: this[$content],
  52725. defaultValue: this[_options][0],
  52726. validate: k => this[_options].includes(k)
  52727. });
  52728. }
  52729. [$clean](builder) {
  52730. super[$clean](builder);
  52731. delete this[_options];
  52732. }
  52733. }
  52734. exports.OptionObject = OptionObject;
  52735. class StringObject extends ContentObject {
  52736. [$finalize]() {
  52737. this[$content] = this[$content].trim();
  52738. }
  52739. }
  52740. exports.StringObject = StringObject;
  52741. class IntegerObject extends ContentObject {
  52742. constructor(nsId, name, defaultValue, validator) {
  52743. super(nsId, name);
  52744. this[_defaultValue] = defaultValue;
  52745. this[_validator] = validator;
  52746. }
  52747. [$finalize]() {
  52748. this[$content] = (0, _utils.getInteger)({
  52749. data: this[$content],
  52750. defaultValue: this[_defaultValue],
  52751. validate: this[_validator]
  52752. });
  52753. }
  52754. [$clean](builder) {
  52755. super[$clean](builder);
  52756. delete this[_defaultValue];
  52757. delete this[_validator];
  52758. }
  52759. }
  52760. exports.IntegerObject = IntegerObject;
  52761. class Option01 extends IntegerObject {
  52762. constructor(nsId, name) {
  52763. super(nsId, name, 0, n => n === 1);
  52764. }
  52765. }
  52766. exports.Option01 = Option01;
  52767. class Option10 extends IntegerObject {
  52768. constructor(nsId, name) {
  52769. super(nsId, name, 1, n => n === 0);
  52770. }
  52771. }
  52772. exports.Option10 = Option10;
  52773. /***/ }),
  52774. /* 76 */
  52775. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52776. Object.defineProperty(exports, "__esModule", ({
  52777. value: true
  52778. }));
  52779. exports.HTMLResult = void 0;
  52780. exports.getBBox = getBBox;
  52781. exports.getColor = getColor;
  52782. exports.getFloat = getFloat;
  52783. exports.getInteger = getInteger;
  52784. exports.getKeyword = getKeyword;
  52785. exports.getMeasurement = getMeasurement;
  52786. exports.getRatio = getRatio;
  52787. exports.getRelevant = getRelevant;
  52788. exports.getStringOption = getStringOption;
  52789. exports.stripQuotes = stripQuotes;
  52790. var _util = __w_pdfjs_require__(2);
  52791. const dimConverters = {
  52792. pt: x => x,
  52793. cm: x => x / 2.54 * 72,
  52794. mm: x => x / (10 * 2.54) * 72,
  52795. in: x => x * 72,
  52796. px: x => x
  52797. };
  52798. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  52799. function stripQuotes(str) {
  52800. if (str.startsWith("'") || str.startsWith('"')) {
  52801. return str.slice(1, str.length - 1);
  52802. }
  52803. return str;
  52804. }
  52805. function getInteger({
  52806. data,
  52807. defaultValue,
  52808. validate
  52809. }) {
  52810. if (!data) {
  52811. return defaultValue;
  52812. }
  52813. data = data.trim();
  52814. const n = parseInt(data, 10);
  52815. if (!isNaN(n) && validate(n)) {
  52816. return n;
  52817. }
  52818. return defaultValue;
  52819. }
  52820. function getFloat({
  52821. data,
  52822. defaultValue,
  52823. validate
  52824. }) {
  52825. if (!data) {
  52826. return defaultValue;
  52827. }
  52828. data = data.trim();
  52829. const n = parseFloat(data);
  52830. if (!isNaN(n) && validate(n)) {
  52831. return n;
  52832. }
  52833. return defaultValue;
  52834. }
  52835. function getKeyword({
  52836. data,
  52837. defaultValue,
  52838. validate
  52839. }) {
  52840. if (!data) {
  52841. return defaultValue;
  52842. }
  52843. data = data.trim();
  52844. if (validate(data)) {
  52845. return data;
  52846. }
  52847. return defaultValue;
  52848. }
  52849. function getStringOption(data, options) {
  52850. return getKeyword({
  52851. data,
  52852. defaultValue: options[0],
  52853. validate: k => options.includes(k)
  52854. });
  52855. }
  52856. function getMeasurement(str, def = "0") {
  52857. def = def || "0";
  52858. if (!str) {
  52859. return getMeasurement(def);
  52860. }
  52861. const match = str.trim().match(measurementPattern);
  52862. if (!match) {
  52863. return getMeasurement(def);
  52864. }
  52865. const [, valueStr, unit] = match;
  52866. const value = parseFloat(valueStr);
  52867. if (isNaN(value)) {
  52868. return getMeasurement(def);
  52869. }
  52870. if (value === 0) {
  52871. return 0;
  52872. }
  52873. const conv = dimConverters[unit];
  52874. if (conv) {
  52875. return conv(value);
  52876. }
  52877. return value;
  52878. }
  52879. function getRatio(data) {
  52880. if (!data) {
  52881. return {
  52882. num: 1,
  52883. den: 1
  52884. };
  52885. }
  52886. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  52887. if (ratio.length === 1) {
  52888. ratio.push(1);
  52889. }
  52890. if (ratio.length === 0) {
  52891. return {
  52892. num: 1,
  52893. den: 1
  52894. };
  52895. }
  52896. const [num, den] = ratio;
  52897. return {
  52898. num,
  52899. den
  52900. };
  52901. }
  52902. function getRelevant(data) {
  52903. if (!data) {
  52904. return [];
  52905. }
  52906. return data.trim().split(/\s+/).map(e => {
  52907. return {
  52908. excluded: e[0] === "-",
  52909. viewname: e.substring(1)
  52910. };
  52911. });
  52912. }
  52913. function getColor(data, def = [0, 0, 0]) {
  52914. let [r, g, b] = def;
  52915. if (!data) {
  52916. return {
  52917. r,
  52918. g,
  52919. b
  52920. };
  52921. }
  52922. 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);
  52923. if (color.length < 3) {
  52924. return {
  52925. r,
  52926. g,
  52927. b
  52928. };
  52929. }
  52930. [r, g, b] = color;
  52931. return {
  52932. r,
  52933. g,
  52934. b
  52935. };
  52936. }
  52937. function getBBox(data) {
  52938. const def = -1;
  52939. if (!data) {
  52940. return {
  52941. x: def,
  52942. y: def,
  52943. width: def,
  52944. height: def
  52945. };
  52946. }
  52947. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  52948. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  52949. return {
  52950. x: def,
  52951. y: def,
  52952. width: def,
  52953. height: def
  52954. };
  52955. }
  52956. const [x, y, width, height] = bbox;
  52957. return {
  52958. x,
  52959. y,
  52960. width,
  52961. height
  52962. };
  52963. }
  52964. class HTMLResult {
  52965. static get FAILURE() {
  52966. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  52967. }
  52968. static get EMPTY() {
  52969. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  52970. }
  52971. constructor(success, html, bbox, breakNode) {
  52972. this.success = success;
  52973. this.html = html;
  52974. this.bbox = bbox;
  52975. this.breakNode = breakNode;
  52976. }
  52977. isBreak() {
  52978. return !!this.breakNode;
  52979. }
  52980. static breakNode(node) {
  52981. return new HTMLResult(false, null, null, node);
  52982. }
  52983. static success(html, bbox = null) {
  52984. return new HTMLResult(true, html, bbox, null);
  52985. }
  52986. }
  52987. exports.HTMLResult = HTMLResult;
  52988. /***/ }),
  52989. /* 77 */
  52990. /***/ ((__unused_webpack_module, exports) => {
  52991. Object.defineProperty(exports, "__esModule", ({
  52992. value: true
  52993. }));
  52994. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  52995. const $buildXFAObject = Symbol();
  52996. exports.$buildXFAObject = $buildXFAObject;
  52997. const NamespaceIds = {
  52998. config: {
  52999. id: 0,
  53000. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  53001. },
  53002. connectionSet: {
  53003. id: 1,
  53004. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  53005. },
  53006. datasets: {
  53007. id: 2,
  53008. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  53009. },
  53010. form: {
  53011. id: 3,
  53012. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  53013. },
  53014. localeSet: {
  53015. id: 4,
  53016. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  53017. },
  53018. pdf: {
  53019. id: 5,
  53020. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  53021. },
  53022. signature: {
  53023. id: 6,
  53024. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  53025. },
  53026. sourceSet: {
  53027. id: 7,
  53028. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  53029. },
  53030. stylesheet: {
  53031. id: 8,
  53032. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  53033. },
  53034. template: {
  53035. id: 9,
  53036. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  53037. },
  53038. xdc: {
  53039. id: 10,
  53040. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  53041. },
  53042. xdp: {
  53043. id: 11,
  53044. check: ns => ns === "http://ns.adobe.com/xdp/"
  53045. },
  53046. xfdf: {
  53047. id: 12,
  53048. check: ns => ns === "http://ns.adobe.com/xfdf/"
  53049. },
  53050. xhtml: {
  53051. id: 13,
  53052. check: ns => ns === "http://www.w3.org/1999/xhtml"
  53053. },
  53054. xmpmeta: {
  53055. id: 14,
  53056. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  53057. }
  53058. };
  53059. exports.NamespaceIds = NamespaceIds;
  53060. /***/ }),
  53061. /* 78 */
  53062. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53063. Object.defineProperty(exports, "__esModule", ({
  53064. value: true
  53065. }));
  53066. exports.createDataNode = createDataNode;
  53067. exports.searchNode = searchNode;
  53068. var _xfa_object = __w_pdfjs_require__(75);
  53069. var _namespaces = __w_pdfjs_require__(77);
  53070. var _util = __w_pdfjs_require__(2);
  53071. const namePattern = /^[^.[]+/;
  53072. const indexPattern = /^[^\]]+/;
  53073. const operators = {
  53074. dot: 0,
  53075. dotDot: 1,
  53076. dotHash: 2,
  53077. dotBracket: 3,
  53078. dotParen: 4
  53079. };
  53080. 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]]);
  53081. const somCache = new WeakMap();
  53082. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  53083. function parseIndex(index) {
  53084. index = index.trim();
  53085. if (index === "*") {
  53086. return Infinity;
  53087. }
  53088. return parseInt(index, 10) || 0;
  53089. }
  53090. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  53091. let match = expr.match(namePattern);
  53092. if (!match) {
  53093. return null;
  53094. }
  53095. let [name] = match;
  53096. const parsed = [{
  53097. name,
  53098. cacheName: "." + name,
  53099. index: 0,
  53100. js: null,
  53101. formCalc: null,
  53102. operator: operators.dot
  53103. }];
  53104. let pos = name.length;
  53105. while (pos < expr.length) {
  53106. const spos = pos;
  53107. const char = expr.charAt(pos++);
  53108. if (char === "[") {
  53109. match = expr.slice(pos).match(indexPattern);
  53110. if (!match) {
  53111. (0, _util.warn)("XFA - Invalid index in SOM expression");
  53112. return null;
  53113. }
  53114. parsed.at(-1).index = parseIndex(match[0]);
  53115. pos += match[0].length + 1;
  53116. continue;
  53117. }
  53118. let operator;
  53119. switch (expr.charAt(pos)) {
  53120. case ".":
  53121. if (!dotDotAllowed) {
  53122. return null;
  53123. }
  53124. pos++;
  53125. operator = operators.dotDot;
  53126. break;
  53127. case "#":
  53128. pos++;
  53129. operator = operators.dotHash;
  53130. break;
  53131. case "[":
  53132. if (noExpr) {
  53133. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  53134. return null;
  53135. }
  53136. operator = operators.dotBracket;
  53137. break;
  53138. case "(":
  53139. if (noExpr) {
  53140. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  53141. return null;
  53142. }
  53143. operator = operators.dotParen;
  53144. break;
  53145. default:
  53146. operator = operators.dot;
  53147. break;
  53148. }
  53149. match = expr.slice(pos).match(namePattern);
  53150. if (!match) {
  53151. break;
  53152. }
  53153. [name] = match;
  53154. pos += name.length;
  53155. parsed.push({
  53156. name,
  53157. cacheName: expr.slice(spos, pos),
  53158. operator,
  53159. index: 0,
  53160. js: null,
  53161. formCalc: null
  53162. });
  53163. }
  53164. return parsed;
  53165. }
  53166. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  53167. const parsed = parseExpression(expr, dotDotAllowed);
  53168. if (!parsed) {
  53169. return null;
  53170. }
  53171. const fn = shortcuts.get(parsed[0].name);
  53172. let i = 0;
  53173. let isQualified;
  53174. if (fn) {
  53175. isQualified = true;
  53176. root = [fn(root, container)];
  53177. i = 1;
  53178. } else {
  53179. isQualified = container === null;
  53180. root = [container || root];
  53181. }
  53182. for (let ii = parsed.length; i < ii; i++) {
  53183. const {
  53184. name,
  53185. cacheName,
  53186. operator,
  53187. index
  53188. } = parsed[i];
  53189. const nodes = [];
  53190. for (const node of root) {
  53191. if (!(node instanceof _xfa_object.XFAObject)) {
  53192. continue;
  53193. }
  53194. let children, cached;
  53195. if (useCache) {
  53196. cached = somCache.get(node);
  53197. if (!cached) {
  53198. cached = new Map();
  53199. somCache.set(node, cached);
  53200. }
  53201. children = cached.get(cacheName);
  53202. }
  53203. if (!children) {
  53204. switch (operator) {
  53205. case operators.dot:
  53206. children = node[_xfa_object.$getChildrenByName](name, false);
  53207. break;
  53208. case operators.dotDot:
  53209. children = node[_xfa_object.$getChildrenByName](name, true);
  53210. break;
  53211. case operators.dotHash:
  53212. children = node[_xfa_object.$getChildrenByClass](name);
  53213. if (children instanceof _xfa_object.XFAObjectArray) {
  53214. children = children.children;
  53215. } else {
  53216. children = [children];
  53217. }
  53218. break;
  53219. default:
  53220. break;
  53221. }
  53222. if (useCache) {
  53223. cached.set(cacheName, children);
  53224. }
  53225. }
  53226. if (children.length > 0) {
  53227. nodes.push(children);
  53228. }
  53229. }
  53230. if (nodes.length === 0 && !isQualified && i === 0) {
  53231. const parent = container[_xfa_object.$getParent]();
  53232. container = parent;
  53233. if (!container) {
  53234. return null;
  53235. }
  53236. i = -1;
  53237. root = [container];
  53238. continue;
  53239. }
  53240. if (isFinite(index)) {
  53241. root = nodes.filter(node => index < node.length).map(node => node[index]);
  53242. } else {
  53243. root = nodes.flat();
  53244. }
  53245. }
  53246. if (root.length === 0) {
  53247. return null;
  53248. }
  53249. return root;
  53250. }
  53251. function createNodes(root, path) {
  53252. let node = null;
  53253. for (const {
  53254. name,
  53255. index
  53256. } of path) {
  53257. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  53258. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  53259. node = new _xfa_object.XmlObject(nsId, name);
  53260. root[_xfa_object.$appendChild](node);
  53261. }
  53262. root = node;
  53263. }
  53264. return node;
  53265. }
  53266. function createDataNode(root, container, expr) {
  53267. const parsed = parseExpression(expr);
  53268. if (!parsed) {
  53269. return null;
  53270. }
  53271. if (parsed.some(x => x.operator === operators.dotDot)) {
  53272. return null;
  53273. }
  53274. const fn = shortcuts.get(parsed[0].name);
  53275. let i = 0;
  53276. if (fn) {
  53277. root = fn(root, container);
  53278. i = 1;
  53279. } else {
  53280. root = container || root;
  53281. }
  53282. for (let ii = parsed.length; i < ii; i++) {
  53283. const {
  53284. name,
  53285. operator,
  53286. index
  53287. } = parsed[i];
  53288. if (!isFinite(index)) {
  53289. parsed[i].index = 0;
  53290. return createNodes(root, parsed.slice(i));
  53291. }
  53292. let children;
  53293. switch (operator) {
  53294. case operators.dot:
  53295. children = root[_xfa_object.$getChildrenByName](name, false);
  53296. break;
  53297. case operators.dotDot:
  53298. children = root[_xfa_object.$getChildrenByName](name, true);
  53299. break;
  53300. case operators.dotHash:
  53301. children = root[_xfa_object.$getChildrenByClass](name);
  53302. if (children instanceof _xfa_object.XFAObjectArray) {
  53303. children = children.children;
  53304. } else {
  53305. children = [children];
  53306. }
  53307. break;
  53308. default:
  53309. break;
  53310. }
  53311. if (children.length === 0) {
  53312. return createNodes(root, parsed.slice(i));
  53313. }
  53314. if (index < children.length) {
  53315. const child = children[index];
  53316. if (!(child instanceof _xfa_object.XFAObject)) {
  53317. (0, _util.warn)(`XFA - Cannot create a node.`);
  53318. return null;
  53319. }
  53320. root = child;
  53321. } else {
  53322. parsed[i].index = index - children.length;
  53323. return createNodes(root, parsed.slice(i));
  53324. }
  53325. }
  53326. return null;
  53327. }
  53328. /***/ }),
  53329. /* 79 */
  53330. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53331. Object.defineProperty(exports, "__esModule", ({
  53332. value: true
  53333. }));
  53334. exports.Binder = void 0;
  53335. var _xfa_object = __w_pdfjs_require__(75);
  53336. var _template = __w_pdfjs_require__(80);
  53337. var _som = __w_pdfjs_require__(78);
  53338. var _namespaces = __w_pdfjs_require__(77);
  53339. var _util = __w_pdfjs_require__(2);
  53340. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  53341. function createText(content) {
  53342. const node = new _template.Text({});
  53343. node[_xfa_object.$content] = content;
  53344. return node;
  53345. }
  53346. class Binder {
  53347. constructor(root) {
  53348. this.root = root;
  53349. this.datasets = root.datasets;
  53350. if (root.datasets && root.datasets.data) {
  53351. this.data = root.datasets.data;
  53352. } else {
  53353. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  53354. }
  53355. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  53356. this.root.form = this.form = root.template[_xfa_object.$clone]();
  53357. }
  53358. _isConsumeData() {
  53359. return !this.emptyMerge && this._mergeMode;
  53360. }
  53361. _isMatchTemplate() {
  53362. return !this._isConsumeData();
  53363. }
  53364. bind() {
  53365. this._bindElement(this.form, this.data);
  53366. return this.form;
  53367. }
  53368. getData() {
  53369. return this.data;
  53370. }
  53371. _bindValue(formNode, data, picture) {
  53372. formNode[_xfa_object.$data] = data;
  53373. if (formNode[_xfa_object.$hasSettableValue]()) {
  53374. if (data[_xfa_object.$isDataValue]()) {
  53375. const value = data[_xfa_object.$getDataValue]();
  53376. formNode[_xfa_object.$setValue](createText(value));
  53377. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  53378. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  53379. formNode[_xfa_object.$setValue](createText(value));
  53380. } else if (this._isConsumeData()) {
  53381. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  53382. }
  53383. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  53384. this._bindElement(formNode, data);
  53385. } else {
  53386. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  53387. }
  53388. }
  53389. _findDataByNameToConsume(name, isValue, dataNode, global) {
  53390. if (!name) {
  53391. return null;
  53392. }
  53393. let generator, match;
  53394. for (let i = 0; i < 3; i++) {
  53395. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  53396. while (true) {
  53397. match = generator.next().value;
  53398. if (!match) {
  53399. break;
  53400. }
  53401. if (isValue === match[_xfa_object.$isDataValue]()) {
  53402. return match;
  53403. }
  53404. }
  53405. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  53406. break;
  53407. }
  53408. dataNode = dataNode[_xfa_object.$getParent]();
  53409. }
  53410. if (!global) {
  53411. return null;
  53412. }
  53413. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  53414. match = generator.next().value;
  53415. if (match) {
  53416. return match;
  53417. }
  53418. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  53419. match = generator.next().value;
  53420. if (match && match[_xfa_object.$isDataValue]()) {
  53421. return match;
  53422. }
  53423. return null;
  53424. }
  53425. _setProperties(formNode, dataNode) {
  53426. if (!formNode.hasOwnProperty("setProperty")) {
  53427. return;
  53428. }
  53429. for (const {
  53430. ref,
  53431. target,
  53432. connection
  53433. } of formNode.setProperty.children) {
  53434. if (connection) {
  53435. continue;
  53436. }
  53437. if (!ref) {
  53438. continue;
  53439. }
  53440. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53441. if (!nodes) {
  53442. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53443. continue;
  53444. }
  53445. const [node] = nodes;
  53446. if (!node[_xfa_object.$isDescendent](this.data)) {
  53447. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  53448. continue;
  53449. }
  53450. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  53451. if (!targetNodes) {
  53452. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  53453. continue;
  53454. }
  53455. const [targetNode] = targetNodes;
  53456. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  53457. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  53458. continue;
  53459. }
  53460. const targetParent = targetNode[_xfa_object.$getParent]();
  53461. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  53462. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  53463. continue;
  53464. }
  53465. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  53466. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  53467. continue;
  53468. }
  53469. const content = node[_xfa_object.$text]();
  53470. const name = targetNode[_xfa_object.$nodeName];
  53471. if (targetNode instanceof _xfa_object.XFAAttribute) {
  53472. const attrs = Object.create(null);
  53473. attrs[name] = content;
  53474. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  53475. targetParent[name] = obj[name];
  53476. continue;
  53477. }
  53478. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  53479. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  53480. continue;
  53481. }
  53482. targetNode[_xfa_object.$data] = node;
  53483. targetNode[_xfa_object.$content] = content;
  53484. targetNode[_xfa_object.$finalize]();
  53485. }
  53486. }
  53487. _bindItems(formNode, dataNode) {
  53488. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  53489. return;
  53490. }
  53491. for (const item of formNode.items.children) {
  53492. formNode[_xfa_object.$removeChild](item);
  53493. }
  53494. formNode.items.clear();
  53495. const labels = new _template.Items({});
  53496. const values = new _template.Items({});
  53497. formNode[_xfa_object.$appendChild](labels);
  53498. formNode.items.push(labels);
  53499. formNode[_xfa_object.$appendChild](values);
  53500. formNode.items.push(values);
  53501. for (const {
  53502. ref,
  53503. labelRef,
  53504. valueRef,
  53505. connection
  53506. } of formNode.bindItems.children) {
  53507. if (connection) {
  53508. continue;
  53509. }
  53510. if (!ref) {
  53511. continue;
  53512. }
  53513. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53514. if (!nodes) {
  53515. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53516. continue;
  53517. }
  53518. for (const node of nodes) {
  53519. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  53520. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  53521. continue;
  53522. }
  53523. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  53524. if (!labelNodes) {
  53525. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  53526. continue;
  53527. }
  53528. const [labelNode] = labelNodes;
  53529. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  53530. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  53531. continue;
  53532. }
  53533. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  53534. if (!valueNodes) {
  53535. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  53536. continue;
  53537. }
  53538. const [valueNode] = valueNodes;
  53539. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  53540. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  53541. continue;
  53542. }
  53543. const label = createText(labelNode[_xfa_object.$text]());
  53544. const value = createText(valueNode[_xfa_object.$text]());
  53545. labels[_xfa_object.$appendChild](label);
  53546. labels.text.push(label);
  53547. values[_xfa_object.$appendChild](value);
  53548. values.text.push(value);
  53549. }
  53550. }
  53551. }
  53552. _bindOccurrences(formNode, matches, picture) {
  53553. let baseClone;
  53554. if (matches.length > 1) {
  53555. baseClone = formNode[_xfa_object.$clone]();
  53556. baseClone[_xfa_object.$removeChild](baseClone.occur);
  53557. baseClone.occur = null;
  53558. }
  53559. this._bindValue(formNode, matches[0], picture);
  53560. this._setProperties(formNode, matches[0]);
  53561. this._bindItems(formNode, matches[0]);
  53562. if (matches.length === 1) {
  53563. return;
  53564. }
  53565. const parent = formNode[_xfa_object.$getParent]();
  53566. const name = formNode[_xfa_object.$nodeName];
  53567. const pos = parent[_xfa_object.$indexOf](formNode);
  53568. for (let i = 1, ii = matches.length; i < ii; i++) {
  53569. const match = matches[i];
  53570. const clone = baseClone[_xfa_object.$clone]();
  53571. parent[name].push(clone);
  53572. parent[_xfa_object.$insertAt](pos + i, clone);
  53573. this._bindValue(clone, match, picture);
  53574. this._setProperties(clone, match);
  53575. this._bindItems(clone, match);
  53576. }
  53577. }
  53578. _createOccurrences(formNode) {
  53579. if (!this.emptyMerge) {
  53580. return;
  53581. }
  53582. const {
  53583. occur
  53584. } = formNode;
  53585. if (!occur || occur.initial <= 1) {
  53586. return;
  53587. }
  53588. const parent = formNode[_xfa_object.$getParent]();
  53589. const name = formNode[_xfa_object.$nodeName];
  53590. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  53591. return;
  53592. }
  53593. let currentNumber;
  53594. if (formNode.name) {
  53595. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  53596. } else {
  53597. currentNumber = parent[name].children.length;
  53598. }
  53599. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  53600. const ii = occur.initial - currentNumber;
  53601. if (ii) {
  53602. const nodeClone = formNode[_xfa_object.$clone]();
  53603. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  53604. nodeClone.occur = null;
  53605. parent[name].push(nodeClone);
  53606. parent[_xfa_object.$insertAt](pos, nodeClone);
  53607. for (let i = 1; i < ii; i++) {
  53608. const clone = nodeClone[_xfa_object.$clone]();
  53609. parent[name].push(clone);
  53610. parent[_xfa_object.$insertAt](pos + i, clone);
  53611. }
  53612. }
  53613. }
  53614. _getOccurInfo(formNode) {
  53615. const {
  53616. name,
  53617. occur
  53618. } = formNode;
  53619. if (!occur || !name) {
  53620. return [1, 1];
  53621. }
  53622. const max = occur.max === -1 ? Infinity : occur.max;
  53623. return [occur.min, max];
  53624. }
  53625. _setAndBind(formNode, dataNode) {
  53626. this._setProperties(formNode, dataNode);
  53627. this._bindItems(formNode, dataNode);
  53628. this._bindElement(formNode, dataNode);
  53629. }
  53630. _bindElement(formNode, dataNode) {
  53631. const uselessNodes = [];
  53632. this._createOccurrences(formNode);
  53633. for (const child of formNode[_xfa_object.$getChildren]()) {
  53634. if (child[_xfa_object.$data]) {
  53635. continue;
  53636. }
  53637. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  53638. this._mergeMode = child.mergeMode === "consumeData";
  53639. const dataChildren = dataNode[_xfa_object.$getChildren]();
  53640. if (dataChildren.length > 0) {
  53641. this._bindOccurrences(child, [dataChildren[0]], null);
  53642. } else if (this.emptyMerge) {
  53643. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53644. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  53645. dataNode[_xfa_object.$appendChild](dataChild);
  53646. this._bindElement(child, dataChild);
  53647. }
  53648. continue;
  53649. }
  53650. if (!child[_xfa_object.$isBindable]()) {
  53651. continue;
  53652. }
  53653. let global = false;
  53654. let picture = null;
  53655. let ref = null;
  53656. let match = null;
  53657. if (child.bind) {
  53658. switch (child.bind.match) {
  53659. case "none":
  53660. this._setAndBind(child, dataNode);
  53661. continue;
  53662. case "global":
  53663. global = true;
  53664. break;
  53665. case "dataRef":
  53666. if (!child.bind.ref) {
  53667. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  53668. this._setAndBind(child, dataNode);
  53669. continue;
  53670. }
  53671. ref = child.bind.ref;
  53672. break;
  53673. default:
  53674. break;
  53675. }
  53676. if (child.bind.picture) {
  53677. picture = child.bind.picture[_xfa_object.$content];
  53678. }
  53679. }
  53680. const [min, max] = this._getOccurInfo(child);
  53681. if (ref) {
  53682. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  53683. if (match === null) {
  53684. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  53685. if (!match) {
  53686. continue;
  53687. }
  53688. if (this._isConsumeData()) {
  53689. match[_xfa_object.$consumed] = true;
  53690. }
  53691. this._setAndBind(child, match);
  53692. continue;
  53693. } else {
  53694. if (this._isConsumeData()) {
  53695. match = match.filter(node => !node[_xfa_object.$consumed]);
  53696. }
  53697. if (match.length > max) {
  53698. match = match.slice(0, max);
  53699. } else if (match.length === 0) {
  53700. match = null;
  53701. }
  53702. if (match && this._isConsumeData()) {
  53703. match.forEach(node => {
  53704. node[_xfa_object.$consumed] = true;
  53705. });
  53706. }
  53707. }
  53708. } else {
  53709. if (!child.name) {
  53710. this._setAndBind(child, dataNode);
  53711. continue;
  53712. }
  53713. if (this._isConsumeData()) {
  53714. const matches = [];
  53715. while (matches.length < max) {
  53716. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  53717. if (!found) {
  53718. break;
  53719. }
  53720. found[_xfa_object.$consumed] = true;
  53721. matches.push(found);
  53722. }
  53723. match = matches.length > 0 ? matches : null;
  53724. } else {
  53725. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  53726. if (!match) {
  53727. if (min === 0) {
  53728. uselessNodes.push(child);
  53729. continue;
  53730. }
  53731. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53732. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  53733. if (this.emptyMerge) {
  53734. match[_xfa_object.$consumed] = true;
  53735. }
  53736. dataNode[_xfa_object.$appendChild](match);
  53737. this._setAndBind(child, match);
  53738. continue;
  53739. }
  53740. if (this.emptyMerge) {
  53741. match[_xfa_object.$consumed] = true;
  53742. }
  53743. match = [match];
  53744. }
  53745. }
  53746. if (match) {
  53747. this._bindOccurrences(child, match, picture);
  53748. } else if (min > 0) {
  53749. this._setAndBind(child, dataNode);
  53750. } else {
  53751. uselessNodes.push(child);
  53752. }
  53753. }
  53754. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  53755. }
  53756. }
  53757. exports.Binder = Binder;
  53758. /***/ }),
  53759. /* 80 */
  53760. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53761. Object.defineProperty(exports, "__esModule", ({
  53762. value: true
  53763. }));
  53764. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  53765. var _xfa_object = __w_pdfjs_require__(75);
  53766. var _namespaces = __w_pdfjs_require__(77);
  53767. var _layout = __w_pdfjs_require__(81);
  53768. var _html_utils = __w_pdfjs_require__(82);
  53769. var _utils = __w_pdfjs_require__(76);
  53770. var _util = __w_pdfjs_require__(2);
  53771. var _fonts = __w_pdfjs_require__(83);
  53772. var _core_utils = __w_pdfjs_require__(4);
  53773. var _som = __w_pdfjs_require__(78);
  53774. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  53775. const SVG_NS = "http://www.w3.org/2000/svg";
  53776. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  53777. const MAX_EMPTY_PAGES = 3;
  53778. const DEFAULT_TAB_INDEX = 5000;
  53779. const HEADING_PATTERN = /^H(\d+)$/;
  53780. 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"]);
  53781. 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"]];
  53782. function getBorderDims(node) {
  53783. if (!node || !node.border) {
  53784. return {
  53785. w: 0,
  53786. h: 0
  53787. };
  53788. }
  53789. const borderExtra = node.border[_xfa_object.$getExtra]();
  53790. if (!borderExtra) {
  53791. return {
  53792. w: 0,
  53793. h: 0
  53794. };
  53795. }
  53796. return {
  53797. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  53798. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  53799. };
  53800. }
  53801. function hasMargin(node) {
  53802. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  53803. }
  53804. function _setValue(templateNode, value) {
  53805. if (!templateNode.value) {
  53806. const nodeValue = new Value({});
  53807. templateNode[_xfa_object.$appendChild](nodeValue);
  53808. templateNode.value = nodeValue;
  53809. }
  53810. templateNode.value[_xfa_object.$setValue](value);
  53811. }
  53812. function* getContainedChildren(node) {
  53813. for (const child of node[_xfa_object.$getChildren]()) {
  53814. if (child instanceof SubformSet) {
  53815. yield* child[_xfa_object.$getContainedChildren]();
  53816. continue;
  53817. }
  53818. yield child;
  53819. }
  53820. }
  53821. function isRequired(node) {
  53822. return node.validate && node.validate.nullTest === "error";
  53823. }
  53824. function setTabIndex(node) {
  53825. while (node) {
  53826. if (!node.traversal) {
  53827. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53828. return;
  53829. }
  53830. if (node[_xfa_object.$tabIndex]) {
  53831. return;
  53832. }
  53833. let next = null;
  53834. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  53835. if (child.operation === "next") {
  53836. next = child;
  53837. break;
  53838. }
  53839. }
  53840. if (!next || !next.ref) {
  53841. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53842. return;
  53843. }
  53844. const root = node[_xfa_object.$getTemplateRoot]();
  53845. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  53846. const ref = root[_xfa_object.$searchNode](next.ref, node);
  53847. if (!ref) {
  53848. return;
  53849. }
  53850. node = ref[0];
  53851. }
  53852. }
  53853. function applyAssist(obj, attributes) {
  53854. const assist = obj.assist;
  53855. if (assist) {
  53856. const assistTitle = assist[_xfa_object.$toHTML]();
  53857. if (assistTitle) {
  53858. attributes.title = assistTitle;
  53859. }
  53860. const role = assist.role;
  53861. const match = role.match(HEADING_PATTERN);
  53862. if (match) {
  53863. const ariaRole = "heading";
  53864. const ariaLevel = match[1];
  53865. attributes.role = ariaRole;
  53866. attributes["aria-level"] = ariaLevel;
  53867. }
  53868. }
  53869. if (obj.layout === "table") {
  53870. attributes.role = "table";
  53871. } else if (obj.layout === "row") {
  53872. attributes.role = "row";
  53873. } else {
  53874. const parent = obj[_xfa_object.$getParent]();
  53875. if (parent.layout === "row") {
  53876. if (parent.assist && parent.assist.role === "TH") {
  53877. attributes.role = "columnheader";
  53878. } else {
  53879. attributes.role = "cell";
  53880. }
  53881. }
  53882. }
  53883. }
  53884. function ariaLabel(obj) {
  53885. if (!obj.assist) {
  53886. return null;
  53887. }
  53888. const assist = obj.assist;
  53889. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  53890. return assist.speak[_xfa_object.$content];
  53891. }
  53892. if (assist.toolTip) {
  53893. return assist.toolTip[_xfa_object.$content];
  53894. }
  53895. return null;
  53896. }
  53897. function valueToHtml(value) {
  53898. return _utils.HTMLResult.success({
  53899. name: "div",
  53900. attributes: {
  53901. class: ["xfaRich"],
  53902. style: Object.create(null)
  53903. },
  53904. children: [{
  53905. name: "span",
  53906. attributes: {
  53907. style: Object.create(null)
  53908. },
  53909. value
  53910. }]
  53911. });
  53912. }
  53913. function setFirstUnsplittable(node) {
  53914. const root = node[_xfa_object.$getTemplateRoot]();
  53915. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  53916. root[_xfa_object.$extra].firstUnsplittable = node;
  53917. root[_xfa_object.$extra].noLayoutFailure = true;
  53918. }
  53919. }
  53920. function unsetFirstUnsplittable(node) {
  53921. const root = node[_xfa_object.$getTemplateRoot]();
  53922. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  53923. root[_xfa_object.$extra].noLayoutFailure = false;
  53924. }
  53925. }
  53926. function handleBreak(node) {
  53927. if (node[_xfa_object.$extra]) {
  53928. return false;
  53929. }
  53930. node[_xfa_object.$extra] = Object.create(null);
  53931. if (node.targetType === "auto") {
  53932. return false;
  53933. }
  53934. const root = node[_xfa_object.$getTemplateRoot]();
  53935. let target = null;
  53936. if (node.target) {
  53937. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  53938. if (!target) {
  53939. return false;
  53940. }
  53941. target = target[0];
  53942. }
  53943. const {
  53944. currentPageArea,
  53945. currentContentArea
  53946. } = root[_xfa_object.$extra];
  53947. if (node.targetType === "pageArea") {
  53948. if (!(target instanceof PageArea)) {
  53949. target = null;
  53950. }
  53951. if (node.startNew) {
  53952. node[_xfa_object.$extra].target = target || currentPageArea;
  53953. return true;
  53954. } else if (target && target !== currentPageArea) {
  53955. node[_xfa_object.$extra].target = target;
  53956. return true;
  53957. }
  53958. return false;
  53959. }
  53960. if (!(target instanceof ContentArea)) {
  53961. target = null;
  53962. }
  53963. const pageArea = target && target[_xfa_object.$getParent]();
  53964. let index;
  53965. let nextPageArea = pageArea;
  53966. if (node.startNew) {
  53967. if (target) {
  53968. const contentAreas = pageArea.contentArea.children;
  53969. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  53970. const indexForTarget = contentAreas.indexOf(target);
  53971. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  53972. nextPageArea = null;
  53973. }
  53974. index = indexForTarget - 1;
  53975. } else {
  53976. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  53977. }
  53978. } else if (target && target !== currentContentArea) {
  53979. const contentAreas = pageArea.contentArea.children;
  53980. index = contentAreas.indexOf(target) - 1;
  53981. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  53982. } else {
  53983. return false;
  53984. }
  53985. node[_xfa_object.$extra].target = nextPageArea;
  53986. node[_xfa_object.$extra].index = index;
  53987. return true;
  53988. }
  53989. function handleOverflow(node, extraNode, space) {
  53990. const root = node[_xfa_object.$getTemplateRoot]();
  53991. const saved = root[_xfa_object.$extra].noLayoutFailure;
  53992. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  53993. extraNode[_xfa_object.$getSubformParent] = () => node;
  53994. root[_xfa_object.$extra].noLayoutFailure = true;
  53995. const res = extraNode[_xfa_object.$toHTML](space);
  53996. node[_xfa_object.$addHTML](res.html, res.bbox);
  53997. root[_xfa_object.$extra].noLayoutFailure = saved;
  53998. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  53999. }
  54000. class AppearanceFilter extends _xfa_object.StringObject {
  54001. constructor(attributes) {
  54002. super(TEMPLATE_NS_ID, "appearanceFilter");
  54003. this.id = attributes.id || "";
  54004. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54005. this.use = attributes.use || "";
  54006. this.usehref = attributes.usehref || "";
  54007. }
  54008. }
  54009. class Arc extends _xfa_object.XFAObject {
  54010. constructor(attributes) {
  54011. super(TEMPLATE_NS_ID, "arc", true);
  54012. this.circular = (0, _utils.getInteger)({
  54013. data: attributes.circular,
  54014. defaultValue: 0,
  54015. validate: x => x === 1
  54016. });
  54017. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54018. this.id = attributes.id || "";
  54019. this.startAngle = (0, _utils.getFloat)({
  54020. data: attributes.startAngle,
  54021. defaultValue: 0,
  54022. validate: x => true
  54023. });
  54024. this.sweepAngle = (0, _utils.getFloat)({
  54025. data: attributes.sweepAngle,
  54026. defaultValue: 360,
  54027. validate: x => true
  54028. });
  54029. this.use = attributes.use || "";
  54030. this.usehref = attributes.usehref || "";
  54031. this.edge = null;
  54032. this.fill = null;
  54033. }
  54034. [_xfa_object.$toHTML]() {
  54035. const edge = this.edge || new Edge({});
  54036. const edgeStyle = edge[_xfa_object.$toStyle]();
  54037. const style = Object.create(null);
  54038. if (this.fill && this.fill.presence === "visible") {
  54039. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  54040. } else {
  54041. style.fill = "transparent";
  54042. }
  54043. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  54044. style.stroke = edgeStyle.color;
  54045. let arc;
  54046. const attributes = {
  54047. xmlns: SVG_NS,
  54048. style: {
  54049. width: "100%",
  54050. height: "100%",
  54051. overflow: "visible"
  54052. }
  54053. };
  54054. if (this.sweepAngle === 360) {
  54055. arc = {
  54056. name: "ellipse",
  54057. attributes: {
  54058. xmlns: SVG_NS,
  54059. cx: "50%",
  54060. cy: "50%",
  54061. rx: "50%",
  54062. ry: "50%",
  54063. style
  54064. }
  54065. };
  54066. } else {
  54067. const startAngle = this.startAngle * Math.PI / 180;
  54068. const sweepAngle = this.sweepAngle * Math.PI / 180;
  54069. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  54070. 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))];
  54071. arc = {
  54072. name: "path",
  54073. attributes: {
  54074. xmlns: SVG_NS,
  54075. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  54076. vectorEffect: "non-scaling-stroke",
  54077. style
  54078. }
  54079. };
  54080. Object.assign(attributes, {
  54081. viewBox: "0 0 100 100",
  54082. preserveAspectRatio: "none"
  54083. });
  54084. }
  54085. const svg = {
  54086. name: "svg",
  54087. children: [arc],
  54088. attributes
  54089. };
  54090. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54091. if (hasMargin(parent)) {
  54092. return _utils.HTMLResult.success({
  54093. name: "div",
  54094. attributes: {
  54095. style: {
  54096. display: "inline",
  54097. width: "100%",
  54098. height: "100%"
  54099. }
  54100. },
  54101. children: [svg]
  54102. });
  54103. }
  54104. svg.attributes.style.position = "absolute";
  54105. return _utils.HTMLResult.success(svg);
  54106. }
  54107. }
  54108. class Area extends _xfa_object.XFAObject {
  54109. constructor(attributes) {
  54110. super(TEMPLATE_NS_ID, "area", true);
  54111. this.colSpan = (0, _utils.getInteger)({
  54112. data: attributes.colSpan,
  54113. defaultValue: 1,
  54114. validate: n => n >= 1 || n === -1
  54115. });
  54116. this.id = attributes.id || "";
  54117. this.name = attributes.name || "";
  54118. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54119. this.use = attributes.use || "";
  54120. this.usehref = attributes.usehref || "";
  54121. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54122. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54123. this.desc = null;
  54124. this.extras = null;
  54125. this.area = new _xfa_object.XFAObjectArray();
  54126. this.draw = new _xfa_object.XFAObjectArray();
  54127. this.exObject = new _xfa_object.XFAObjectArray();
  54128. this.exclGroup = new _xfa_object.XFAObjectArray();
  54129. this.field = new _xfa_object.XFAObjectArray();
  54130. this.subform = new _xfa_object.XFAObjectArray();
  54131. this.subformSet = new _xfa_object.XFAObjectArray();
  54132. }
  54133. *[_xfa_object.$getContainedChildren]() {
  54134. yield* getContainedChildren(this);
  54135. }
  54136. [_xfa_object.$isTransparent]() {
  54137. return true;
  54138. }
  54139. [_xfa_object.$isBindable]() {
  54140. return true;
  54141. }
  54142. [_xfa_object.$addHTML](html, bbox) {
  54143. const [x, y, w, h] = bbox;
  54144. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  54145. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  54146. this[_xfa_object.$extra].children.push(html);
  54147. }
  54148. [_xfa_object.$getAvailableSpace]() {
  54149. return this[_xfa_object.$extra].availableSpace;
  54150. }
  54151. [_xfa_object.$toHTML](availableSpace) {
  54152. const style = (0, _html_utils.toStyle)(this, "position");
  54153. const attributes = {
  54154. style,
  54155. id: this[_xfa_object.$uid],
  54156. class: ["xfaArea"]
  54157. };
  54158. if ((0, _html_utils.isPrintOnly)(this)) {
  54159. attributes.class.push("xfaPrintOnly");
  54160. }
  54161. if (this.name) {
  54162. attributes.xfaName = this.name;
  54163. }
  54164. const children = [];
  54165. this[_xfa_object.$extra] = {
  54166. children,
  54167. width: 0,
  54168. height: 0,
  54169. availableSpace
  54170. };
  54171. const result = this[_xfa_object.$childrenToHTML]({
  54172. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  54173. include: true
  54174. });
  54175. if (!result.success) {
  54176. if (result.isBreak()) {
  54177. return result;
  54178. }
  54179. delete this[_xfa_object.$extra];
  54180. return _utils.HTMLResult.FAILURE;
  54181. }
  54182. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  54183. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  54184. const html = {
  54185. name: "div",
  54186. attributes,
  54187. children
  54188. };
  54189. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  54190. delete this[_xfa_object.$extra];
  54191. return _utils.HTMLResult.success(html, bbox);
  54192. }
  54193. }
  54194. class Assist extends _xfa_object.XFAObject {
  54195. constructor(attributes) {
  54196. super(TEMPLATE_NS_ID, "assist", true);
  54197. this.id = attributes.id || "";
  54198. this.role = attributes.role || "";
  54199. this.use = attributes.use || "";
  54200. this.usehref = attributes.usehref || "";
  54201. this.speak = null;
  54202. this.toolTip = null;
  54203. }
  54204. [_xfa_object.$toHTML]() {
  54205. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  54206. }
  54207. }
  54208. class Barcode extends _xfa_object.XFAObject {
  54209. constructor(attributes) {
  54210. super(TEMPLATE_NS_ID, "barcode", true);
  54211. this.charEncoding = (0, _utils.getKeyword)({
  54212. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  54213. defaultValue: "",
  54214. 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}/)
  54215. });
  54216. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  54217. this.dataColumnCount = (0, _utils.getInteger)({
  54218. data: attributes.dataColumnCount,
  54219. defaultValue: -1,
  54220. validate: x => x >= 0
  54221. });
  54222. this.dataLength = (0, _utils.getInteger)({
  54223. data: attributes.dataLength,
  54224. defaultValue: -1,
  54225. validate: x => x >= 0
  54226. });
  54227. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  54228. this.dataRowCount = (0, _utils.getInteger)({
  54229. data: attributes.dataRowCount,
  54230. defaultValue: -1,
  54231. validate: x => x >= 0
  54232. });
  54233. this.endChar = attributes.endChar || "";
  54234. this.errorCorrectionLevel = (0, _utils.getInteger)({
  54235. data: attributes.errorCorrectionLevel,
  54236. defaultValue: -1,
  54237. validate: x => x >= 0 && x <= 8
  54238. });
  54239. this.id = attributes.id || "";
  54240. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  54241. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  54242. this.printCheckDigit = (0, _utils.getInteger)({
  54243. data: attributes.printCheckDigit,
  54244. defaultValue: 0,
  54245. validate: x => x === 1
  54246. });
  54247. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  54248. this.startChar = attributes.startChar || "";
  54249. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  54250. this.truncate = (0, _utils.getInteger)({
  54251. data: attributes.truncate,
  54252. defaultValue: 0,
  54253. validate: x => x === 1
  54254. });
  54255. 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"]);
  54256. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  54257. this.use = attributes.use || "";
  54258. this.usehref = attributes.usehref || "";
  54259. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  54260. this.encrypt = null;
  54261. this.extras = null;
  54262. }
  54263. }
  54264. class Bind extends _xfa_object.XFAObject {
  54265. constructor(attributes) {
  54266. super(TEMPLATE_NS_ID, "bind", true);
  54267. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  54268. this.ref = attributes.ref || "";
  54269. this.picture = null;
  54270. }
  54271. }
  54272. class BindItems extends _xfa_object.XFAObject {
  54273. constructor(attributes) {
  54274. super(TEMPLATE_NS_ID, "bindItems");
  54275. this.connection = attributes.connection || "";
  54276. this.labelRef = attributes.labelRef || "";
  54277. this.ref = attributes.ref || "";
  54278. this.valueRef = attributes.valueRef || "";
  54279. }
  54280. }
  54281. exports.BindItems = BindItems;
  54282. class Bookend extends _xfa_object.XFAObject {
  54283. constructor(attributes) {
  54284. super(TEMPLATE_NS_ID, "bookend");
  54285. this.id = attributes.id || "";
  54286. this.leader = attributes.leader || "";
  54287. this.trailer = attributes.trailer || "";
  54288. this.use = attributes.use || "";
  54289. this.usehref = attributes.usehref || "";
  54290. }
  54291. }
  54292. class BooleanElement extends _xfa_object.Option01 {
  54293. constructor(attributes) {
  54294. super(TEMPLATE_NS_ID, "boolean");
  54295. this.id = attributes.id || "";
  54296. this.name = attributes.name || "";
  54297. this.use = attributes.use || "";
  54298. this.usehref = attributes.usehref || "";
  54299. }
  54300. [_xfa_object.$toHTML](availableSpace) {
  54301. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  54302. }
  54303. }
  54304. class Border extends _xfa_object.XFAObject {
  54305. constructor(attributes) {
  54306. super(TEMPLATE_NS_ID, "border", true);
  54307. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  54308. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54309. this.id = attributes.id || "";
  54310. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54311. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54312. this.use = attributes.use || "";
  54313. this.usehref = attributes.usehref || "";
  54314. this.corner = new _xfa_object.XFAObjectArray(4);
  54315. this.edge = new _xfa_object.XFAObjectArray(4);
  54316. this.extras = null;
  54317. this.fill = null;
  54318. this.margin = null;
  54319. }
  54320. [_xfa_object.$getExtra]() {
  54321. if (!this[_xfa_object.$extra]) {
  54322. const edges = this.edge.children.slice();
  54323. if (edges.length < 4) {
  54324. const defaultEdge = edges.at(-1) || new Edge({});
  54325. for (let i = edges.length; i < 4; i++) {
  54326. edges.push(defaultEdge);
  54327. }
  54328. }
  54329. const widths = edges.map(edge => edge.thickness);
  54330. const insets = [0, 0, 0, 0];
  54331. if (this.margin) {
  54332. insets[0] = this.margin.topInset;
  54333. insets[1] = this.margin.rightInset;
  54334. insets[2] = this.margin.bottomInset;
  54335. insets[3] = this.margin.leftInset;
  54336. }
  54337. this[_xfa_object.$extra] = {
  54338. widths,
  54339. insets,
  54340. edges
  54341. };
  54342. }
  54343. return this[_xfa_object.$extra];
  54344. }
  54345. [_xfa_object.$toStyle]() {
  54346. const {
  54347. edges
  54348. } = this[_xfa_object.$getExtra]();
  54349. const edgeStyles = edges.map(node => {
  54350. const style = node[_xfa_object.$toStyle]();
  54351. style.color = style.color || "#000000";
  54352. return style;
  54353. });
  54354. const style = Object.create(null);
  54355. if (this.margin) {
  54356. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  54357. }
  54358. if (this.fill && this.fill.presence === "visible") {
  54359. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  54360. }
  54361. if (this.corner.children.some(node => node.radius !== 0)) {
  54362. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  54363. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  54364. const last = cornerStyles.at(-1);
  54365. for (let i = cornerStyles.length; i < 4; i++) {
  54366. cornerStyles.push(last);
  54367. }
  54368. }
  54369. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  54370. }
  54371. switch (this.presence) {
  54372. case "invisible":
  54373. case "hidden":
  54374. style.borderStyle = "";
  54375. break;
  54376. case "inactive":
  54377. style.borderStyle = "none";
  54378. break;
  54379. default:
  54380. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  54381. break;
  54382. }
  54383. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  54384. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  54385. return style;
  54386. }
  54387. }
  54388. class Break extends _xfa_object.XFAObject {
  54389. constructor(attributes) {
  54390. super(TEMPLATE_NS_ID, "break", true);
  54391. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  54392. this.afterTarget = attributes.afterTarget || "";
  54393. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  54394. this.beforeTarget = attributes.beforeTarget || "";
  54395. this.bookendLeader = attributes.bookendLeader || "";
  54396. this.bookendTrailer = attributes.bookendTrailer || "";
  54397. this.id = attributes.id || "";
  54398. this.overflowLeader = attributes.overflowLeader || "";
  54399. this.overflowTarget = attributes.overflowTarget || "";
  54400. this.overflowTrailer = attributes.overflowTrailer || "";
  54401. this.startNew = (0, _utils.getInteger)({
  54402. data: attributes.startNew,
  54403. defaultValue: 0,
  54404. validate: x => x === 1
  54405. });
  54406. this.use = attributes.use || "";
  54407. this.usehref = attributes.usehref || "";
  54408. this.extras = null;
  54409. }
  54410. }
  54411. class BreakAfter extends _xfa_object.XFAObject {
  54412. constructor(attributes) {
  54413. super(TEMPLATE_NS_ID, "breakAfter", true);
  54414. this.id = attributes.id || "";
  54415. this.leader = attributes.leader || "";
  54416. this.startNew = (0, _utils.getInteger)({
  54417. data: attributes.startNew,
  54418. defaultValue: 0,
  54419. validate: x => x === 1
  54420. });
  54421. this.target = attributes.target || "";
  54422. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  54423. this.trailer = attributes.trailer || "";
  54424. this.use = attributes.use || "";
  54425. this.usehref = attributes.usehref || "";
  54426. this.script = null;
  54427. }
  54428. }
  54429. class BreakBefore extends _xfa_object.XFAObject {
  54430. constructor(attributes) {
  54431. super(TEMPLATE_NS_ID, "breakBefore", true);
  54432. this.id = attributes.id || "";
  54433. this.leader = attributes.leader || "";
  54434. this.startNew = (0, _utils.getInteger)({
  54435. data: attributes.startNew,
  54436. defaultValue: 0,
  54437. validate: x => x === 1
  54438. });
  54439. this.target = attributes.target || "";
  54440. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  54441. this.trailer = attributes.trailer || "";
  54442. this.use = attributes.use || "";
  54443. this.usehref = attributes.usehref || "";
  54444. this.script = null;
  54445. }
  54446. [_xfa_object.$toHTML](availableSpace) {
  54447. this[_xfa_object.$extra] = {};
  54448. return _utils.HTMLResult.FAILURE;
  54449. }
  54450. }
  54451. class Button extends _xfa_object.XFAObject {
  54452. constructor(attributes) {
  54453. super(TEMPLATE_NS_ID, "button", true);
  54454. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  54455. this.id = attributes.id || "";
  54456. this.use = attributes.use || "";
  54457. this.usehref = attributes.usehref || "";
  54458. this.extras = null;
  54459. }
  54460. [_xfa_object.$toHTML](availableSpace) {
  54461. const parent = this[_xfa_object.$getParent]();
  54462. const grandpa = parent[_xfa_object.$getParent]();
  54463. const htmlButton = {
  54464. name: "button",
  54465. attributes: {
  54466. id: this[_xfa_object.$uid],
  54467. class: ["xfaButton"],
  54468. style: {}
  54469. },
  54470. children: []
  54471. };
  54472. for (const event of grandpa.event.children) {
  54473. if (event.activity !== "click" || !event.script) {
  54474. continue;
  54475. }
  54476. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  54477. if (!jsURL) {
  54478. continue;
  54479. }
  54480. const href = (0, _html_utils.fixURL)(jsURL.url);
  54481. if (!href) {
  54482. continue;
  54483. }
  54484. htmlButton.children.push({
  54485. name: "a",
  54486. attributes: {
  54487. id: "link" + this[_xfa_object.$uid],
  54488. href,
  54489. newWindow: jsURL.newWindow,
  54490. class: ["xfaLink"],
  54491. style: {}
  54492. },
  54493. children: []
  54494. });
  54495. }
  54496. return _utils.HTMLResult.success(htmlButton);
  54497. }
  54498. }
  54499. class Calculate extends _xfa_object.XFAObject {
  54500. constructor(attributes) {
  54501. super(TEMPLATE_NS_ID, "calculate", true);
  54502. this.id = attributes.id || "";
  54503. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  54504. this.use = attributes.use || "";
  54505. this.usehref = attributes.usehref || "";
  54506. this.extras = null;
  54507. this.message = null;
  54508. this.script = null;
  54509. }
  54510. }
  54511. class Caption extends _xfa_object.XFAObject {
  54512. constructor(attributes) {
  54513. super(TEMPLATE_NS_ID, "caption", true);
  54514. this.id = attributes.id || "";
  54515. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  54516. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54517. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  54518. this.use = attributes.use || "";
  54519. this.usehref = attributes.usehref || "";
  54520. this.extras = null;
  54521. this.font = null;
  54522. this.margin = null;
  54523. this.para = null;
  54524. this.value = null;
  54525. }
  54526. [_xfa_object.$setValue](value) {
  54527. _setValue(this, value);
  54528. }
  54529. [_xfa_object.$getExtra](availableSpace) {
  54530. if (!this[_xfa_object.$extra]) {
  54531. let {
  54532. width,
  54533. height
  54534. } = availableSpace;
  54535. switch (this.placement) {
  54536. case "left":
  54537. case "right":
  54538. case "inline":
  54539. width = this.reserve <= 0 ? width : this.reserve;
  54540. break;
  54541. case "top":
  54542. case "bottom":
  54543. height = this.reserve <= 0 ? height : this.reserve;
  54544. break;
  54545. }
  54546. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  54547. width,
  54548. height
  54549. });
  54550. }
  54551. return this[_xfa_object.$extra];
  54552. }
  54553. [_xfa_object.$toHTML](availableSpace) {
  54554. if (!this.value) {
  54555. return _utils.HTMLResult.EMPTY;
  54556. }
  54557. this[_xfa_object.$pushPara]();
  54558. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  54559. if (!value) {
  54560. this[_xfa_object.$popPara]();
  54561. return _utils.HTMLResult.EMPTY;
  54562. }
  54563. const savedReserve = this.reserve;
  54564. if (this.reserve <= 0) {
  54565. const {
  54566. w,
  54567. h
  54568. } = this[_xfa_object.$getExtra](availableSpace);
  54569. switch (this.placement) {
  54570. case "left":
  54571. case "right":
  54572. case "inline":
  54573. this.reserve = w;
  54574. break;
  54575. case "top":
  54576. case "bottom":
  54577. this.reserve = h;
  54578. break;
  54579. }
  54580. }
  54581. const children = [];
  54582. if (typeof value === "string") {
  54583. children.push({
  54584. name: "#text",
  54585. value
  54586. });
  54587. } else {
  54588. children.push(value);
  54589. }
  54590. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  54591. switch (this.placement) {
  54592. case "left":
  54593. case "right":
  54594. if (this.reserve > 0) {
  54595. style.width = (0, _html_utils.measureToString)(this.reserve);
  54596. }
  54597. break;
  54598. case "top":
  54599. case "bottom":
  54600. if (this.reserve > 0) {
  54601. style.height = (0, _html_utils.measureToString)(this.reserve);
  54602. }
  54603. break;
  54604. }
  54605. (0, _html_utils.setPara)(this, null, value);
  54606. this[_xfa_object.$popPara]();
  54607. this.reserve = savedReserve;
  54608. return _utils.HTMLResult.success({
  54609. name: "div",
  54610. attributes: {
  54611. style,
  54612. class: ["xfaCaption"]
  54613. },
  54614. children
  54615. });
  54616. }
  54617. }
  54618. class Certificate extends _xfa_object.StringObject {
  54619. constructor(attributes) {
  54620. super(TEMPLATE_NS_ID, "certificate");
  54621. this.id = attributes.id || "";
  54622. this.name = attributes.name || "";
  54623. this.use = attributes.use || "";
  54624. this.usehref = attributes.usehref || "";
  54625. }
  54626. }
  54627. class Certificates extends _xfa_object.XFAObject {
  54628. constructor(attributes) {
  54629. super(TEMPLATE_NS_ID, "certificates", true);
  54630. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  54631. this.id = attributes.id || "";
  54632. this.url = attributes.url || "";
  54633. this.urlPolicy = attributes.urlPolicy || "";
  54634. this.use = attributes.use || "";
  54635. this.usehref = attributes.usehref || "";
  54636. this.encryption = null;
  54637. this.issuers = null;
  54638. this.keyUsage = null;
  54639. this.oids = null;
  54640. this.signing = null;
  54641. this.subjectDNs = null;
  54642. }
  54643. }
  54644. class CheckButton extends _xfa_object.XFAObject {
  54645. constructor(attributes) {
  54646. super(TEMPLATE_NS_ID, "checkButton", true);
  54647. this.id = attributes.id || "";
  54648. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  54649. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  54650. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54651. this.use = attributes.use || "";
  54652. this.usehref = attributes.usehref || "";
  54653. this.border = null;
  54654. this.extras = null;
  54655. this.margin = null;
  54656. }
  54657. [_xfa_object.$toHTML](availableSpace) {
  54658. const style = (0, _html_utils.toStyle)("margin");
  54659. const size = (0, _html_utils.measureToString)(this.size);
  54660. style.width = style.height = size;
  54661. let type;
  54662. let className;
  54663. let groupId;
  54664. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54665. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  54666. const exportedValue = {
  54667. on: (items[0] !== undefined ? items[0] : "on").toString(),
  54668. off: (items[1] !== undefined ? items[1] : "off").toString()
  54669. };
  54670. const value = field.value && field.value[_xfa_object.$text]() || "off";
  54671. const checked = value === exportedValue.on || undefined;
  54672. const container = field[_xfa_object.$getSubformParent]();
  54673. const fieldId = field[_xfa_object.$uid];
  54674. let dataId;
  54675. if (container instanceof ExclGroup) {
  54676. groupId = container[_xfa_object.$uid];
  54677. type = "radio";
  54678. className = "xfaRadio";
  54679. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  54680. } else {
  54681. type = "checkbox";
  54682. className = "xfaCheckbox";
  54683. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  54684. }
  54685. const input = {
  54686. name: "input",
  54687. attributes: {
  54688. class: [className],
  54689. style,
  54690. fieldId,
  54691. dataId,
  54692. type,
  54693. checked,
  54694. xfaOn: exportedValue.on,
  54695. xfaOff: exportedValue.off,
  54696. "aria-label": ariaLabel(field),
  54697. "aria-required": false
  54698. }
  54699. };
  54700. if (groupId) {
  54701. input.attributes.name = groupId;
  54702. }
  54703. if (isRequired(field)) {
  54704. input.attributes["aria-required"] = true;
  54705. input.attributes.required = true;
  54706. }
  54707. return _utils.HTMLResult.success({
  54708. name: "label",
  54709. attributes: {
  54710. class: ["xfaLabel"]
  54711. },
  54712. children: [input]
  54713. });
  54714. }
  54715. }
  54716. class ChoiceList extends _xfa_object.XFAObject {
  54717. constructor(attributes) {
  54718. super(TEMPLATE_NS_ID, "choiceList", true);
  54719. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  54720. this.id = attributes.id || "";
  54721. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  54722. this.textEntry = (0, _utils.getInteger)({
  54723. data: attributes.textEntry,
  54724. defaultValue: 0,
  54725. validate: x => x === 1
  54726. });
  54727. this.use = attributes.use || "";
  54728. this.usehref = attributes.usehref || "";
  54729. this.border = null;
  54730. this.extras = null;
  54731. this.margin = null;
  54732. }
  54733. [_xfa_object.$toHTML](availableSpace) {
  54734. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  54735. const ui = this[_xfa_object.$getParent]();
  54736. const field = ui[_xfa_object.$getParent]();
  54737. const fontSize = field.font && field.font.size || 10;
  54738. const optionStyle = {
  54739. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  54740. };
  54741. const children = [];
  54742. if (field.items.children.length > 0) {
  54743. const items = field.items;
  54744. let displayedIndex = 0;
  54745. let saveIndex = 0;
  54746. if (items.children.length === 2) {
  54747. displayedIndex = items.children[0].save;
  54748. saveIndex = 1 - displayedIndex;
  54749. }
  54750. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  54751. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  54752. let selected = false;
  54753. const value = field.value && field.value[_xfa_object.$text]() || "";
  54754. for (let i = 0, ii = displayed.length; i < ii; i++) {
  54755. const option = {
  54756. name: "option",
  54757. attributes: {
  54758. value: values[i] || displayed[i],
  54759. style: optionStyle
  54760. },
  54761. value: displayed[i]
  54762. };
  54763. if (values[i] === value) {
  54764. option.attributes.selected = selected = true;
  54765. }
  54766. children.push(option);
  54767. }
  54768. if (!selected) {
  54769. children.splice(0, 0, {
  54770. name: "option",
  54771. attributes: {
  54772. hidden: true,
  54773. selected: true
  54774. },
  54775. value: " "
  54776. });
  54777. }
  54778. }
  54779. const selectAttributes = {
  54780. class: ["xfaSelect"],
  54781. fieldId: field[_xfa_object.$uid],
  54782. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54783. style,
  54784. "aria-label": ariaLabel(field),
  54785. "aria-required": false
  54786. };
  54787. if (isRequired(field)) {
  54788. selectAttributes["aria-required"] = true;
  54789. selectAttributes.required = true;
  54790. }
  54791. if (this.open === "multiSelect") {
  54792. selectAttributes.multiple = true;
  54793. }
  54794. return _utils.HTMLResult.success({
  54795. name: "label",
  54796. attributes: {
  54797. class: ["xfaLabel"]
  54798. },
  54799. children: [{
  54800. name: "select",
  54801. children,
  54802. attributes: selectAttributes
  54803. }]
  54804. });
  54805. }
  54806. }
  54807. class Color extends _xfa_object.XFAObject {
  54808. constructor(attributes) {
  54809. super(TEMPLATE_NS_ID, "color", true);
  54810. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  54811. this.id = attributes.id || "";
  54812. this.use = attributes.use || "";
  54813. this.usehref = attributes.usehref || "";
  54814. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  54815. this.extras = null;
  54816. }
  54817. [_xfa_object.$hasSettableValue]() {
  54818. return false;
  54819. }
  54820. [_xfa_object.$toStyle]() {
  54821. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  54822. }
  54823. }
  54824. class Comb extends _xfa_object.XFAObject {
  54825. constructor(attributes) {
  54826. super(TEMPLATE_NS_ID, "comb");
  54827. this.id = attributes.id || "";
  54828. this.numberOfCells = (0, _utils.getInteger)({
  54829. data: attributes.numberOfCells,
  54830. defaultValue: 0,
  54831. validate: x => x >= 0
  54832. });
  54833. this.use = attributes.use || "";
  54834. this.usehref = attributes.usehref || "";
  54835. }
  54836. }
  54837. class Connect extends _xfa_object.XFAObject {
  54838. constructor(attributes) {
  54839. super(TEMPLATE_NS_ID, "connect", true);
  54840. this.connection = attributes.connection || "";
  54841. this.id = attributes.id || "";
  54842. this.ref = attributes.ref || "";
  54843. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  54844. this.use = attributes.use || "";
  54845. this.usehref = attributes.usehref || "";
  54846. this.picture = null;
  54847. }
  54848. }
  54849. class ContentArea extends _xfa_object.XFAObject {
  54850. constructor(attributes) {
  54851. super(TEMPLATE_NS_ID, "contentArea", true);
  54852. this.h = (0, _utils.getMeasurement)(attributes.h);
  54853. this.id = attributes.id || "";
  54854. this.name = attributes.name || "";
  54855. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54856. this.use = attributes.use || "";
  54857. this.usehref = attributes.usehref || "";
  54858. this.w = (0, _utils.getMeasurement)(attributes.w);
  54859. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54860. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54861. this.desc = null;
  54862. this.extras = null;
  54863. }
  54864. [_xfa_object.$toHTML](availableSpace) {
  54865. const left = (0, _html_utils.measureToString)(this.x);
  54866. const top = (0, _html_utils.measureToString)(this.y);
  54867. const style = {
  54868. left,
  54869. top,
  54870. width: (0, _html_utils.measureToString)(this.w),
  54871. height: (0, _html_utils.measureToString)(this.h)
  54872. };
  54873. const classNames = ["xfaContentarea"];
  54874. if ((0, _html_utils.isPrintOnly)(this)) {
  54875. classNames.push("xfaPrintOnly");
  54876. }
  54877. return _utils.HTMLResult.success({
  54878. name: "div",
  54879. children: [],
  54880. attributes: {
  54881. style,
  54882. class: classNames,
  54883. id: this[_xfa_object.$uid]
  54884. }
  54885. });
  54886. }
  54887. }
  54888. class Corner extends _xfa_object.XFAObject {
  54889. constructor(attributes) {
  54890. super(TEMPLATE_NS_ID, "corner", true);
  54891. this.id = attributes.id || "";
  54892. this.inverted = (0, _utils.getInteger)({
  54893. data: attributes.inverted,
  54894. defaultValue: 0,
  54895. validate: x => x === 1
  54896. });
  54897. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  54898. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54899. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  54900. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54901. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54902. this.use = attributes.use || "";
  54903. this.usehref = attributes.usehref || "";
  54904. this.color = null;
  54905. this.extras = null;
  54906. }
  54907. [_xfa_object.$toStyle]() {
  54908. const style = (0, _html_utils.toStyle)(this, "visibility");
  54909. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  54910. return style;
  54911. }
  54912. }
  54913. class DateElement extends _xfa_object.ContentObject {
  54914. constructor(attributes) {
  54915. super(TEMPLATE_NS_ID, "date");
  54916. this.id = attributes.id || "";
  54917. this.name = attributes.name || "";
  54918. this.use = attributes.use || "";
  54919. this.usehref = attributes.usehref || "";
  54920. }
  54921. [_xfa_object.$finalize]() {
  54922. const date = this[_xfa_object.$content].trim();
  54923. this[_xfa_object.$content] = date ? new Date(date) : null;
  54924. }
  54925. [_xfa_object.$toHTML](availableSpace) {
  54926. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54927. }
  54928. }
  54929. class DateTime extends _xfa_object.ContentObject {
  54930. constructor(attributes) {
  54931. super(TEMPLATE_NS_ID, "dateTime");
  54932. this.id = attributes.id || "";
  54933. this.name = attributes.name || "";
  54934. this.use = attributes.use || "";
  54935. this.usehref = attributes.usehref || "";
  54936. }
  54937. [_xfa_object.$finalize]() {
  54938. const date = this[_xfa_object.$content].trim();
  54939. this[_xfa_object.$content] = date ? new Date(date) : null;
  54940. }
  54941. [_xfa_object.$toHTML](availableSpace) {
  54942. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54943. }
  54944. }
  54945. class DateTimeEdit extends _xfa_object.XFAObject {
  54946. constructor(attributes) {
  54947. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  54948. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54949. this.id = attributes.id || "";
  54950. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  54951. this.use = attributes.use || "";
  54952. this.usehref = attributes.usehref || "";
  54953. this.border = null;
  54954. this.comb = null;
  54955. this.extras = null;
  54956. this.margin = null;
  54957. }
  54958. [_xfa_object.$toHTML](availableSpace) {
  54959. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54960. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54961. const html = {
  54962. name: "input",
  54963. attributes: {
  54964. type: "text",
  54965. fieldId: field[_xfa_object.$uid],
  54966. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54967. class: ["xfaTextfield"],
  54968. style,
  54969. "aria-label": ariaLabel(field),
  54970. "aria-required": false
  54971. }
  54972. };
  54973. if (isRequired(field)) {
  54974. html.attributes["aria-required"] = true;
  54975. html.attributes.required = true;
  54976. }
  54977. return _utils.HTMLResult.success({
  54978. name: "label",
  54979. attributes: {
  54980. class: ["xfaLabel"]
  54981. },
  54982. children: [html]
  54983. });
  54984. }
  54985. }
  54986. class Decimal extends _xfa_object.ContentObject {
  54987. constructor(attributes) {
  54988. super(TEMPLATE_NS_ID, "decimal");
  54989. this.fracDigits = (0, _utils.getInteger)({
  54990. data: attributes.fracDigits,
  54991. defaultValue: 2,
  54992. validate: x => true
  54993. });
  54994. this.id = attributes.id || "";
  54995. this.leadDigits = (0, _utils.getInteger)({
  54996. data: attributes.leadDigits,
  54997. defaultValue: -1,
  54998. validate: x => true
  54999. });
  55000. this.name = attributes.name || "";
  55001. this.use = attributes.use || "";
  55002. this.usehref = attributes.usehref || "";
  55003. }
  55004. [_xfa_object.$finalize]() {
  55005. const number = parseFloat(this[_xfa_object.$content].trim());
  55006. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55007. }
  55008. [_xfa_object.$toHTML](availableSpace) {
  55009. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55010. }
  55011. }
  55012. class DefaultUi extends _xfa_object.XFAObject {
  55013. constructor(attributes) {
  55014. super(TEMPLATE_NS_ID, "defaultUi", true);
  55015. this.id = attributes.id || "";
  55016. this.use = attributes.use || "";
  55017. this.usehref = attributes.usehref || "";
  55018. this.extras = null;
  55019. }
  55020. }
  55021. class Desc extends _xfa_object.XFAObject {
  55022. constructor(attributes) {
  55023. super(TEMPLATE_NS_ID, "desc", true);
  55024. this.id = attributes.id || "";
  55025. this.use = attributes.use || "";
  55026. this.usehref = attributes.usehref || "";
  55027. this.boolean = new _xfa_object.XFAObjectArray();
  55028. this.date = new _xfa_object.XFAObjectArray();
  55029. this.dateTime = new _xfa_object.XFAObjectArray();
  55030. this.decimal = new _xfa_object.XFAObjectArray();
  55031. this.exData = new _xfa_object.XFAObjectArray();
  55032. this.float = new _xfa_object.XFAObjectArray();
  55033. this.image = new _xfa_object.XFAObjectArray();
  55034. this.integer = new _xfa_object.XFAObjectArray();
  55035. this.text = new _xfa_object.XFAObjectArray();
  55036. this.time = new _xfa_object.XFAObjectArray();
  55037. }
  55038. }
  55039. class DigestMethod extends _xfa_object.OptionObject {
  55040. constructor(attributes) {
  55041. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  55042. this.id = attributes.id || "";
  55043. this.use = attributes.use || "";
  55044. this.usehref = attributes.usehref || "";
  55045. }
  55046. }
  55047. class DigestMethods extends _xfa_object.XFAObject {
  55048. constructor(attributes) {
  55049. super(TEMPLATE_NS_ID, "digestMethods", true);
  55050. this.id = attributes.id || "";
  55051. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55052. this.use = attributes.use || "";
  55053. this.usehref = attributes.usehref || "";
  55054. this.digestMethod = new _xfa_object.XFAObjectArray();
  55055. }
  55056. }
  55057. class Draw extends _xfa_object.XFAObject {
  55058. constructor(attributes) {
  55059. super(TEMPLATE_NS_ID, "draw", true);
  55060. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55061. this.colSpan = (0, _utils.getInteger)({
  55062. data: attributes.colSpan,
  55063. defaultValue: 1,
  55064. validate: n => n >= 1 || n === -1
  55065. });
  55066. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55067. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55068. this.id = attributes.id || "";
  55069. this.locale = attributes.locale || "";
  55070. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55071. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55072. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55073. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55074. this.name = attributes.name || "";
  55075. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55076. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55077. this.rotate = (0, _utils.getInteger)({
  55078. data: attributes.rotate,
  55079. defaultValue: 0,
  55080. validate: x => x % 90 === 0
  55081. });
  55082. this.use = attributes.use || "";
  55083. this.usehref = attributes.usehref || "";
  55084. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55085. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55086. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55087. this.assist = null;
  55088. this.border = null;
  55089. this.caption = null;
  55090. this.desc = null;
  55091. this.extras = null;
  55092. this.font = null;
  55093. this.keep = null;
  55094. this.margin = null;
  55095. this.para = null;
  55096. this.traversal = null;
  55097. this.ui = null;
  55098. this.value = null;
  55099. this.setProperty = new _xfa_object.XFAObjectArray();
  55100. }
  55101. [_xfa_object.$setValue](value) {
  55102. _setValue(this, value);
  55103. }
  55104. [_xfa_object.$toHTML](availableSpace) {
  55105. setTabIndex(this);
  55106. if (this.presence === "hidden" || this.presence === "inactive") {
  55107. return _utils.HTMLResult.EMPTY;
  55108. }
  55109. (0, _html_utils.fixDimensions)(this);
  55110. this[_xfa_object.$pushPara]();
  55111. const savedW = this.w;
  55112. const savedH = this.h;
  55113. const {
  55114. w,
  55115. h,
  55116. isBroken
  55117. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55118. if (w && this.w === "") {
  55119. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55120. this[_xfa_object.$popPara]();
  55121. return _utils.HTMLResult.FAILURE;
  55122. }
  55123. this.w = w;
  55124. }
  55125. if (h && this.h === "") {
  55126. this.h = h;
  55127. }
  55128. setFirstUnsplittable(this);
  55129. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55130. this.w = savedW;
  55131. this.h = savedH;
  55132. this[_xfa_object.$popPara]();
  55133. return _utils.HTMLResult.FAILURE;
  55134. }
  55135. unsetFirstUnsplittable(this);
  55136. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  55137. (0, _html_utils.setMinMaxDimensions)(this, style);
  55138. if (style.margin) {
  55139. style.padding = style.margin;
  55140. delete style.margin;
  55141. }
  55142. const classNames = ["xfaDraw"];
  55143. if (this.font) {
  55144. classNames.push("xfaFont");
  55145. }
  55146. if ((0, _html_utils.isPrintOnly)(this)) {
  55147. classNames.push("xfaPrintOnly");
  55148. }
  55149. const attributes = {
  55150. style,
  55151. id: this[_xfa_object.$uid],
  55152. class: classNames
  55153. };
  55154. if (this.name) {
  55155. attributes.xfaName = this.name;
  55156. }
  55157. const html = {
  55158. name: "div",
  55159. attributes,
  55160. children: []
  55161. };
  55162. applyAssist(this, attributes);
  55163. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55164. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  55165. if (value === null) {
  55166. this.w = savedW;
  55167. this.h = savedH;
  55168. this[_xfa_object.$popPara]();
  55169. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55170. }
  55171. html.children.push(value);
  55172. (0, _html_utils.setPara)(this, style, value);
  55173. this.w = savedW;
  55174. this.h = savedH;
  55175. this[_xfa_object.$popPara]();
  55176. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55177. }
  55178. }
  55179. class Edge extends _xfa_object.XFAObject {
  55180. constructor(attributes) {
  55181. super(TEMPLATE_NS_ID, "edge", true);
  55182. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  55183. this.id = attributes.id || "";
  55184. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55185. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  55186. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  55187. this.use = attributes.use || "";
  55188. this.usehref = attributes.usehref || "";
  55189. this.color = null;
  55190. this.extras = null;
  55191. }
  55192. [_xfa_object.$toStyle]() {
  55193. const style = (0, _html_utils.toStyle)(this, "visibility");
  55194. Object.assign(style, {
  55195. linecap: this.cap,
  55196. width: (0, _html_utils.measureToString)(this.thickness),
  55197. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  55198. style: ""
  55199. });
  55200. if (this.presence !== "visible") {
  55201. style.style = "none";
  55202. } else {
  55203. switch (this.stroke) {
  55204. case "solid":
  55205. style.style = "solid";
  55206. break;
  55207. case "dashDot":
  55208. style.style = "dashed";
  55209. break;
  55210. case "dashDotDot":
  55211. style.style = "dashed";
  55212. break;
  55213. case "dashed":
  55214. style.style = "dashed";
  55215. break;
  55216. case "dotted":
  55217. style.style = "dotted";
  55218. break;
  55219. case "embossed":
  55220. style.style = "ridge";
  55221. break;
  55222. case "etched":
  55223. style.style = "groove";
  55224. break;
  55225. case "lowered":
  55226. style.style = "inset";
  55227. break;
  55228. case "raised":
  55229. style.style = "outset";
  55230. break;
  55231. }
  55232. }
  55233. return style;
  55234. }
  55235. }
  55236. class Encoding extends _xfa_object.OptionObject {
  55237. constructor(attributes) {
  55238. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  55239. this.id = attributes.id || "";
  55240. this.use = attributes.use || "";
  55241. this.usehref = attributes.usehref || "";
  55242. }
  55243. }
  55244. class Encodings extends _xfa_object.XFAObject {
  55245. constructor(attributes) {
  55246. super(TEMPLATE_NS_ID, "encodings", true);
  55247. this.id = attributes.id || "";
  55248. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55249. this.use = attributes.use || "";
  55250. this.usehref = attributes.usehref || "";
  55251. this.encoding = new _xfa_object.XFAObjectArray();
  55252. }
  55253. }
  55254. class Encrypt extends _xfa_object.XFAObject {
  55255. constructor(attributes) {
  55256. super(TEMPLATE_NS_ID, "encrypt", true);
  55257. this.id = attributes.id || "";
  55258. this.use = attributes.use || "";
  55259. this.usehref = attributes.usehref || "";
  55260. this.certificate = null;
  55261. }
  55262. }
  55263. class EncryptData extends _xfa_object.XFAObject {
  55264. constructor(attributes) {
  55265. super(TEMPLATE_NS_ID, "encryptData", true);
  55266. this.id = attributes.id || "";
  55267. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  55268. this.target = attributes.target || "";
  55269. this.use = attributes.use || "";
  55270. this.usehref = attributes.usehref || "";
  55271. this.filter = null;
  55272. this.manifest = null;
  55273. }
  55274. }
  55275. class Encryption extends _xfa_object.XFAObject {
  55276. constructor(attributes) {
  55277. super(TEMPLATE_NS_ID, "encryption", true);
  55278. this.id = attributes.id || "";
  55279. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55280. this.use = attributes.use || "";
  55281. this.usehref = attributes.usehref || "";
  55282. this.certificate = new _xfa_object.XFAObjectArray();
  55283. }
  55284. }
  55285. class EncryptionMethod extends _xfa_object.OptionObject {
  55286. constructor(attributes) {
  55287. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  55288. this.id = attributes.id || "";
  55289. this.use = attributes.use || "";
  55290. this.usehref = attributes.usehref || "";
  55291. }
  55292. }
  55293. class EncryptionMethods extends _xfa_object.XFAObject {
  55294. constructor(attributes) {
  55295. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  55296. this.id = attributes.id || "";
  55297. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55298. this.use = attributes.use || "";
  55299. this.usehref = attributes.usehref || "";
  55300. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  55301. }
  55302. }
  55303. class Event extends _xfa_object.XFAObject {
  55304. constructor(attributes) {
  55305. super(TEMPLATE_NS_ID, "event", true);
  55306. 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"]);
  55307. this.id = attributes.id || "";
  55308. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  55309. this.name = attributes.name || "";
  55310. this.ref = attributes.ref || "";
  55311. this.use = attributes.use || "";
  55312. this.usehref = attributes.usehref || "";
  55313. this.extras = null;
  55314. this.encryptData = null;
  55315. this.execute = null;
  55316. this.script = null;
  55317. this.signData = null;
  55318. this.submit = null;
  55319. }
  55320. }
  55321. class ExData extends _xfa_object.ContentObject {
  55322. constructor(attributes) {
  55323. super(TEMPLATE_NS_ID, "exData");
  55324. this.contentType = attributes.contentType || "";
  55325. this.href = attributes.href || "";
  55326. this.id = attributes.id || "";
  55327. this.maxLength = (0, _utils.getInteger)({
  55328. data: attributes.maxLength,
  55329. defaultValue: -1,
  55330. validate: x => x >= -1
  55331. });
  55332. this.name = attributes.name || "";
  55333. this.rid = attributes.rid || "";
  55334. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  55335. this.use = attributes.use || "";
  55336. this.usehref = attributes.usehref || "";
  55337. }
  55338. [_xfa_object.$isCDATAXml]() {
  55339. return this.contentType === "text/html";
  55340. }
  55341. [_xfa_object.$onChild](child) {
  55342. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  55343. this[_xfa_object.$content] = child;
  55344. return true;
  55345. }
  55346. if (this.contentType === "text/xml") {
  55347. this[_xfa_object.$content] = child;
  55348. return true;
  55349. }
  55350. return false;
  55351. }
  55352. [_xfa_object.$toHTML](availableSpace) {
  55353. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  55354. return _utils.HTMLResult.EMPTY;
  55355. }
  55356. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  55357. }
  55358. }
  55359. class ExObject extends _xfa_object.XFAObject {
  55360. constructor(attributes) {
  55361. super(TEMPLATE_NS_ID, "exObject", true);
  55362. this.archive = attributes.archive || "";
  55363. this.classId = attributes.classId || "";
  55364. this.codeBase = attributes.codeBase || "";
  55365. this.codeType = attributes.codeType || "";
  55366. this.id = attributes.id || "";
  55367. this.name = attributes.name || "";
  55368. this.use = attributes.use || "";
  55369. this.usehref = attributes.usehref || "";
  55370. this.extras = null;
  55371. this.boolean = new _xfa_object.XFAObjectArray();
  55372. this.date = new _xfa_object.XFAObjectArray();
  55373. this.dateTime = new _xfa_object.XFAObjectArray();
  55374. this.decimal = new _xfa_object.XFAObjectArray();
  55375. this.exData = new _xfa_object.XFAObjectArray();
  55376. this.exObject = new _xfa_object.XFAObjectArray();
  55377. this.float = new _xfa_object.XFAObjectArray();
  55378. this.image = new _xfa_object.XFAObjectArray();
  55379. this.integer = new _xfa_object.XFAObjectArray();
  55380. this.text = new _xfa_object.XFAObjectArray();
  55381. this.time = new _xfa_object.XFAObjectArray();
  55382. }
  55383. }
  55384. class ExclGroup extends _xfa_object.XFAObject {
  55385. constructor(attributes) {
  55386. super(TEMPLATE_NS_ID, "exclGroup", true);
  55387. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55388. this.accessKey = attributes.accessKey || "";
  55389. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55390. this.colSpan = (0, _utils.getInteger)({
  55391. data: attributes.colSpan,
  55392. defaultValue: 1,
  55393. validate: n => n >= 1 || n === -1
  55394. });
  55395. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55396. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55397. this.id = attributes.id || "";
  55398. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  55399. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55400. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55401. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55402. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55403. this.name = attributes.name || "";
  55404. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55405. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55406. this.use = attributes.use || "";
  55407. this.usehref = attributes.usehref || "";
  55408. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55409. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55410. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55411. this.assist = null;
  55412. this.bind = null;
  55413. this.border = null;
  55414. this.calculate = null;
  55415. this.caption = null;
  55416. this.desc = null;
  55417. this.extras = null;
  55418. this.margin = null;
  55419. this.para = null;
  55420. this.traversal = null;
  55421. this.validate = null;
  55422. this.connect = new _xfa_object.XFAObjectArray();
  55423. this.event = new _xfa_object.XFAObjectArray();
  55424. this.field = new _xfa_object.XFAObjectArray();
  55425. this.setProperty = new _xfa_object.XFAObjectArray();
  55426. }
  55427. [_xfa_object.$isBindable]() {
  55428. return true;
  55429. }
  55430. [_xfa_object.$hasSettableValue]() {
  55431. return true;
  55432. }
  55433. [_xfa_object.$setValue](value) {
  55434. for (const field of this.field.children) {
  55435. if (!field.value) {
  55436. const nodeValue = new Value({});
  55437. field[_xfa_object.$appendChild](nodeValue);
  55438. field.value = nodeValue;
  55439. }
  55440. field.value[_xfa_object.$setValue](value);
  55441. }
  55442. }
  55443. [_xfa_object.$isThereMoreWidth]() {
  55444. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  55445. }
  55446. [_xfa_object.$isSplittable]() {
  55447. const parent = this[_xfa_object.$getSubformParent]();
  55448. if (!parent[_xfa_object.$isSplittable]()) {
  55449. return false;
  55450. }
  55451. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  55452. return this[_xfa_object.$extra]._isSplittable;
  55453. }
  55454. if (this.layout === "position" || this.layout.includes("row")) {
  55455. this[_xfa_object.$extra]._isSplittable = false;
  55456. return false;
  55457. }
  55458. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  55459. return false;
  55460. }
  55461. this[_xfa_object.$extra]._isSplittable = true;
  55462. return true;
  55463. }
  55464. [_xfa_object.$flushHTML]() {
  55465. return (0, _layout.flushHTML)(this);
  55466. }
  55467. [_xfa_object.$addHTML](html, bbox) {
  55468. (0, _layout.addHTML)(this, html, bbox);
  55469. }
  55470. [_xfa_object.$getAvailableSpace]() {
  55471. return (0, _layout.getAvailableSpace)(this);
  55472. }
  55473. [_xfa_object.$toHTML](availableSpace) {
  55474. setTabIndex(this);
  55475. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55476. return _utils.HTMLResult.EMPTY;
  55477. }
  55478. (0, _html_utils.fixDimensions)(this);
  55479. const children = [];
  55480. const attributes = {
  55481. id: this[_xfa_object.$uid],
  55482. class: []
  55483. };
  55484. (0, _html_utils.setAccess)(this, attributes.class);
  55485. if (!this[_xfa_object.$extra]) {
  55486. this[_xfa_object.$extra] = Object.create(null);
  55487. }
  55488. Object.assign(this[_xfa_object.$extra], {
  55489. children,
  55490. attributes,
  55491. attempt: 0,
  55492. line: null,
  55493. numberInLine: 0,
  55494. availableSpace: {
  55495. width: Math.min(this.w || Infinity, availableSpace.width),
  55496. height: Math.min(this.h || Infinity, availableSpace.height)
  55497. },
  55498. width: 0,
  55499. height: 0,
  55500. prevHeight: 0,
  55501. currentWidth: 0
  55502. });
  55503. const isSplittable = this[_xfa_object.$isSplittable]();
  55504. if (!isSplittable) {
  55505. setFirstUnsplittable(this);
  55506. }
  55507. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55508. return _utils.HTMLResult.FAILURE;
  55509. }
  55510. const filter = new Set(["field"]);
  55511. if (this.layout.includes("row")) {
  55512. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  55513. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  55514. this[_xfa_object.$extra].columnWidths = columnWidths;
  55515. this[_xfa_object.$extra].currentColumn = 0;
  55516. }
  55517. }
  55518. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  55519. const classNames = ["xfaExclgroup"];
  55520. const cl = (0, _html_utils.layoutClass)(this);
  55521. if (cl) {
  55522. classNames.push(cl);
  55523. }
  55524. if ((0, _html_utils.isPrintOnly)(this)) {
  55525. classNames.push("xfaPrintOnly");
  55526. }
  55527. attributes.style = style;
  55528. attributes.class = classNames;
  55529. if (this.name) {
  55530. attributes.xfaName = this.name;
  55531. }
  55532. this[_xfa_object.$pushPara]();
  55533. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55534. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55535. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55536. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55537. this[_xfa_object.$extra].numberInLine = 0;
  55538. }
  55539. const result = this[_xfa_object.$childrenToHTML]({
  55540. filter,
  55541. include: true
  55542. });
  55543. if (result.success) {
  55544. break;
  55545. }
  55546. if (result.isBreak()) {
  55547. this[_xfa_object.$popPara]();
  55548. return result;
  55549. }
  55550. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55551. this[_xfa_object.$extra].attempt = maxRun;
  55552. break;
  55553. }
  55554. }
  55555. this[_xfa_object.$popPara]();
  55556. if (!isSplittable) {
  55557. unsetFirstUnsplittable(this);
  55558. }
  55559. if (this[_xfa_object.$extra].attempt === maxRun) {
  55560. if (!isSplittable) {
  55561. delete this[_xfa_object.$extra];
  55562. }
  55563. return _utils.HTMLResult.FAILURE;
  55564. }
  55565. let marginH = 0;
  55566. let marginV = 0;
  55567. if (this.margin) {
  55568. marginH = this.margin.leftInset + this.margin.rightInset;
  55569. marginV = this.margin.topInset + this.margin.bottomInset;
  55570. }
  55571. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55572. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55573. const bbox = [this.x, this.y, width, height];
  55574. if (this.w === "") {
  55575. style.width = (0, _html_utils.measureToString)(width);
  55576. }
  55577. if (this.h === "") {
  55578. style.height = (0, _html_utils.measureToString)(height);
  55579. }
  55580. const html = {
  55581. name: "div",
  55582. attributes,
  55583. children
  55584. };
  55585. applyAssist(this, attributes);
  55586. delete this[_xfa_object.$extra];
  55587. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55588. }
  55589. }
  55590. class Execute extends _xfa_object.XFAObject {
  55591. constructor(attributes) {
  55592. super(TEMPLATE_NS_ID, "execute");
  55593. this.connection = attributes.connection || "";
  55594. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  55595. this.id = attributes.id || "";
  55596. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55597. this.use = attributes.use || "";
  55598. this.usehref = attributes.usehref || "";
  55599. }
  55600. }
  55601. class Extras extends _xfa_object.XFAObject {
  55602. constructor(attributes) {
  55603. super(TEMPLATE_NS_ID, "extras", true);
  55604. this.id = attributes.id || "";
  55605. this.name = attributes.name || "";
  55606. this.use = attributes.use || "";
  55607. this.usehref = attributes.usehref || "";
  55608. this.boolean = new _xfa_object.XFAObjectArray();
  55609. this.date = new _xfa_object.XFAObjectArray();
  55610. this.dateTime = new _xfa_object.XFAObjectArray();
  55611. this.decimal = new _xfa_object.XFAObjectArray();
  55612. this.exData = new _xfa_object.XFAObjectArray();
  55613. this.extras = new _xfa_object.XFAObjectArray();
  55614. this.float = new _xfa_object.XFAObjectArray();
  55615. this.image = new _xfa_object.XFAObjectArray();
  55616. this.integer = new _xfa_object.XFAObjectArray();
  55617. this.text = new _xfa_object.XFAObjectArray();
  55618. this.time = new _xfa_object.XFAObjectArray();
  55619. }
  55620. }
  55621. class Field extends _xfa_object.XFAObject {
  55622. constructor(attributes) {
  55623. super(TEMPLATE_NS_ID, "field", true);
  55624. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55625. this.accessKey = attributes.accessKey || "";
  55626. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55627. this.colSpan = (0, _utils.getInteger)({
  55628. data: attributes.colSpan,
  55629. defaultValue: 1,
  55630. validate: n => n >= 1 || n === -1
  55631. });
  55632. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55633. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55634. this.id = attributes.id || "";
  55635. this.locale = attributes.locale || "";
  55636. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55637. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55638. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55639. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55640. this.name = attributes.name || "";
  55641. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55642. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55643. this.rotate = (0, _utils.getInteger)({
  55644. data: attributes.rotate,
  55645. defaultValue: 0,
  55646. validate: x => x % 90 === 0
  55647. });
  55648. this.use = attributes.use || "";
  55649. this.usehref = attributes.usehref || "";
  55650. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55651. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55652. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55653. this.assist = null;
  55654. this.bind = null;
  55655. this.border = null;
  55656. this.calculate = null;
  55657. this.caption = null;
  55658. this.desc = null;
  55659. this.extras = null;
  55660. this.font = null;
  55661. this.format = null;
  55662. this.items = new _xfa_object.XFAObjectArray(2);
  55663. this.keep = null;
  55664. this.margin = null;
  55665. this.para = null;
  55666. this.traversal = null;
  55667. this.ui = null;
  55668. this.validate = null;
  55669. this.value = null;
  55670. this.bindItems = new _xfa_object.XFAObjectArray();
  55671. this.connect = new _xfa_object.XFAObjectArray();
  55672. this.event = new _xfa_object.XFAObjectArray();
  55673. this.setProperty = new _xfa_object.XFAObjectArray();
  55674. }
  55675. [_xfa_object.$isBindable]() {
  55676. return true;
  55677. }
  55678. [_xfa_object.$setValue](value) {
  55679. _setValue(this, value);
  55680. }
  55681. [_xfa_object.$toHTML](availableSpace) {
  55682. setTabIndex(this);
  55683. if (!this.ui) {
  55684. this.ui = new Ui({});
  55685. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55686. this[_xfa_object.$appendChild](this.ui);
  55687. let node;
  55688. switch (this.items.children.length) {
  55689. case 0:
  55690. node = new TextEdit({});
  55691. this.ui.textEdit = node;
  55692. break;
  55693. case 1:
  55694. node = new CheckButton({});
  55695. this.ui.checkButton = node;
  55696. break;
  55697. case 2:
  55698. node = new ChoiceList({});
  55699. this.ui.choiceList = node;
  55700. break;
  55701. }
  55702. this.ui[_xfa_object.$appendChild](node);
  55703. }
  55704. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55705. return _utils.HTMLResult.EMPTY;
  55706. }
  55707. if (this.caption) {
  55708. delete this.caption[_xfa_object.$extra];
  55709. }
  55710. this[_xfa_object.$pushPara]();
  55711. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  55712. const savedW = this.w;
  55713. const savedH = this.h;
  55714. let marginH = 0;
  55715. let marginV = 0;
  55716. if (this.margin) {
  55717. marginH = this.margin.leftInset + this.margin.rightInset;
  55718. marginV = this.margin.topInset + this.margin.bottomInset;
  55719. }
  55720. let borderDims = null;
  55721. if (this.w === "" || this.h === "") {
  55722. let width = null;
  55723. let height = null;
  55724. let uiW = 0;
  55725. let uiH = 0;
  55726. if (this.ui.checkButton) {
  55727. uiW = uiH = this.ui.checkButton.size;
  55728. } else {
  55729. const {
  55730. w,
  55731. h
  55732. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55733. if (w !== null) {
  55734. uiW = w;
  55735. uiH = h;
  55736. } else {
  55737. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  55738. }
  55739. }
  55740. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  55741. uiW += borderDims.w;
  55742. uiH += borderDims.h;
  55743. if (this.caption) {
  55744. const {
  55745. w,
  55746. h,
  55747. isBroken
  55748. } = this.caption[_xfa_object.$getExtra](availableSpace);
  55749. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55750. this[_xfa_object.$popPara]();
  55751. return _utils.HTMLResult.FAILURE;
  55752. }
  55753. width = w;
  55754. height = h;
  55755. switch (this.caption.placement) {
  55756. case "left":
  55757. case "right":
  55758. case "inline":
  55759. width += uiW;
  55760. break;
  55761. case "top":
  55762. case "bottom":
  55763. height += uiH;
  55764. break;
  55765. }
  55766. } else {
  55767. width = uiW;
  55768. height = uiH;
  55769. }
  55770. if (width && this.w === "") {
  55771. width += marginH;
  55772. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  55773. }
  55774. if (height && this.h === "") {
  55775. height += marginV;
  55776. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  55777. }
  55778. }
  55779. this[_xfa_object.$popPara]();
  55780. (0, _html_utils.fixDimensions)(this);
  55781. setFirstUnsplittable(this);
  55782. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55783. this.w = savedW;
  55784. this.h = savedH;
  55785. this[_xfa_object.$popPara]();
  55786. return _utils.HTMLResult.FAILURE;
  55787. }
  55788. unsetFirstUnsplittable(this);
  55789. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  55790. (0, _html_utils.setMinMaxDimensions)(this, style);
  55791. const classNames = ["xfaField"];
  55792. if (this.font) {
  55793. classNames.push("xfaFont");
  55794. }
  55795. if ((0, _html_utils.isPrintOnly)(this)) {
  55796. classNames.push("xfaPrintOnly");
  55797. }
  55798. const attributes = {
  55799. style,
  55800. id: this[_xfa_object.$uid],
  55801. class: classNames
  55802. };
  55803. if (style.margin) {
  55804. style.padding = style.margin;
  55805. delete style.margin;
  55806. }
  55807. (0, _html_utils.setAccess)(this, classNames);
  55808. if (this.name) {
  55809. attributes.xfaName = this.name;
  55810. }
  55811. const children = [];
  55812. const html = {
  55813. name: "div",
  55814. attributes,
  55815. children
  55816. };
  55817. applyAssist(this, attributes);
  55818. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  55819. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55820. const ui = this.ui[_xfa_object.$toHTML]().html;
  55821. if (!ui) {
  55822. Object.assign(style, borderStyle);
  55823. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55824. }
  55825. if (this[_xfa_object.$tabIndex]) {
  55826. if (ui.children && ui.children[0]) {
  55827. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  55828. } else {
  55829. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  55830. }
  55831. }
  55832. if (!ui.attributes.style) {
  55833. ui.attributes.style = Object.create(null);
  55834. }
  55835. let aElement = null;
  55836. if (this.ui.button) {
  55837. if (ui.children.length === 1) {
  55838. [aElement] = ui.children.splice(0, 1);
  55839. }
  55840. Object.assign(ui.attributes.style, borderStyle);
  55841. } else {
  55842. Object.assign(style, borderStyle);
  55843. }
  55844. children.push(ui);
  55845. if (this.value) {
  55846. if (this.ui.imageEdit) {
  55847. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  55848. } else if (!this.ui.button) {
  55849. let value = "";
  55850. if (this.value.exData) {
  55851. value = this.value.exData[_xfa_object.$text]();
  55852. } else if (this.value.text) {
  55853. value = this.value.text[_xfa_object.$getExtra]();
  55854. } else {
  55855. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  55856. if (htmlValue !== null) {
  55857. value = htmlValue.children[0].value;
  55858. }
  55859. }
  55860. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  55861. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  55862. }
  55863. if (value) {
  55864. if (this.ui.numericEdit) {
  55865. value = parseFloat(value);
  55866. value = isNaN(value) ? "" : value.toString();
  55867. }
  55868. if (ui.children[0].name === "textarea") {
  55869. ui.children[0].attributes.textContent = value;
  55870. } else {
  55871. ui.children[0].attributes.value = value;
  55872. }
  55873. }
  55874. }
  55875. }
  55876. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  55877. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  55878. let captionHeight = 0;
  55879. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  55880. captionHeight = this.caption.reserve;
  55881. if (captionHeight <= 0) {
  55882. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  55883. }
  55884. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  55885. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  55886. } else {
  55887. ui.children[0].attributes.style.height = "100%";
  55888. }
  55889. }
  55890. if (aElement) {
  55891. ui.children.push(aElement);
  55892. }
  55893. if (!caption) {
  55894. if (ui.attributes.class) {
  55895. ui.attributes.class.push("xfaLeft");
  55896. }
  55897. this.w = savedW;
  55898. this.h = savedH;
  55899. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55900. }
  55901. if (this.ui.button) {
  55902. if (style.padding) {
  55903. delete style.padding;
  55904. }
  55905. if (caption.name === "div") {
  55906. caption.name = "span";
  55907. }
  55908. ui.children.push(caption);
  55909. return _utils.HTMLResult.success(html, bbox);
  55910. } else if (this.ui.checkButton) {
  55911. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  55912. }
  55913. if (!ui.attributes.class) {
  55914. ui.attributes.class = [];
  55915. }
  55916. ui.children.splice(0, 0, caption);
  55917. switch (this.caption.placement) {
  55918. case "left":
  55919. ui.attributes.class.push("xfaLeft");
  55920. break;
  55921. case "right":
  55922. ui.attributes.class.push("xfaRight");
  55923. break;
  55924. case "top":
  55925. ui.attributes.class.push("xfaTop");
  55926. break;
  55927. case "bottom":
  55928. ui.attributes.class.push("xfaBottom");
  55929. break;
  55930. case "inline":
  55931. ui.attributes.class.push("xfaLeft");
  55932. break;
  55933. }
  55934. this.w = savedW;
  55935. this.h = savedH;
  55936. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55937. }
  55938. }
  55939. exports.Field = Field;
  55940. class Fill extends _xfa_object.XFAObject {
  55941. constructor(attributes) {
  55942. super(TEMPLATE_NS_ID, "fill", true);
  55943. this.id = attributes.id || "";
  55944. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55945. this.use = attributes.use || "";
  55946. this.usehref = attributes.usehref || "";
  55947. this.color = null;
  55948. this.extras = null;
  55949. this.linear = null;
  55950. this.pattern = null;
  55951. this.radial = null;
  55952. this.solid = null;
  55953. this.stipple = null;
  55954. }
  55955. [_xfa_object.$toStyle]() {
  55956. const parent = this[_xfa_object.$getParent]();
  55957. const grandpa = parent[_xfa_object.$getParent]();
  55958. const ggrandpa = grandpa[_xfa_object.$getParent]();
  55959. const style = Object.create(null);
  55960. let propName = "color";
  55961. let altPropName = propName;
  55962. if (parent instanceof Border) {
  55963. propName = "background-color";
  55964. altPropName = "background";
  55965. if (ggrandpa instanceof Ui) {
  55966. style.backgroundColor = "white";
  55967. }
  55968. }
  55969. if (parent instanceof Rectangle || parent instanceof Arc) {
  55970. propName = altPropName = "fill";
  55971. style.fill = "white";
  55972. }
  55973. for (const name of Object.getOwnPropertyNames(this)) {
  55974. if (name === "extras" || name === "color") {
  55975. continue;
  55976. }
  55977. const obj = this[name];
  55978. if (!(obj instanceof _xfa_object.XFAObject)) {
  55979. continue;
  55980. }
  55981. const color = obj[_xfa_object.$toStyle](this.color);
  55982. if (color) {
  55983. style[color.startsWith("#") ? propName : altPropName] = color;
  55984. }
  55985. return style;
  55986. }
  55987. if (this.color && this.color.value) {
  55988. const color = this.color[_xfa_object.$toStyle]();
  55989. style[color.startsWith("#") ? propName : altPropName] = color;
  55990. }
  55991. return style;
  55992. }
  55993. }
  55994. class Filter extends _xfa_object.XFAObject {
  55995. constructor(attributes) {
  55996. super(TEMPLATE_NS_ID, "filter", true);
  55997. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  55998. this.id = attributes.id || "";
  55999. this.name = attributes.name || "";
  56000. this.use = attributes.use || "";
  56001. this.usehref = attributes.usehref || "";
  56002. this.version = (0, _utils.getInteger)({
  56003. data: this.version,
  56004. defaultValue: 5,
  56005. validate: x => x >= 1 && x <= 5
  56006. });
  56007. this.appearanceFilter = null;
  56008. this.certificates = null;
  56009. this.digestMethods = null;
  56010. this.encodings = null;
  56011. this.encryptionMethods = null;
  56012. this.handler = null;
  56013. this.lockDocument = null;
  56014. this.mdp = null;
  56015. this.reasons = null;
  56016. this.timeStamp = null;
  56017. }
  56018. }
  56019. class Float extends _xfa_object.ContentObject {
  56020. constructor(attributes) {
  56021. super(TEMPLATE_NS_ID, "float");
  56022. this.id = attributes.id || "";
  56023. this.name = attributes.name || "";
  56024. this.use = attributes.use || "";
  56025. this.usehref = attributes.usehref || "";
  56026. }
  56027. [_xfa_object.$finalize]() {
  56028. const number = parseFloat(this[_xfa_object.$content].trim());
  56029. this[_xfa_object.$content] = isNaN(number) ? null : number;
  56030. }
  56031. [_xfa_object.$toHTML](availableSpace) {
  56032. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  56033. }
  56034. }
  56035. class Font extends _xfa_object.XFAObject {
  56036. constructor(attributes) {
  56037. super(TEMPLATE_NS_ID, "font", true);
  56038. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  56039. this.fontHorizontalScale = (0, _utils.getFloat)({
  56040. data: attributes.fontHorizontalScale,
  56041. defaultValue: 100,
  56042. validate: x => x >= 0
  56043. });
  56044. this.fontVerticalScale = (0, _utils.getFloat)({
  56045. data: attributes.fontVerticalScale,
  56046. defaultValue: 100,
  56047. validate: x => x >= 0
  56048. });
  56049. this.id = attributes.id || "";
  56050. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  56051. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  56052. this.lineThrough = (0, _utils.getInteger)({
  56053. data: attributes.lineThrough,
  56054. defaultValue: 0,
  56055. validate: x => x === 1 || x === 2
  56056. });
  56057. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  56058. this.overline = (0, _utils.getInteger)({
  56059. data: attributes.overline,
  56060. defaultValue: 0,
  56061. validate: x => x === 1 || x === 2
  56062. });
  56063. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  56064. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  56065. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  56066. this.typeface = attributes.typeface || "Courier";
  56067. this.underline = (0, _utils.getInteger)({
  56068. data: attributes.underline,
  56069. defaultValue: 0,
  56070. validate: x => x === 1 || x === 2
  56071. });
  56072. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  56073. this.use = attributes.use || "";
  56074. this.usehref = attributes.usehref || "";
  56075. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  56076. this.extras = null;
  56077. this.fill = null;
  56078. }
  56079. [_xfa_object.$clean](builder) {
  56080. super[_xfa_object.$clean](builder);
  56081. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  56082. }
  56083. [_xfa_object.$toStyle]() {
  56084. const style = (0, _html_utils.toStyle)(this, "fill");
  56085. const color = style.color;
  56086. if (color) {
  56087. if (color === "#000000") {
  56088. delete style.color;
  56089. } else if (!color.startsWith("#")) {
  56090. style.background = color;
  56091. style.backgroundClip = "text";
  56092. style.color = "transparent";
  56093. }
  56094. }
  56095. if (this.baselineShift) {
  56096. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  56097. }
  56098. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  56099. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  56100. if (this.lineThrough !== 0) {
  56101. style.textDecoration = "line-through";
  56102. if (this.lineThrough === 2) {
  56103. style.textDecorationStyle = "double";
  56104. }
  56105. }
  56106. if (this.overline !== 0) {
  56107. style.textDecoration = "overline";
  56108. if (this.overline === 2) {
  56109. style.textDecorationStyle = "double";
  56110. }
  56111. }
  56112. style.fontStyle = this.posture;
  56113. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  56114. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  56115. if (this.underline !== 0) {
  56116. style.textDecoration = "underline";
  56117. if (this.underline === 2) {
  56118. style.textDecorationStyle = "double";
  56119. }
  56120. }
  56121. style.fontWeight = this.weight;
  56122. return style;
  56123. }
  56124. }
  56125. class Format extends _xfa_object.XFAObject {
  56126. constructor(attributes) {
  56127. super(TEMPLATE_NS_ID, "format", true);
  56128. this.id = attributes.id || "";
  56129. this.use = attributes.use || "";
  56130. this.usehref = attributes.usehref || "";
  56131. this.extras = null;
  56132. this.picture = null;
  56133. }
  56134. }
  56135. class Handler extends _xfa_object.StringObject {
  56136. constructor(attributes) {
  56137. super(TEMPLATE_NS_ID, "handler");
  56138. this.id = attributes.id || "";
  56139. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56140. this.use = attributes.use || "";
  56141. this.usehref = attributes.usehref || "";
  56142. }
  56143. }
  56144. class Hyphenation extends _xfa_object.XFAObject {
  56145. constructor(attributes) {
  56146. super(TEMPLATE_NS_ID, "hyphenation");
  56147. this.excludeAllCaps = (0, _utils.getInteger)({
  56148. data: attributes.excludeAllCaps,
  56149. defaultValue: 0,
  56150. validate: x => x === 1
  56151. });
  56152. this.excludeInitialCap = (0, _utils.getInteger)({
  56153. data: attributes.excludeInitialCap,
  56154. defaultValue: 0,
  56155. validate: x => x === 1
  56156. });
  56157. this.hyphenate = (0, _utils.getInteger)({
  56158. data: attributes.hyphenate,
  56159. defaultValue: 0,
  56160. validate: x => x === 1
  56161. });
  56162. this.id = attributes.id || "";
  56163. this.pushCharacterCount = (0, _utils.getInteger)({
  56164. data: attributes.pushCharacterCount,
  56165. defaultValue: 3,
  56166. validate: x => x >= 0
  56167. });
  56168. this.remainCharacterCount = (0, _utils.getInteger)({
  56169. data: attributes.remainCharacterCount,
  56170. defaultValue: 3,
  56171. validate: x => x >= 0
  56172. });
  56173. this.use = attributes.use || "";
  56174. this.usehref = attributes.usehref || "";
  56175. this.wordCharacterCount = (0, _utils.getInteger)({
  56176. data: attributes.wordCharacterCount,
  56177. defaultValue: 7,
  56178. validate: x => x >= 0
  56179. });
  56180. }
  56181. }
  56182. class Image extends _xfa_object.StringObject {
  56183. constructor(attributes) {
  56184. super(TEMPLATE_NS_ID, "image");
  56185. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  56186. this.contentType = attributes.contentType || "";
  56187. this.href = attributes.href || "";
  56188. this.id = attributes.id || "";
  56189. this.name = attributes.name || "";
  56190. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  56191. this.use = attributes.use || "";
  56192. this.usehref = attributes.usehref || "";
  56193. }
  56194. [_xfa_object.$toHTML]() {
  56195. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  56196. return _utils.HTMLResult.EMPTY;
  56197. }
  56198. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  56199. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  56200. return _utils.HTMLResult.EMPTY;
  56201. }
  56202. if (!buffer && this.transferEncoding === "base64") {
  56203. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  56204. }
  56205. if (!buffer) {
  56206. return _utils.HTMLResult.EMPTY;
  56207. }
  56208. if (!this.contentType) {
  56209. for (const [header, type] of IMAGES_HEADERS) {
  56210. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  56211. this.contentType = type;
  56212. break;
  56213. }
  56214. }
  56215. if (!this.contentType) {
  56216. return _utils.HTMLResult.EMPTY;
  56217. }
  56218. }
  56219. const blob = new Blob([buffer], {
  56220. type: this.contentType
  56221. });
  56222. let style;
  56223. switch (this.aspect) {
  56224. case "fit":
  56225. case "actual":
  56226. break;
  56227. case "height":
  56228. style = {
  56229. height: "100%",
  56230. objectFit: "fill"
  56231. };
  56232. break;
  56233. case "none":
  56234. style = {
  56235. width: "100%",
  56236. height: "100%",
  56237. objectFit: "fill"
  56238. };
  56239. break;
  56240. case "width":
  56241. style = {
  56242. width: "100%",
  56243. objectFit: "fill"
  56244. };
  56245. break;
  56246. }
  56247. const parent = this[_xfa_object.$getParent]();
  56248. return _utils.HTMLResult.success({
  56249. name: "img",
  56250. attributes: {
  56251. class: ["xfaImage"],
  56252. style,
  56253. src: URL.createObjectURL(blob),
  56254. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  56255. }
  56256. });
  56257. }
  56258. }
  56259. class ImageEdit extends _xfa_object.XFAObject {
  56260. constructor(attributes) {
  56261. super(TEMPLATE_NS_ID, "imageEdit", true);
  56262. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  56263. this.id = attributes.id || "";
  56264. this.use = attributes.use || "";
  56265. this.usehref = attributes.usehref || "";
  56266. this.border = null;
  56267. this.extras = null;
  56268. this.margin = null;
  56269. }
  56270. [_xfa_object.$toHTML](availableSpace) {
  56271. if (this.data === "embed") {
  56272. return _utils.HTMLResult.success({
  56273. name: "div",
  56274. children: [],
  56275. attributes: {}
  56276. });
  56277. }
  56278. return _utils.HTMLResult.EMPTY;
  56279. }
  56280. }
  56281. class Integer extends _xfa_object.ContentObject {
  56282. constructor(attributes) {
  56283. super(TEMPLATE_NS_ID, "integer");
  56284. this.id = attributes.id || "";
  56285. this.name = attributes.name || "";
  56286. this.use = attributes.use || "";
  56287. this.usehref = attributes.usehref || "";
  56288. }
  56289. [_xfa_object.$finalize]() {
  56290. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  56291. this[_xfa_object.$content] = isNaN(number) ? null : number;
  56292. }
  56293. [_xfa_object.$toHTML](availableSpace) {
  56294. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  56295. }
  56296. }
  56297. class Issuers extends _xfa_object.XFAObject {
  56298. constructor(attributes) {
  56299. super(TEMPLATE_NS_ID, "issuers", true);
  56300. this.id = attributes.id || "";
  56301. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56302. this.use = attributes.use || "";
  56303. this.usehref = attributes.usehref || "";
  56304. this.certificate = new _xfa_object.XFAObjectArray();
  56305. }
  56306. }
  56307. class Items extends _xfa_object.XFAObject {
  56308. constructor(attributes) {
  56309. super(TEMPLATE_NS_ID, "items", true);
  56310. this.id = attributes.id || "";
  56311. this.name = attributes.name || "";
  56312. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  56313. this.ref = attributes.ref || "";
  56314. this.save = (0, _utils.getInteger)({
  56315. data: attributes.save,
  56316. defaultValue: 0,
  56317. validate: x => x === 1
  56318. });
  56319. this.use = attributes.use || "";
  56320. this.usehref = attributes.usehref || "";
  56321. this.boolean = new _xfa_object.XFAObjectArray();
  56322. this.date = new _xfa_object.XFAObjectArray();
  56323. this.dateTime = new _xfa_object.XFAObjectArray();
  56324. this.decimal = new _xfa_object.XFAObjectArray();
  56325. this.exData = new _xfa_object.XFAObjectArray();
  56326. this.float = new _xfa_object.XFAObjectArray();
  56327. this.image = new _xfa_object.XFAObjectArray();
  56328. this.integer = new _xfa_object.XFAObjectArray();
  56329. this.text = new _xfa_object.XFAObjectArray();
  56330. this.time = new _xfa_object.XFAObjectArray();
  56331. }
  56332. [_xfa_object.$toHTML]() {
  56333. const output = [];
  56334. for (const child of this[_xfa_object.$getChildren]()) {
  56335. output.push(child[_xfa_object.$text]());
  56336. }
  56337. return _utils.HTMLResult.success(output);
  56338. }
  56339. }
  56340. exports.Items = Items;
  56341. class Keep extends _xfa_object.XFAObject {
  56342. constructor(attributes) {
  56343. super(TEMPLATE_NS_ID, "keep", true);
  56344. this.id = attributes.id || "";
  56345. const options = ["none", "contentArea", "pageArea"];
  56346. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  56347. this.next = (0, _utils.getStringOption)(attributes.next, options);
  56348. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  56349. this.use = attributes.use || "";
  56350. this.usehref = attributes.usehref || "";
  56351. this.extras = null;
  56352. }
  56353. }
  56354. class KeyUsage extends _xfa_object.XFAObject {
  56355. constructor(attributes) {
  56356. super(TEMPLATE_NS_ID, "keyUsage");
  56357. const options = ["", "yes", "no"];
  56358. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  56359. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  56360. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  56361. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  56362. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  56363. this.id = attributes.id || "";
  56364. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  56365. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  56366. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  56367. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  56368. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56369. this.use = attributes.use || "";
  56370. this.usehref = attributes.usehref || "";
  56371. }
  56372. }
  56373. class Line extends _xfa_object.XFAObject {
  56374. constructor(attributes) {
  56375. super(TEMPLATE_NS_ID, "line", true);
  56376. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  56377. this.id = attributes.id || "";
  56378. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  56379. this.use = attributes.use || "";
  56380. this.usehref = attributes.usehref || "";
  56381. this.edge = null;
  56382. }
  56383. [_xfa_object.$toHTML]() {
  56384. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56385. const edge = this.edge || new Edge({});
  56386. const edgeStyle = edge[_xfa_object.$toStyle]();
  56387. const style = Object.create(null);
  56388. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  56389. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  56390. style.stroke = edgeStyle.color;
  56391. let x1, y1, x2, y2;
  56392. let width = "100%";
  56393. let height = "100%";
  56394. if (parent.w <= thickness) {
  56395. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  56396. width = style.strokeWidth;
  56397. } else if (parent.h <= thickness) {
  56398. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  56399. height = style.strokeWidth;
  56400. } else {
  56401. if (this.slope === "\\") {
  56402. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  56403. } else {
  56404. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  56405. }
  56406. }
  56407. const line = {
  56408. name: "line",
  56409. attributes: {
  56410. xmlns: SVG_NS,
  56411. x1,
  56412. y1,
  56413. x2,
  56414. y2,
  56415. style
  56416. }
  56417. };
  56418. const svg = {
  56419. name: "svg",
  56420. children: [line],
  56421. attributes: {
  56422. xmlns: SVG_NS,
  56423. width,
  56424. height,
  56425. style: {
  56426. overflow: "visible"
  56427. }
  56428. }
  56429. };
  56430. if (hasMargin(parent)) {
  56431. return _utils.HTMLResult.success({
  56432. name: "div",
  56433. attributes: {
  56434. style: {
  56435. display: "inline",
  56436. width: "100%",
  56437. height: "100%"
  56438. }
  56439. },
  56440. children: [svg]
  56441. });
  56442. }
  56443. svg.attributes.style.position = "absolute";
  56444. return _utils.HTMLResult.success(svg);
  56445. }
  56446. }
  56447. class Linear extends _xfa_object.XFAObject {
  56448. constructor(attributes) {
  56449. super(TEMPLATE_NS_ID, "linear", true);
  56450. this.id = attributes.id || "";
  56451. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  56452. this.use = attributes.use || "";
  56453. this.usehref = attributes.usehref || "";
  56454. this.color = null;
  56455. this.extras = null;
  56456. }
  56457. [_xfa_object.$toStyle](startColor) {
  56458. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56459. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  56460. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56461. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  56462. }
  56463. }
  56464. class LockDocument extends _xfa_object.ContentObject {
  56465. constructor(attributes) {
  56466. super(TEMPLATE_NS_ID, "lockDocument");
  56467. this.id = attributes.id || "";
  56468. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56469. this.use = attributes.use || "";
  56470. this.usehref = attributes.usehref || "";
  56471. }
  56472. [_xfa_object.$finalize]() {
  56473. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  56474. }
  56475. }
  56476. class Manifest extends _xfa_object.XFAObject {
  56477. constructor(attributes) {
  56478. super(TEMPLATE_NS_ID, "manifest", true);
  56479. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  56480. this.id = attributes.id || "";
  56481. this.name = attributes.name || "";
  56482. this.use = attributes.use || "";
  56483. this.usehref = attributes.usehref || "";
  56484. this.extras = null;
  56485. this.ref = new _xfa_object.XFAObjectArray();
  56486. }
  56487. }
  56488. class Margin extends _xfa_object.XFAObject {
  56489. constructor(attributes) {
  56490. super(TEMPLATE_NS_ID, "margin", true);
  56491. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  56492. this.id = attributes.id || "";
  56493. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  56494. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  56495. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  56496. this.use = attributes.use || "";
  56497. this.usehref = attributes.usehref || "";
  56498. this.extras = null;
  56499. }
  56500. [_xfa_object.$toStyle]() {
  56501. return {
  56502. 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)
  56503. };
  56504. }
  56505. }
  56506. class Mdp extends _xfa_object.XFAObject {
  56507. constructor(attributes) {
  56508. super(TEMPLATE_NS_ID, "mdp");
  56509. this.id = attributes.id || "";
  56510. this.permissions = (0, _utils.getInteger)({
  56511. data: attributes.permissions,
  56512. defaultValue: 2,
  56513. validate: x => x === 1 || x === 3
  56514. });
  56515. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  56516. this.use = attributes.use || "";
  56517. this.usehref = attributes.usehref || "";
  56518. }
  56519. }
  56520. class Medium extends _xfa_object.XFAObject {
  56521. constructor(attributes) {
  56522. super(TEMPLATE_NS_ID, "medium");
  56523. this.id = attributes.id || "";
  56524. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  56525. this.long = (0, _utils.getMeasurement)(attributes.long);
  56526. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  56527. this.short = (0, _utils.getMeasurement)(attributes.short);
  56528. this.stock = attributes.stock || "";
  56529. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  56530. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  56531. this.use = attributes.use || "";
  56532. this.usehref = attributes.usehref || "";
  56533. }
  56534. }
  56535. class Message extends _xfa_object.XFAObject {
  56536. constructor(attributes) {
  56537. super(TEMPLATE_NS_ID, "message", true);
  56538. this.id = attributes.id || "";
  56539. this.use = attributes.use || "";
  56540. this.usehref = attributes.usehref || "";
  56541. this.text = new _xfa_object.XFAObjectArray();
  56542. }
  56543. }
  56544. class NumericEdit extends _xfa_object.XFAObject {
  56545. constructor(attributes) {
  56546. super(TEMPLATE_NS_ID, "numericEdit", true);
  56547. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56548. this.id = attributes.id || "";
  56549. this.use = attributes.use || "";
  56550. this.usehref = attributes.usehref || "";
  56551. this.border = null;
  56552. this.comb = null;
  56553. this.extras = null;
  56554. this.margin = null;
  56555. }
  56556. [_xfa_object.$toHTML](availableSpace) {
  56557. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56558. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56559. const html = {
  56560. name: "input",
  56561. attributes: {
  56562. type: "text",
  56563. fieldId: field[_xfa_object.$uid],
  56564. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56565. class: ["xfaTextfield"],
  56566. style,
  56567. "aria-label": ariaLabel(field),
  56568. "aria-required": false
  56569. }
  56570. };
  56571. if (isRequired(field)) {
  56572. html.attributes["aria-required"] = true;
  56573. html.attributes.required = true;
  56574. }
  56575. return _utils.HTMLResult.success({
  56576. name: "label",
  56577. attributes: {
  56578. class: ["xfaLabel"]
  56579. },
  56580. children: [html]
  56581. });
  56582. }
  56583. }
  56584. class Occur extends _xfa_object.XFAObject {
  56585. constructor(attributes) {
  56586. super(TEMPLATE_NS_ID, "occur", true);
  56587. this.id = attributes.id || "";
  56588. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  56589. data: attributes.initial,
  56590. defaultValue: "",
  56591. validate: x => true
  56592. }) : "";
  56593. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  56594. data: attributes.max,
  56595. defaultValue: 1,
  56596. validate: x => true
  56597. }) : "";
  56598. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  56599. data: attributes.min,
  56600. defaultValue: 1,
  56601. validate: x => true
  56602. }) : "";
  56603. this.use = attributes.use || "";
  56604. this.usehref = attributes.usehref || "";
  56605. this.extras = null;
  56606. }
  56607. [_xfa_object.$clean]() {
  56608. const parent = this[_xfa_object.$getParent]();
  56609. const originalMin = this.min;
  56610. if (this.min === "") {
  56611. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  56612. }
  56613. if (this.max === "") {
  56614. if (originalMin === "") {
  56615. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  56616. } else {
  56617. this.max = this.min;
  56618. }
  56619. }
  56620. if (this.max !== -1 && this.max < this.min) {
  56621. this.max = this.min;
  56622. }
  56623. if (this.initial === "") {
  56624. this.initial = parent instanceof Template ? 1 : this.min;
  56625. }
  56626. }
  56627. }
  56628. class Oid extends _xfa_object.StringObject {
  56629. constructor(attributes) {
  56630. super(TEMPLATE_NS_ID, "oid");
  56631. this.id = attributes.id || "";
  56632. this.name = attributes.name || "";
  56633. this.use = attributes.use || "";
  56634. this.usehref = attributes.usehref || "";
  56635. }
  56636. }
  56637. class Oids extends _xfa_object.XFAObject {
  56638. constructor(attributes) {
  56639. super(TEMPLATE_NS_ID, "oids", true);
  56640. this.id = attributes.id || "";
  56641. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56642. this.use = attributes.use || "";
  56643. this.usehref = attributes.usehref || "";
  56644. this.oid = new _xfa_object.XFAObjectArray();
  56645. }
  56646. }
  56647. class Overflow extends _xfa_object.XFAObject {
  56648. constructor(attributes) {
  56649. super(TEMPLATE_NS_ID, "overflow");
  56650. this.id = attributes.id || "";
  56651. this.leader = attributes.leader || "";
  56652. this.target = attributes.target || "";
  56653. this.trailer = attributes.trailer || "";
  56654. this.use = attributes.use || "";
  56655. this.usehref = attributes.usehref || "";
  56656. }
  56657. [_xfa_object.$getExtra]() {
  56658. if (!this[_xfa_object.$extra]) {
  56659. const parent = this[_xfa_object.$getParent]();
  56660. const root = this[_xfa_object.$getTemplateRoot]();
  56661. const target = root[_xfa_object.$searchNode](this.target, parent);
  56662. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  56663. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  56664. this[_xfa_object.$extra] = {
  56665. target: target && target[0] || null,
  56666. leader: leader && leader[0] || null,
  56667. trailer: trailer && trailer[0] || null,
  56668. addLeader: false,
  56669. addTrailer: false
  56670. };
  56671. }
  56672. return this[_xfa_object.$extra];
  56673. }
  56674. }
  56675. class PageArea extends _xfa_object.XFAObject {
  56676. constructor(attributes) {
  56677. super(TEMPLATE_NS_ID, "pageArea", true);
  56678. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  56679. this.id = attributes.id || "";
  56680. this.initialNumber = (0, _utils.getInteger)({
  56681. data: attributes.initialNumber,
  56682. defaultValue: 1,
  56683. validate: x => true
  56684. });
  56685. this.name = attributes.name || "";
  56686. this.numbered = (0, _utils.getInteger)({
  56687. data: attributes.numbered,
  56688. defaultValue: 1,
  56689. validate: x => true
  56690. });
  56691. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  56692. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  56693. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56694. this.use = attributes.use || "";
  56695. this.usehref = attributes.usehref || "";
  56696. this.desc = null;
  56697. this.extras = null;
  56698. this.medium = null;
  56699. this.occur = null;
  56700. this.area = new _xfa_object.XFAObjectArray();
  56701. this.contentArea = new _xfa_object.XFAObjectArray();
  56702. this.draw = new _xfa_object.XFAObjectArray();
  56703. this.exclGroup = new _xfa_object.XFAObjectArray();
  56704. this.field = new _xfa_object.XFAObjectArray();
  56705. this.subform = new _xfa_object.XFAObjectArray();
  56706. }
  56707. [_xfa_object.$isUsable]() {
  56708. if (!this[_xfa_object.$extra]) {
  56709. this[_xfa_object.$extra] = {
  56710. numberOfUse: 0
  56711. };
  56712. return true;
  56713. }
  56714. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56715. }
  56716. [_xfa_object.$cleanPage]() {
  56717. delete this[_xfa_object.$extra];
  56718. }
  56719. [_xfa_object.$getNextPage]() {
  56720. if (!this[_xfa_object.$extra]) {
  56721. this[_xfa_object.$extra] = {
  56722. numberOfUse: 0
  56723. };
  56724. }
  56725. const parent = this[_xfa_object.$getParent]();
  56726. if (parent.relation === "orderedOccurrence") {
  56727. if (this[_xfa_object.$isUsable]()) {
  56728. this[_xfa_object.$extra].numberOfUse += 1;
  56729. return this;
  56730. }
  56731. }
  56732. return parent[_xfa_object.$getNextPage]();
  56733. }
  56734. [_xfa_object.$getAvailableSpace]() {
  56735. return this[_xfa_object.$extra].space || {
  56736. width: 0,
  56737. height: 0
  56738. };
  56739. }
  56740. [_xfa_object.$toHTML]() {
  56741. if (!this[_xfa_object.$extra]) {
  56742. this[_xfa_object.$extra] = {
  56743. numberOfUse: 1
  56744. };
  56745. }
  56746. const children = [];
  56747. this[_xfa_object.$extra].children = children;
  56748. const style = Object.create(null);
  56749. if (this.medium && this.medium.short && this.medium.long) {
  56750. style.width = (0, _html_utils.measureToString)(this.medium.short);
  56751. style.height = (0, _html_utils.measureToString)(this.medium.long);
  56752. this[_xfa_object.$extra].space = {
  56753. width: this.medium.short,
  56754. height: this.medium.long
  56755. };
  56756. if (this.medium.orientation === "landscape") {
  56757. const x = style.width;
  56758. style.width = style.height;
  56759. style.height = x;
  56760. this[_xfa_object.$extra].space = {
  56761. width: this.medium.long,
  56762. height: this.medium.short
  56763. };
  56764. }
  56765. } else {
  56766. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  56767. }
  56768. this[_xfa_object.$childrenToHTML]({
  56769. filter: new Set(["area", "draw", "field", "subform"]),
  56770. include: true
  56771. });
  56772. this[_xfa_object.$childrenToHTML]({
  56773. filter: new Set(["contentArea"]),
  56774. include: true
  56775. });
  56776. return _utils.HTMLResult.success({
  56777. name: "div",
  56778. children,
  56779. attributes: {
  56780. class: ["xfaPage"],
  56781. id: this[_xfa_object.$uid],
  56782. style,
  56783. xfaName: this.name
  56784. }
  56785. });
  56786. }
  56787. }
  56788. class PageSet extends _xfa_object.XFAObject {
  56789. constructor(attributes) {
  56790. super(TEMPLATE_NS_ID, "pageSet", true);
  56791. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  56792. this.id = attributes.id || "";
  56793. this.name = attributes.name || "";
  56794. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  56795. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56796. this.use = attributes.use || "";
  56797. this.usehref = attributes.usehref || "";
  56798. this.extras = null;
  56799. this.occur = null;
  56800. this.pageArea = new _xfa_object.XFAObjectArray();
  56801. this.pageSet = new _xfa_object.XFAObjectArray();
  56802. }
  56803. [_xfa_object.$cleanPage]() {
  56804. for (const page of this.pageArea.children) {
  56805. page[_xfa_object.$cleanPage]();
  56806. }
  56807. for (const page of this.pageSet.children) {
  56808. page[_xfa_object.$cleanPage]();
  56809. }
  56810. }
  56811. [_xfa_object.$isUsable]() {
  56812. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56813. }
  56814. [_xfa_object.$getNextPage]() {
  56815. if (!this[_xfa_object.$extra]) {
  56816. this[_xfa_object.$extra] = {
  56817. numberOfUse: 1,
  56818. pageIndex: -1,
  56819. pageSetIndex: -1
  56820. };
  56821. }
  56822. if (this.relation === "orderedOccurrence") {
  56823. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  56824. this[_xfa_object.$extra].pageIndex += 1;
  56825. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  56826. return pageArea[_xfa_object.$getNextPage]();
  56827. }
  56828. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  56829. this[_xfa_object.$extra].pageSetIndex += 1;
  56830. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  56831. }
  56832. if (this[_xfa_object.$isUsable]()) {
  56833. this[_xfa_object.$extra].numberOfUse += 1;
  56834. this[_xfa_object.$extra].pageIndex = -1;
  56835. this[_xfa_object.$extra].pageSetIndex = -1;
  56836. return this[_xfa_object.$getNextPage]();
  56837. }
  56838. const parent = this[_xfa_object.$getParent]();
  56839. if (parent instanceof PageSet) {
  56840. return parent[_xfa_object.$getNextPage]();
  56841. }
  56842. this[_xfa_object.$cleanPage]();
  56843. return this[_xfa_object.$getNextPage]();
  56844. }
  56845. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  56846. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  56847. const position = pageNumber === 0 ? "first" : "rest";
  56848. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  56849. if (page) {
  56850. return page;
  56851. }
  56852. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  56853. if (page) {
  56854. return page;
  56855. }
  56856. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  56857. if (page) {
  56858. return page;
  56859. }
  56860. return this.pageArea.children[0];
  56861. }
  56862. }
  56863. class Para extends _xfa_object.XFAObject {
  56864. constructor(attributes) {
  56865. super(TEMPLATE_NS_ID, "para", true);
  56866. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56867. this.id = attributes.id || "";
  56868. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  56869. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  56870. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  56871. this.orphans = (0, _utils.getInteger)({
  56872. data: attributes.orphans,
  56873. defaultValue: 0,
  56874. validate: x => x >= 0
  56875. });
  56876. this.preserve = attributes.preserve || "";
  56877. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  56878. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  56879. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  56880. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  56881. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  56882. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  56883. this.use = attributes.use || "";
  56884. this.usehref = attributes.usehref || "";
  56885. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  56886. this.widows = (0, _utils.getInteger)({
  56887. data: attributes.widows,
  56888. defaultValue: 0,
  56889. validate: x => x >= 0
  56890. });
  56891. this.hyphenation = null;
  56892. }
  56893. [_xfa_object.$toStyle]() {
  56894. const style = (0, _html_utils.toStyle)(this, "hAlign");
  56895. if (this.marginLeft !== "") {
  56896. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  56897. }
  56898. if (this.marginRight !== "") {
  56899. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  56900. }
  56901. if (this.spaceAbove !== "") {
  56902. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  56903. }
  56904. if (this.spaceBelow !== "") {
  56905. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  56906. }
  56907. if (this.textIndent !== "") {
  56908. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  56909. (0, _html_utils.fixTextIndent)(style);
  56910. }
  56911. if (this.lineHeight > 0) {
  56912. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  56913. }
  56914. if (this.tabDefault !== "") {
  56915. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  56916. }
  56917. if (this.tabStops.length > 0) {}
  56918. if (this.hyphenatation) {
  56919. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  56920. }
  56921. return style;
  56922. }
  56923. }
  56924. class PasswordEdit extends _xfa_object.XFAObject {
  56925. constructor(attributes) {
  56926. super(TEMPLATE_NS_ID, "passwordEdit", true);
  56927. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56928. this.id = attributes.id || "";
  56929. this.passwordChar = attributes.passwordChar || "*";
  56930. this.use = attributes.use || "";
  56931. this.usehref = attributes.usehref || "";
  56932. this.border = null;
  56933. this.extras = null;
  56934. this.margin = null;
  56935. }
  56936. }
  56937. class Pattern extends _xfa_object.XFAObject {
  56938. constructor(attributes) {
  56939. super(TEMPLATE_NS_ID, "pattern", true);
  56940. this.id = attributes.id || "";
  56941. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  56942. this.use = attributes.use || "";
  56943. this.usehref = attributes.usehref || "";
  56944. this.color = null;
  56945. this.extras = null;
  56946. }
  56947. [_xfa_object.$toStyle](startColor) {
  56948. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56949. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56950. const width = 5;
  56951. const cmd = "repeating-linear-gradient";
  56952. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  56953. switch (this.type) {
  56954. case "crossHatch":
  56955. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  56956. case "crossDiagonal":
  56957. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  56958. case "diagonalLeft":
  56959. return `${cmd}(45deg,${colors})`;
  56960. case "diagonalRight":
  56961. return `${cmd}(-45deg,${colors})`;
  56962. case "horizontal":
  56963. return `${cmd}(to top,${colors})`;
  56964. case "vertical":
  56965. return `${cmd}(to right,${colors})`;
  56966. }
  56967. return "";
  56968. }
  56969. }
  56970. class Picture extends _xfa_object.StringObject {
  56971. constructor(attributes) {
  56972. super(TEMPLATE_NS_ID, "picture");
  56973. this.id = attributes.id || "";
  56974. this.use = attributes.use || "";
  56975. this.usehref = attributes.usehref || "";
  56976. }
  56977. }
  56978. class Proto extends _xfa_object.XFAObject {
  56979. constructor(attributes) {
  56980. super(TEMPLATE_NS_ID, "proto", true);
  56981. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  56982. this.arc = new _xfa_object.XFAObjectArray();
  56983. this.area = new _xfa_object.XFAObjectArray();
  56984. this.assist = new _xfa_object.XFAObjectArray();
  56985. this.barcode = new _xfa_object.XFAObjectArray();
  56986. this.bindItems = new _xfa_object.XFAObjectArray();
  56987. this.bookend = new _xfa_object.XFAObjectArray();
  56988. this.boolean = new _xfa_object.XFAObjectArray();
  56989. this.border = new _xfa_object.XFAObjectArray();
  56990. this.break = new _xfa_object.XFAObjectArray();
  56991. this.breakAfter = new _xfa_object.XFAObjectArray();
  56992. this.breakBefore = new _xfa_object.XFAObjectArray();
  56993. this.button = new _xfa_object.XFAObjectArray();
  56994. this.calculate = new _xfa_object.XFAObjectArray();
  56995. this.caption = new _xfa_object.XFAObjectArray();
  56996. this.certificate = new _xfa_object.XFAObjectArray();
  56997. this.certificates = new _xfa_object.XFAObjectArray();
  56998. this.checkButton = new _xfa_object.XFAObjectArray();
  56999. this.choiceList = new _xfa_object.XFAObjectArray();
  57000. this.color = new _xfa_object.XFAObjectArray();
  57001. this.comb = new _xfa_object.XFAObjectArray();
  57002. this.connect = new _xfa_object.XFAObjectArray();
  57003. this.contentArea = new _xfa_object.XFAObjectArray();
  57004. this.corner = new _xfa_object.XFAObjectArray();
  57005. this.date = new _xfa_object.XFAObjectArray();
  57006. this.dateTime = new _xfa_object.XFAObjectArray();
  57007. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  57008. this.decimal = new _xfa_object.XFAObjectArray();
  57009. this.defaultUi = new _xfa_object.XFAObjectArray();
  57010. this.desc = new _xfa_object.XFAObjectArray();
  57011. this.digestMethod = new _xfa_object.XFAObjectArray();
  57012. this.digestMethods = new _xfa_object.XFAObjectArray();
  57013. this.draw = new _xfa_object.XFAObjectArray();
  57014. this.edge = new _xfa_object.XFAObjectArray();
  57015. this.encoding = new _xfa_object.XFAObjectArray();
  57016. this.encodings = new _xfa_object.XFAObjectArray();
  57017. this.encrypt = new _xfa_object.XFAObjectArray();
  57018. this.encryptData = new _xfa_object.XFAObjectArray();
  57019. this.encryption = new _xfa_object.XFAObjectArray();
  57020. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  57021. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  57022. this.event = new _xfa_object.XFAObjectArray();
  57023. this.exData = new _xfa_object.XFAObjectArray();
  57024. this.exObject = new _xfa_object.XFAObjectArray();
  57025. this.exclGroup = new _xfa_object.XFAObjectArray();
  57026. this.execute = new _xfa_object.XFAObjectArray();
  57027. this.extras = new _xfa_object.XFAObjectArray();
  57028. this.field = new _xfa_object.XFAObjectArray();
  57029. this.fill = new _xfa_object.XFAObjectArray();
  57030. this.filter = new _xfa_object.XFAObjectArray();
  57031. this.float = new _xfa_object.XFAObjectArray();
  57032. this.font = new _xfa_object.XFAObjectArray();
  57033. this.format = new _xfa_object.XFAObjectArray();
  57034. this.handler = new _xfa_object.XFAObjectArray();
  57035. this.hyphenation = new _xfa_object.XFAObjectArray();
  57036. this.image = new _xfa_object.XFAObjectArray();
  57037. this.imageEdit = new _xfa_object.XFAObjectArray();
  57038. this.integer = new _xfa_object.XFAObjectArray();
  57039. this.issuers = new _xfa_object.XFAObjectArray();
  57040. this.items = new _xfa_object.XFAObjectArray();
  57041. this.keep = new _xfa_object.XFAObjectArray();
  57042. this.keyUsage = new _xfa_object.XFAObjectArray();
  57043. this.line = new _xfa_object.XFAObjectArray();
  57044. this.linear = new _xfa_object.XFAObjectArray();
  57045. this.lockDocument = new _xfa_object.XFAObjectArray();
  57046. this.manifest = new _xfa_object.XFAObjectArray();
  57047. this.margin = new _xfa_object.XFAObjectArray();
  57048. this.mdp = new _xfa_object.XFAObjectArray();
  57049. this.medium = new _xfa_object.XFAObjectArray();
  57050. this.message = new _xfa_object.XFAObjectArray();
  57051. this.numericEdit = new _xfa_object.XFAObjectArray();
  57052. this.occur = new _xfa_object.XFAObjectArray();
  57053. this.oid = new _xfa_object.XFAObjectArray();
  57054. this.oids = new _xfa_object.XFAObjectArray();
  57055. this.overflow = new _xfa_object.XFAObjectArray();
  57056. this.pageArea = new _xfa_object.XFAObjectArray();
  57057. this.pageSet = new _xfa_object.XFAObjectArray();
  57058. this.para = new _xfa_object.XFAObjectArray();
  57059. this.passwordEdit = new _xfa_object.XFAObjectArray();
  57060. this.pattern = new _xfa_object.XFAObjectArray();
  57061. this.picture = new _xfa_object.XFAObjectArray();
  57062. this.radial = new _xfa_object.XFAObjectArray();
  57063. this.reason = new _xfa_object.XFAObjectArray();
  57064. this.reasons = new _xfa_object.XFAObjectArray();
  57065. this.rectangle = new _xfa_object.XFAObjectArray();
  57066. this.ref = new _xfa_object.XFAObjectArray();
  57067. this.script = new _xfa_object.XFAObjectArray();
  57068. this.setProperty = new _xfa_object.XFAObjectArray();
  57069. this.signData = new _xfa_object.XFAObjectArray();
  57070. this.signature = new _xfa_object.XFAObjectArray();
  57071. this.signing = new _xfa_object.XFAObjectArray();
  57072. this.solid = new _xfa_object.XFAObjectArray();
  57073. this.speak = new _xfa_object.XFAObjectArray();
  57074. this.stipple = new _xfa_object.XFAObjectArray();
  57075. this.subform = new _xfa_object.XFAObjectArray();
  57076. this.subformSet = new _xfa_object.XFAObjectArray();
  57077. this.subjectDN = new _xfa_object.XFAObjectArray();
  57078. this.subjectDNs = new _xfa_object.XFAObjectArray();
  57079. this.submit = new _xfa_object.XFAObjectArray();
  57080. this.text = new _xfa_object.XFAObjectArray();
  57081. this.textEdit = new _xfa_object.XFAObjectArray();
  57082. this.time = new _xfa_object.XFAObjectArray();
  57083. this.timeStamp = new _xfa_object.XFAObjectArray();
  57084. this.toolTip = new _xfa_object.XFAObjectArray();
  57085. this.traversal = new _xfa_object.XFAObjectArray();
  57086. this.traverse = new _xfa_object.XFAObjectArray();
  57087. this.ui = new _xfa_object.XFAObjectArray();
  57088. this.validate = new _xfa_object.XFAObjectArray();
  57089. this.value = new _xfa_object.XFAObjectArray();
  57090. this.variables = new _xfa_object.XFAObjectArray();
  57091. }
  57092. }
  57093. class Radial extends _xfa_object.XFAObject {
  57094. constructor(attributes) {
  57095. super(TEMPLATE_NS_ID, "radial", true);
  57096. this.id = attributes.id || "";
  57097. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  57098. this.use = attributes.use || "";
  57099. this.usehref = attributes.usehref || "";
  57100. this.color = null;
  57101. this.extras = null;
  57102. }
  57103. [_xfa_object.$toStyle](startColor) {
  57104. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  57105. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  57106. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  57107. return `radial-gradient(circle at center, ${colors})`;
  57108. }
  57109. }
  57110. class Reason extends _xfa_object.StringObject {
  57111. constructor(attributes) {
  57112. super(TEMPLATE_NS_ID, "reason");
  57113. this.id = attributes.id || "";
  57114. this.name = attributes.name || "";
  57115. this.use = attributes.use || "";
  57116. this.usehref = attributes.usehref || "";
  57117. }
  57118. }
  57119. class Reasons extends _xfa_object.XFAObject {
  57120. constructor(attributes) {
  57121. super(TEMPLATE_NS_ID, "reasons", true);
  57122. this.id = attributes.id || "";
  57123. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57124. this.use = attributes.use || "";
  57125. this.usehref = attributes.usehref || "";
  57126. this.reason = new _xfa_object.XFAObjectArray();
  57127. }
  57128. }
  57129. class Rectangle extends _xfa_object.XFAObject {
  57130. constructor(attributes) {
  57131. super(TEMPLATE_NS_ID, "rectangle", true);
  57132. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57133. this.id = attributes.id || "";
  57134. this.use = attributes.use || "";
  57135. this.usehref = attributes.usehref || "";
  57136. this.corner = new _xfa_object.XFAObjectArray(4);
  57137. this.edge = new _xfa_object.XFAObjectArray(4);
  57138. this.fill = null;
  57139. }
  57140. [_xfa_object.$toHTML]() {
  57141. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  57142. const edgeStyle = edge[_xfa_object.$toStyle]();
  57143. const style = Object.create(null);
  57144. if (this.fill && this.fill.presence === "visible") {
  57145. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57146. } else {
  57147. style.fill = "transparent";
  57148. }
  57149. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  57150. style.stroke = edgeStyle.color;
  57151. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  57152. const cornerStyle = corner[_xfa_object.$toStyle]();
  57153. const rect = {
  57154. name: "rect",
  57155. attributes: {
  57156. xmlns: SVG_NS,
  57157. width: "100%",
  57158. height: "100%",
  57159. x: 0,
  57160. y: 0,
  57161. rx: cornerStyle.radius,
  57162. ry: cornerStyle.radius,
  57163. style
  57164. }
  57165. };
  57166. const svg = {
  57167. name: "svg",
  57168. children: [rect],
  57169. attributes: {
  57170. xmlns: SVG_NS,
  57171. style: {
  57172. overflow: "visible"
  57173. },
  57174. width: "100%",
  57175. height: "100%"
  57176. }
  57177. };
  57178. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57179. if (hasMargin(parent)) {
  57180. return _utils.HTMLResult.success({
  57181. name: "div",
  57182. attributes: {
  57183. style: {
  57184. display: "inline",
  57185. width: "100%",
  57186. height: "100%"
  57187. }
  57188. },
  57189. children: [svg]
  57190. });
  57191. }
  57192. svg.attributes.style.position = "absolute";
  57193. return _utils.HTMLResult.success(svg);
  57194. }
  57195. }
  57196. class RefElement extends _xfa_object.StringObject {
  57197. constructor(attributes) {
  57198. super(TEMPLATE_NS_ID, "ref");
  57199. this.id = attributes.id || "";
  57200. this.use = attributes.use || "";
  57201. this.usehref = attributes.usehref || "";
  57202. }
  57203. }
  57204. class Script extends _xfa_object.StringObject {
  57205. constructor(attributes) {
  57206. super(TEMPLATE_NS_ID, "script");
  57207. this.binding = attributes.binding || "";
  57208. this.contentType = attributes.contentType || "";
  57209. this.id = attributes.id || "";
  57210. this.name = attributes.name || "";
  57211. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  57212. this.use = attributes.use || "";
  57213. this.usehref = attributes.usehref || "";
  57214. }
  57215. }
  57216. class SetProperty extends _xfa_object.XFAObject {
  57217. constructor(attributes) {
  57218. super(TEMPLATE_NS_ID, "setProperty");
  57219. this.connection = attributes.connection || "";
  57220. this.ref = attributes.ref || "";
  57221. this.target = attributes.target || "";
  57222. }
  57223. }
  57224. exports.SetProperty = SetProperty;
  57225. class SignData extends _xfa_object.XFAObject {
  57226. constructor(attributes) {
  57227. super(TEMPLATE_NS_ID, "signData", true);
  57228. this.id = attributes.id || "";
  57229. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  57230. this.ref = attributes.ref || "";
  57231. this.target = attributes.target || "";
  57232. this.use = attributes.use || "";
  57233. this.usehref = attributes.usehref || "";
  57234. this.filter = null;
  57235. this.manifest = null;
  57236. }
  57237. }
  57238. class Signature extends _xfa_object.XFAObject {
  57239. constructor(attributes) {
  57240. super(TEMPLATE_NS_ID, "signature", true);
  57241. this.id = attributes.id || "";
  57242. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  57243. this.use = attributes.use || "";
  57244. this.usehref = attributes.usehref || "";
  57245. this.border = null;
  57246. this.extras = null;
  57247. this.filter = null;
  57248. this.manifest = null;
  57249. this.margin = null;
  57250. }
  57251. }
  57252. class Signing extends _xfa_object.XFAObject {
  57253. constructor(attributes) {
  57254. super(TEMPLATE_NS_ID, "signing", true);
  57255. this.id = attributes.id || "";
  57256. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57257. this.use = attributes.use || "";
  57258. this.usehref = attributes.usehref || "";
  57259. this.certificate = new _xfa_object.XFAObjectArray();
  57260. }
  57261. }
  57262. class Solid extends _xfa_object.XFAObject {
  57263. constructor(attributes) {
  57264. super(TEMPLATE_NS_ID, "solid", true);
  57265. this.id = attributes.id || "";
  57266. this.use = attributes.use || "";
  57267. this.usehref = attributes.usehref || "";
  57268. this.extras = null;
  57269. }
  57270. [_xfa_object.$toStyle](startColor) {
  57271. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  57272. }
  57273. }
  57274. class Speak extends _xfa_object.StringObject {
  57275. constructor(attributes) {
  57276. super(TEMPLATE_NS_ID, "speak");
  57277. this.disable = (0, _utils.getInteger)({
  57278. data: attributes.disable,
  57279. defaultValue: 0,
  57280. validate: x => x === 1
  57281. });
  57282. this.id = attributes.id || "";
  57283. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  57284. this.rid = attributes.rid || "";
  57285. this.use = attributes.use || "";
  57286. this.usehref = attributes.usehref || "";
  57287. }
  57288. }
  57289. class Stipple extends _xfa_object.XFAObject {
  57290. constructor(attributes) {
  57291. super(TEMPLATE_NS_ID, "stipple", true);
  57292. this.id = attributes.id || "";
  57293. this.rate = (0, _utils.getInteger)({
  57294. data: attributes.rate,
  57295. defaultValue: 50,
  57296. validate: x => x >= 0 && x <= 100
  57297. });
  57298. this.use = attributes.use || "";
  57299. this.usehref = attributes.usehref || "";
  57300. this.color = null;
  57301. this.extras = null;
  57302. }
  57303. [_xfa_object.$toStyle](bgColor) {
  57304. const alpha = this.rate / 100;
  57305. 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));
  57306. }
  57307. }
  57308. class Subform extends _xfa_object.XFAObject {
  57309. constructor(attributes) {
  57310. super(TEMPLATE_NS_ID, "subform", true);
  57311. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  57312. this.allowMacro = (0, _utils.getInteger)({
  57313. data: attributes.allowMacro,
  57314. defaultValue: 0,
  57315. validate: x => x === 1
  57316. });
  57317. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  57318. this.colSpan = (0, _utils.getInteger)({
  57319. data: attributes.colSpan,
  57320. defaultValue: 1,
  57321. validate: n => n >= 1 || n === -1
  57322. });
  57323. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  57324. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  57325. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  57326. this.id = attributes.id || "";
  57327. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  57328. this.locale = attributes.locale || "";
  57329. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  57330. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  57331. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  57332. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  57333. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  57334. this.name = attributes.name || "";
  57335. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57336. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57337. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  57338. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  57339. this.use = attributes.use || "";
  57340. this.usehref = attributes.usehref || "";
  57341. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  57342. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57343. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57344. this.assist = null;
  57345. this.bind = null;
  57346. this.bookend = null;
  57347. this.border = null;
  57348. this.break = null;
  57349. this.calculate = null;
  57350. this.desc = null;
  57351. this.extras = null;
  57352. this.keep = null;
  57353. this.margin = null;
  57354. this.occur = null;
  57355. this.overflow = null;
  57356. this.pageSet = null;
  57357. this.para = null;
  57358. this.traversal = null;
  57359. this.validate = null;
  57360. this.variables = null;
  57361. this.area = new _xfa_object.XFAObjectArray();
  57362. this.breakAfter = new _xfa_object.XFAObjectArray();
  57363. this.breakBefore = new _xfa_object.XFAObjectArray();
  57364. this.connect = new _xfa_object.XFAObjectArray();
  57365. this.draw = new _xfa_object.XFAObjectArray();
  57366. this.event = new _xfa_object.XFAObjectArray();
  57367. this.exObject = new _xfa_object.XFAObjectArray();
  57368. this.exclGroup = new _xfa_object.XFAObjectArray();
  57369. this.field = new _xfa_object.XFAObjectArray();
  57370. this.proto = new _xfa_object.XFAObjectArray();
  57371. this.setProperty = new _xfa_object.XFAObjectArray();
  57372. this.subform = new _xfa_object.XFAObjectArray();
  57373. this.subformSet = new _xfa_object.XFAObjectArray();
  57374. }
  57375. [_xfa_object.$getSubformParent]() {
  57376. const parent = this[_xfa_object.$getParent]();
  57377. if (parent instanceof SubformSet) {
  57378. return parent[_xfa_object.$getSubformParent]();
  57379. }
  57380. return parent;
  57381. }
  57382. [_xfa_object.$isBindable]() {
  57383. return true;
  57384. }
  57385. [_xfa_object.$isThereMoreWidth]() {
  57386. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  57387. }
  57388. *[_xfa_object.$getContainedChildren]() {
  57389. yield* getContainedChildren(this);
  57390. }
  57391. [_xfa_object.$flushHTML]() {
  57392. return (0, _layout.flushHTML)(this);
  57393. }
  57394. [_xfa_object.$addHTML](html, bbox) {
  57395. (0, _layout.addHTML)(this, html, bbox);
  57396. }
  57397. [_xfa_object.$getAvailableSpace]() {
  57398. return (0, _layout.getAvailableSpace)(this);
  57399. }
  57400. [_xfa_object.$isSplittable]() {
  57401. const parent = this[_xfa_object.$getSubformParent]();
  57402. if (!parent[_xfa_object.$isSplittable]()) {
  57403. return false;
  57404. }
  57405. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  57406. return this[_xfa_object.$extra]._isSplittable;
  57407. }
  57408. if (this.layout === "position" || this.layout.includes("row")) {
  57409. this[_xfa_object.$extra]._isSplittable = false;
  57410. return false;
  57411. }
  57412. if (this.keep && this.keep.intact !== "none") {
  57413. this[_xfa_object.$extra]._isSplittable = false;
  57414. return false;
  57415. }
  57416. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  57417. return false;
  57418. }
  57419. this[_xfa_object.$extra]._isSplittable = true;
  57420. return true;
  57421. }
  57422. [_xfa_object.$toHTML](availableSpace) {
  57423. setTabIndex(this);
  57424. if (this.break) {
  57425. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  57426. const node = new BreakAfter({
  57427. targetType: this.break.after,
  57428. target: this.break.afterTarget,
  57429. startNew: this.break.startNew.toString()
  57430. });
  57431. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57432. this[_xfa_object.$appendChild](node);
  57433. this.breakAfter.push(node);
  57434. }
  57435. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  57436. const node = new BreakBefore({
  57437. targetType: this.break.before,
  57438. target: this.break.beforeTarget,
  57439. startNew: this.break.startNew.toString()
  57440. });
  57441. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57442. this[_xfa_object.$appendChild](node);
  57443. this.breakBefore.push(node);
  57444. }
  57445. if (this.break.overflowTarget !== "") {
  57446. const node = new Overflow({
  57447. target: this.break.overflowTarget,
  57448. leader: this.break.overflowLeader,
  57449. trailer: this.break.overflowTrailer
  57450. });
  57451. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  57452. this[_xfa_object.$appendChild](node);
  57453. this.overflow.push(node);
  57454. }
  57455. this[_xfa_object.$removeChild](this.break);
  57456. this.break = null;
  57457. }
  57458. if (this.presence === "hidden" || this.presence === "inactive") {
  57459. return _utils.HTMLResult.EMPTY;
  57460. }
  57461. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  57462. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  57463. }
  57464. if (this.breakBefore.children.length >= 1) {
  57465. const breakBefore = this.breakBefore.children[0];
  57466. if (handleBreak(breakBefore)) {
  57467. return _utils.HTMLResult.breakNode(breakBefore);
  57468. }
  57469. }
  57470. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  57471. return _utils.HTMLResult.EMPTY;
  57472. }
  57473. (0, _html_utils.fixDimensions)(this);
  57474. const children = [];
  57475. const attributes = {
  57476. id: this[_xfa_object.$uid],
  57477. class: []
  57478. };
  57479. (0, _html_utils.setAccess)(this, attributes.class);
  57480. if (!this[_xfa_object.$extra]) {
  57481. this[_xfa_object.$extra] = Object.create(null);
  57482. }
  57483. Object.assign(this[_xfa_object.$extra], {
  57484. children,
  57485. line: null,
  57486. attributes,
  57487. attempt: 0,
  57488. numberInLine: 0,
  57489. availableSpace: {
  57490. width: Math.min(this.w || Infinity, availableSpace.width),
  57491. height: Math.min(this.h || Infinity, availableSpace.height)
  57492. },
  57493. width: 0,
  57494. height: 0,
  57495. prevHeight: 0,
  57496. currentWidth: 0
  57497. });
  57498. const root = this[_xfa_object.$getTemplateRoot]();
  57499. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  57500. const isSplittable = this[_xfa_object.$isSplittable]();
  57501. if (!isSplittable) {
  57502. setFirstUnsplittable(this);
  57503. }
  57504. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  57505. return _utils.HTMLResult.FAILURE;
  57506. }
  57507. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  57508. if (this.layout.includes("row")) {
  57509. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  57510. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  57511. this[_xfa_object.$extra].columnWidths = columnWidths;
  57512. this[_xfa_object.$extra].currentColumn = 0;
  57513. }
  57514. }
  57515. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  57516. const classNames = ["xfaSubform"];
  57517. const cl = (0, _html_utils.layoutClass)(this);
  57518. if (cl) {
  57519. classNames.push(cl);
  57520. }
  57521. attributes.style = style;
  57522. attributes.class = classNames;
  57523. if (this.name) {
  57524. attributes.xfaName = this.name;
  57525. }
  57526. if (this.overflow) {
  57527. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57528. if (overflowExtra.addLeader) {
  57529. overflowExtra.addLeader = false;
  57530. handleOverflow(this, overflowExtra.leader, availableSpace);
  57531. }
  57532. }
  57533. this[_xfa_object.$pushPara]();
  57534. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  57535. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  57536. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  57537. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  57538. this[_xfa_object.$extra].numberInLine = 0;
  57539. }
  57540. const result = this[_xfa_object.$childrenToHTML]({
  57541. filter,
  57542. include: true
  57543. });
  57544. if (result.success) {
  57545. break;
  57546. }
  57547. if (result.isBreak()) {
  57548. this[_xfa_object.$popPara]();
  57549. return result;
  57550. }
  57551. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  57552. this[_xfa_object.$extra].attempt = maxRun;
  57553. break;
  57554. }
  57555. }
  57556. this[_xfa_object.$popPara]();
  57557. if (!isSplittable) {
  57558. unsetFirstUnsplittable(this);
  57559. }
  57560. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  57561. if (this[_xfa_object.$extra].attempt === maxRun) {
  57562. if (this.overflow) {
  57563. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  57564. }
  57565. if (!isSplittable) {
  57566. delete this[_xfa_object.$extra];
  57567. }
  57568. return _utils.HTMLResult.FAILURE;
  57569. }
  57570. if (this.overflow) {
  57571. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57572. if (overflowExtra.addTrailer) {
  57573. overflowExtra.addTrailer = false;
  57574. handleOverflow(this, overflowExtra.trailer, availableSpace);
  57575. }
  57576. }
  57577. let marginH = 0;
  57578. let marginV = 0;
  57579. if (this.margin) {
  57580. marginH = this.margin.leftInset + this.margin.rightInset;
  57581. marginV = this.margin.topInset + this.margin.bottomInset;
  57582. }
  57583. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  57584. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  57585. const bbox = [this.x, this.y, width, height];
  57586. if (this.w === "") {
  57587. style.width = (0, _html_utils.measureToString)(width);
  57588. }
  57589. if (this.h === "") {
  57590. style.height = (0, _html_utils.measureToString)(height);
  57591. }
  57592. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  57593. return _utils.HTMLResult.EMPTY;
  57594. }
  57595. const html = {
  57596. name: "div",
  57597. attributes,
  57598. children
  57599. };
  57600. applyAssist(this, attributes);
  57601. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  57602. if (this.breakAfter.children.length >= 1) {
  57603. const breakAfter = this.breakAfter.children[0];
  57604. if (handleBreak(breakAfter)) {
  57605. this[_xfa_object.$extra].afterBreakAfter = result;
  57606. return _utils.HTMLResult.breakNode(breakAfter);
  57607. }
  57608. }
  57609. delete this[_xfa_object.$extra];
  57610. return result;
  57611. }
  57612. }
  57613. class SubformSet extends _xfa_object.XFAObject {
  57614. constructor(attributes) {
  57615. super(TEMPLATE_NS_ID, "subformSet", true);
  57616. this.id = attributes.id || "";
  57617. this.name = attributes.name || "";
  57618. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  57619. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57620. this.use = attributes.use || "";
  57621. this.usehref = attributes.usehref || "";
  57622. this.bookend = null;
  57623. this.break = null;
  57624. this.desc = null;
  57625. this.extras = null;
  57626. this.occur = null;
  57627. this.overflow = null;
  57628. this.breakAfter = new _xfa_object.XFAObjectArray();
  57629. this.breakBefore = new _xfa_object.XFAObjectArray();
  57630. this.subform = new _xfa_object.XFAObjectArray();
  57631. this.subformSet = new _xfa_object.XFAObjectArray();
  57632. }
  57633. *[_xfa_object.$getContainedChildren]() {
  57634. yield* getContainedChildren(this);
  57635. }
  57636. [_xfa_object.$getSubformParent]() {
  57637. let parent = this[_xfa_object.$getParent]();
  57638. while (!(parent instanceof Subform)) {
  57639. parent = parent[_xfa_object.$getParent]();
  57640. }
  57641. return parent;
  57642. }
  57643. [_xfa_object.$isBindable]() {
  57644. return true;
  57645. }
  57646. }
  57647. class SubjectDN extends _xfa_object.ContentObject {
  57648. constructor(attributes) {
  57649. super(TEMPLATE_NS_ID, "subjectDN");
  57650. this.delimiter = attributes.delimiter || ",";
  57651. this.id = attributes.id || "";
  57652. this.name = attributes.name || "";
  57653. this.use = attributes.use || "";
  57654. this.usehref = attributes.usehref || "";
  57655. }
  57656. [_xfa_object.$finalize]() {
  57657. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  57658. kv = kv.split("=", 2);
  57659. kv[0] = kv[0].trim();
  57660. return kv;
  57661. }));
  57662. }
  57663. }
  57664. class SubjectDNs extends _xfa_object.XFAObject {
  57665. constructor(attributes) {
  57666. super(TEMPLATE_NS_ID, "subjectDNs", true);
  57667. this.id = attributes.id || "";
  57668. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57669. this.use = attributes.use || "";
  57670. this.usehref = attributes.usehref || "";
  57671. this.subjectDN = new _xfa_object.XFAObjectArray();
  57672. }
  57673. }
  57674. class Submit extends _xfa_object.XFAObject {
  57675. constructor(attributes) {
  57676. super(TEMPLATE_NS_ID, "submit", true);
  57677. this.embedPDF = (0, _utils.getInteger)({
  57678. data: attributes.embedPDF,
  57679. defaultValue: 0,
  57680. validate: x => x === 1
  57681. });
  57682. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  57683. this.id = attributes.id || "";
  57684. this.target = attributes.target || "";
  57685. this.textEncoding = (0, _utils.getKeyword)({
  57686. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  57687. defaultValue: "",
  57688. 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}/)
  57689. });
  57690. this.use = attributes.use || "";
  57691. this.usehref = attributes.usehref || "";
  57692. this.xdpContent = attributes.xdpContent || "";
  57693. this.encrypt = null;
  57694. this.encryptData = new _xfa_object.XFAObjectArray();
  57695. this.signData = new _xfa_object.XFAObjectArray();
  57696. }
  57697. }
  57698. class Template extends _xfa_object.XFAObject {
  57699. constructor(attributes) {
  57700. super(TEMPLATE_NS_ID, "template", true);
  57701. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  57702. this.extras = null;
  57703. this.subform = new _xfa_object.XFAObjectArray();
  57704. }
  57705. [_xfa_object.$finalize]() {
  57706. if (this.subform.children.length === 0) {
  57707. (0, _util.warn)("XFA - No subforms in template node.");
  57708. }
  57709. if (this.subform.children.length >= 2) {
  57710. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  57711. }
  57712. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  57713. }
  57714. [_xfa_object.$isSplittable]() {
  57715. return true;
  57716. }
  57717. [_xfa_object.$searchNode](expr, container) {
  57718. if (expr.startsWith("#")) {
  57719. return [this[_xfa_object.$ids].get(expr.slice(1))];
  57720. }
  57721. return (0, _som.searchNode)(this, container, expr, true, true);
  57722. }
  57723. *[_xfa_object.$toPages]() {
  57724. if (!this.subform.children.length) {
  57725. return _utils.HTMLResult.success({
  57726. name: "div",
  57727. children: []
  57728. });
  57729. }
  57730. this[_xfa_object.$extra] = {
  57731. overflowNode: null,
  57732. firstUnsplittable: null,
  57733. currentContentArea: null,
  57734. currentPageArea: null,
  57735. noLayoutFailure: false,
  57736. pageNumber: 1,
  57737. pagePosition: "first",
  57738. oddOrEven: "odd",
  57739. blankOrNotBlank: "nonBlank",
  57740. paraStack: []
  57741. };
  57742. const root = this.subform.children[0];
  57743. root.pageSet[_xfa_object.$cleanPage]();
  57744. const pageAreas = root.pageSet.pageArea.children;
  57745. const mainHtml = {
  57746. name: "div",
  57747. children: []
  57748. };
  57749. let pageArea = null;
  57750. let breakBefore = null;
  57751. let breakBeforeTarget = null;
  57752. if (root.breakBefore.children.length >= 1) {
  57753. breakBefore = root.breakBefore.children[0];
  57754. breakBeforeTarget = breakBefore.target;
  57755. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  57756. breakBefore = root.subform.children[0].breakBefore.children[0];
  57757. breakBeforeTarget = breakBefore.target;
  57758. } else if (root.break && root.break.beforeTarget) {
  57759. breakBefore = root.break;
  57760. breakBeforeTarget = breakBefore.beforeTarget;
  57761. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  57762. breakBefore = root.subform.children[0].break;
  57763. breakBeforeTarget = breakBefore.beforeTarget;
  57764. }
  57765. if (breakBefore) {
  57766. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  57767. if (target instanceof PageArea) {
  57768. pageArea = target;
  57769. breakBefore[_xfa_object.$extra] = {};
  57770. }
  57771. }
  57772. if (!pageArea) {
  57773. pageArea = pageAreas[0];
  57774. }
  57775. pageArea[_xfa_object.$extra] = {
  57776. numberOfUse: 1
  57777. };
  57778. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  57779. pageAreaParent[_xfa_object.$extra] = {
  57780. numberOfUse: 1,
  57781. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  57782. pageSetIndex: 0
  57783. };
  57784. let targetPageArea;
  57785. let leader = null;
  57786. let trailer = null;
  57787. let hasSomething = true;
  57788. let hasSomethingCounter = 0;
  57789. let startIndex = 0;
  57790. while (true) {
  57791. if (!hasSomething) {
  57792. mainHtml.children.pop();
  57793. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  57794. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  57795. return mainHtml;
  57796. }
  57797. } else {
  57798. hasSomethingCounter = 0;
  57799. }
  57800. targetPageArea = null;
  57801. this[_xfa_object.$extra].currentPageArea = pageArea;
  57802. const page = pageArea[_xfa_object.$toHTML]().html;
  57803. mainHtml.children.push(page);
  57804. if (leader) {
  57805. this[_xfa_object.$extra].noLayoutFailure = true;
  57806. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57807. leader = null;
  57808. }
  57809. if (trailer) {
  57810. this[_xfa_object.$extra].noLayoutFailure = true;
  57811. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57812. trailer = null;
  57813. }
  57814. const contentAreas = pageArea.contentArea.children;
  57815. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  57816. hasSomething = false;
  57817. this[_xfa_object.$extra].firstUnsplittable = null;
  57818. this[_xfa_object.$extra].noLayoutFailure = false;
  57819. const flush = index => {
  57820. const html = root[_xfa_object.$flushHTML]();
  57821. if (html) {
  57822. hasSomething = hasSomething || html.children && html.children.length !== 0;
  57823. htmlContentAreas[index].children.push(html);
  57824. }
  57825. };
  57826. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  57827. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  57828. const space = {
  57829. width: contentArea.w,
  57830. height: contentArea.h
  57831. };
  57832. startIndex = 0;
  57833. if (leader) {
  57834. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  57835. leader = null;
  57836. }
  57837. if (trailer) {
  57838. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  57839. trailer = null;
  57840. }
  57841. const html = root[_xfa_object.$toHTML](space);
  57842. if (html.success) {
  57843. if (html.html) {
  57844. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  57845. htmlContentAreas[i].children.push(html.html);
  57846. } else if (!hasSomething && mainHtml.children.length > 1) {
  57847. mainHtml.children.pop();
  57848. }
  57849. return mainHtml;
  57850. }
  57851. if (html.isBreak()) {
  57852. const node = html.breakNode;
  57853. flush(i);
  57854. if (node.targetType === "auto") {
  57855. continue;
  57856. }
  57857. if (node.leader) {
  57858. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  57859. leader = leader ? leader[0] : null;
  57860. }
  57861. if (node.trailer) {
  57862. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  57863. trailer = trailer ? trailer[0] : null;
  57864. }
  57865. if (node.targetType === "pageArea") {
  57866. targetPageArea = node[_xfa_object.$extra].target;
  57867. i = Infinity;
  57868. } else if (!node[_xfa_object.$extra].target) {
  57869. i = node[_xfa_object.$extra].index;
  57870. } else {
  57871. targetPageArea = node[_xfa_object.$extra].target;
  57872. startIndex = node[_xfa_object.$extra].index + 1;
  57873. i = Infinity;
  57874. }
  57875. continue;
  57876. }
  57877. if (this[_xfa_object.$extra].overflowNode) {
  57878. const node = this[_xfa_object.$extra].overflowNode;
  57879. this[_xfa_object.$extra].overflowNode = null;
  57880. const overflowExtra = node[_xfa_object.$getExtra]();
  57881. const target = overflowExtra.target;
  57882. overflowExtra.addLeader = overflowExtra.leader !== null;
  57883. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  57884. flush(i);
  57885. const currentIndex = i;
  57886. i = Infinity;
  57887. if (target instanceof PageArea) {
  57888. targetPageArea = target;
  57889. } else if (target instanceof ContentArea) {
  57890. const index = contentAreas.indexOf(target);
  57891. if (index !== -1) {
  57892. if (index > currentIndex) {
  57893. i = index - 1;
  57894. } else {
  57895. startIndex = index;
  57896. }
  57897. } else {
  57898. targetPageArea = target[_xfa_object.$getParent]();
  57899. startIndex = targetPageArea.contentArea.children.indexOf(target);
  57900. }
  57901. }
  57902. continue;
  57903. }
  57904. flush(i);
  57905. }
  57906. this[_xfa_object.$extra].pageNumber += 1;
  57907. if (targetPageArea) {
  57908. if (targetPageArea[_xfa_object.$isUsable]()) {
  57909. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  57910. } else {
  57911. targetPageArea = null;
  57912. }
  57913. }
  57914. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  57915. yield null;
  57916. }
  57917. }
  57918. }
  57919. exports.Template = Template;
  57920. class Text extends _xfa_object.ContentObject {
  57921. constructor(attributes) {
  57922. super(TEMPLATE_NS_ID, "text");
  57923. this.id = attributes.id || "";
  57924. this.maxChars = (0, _utils.getInteger)({
  57925. data: attributes.maxChars,
  57926. defaultValue: 0,
  57927. validate: x => x >= 0
  57928. });
  57929. this.name = attributes.name || "";
  57930. this.rid = attributes.rid || "";
  57931. this.use = attributes.use || "";
  57932. this.usehref = attributes.usehref || "";
  57933. }
  57934. [_xfa_object.$acceptWhitespace]() {
  57935. return true;
  57936. }
  57937. [_xfa_object.$onChild](child) {
  57938. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  57939. this[_xfa_object.$content] = child;
  57940. return true;
  57941. }
  57942. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  57943. return false;
  57944. }
  57945. [_xfa_object.$onText](str) {
  57946. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  57947. return;
  57948. }
  57949. super[_xfa_object.$onText](str);
  57950. }
  57951. [_xfa_object.$finalize]() {
  57952. if (typeof this[_xfa_object.$content] === "string") {
  57953. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  57954. }
  57955. }
  57956. [_xfa_object.$getExtra]() {
  57957. if (typeof this[_xfa_object.$content] === "string") {
  57958. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  57959. if (line) {
  57960. acc.push(line);
  57961. }
  57962. return acc;
  57963. }, []).join("\n");
  57964. }
  57965. return this[_xfa_object.$content][_xfa_object.$text]();
  57966. }
  57967. [_xfa_object.$toHTML](availableSpace) {
  57968. if (typeof this[_xfa_object.$content] === "string") {
  57969. const html = valueToHtml(this[_xfa_object.$content]).html;
  57970. if (this[_xfa_object.$content].includes("\u2029")) {
  57971. html.name = "div";
  57972. html.children = [];
  57973. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  57974. acc.push({
  57975. name: "span",
  57976. value: line
  57977. }, {
  57978. name: "br"
  57979. });
  57980. return acc;
  57981. }, [])).forEach(lines => {
  57982. html.children.push({
  57983. name: "p",
  57984. children: lines
  57985. });
  57986. });
  57987. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  57988. html.name = "div";
  57989. html.children = [];
  57990. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  57991. html.children.push({
  57992. name: "span",
  57993. value: line
  57994. }, {
  57995. name: "br"
  57996. });
  57997. });
  57998. }
  57999. return _utils.HTMLResult.success(html);
  58000. }
  58001. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  58002. }
  58003. }
  58004. exports.Text = Text;
  58005. class TextEdit extends _xfa_object.XFAObject {
  58006. constructor(attributes) {
  58007. super(TEMPLATE_NS_ID, "textEdit", true);
  58008. this.allowRichText = (0, _utils.getInteger)({
  58009. data: attributes.allowRichText,
  58010. defaultValue: 0,
  58011. validate: x => x === 1
  58012. });
  58013. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  58014. this.id = attributes.id || "";
  58015. this.multiLine = (0, _utils.getInteger)({
  58016. data: attributes.multiLine,
  58017. defaultValue: "",
  58018. validate: x => x === 0 || x === 1
  58019. });
  58020. this.use = attributes.use || "";
  58021. this.usehref = attributes.usehref || "";
  58022. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  58023. this.border = null;
  58024. this.comb = null;
  58025. this.extras = null;
  58026. this.margin = null;
  58027. }
  58028. [_xfa_object.$toHTML](availableSpace) {
  58029. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  58030. let html;
  58031. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  58032. if (this.multiLine === "") {
  58033. this.multiLine = field instanceof Draw ? 1 : 0;
  58034. }
  58035. if (this.multiLine === 1) {
  58036. html = {
  58037. name: "textarea",
  58038. attributes: {
  58039. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58040. fieldId: field[_xfa_object.$uid],
  58041. class: ["xfaTextfield"],
  58042. style,
  58043. "aria-label": ariaLabel(field),
  58044. "aria-required": false
  58045. }
  58046. };
  58047. } else {
  58048. html = {
  58049. name: "input",
  58050. attributes: {
  58051. type: "text",
  58052. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  58053. fieldId: field[_xfa_object.$uid],
  58054. class: ["xfaTextfield"],
  58055. style,
  58056. "aria-label": ariaLabel(field),
  58057. "aria-required": false
  58058. }
  58059. };
  58060. }
  58061. if (isRequired(field)) {
  58062. html.attributes["aria-required"] = true;
  58063. html.attributes.required = true;
  58064. }
  58065. return _utils.HTMLResult.success({
  58066. name: "label",
  58067. attributes: {
  58068. class: ["xfaLabel"]
  58069. },
  58070. children: [html]
  58071. });
  58072. }
  58073. }
  58074. class Time extends _xfa_object.StringObject {
  58075. constructor(attributes) {
  58076. super(TEMPLATE_NS_ID, "time");
  58077. this.id = attributes.id || "";
  58078. this.name = attributes.name || "";
  58079. this.use = attributes.use || "";
  58080. this.usehref = attributes.usehref || "";
  58081. }
  58082. [_xfa_object.$finalize]() {
  58083. const date = this[_xfa_object.$content].trim();
  58084. this[_xfa_object.$content] = date ? new Date(date) : null;
  58085. }
  58086. [_xfa_object.$toHTML](availableSpace) {
  58087. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  58088. }
  58089. }
  58090. class TimeStamp extends _xfa_object.XFAObject {
  58091. constructor(attributes) {
  58092. super(TEMPLATE_NS_ID, "timeStamp");
  58093. this.id = attributes.id || "";
  58094. this.server = attributes.server || "";
  58095. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58096. this.use = attributes.use || "";
  58097. this.usehref = attributes.usehref || "";
  58098. }
  58099. }
  58100. class ToolTip extends _xfa_object.StringObject {
  58101. constructor(attributes) {
  58102. super(TEMPLATE_NS_ID, "toolTip");
  58103. this.id = attributes.id || "";
  58104. this.rid = attributes.rid || "";
  58105. this.use = attributes.use || "";
  58106. this.usehref = attributes.usehref || "";
  58107. }
  58108. }
  58109. class Traversal extends _xfa_object.XFAObject {
  58110. constructor(attributes) {
  58111. super(TEMPLATE_NS_ID, "traversal", true);
  58112. this.id = attributes.id || "";
  58113. this.use = attributes.use || "";
  58114. this.usehref = attributes.usehref || "";
  58115. this.extras = null;
  58116. this.traverse = new _xfa_object.XFAObjectArray();
  58117. }
  58118. }
  58119. class Traverse extends _xfa_object.XFAObject {
  58120. constructor(attributes) {
  58121. super(TEMPLATE_NS_ID, "traverse", true);
  58122. this.id = attributes.id || "";
  58123. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  58124. this.ref = attributes.ref || "";
  58125. this.use = attributes.use || "";
  58126. this.usehref = attributes.usehref || "";
  58127. this.extras = null;
  58128. this.script = null;
  58129. }
  58130. get name() {
  58131. return this.operation;
  58132. }
  58133. [_xfa_object.$isTransparent]() {
  58134. return false;
  58135. }
  58136. }
  58137. class Ui extends _xfa_object.XFAObject {
  58138. constructor(attributes) {
  58139. super(TEMPLATE_NS_ID, "ui", true);
  58140. this.id = attributes.id || "";
  58141. this.use = attributes.use || "";
  58142. this.usehref = attributes.usehref || "";
  58143. this.extras = null;
  58144. this.picture = null;
  58145. this.barcode = null;
  58146. this.button = null;
  58147. this.checkButton = null;
  58148. this.choiceList = null;
  58149. this.dateTimeEdit = null;
  58150. this.defaultUi = null;
  58151. this.imageEdit = null;
  58152. this.numericEdit = null;
  58153. this.passwordEdit = null;
  58154. this.signature = null;
  58155. this.textEdit = null;
  58156. }
  58157. [_xfa_object.$getExtra]() {
  58158. if (this[_xfa_object.$extra] === undefined) {
  58159. for (const name of Object.getOwnPropertyNames(this)) {
  58160. if (name === "extras" || name === "picture") {
  58161. continue;
  58162. }
  58163. const obj = this[name];
  58164. if (!(obj instanceof _xfa_object.XFAObject)) {
  58165. continue;
  58166. }
  58167. this[_xfa_object.$extra] = obj;
  58168. return obj;
  58169. }
  58170. this[_xfa_object.$extra] = null;
  58171. }
  58172. return this[_xfa_object.$extra];
  58173. }
  58174. [_xfa_object.$toHTML](availableSpace) {
  58175. const obj = this[_xfa_object.$getExtra]();
  58176. if (obj) {
  58177. return obj[_xfa_object.$toHTML](availableSpace);
  58178. }
  58179. return _utils.HTMLResult.EMPTY;
  58180. }
  58181. }
  58182. class Validate extends _xfa_object.XFAObject {
  58183. constructor(attributes) {
  58184. super(TEMPLATE_NS_ID, "validate", true);
  58185. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  58186. this.id = attributes.id || "";
  58187. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  58188. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  58189. this.use = attributes.use || "";
  58190. this.usehref = attributes.usehref || "";
  58191. this.extras = null;
  58192. this.message = null;
  58193. this.picture = null;
  58194. this.script = null;
  58195. }
  58196. }
  58197. class Value extends _xfa_object.XFAObject {
  58198. constructor(attributes) {
  58199. super(TEMPLATE_NS_ID, "value", true);
  58200. this.id = attributes.id || "";
  58201. this.override = (0, _utils.getInteger)({
  58202. data: attributes.override,
  58203. defaultValue: 0,
  58204. validate: x => x === 1
  58205. });
  58206. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58207. this.use = attributes.use || "";
  58208. this.usehref = attributes.usehref || "";
  58209. this.arc = null;
  58210. this.boolean = null;
  58211. this.date = null;
  58212. this.dateTime = null;
  58213. this.decimal = null;
  58214. this.exData = null;
  58215. this.float = null;
  58216. this.image = null;
  58217. this.integer = null;
  58218. this.line = null;
  58219. this.rectangle = null;
  58220. this.text = null;
  58221. this.time = null;
  58222. }
  58223. [_xfa_object.$setValue](value) {
  58224. const parent = this[_xfa_object.$getParent]();
  58225. if (parent instanceof Field) {
  58226. if (parent.ui && parent.ui.imageEdit) {
  58227. if (!this.image) {
  58228. this.image = new Image({});
  58229. this[_xfa_object.$appendChild](this.image);
  58230. }
  58231. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  58232. return;
  58233. }
  58234. }
  58235. const valueName = value[_xfa_object.$nodeName];
  58236. if (this[valueName] !== null) {
  58237. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  58238. return;
  58239. }
  58240. for (const name of Object.getOwnPropertyNames(this)) {
  58241. const obj = this[name];
  58242. if (obj instanceof _xfa_object.XFAObject) {
  58243. this[name] = null;
  58244. this[_xfa_object.$removeChild](obj);
  58245. }
  58246. }
  58247. this[value[_xfa_object.$nodeName]] = value;
  58248. this[_xfa_object.$appendChild](value);
  58249. }
  58250. [_xfa_object.$text]() {
  58251. if (this.exData) {
  58252. if (typeof this.exData[_xfa_object.$content] === "string") {
  58253. return this.exData[_xfa_object.$content].trim();
  58254. }
  58255. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  58256. }
  58257. for (const name of Object.getOwnPropertyNames(this)) {
  58258. if (name === "image") {
  58259. continue;
  58260. }
  58261. const obj = this[name];
  58262. if (obj instanceof _xfa_object.XFAObject) {
  58263. return (obj[_xfa_object.$content] || "").toString().trim();
  58264. }
  58265. }
  58266. return null;
  58267. }
  58268. [_xfa_object.$toHTML](availableSpace) {
  58269. for (const name of Object.getOwnPropertyNames(this)) {
  58270. const obj = this[name];
  58271. if (!(obj instanceof _xfa_object.XFAObject)) {
  58272. continue;
  58273. }
  58274. return obj[_xfa_object.$toHTML](availableSpace);
  58275. }
  58276. return _utils.HTMLResult.EMPTY;
  58277. }
  58278. }
  58279. exports.Value = Value;
  58280. class Variables extends _xfa_object.XFAObject {
  58281. constructor(attributes) {
  58282. super(TEMPLATE_NS_ID, "variables", true);
  58283. this.id = attributes.id || "";
  58284. this.use = attributes.use || "";
  58285. this.usehref = attributes.usehref || "";
  58286. this.boolean = new _xfa_object.XFAObjectArray();
  58287. this.date = new _xfa_object.XFAObjectArray();
  58288. this.dateTime = new _xfa_object.XFAObjectArray();
  58289. this.decimal = new _xfa_object.XFAObjectArray();
  58290. this.exData = new _xfa_object.XFAObjectArray();
  58291. this.float = new _xfa_object.XFAObjectArray();
  58292. this.image = new _xfa_object.XFAObjectArray();
  58293. this.integer = new _xfa_object.XFAObjectArray();
  58294. this.manifest = new _xfa_object.XFAObjectArray();
  58295. this.script = new _xfa_object.XFAObjectArray();
  58296. this.text = new _xfa_object.XFAObjectArray();
  58297. this.time = new _xfa_object.XFAObjectArray();
  58298. }
  58299. [_xfa_object.$isTransparent]() {
  58300. return true;
  58301. }
  58302. }
  58303. class TemplateNamespace {
  58304. static [_namespaces.$buildXFAObject](name, attributes) {
  58305. if (TemplateNamespace.hasOwnProperty(name)) {
  58306. const node = TemplateNamespace[name](attributes);
  58307. node[_xfa_object.$setSetAttributes](attributes);
  58308. return node;
  58309. }
  58310. return undefined;
  58311. }
  58312. static appearanceFilter(attrs) {
  58313. return new AppearanceFilter(attrs);
  58314. }
  58315. static arc(attrs) {
  58316. return new Arc(attrs);
  58317. }
  58318. static area(attrs) {
  58319. return new Area(attrs);
  58320. }
  58321. static assist(attrs) {
  58322. return new Assist(attrs);
  58323. }
  58324. static barcode(attrs) {
  58325. return new Barcode(attrs);
  58326. }
  58327. static bind(attrs) {
  58328. return new Bind(attrs);
  58329. }
  58330. static bindItems(attrs) {
  58331. return new BindItems(attrs);
  58332. }
  58333. static bookend(attrs) {
  58334. return new Bookend(attrs);
  58335. }
  58336. static boolean(attrs) {
  58337. return new BooleanElement(attrs);
  58338. }
  58339. static border(attrs) {
  58340. return new Border(attrs);
  58341. }
  58342. static break(attrs) {
  58343. return new Break(attrs);
  58344. }
  58345. static breakAfter(attrs) {
  58346. return new BreakAfter(attrs);
  58347. }
  58348. static breakBefore(attrs) {
  58349. return new BreakBefore(attrs);
  58350. }
  58351. static button(attrs) {
  58352. return new Button(attrs);
  58353. }
  58354. static calculate(attrs) {
  58355. return new Calculate(attrs);
  58356. }
  58357. static caption(attrs) {
  58358. return new Caption(attrs);
  58359. }
  58360. static certificate(attrs) {
  58361. return new Certificate(attrs);
  58362. }
  58363. static certificates(attrs) {
  58364. return new Certificates(attrs);
  58365. }
  58366. static checkButton(attrs) {
  58367. return new CheckButton(attrs);
  58368. }
  58369. static choiceList(attrs) {
  58370. return new ChoiceList(attrs);
  58371. }
  58372. static color(attrs) {
  58373. return new Color(attrs);
  58374. }
  58375. static comb(attrs) {
  58376. return new Comb(attrs);
  58377. }
  58378. static connect(attrs) {
  58379. return new Connect(attrs);
  58380. }
  58381. static contentArea(attrs) {
  58382. return new ContentArea(attrs);
  58383. }
  58384. static corner(attrs) {
  58385. return new Corner(attrs);
  58386. }
  58387. static date(attrs) {
  58388. return new DateElement(attrs);
  58389. }
  58390. static dateTime(attrs) {
  58391. return new DateTime(attrs);
  58392. }
  58393. static dateTimeEdit(attrs) {
  58394. return new DateTimeEdit(attrs);
  58395. }
  58396. static decimal(attrs) {
  58397. return new Decimal(attrs);
  58398. }
  58399. static defaultUi(attrs) {
  58400. return new DefaultUi(attrs);
  58401. }
  58402. static desc(attrs) {
  58403. return new Desc(attrs);
  58404. }
  58405. static digestMethod(attrs) {
  58406. return new DigestMethod(attrs);
  58407. }
  58408. static digestMethods(attrs) {
  58409. return new DigestMethods(attrs);
  58410. }
  58411. static draw(attrs) {
  58412. return new Draw(attrs);
  58413. }
  58414. static edge(attrs) {
  58415. return new Edge(attrs);
  58416. }
  58417. static encoding(attrs) {
  58418. return new Encoding(attrs);
  58419. }
  58420. static encodings(attrs) {
  58421. return new Encodings(attrs);
  58422. }
  58423. static encrypt(attrs) {
  58424. return new Encrypt(attrs);
  58425. }
  58426. static encryptData(attrs) {
  58427. return new EncryptData(attrs);
  58428. }
  58429. static encryption(attrs) {
  58430. return new Encryption(attrs);
  58431. }
  58432. static encryptionMethod(attrs) {
  58433. return new EncryptionMethod(attrs);
  58434. }
  58435. static encryptionMethods(attrs) {
  58436. return new EncryptionMethods(attrs);
  58437. }
  58438. static event(attrs) {
  58439. return new Event(attrs);
  58440. }
  58441. static exData(attrs) {
  58442. return new ExData(attrs);
  58443. }
  58444. static exObject(attrs) {
  58445. return new ExObject(attrs);
  58446. }
  58447. static exclGroup(attrs) {
  58448. return new ExclGroup(attrs);
  58449. }
  58450. static execute(attrs) {
  58451. return new Execute(attrs);
  58452. }
  58453. static extras(attrs) {
  58454. return new Extras(attrs);
  58455. }
  58456. static field(attrs) {
  58457. return new Field(attrs);
  58458. }
  58459. static fill(attrs) {
  58460. return new Fill(attrs);
  58461. }
  58462. static filter(attrs) {
  58463. return new Filter(attrs);
  58464. }
  58465. static float(attrs) {
  58466. return new Float(attrs);
  58467. }
  58468. static font(attrs) {
  58469. return new Font(attrs);
  58470. }
  58471. static format(attrs) {
  58472. return new Format(attrs);
  58473. }
  58474. static handler(attrs) {
  58475. return new Handler(attrs);
  58476. }
  58477. static hyphenation(attrs) {
  58478. return new Hyphenation(attrs);
  58479. }
  58480. static image(attrs) {
  58481. return new Image(attrs);
  58482. }
  58483. static imageEdit(attrs) {
  58484. return new ImageEdit(attrs);
  58485. }
  58486. static integer(attrs) {
  58487. return new Integer(attrs);
  58488. }
  58489. static issuers(attrs) {
  58490. return new Issuers(attrs);
  58491. }
  58492. static items(attrs) {
  58493. return new Items(attrs);
  58494. }
  58495. static keep(attrs) {
  58496. return new Keep(attrs);
  58497. }
  58498. static keyUsage(attrs) {
  58499. return new KeyUsage(attrs);
  58500. }
  58501. static line(attrs) {
  58502. return new Line(attrs);
  58503. }
  58504. static linear(attrs) {
  58505. return new Linear(attrs);
  58506. }
  58507. static lockDocument(attrs) {
  58508. return new LockDocument(attrs);
  58509. }
  58510. static manifest(attrs) {
  58511. return new Manifest(attrs);
  58512. }
  58513. static margin(attrs) {
  58514. return new Margin(attrs);
  58515. }
  58516. static mdp(attrs) {
  58517. return new Mdp(attrs);
  58518. }
  58519. static medium(attrs) {
  58520. return new Medium(attrs);
  58521. }
  58522. static message(attrs) {
  58523. return new Message(attrs);
  58524. }
  58525. static numericEdit(attrs) {
  58526. return new NumericEdit(attrs);
  58527. }
  58528. static occur(attrs) {
  58529. return new Occur(attrs);
  58530. }
  58531. static oid(attrs) {
  58532. return new Oid(attrs);
  58533. }
  58534. static oids(attrs) {
  58535. return new Oids(attrs);
  58536. }
  58537. static overflow(attrs) {
  58538. return new Overflow(attrs);
  58539. }
  58540. static pageArea(attrs) {
  58541. return new PageArea(attrs);
  58542. }
  58543. static pageSet(attrs) {
  58544. return new PageSet(attrs);
  58545. }
  58546. static para(attrs) {
  58547. return new Para(attrs);
  58548. }
  58549. static passwordEdit(attrs) {
  58550. return new PasswordEdit(attrs);
  58551. }
  58552. static pattern(attrs) {
  58553. return new Pattern(attrs);
  58554. }
  58555. static picture(attrs) {
  58556. return new Picture(attrs);
  58557. }
  58558. static proto(attrs) {
  58559. return new Proto(attrs);
  58560. }
  58561. static radial(attrs) {
  58562. return new Radial(attrs);
  58563. }
  58564. static reason(attrs) {
  58565. return new Reason(attrs);
  58566. }
  58567. static reasons(attrs) {
  58568. return new Reasons(attrs);
  58569. }
  58570. static rectangle(attrs) {
  58571. return new Rectangle(attrs);
  58572. }
  58573. static ref(attrs) {
  58574. return new RefElement(attrs);
  58575. }
  58576. static script(attrs) {
  58577. return new Script(attrs);
  58578. }
  58579. static setProperty(attrs) {
  58580. return new SetProperty(attrs);
  58581. }
  58582. static signData(attrs) {
  58583. return new SignData(attrs);
  58584. }
  58585. static signature(attrs) {
  58586. return new Signature(attrs);
  58587. }
  58588. static signing(attrs) {
  58589. return new Signing(attrs);
  58590. }
  58591. static solid(attrs) {
  58592. return new Solid(attrs);
  58593. }
  58594. static speak(attrs) {
  58595. return new Speak(attrs);
  58596. }
  58597. static stipple(attrs) {
  58598. return new Stipple(attrs);
  58599. }
  58600. static subform(attrs) {
  58601. return new Subform(attrs);
  58602. }
  58603. static subformSet(attrs) {
  58604. return new SubformSet(attrs);
  58605. }
  58606. static subjectDN(attrs) {
  58607. return new SubjectDN(attrs);
  58608. }
  58609. static subjectDNs(attrs) {
  58610. return new SubjectDNs(attrs);
  58611. }
  58612. static submit(attrs) {
  58613. return new Submit(attrs);
  58614. }
  58615. static template(attrs) {
  58616. return new Template(attrs);
  58617. }
  58618. static text(attrs) {
  58619. return new Text(attrs);
  58620. }
  58621. static textEdit(attrs) {
  58622. return new TextEdit(attrs);
  58623. }
  58624. static time(attrs) {
  58625. return new Time(attrs);
  58626. }
  58627. static timeStamp(attrs) {
  58628. return new TimeStamp(attrs);
  58629. }
  58630. static toolTip(attrs) {
  58631. return new ToolTip(attrs);
  58632. }
  58633. static traversal(attrs) {
  58634. return new Traversal(attrs);
  58635. }
  58636. static traverse(attrs) {
  58637. return new Traverse(attrs);
  58638. }
  58639. static ui(attrs) {
  58640. return new Ui(attrs);
  58641. }
  58642. static validate(attrs) {
  58643. return new Validate(attrs);
  58644. }
  58645. static value(attrs) {
  58646. return new Value(attrs);
  58647. }
  58648. static variables(attrs) {
  58649. return new Variables(attrs);
  58650. }
  58651. }
  58652. exports.TemplateNamespace = TemplateNamespace;
  58653. /***/ }),
  58654. /* 81 */
  58655. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58656. Object.defineProperty(exports, "__esModule", ({
  58657. value: true
  58658. }));
  58659. exports.addHTML = addHTML;
  58660. exports.checkDimensions = checkDimensions;
  58661. exports.flushHTML = flushHTML;
  58662. exports.getAvailableSpace = getAvailableSpace;
  58663. var _xfa_object = __w_pdfjs_require__(75);
  58664. var _html_utils = __w_pdfjs_require__(82);
  58665. function createLine(node, children) {
  58666. return {
  58667. name: "div",
  58668. attributes: {
  58669. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  58670. },
  58671. children
  58672. };
  58673. }
  58674. function flushHTML(node) {
  58675. if (!node[_xfa_object.$extra]) {
  58676. return null;
  58677. }
  58678. const attributes = node[_xfa_object.$extra].attributes;
  58679. const html = {
  58680. name: "div",
  58681. attributes,
  58682. children: node[_xfa_object.$extra].children
  58683. };
  58684. if (node[_xfa_object.$extra].failingNode) {
  58685. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  58686. if (htmlFromFailing) {
  58687. if (node.layout.endsWith("-tb")) {
  58688. html.children.push(createLine(node, [htmlFromFailing]));
  58689. } else {
  58690. html.children.push(htmlFromFailing);
  58691. }
  58692. }
  58693. }
  58694. if (html.children.length === 0) {
  58695. return null;
  58696. }
  58697. return html;
  58698. }
  58699. function addHTML(node, html, bbox) {
  58700. const extra = node[_xfa_object.$extra];
  58701. const availableSpace = extra.availableSpace;
  58702. const [x, y, w, h] = bbox;
  58703. switch (node.layout) {
  58704. case "position":
  58705. {
  58706. extra.width = Math.max(extra.width, x + w);
  58707. extra.height = Math.max(extra.height, y + h);
  58708. extra.children.push(html);
  58709. break;
  58710. }
  58711. case "lr-tb":
  58712. case "rl-tb":
  58713. if (!extra.line || extra.attempt === 1) {
  58714. extra.line = createLine(node, []);
  58715. extra.children.push(extra.line);
  58716. extra.numberInLine = 0;
  58717. }
  58718. extra.numberInLine += 1;
  58719. extra.line.children.push(html);
  58720. if (extra.attempt === 0) {
  58721. extra.currentWidth += w;
  58722. extra.height = Math.max(extra.height, extra.prevHeight + h);
  58723. } else {
  58724. extra.currentWidth = w;
  58725. extra.prevHeight = extra.height;
  58726. extra.height += h;
  58727. extra.attempt = 0;
  58728. }
  58729. extra.width = Math.max(extra.width, extra.currentWidth);
  58730. break;
  58731. case "rl-row":
  58732. case "row":
  58733. {
  58734. extra.children.push(html);
  58735. extra.width += w;
  58736. extra.height = Math.max(extra.height, h);
  58737. const height = (0, _html_utils.measureToString)(extra.height);
  58738. for (const child of extra.children) {
  58739. child.attributes.style.height = height;
  58740. }
  58741. break;
  58742. }
  58743. case "table":
  58744. {
  58745. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58746. extra.height += h;
  58747. extra.children.push(html);
  58748. break;
  58749. }
  58750. case "tb":
  58751. {
  58752. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58753. extra.height += h;
  58754. extra.children.push(html);
  58755. break;
  58756. }
  58757. }
  58758. }
  58759. function getAvailableSpace(node) {
  58760. const availableSpace = node[_xfa_object.$extra].availableSpace;
  58761. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  58762. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  58763. switch (node.layout) {
  58764. case "lr-tb":
  58765. case "rl-tb":
  58766. if (node[_xfa_object.$extra].attempt === 0) {
  58767. return {
  58768. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  58769. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  58770. };
  58771. }
  58772. return {
  58773. width: availableSpace.width - marginH,
  58774. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58775. };
  58776. case "rl-row":
  58777. case "row":
  58778. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  58779. return {
  58780. width,
  58781. height: availableSpace.height - marginH
  58782. };
  58783. case "table":
  58784. case "tb":
  58785. return {
  58786. width: availableSpace.width - marginH,
  58787. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58788. };
  58789. case "position":
  58790. default:
  58791. return availableSpace;
  58792. }
  58793. }
  58794. function getTransformedBBox(node) {
  58795. let w = node.w === "" ? NaN : node.w;
  58796. let h = node.h === "" ? NaN : node.h;
  58797. let [centerX, centerY] = [0, 0];
  58798. switch (node.anchorType || "") {
  58799. case "bottomCenter":
  58800. [centerX, centerY] = [w / 2, h];
  58801. break;
  58802. case "bottomLeft":
  58803. [centerX, centerY] = [0, h];
  58804. break;
  58805. case "bottomRight":
  58806. [centerX, centerY] = [w, h];
  58807. break;
  58808. case "middleCenter":
  58809. [centerX, centerY] = [w / 2, h / 2];
  58810. break;
  58811. case "middleLeft":
  58812. [centerX, centerY] = [0, h / 2];
  58813. break;
  58814. case "middleRight":
  58815. [centerX, centerY] = [w, h / 2];
  58816. break;
  58817. case "topCenter":
  58818. [centerX, centerY] = [w / 2, 0];
  58819. break;
  58820. case "topRight":
  58821. [centerX, centerY] = [w, 0];
  58822. break;
  58823. }
  58824. let x, y;
  58825. switch (node.rotate || 0) {
  58826. case 0:
  58827. [x, y] = [-centerX, -centerY];
  58828. break;
  58829. case 90:
  58830. [x, y] = [-centerY, centerX];
  58831. [w, h] = [h, -w];
  58832. break;
  58833. case 180:
  58834. [x, y] = [centerX, centerY];
  58835. [w, h] = [-w, -h];
  58836. break;
  58837. case 270:
  58838. [x, y] = [centerY, -centerX];
  58839. [w, h] = [-h, w];
  58840. break;
  58841. }
  58842. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  58843. }
  58844. function checkDimensions(node, space) {
  58845. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  58846. return true;
  58847. }
  58848. if (node.w === 0 || node.h === 0) {
  58849. return true;
  58850. }
  58851. const ERROR = 2;
  58852. const parent = node[_xfa_object.$getSubformParent]();
  58853. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  58854. const [, y, w, h] = getTransformedBBox(node);
  58855. switch (parent.layout) {
  58856. case "lr-tb":
  58857. case "rl-tb":
  58858. if (attempt === 0) {
  58859. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58860. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58861. return false;
  58862. }
  58863. if (node.w !== "") {
  58864. if (Math.round(w - space.width) <= ERROR) {
  58865. return true;
  58866. }
  58867. if (parent[_xfa_object.$extra].numberInLine === 0) {
  58868. return space.height > ERROR;
  58869. }
  58870. return false;
  58871. }
  58872. return space.width > ERROR;
  58873. }
  58874. if (node.w !== "") {
  58875. return Math.round(w - space.width) <= ERROR;
  58876. }
  58877. return space.width > ERROR;
  58878. }
  58879. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58880. return true;
  58881. }
  58882. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58883. return false;
  58884. }
  58885. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58886. return space.height > ERROR;
  58887. }
  58888. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58889. return false;
  58890. }
  58891. return space.height > ERROR;
  58892. case "table":
  58893. case "tb":
  58894. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58895. return true;
  58896. }
  58897. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  58898. return Math.round(h - space.height) <= ERROR;
  58899. }
  58900. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58901. return space.height > ERROR;
  58902. }
  58903. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58904. return false;
  58905. }
  58906. return space.height > ERROR;
  58907. case "position":
  58908. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58909. return true;
  58910. }
  58911. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  58912. return true;
  58913. }
  58914. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  58915. return h + y > area.h;
  58916. case "rl-row":
  58917. case "row":
  58918. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58919. return true;
  58920. }
  58921. if (node.h !== "") {
  58922. return Math.round(h - space.height) <= ERROR;
  58923. }
  58924. return true;
  58925. default:
  58926. return true;
  58927. }
  58928. }
  58929. /***/ }),
  58930. /* 82 */
  58931. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58932. Object.defineProperty(exports, "__esModule", ({
  58933. value: true
  58934. }));
  58935. exports.computeBbox = computeBbox;
  58936. exports.createWrapper = createWrapper;
  58937. exports.fixDimensions = fixDimensions;
  58938. exports.fixTextIndent = fixTextIndent;
  58939. exports.fixURL = fixURL;
  58940. exports.isPrintOnly = isPrintOnly;
  58941. exports.layoutClass = layoutClass;
  58942. exports.layoutNode = layoutNode;
  58943. exports.measureToString = measureToString;
  58944. exports.setAccess = setAccess;
  58945. exports.setFontFamily = setFontFamily;
  58946. exports.setMinMaxDimensions = setMinMaxDimensions;
  58947. exports.setPara = setPara;
  58948. exports.toStyle = toStyle;
  58949. var _xfa_object = __w_pdfjs_require__(75);
  58950. var _util = __w_pdfjs_require__(2);
  58951. var _utils = __w_pdfjs_require__(76);
  58952. var _fonts = __w_pdfjs_require__(83);
  58953. var _text = __w_pdfjs_require__(84);
  58954. function measureToString(m) {
  58955. if (typeof m === "string") {
  58956. return "0px";
  58957. }
  58958. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  58959. }
  58960. const converters = {
  58961. anchorType(node, style) {
  58962. const parent = node[_xfa_object.$getSubformParent]();
  58963. if (!parent || parent.layout && parent.layout !== "position") {
  58964. return;
  58965. }
  58966. if (!("transform" in style)) {
  58967. style.transform = "";
  58968. }
  58969. switch (node.anchorType) {
  58970. case "bottomCenter":
  58971. style.transform += "translate(-50%, -100%)";
  58972. break;
  58973. case "bottomLeft":
  58974. style.transform += "translate(0,-100%)";
  58975. break;
  58976. case "bottomRight":
  58977. style.transform += "translate(-100%,-100%)";
  58978. break;
  58979. case "middleCenter":
  58980. style.transform += "translate(-50%,-50%)";
  58981. break;
  58982. case "middleLeft":
  58983. style.transform += "translate(0,-50%)";
  58984. break;
  58985. case "middleRight":
  58986. style.transform += "translate(-100%,-50%)";
  58987. break;
  58988. case "topCenter":
  58989. style.transform += "translate(-50%,0)";
  58990. break;
  58991. case "topRight":
  58992. style.transform += "translate(-100%,0)";
  58993. break;
  58994. }
  58995. },
  58996. dimensions(node, style) {
  58997. const parent = node[_xfa_object.$getSubformParent]();
  58998. let width = node.w;
  58999. const height = node.h;
  59000. if (parent.layout && parent.layout.includes("row")) {
  59001. const extra = parent[_xfa_object.$extra];
  59002. const colSpan = node.colSpan;
  59003. let w;
  59004. if (colSpan === -1) {
  59005. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  59006. extra.currentColumn = 0;
  59007. } else {
  59008. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  59009. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  59010. }
  59011. if (!isNaN(w)) {
  59012. width = node.w = w;
  59013. }
  59014. }
  59015. if (width !== "") {
  59016. style.width = measureToString(width);
  59017. } else {
  59018. style.width = "auto";
  59019. }
  59020. if (height !== "") {
  59021. style.height = measureToString(height);
  59022. } else {
  59023. style.height = "auto";
  59024. }
  59025. },
  59026. position(node, style) {
  59027. const parent = node[_xfa_object.$getSubformParent]();
  59028. if (parent && parent.layout && parent.layout !== "position") {
  59029. return;
  59030. }
  59031. style.position = "absolute";
  59032. style.left = measureToString(node.x);
  59033. style.top = measureToString(node.y);
  59034. },
  59035. rotate(node, style) {
  59036. if (node.rotate) {
  59037. if (!("transform" in style)) {
  59038. style.transform = "";
  59039. }
  59040. style.transform += `rotate(-${node.rotate}deg)`;
  59041. style.transformOrigin = "top left";
  59042. }
  59043. },
  59044. presence(node, style) {
  59045. switch (node.presence) {
  59046. case "invisible":
  59047. style.visibility = "hidden";
  59048. break;
  59049. case "hidden":
  59050. case "inactive":
  59051. style.display = "none";
  59052. break;
  59053. }
  59054. },
  59055. hAlign(node, style) {
  59056. if (node[_xfa_object.$nodeName] === "para") {
  59057. switch (node.hAlign) {
  59058. case "justifyAll":
  59059. style.textAlign = "justify-all";
  59060. break;
  59061. case "radix":
  59062. style.textAlign = "left";
  59063. break;
  59064. default:
  59065. style.textAlign = node.hAlign;
  59066. }
  59067. } else {
  59068. switch (node.hAlign) {
  59069. case "left":
  59070. style.alignSelf = "start";
  59071. break;
  59072. case "center":
  59073. style.alignSelf = "center";
  59074. break;
  59075. case "right":
  59076. style.alignSelf = "end";
  59077. break;
  59078. }
  59079. }
  59080. },
  59081. margin(node, style) {
  59082. if (node.margin) {
  59083. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  59084. }
  59085. }
  59086. };
  59087. function setMinMaxDimensions(node, style) {
  59088. const parent = node[_xfa_object.$getSubformParent]();
  59089. if (parent.layout === "position") {
  59090. if (node.minW > 0) {
  59091. style.minWidth = measureToString(node.minW);
  59092. }
  59093. if (node.maxW > 0) {
  59094. style.maxWidth = measureToString(node.maxW);
  59095. }
  59096. if (node.minH > 0) {
  59097. style.minHeight = measureToString(node.minH);
  59098. }
  59099. if (node.maxH > 0) {
  59100. style.maxHeight = measureToString(node.maxH);
  59101. }
  59102. }
  59103. }
  59104. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  59105. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  59106. if (typeof text === "string") {
  59107. measure.addString(text);
  59108. } else {
  59109. text[_xfa_object.$pushGlyphs](measure);
  59110. }
  59111. return measure.compute(width);
  59112. }
  59113. function layoutNode(node, availableSpace) {
  59114. let height = null;
  59115. let width = null;
  59116. let isBroken = false;
  59117. if ((!node.w || !node.h) && node.value) {
  59118. let marginH = 0;
  59119. let marginV = 0;
  59120. if (node.margin) {
  59121. marginH = node.margin.leftInset + node.margin.rightInset;
  59122. marginV = node.margin.topInset + node.margin.bottomInset;
  59123. }
  59124. let lineHeight = null;
  59125. let margin = null;
  59126. if (node.para) {
  59127. margin = Object.create(null);
  59128. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  59129. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  59130. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  59131. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  59132. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  59133. }
  59134. let font = node.font;
  59135. if (!font) {
  59136. const root = node[_xfa_object.$getTemplateRoot]();
  59137. let parent = node[_xfa_object.$getParent]();
  59138. while (parent && parent !== root) {
  59139. if (parent.font) {
  59140. font = parent.font;
  59141. break;
  59142. }
  59143. parent = parent[_xfa_object.$getParent]();
  59144. }
  59145. }
  59146. const maxWidth = (node.w || availableSpace.width) - marginH;
  59147. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  59148. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  59149. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  59150. width = res.width;
  59151. height = res.height;
  59152. isBroken = res.isBroken;
  59153. } else {
  59154. const text = node.value[_xfa_object.$text]();
  59155. if (text) {
  59156. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  59157. width = res.width;
  59158. height = res.height;
  59159. isBroken = res.isBroken;
  59160. }
  59161. }
  59162. if (width !== null && !node.w) {
  59163. width += marginH;
  59164. }
  59165. if (height !== null && !node.h) {
  59166. height += marginV;
  59167. }
  59168. }
  59169. return {
  59170. w: width,
  59171. h: height,
  59172. isBroken
  59173. };
  59174. }
  59175. function computeBbox(node, html, availableSpace) {
  59176. let bbox;
  59177. if (node.w !== "" && node.h !== "") {
  59178. bbox = [node.x, node.y, node.w, node.h];
  59179. } else {
  59180. if (!availableSpace) {
  59181. return null;
  59182. }
  59183. let width = node.w;
  59184. if (width === "") {
  59185. if (node.maxW === 0) {
  59186. const parent = node[_xfa_object.$getSubformParent]();
  59187. if (parent.layout === "position" && parent.w !== "") {
  59188. width = 0;
  59189. } else {
  59190. width = node.minW;
  59191. }
  59192. } else {
  59193. width = Math.min(node.maxW, availableSpace.width);
  59194. }
  59195. html.attributes.style.width = measureToString(width);
  59196. }
  59197. let height = node.h;
  59198. if (height === "") {
  59199. if (node.maxH === 0) {
  59200. const parent = node[_xfa_object.$getSubformParent]();
  59201. if (parent.layout === "position" && parent.h !== "") {
  59202. height = 0;
  59203. } else {
  59204. height = node.minH;
  59205. }
  59206. } else {
  59207. height = Math.min(node.maxH, availableSpace.height);
  59208. }
  59209. html.attributes.style.height = measureToString(height);
  59210. }
  59211. bbox = [node.x, node.y, width, height];
  59212. }
  59213. return bbox;
  59214. }
  59215. function fixDimensions(node) {
  59216. const parent = node[_xfa_object.$getSubformParent]();
  59217. if (parent.layout && parent.layout.includes("row")) {
  59218. const extra = parent[_xfa_object.$extra];
  59219. const colSpan = node.colSpan;
  59220. let width;
  59221. if (colSpan === -1) {
  59222. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  59223. } else {
  59224. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  59225. }
  59226. if (!isNaN(width)) {
  59227. node.w = width;
  59228. }
  59229. }
  59230. if (parent.layout && parent.layout !== "position") {
  59231. node.x = node.y = 0;
  59232. }
  59233. if (node.layout === "table") {
  59234. if (node.w === "" && Array.isArray(node.columnWidths)) {
  59235. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  59236. }
  59237. }
  59238. }
  59239. function layoutClass(node) {
  59240. switch (node.layout) {
  59241. case "position":
  59242. return "xfaPosition";
  59243. case "lr-tb":
  59244. return "xfaLrTb";
  59245. case "rl-row":
  59246. return "xfaRlRow";
  59247. case "rl-tb":
  59248. return "xfaRlTb";
  59249. case "row":
  59250. return "xfaRow";
  59251. case "table":
  59252. return "xfaTable";
  59253. case "tb":
  59254. return "xfaTb";
  59255. default:
  59256. return "xfaPosition";
  59257. }
  59258. }
  59259. function toStyle(node, ...names) {
  59260. const style = Object.create(null);
  59261. for (const name of names) {
  59262. const value = node[name];
  59263. if (value === null) {
  59264. continue;
  59265. }
  59266. if (converters.hasOwnProperty(name)) {
  59267. converters[name](node, style);
  59268. continue;
  59269. }
  59270. if (value instanceof _xfa_object.XFAObject) {
  59271. const newStyle = value[_xfa_object.$toStyle]();
  59272. if (newStyle) {
  59273. Object.assign(style, newStyle);
  59274. } else {
  59275. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  59276. }
  59277. }
  59278. }
  59279. return style;
  59280. }
  59281. function createWrapper(node, html) {
  59282. const {
  59283. attributes
  59284. } = html;
  59285. const {
  59286. style
  59287. } = attributes;
  59288. const wrapper = {
  59289. name: "div",
  59290. attributes: {
  59291. class: ["xfaWrapper"],
  59292. style: Object.create(null)
  59293. },
  59294. children: []
  59295. };
  59296. attributes.class.push("xfaWrapped");
  59297. if (node.border) {
  59298. const {
  59299. widths,
  59300. insets
  59301. } = node.border[_xfa_object.$extra];
  59302. let width, height;
  59303. let top = insets[0];
  59304. let left = insets[3];
  59305. const insetsH = insets[0] + insets[2];
  59306. const insetsW = insets[1] + insets[3];
  59307. switch (node.border.hand) {
  59308. case "even":
  59309. top -= widths[0] / 2;
  59310. left -= widths[3] / 2;
  59311. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  59312. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  59313. break;
  59314. case "left":
  59315. top -= widths[0];
  59316. left -= widths[3];
  59317. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  59318. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  59319. break;
  59320. case "right":
  59321. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  59322. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  59323. break;
  59324. }
  59325. const classNames = ["xfaBorder"];
  59326. if (isPrintOnly(node.border)) {
  59327. classNames.push("xfaPrintOnly");
  59328. }
  59329. const border = {
  59330. name: "div",
  59331. attributes: {
  59332. class: classNames,
  59333. style: {
  59334. top: `${top}px`,
  59335. left: `${left}px`,
  59336. width,
  59337. height
  59338. }
  59339. },
  59340. children: []
  59341. };
  59342. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  59343. if (style[key] !== undefined) {
  59344. border.attributes.style[key] = style[key];
  59345. delete style[key];
  59346. }
  59347. }
  59348. wrapper.children.push(border, html);
  59349. } else {
  59350. wrapper.children.push(html);
  59351. }
  59352. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  59353. if (style[key] !== undefined) {
  59354. wrapper.attributes.style[key] = style[key];
  59355. delete style[key];
  59356. }
  59357. }
  59358. if (style.position === "absolute") {
  59359. wrapper.attributes.style.position = "absolute";
  59360. } else {
  59361. wrapper.attributes.style.position = "relative";
  59362. }
  59363. delete style.position;
  59364. if (style.alignSelf) {
  59365. wrapper.attributes.style.alignSelf = style.alignSelf;
  59366. delete style.alignSelf;
  59367. }
  59368. return wrapper;
  59369. }
  59370. function fixTextIndent(styles) {
  59371. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  59372. if (indent >= 0) {
  59373. return;
  59374. }
  59375. const align = styles.textAlign === "right" ? "right" : "left";
  59376. const name = "padding" + (align === "left" ? "Left" : "Right");
  59377. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  59378. styles[name] = `${padding - indent}px`;
  59379. }
  59380. function setAccess(node, classNames) {
  59381. switch (node.access) {
  59382. case "nonInteractive":
  59383. classNames.push("xfaNonInteractive");
  59384. break;
  59385. case "readOnly":
  59386. classNames.push("xfaReadOnly");
  59387. break;
  59388. case "protected":
  59389. classNames.push("xfaDisabled");
  59390. break;
  59391. }
  59392. }
  59393. function isPrintOnly(node) {
  59394. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  59395. }
  59396. function getCurrentPara(node) {
  59397. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  59398. return stack.length ? stack.at(-1) : null;
  59399. }
  59400. function setPara(node, nodeStyle, value) {
  59401. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  59402. if (nodeStyle) {
  59403. if (node.h === "") {
  59404. nodeStyle.height = "auto";
  59405. }
  59406. if (node.w === "") {
  59407. nodeStyle.width = "auto";
  59408. }
  59409. }
  59410. const para = getCurrentPara(node);
  59411. if (para) {
  59412. const valueStyle = value.attributes.style;
  59413. valueStyle.display = "flex";
  59414. valueStyle.flexDirection = "column";
  59415. switch (para.vAlign) {
  59416. case "top":
  59417. valueStyle.justifyContent = "start";
  59418. break;
  59419. case "bottom":
  59420. valueStyle.justifyContent = "end";
  59421. break;
  59422. case "middle":
  59423. valueStyle.justifyContent = "center";
  59424. break;
  59425. }
  59426. const paraStyle = para[_xfa_object.$toStyle]();
  59427. for (const [key, val] of Object.entries(paraStyle)) {
  59428. if (!(key in valueStyle)) {
  59429. valueStyle[key] = val;
  59430. }
  59431. }
  59432. }
  59433. }
  59434. }
  59435. function setFontFamily(xfaFont, node, fontFinder, style) {
  59436. if (!fontFinder) {
  59437. delete style.fontFamily;
  59438. return;
  59439. }
  59440. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59441. style.fontFamily = `"${name}"`;
  59442. const typeface = fontFinder.find(name);
  59443. if (typeface) {
  59444. const {
  59445. fontFamily
  59446. } = typeface.regular.cssFontInfo;
  59447. if (fontFamily !== name) {
  59448. style.fontFamily = `"${fontFamily}"`;
  59449. }
  59450. const para = getCurrentPara(node);
  59451. if (para && para.lineHeight !== "") {
  59452. return;
  59453. }
  59454. if (style.lineHeight) {
  59455. return;
  59456. }
  59457. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59458. if (pdfFont) {
  59459. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  59460. }
  59461. }
  59462. }
  59463. function fixURL(str) {
  59464. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  59465. addDefaultProtocol: true,
  59466. tryConvertEncoding: true
  59467. });
  59468. return absoluteUrl ? absoluteUrl.href : null;
  59469. }
  59470. /***/ }),
  59471. /* 83 */
  59472. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59473. Object.defineProperty(exports, "__esModule", ({
  59474. value: true
  59475. }));
  59476. exports.FontFinder = void 0;
  59477. exports.getMetrics = getMetrics;
  59478. exports.selectFont = selectFont;
  59479. var _xfa_object = __w_pdfjs_require__(75);
  59480. var _utils = __w_pdfjs_require__(76);
  59481. var _util = __w_pdfjs_require__(2);
  59482. class FontFinder {
  59483. constructor(pdfFonts) {
  59484. this.fonts = new Map();
  59485. this.cache = new Map();
  59486. this.warned = new Set();
  59487. this.defaultFont = null;
  59488. this.add(pdfFonts);
  59489. }
  59490. add(pdfFonts, reallyMissingFonts = null) {
  59491. for (const pdfFont of pdfFonts) {
  59492. this.addPdfFont(pdfFont);
  59493. }
  59494. for (const pdfFont of this.fonts.values()) {
  59495. if (!pdfFont.regular) {
  59496. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  59497. }
  59498. }
  59499. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  59500. return;
  59501. }
  59502. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  59503. for (const missing of reallyMissingFonts) {
  59504. this.fonts.set(missing, myriad);
  59505. }
  59506. }
  59507. addPdfFont(pdfFont) {
  59508. const cssFontInfo = pdfFont.cssFontInfo;
  59509. const name = cssFontInfo.fontFamily;
  59510. let font = this.fonts.get(name);
  59511. if (!font) {
  59512. font = Object.create(null);
  59513. this.fonts.set(name, font);
  59514. if (!this.defaultFont) {
  59515. this.defaultFont = font;
  59516. }
  59517. }
  59518. let property = "";
  59519. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  59520. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  59521. property = fontWeight >= 700 ? "bolditalic" : "italic";
  59522. } else if (fontWeight >= 700) {
  59523. property = "bold";
  59524. }
  59525. if (!property) {
  59526. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  59527. property = "bold";
  59528. }
  59529. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  59530. property += "italic";
  59531. }
  59532. }
  59533. if (!property) {
  59534. property = "regular";
  59535. }
  59536. font[property] = pdfFont;
  59537. }
  59538. getDefault() {
  59539. return this.defaultFont;
  59540. }
  59541. find(fontName, mustWarn = true) {
  59542. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  59543. if (font) {
  59544. return font;
  59545. }
  59546. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  59547. let name = fontName.replace(pattern, "");
  59548. font = this.fonts.get(name);
  59549. if (font) {
  59550. this.cache.set(fontName, font);
  59551. return font;
  59552. }
  59553. name = name.toLowerCase();
  59554. const maybe = [];
  59555. for (const [family, pdfFont] of this.fonts.entries()) {
  59556. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59557. maybe.push(pdfFont);
  59558. }
  59559. }
  59560. if (maybe.length === 0) {
  59561. for (const [, pdfFont] of this.fonts.entries()) {
  59562. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59563. maybe.push(pdfFont);
  59564. }
  59565. }
  59566. }
  59567. if (maybe.length === 0) {
  59568. name = name.replace(/psmt|mt/gi, "");
  59569. for (const [family, pdfFont] of this.fonts.entries()) {
  59570. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59571. maybe.push(pdfFont);
  59572. }
  59573. }
  59574. }
  59575. if (maybe.length === 0) {
  59576. for (const pdfFont of this.fonts.values()) {
  59577. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59578. maybe.push(pdfFont);
  59579. }
  59580. }
  59581. }
  59582. if (maybe.length >= 1) {
  59583. if (maybe.length !== 1 && mustWarn) {
  59584. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  59585. }
  59586. this.cache.set(fontName, maybe[0]);
  59587. return maybe[0];
  59588. }
  59589. if (mustWarn && !this.warned.has(fontName)) {
  59590. this.warned.add(fontName);
  59591. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  59592. }
  59593. return null;
  59594. }
  59595. }
  59596. exports.FontFinder = FontFinder;
  59597. function selectFont(xfaFont, typeface) {
  59598. if (xfaFont.posture === "italic") {
  59599. if (xfaFont.weight === "bold") {
  59600. return typeface.bolditalic;
  59601. }
  59602. return typeface.italic;
  59603. } else if (xfaFont.weight === "bold") {
  59604. return typeface.bold;
  59605. }
  59606. return typeface.regular;
  59607. }
  59608. function getMetrics(xfaFont, real = false) {
  59609. let pdfFont = null;
  59610. if (xfaFont) {
  59611. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59612. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  59613. pdfFont = selectFont(xfaFont, typeface);
  59614. }
  59615. if (!pdfFont) {
  59616. return {
  59617. lineHeight: 12,
  59618. lineGap: 2,
  59619. lineNoGap: 10
  59620. };
  59621. }
  59622. const size = xfaFont.size || 10;
  59623. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  59624. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59625. return {
  59626. lineHeight: lineHeight * size,
  59627. lineGap: lineGap * size,
  59628. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  59629. };
  59630. }
  59631. /***/ }),
  59632. /* 84 */
  59633. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59634. Object.defineProperty(exports, "__esModule", ({
  59635. value: true
  59636. }));
  59637. exports.TextMeasure = void 0;
  59638. var _fonts = __w_pdfjs_require__(83);
  59639. const WIDTH_FACTOR = 1.02;
  59640. class FontInfo {
  59641. constructor(xfaFont, margin, lineHeight, fontFinder) {
  59642. this.lineHeight = lineHeight;
  59643. this.paraMargin = margin || {
  59644. top: 0,
  59645. bottom: 0,
  59646. left: 0,
  59647. right: 0
  59648. };
  59649. if (!xfaFont) {
  59650. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59651. return;
  59652. }
  59653. this.xfaFont = {
  59654. typeface: xfaFont.typeface,
  59655. posture: xfaFont.posture,
  59656. weight: xfaFont.weight,
  59657. size: xfaFont.size,
  59658. letterSpacing: xfaFont.letterSpacing
  59659. };
  59660. const typeface = fontFinder.find(xfaFont.typeface);
  59661. if (!typeface) {
  59662. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59663. return;
  59664. }
  59665. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59666. if (!this.pdfFont) {
  59667. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59668. }
  59669. }
  59670. defaultFont(fontFinder) {
  59671. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  59672. if (font && font.regular) {
  59673. const pdfFont = font.regular;
  59674. const info = pdfFont.cssFontInfo;
  59675. const xfaFont = {
  59676. typeface: info.fontFamily,
  59677. posture: "normal",
  59678. weight: "normal",
  59679. size: 10,
  59680. letterSpacing: 0
  59681. };
  59682. return [pdfFont, xfaFont];
  59683. }
  59684. const xfaFont = {
  59685. typeface: "Courier",
  59686. posture: "normal",
  59687. weight: "normal",
  59688. size: 10,
  59689. letterSpacing: 0
  59690. };
  59691. return [null, xfaFont];
  59692. }
  59693. }
  59694. class FontSelector {
  59695. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  59696. this.fontFinder = fontFinder;
  59697. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  59698. }
  59699. pushData(xfaFont, margin, lineHeight) {
  59700. const lastFont = this.stack.at(-1);
  59701. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  59702. if (!xfaFont[name]) {
  59703. xfaFont[name] = lastFont.xfaFont[name];
  59704. }
  59705. }
  59706. for (const name of ["top", "bottom", "left", "right"]) {
  59707. if (isNaN(margin[name])) {
  59708. margin[name] = lastFont.paraMargin[name];
  59709. }
  59710. }
  59711. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  59712. if (!fontInfo.pdfFont) {
  59713. fontInfo.pdfFont = lastFont.pdfFont;
  59714. }
  59715. this.stack.push(fontInfo);
  59716. }
  59717. popFont() {
  59718. this.stack.pop();
  59719. }
  59720. topFont() {
  59721. return this.stack.at(-1);
  59722. }
  59723. }
  59724. class TextMeasure {
  59725. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  59726. this.glyphs = [];
  59727. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  59728. this.extraHeight = 0;
  59729. }
  59730. pushData(xfaFont, margin, lineHeight) {
  59731. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  59732. }
  59733. popFont(xfaFont) {
  59734. return this.fontSelector.popFont();
  59735. }
  59736. addPara() {
  59737. const lastFont = this.fontSelector.topFont();
  59738. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  59739. }
  59740. addString(str) {
  59741. if (!str) {
  59742. return;
  59743. }
  59744. const lastFont = this.fontSelector.topFont();
  59745. const fontSize = lastFont.xfaFont.size;
  59746. if (lastFont.pdfFont) {
  59747. const letterSpacing = lastFont.xfaFont.letterSpacing;
  59748. const pdfFont = lastFont.pdfFont;
  59749. const fontLineHeight = pdfFont.lineHeight || 1.2;
  59750. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  59751. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59752. const noGap = fontLineHeight - lineGap;
  59753. const firstLineHeight = Math.max(1, noGap) * fontSize;
  59754. const scale = fontSize / 1000;
  59755. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  59756. for (const line of str.split(/[\u2029\n]/)) {
  59757. const encodedLine = pdfFont.encodeString(line).join("");
  59758. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  59759. for (const glyph of glyphs) {
  59760. const width = glyph.width || fallbackWidth;
  59761. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  59762. }
  59763. this.glyphs.push([0, 0, 0, "\n", true]);
  59764. }
  59765. this.glyphs.pop();
  59766. return;
  59767. }
  59768. for (const line of str.split(/[\u2029\n]/)) {
  59769. for (const char of line.split("")) {
  59770. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  59771. }
  59772. this.glyphs.push([0, 0, 0, "\n", true]);
  59773. }
  59774. this.glyphs.pop();
  59775. }
  59776. compute(maxWidth) {
  59777. let lastSpacePos = -1,
  59778. lastSpaceWidth = 0,
  59779. width = 0,
  59780. height = 0,
  59781. currentLineWidth = 0,
  59782. currentLineHeight = 0;
  59783. let isBroken = false;
  59784. let isFirstLine = true;
  59785. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  59786. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  59787. const isSpace = char === " ";
  59788. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  59789. if (isEOL) {
  59790. width = Math.max(width, currentLineWidth);
  59791. currentLineWidth = 0;
  59792. height += currentLineHeight;
  59793. currentLineHeight = glyphHeight;
  59794. lastSpacePos = -1;
  59795. lastSpaceWidth = 0;
  59796. isFirstLine = false;
  59797. continue;
  59798. }
  59799. if (isSpace) {
  59800. if (currentLineWidth + glyphWidth > maxWidth) {
  59801. width = Math.max(width, currentLineWidth);
  59802. currentLineWidth = 0;
  59803. height += currentLineHeight;
  59804. currentLineHeight = glyphHeight;
  59805. lastSpacePos = -1;
  59806. lastSpaceWidth = 0;
  59807. isBroken = true;
  59808. isFirstLine = false;
  59809. } else {
  59810. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59811. lastSpaceWidth = currentLineWidth;
  59812. currentLineWidth += glyphWidth;
  59813. lastSpacePos = i;
  59814. }
  59815. continue;
  59816. }
  59817. if (currentLineWidth + glyphWidth > maxWidth) {
  59818. height += currentLineHeight;
  59819. currentLineHeight = glyphHeight;
  59820. if (lastSpacePos !== -1) {
  59821. i = lastSpacePos;
  59822. width = Math.max(width, lastSpaceWidth);
  59823. currentLineWidth = 0;
  59824. lastSpacePos = -1;
  59825. lastSpaceWidth = 0;
  59826. } else {
  59827. width = Math.max(width, currentLineWidth);
  59828. currentLineWidth = glyphWidth;
  59829. }
  59830. isBroken = true;
  59831. isFirstLine = false;
  59832. continue;
  59833. }
  59834. currentLineWidth += glyphWidth;
  59835. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59836. }
  59837. width = Math.max(width, currentLineWidth);
  59838. height += currentLineHeight + this.extraHeight;
  59839. return {
  59840. width: WIDTH_FACTOR * width,
  59841. height,
  59842. isBroken
  59843. };
  59844. }
  59845. }
  59846. exports.TextMeasure = TextMeasure;
  59847. /***/ }),
  59848. /* 85 */
  59849. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59850. Object.defineProperty(exports, "__esModule", ({
  59851. value: true
  59852. }));
  59853. exports.DataHandler = void 0;
  59854. var _xfa_object = __w_pdfjs_require__(75);
  59855. class DataHandler {
  59856. constructor(root, data) {
  59857. this.data = data;
  59858. this.dataset = root.datasets || null;
  59859. }
  59860. serialize(storage) {
  59861. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  59862. while (stack.length > 0) {
  59863. const last = stack.at(-1);
  59864. const [i, children] = last;
  59865. if (i + 1 === children.length) {
  59866. stack.pop();
  59867. continue;
  59868. }
  59869. const child = children[++last[0]];
  59870. const storageEntry = storage.get(child[_xfa_object.$uid]);
  59871. if (storageEntry) {
  59872. child[_xfa_object.$setValue](storageEntry);
  59873. } else {
  59874. const attributes = child[_xfa_object.$getAttributes]();
  59875. for (const value of attributes.values()) {
  59876. const entry = storage.get(value[_xfa_object.$uid]);
  59877. if (entry) {
  59878. value[_xfa_object.$setValue](entry);
  59879. break;
  59880. }
  59881. }
  59882. }
  59883. const nodes = child[_xfa_object.$getChildren]();
  59884. if (nodes.length > 0) {
  59885. stack.push([-1, nodes]);
  59886. }
  59887. }
  59888. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  59889. if (this.dataset) {
  59890. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  59891. if (child[_xfa_object.$nodeName] !== "data") {
  59892. child[_xfa_object.$toString](buf);
  59893. }
  59894. }
  59895. }
  59896. this.data[_xfa_object.$toString](buf);
  59897. buf.push("</xfa:datasets>");
  59898. return buf.join("");
  59899. }
  59900. }
  59901. exports.DataHandler = DataHandler;
  59902. /***/ }),
  59903. /* 86 */
  59904. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59905. Object.defineProperty(exports, "__esModule", ({
  59906. value: true
  59907. }));
  59908. exports.XFAParser = void 0;
  59909. var _xfa_object = __w_pdfjs_require__(75);
  59910. var _xml_parser = __w_pdfjs_require__(64);
  59911. var _builder = __w_pdfjs_require__(87);
  59912. var _util = __w_pdfjs_require__(2);
  59913. class XFAParser extends _xml_parser.XMLParserBase {
  59914. constructor(rootNameSpace = null, richText = false) {
  59915. super();
  59916. this._builder = new _builder.Builder(rootNameSpace);
  59917. this._stack = [];
  59918. this._globalData = {
  59919. usedTypefaces: new Set()
  59920. };
  59921. this._ids = new Map();
  59922. this._current = this._builder.buildRoot(this._ids);
  59923. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  59924. this._whiteRegex = /^\s+$/;
  59925. this._nbsps = /\xa0+/g;
  59926. this._richText = richText;
  59927. }
  59928. parse(data) {
  59929. this.parseXml(data);
  59930. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  59931. return undefined;
  59932. }
  59933. this._current[_xfa_object.$finalize]();
  59934. return this._current.element;
  59935. }
  59936. onText(text) {
  59937. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  59938. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  59939. this._current[_xfa_object.$onText](text, this._richText);
  59940. return;
  59941. }
  59942. if (this._whiteRegex.test(text)) {
  59943. return;
  59944. }
  59945. this._current[_xfa_object.$onText](text.trim());
  59946. }
  59947. onCdata(text) {
  59948. this._current[_xfa_object.$onText](text);
  59949. }
  59950. _mkAttributes(attributes, tagName) {
  59951. let namespace = null;
  59952. let prefixes = null;
  59953. const attributeObj = Object.create({});
  59954. for (const {
  59955. name,
  59956. value
  59957. } of attributes) {
  59958. if (name === "xmlns") {
  59959. if (!namespace) {
  59960. namespace = value;
  59961. } else {
  59962. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  59963. }
  59964. } else if (name.startsWith("xmlns:")) {
  59965. const prefix = name.substring("xmlns:".length);
  59966. if (!prefixes) {
  59967. prefixes = [];
  59968. }
  59969. prefixes.push({
  59970. prefix,
  59971. value
  59972. });
  59973. } else {
  59974. const i = name.indexOf(":");
  59975. if (i === -1) {
  59976. attributeObj[name] = value;
  59977. } else {
  59978. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  59979. if (!nsAttrs) {
  59980. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  59981. }
  59982. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  59983. let attrs = nsAttrs[ns];
  59984. if (!attrs) {
  59985. attrs = nsAttrs[ns] = Object.create(null);
  59986. }
  59987. attrs[attrName] = value;
  59988. }
  59989. }
  59990. }
  59991. return [namespace, prefixes, attributeObj];
  59992. }
  59993. _getNameAndPrefix(name, nsAgnostic) {
  59994. const i = name.indexOf(":");
  59995. if (i === -1) {
  59996. return [name, null];
  59997. }
  59998. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  59999. }
  60000. onBeginElement(tagName, attributes, isEmpty) {
  60001. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  60002. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  60003. const node = this._builder.build({
  60004. nsPrefix,
  60005. name,
  60006. attributes: attributesObj,
  60007. namespace,
  60008. prefixes
  60009. });
  60010. node[_xfa_object.$globalData] = this._globalData;
  60011. if (isEmpty) {
  60012. node[_xfa_object.$finalize]();
  60013. if (this._current[_xfa_object.$onChild](node)) {
  60014. node[_xfa_object.$setId](this._ids);
  60015. }
  60016. node[_xfa_object.$clean](this._builder);
  60017. return;
  60018. }
  60019. this._stack.push(this._current);
  60020. this._current = node;
  60021. }
  60022. onEndElement(name) {
  60023. const node = this._current;
  60024. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  60025. const parser = new XFAParser();
  60026. parser._globalData = this._globalData;
  60027. const root = parser.parse(node[_xfa_object.$content]);
  60028. node[_xfa_object.$content] = null;
  60029. node[_xfa_object.$onChild](root);
  60030. }
  60031. node[_xfa_object.$finalize]();
  60032. this._current = this._stack.pop();
  60033. if (this._current[_xfa_object.$onChild](node)) {
  60034. node[_xfa_object.$setId](this._ids);
  60035. }
  60036. node[_xfa_object.$clean](this._builder);
  60037. }
  60038. onError(code) {
  60039. this._errorCode = code;
  60040. }
  60041. }
  60042. exports.XFAParser = XFAParser;
  60043. /***/ }),
  60044. /* 87 */
  60045. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60046. Object.defineProperty(exports, "__esModule", ({
  60047. value: true
  60048. }));
  60049. exports.Builder = void 0;
  60050. var _namespaces = __w_pdfjs_require__(77);
  60051. var _xfa_object = __w_pdfjs_require__(75);
  60052. var _setup = __w_pdfjs_require__(88);
  60053. var _template = __w_pdfjs_require__(80);
  60054. var _unknown = __w_pdfjs_require__(97);
  60055. var _util = __w_pdfjs_require__(2);
  60056. class Root extends _xfa_object.XFAObject {
  60057. constructor(ids) {
  60058. super(-1, "root", Object.create(null));
  60059. this.element = null;
  60060. this[_xfa_object.$ids] = ids;
  60061. }
  60062. [_xfa_object.$onChild](child) {
  60063. this.element = child;
  60064. return true;
  60065. }
  60066. [_xfa_object.$finalize]() {
  60067. super[_xfa_object.$finalize]();
  60068. if (this.element.template instanceof _template.Template) {
  60069. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  60070. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  60071. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  60072. }
  60073. }
  60074. }
  60075. class Empty extends _xfa_object.XFAObject {
  60076. constructor() {
  60077. super(-1, "", Object.create(null));
  60078. }
  60079. [_xfa_object.$onChild](_) {
  60080. return false;
  60081. }
  60082. }
  60083. class Builder {
  60084. constructor(rootNameSpace = null) {
  60085. this._namespaceStack = [];
  60086. this._nsAgnosticLevel = 0;
  60087. this._namespacePrefixes = new Map();
  60088. this._namespaces = new Map();
  60089. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  60090. id
  60091. }) => id));
  60092. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  60093. }
  60094. buildRoot(ids) {
  60095. return new Root(ids);
  60096. }
  60097. build({
  60098. nsPrefix,
  60099. name,
  60100. attributes,
  60101. namespace,
  60102. prefixes
  60103. }) {
  60104. const hasNamespaceDef = namespace !== null;
  60105. if (hasNamespaceDef) {
  60106. this._namespaceStack.push(this._currentNamespace);
  60107. this._currentNamespace = this._searchNamespace(namespace);
  60108. }
  60109. if (prefixes) {
  60110. this._addNamespacePrefix(prefixes);
  60111. }
  60112. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  60113. const dataTemplate = _setup.NamespaceSetUp.datasets;
  60114. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  60115. let xfaAttrs = null;
  60116. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  60117. const nsToUse = this._getNamespaceToUse(ns);
  60118. if (nsToUse === dataTemplate) {
  60119. xfaAttrs = {
  60120. xfa: attrs
  60121. };
  60122. break;
  60123. }
  60124. }
  60125. if (xfaAttrs) {
  60126. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  60127. } else {
  60128. delete attributes[_xfa_object.$nsAttributes];
  60129. }
  60130. }
  60131. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  60132. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  60133. if (node[_xfa_object.$isNsAgnostic]()) {
  60134. this._nsAgnosticLevel++;
  60135. }
  60136. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  60137. node[_xfa_object.$cleanup] = {
  60138. hasNamespace: hasNamespaceDef,
  60139. prefixes,
  60140. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  60141. };
  60142. }
  60143. return node;
  60144. }
  60145. isNsAgnostic() {
  60146. return this._nsAgnosticLevel > 0;
  60147. }
  60148. _searchNamespace(nsName) {
  60149. let ns = this._namespaces.get(nsName);
  60150. if (ns) {
  60151. return ns;
  60152. }
  60153. for (const [name, {
  60154. check
  60155. }] of Object.entries(_namespaces.NamespaceIds)) {
  60156. if (check(nsName)) {
  60157. ns = _setup.NamespaceSetUp[name];
  60158. if (ns) {
  60159. this._namespaces.set(nsName, ns);
  60160. return ns;
  60161. }
  60162. break;
  60163. }
  60164. }
  60165. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  60166. this._namespaces.set(nsName, ns);
  60167. return ns;
  60168. }
  60169. _addNamespacePrefix(prefixes) {
  60170. for (const {
  60171. prefix,
  60172. value
  60173. } of prefixes) {
  60174. const namespace = this._searchNamespace(value);
  60175. let prefixStack = this._namespacePrefixes.get(prefix);
  60176. if (!prefixStack) {
  60177. prefixStack = [];
  60178. this._namespacePrefixes.set(prefix, prefixStack);
  60179. }
  60180. prefixStack.push(namespace);
  60181. }
  60182. }
  60183. _getNamespaceToUse(prefix) {
  60184. if (!prefix) {
  60185. return this._currentNamespace;
  60186. }
  60187. const prefixStack = this._namespacePrefixes.get(prefix);
  60188. if (prefixStack && prefixStack.length > 0) {
  60189. return prefixStack.at(-1);
  60190. }
  60191. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  60192. return null;
  60193. }
  60194. clean(data) {
  60195. const {
  60196. hasNamespace,
  60197. prefixes,
  60198. nsAgnostic
  60199. } = data;
  60200. if (hasNamespace) {
  60201. this._currentNamespace = this._namespaceStack.pop();
  60202. }
  60203. if (prefixes) {
  60204. prefixes.forEach(({
  60205. prefix
  60206. }) => {
  60207. this._namespacePrefixes.get(prefix).pop();
  60208. });
  60209. }
  60210. if (nsAgnostic) {
  60211. this._nsAgnosticLevel--;
  60212. }
  60213. }
  60214. }
  60215. exports.Builder = Builder;
  60216. /***/ }),
  60217. /* 88 */
  60218. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60219. Object.defineProperty(exports, "__esModule", ({
  60220. value: true
  60221. }));
  60222. exports.NamespaceSetUp = void 0;
  60223. var _config = __w_pdfjs_require__(89);
  60224. var _connection_set = __w_pdfjs_require__(90);
  60225. var _datasets = __w_pdfjs_require__(91);
  60226. var _locale_set = __w_pdfjs_require__(92);
  60227. var _signature = __w_pdfjs_require__(93);
  60228. var _stylesheet = __w_pdfjs_require__(94);
  60229. var _template = __w_pdfjs_require__(80);
  60230. var _xdp = __w_pdfjs_require__(95);
  60231. var _xhtml = __w_pdfjs_require__(96);
  60232. const NamespaceSetUp = {
  60233. config: _config.ConfigNamespace,
  60234. connection: _connection_set.ConnectionSetNamespace,
  60235. datasets: _datasets.DatasetsNamespace,
  60236. localeSet: _locale_set.LocaleSetNamespace,
  60237. signature: _signature.SignatureNamespace,
  60238. stylesheet: _stylesheet.StylesheetNamespace,
  60239. template: _template.TemplateNamespace,
  60240. xdp: _xdp.XdpNamespace,
  60241. xhtml: _xhtml.XhtmlNamespace
  60242. };
  60243. exports.NamespaceSetUp = NamespaceSetUp;
  60244. /***/ }),
  60245. /* 89 */
  60246. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60247. Object.defineProperty(exports, "__esModule", ({
  60248. value: true
  60249. }));
  60250. exports.ConfigNamespace = void 0;
  60251. var _namespaces = __w_pdfjs_require__(77);
  60252. var _xfa_object = __w_pdfjs_require__(75);
  60253. var _utils = __w_pdfjs_require__(76);
  60254. var _util = __w_pdfjs_require__(2);
  60255. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  60256. class Acrobat extends _xfa_object.XFAObject {
  60257. constructor(attributes) {
  60258. super(CONFIG_NS_ID, "acrobat", true);
  60259. this.acrobat7 = null;
  60260. this.autoSave = null;
  60261. this.common = null;
  60262. this.validate = null;
  60263. this.validateApprovalSignatures = null;
  60264. this.submitUrl = new _xfa_object.XFAObjectArray();
  60265. }
  60266. }
  60267. class Acrobat7 extends _xfa_object.XFAObject {
  60268. constructor(attributes) {
  60269. super(CONFIG_NS_ID, "acrobat7", true);
  60270. this.dynamicRender = null;
  60271. }
  60272. }
  60273. class ADBE_JSConsole extends _xfa_object.OptionObject {
  60274. constructor(attributes) {
  60275. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  60276. }
  60277. }
  60278. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  60279. constructor(attributes) {
  60280. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  60281. }
  60282. }
  60283. class AddSilentPrint extends _xfa_object.Option01 {
  60284. constructor(attributes) {
  60285. super(CONFIG_NS_ID, "addSilentPrint");
  60286. }
  60287. }
  60288. class AddViewerPreferences extends _xfa_object.Option01 {
  60289. constructor(attributes) {
  60290. super(CONFIG_NS_ID, "addViewerPreferences");
  60291. }
  60292. }
  60293. class AdjustData extends _xfa_object.Option10 {
  60294. constructor(attributes) {
  60295. super(CONFIG_NS_ID, "adjustData");
  60296. }
  60297. }
  60298. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  60299. constructor(attributes) {
  60300. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  60301. }
  60302. }
  60303. class Agent extends _xfa_object.XFAObject {
  60304. constructor(attributes) {
  60305. super(CONFIG_NS_ID, "agent", true);
  60306. this.name = attributes.name ? attributes.name.trim() : "";
  60307. this.common = new _xfa_object.XFAObjectArray();
  60308. }
  60309. }
  60310. class AlwaysEmbed extends _xfa_object.ContentObject {
  60311. constructor(attributes) {
  60312. super(CONFIG_NS_ID, "alwaysEmbed");
  60313. }
  60314. }
  60315. class Amd extends _xfa_object.StringObject {
  60316. constructor(attributes) {
  60317. super(CONFIG_NS_ID, "amd");
  60318. }
  60319. }
  60320. class Area extends _xfa_object.XFAObject {
  60321. constructor(attributes) {
  60322. super(CONFIG_NS_ID, "area");
  60323. this.level = (0, _utils.getInteger)({
  60324. data: attributes.level,
  60325. defaultValue: 0,
  60326. validate: n => n >= 1 && n <= 3
  60327. });
  60328. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  60329. }
  60330. }
  60331. class Attributes extends _xfa_object.OptionObject {
  60332. constructor(attributes) {
  60333. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  60334. }
  60335. }
  60336. class AutoSave extends _xfa_object.OptionObject {
  60337. constructor(attributes) {
  60338. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  60339. }
  60340. }
  60341. class Base extends _xfa_object.StringObject {
  60342. constructor(attributes) {
  60343. super(CONFIG_NS_ID, "base");
  60344. }
  60345. }
  60346. class BatchOutput extends _xfa_object.XFAObject {
  60347. constructor(attributes) {
  60348. super(CONFIG_NS_ID, "batchOutput");
  60349. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  60350. }
  60351. }
  60352. class BehaviorOverride extends _xfa_object.ContentObject {
  60353. constructor(attributes) {
  60354. super(CONFIG_NS_ID, "behaviorOverride");
  60355. }
  60356. [_xfa_object.$finalize]() {
  60357. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  60358. }
  60359. }
  60360. class Cache extends _xfa_object.XFAObject {
  60361. constructor(attributes) {
  60362. super(CONFIG_NS_ID, "cache", true);
  60363. this.templateCache = null;
  60364. }
  60365. }
  60366. class Change extends _xfa_object.Option01 {
  60367. constructor(attributes) {
  60368. super(CONFIG_NS_ID, "change");
  60369. }
  60370. }
  60371. class Common extends _xfa_object.XFAObject {
  60372. constructor(attributes) {
  60373. super(CONFIG_NS_ID, "common", true);
  60374. this.data = null;
  60375. this.locale = null;
  60376. this.localeSet = null;
  60377. this.messaging = null;
  60378. this.suppressBanner = null;
  60379. this.template = null;
  60380. this.validationMessaging = null;
  60381. this.versionControl = null;
  60382. this.log = new _xfa_object.XFAObjectArray();
  60383. }
  60384. }
  60385. class Compress extends _xfa_object.XFAObject {
  60386. constructor(attributes) {
  60387. super(CONFIG_NS_ID, "compress");
  60388. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  60389. }
  60390. }
  60391. class CompressLogicalStructure extends _xfa_object.Option01 {
  60392. constructor(attributes) {
  60393. super(CONFIG_NS_ID, "compressLogicalStructure");
  60394. }
  60395. }
  60396. class CompressObjectStream extends _xfa_object.Option10 {
  60397. constructor(attributes) {
  60398. super(CONFIG_NS_ID, "compressObjectStream");
  60399. }
  60400. }
  60401. class Compression extends _xfa_object.XFAObject {
  60402. constructor(attributes) {
  60403. super(CONFIG_NS_ID, "compression", true);
  60404. this.compressLogicalStructure = null;
  60405. this.compressObjectStream = null;
  60406. this.level = null;
  60407. this.type = null;
  60408. }
  60409. }
  60410. class Config extends _xfa_object.XFAObject {
  60411. constructor(attributes) {
  60412. super(CONFIG_NS_ID, "config", true);
  60413. this.acrobat = null;
  60414. this.present = null;
  60415. this.trace = null;
  60416. this.agent = new _xfa_object.XFAObjectArray();
  60417. }
  60418. }
  60419. class Conformance extends _xfa_object.OptionObject {
  60420. constructor(attributes) {
  60421. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  60422. }
  60423. }
  60424. class ContentCopy extends _xfa_object.Option01 {
  60425. constructor(attributes) {
  60426. super(CONFIG_NS_ID, "contentCopy");
  60427. }
  60428. }
  60429. class Copies extends _xfa_object.IntegerObject {
  60430. constructor(attributes) {
  60431. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  60432. }
  60433. }
  60434. class Creator extends _xfa_object.StringObject {
  60435. constructor(attributes) {
  60436. super(CONFIG_NS_ID, "creator");
  60437. }
  60438. }
  60439. class CurrentPage extends _xfa_object.IntegerObject {
  60440. constructor(attributes) {
  60441. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  60442. }
  60443. }
  60444. class Data extends _xfa_object.XFAObject {
  60445. constructor(attributes) {
  60446. super(CONFIG_NS_ID, "data", true);
  60447. this.adjustData = null;
  60448. this.attributes = null;
  60449. this.incrementalLoad = null;
  60450. this.outputXSL = null;
  60451. this.range = null;
  60452. this.record = null;
  60453. this.startNode = null;
  60454. this.uri = null;
  60455. this.window = null;
  60456. this.xsl = null;
  60457. this.excludeNS = new _xfa_object.XFAObjectArray();
  60458. this.transform = new _xfa_object.XFAObjectArray();
  60459. }
  60460. }
  60461. class Debug extends _xfa_object.XFAObject {
  60462. constructor(attributes) {
  60463. super(CONFIG_NS_ID, "debug", true);
  60464. this.uri = null;
  60465. }
  60466. }
  60467. class DefaultTypeface extends _xfa_object.ContentObject {
  60468. constructor(attributes) {
  60469. super(CONFIG_NS_ID, "defaultTypeface");
  60470. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  60471. }
  60472. }
  60473. class Destination extends _xfa_object.OptionObject {
  60474. constructor(attributes) {
  60475. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  60476. }
  60477. }
  60478. class DocumentAssembly extends _xfa_object.Option01 {
  60479. constructor(attributes) {
  60480. super(CONFIG_NS_ID, "documentAssembly");
  60481. }
  60482. }
  60483. class Driver extends _xfa_object.XFAObject {
  60484. constructor(attributes) {
  60485. super(CONFIG_NS_ID, "driver", true);
  60486. this.name = attributes.name ? attributes.name.trim() : "";
  60487. this.fontInfo = null;
  60488. this.xdc = null;
  60489. }
  60490. }
  60491. class DuplexOption extends _xfa_object.OptionObject {
  60492. constructor(attributes) {
  60493. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  60494. }
  60495. }
  60496. class DynamicRender extends _xfa_object.OptionObject {
  60497. constructor(attributes) {
  60498. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  60499. }
  60500. }
  60501. class Embed extends _xfa_object.Option01 {
  60502. constructor(attributes) {
  60503. super(CONFIG_NS_ID, "embed");
  60504. }
  60505. }
  60506. class Encrypt extends _xfa_object.Option01 {
  60507. constructor(attributes) {
  60508. super(CONFIG_NS_ID, "encrypt");
  60509. }
  60510. }
  60511. class Encryption extends _xfa_object.XFAObject {
  60512. constructor(attributes) {
  60513. super(CONFIG_NS_ID, "encryption", true);
  60514. this.encrypt = null;
  60515. this.encryptionLevel = null;
  60516. this.permissions = null;
  60517. }
  60518. }
  60519. class EncryptionLevel extends _xfa_object.OptionObject {
  60520. constructor(attributes) {
  60521. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  60522. }
  60523. }
  60524. class Enforce extends _xfa_object.StringObject {
  60525. constructor(attributes) {
  60526. super(CONFIG_NS_ID, "enforce");
  60527. }
  60528. }
  60529. class Equate extends _xfa_object.XFAObject {
  60530. constructor(attributes) {
  60531. super(CONFIG_NS_ID, "equate");
  60532. this.force = (0, _utils.getInteger)({
  60533. data: attributes.force,
  60534. defaultValue: 1,
  60535. validate: n => n === 0
  60536. });
  60537. this.from = attributes.from || "";
  60538. this.to = attributes.to || "";
  60539. }
  60540. }
  60541. class EquateRange extends _xfa_object.XFAObject {
  60542. constructor(attributes) {
  60543. super(CONFIG_NS_ID, "equateRange");
  60544. this.from = attributes.from || "";
  60545. this.to = attributes.to || "";
  60546. this._unicodeRange = attributes.unicodeRange || "";
  60547. }
  60548. get unicodeRange() {
  60549. const ranges = [];
  60550. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  60551. const unicodeRange = this._unicodeRange;
  60552. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  60553. range = range.split("-", 2).map(x => {
  60554. const found = x.match(unicodeRegex);
  60555. if (!found) {
  60556. return 0;
  60557. }
  60558. return parseInt(found[1], 16);
  60559. });
  60560. if (range.length === 1) {
  60561. range.push(range[0]);
  60562. }
  60563. ranges.push(range);
  60564. }
  60565. return (0, _util.shadow)(this, "unicodeRange", ranges);
  60566. }
  60567. }
  60568. class Exclude extends _xfa_object.ContentObject {
  60569. constructor(attributes) {
  60570. super(CONFIG_NS_ID, "exclude");
  60571. }
  60572. [_xfa_object.$finalize]() {
  60573. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  60574. }
  60575. }
  60576. class ExcludeNS extends _xfa_object.StringObject {
  60577. constructor(attributes) {
  60578. super(CONFIG_NS_ID, "excludeNS");
  60579. }
  60580. }
  60581. class FlipLabel extends _xfa_object.OptionObject {
  60582. constructor(attributes) {
  60583. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  60584. }
  60585. }
  60586. class FontInfo extends _xfa_object.XFAObject {
  60587. constructor(attributes) {
  60588. super(CONFIG_NS_ID, "fontInfo", true);
  60589. this.embed = null;
  60590. this.map = null;
  60591. this.subsetBelow = null;
  60592. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  60593. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  60594. this.neverEmbed = new _xfa_object.XFAObjectArray();
  60595. }
  60596. }
  60597. class FormFieldFilling extends _xfa_object.Option01 {
  60598. constructor(attributes) {
  60599. super(CONFIG_NS_ID, "formFieldFilling");
  60600. }
  60601. }
  60602. class GroupParent extends _xfa_object.StringObject {
  60603. constructor(attributes) {
  60604. super(CONFIG_NS_ID, "groupParent");
  60605. }
  60606. }
  60607. class IfEmpty extends _xfa_object.OptionObject {
  60608. constructor(attributes) {
  60609. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  60610. }
  60611. }
  60612. class IncludeXDPContent extends _xfa_object.StringObject {
  60613. constructor(attributes) {
  60614. super(CONFIG_NS_ID, "includeXDPContent");
  60615. }
  60616. }
  60617. class IncrementalLoad extends _xfa_object.OptionObject {
  60618. constructor(attributes) {
  60619. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  60620. }
  60621. }
  60622. class IncrementalMerge extends _xfa_object.Option01 {
  60623. constructor(attributes) {
  60624. super(CONFIG_NS_ID, "incrementalMerge");
  60625. }
  60626. }
  60627. class Interactive extends _xfa_object.Option01 {
  60628. constructor(attributes) {
  60629. super(CONFIG_NS_ID, "interactive");
  60630. }
  60631. }
  60632. class Jog extends _xfa_object.OptionObject {
  60633. constructor(attributes) {
  60634. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  60635. }
  60636. }
  60637. class LabelPrinter extends _xfa_object.XFAObject {
  60638. constructor(attributes) {
  60639. super(CONFIG_NS_ID, "labelPrinter", true);
  60640. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  60641. this.batchOutput = null;
  60642. this.flipLabel = null;
  60643. this.fontInfo = null;
  60644. this.xdc = null;
  60645. }
  60646. }
  60647. class Layout extends _xfa_object.OptionObject {
  60648. constructor(attributes) {
  60649. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  60650. }
  60651. }
  60652. class Level extends _xfa_object.IntegerObject {
  60653. constructor(attributes) {
  60654. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  60655. }
  60656. }
  60657. class Linearized extends _xfa_object.Option01 {
  60658. constructor(attributes) {
  60659. super(CONFIG_NS_ID, "linearized");
  60660. }
  60661. }
  60662. class Locale extends _xfa_object.StringObject {
  60663. constructor(attributes) {
  60664. super(CONFIG_NS_ID, "locale");
  60665. }
  60666. }
  60667. class LocaleSet extends _xfa_object.StringObject {
  60668. constructor(attributes) {
  60669. super(CONFIG_NS_ID, "localeSet");
  60670. }
  60671. }
  60672. class Log extends _xfa_object.XFAObject {
  60673. constructor(attributes) {
  60674. super(CONFIG_NS_ID, "log", true);
  60675. this.mode = null;
  60676. this.threshold = null;
  60677. this.to = null;
  60678. this.uri = null;
  60679. }
  60680. }
  60681. class MapElement extends _xfa_object.XFAObject {
  60682. constructor(attributes) {
  60683. super(CONFIG_NS_ID, "map", true);
  60684. this.equate = new _xfa_object.XFAObjectArray();
  60685. this.equateRange = new _xfa_object.XFAObjectArray();
  60686. }
  60687. }
  60688. class MediumInfo extends _xfa_object.XFAObject {
  60689. constructor(attributes) {
  60690. super(CONFIG_NS_ID, "mediumInfo", true);
  60691. this.map = null;
  60692. }
  60693. }
  60694. class Message extends _xfa_object.XFAObject {
  60695. constructor(attributes) {
  60696. super(CONFIG_NS_ID, "message", true);
  60697. this.msgId = null;
  60698. this.severity = null;
  60699. }
  60700. }
  60701. class Messaging extends _xfa_object.XFAObject {
  60702. constructor(attributes) {
  60703. super(CONFIG_NS_ID, "messaging", true);
  60704. this.message = new _xfa_object.XFAObjectArray();
  60705. }
  60706. }
  60707. class Mode extends _xfa_object.OptionObject {
  60708. constructor(attributes) {
  60709. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  60710. }
  60711. }
  60712. class ModifyAnnots extends _xfa_object.Option01 {
  60713. constructor(attributes) {
  60714. super(CONFIG_NS_ID, "modifyAnnots");
  60715. }
  60716. }
  60717. class MsgId extends _xfa_object.IntegerObject {
  60718. constructor(attributes) {
  60719. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  60720. }
  60721. }
  60722. class NameAttr extends _xfa_object.StringObject {
  60723. constructor(attributes) {
  60724. super(CONFIG_NS_ID, "nameAttr");
  60725. }
  60726. }
  60727. class NeverEmbed extends _xfa_object.ContentObject {
  60728. constructor(attributes) {
  60729. super(CONFIG_NS_ID, "neverEmbed");
  60730. }
  60731. }
  60732. class NumberOfCopies extends _xfa_object.IntegerObject {
  60733. constructor(attributes) {
  60734. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  60735. }
  60736. }
  60737. class OpenAction extends _xfa_object.XFAObject {
  60738. constructor(attributes) {
  60739. super(CONFIG_NS_ID, "openAction", true);
  60740. this.destination = null;
  60741. }
  60742. }
  60743. class Output extends _xfa_object.XFAObject {
  60744. constructor(attributes) {
  60745. super(CONFIG_NS_ID, "output", true);
  60746. this.to = null;
  60747. this.type = null;
  60748. this.uri = null;
  60749. }
  60750. }
  60751. class OutputBin extends _xfa_object.StringObject {
  60752. constructor(attributes) {
  60753. super(CONFIG_NS_ID, "outputBin");
  60754. }
  60755. }
  60756. class OutputXSL extends _xfa_object.XFAObject {
  60757. constructor(attributes) {
  60758. super(CONFIG_NS_ID, "outputXSL", true);
  60759. this.uri = null;
  60760. }
  60761. }
  60762. class Overprint extends _xfa_object.OptionObject {
  60763. constructor(attributes) {
  60764. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  60765. }
  60766. }
  60767. class Packets extends _xfa_object.StringObject {
  60768. constructor(attributes) {
  60769. super(CONFIG_NS_ID, "packets");
  60770. }
  60771. [_xfa_object.$finalize]() {
  60772. if (this[_xfa_object.$content] === "*") {
  60773. return;
  60774. }
  60775. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  60776. }
  60777. }
  60778. class PageOffset extends _xfa_object.XFAObject {
  60779. constructor(attributes) {
  60780. super(CONFIG_NS_ID, "pageOffset");
  60781. this.x = (0, _utils.getInteger)({
  60782. data: attributes.x,
  60783. defaultValue: "useXDCSetting",
  60784. validate: n => true
  60785. });
  60786. this.y = (0, _utils.getInteger)({
  60787. data: attributes.y,
  60788. defaultValue: "useXDCSetting",
  60789. validate: n => true
  60790. });
  60791. }
  60792. }
  60793. class PageRange extends _xfa_object.StringObject {
  60794. constructor(attributes) {
  60795. super(CONFIG_NS_ID, "pageRange");
  60796. }
  60797. [_xfa_object.$finalize]() {
  60798. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  60799. const ranges = [];
  60800. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  60801. ranges.push(numbers.slice(i, i + 2));
  60802. }
  60803. this[_xfa_object.$content] = ranges;
  60804. }
  60805. }
  60806. class Pagination extends _xfa_object.OptionObject {
  60807. constructor(attributes) {
  60808. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  60809. }
  60810. }
  60811. class PaginationOverride extends _xfa_object.OptionObject {
  60812. constructor(attributes) {
  60813. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  60814. }
  60815. }
  60816. class Part extends _xfa_object.IntegerObject {
  60817. constructor(attributes) {
  60818. super(CONFIG_NS_ID, "part", 1, n => false);
  60819. }
  60820. }
  60821. class Pcl extends _xfa_object.XFAObject {
  60822. constructor(attributes) {
  60823. super(CONFIG_NS_ID, "pcl", true);
  60824. this.name = attributes.name || "";
  60825. this.batchOutput = null;
  60826. this.fontInfo = null;
  60827. this.jog = null;
  60828. this.mediumInfo = null;
  60829. this.outputBin = null;
  60830. this.pageOffset = null;
  60831. this.staple = null;
  60832. this.xdc = null;
  60833. }
  60834. }
  60835. class Pdf extends _xfa_object.XFAObject {
  60836. constructor(attributes) {
  60837. super(CONFIG_NS_ID, "pdf", true);
  60838. this.name = attributes.name || "";
  60839. this.adobeExtensionLevel = null;
  60840. this.batchOutput = null;
  60841. this.compression = null;
  60842. this.creator = null;
  60843. this.encryption = null;
  60844. this.fontInfo = null;
  60845. this.interactive = null;
  60846. this.linearized = null;
  60847. this.openAction = null;
  60848. this.pdfa = null;
  60849. this.producer = null;
  60850. this.renderPolicy = null;
  60851. this.scriptModel = null;
  60852. this.silentPrint = null;
  60853. this.submitFormat = null;
  60854. this.tagged = null;
  60855. this.version = null;
  60856. this.viewerPreferences = null;
  60857. this.xdc = null;
  60858. }
  60859. }
  60860. class Pdfa extends _xfa_object.XFAObject {
  60861. constructor(attributes) {
  60862. super(CONFIG_NS_ID, "pdfa", true);
  60863. this.amd = null;
  60864. this.conformance = null;
  60865. this.includeXDPContent = null;
  60866. this.part = null;
  60867. }
  60868. }
  60869. class Permissions extends _xfa_object.XFAObject {
  60870. constructor(attributes) {
  60871. super(CONFIG_NS_ID, "permissions", true);
  60872. this.accessibleContent = null;
  60873. this.change = null;
  60874. this.contentCopy = null;
  60875. this.documentAssembly = null;
  60876. this.formFieldFilling = null;
  60877. this.modifyAnnots = null;
  60878. this.plaintextMetadata = null;
  60879. this.print = null;
  60880. this.printHighQuality = null;
  60881. }
  60882. }
  60883. class PickTrayByPDFSize extends _xfa_object.Option01 {
  60884. constructor(attributes) {
  60885. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  60886. }
  60887. }
  60888. class Picture extends _xfa_object.StringObject {
  60889. constructor(attributes) {
  60890. super(CONFIG_NS_ID, "picture");
  60891. }
  60892. }
  60893. class PlaintextMetadata extends _xfa_object.Option01 {
  60894. constructor(attributes) {
  60895. super(CONFIG_NS_ID, "plaintextMetadata");
  60896. }
  60897. }
  60898. class Presence extends _xfa_object.OptionObject {
  60899. constructor(attributes) {
  60900. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  60901. }
  60902. }
  60903. class Present extends _xfa_object.XFAObject {
  60904. constructor(attributes) {
  60905. super(CONFIG_NS_ID, "present", true);
  60906. this.behaviorOverride = null;
  60907. this.cache = null;
  60908. this.common = null;
  60909. this.copies = null;
  60910. this.destination = null;
  60911. this.incrementalMerge = null;
  60912. this.layout = null;
  60913. this.output = null;
  60914. this.overprint = null;
  60915. this.pagination = null;
  60916. this.paginationOverride = null;
  60917. this.script = null;
  60918. this.validate = null;
  60919. this.xdp = null;
  60920. this.driver = new _xfa_object.XFAObjectArray();
  60921. this.labelPrinter = new _xfa_object.XFAObjectArray();
  60922. this.pcl = new _xfa_object.XFAObjectArray();
  60923. this.pdf = new _xfa_object.XFAObjectArray();
  60924. this.ps = new _xfa_object.XFAObjectArray();
  60925. this.submitUrl = new _xfa_object.XFAObjectArray();
  60926. this.webClient = new _xfa_object.XFAObjectArray();
  60927. this.zpl = new _xfa_object.XFAObjectArray();
  60928. }
  60929. }
  60930. class Print extends _xfa_object.Option01 {
  60931. constructor(attributes) {
  60932. super(CONFIG_NS_ID, "print");
  60933. }
  60934. }
  60935. class PrintHighQuality extends _xfa_object.Option01 {
  60936. constructor(attributes) {
  60937. super(CONFIG_NS_ID, "printHighQuality");
  60938. }
  60939. }
  60940. class PrintScaling extends _xfa_object.OptionObject {
  60941. constructor(attributes) {
  60942. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  60943. }
  60944. }
  60945. class PrinterName extends _xfa_object.StringObject {
  60946. constructor(attributes) {
  60947. super(CONFIG_NS_ID, "printerName");
  60948. }
  60949. }
  60950. class Producer extends _xfa_object.StringObject {
  60951. constructor(attributes) {
  60952. super(CONFIG_NS_ID, "producer");
  60953. }
  60954. }
  60955. class Ps extends _xfa_object.XFAObject {
  60956. constructor(attributes) {
  60957. super(CONFIG_NS_ID, "ps", true);
  60958. this.name = attributes.name || "";
  60959. this.batchOutput = null;
  60960. this.fontInfo = null;
  60961. this.jog = null;
  60962. this.mediumInfo = null;
  60963. this.outputBin = null;
  60964. this.staple = null;
  60965. this.xdc = null;
  60966. }
  60967. }
  60968. class Range extends _xfa_object.ContentObject {
  60969. constructor(attributes) {
  60970. super(CONFIG_NS_ID, "range");
  60971. }
  60972. [_xfa_object.$finalize]() {
  60973. 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 => {
  60974. if (range.length === 1) {
  60975. range.push(range[0]);
  60976. }
  60977. return range;
  60978. });
  60979. }
  60980. }
  60981. class Record extends _xfa_object.ContentObject {
  60982. constructor(attributes) {
  60983. super(CONFIG_NS_ID, "record");
  60984. }
  60985. [_xfa_object.$finalize]() {
  60986. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  60987. const n = parseInt(this[_xfa_object.$content], 10);
  60988. if (!isNaN(n) && n >= 0) {
  60989. this[_xfa_object.$content] = n;
  60990. }
  60991. }
  60992. }
  60993. class Relevant extends _xfa_object.ContentObject {
  60994. constructor(attributes) {
  60995. super(CONFIG_NS_ID, "relevant");
  60996. }
  60997. [_xfa_object.$finalize]() {
  60998. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  60999. }
  61000. }
  61001. class Rename extends _xfa_object.ContentObject {
  61002. constructor(attributes) {
  61003. super(CONFIG_NS_ID, "rename");
  61004. }
  61005. [_xfa_object.$finalize]() {
  61006. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  61007. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_xfa_object.$content])) {
  61008. (0, _util.warn)("XFA - Rename: invalid XFA name");
  61009. }
  61010. }
  61011. }
  61012. class RenderPolicy extends _xfa_object.OptionObject {
  61013. constructor(attributes) {
  61014. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  61015. }
  61016. }
  61017. class RunScripts extends _xfa_object.OptionObject {
  61018. constructor(attributes) {
  61019. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  61020. }
  61021. }
  61022. class Script extends _xfa_object.XFAObject {
  61023. constructor(attributes) {
  61024. super(CONFIG_NS_ID, "script", true);
  61025. this.currentPage = null;
  61026. this.exclude = null;
  61027. this.runScripts = null;
  61028. }
  61029. }
  61030. class ScriptModel extends _xfa_object.OptionObject {
  61031. constructor(attributes) {
  61032. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  61033. }
  61034. }
  61035. class Severity extends _xfa_object.OptionObject {
  61036. constructor(attributes) {
  61037. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  61038. }
  61039. }
  61040. class SilentPrint extends _xfa_object.XFAObject {
  61041. constructor(attributes) {
  61042. super(CONFIG_NS_ID, "silentPrint", true);
  61043. this.addSilentPrint = null;
  61044. this.printerName = null;
  61045. }
  61046. }
  61047. class Staple extends _xfa_object.XFAObject {
  61048. constructor(attributes) {
  61049. super(CONFIG_NS_ID, "staple");
  61050. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  61051. }
  61052. }
  61053. class StartNode extends _xfa_object.StringObject {
  61054. constructor(attributes) {
  61055. super(CONFIG_NS_ID, "startNode");
  61056. }
  61057. }
  61058. class StartPage extends _xfa_object.IntegerObject {
  61059. constructor(attributes) {
  61060. super(CONFIG_NS_ID, "startPage", 0, n => true);
  61061. }
  61062. }
  61063. class SubmitFormat extends _xfa_object.OptionObject {
  61064. constructor(attributes) {
  61065. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  61066. }
  61067. }
  61068. class SubmitUrl extends _xfa_object.StringObject {
  61069. constructor(attributes) {
  61070. super(CONFIG_NS_ID, "submitUrl");
  61071. }
  61072. }
  61073. class SubsetBelow extends _xfa_object.IntegerObject {
  61074. constructor(attributes) {
  61075. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  61076. }
  61077. }
  61078. class SuppressBanner extends _xfa_object.Option01 {
  61079. constructor(attributes) {
  61080. super(CONFIG_NS_ID, "suppressBanner");
  61081. }
  61082. }
  61083. class Tagged extends _xfa_object.Option01 {
  61084. constructor(attributes) {
  61085. super(CONFIG_NS_ID, "tagged");
  61086. }
  61087. }
  61088. class Template extends _xfa_object.XFAObject {
  61089. constructor(attributes) {
  61090. super(CONFIG_NS_ID, "template", true);
  61091. this.base = null;
  61092. this.relevant = null;
  61093. this.startPage = null;
  61094. this.uri = null;
  61095. this.xsl = null;
  61096. }
  61097. }
  61098. class Threshold extends _xfa_object.OptionObject {
  61099. constructor(attributes) {
  61100. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  61101. }
  61102. }
  61103. class To extends _xfa_object.OptionObject {
  61104. constructor(attributes) {
  61105. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  61106. }
  61107. }
  61108. class TemplateCache extends _xfa_object.XFAObject {
  61109. constructor(attributes) {
  61110. super(CONFIG_NS_ID, "templateCache");
  61111. this.maxEntries = (0, _utils.getInteger)({
  61112. data: attributes.maxEntries,
  61113. defaultValue: 5,
  61114. validate: n => n >= 0
  61115. });
  61116. }
  61117. }
  61118. class Trace extends _xfa_object.XFAObject {
  61119. constructor(attributes) {
  61120. super(CONFIG_NS_ID, "trace", true);
  61121. this.area = new _xfa_object.XFAObjectArray();
  61122. }
  61123. }
  61124. class Transform extends _xfa_object.XFAObject {
  61125. constructor(attributes) {
  61126. super(CONFIG_NS_ID, "transform", true);
  61127. this.groupParent = null;
  61128. this.ifEmpty = null;
  61129. this.nameAttr = null;
  61130. this.picture = null;
  61131. this.presence = null;
  61132. this.rename = null;
  61133. this.whitespace = null;
  61134. }
  61135. }
  61136. class Type extends _xfa_object.OptionObject {
  61137. constructor(attributes) {
  61138. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  61139. }
  61140. }
  61141. class Uri extends _xfa_object.StringObject {
  61142. constructor(attributes) {
  61143. super(CONFIG_NS_ID, "uri");
  61144. }
  61145. }
  61146. class Validate extends _xfa_object.OptionObject {
  61147. constructor(attributes) {
  61148. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  61149. }
  61150. }
  61151. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  61152. constructor(attributes) {
  61153. super(CONFIG_NS_ID, "validateApprovalSignatures");
  61154. }
  61155. [_xfa_object.$finalize]() {
  61156. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  61157. }
  61158. }
  61159. class ValidationMessaging extends _xfa_object.OptionObject {
  61160. constructor(attributes) {
  61161. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  61162. }
  61163. }
  61164. class Version extends _xfa_object.OptionObject {
  61165. constructor(attributes) {
  61166. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  61167. }
  61168. }
  61169. class VersionControl extends _xfa_object.XFAObject {
  61170. constructor(attributes) {
  61171. super(CONFIG_NS_ID, "VersionControl");
  61172. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  61173. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  61174. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  61175. }
  61176. }
  61177. class ViewerPreferences extends _xfa_object.XFAObject {
  61178. constructor(attributes) {
  61179. super(CONFIG_NS_ID, "viewerPreferences", true);
  61180. this.ADBE_JSConsole = null;
  61181. this.ADBE_JSDebugger = null;
  61182. this.addViewerPreferences = null;
  61183. this.duplexOption = null;
  61184. this.enforce = null;
  61185. this.numberOfCopies = null;
  61186. this.pageRange = null;
  61187. this.pickTrayByPDFSize = null;
  61188. this.printScaling = null;
  61189. }
  61190. }
  61191. class WebClient extends _xfa_object.XFAObject {
  61192. constructor(attributes) {
  61193. super(CONFIG_NS_ID, "webClient", true);
  61194. this.name = attributes.name ? attributes.name.trim() : "";
  61195. this.fontInfo = null;
  61196. this.xdc = null;
  61197. }
  61198. }
  61199. class Whitespace extends _xfa_object.OptionObject {
  61200. constructor(attributes) {
  61201. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  61202. }
  61203. }
  61204. class Window extends _xfa_object.ContentObject {
  61205. constructor(attributes) {
  61206. super(CONFIG_NS_ID, "window");
  61207. }
  61208. [_xfa_object.$finalize]() {
  61209. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  61210. if (pair.some(x => isNaN(x))) {
  61211. this[_xfa_object.$content] = [0, 0];
  61212. return;
  61213. }
  61214. if (pair.length === 1) {
  61215. pair.push(pair[0]);
  61216. }
  61217. this[_xfa_object.$content] = pair;
  61218. }
  61219. }
  61220. class Xdc extends _xfa_object.XFAObject {
  61221. constructor(attributes) {
  61222. super(CONFIG_NS_ID, "xdc", true);
  61223. this.uri = new _xfa_object.XFAObjectArray();
  61224. this.xsl = new _xfa_object.XFAObjectArray();
  61225. }
  61226. }
  61227. class Xdp extends _xfa_object.XFAObject {
  61228. constructor(attributes) {
  61229. super(CONFIG_NS_ID, "xdp", true);
  61230. this.packets = null;
  61231. }
  61232. }
  61233. class Xsl extends _xfa_object.XFAObject {
  61234. constructor(attributes) {
  61235. super(CONFIG_NS_ID, "xsl", true);
  61236. this.debug = null;
  61237. this.uri = null;
  61238. }
  61239. }
  61240. class Zpl extends _xfa_object.XFAObject {
  61241. constructor(attributes) {
  61242. super(CONFIG_NS_ID, "zpl", true);
  61243. this.name = attributes.name ? attributes.name.trim() : "";
  61244. this.batchOutput = null;
  61245. this.flipLabel = null;
  61246. this.fontInfo = null;
  61247. this.xdc = null;
  61248. }
  61249. }
  61250. class ConfigNamespace {
  61251. static [_namespaces.$buildXFAObject](name, attributes) {
  61252. if (ConfigNamespace.hasOwnProperty(name)) {
  61253. return ConfigNamespace[name](attributes);
  61254. }
  61255. return undefined;
  61256. }
  61257. static acrobat(attrs) {
  61258. return new Acrobat(attrs);
  61259. }
  61260. static acrobat7(attrs) {
  61261. return new Acrobat7(attrs);
  61262. }
  61263. static ADBE_JSConsole(attrs) {
  61264. return new ADBE_JSConsole(attrs);
  61265. }
  61266. static ADBE_JSDebugger(attrs) {
  61267. return new ADBE_JSDebugger(attrs);
  61268. }
  61269. static addSilentPrint(attrs) {
  61270. return new AddSilentPrint(attrs);
  61271. }
  61272. static addViewerPreferences(attrs) {
  61273. return new AddViewerPreferences(attrs);
  61274. }
  61275. static adjustData(attrs) {
  61276. return new AdjustData(attrs);
  61277. }
  61278. static adobeExtensionLevel(attrs) {
  61279. return new AdobeExtensionLevel(attrs);
  61280. }
  61281. static agent(attrs) {
  61282. return new Agent(attrs);
  61283. }
  61284. static alwaysEmbed(attrs) {
  61285. return new AlwaysEmbed(attrs);
  61286. }
  61287. static amd(attrs) {
  61288. return new Amd(attrs);
  61289. }
  61290. static area(attrs) {
  61291. return new Area(attrs);
  61292. }
  61293. static attributes(attrs) {
  61294. return new Attributes(attrs);
  61295. }
  61296. static autoSave(attrs) {
  61297. return new AutoSave(attrs);
  61298. }
  61299. static base(attrs) {
  61300. return new Base(attrs);
  61301. }
  61302. static batchOutput(attrs) {
  61303. return new BatchOutput(attrs);
  61304. }
  61305. static behaviorOverride(attrs) {
  61306. return new BehaviorOverride(attrs);
  61307. }
  61308. static cache(attrs) {
  61309. return new Cache(attrs);
  61310. }
  61311. static change(attrs) {
  61312. return new Change(attrs);
  61313. }
  61314. static common(attrs) {
  61315. return new Common(attrs);
  61316. }
  61317. static compress(attrs) {
  61318. return new Compress(attrs);
  61319. }
  61320. static compressLogicalStructure(attrs) {
  61321. return new CompressLogicalStructure(attrs);
  61322. }
  61323. static compressObjectStream(attrs) {
  61324. return new CompressObjectStream(attrs);
  61325. }
  61326. static compression(attrs) {
  61327. return new Compression(attrs);
  61328. }
  61329. static config(attrs) {
  61330. return new Config(attrs);
  61331. }
  61332. static conformance(attrs) {
  61333. return new Conformance(attrs);
  61334. }
  61335. static contentCopy(attrs) {
  61336. return new ContentCopy(attrs);
  61337. }
  61338. static copies(attrs) {
  61339. return new Copies(attrs);
  61340. }
  61341. static creator(attrs) {
  61342. return new Creator(attrs);
  61343. }
  61344. static currentPage(attrs) {
  61345. return new CurrentPage(attrs);
  61346. }
  61347. static data(attrs) {
  61348. return new Data(attrs);
  61349. }
  61350. static debug(attrs) {
  61351. return new Debug(attrs);
  61352. }
  61353. static defaultTypeface(attrs) {
  61354. return new DefaultTypeface(attrs);
  61355. }
  61356. static destination(attrs) {
  61357. return new Destination(attrs);
  61358. }
  61359. static documentAssembly(attrs) {
  61360. return new DocumentAssembly(attrs);
  61361. }
  61362. static driver(attrs) {
  61363. return new Driver(attrs);
  61364. }
  61365. static duplexOption(attrs) {
  61366. return new DuplexOption(attrs);
  61367. }
  61368. static dynamicRender(attrs) {
  61369. return new DynamicRender(attrs);
  61370. }
  61371. static embed(attrs) {
  61372. return new Embed(attrs);
  61373. }
  61374. static encrypt(attrs) {
  61375. return new Encrypt(attrs);
  61376. }
  61377. static encryption(attrs) {
  61378. return new Encryption(attrs);
  61379. }
  61380. static encryptionLevel(attrs) {
  61381. return new EncryptionLevel(attrs);
  61382. }
  61383. static enforce(attrs) {
  61384. return new Enforce(attrs);
  61385. }
  61386. static equate(attrs) {
  61387. return new Equate(attrs);
  61388. }
  61389. static equateRange(attrs) {
  61390. return new EquateRange(attrs);
  61391. }
  61392. static exclude(attrs) {
  61393. return new Exclude(attrs);
  61394. }
  61395. static excludeNS(attrs) {
  61396. return new ExcludeNS(attrs);
  61397. }
  61398. static flipLabel(attrs) {
  61399. return new FlipLabel(attrs);
  61400. }
  61401. static fontInfo(attrs) {
  61402. return new FontInfo(attrs);
  61403. }
  61404. static formFieldFilling(attrs) {
  61405. return new FormFieldFilling(attrs);
  61406. }
  61407. static groupParent(attrs) {
  61408. return new GroupParent(attrs);
  61409. }
  61410. static ifEmpty(attrs) {
  61411. return new IfEmpty(attrs);
  61412. }
  61413. static includeXDPContent(attrs) {
  61414. return new IncludeXDPContent(attrs);
  61415. }
  61416. static incrementalLoad(attrs) {
  61417. return new IncrementalLoad(attrs);
  61418. }
  61419. static incrementalMerge(attrs) {
  61420. return new IncrementalMerge(attrs);
  61421. }
  61422. static interactive(attrs) {
  61423. return new Interactive(attrs);
  61424. }
  61425. static jog(attrs) {
  61426. return new Jog(attrs);
  61427. }
  61428. static labelPrinter(attrs) {
  61429. return new LabelPrinter(attrs);
  61430. }
  61431. static layout(attrs) {
  61432. return new Layout(attrs);
  61433. }
  61434. static level(attrs) {
  61435. return new Level(attrs);
  61436. }
  61437. static linearized(attrs) {
  61438. return new Linearized(attrs);
  61439. }
  61440. static locale(attrs) {
  61441. return new Locale(attrs);
  61442. }
  61443. static localeSet(attrs) {
  61444. return new LocaleSet(attrs);
  61445. }
  61446. static log(attrs) {
  61447. return new Log(attrs);
  61448. }
  61449. static map(attrs) {
  61450. return new MapElement(attrs);
  61451. }
  61452. static mediumInfo(attrs) {
  61453. return new MediumInfo(attrs);
  61454. }
  61455. static message(attrs) {
  61456. return new Message(attrs);
  61457. }
  61458. static messaging(attrs) {
  61459. return new Messaging(attrs);
  61460. }
  61461. static mode(attrs) {
  61462. return new Mode(attrs);
  61463. }
  61464. static modifyAnnots(attrs) {
  61465. return new ModifyAnnots(attrs);
  61466. }
  61467. static msgId(attrs) {
  61468. return new MsgId(attrs);
  61469. }
  61470. static nameAttr(attrs) {
  61471. return new NameAttr(attrs);
  61472. }
  61473. static neverEmbed(attrs) {
  61474. return new NeverEmbed(attrs);
  61475. }
  61476. static numberOfCopies(attrs) {
  61477. return new NumberOfCopies(attrs);
  61478. }
  61479. static openAction(attrs) {
  61480. return new OpenAction(attrs);
  61481. }
  61482. static output(attrs) {
  61483. return new Output(attrs);
  61484. }
  61485. static outputBin(attrs) {
  61486. return new OutputBin(attrs);
  61487. }
  61488. static outputXSL(attrs) {
  61489. return new OutputXSL(attrs);
  61490. }
  61491. static overprint(attrs) {
  61492. return new Overprint(attrs);
  61493. }
  61494. static packets(attrs) {
  61495. return new Packets(attrs);
  61496. }
  61497. static pageOffset(attrs) {
  61498. return new PageOffset(attrs);
  61499. }
  61500. static pageRange(attrs) {
  61501. return new PageRange(attrs);
  61502. }
  61503. static pagination(attrs) {
  61504. return new Pagination(attrs);
  61505. }
  61506. static paginationOverride(attrs) {
  61507. return new PaginationOverride(attrs);
  61508. }
  61509. static part(attrs) {
  61510. return new Part(attrs);
  61511. }
  61512. static pcl(attrs) {
  61513. return new Pcl(attrs);
  61514. }
  61515. static pdf(attrs) {
  61516. return new Pdf(attrs);
  61517. }
  61518. static pdfa(attrs) {
  61519. return new Pdfa(attrs);
  61520. }
  61521. static permissions(attrs) {
  61522. return new Permissions(attrs);
  61523. }
  61524. static pickTrayByPDFSize(attrs) {
  61525. return new PickTrayByPDFSize(attrs);
  61526. }
  61527. static picture(attrs) {
  61528. return new Picture(attrs);
  61529. }
  61530. static plaintextMetadata(attrs) {
  61531. return new PlaintextMetadata(attrs);
  61532. }
  61533. static presence(attrs) {
  61534. return new Presence(attrs);
  61535. }
  61536. static present(attrs) {
  61537. return new Present(attrs);
  61538. }
  61539. static print(attrs) {
  61540. return new Print(attrs);
  61541. }
  61542. static printHighQuality(attrs) {
  61543. return new PrintHighQuality(attrs);
  61544. }
  61545. static printScaling(attrs) {
  61546. return new PrintScaling(attrs);
  61547. }
  61548. static printerName(attrs) {
  61549. return new PrinterName(attrs);
  61550. }
  61551. static producer(attrs) {
  61552. return new Producer(attrs);
  61553. }
  61554. static ps(attrs) {
  61555. return new Ps(attrs);
  61556. }
  61557. static range(attrs) {
  61558. return new Range(attrs);
  61559. }
  61560. static record(attrs) {
  61561. return new Record(attrs);
  61562. }
  61563. static relevant(attrs) {
  61564. return new Relevant(attrs);
  61565. }
  61566. static rename(attrs) {
  61567. return new Rename(attrs);
  61568. }
  61569. static renderPolicy(attrs) {
  61570. return new RenderPolicy(attrs);
  61571. }
  61572. static runScripts(attrs) {
  61573. return new RunScripts(attrs);
  61574. }
  61575. static script(attrs) {
  61576. return new Script(attrs);
  61577. }
  61578. static scriptModel(attrs) {
  61579. return new ScriptModel(attrs);
  61580. }
  61581. static severity(attrs) {
  61582. return new Severity(attrs);
  61583. }
  61584. static silentPrint(attrs) {
  61585. return new SilentPrint(attrs);
  61586. }
  61587. static staple(attrs) {
  61588. return new Staple(attrs);
  61589. }
  61590. static startNode(attrs) {
  61591. return new StartNode(attrs);
  61592. }
  61593. static startPage(attrs) {
  61594. return new StartPage(attrs);
  61595. }
  61596. static submitFormat(attrs) {
  61597. return new SubmitFormat(attrs);
  61598. }
  61599. static submitUrl(attrs) {
  61600. return new SubmitUrl(attrs);
  61601. }
  61602. static subsetBelow(attrs) {
  61603. return new SubsetBelow(attrs);
  61604. }
  61605. static suppressBanner(attrs) {
  61606. return new SuppressBanner(attrs);
  61607. }
  61608. static tagged(attrs) {
  61609. return new Tagged(attrs);
  61610. }
  61611. static template(attrs) {
  61612. return new Template(attrs);
  61613. }
  61614. static templateCache(attrs) {
  61615. return new TemplateCache(attrs);
  61616. }
  61617. static threshold(attrs) {
  61618. return new Threshold(attrs);
  61619. }
  61620. static to(attrs) {
  61621. return new To(attrs);
  61622. }
  61623. static trace(attrs) {
  61624. return new Trace(attrs);
  61625. }
  61626. static transform(attrs) {
  61627. return new Transform(attrs);
  61628. }
  61629. static type(attrs) {
  61630. return new Type(attrs);
  61631. }
  61632. static uri(attrs) {
  61633. return new Uri(attrs);
  61634. }
  61635. static validate(attrs) {
  61636. return new Validate(attrs);
  61637. }
  61638. static validateApprovalSignatures(attrs) {
  61639. return new ValidateApprovalSignatures(attrs);
  61640. }
  61641. static validationMessaging(attrs) {
  61642. return new ValidationMessaging(attrs);
  61643. }
  61644. static version(attrs) {
  61645. return new Version(attrs);
  61646. }
  61647. static versionControl(attrs) {
  61648. return new VersionControl(attrs);
  61649. }
  61650. static viewerPreferences(attrs) {
  61651. return new ViewerPreferences(attrs);
  61652. }
  61653. static webClient(attrs) {
  61654. return new WebClient(attrs);
  61655. }
  61656. static whitespace(attrs) {
  61657. return new Whitespace(attrs);
  61658. }
  61659. static window(attrs) {
  61660. return new Window(attrs);
  61661. }
  61662. static xdc(attrs) {
  61663. return new Xdc(attrs);
  61664. }
  61665. static xdp(attrs) {
  61666. return new Xdp(attrs);
  61667. }
  61668. static xsl(attrs) {
  61669. return new Xsl(attrs);
  61670. }
  61671. static zpl(attrs) {
  61672. return new Zpl(attrs);
  61673. }
  61674. }
  61675. exports.ConfigNamespace = ConfigNamespace;
  61676. /***/ }),
  61677. /* 90 */
  61678. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61679. Object.defineProperty(exports, "__esModule", ({
  61680. value: true
  61681. }));
  61682. exports.ConnectionSetNamespace = void 0;
  61683. var _namespaces = __w_pdfjs_require__(77);
  61684. var _xfa_object = __w_pdfjs_require__(75);
  61685. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  61686. class ConnectionSet extends _xfa_object.XFAObject {
  61687. constructor(attributes) {
  61688. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  61689. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  61690. this.xmlConnection = new _xfa_object.XFAObjectArray();
  61691. this.xsdConnection = new _xfa_object.XFAObjectArray();
  61692. }
  61693. }
  61694. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  61695. constructor(attributes) {
  61696. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  61697. this.id = attributes.id || "";
  61698. this.name = attributes.name || "";
  61699. this.use = attributes.use || "";
  61700. this.usehref = attributes.usehref || "";
  61701. }
  61702. }
  61703. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  61704. constructor(attributes) {
  61705. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  61706. this.id = attributes.id || "";
  61707. this.name = attributes.name || "";
  61708. this.use = attributes.use || "";
  61709. this.usehref = attributes.usehref || "";
  61710. }
  61711. }
  61712. class Operation extends _xfa_object.StringObject {
  61713. constructor(attributes) {
  61714. super(CONNECTION_SET_NS_ID, "operation");
  61715. this.id = attributes.id || "";
  61716. this.input = attributes.input || "";
  61717. this.name = attributes.name || "";
  61718. this.output = attributes.output || "";
  61719. this.use = attributes.use || "";
  61720. this.usehref = attributes.usehref || "";
  61721. }
  61722. }
  61723. class RootElement extends _xfa_object.StringObject {
  61724. constructor(attributes) {
  61725. super(CONNECTION_SET_NS_ID, "rootElement");
  61726. this.id = attributes.id || "";
  61727. this.name = attributes.name || "";
  61728. this.use = attributes.use || "";
  61729. this.usehref = attributes.usehref || "";
  61730. }
  61731. }
  61732. class SoapAction extends _xfa_object.StringObject {
  61733. constructor(attributes) {
  61734. super(CONNECTION_SET_NS_ID, "soapAction");
  61735. this.id = attributes.id || "";
  61736. this.name = attributes.name || "";
  61737. this.use = attributes.use || "";
  61738. this.usehref = attributes.usehref || "";
  61739. }
  61740. }
  61741. class SoapAddress extends _xfa_object.StringObject {
  61742. constructor(attributes) {
  61743. super(CONNECTION_SET_NS_ID, "soapAddress");
  61744. this.id = attributes.id || "";
  61745. this.name = attributes.name || "";
  61746. this.use = attributes.use || "";
  61747. this.usehref = attributes.usehref || "";
  61748. }
  61749. }
  61750. class Uri extends _xfa_object.StringObject {
  61751. constructor(attributes) {
  61752. super(CONNECTION_SET_NS_ID, "uri");
  61753. this.id = attributes.id || "";
  61754. this.name = attributes.name || "";
  61755. this.use = attributes.use || "";
  61756. this.usehref = attributes.usehref || "";
  61757. }
  61758. }
  61759. class WsdlAddress extends _xfa_object.StringObject {
  61760. constructor(attributes) {
  61761. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  61762. this.id = attributes.id || "";
  61763. this.name = attributes.name || "";
  61764. this.use = attributes.use || "";
  61765. this.usehref = attributes.usehref || "";
  61766. }
  61767. }
  61768. class WsdlConnection extends _xfa_object.XFAObject {
  61769. constructor(attributes) {
  61770. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  61771. this.dataDescription = attributes.dataDescription || "";
  61772. this.name = attributes.name || "";
  61773. this.effectiveInputPolicy = null;
  61774. this.effectiveOutputPolicy = null;
  61775. this.operation = null;
  61776. this.soapAction = null;
  61777. this.soapAddress = null;
  61778. this.wsdlAddress = null;
  61779. }
  61780. }
  61781. class XmlConnection extends _xfa_object.XFAObject {
  61782. constructor(attributes) {
  61783. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  61784. this.dataDescription = attributes.dataDescription || "";
  61785. this.name = attributes.name || "";
  61786. this.uri = null;
  61787. }
  61788. }
  61789. class XsdConnection extends _xfa_object.XFAObject {
  61790. constructor(attributes) {
  61791. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  61792. this.dataDescription = attributes.dataDescription || "";
  61793. this.name = attributes.name || "";
  61794. this.rootElement = null;
  61795. this.uri = null;
  61796. }
  61797. }
  61798. class ConnectionSetNamespace {
  61799. static [_namespaces.$buildXFAObject](name, attributes) {
  61800. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  61801. return ConnectionSetNamespace[name](attributes);
  61802. }
  61803. return undefined;
  61804. }
  61805. static connectionSet(attrs) {
  61806. return new ConnectionSet(attrs);
  61807. }
  61808. static effectiveInputPolicy(attrs) {
  61809. return new EffectiveInputPolicy(attrs);
  61810. }
  61811. static effectiveOutputPolicy(attrs) {
  61812. return new EffectiveOutputPolicy(attrs);
  61813. }
  61814. static operation(attrs) {
  61815. return new Operation(attrs);
  61816. }
  61817. static rootElement(attrs) {
  61818. return new RootElement(attrs);
  61819. }
  61820. static soapAction(attrs) {
  61821. return new SoapAction(attrs);
  61822. }
  61823. static soapAddress(attrs) {
  61824. return new SoapAddress(attrs);
  61825. }
  61826. static uri(attrs) {
  61827. return new Uri(attrs);
  61828. }
  61829. static wsdlAddress(attrs) {
  61830. return new WsdlAddress(attrs);
  61831. }
  61832. static wsdlConnection(attrs) {
  61833. return new WsdlConnection(attrs);
  61834. }
  61835. static xmlConnection(attrs) {
  61836. return new XmlConnection(attrs);
  61837. }
  61838. static xsdConnection(attrs) {
  61839. return new XsdConnection(attrs);
  61840. }
  61841. }
  61842. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  61843. /***/ }),
  61844. /* 91 */
  61845. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61846. Object.defineProperty(exports, "__esModule", ({
  61847. value: true
  61848. }));
  61849. exports.DatasetsNamespace = void 0;
  61850. var _xfa_object = __w_pdfjs_require__(75);
  61851. var _namespaces = __w_pdfjs_require__(77);
  61852. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  61853. class Data extends _xfa_object.XmlObject {
  61854. constructor(attributes) {
  61855. super(DATASETS_NS_ID, "data", attributes);
  61856. }
  61857. [_xfa_object.$isNsAgnostic]() {
  61858. return true;
  61859. }
  61860. }
  61861. class Datasets extends _xfa_object.XFAObject {
  61862. constructor(attributes) {
  61863. super(DATASETS_NS_ID, "datasets", true);
  61864. this.data = null;
  61865. this.Signature = null;
  61866. }
  61867. [_xfa_object.$onChild](child) {
  61868. const name = child[_xfa_object.$nodeName];
  61869. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  61870. this[name] = child;
  61871. }
  61872. this[_xfa_object.$appendChild](child);
  61873. }
  61874. }
  61875. class DatasetsNamespace {
  61876. static [_namespaces.$buildXFAObject](name, attributes) {
  61877. if (DatasetsNamespace.hasOwnProperty(name)) {
  61878. return DatasetsNamespace[name](attributes);
  61879. }
  61880. return undefined;
  61881. }
  61882. static datasets(attributes) {
  61883. return new Datasets(attributes);
  61884. }
  61885. static data(attributes) {
  61886. return new Data(attributes);
  61887. }
  61888. }
  61889. exports.DatasetsNamespace = DatasetsNamespace;
  61890. /***/ }),
  61891. /* 92 */
  61892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61893. Object.defineProperty(exports, "__esModule", ({
  61894. value: true
  61895. }));
  61896. exports.LocaleSetNamespace = void 0;
  61897. var _namespaces = __w_pdfjs_require__(77);
  61898. var _xfa_object = __w_pdfjs_require__(75);
  61899. var _utils = __w_pdfjs_require__(76);
  61900. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  61901. class CalendarSymbols extends _xfa_object.XFAObject {
  61902. constructor(attributes) {
  61903. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  61904. this.name = "gregorian";
  61905. this.dayNames = new _xfa_object.XFAObjectArray(2);
  61906. this.eraNames = null;
  61907. this.meridiemNames = null;
  61908. this.monthNames = new _xfa_object.XFAObjectArray(2);
  61909. }
  61910. }
  61911. class CurrencySymbol extends _xfa_object.StringObject {
  61912. constructor(attributes) {
  61913. super(LOCALE_SET_NS_ID, "currencySymbol");
  61914. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  61915. }
  61916. }
  61917. class CurrencySymbols extends _xfa_object.XFAObject {
  61918. constructor(attributes) {
  61919. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  61920. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  61921. }
  61922. }
  61923. class DatePattern extends _xfa_object.StringObject {
  61924. constructor(attributes) {
  61925. super(LOCALE_SET_NS_ID, "datePattern");
  61926. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61927. }
  61928. }
  61929. class DatePatterns extends _xfa_object.XFAObject {
  61930. constructor(attributes) {
  61931. super(LOCALE_SET_NS_ID, "datePatterns", true);
  61932. this.datePattern = new _xfa_object.XFAObjectArray(4);
  61933. }
  61934. }
  61935. class DateTimeSymbols extends _xfa_object.ContentObject {
  61936. constructor(attributes) {
  61937. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  61938. }
  61939. }
  61940. class Day extends _xfa_object.StringObject {
  61941. constructor(attributes) {
  61942. super(LOCALE_SET_NS_ID, "day");
  61943. }
  61944. }
  61945. class DayNames extends _xfa_object.XFAObject {
  61946. constructor(attributes) {
  61947. super(LOCALE_SET_NS_ID, "dayNames", true);
  61948. this.abbr = (0, _utils.getInteger)({
  61949. data: attributes.abbr,
  61950. defaultValue: 0,
  61951. validate: x => x === 1
  61952. });
  61953. this.day = new _xfa_object.XFAObjectArray(7);
  61954. }
  61955. }
  61956. class Era extends _xfa_object.StringObject {
  61957. constructor(attributes) {
  61958. super(LOCALE_SET_NS_ID, "era");
  61959. }
  61960. }
  61961. class EraNames extends _xfa_object.XFAObject {
  61962. constructor(attributes) {
  61963. super(LOCALE_SET_NS_ID, "eraNames", true);
  61964. this.era = new _xfa_object.XFAObjectArray(2);
  61965. }
  61966. }
  61967. class Locale extends _xfa_object.XFAObject {
  61968. constructor(attributes) {
  61969. super(LOCALE_SET_NS_ID, "locale", true);
  61970. this.desc = attributes.desc || "";
  61971. this.name = "isoname";
  61972. this.calendarSymbols = null;
  61973. this.currencySymbols = null;
  61974. this.datePatterns = null;
  61975. this.dateTimeSymbols = null;
  61976. this.numberPatterns = null;
  61977. this.numberSymbols = null;
  61978. this.timePatterns = null;
  61979. this.typeFaces = null;
  61980. }
  61981. }
  61982. class LocaleSet extends _xfa_object.XFAObject {
  61983. constructor(attributes) {
  61984. super(LOCALE_SET_NS_ID, "localeSet", true);
  61985. this.locale = new _xfa_object.XFAObjectArray();
  61986. }
  61987. }
  61988. class Meridiem extends _xfa_object.StringObject {
  61989. constructor(attributes) {
  61990. super(LOCALE_SET_NS_ID, "meridiem");
  61991. }
  61992. }
  61993. class MeridiemNames extends _xfa_object.XFAObject {
  61994. constructor(attributes) {
  61995. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  61996. this.meridiem = new _xfa_object.XFAObjectArray(2);
  61997. }
  61998. }
  61999. class Month extends _xfa_object.StringObject {
  62000. constructor(attributes) {
  62001. super(LOCALE_SET_NS_ID, "month");
  62002. }
  62003. }
  62004. class MonthNames extends _xfa_object.XFAObject {
  62005. constructor(attributes) {
  62006. super(LOCALE_SET_NS_ID, "monthNames", true);
  62007. this.abbr = (0, _utils.getInteger)({
  62008. data: attributes.abbr,
  62009. defaultValue: 0,
  62010. validate: x => x === 1
  62011. });
  62012. this.month = new _xfa_object.XFAObjectArray(12);
  62013. }
  62014. }
  62015. class NumberPattern extends _xfa_object.StringObject {
  62016. constructor(attributes) {
  62017. super(LOCALE_SET_NS_ID, "numberPattern");
  62018. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  62019. }
  62020. }
  62021. class NumberPatterns extends _xfa_object.XFAObject {
  62022. constructor(attributes) {
  62023. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  62024. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  62025. }
  62026. }
  62027. class NumberSymbol extends _xfa_object.StringObject {
  62028. constructor(attributes) {
  62029. super(LOCALE_SET_NS_ID, "numberSymbol");
  62030. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  62031. }
  62032. }
  62033. class NumberSymbols extends _xfa_object.XFAObject {
  62034. constructor(attributes) {
  62035. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  62036. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  62037. }
  62038. }
  62039. class TimePattern extends _xfa_object.StringObject {
  62040. constructor(attributes) {
  62041. super(LOCALE_SET_NS_ID, "timePattern");
  62042. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  62043. }
  62044. }
  62045. class TimePatterns extends _xfa_object.XFAObject {
  62046. constructor(attributes) {
  62047. super(LOCALE_SET_NS_ID, "timePatterns", true);
  62048. this.timePattern = new _xfa_object.XFAObjectArray(4);
  62049. }
  62050. }
  62051. class TypeFace extends _xfa_object.XFAObject {
  62052. constructor(attributes) {
  62053. super(LOCALE_SET_NS_ID, "typeFace", true);
  62054. this.name = attributes.name | "";
  62055. }
  62056. }
  62057. class TypeFaces extends _xfa_object.XFAObject {
  62058. constructor(attributes) {
  62059. super(LOCALE_SET_NS_ID, "typeFaces", true);
  62060. this.typeFace = new _xfa_object.XFAObjectArray();
  62061. }
  62062. }
  62063. class LocaleSetNamespace {
  62064. static [_namespaces.$buildXFAObject](name, attributes) {
  62065. if (LocaleSetNamespace.hasOwnProperty(name)) {
  62066. return LocaleSetNamespace[name](attributes);
  62067. }
  62068. return undefined;
  62069. }
  62070. static calendarSymbols(attrs) {
  62071. return new CalendarSymbols(attrs);
  62072. }
  62073. static currencySymbol(attrs) {
  62074. return new CurrencySymbol(attrs);
  62075. }
  62076. static currencySymbols(attrs) {
  62077. return new CurrencySymbols(attrs);
  62078. }
  62079. static datePattern(attrs) {
  62080. return new DatePattern(attrs);
  62081. }
  62082. static datePatterns(attrs) {
  62083. return new DatePatterns(attrs);
  62084. }
  62085. static dateTimeSymbols(attrs) {
  62086. return new DateTimeSymbols(attrs);
  62087. }
  62088. static day(attrs) {
  62089. return new Day(attrs);
  62090. }
  62091. static dayNames(attrs) {
  62092. return new DayNames(attrs);
  62093. }
  62094. static era(attrs) {
  62095. return new Era(attrs);
  62096. }
  62097. static eraNames(attrs) {
  62098. return new EraNames(attrs);
  62099. }
  62100. static locale(attrs) {
  62101. return new Locale(attrs);
  62102. }
  62103. static localeSet(attrs) {
  62104. return new LocaleSet(attrs);
  62105. }
  62106. static meridiem(attrs) {
  62107. return new Meridiem(attrs);
  62108. }
  62109. static meridiemNames(attrs) {
  62110. return new MeridiemNames(attrs);
  62111. }
  62112. static month(attrs) {
  62113. return new Month(attrs);
  62114. }
  62115. static monthNames(attrs) {
  62116. return new MonthNames(attrs);
  62117. }
  62118. static numberPattern(attrs) {
  62119. return new NumberPattern(attrs);
  62120. }
  62121. static numberPatterns(attrs) {
  62122. return new NumberPatterns(attrs);
  62123. }
  62124. static numberSymbol(attrs) {
  62125. return new NumberSymbol(attrs);
  62126. }
  62127. static numberSymbols(attrs) {
  62128. return new NumberSymbols(attrs);
  62129. }
  62130. static timePattern(attrs) {
  62131. return new TimePattern(attrs);
  62132. }
  62133. static timePatterns(attrs) {
  62134. return new TimePatterns(attrs);
  62135. }
  62136. static typeFace(attrs) {
  62137. return new TypeFace(attrs);
  62138. }
  62139. static typeFaces(attrs) {
  62140. return new TypeFaces(attrs);
  62141. }
  62142. }
  62143. exports.LocaleSetNamespace = LocaleSetNamespace;
  62144. /***/ }),
  62145. /* 93 */
  62146. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62147. Object.defineProperty(exports, "__esModule", ({
  62148. value: true
  62149. }));
  62150. exports.SignatureNamespace = void 0;
  62151. var _namespaces = __w_pdfjs_require__(77);
  62152. var _xfa_object = __w_pdfjs_require__(75);
  62153. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  62154. class Signature extends _xfa_object.XFAObject {
  62155. constructor(attributes) {
  62156. super(SIGNATURE_NS_ID, "signature", true);
  62157. }
  62158. }
  62159. class SignatureNamespace {
  62160. static [_namespaces.$buildXFAObject](name, attributes) {
  62161. if (SignatureNamespace.hasOwnProperty(name)) {
  62162. return SignatureNamespace[name](attributes);
  62163. }
  62164. return undefined;
  62165. }
  62166. static signature(attributes) {
  62167. return new Signature(attributes);
  62168. }
  62169. }
  62170. exports.SignatureNamespace = SignatureNamespace;
  62171. /***/ }),
  62172. /* 94 */
  62173. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62174. Object.defineProperty(exports, "__esModule", ({
  62175. value: true
  62176. }));
  62177. exports.StylesheetNamespace = void 0;
  62178. var _namespaces = __w_pdfjs_require__(77);
  62179. var _xfa_object = __w_pdfjs_require__(75);
  62180. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  62181. class Stylesheet extends _xfa_object.XFAObject {
  62182. constructor(attributes) {
  62183. super(STYLESHEET_NS_ID, "stylesheet", true);
  62184. }
  62185. }
  62186. class StylesheetNamespace {
  62187. static [_namespaces.$buildXFAObject](name, attributes) {
  62188. if (StylesheetNamespace.hasOwnProperty(name)) {
  62189. return StylesheetNamespace[name](attributes);
  62190. }
  62191. return undefined;
  62192. }
  62193. static stylesheet(attributes) {
  62194. return new Stylesheet(attributes);
  62195. }
  62196. }
  62197. exports.StylesheetNamespace = StylesheetNamespace;
  62198. /***/ }),
  62199. /* 95 */
  62200. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62201. Object.defineProperty(exports, "__esModule", ({
  62202. value: true
  62203. }));
  62204. exports.XdpNamespace = void 0;
  62205. var _namespaces = __w_pdfjs_require__(77);
  62206. var _xfa_object = __w_pdfjs_require__(75);
  62207. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  62208. class Xdp extends _xfa_object.XFAObject {
  62209. constructor(attributes) {
  62210. super(XDP_NS_ID, "xdp", true);
  62211. this.uuid = attributes.uuid || "";
  62212. this.timeStamp = attributes.timeStamp || "";
  62213. this.config = null;
  62214. this.connectionSet = null;
  62215. this.datasets = null;
  62216. this.localeSet = null;
  62217. this.stylesheet = new _xfa_object.XFAObjectArray();
  62218. this.template = null;
  62219. }
  62220. [_xfa_object.$onChildCheck](child) {
  62221. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  62222. return ns && child[_xfa_object.$namespaceId] === ns.id;
  62223. }
  62224. }
  62225. class XdpNamespace {
  62226. static [_namespaces.$buildXFAObject](name, attributes) {
  62227. if (XdpNamespace.hasOwnProperty(name)) {
  62228. return XdpNamespace[name](attributes);
  62229. }
  62230. return undefined;
  62231. }
  62232. static xdp(attributes) {
  62233. return new Xdp(attributes);
  62234. }
  62235. }
  62236. exports.XdpNamespace = XdpNamespace;
  62237. /***/ }),
  62238. /* 96 */
  62239. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62240. Object.defineProperty(exports, "__esModule", ({
  62241. value: true
  62242. }));
  62243. exports.XhtmlNamespace = void 0;
  62244. var _xfa_object = __w_pdfjs_require__(75);
  62245. var _namespaces = __w_pdfjs_require__(77);
  62246. var _html_utils = __w_pdfjs_require__(82);
  62247. var _utils = __w_pdfjs_require__(76);
  62248. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  62249. const $richText = Symbol();
  62250. 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"]);
  62251. 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) => {
  62252. value = original.fontSize = (0, _utils.getMeasurement)(value);
  62253. return (0, _html_utils.measureToString)(0.99 * value);
  62254. }], ["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))]]);
  62255. const spacesRegExp = /\s+/g;
  62256. const crlfRegExp = /[\r\n]+/g;
  62257. const crlfForRichTextRegExp = /\r\n?/g;
  62258. function mapStyle(styleStr, node, richText) {
  62259. const style = Object.create(null);
  62260. if (!styleStr) {
  62261. return style;
  62262. }
  62263. const original = Object.create(null);
  62264. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  62265. const mapping = StyleMapping.get(key);
  62266. if (mapping === "") {
  62267. continue;
  62268. }
  62269. let newValue = value;
  62270. if (mapping) {
  62271. if (typeof mapping === "string") {
  62272. newValue = mapping;
  62273. } else {
  62274. newValue = mapping(value, original);
  62275. }
  62276. }
  62277. if (key.endsWith("scale")) {
  62278. if (style.transform) {
  62279. style.transform = `${style[key]} ${newValue}`;
  62280. } else {
  62281. style.transform = newValue;
  62282. }
  62283. } else {
  62284. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  62285. }
  62286. }
  62287. if (style.fontFamily) {
  62288. (0, _html_utils.setFontFamily)({
  62289. typeface: style.fontFamily,
  62290. weight: style.fontWeight || "normal",
  62291. posture: style.fontStyle || "normal",
  62292. size: original.fontSize || 0
  62293. }, node, node[_xfa_object.$globalData].fontFinder, style);
  62294. }
  62295. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  62296. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  62297. const VERTICAL_FACTOR = 0.333;
  62298. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  62299. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  62300. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  62301. }
  62302. if (richText && style.fontSize) {
  62303. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  62304. }
  62305. (0, _html_utils.fixTextIndent)(style);
  62306. return style;
  62307. }
  62308. function checkStyle(node) {
  62309. if (!node.style) {
  62310. return "";
  62311. }
  62312. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  62313. if (key === "font-family") {
  62314. node[_xfa_object.$globalData].usedTypefaces.add(value);
  62315. }
  62316. return VALID_STYLES.has(key);
  62317. }).map(kv => kv.join(":")).join(";");
  62318. }
  62319. const NoWhites = new Set(["body", "html"]);
  62320. class XhtmlObject extends _xfa_object.XmlObject {
  62321. constructor(attributes, name) {
  62322. super(XHTML_NS_ID, name);
  62323. this[$richText] = false;
  62324. this.style = attributes.style || "";
  62325. }
  62326. [_xfa_object.$clean](builder) {
  62327. super[_xfa_object.$clean](builder);
  62328. this.style = checkStyle(this);
  62329. }
  62330. [_xfa_object.$acceptWhitespace]() {
  62331. return !NoWhites.has(this[_xfa_object.$nodeName]);
  62332. }
  62333. [_xfa_object.$onText](str, richText = false) {
  62334. if (!richText) {
  62335. str = str.replace(crlfRegExp, "");
  62336. if (!this.style.includes("xfa-spacerun:yes")) {
  62337. str = str.replace(spacesRegExp, " ");
  62338. }
  62339. } else {
  62340. this[$richText] = true;
  62341. }
  62342. if (str) {
  62343. this[_xfa_object.$content] += str;
  62344. }
  62345. }
  62346. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  62347. const xfaFont = Object.create(null);
  62348. const margin = {
  62349. top: NaN,
  62350. bottom: NaN,
  62351. left: NaN,
  62352. right: NaN
  62353. };
  62354. let lineHeight = null;
  62355. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  62356. switch (key) {
  62357. case "font-family":
  62358. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  62359. break;
  62360. case "font-size":
  62361. xfaFont.size = (0, _utils.getMeasurement)(value);
  62362. break;
  62363. case "font-weight":
  62364. xfaFont.weight = value;
  62365. break;
  62366. case "font-style":
  62367. xfaFont.posture = value;
  62368. break;
  62369. case "letter-spacing":
  62370. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  62371. break;
  62372. case "margin":
  62373. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  62374. switch (values.length) {
  62375. case 1:
  62376. margin.top = margin.bottom = margin.left = margin.right = values[0];
  62377. break;
  62378. case 2:
  62379. margin.top = margin.bottom = values[0];
  62380. margin.left = margin.right = values[1];
  62381. break;
  62382. case 3:
  62383. margin.top = values[0];
  62384. margin.bottom = values[2];
  62385. margin.left = margin.right = values[1];
  62386. break;
  62387. case 4:
  62388. margin.top = values[0];
  62389. margin.left = values[1];
  62390. margin.bottom = values[2];
  62391. margin.right = values[3];
  62392. break;
  62393. }
  62394. break;
  62395. case "margin-top":
  62396. margin.top = (0, _utils.getMeasurement)(value);
  62397. break;
  62398. case "margin-bottom":
  62399. margin.bottom = (0, _utils.getMeasurement)(value);
  62400. break;
  62401. case "margin-left":
  62402. margin.left = (0, _utils.getMeasurement)(value);
  62403. break;
  62404. case "margin-right":
  62405. margin.right = (0, _utils.getMeasurement)(value);
  62406. break;
  62407. case "line-height":
  62408. lineHeight = (0, _utils.getMeasurement)(value);
  62409. break;
  62410. }
  62411. }
  62412. measure.pushData(xfaFont, margin, lineHeight);
  62413. if (this[_xfa_object.$content]) {
  62414. measure.addString(this[_xfa_object.$content]);
  62415. } else {
  62416. for (const child of this[_xfa_object.$getChildren]()) {
  62417. if (child[_xfa_object.$nodeName] === "#text") {
  62418. measure.addString(child[_xfa_object.$content]);
  62419. continue;
  62420. }
  62421. child[_xfa_object.$pushGlyphs](measure);
  62422. }
  62423. }
  62424. if (mustPop) {
  62425. measure.popFont();
  62426. }
  62427. }
  62428. [_xfa_object.$toHTML](availableSpace) {
  62429. const children = [];
  62430. this[_xfa_object.$extra] = {
  62431. children
  62432. };
  62433. this[_xfa_object.$childrenToHTML]({});
  62434. if (children.length === 0 && !this[_xfa_object.$content]) {
  62435. return _utils.HTMLResult.EMPTY;
  62436. }
  62437. let value;
  62438. if (this[$richText]) {
  62439. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  62440. } else {
  62441. value = this[_xfa_object.$content] || undefined;
  62442. }
  62443. return _utils.HTMLResult.success({
  62444. name: this[_xfa_object.$nodeName],
  62445. attributes: {
  62446. href: this.href,
  62447. style: mapStyle(this.style, this, this[$richText])
  62448. },
  62449. children,
  62450. value
  62451. });
  62452. }
  62453. }
  62454. class A extends XhtmlObject {
  62455. constructor(attributes) {
  62456. super(attributes, "a");
  62457. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  62458. }
  62459. }
  62460. class B extends XhtmlObject {
  62461. constructor(attributes) {
  62462. super(attributes, "b");
  62463. }
  62464. [_xfa_object.$pushGlyphs](measure) {
  62465. measure.pushFont({
  62466. weight: "bold"
  62467. });
  62468. super[_xfa_object.$pushGlyphs](measure);
  62469. measure.popFont();
  62470. }
  62471. }
  62472. class Body extends XhtmlObject {
  62473. constructor(attributes) {
  62474. super(attributes, "body");
  62475. }
  62476. [_xfa_object.$toHTML](availableSpace) {
  62477. const res = super[_xfa_object.$toHTML](availableSpace);
  62478. const {
  62479. html
  62480. } = res;
  62481. if (!html) {
  62482. return _utils.HTMLResult.EMPTY;
  62483. }
  62484. html.name = "div";
  62485. html.attributes.class = ["xfaRich"];
  62486. return res;
  62487. }
  62488. }
  62489. class Br extends XhtmlObject {
  62490. constructor(attributes) {
  62491. super(attributes, "br");
  62492. }
  62493. [_xfa_object.$text]() {
  62494. return "\n";
  62495. }
  62496. [_xfa_object.$pushGlyphs](measure) {
  62497. measure.addString("\n");
  62498. }
  62499. [_xfa_object.$toHTML](availableSpace) {
  62500. return _utils.HTMLResult.success({
  62501. name: "br"
  62502. });
  62503. }
  62504. }
  62505. class Html extends XhtmlObject {
  62506. constructor(attributes) {
  62507. super(attributes, "html");
  62508. }
  62509. [_xfa_object.$toHTML](availableSpace) {
  62510. const children = [];
  62511. this[_xfa_object.$extra] = {
  62512. children
  62513. };
  62514. this[_xfa_object.$childrenToHTML]({});
  62515. if (children.length === 0) {
  62516. return _utils.HTMLResult.success({
  62517. name: "div",
  62518. attributes: {
  62519. class: ["xfaRich"],
  62520. style: {}
  62521. },
  62522. value: this[_xfa_object.$content] || ""
  62523. });
  62524. }
  62525. if (children.length === 1) {
  62526. const child = children[0];
  62527. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  62528. return _utils.HTMLResult.success(child);
  62529. }
  62530. }
  62531. return _utils.HTMLResult.success({
  62532. name: "div",
  62533. attributes: {
  62534. class: ["xfaRich"],
  62535. style: {}
  62536. },
  62537. children
  62538. });
  62539. }
  62540. }
  62541. class I extends XhtmlObject {
  62542. constructor(attributes) {
  62543. super(attributes, "i");
  62544. }
  62545. [_xfa_object.$pushGlyphs](measure) {
  62546. measure.pushFont({
  62547. posture: "italic"
  62548. });
  62549. super[_xfa_object.$pushGlyphs](measure);
  62550. measure.popFont();
  62551. }
  62552. }
  62553. class Li extends XhtmlObject {
  62554. constructor(attributes) {
  62555. super(attributes, "li");
  62556. }
  62557. }
  62558. class Ol extends XhtmlObject {
  62559. constructor(attributes) {
  62560. super(attributes, "ol");
  62561. }
  62562. }
  62563. class P extends XhtmlObject {
  62564. constructor(attributes) {
  62565. super(attributes, "p");
  62566. }
  62567. [_xfa_object.$pushGlyphs](measure) {
  62568. super[_xfa_object.$pushGlyphs](measure, false);
  62569. measure.addString("\n");
  62570. measure.addPara();
  62571. measure.popFont();
  62572. }
  62573. [_xfa_object.$text]() {
  62574. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  62575. if (siblings.at(-1) === this) {
  62576. return super[_xfa_object.$text]();
  62577. }
  62578. return super[_xfa_object.$text]() + "\n";
  62579. }
  62580. }
  62581. class Span extends XhtmlObject {
  62582. constructor(attributes) {
  62583. super(attributes, "span");
  62584. }
  62585. }
  62586. class Sub extends XhtmlObject {
  62587. constructor(attributes) {
  62588. super(attributes, "sub");
  62589. }
  62590. }
  62591. class Sup extends XhtmlObject {
  62592. constructor(attributes) {
  62593. super(attributes, "sup");
  62594. }
  62595. }
  62596. class Ul extends XhtmlObject {
  62597. constructor(attributes) {
  62598. super(attributes, "ul");
  62599. }
  62600. }
  62601. class XhtmlNamespace {
  62602. static [_namespaces.$buildXFAObject](name, attributes) {
  62603. if (XhtmlNamespace.hasOwnProperty(name)) {
  62604. return XhtmlNamespace[name](attributes);
  62605. }
  62606. return undefined;
  62607. }
  62608. static a(attributes) {
  62609. return new A(attributes);
  62610. }
  62611. static b(attributes) {
  62612. return new B(attributes);
  62613. }
  62614. static body(attributes) {
  62615. return new Body(attributes);
  62616. }
  62617. static br(attributes) {
  62618. return new Br(attributes);
  62619. }
  62620. static html(attributes) {
  62621. return new Html(attributes);
  62622. }
  62623. static i(attributes) {
  62624. return new I(attributes);
  62625. }
  62626. static li(attributes) {
  62627. return new Li(attributes);
  62628. }
  62629. static ol(attributes) {
  62630. return new Ol(attributes);
  62631. }
  62632. static p(attributes) {
  62633. return new P(attributes);
  62634. }
  62635. static span(attributes) {
  62636. return new Span(attributes);
  62637. }
  62638. static sub(attributes) {
  62639. return new Sub(attributes);
  62640. }
  62641. static sup(attributes) {
  62642. return new Sup(attributes);
  62643. }
  62644. static ul(attributes) {
  62645. return new Ul(attributes);
  62646. }
  62647. }
  62648. exports.XhtmlNamespace = XhtmlNamespace;
  62649. /***/ }),
  62650. /* 97 */
  62651. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62652. Object.defineProperty(exports, "__esModule", ({
  62653. value: true
  62654. }));
  62655. exports.UnknownNamespace = void 0;
  62656. var _namespaces = __w_pdfjs_require__(77);
  62657. var _xfa_object = __w_pdfjs_require__(75);
  62658. class UnknownNamespace {
  62659. constructor(nsId) {
  62660. this.namespaceId = nsId;
  62661. }
  62662. [_namespaces.$buildXFAObject](name, attributes) {
  62663. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  62664. }
  62665. }
  62666. exports.UnknownNamespace = UnknownNamespace;
  62667. /***/ }),
  62668. /* 98 */
  62669. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62670. Object.defineProperty(exports, "__esModule", ({
  62671. value: true
  62672. }));
  62673. exports.DatasetReader = void 0;
  62674. var _util = __w_pdfjs_require__(2);
  62675. var _core_utils = __w_pdfjs_require__(4);
  62676. var _xml_parser = __w_pdfjs_require__(64);
  62677. function decodeString(str) {
  62678. try {
  62679. return (0, _util.stringToUTF8String)(str);
  62680. } catch (ex) {
  62681. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  62682. return str;
  62683. }
  62684. }
  62685. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  62686. constructor(options) {
  62687. super(options);
  62688. this.node = null;
  62689. }
  62690. onEndElement(name) {
  62691. const node = super.onEndElement(name);
  62692. if (node && name === "xfa:datasets") {
  62693. this.node = node;
  62694. throw new Error("Aborting DatasetXMLParser.");
  62695. }
  62696. }
  62697. }
  62698. class DatasetReader {
  62699. constructor(data) {
  62700. if (data.datasets) {
  62701. this.node = new _xml_parser.SimpleXMLParser({
  62702. hasAttributes: true
  62703. }).parseFromString(data.datasets).documentElement;
  62704. } else {
  62705. const parser = new DatasetXMLParser({
  62706. hasAttributes: true
  62707. });
  62708. try {
  62709. parser.parseFromString(data["xdp:xdp"]);
  62710. } catch (_) {}
  62711. this.node = parser.node;
  62712. }
  62713. }
  62714. getValue(path) {
  62715. if (!this.node || !path) {
  62716. return "";
  62717. }
  62718. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  62719. if (!node) {
  62720. return "";
  62721. }
  62722. const first = node.firstChild;
  62723. if (first && first.nodeName === "value") {
  62724. return node.children.map(child => decodeString(child.textContent));
  62725. }
  62726. return decodeString(node.textContent);
  62727. }
  62728. }
  62729. exports.DatasetReader = DatasetReader;
  62730. /***/ }),
  62731. /* 99 */
  62732. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62733. Object.defineProperty(exports, "__esModule", ({
  62734. value: true
  62735. }));
  62736. exports.XRef = void 0;
  62737. var _util = __w_pdfjs_require__(2);
  62738. var _primitives = __w_pdfjs_require__(3);
  62739. var _parser = __w_pdfjs_require__(15);
  62740. var _core_utils = __w_pdfjs_require__(4);
  62741. var _base_stream = __w_pdfjs_require__(5);
  62742. var _crypto = __w_pdfjs_require__(65);
  62743. class XRef {
  62744. constructor(stream, pdfManager) {
  62745. this.stream = stream;
  62746. this.pdfManager = pdfManager;
  62747. this.entries = [];
  62748. this.xrefstms = Object.create(null);
  62749. this._cacheMap = new Map();
  62750. this._pendingRefs = new _primitives.RefSet();
  62751. this._newPersistentRefNum = null;
  62752. this._newTemporaryRefNum = null;
  62753. }
  62754. getNewPersistentRef(obj) {
  62755. if (this._newPersistentRefNum === null) {
  62756. this._newPersistentRefNum = this.entries.length || 1;
  62757. }
  62758. const num = this._newPersistentRefNum++;
  62759. this._cacheMap.set(num, obj);
  62760. return _primitives.Ref.get(num, 0);
  62761. }
  62762. getNewTemporaryRef() {
  62763. if (this._newTemporaryRefNum === null) {
  62764. this._newTemporaryRefNum = this.entries.length || 1;
  62765. }
  62766. return _primitives.Ref.get(this._newTemporaryRefNum++, 0);
  62767. }
  62768. resetNewTemporaryRef() {
  62769. this._newTemporaryRefNum = null;
  62770. }
  62771. setStartXRef(startXRef) {
  62772. this.startXRefQueue = [startXRef];
  62773. }
  62774. parse(recoveryMode = false) {
  62775. let trailerDict;
  62776. if (!recoveryMode) {
  62777. trailerDict = this.readXRef();
  62778. } else {
  62779. (0, _util.warn)("Indexing all PDF objects");
  62780. trailerDict = this.indexObjects();
  62781. }
  62782. trailerDict.assignXref(this);
  62783. this.trailer = trailerDict;
  62784. let encrypt;
  62785. try {
  62786. encrypt = trailerDict.get("Encrypt");
  62787. } catch (ex) {
  62788. if (ex instanceof _core_utils.MissingDataException) {
  62789. throw ex;
  62790. }
  62791. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  62792. }
  62793. if (encrypt instanceof _primitives.Dict) {
  62794. const ids = trailerDict.get("ID");
  62795. const fileId = ids && ids.length ? ids[0] : "";
  62796. encrypt.suppressEncryption = true;
  62797. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  62798. }
  62799. let root;
  62800. try {
  62801. root = trailerDict.get("Root");
  62802. } catch (ex) {
  62803. if (ex instanceof _core_utils.MissingDataException) {
  62804. throw ex;
  62805. }
  62806. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  62807. }
  62808. if (root instanceof _primitives.Dict) {
  62809. try {
  62810. const pages = root.get("Pages");
  62811. if (pages instanceof _primitives.Dict) {
  62812. this.root = root;
  62813. return;
  62814. }
  62815. } catch (ex) {
  62816. if (ex instanceof _core_utils.MissingDataException) {
  62817. throw ex;
  62818. }
  62819. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  62820. }
  62821. }
  62822. if (!recoveryMode) {
  62823. throw new _core_utils.XRefParseException();
  62824. }
  62825. throw new _util.InvalidPDFException("Invalid Root reference.");
  62826. }
  62827. processXRefTable(parser) {
  62828. if (!("tableState" in this)) {
  62829. this.tableState = {
  62830. entryNum: 0,
  62831. streamPos: parser.lexer.stream.pos,
  62832. parserBuf1: parser.buf1,
  62833. parserBuf2: parser.buf2
  62834. };
  62835. }
  62836. const obj = this.readXRefTable(parser);
  62837. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62838. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  62839. }
  62840. let dict = parser.getObj();
  62841. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  62842. dict = dict.dict;
  62843. }
  62844. if (!(dict instanceof _primitives.Dict)) {
  62845. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  62846. }
  62847. delete this.tableState;
  62848. return dict;
  62849. }
  62850. readXRefTable(parser) {
  62851. const stream = parser.lexer.stream;
  62852. const tableState = this.tableState;
  62853. stream.pos = tableState.streamPos;
  62854. parser.buf1 = tableState.parserBuf1;
  62855. parser.buf2 = tableState.parserBuf2;
  62856. let obj;
  62857. while (true) {
  62858. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  62859. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  62860. break;
  62861. }
  62862. tableState.firstEntryNum = obj;
  62863. tableState.entryCount = parser.getObj();
  62864. }
  62865. let first = tableState.firstEntryNum;
  62866. const count = tableState.entryCount;
  62867. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  62868. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  62869. }
  62870. for (let i = tableState.entryNum; i < count; i++) {
  62871. tableState.streamPos = stream.pos;
  62872. tableState.entryNum = i;
  62873. tableState.parserBuf1 = parser.buf1;
  62874. tableState.parserBuf2 = parser.buf2;
  62875. const entry = {};
  62876. entry.offset = parser.getObj();
  62877. entry.gen = parser.getObj();
  62878. const type = parser.getObj();
  62879. if (type instanceof _primitives.Cmd) {
  62880. switch (type.cmd) {
  62881. case "f":
  62882. entry.free = true;
  62883. break;
  62884. case "n":
  62885. entry.uncompressed = true;
  62886. break;
  62887. }
  62888. }
  62889. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  62890. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  62891. }
  62892. if (i === 0 && entry.free && first === 1) {
  62893. first = 0;
  62894. }
  62895. if (!this.entries[i + first]) {
  62896. this.entries[i + first] = entry;
  62897. }
  62898. }
  62899. tableState.entryNum = 0;
  62900. tableState.streamPos = stream.pos;
  62901. tableState.parserBuf1 = parser.buf1;
  62902. tableState.parserBuf2 = parser.buf2;
  62903. delete tableState.firstEntryNum;
  62904. delete tableState.entryCount;
  62905. }
  62906. if (this.entries[0] && !this.entries[0].free) {
  62907. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  62908. }
  62909. return obj;
  62910. }
  62911. processXRefStream(stream) {
  62912. if (!("streamState" in this)) {
  62913. const streamParameters = stream.dict;
  62914. const byteWidths = streamParameters.get("W");
  62915. let range = streamParameters.get("Index");
  62916. if (!range) {
  62917. range = [0, streamParameters.get("Size")];
  62918. }
  62919. this.streamState = {
  62920. entryRanges: range,
  62921. byteWidths,
  62922. entryNum: 0,
  62923. streamPos: stream.pos
  62924. };
  62925. }
  62926. this.readXRefStream(stream);
  62927. delete this.streamState;
  62928. return stream.dict;
  62929. }
  62930. readXRefStream(stream) {
  62931. const streamState = this.streamState;
  62932. stream.pos = streamState.streamPos;
  62933. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  62934. const entryRanges = streamState.entryRanges;
  62935. while (entryRanges.length > 0) {
  62936. const [first, n] = entryRanges;
  62937. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62938. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  62939. }
  62940. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  62941. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  62942. }
  62943. for (let i = streamState.entryNum; i < n; ++i) {
  62944. streamState.entryNum = i;
  62945. streamState.streamPos = stream.pos;
  62946. let type = 0,
  62947. offset = 0,
  62948. generation = 0;
  62949. for (let j = 0; j < typeFieldWidth; ++j) {
  62950. const typeByte = stream.getByte();
  62951. if (typeByte === -1) {
  62952. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  62953. }
  62954. type = type << 8 | typeByte;
  62955. }
  62956. if (typeFieldWidth === 0) {
  62957. type = 1;
  62958. }
  62959. for (let j = 0; j < offsetFieldWidth; ++j) {
  62960. const offsetByte = stream.getByte();
  62961. if (offsetByte === -1) {
  62962. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  62963. }
  62964. offset = offset << 8 | offsetByte;
  62965. }
  62966. for (let j = 0; j < generationFieldWidth; ++j) {
  62967. const generationByte = stream.getByte();
  62968. if (generationByte === -1) {
  62969. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  62970. }
  62971. generation = generation << 8 | generationByte;
  62972. }
  62973. const entry = {};
  62974. entry.offset = offset;
  62975. entry.gen = generation;
  62976. switch (type) {
  62977. case 0:
  62978. entry.free = true;
  62979. break;
  62980. case 1:
  62981. entry.uncompressed = true;
  62982. break;
  62983. case 2:
  62984. break;
  62985. default:
  62986. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  62987. }
  62988. if (!this.entries[first + i]) {
  62989. this.entries[first + i] = entry;
  62990. }
  62991. }
  62992. streamState.entryNum = 0;
  62993. streamState.streamPos = stream.pos;
  62994. entryRanges.splice(0, 2);
  62995. }
  62996. }
  62997. indexObjects() {
  62998. const TAB = 0x9,
  62999. LF = 0xa,
  63000. CR = 0xd,
  63001. SPACE = 0x20;
  63002. const PERCENT = 0x25,
  63003. LT = 0x3c;
  63004. function readToken(data, offset) {
  63005. let token = "",
  63006. ch = data[offset];
  63007. while (ch !== LF && ch !== CR && ch !== LT) {
  63008. if (++offset >= data.length) {
  63009. break;
  63010. }
  63011. token += String.fromCharCode(ch);
  63012. ch = data[offset];
  63013. }
  63014. return token;
  63015. }
  63016. function skipUntil(data, offset, what) {
  63017. const length = what.length,
  63018. dataLength = data.length;
  63019. let skipped = 0;
  63020. while (offset < dataLength) {
  63021. let i = 0;
  63022. while (i < length && data[offset + i] === what[i]) {
  63023. ++i;
  63024. }
  63025. if (i >= length) {
  63026. break;
  63027. }
  63028. offset++;
  63029. skipped++;
  63030. }
  63031. return skipped;
  63032. }
  63033. const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer)\b/g;
  63034. const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
  63035. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  63036. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  63037. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  63038. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  63039. this.entries.length = 0;
  63040. this._cacheMap.clear();
  63041. const stream = this.stream;
  63042. stream.pos = 0;
  63043. const buffer = stream.getBytes(),
  63044. bufferStr = (0, _util.bytesToString)(buffer),
  63045. length = buffer.length;
  63046. let position = stream.start;
  63047. const trailers = [],
  63048. xrefStms = [];
  63049. while (position < length) {
  63050. let ch = buffer[position];
  63051. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  63052. ++position;
  63053. continue;
  63054. }
  63055. if (ch === PERCENT) {
  63056. do {
  63057. ++position;
  63058. if (position >= length) {
  63059. break;
  63060. }
  63061. ch = buffer[position];
  63062. } while (ch !== LF && ch !== CR);
  63063. continue;
  63064. }
  63065. const token = readToken(buffer, position);
  63066. let m;
  63067. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  63068. position += skipUntil(buffer, position, trailerBytes);
  63069. trailers.push(position);
  63070. position += skipUntil(buffer, position, startxrefBytes);
  63071. } else if (m = objRegExp.exec(token)) {
  63072. const num = m[1] | 0,
  63073. gen = m[2] | 0;
  63074. const startPos = position + token.length;
  63075. let contentLength,
  63076. updateEntries = false;
  63077. if (!this.entries[num]) {
  63078. updateEntries = true;
  63079. } else if (this.entries[num].gen === gen) {
  63080. try {
  63081. const parser = new _parser.Parser({
  63082. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  63083. });
  63084. parser.getObj();
  63085. updateEntries = true;
  63086. } catch (ex) {
  63087. if (ex instanceof _core_utils.ParserEOFException) {
  63088. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  63089. } else {
  63090. updateEntries = true;
  63091. }
  63092. }
  63093. }
  63094. if (updateEntries) {
  63095. this.entries[num] = {
  63096. offset: position - stream.start,
  63097. gen,
  63098. uncompressed: true
  63099. };
  63100. }
  63101. gEndobjRegExp.lastIndex = startPos;
  63102. const match = gEndobjRegExp.exec(bufferStr);
  63103. if (match) {
  63104. const endPos = gEndobjRegExp.lastIndex + 1;
  63105. contentLength = endPos - position;
  63106. if (match[1] !== "endobj") {
  63107. (0, _util.warn)(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
  63108. contentLength -= match[1].length + 1;
  63109. }
  63110. } else {
  63111. contentLength = length - position;
  63112. }
  63113. const content = buffer.subarray(position, position + contentLength);
  63114. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  63115. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  63116. xrefStms.push(position - stream.start);
  63117. this.xrefstms[position - stream.start] = 1;
  63118. }
  63119. position += contentLength;
  63120. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  63121. trailers.push(position);
  63122. const startPos = position + token.length;
  63123. let contentLength;
  63124. gStartxrefRegExp.lastIndex = startPos;
  63125. const match = gStartxrefRegExp.exec(bufferStr);
  63126. if (match) {
  63127. const endPos = gStartxrefRegExp.lastIndex + 1;
  63128. contentLength = endPos - position;
  63129. if (match[1] !== "startxref") {
  63130. (0, _util.warn)(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
  63131. contentLength -= match[1].length + 1;
  63132. }
  63133. } else {
  63134. contentLength = length - position;
  63135. }
  63136. position += contentLength;
  63137. } else {
  63138. position += token.length + 1;
  63139. }
  63140. }
  63141. for (const xrefStm of xrefStms) {
  63142. this.startXRefQueue.push(xrefStm);
  63143. this.readXRef(true);
  63144. }
  63145. const trailerDicts = [];
  63146. let isEncrypted = false;
  63147. for (const trailer of trailers) {
  63148. stream.pos = trailer;
  63149. const parser = new _parser.Parser({
  63150. lexer: new _parser.Lexer(stream),
  63151. xref: this,
  63152. allowStreams: true,
  63153. recoveryMode: true
  63154. });
  63155. const obj = parser.getObj();
  63156. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  63157. continue;
  63158. }
  63159. const dict = parser.getObj();
  63160. if (!(dict instanceof _primitives.Dict)) {
  63161. continue;
  63162. }
  63163. trailerDicts.push(dict);
  63164. if (dict.has("Encrypt")) {
  63165. isEncrypted = true;
  63166. }
  63167. }
  63168. let trailerDict, trailerError;
  63169. for (const dict of [...trailerDicts, "genFallback", ...trailerDicts]) {
  63170. if (dict === "genFallback") {
  63171. if (!trailerError) {
  63172. break;
  63173. }
  63174. this._generationFallback = true;
  63175. continue;
  63176. }
  63177. let validPagesDict = false;
  63178. try {
  63179. const rootDict = dict.get("Root");
  63180. if (!(rootDict instanceof _primitives.Dict)) {
  63181. continue;
  63182. }
  63183. const pagesDict = rootDict.get("Pages");
  63184. if (!(pagesDict instanceof _primitives.Dict)) {
  63185. continue;
  63186. }
  63187. const pagesCount = pagesDict.get("Count");
  63188. if (Number.isInteger(pagesCount)) {
  63189. validPagesDict = true;
  63190. }
  63191. } catch (ex) {
  63192. trailerError = ex;
  63193. continue;
  63194. }
  63195. if (validPagesDict && (!isEncrypted || dict.has("Encrypt")) && dict.has("ID")) {
  63196. return dict;
  63197. }
  63198. trailerDict = dict;
  63199. }
  63200. if (trailerDict) {
  63201. return trailerDict;
  63202. }
  63203. if (this.topDict) {
  63204. return this.topDict;
  63205. }
  63206. throw new _util.InvalidPDFException("Invalid PDF structure.");
  63207. }
  63208. readXRef(recoveryMode = false) {
  63209. const stream = this.stream;
  63210. const startXRefParsedCache = new Set();
  63211. while (this.startXRefQueue.length) {
  63212. try {
  63213. const startXRef = this.startXRefQueue[0];
  63214. if (startXRefParsedCache.has(startXRef)) {
  63215. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  63216. this.startXRefQueue.shift();
  63217. continue;
  63218. }
  63219. startXRefParsedCache.add(startXRef);
  63220. stream.pos = startXRef + stream.start;
  63221. const parser = new _parser.Parser({
  63222. lexer: new _parser.Lexer(stream),
  63223. xref: this,
  63224. allowStreams: true
  63225. });
  63226. let obj = parser.getObj();
  63227. let dict;
  63228. if ((0, _primitives.isCmd)(obj, "xref")) {
  63229. dict = this.processXRefTable(parser);
  63230. if (!this.topDict) {
  63231. this.topDict = dict;
  63232. }
  63233. obj = dict.get("XRefStm");
  63234. if (Number.isInteger(obj)) {
  63235. const pos = obj;
  63236. if (!(pos in this.xrefstms)) {
  63237. this.xrefstms[pos] = 1;
  63238. this.startXRefQueue.push(pos);
  63239. }
  63240. }
  63241. } else if (Number.isInteger(obj)) {
  63242. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  63243. throw new _util.FormatError("Invalid XRef stream");
  63244. }
  63245. dict = this.processXRefStream(obj);
  63246. if (!this.topDict) {
  63247. this.topDict = dict;
  63248. }
  63249. if (!dict) {
  63250. throw new _util.FormatError("Failed to read XRef stream");
  63251. }
  63252. } else {
  63253. throw new _util.FormatError("Invalid XRef stream header");
  63254. }
  63255. obj = dict.get("Prev");
  63256. if (Number.isInteger(obj)) {
  63257. this.startXRefQueue.push(obj);
  63258. } else if (obj instanceof _primitives.Ref) {
  63259. this.startXRefQueue.push(obj.num);
  63260. }
  63261. } catch (e) {
  63262. if (e instanceof _core_utils.MissingDataException) {
  63263. throw e;
  63264. }
  63265. (0, _util.info)("(while reading XRef): " + e);
  63266. }
  63267. this.startXRefQueue.shift();
  63268. }
  63269. if (this.topDict) {
  63270. return this.topDict;
  63271. }
  63272. if (recoveryMode) {
  63273. return undefined;
  63274. }
  63275. throw new _core_utils.XRefParseException();
  63276. }
  63277. getEntry(i) {
  63278. const xrefEntry = this.entries[i];
  63279. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  63280. return xrefEntry;
  63281. }
  63282. return null;
  63283. }
  63284. fetchIfRef(obj, suppressEncryption = false) {
  63285. if (obj instanceof _primitives.Ref) {
  63286. return this.fetch(obj, suppressEncryption);
  63287. }
  63288. return obj;
  63289. }
  63290. fetch(ref, suppressEncryption = false) {
  63291. if (!(ref instanceof _primitives.Ref)) {
  63292. throw new Error("ref object is not a reference");
  63293. }
  63294. const num = ref.num;
  63295. const cacheEntry = this._cacheMap.get(num);
  63296. if (cacheEntry !== undefined) {
  63297. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  63298. cacheEntry.objId = ref.toString();
  63299. }
  63300. return cacheEntry;
  63301. }
  63302. let xrefEntry = this.getEntry(num);
  63303. if (xrefEntry === null) {
  63304. this._cacheMap.set(num, xrefEntry);
  63305. return xrefEntry;
  63306. }
  63307. if (this._pendingRefs.has(ref)) {
  63308. this._pendingRefs.remove(ref);
  63309. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  63310. return _primitives.CIRCULAR_REF;
  63311. }
  63312. this._pendingRefs.put(ref);
  63313. try {
  63314. if (xrefEntry.uncompressed) {
  63315. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  63316. } else {
  63317. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  63318. }
  63319. this._pendingRefs.remove(ref);
  63320. } catch (ex) {
  63321. this._pendingRefs.remove(ref);
  63322. throw ex;
  63323. }
  63324. if (xrefEntry instanceof _primitives.Dict) {
  63325. xrefEntry.objId = ref.toString();
  63326. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  63327. xrefEntry.dict.objId = ref.toString();
  63328. }
  63329. return xrefEntry;
  63330. }
  63331. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  63332. const gen = ref.gen;
  63333. let num = ref.num;
  63334. if (xrefEntry.gen !== gen) {
  63335. const msg = `Inconsistent generation in XRef: ${ref}`;
  63336. if (this._generationFallback && xrefEntry.gen < gen) {
  63337. (0, _util.warn)(msg);
  63338. return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  63339. }
  63340. throw new _core_utils.XRefEntryException(msg);
  63341. }
  63342. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  63343. const parser = new _parser.Parser({
  63344. lexer: new _parser.Lexer(stream),
  63345. xref: this,
  63346. allowStreams: true
  63347. });
  63348. const obj1 = parser.getObj();
  63349. const obj2 = parser.getObj();
  63350. const obj3 = parser.getObj();
  63351. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  63352. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  63353. }
  63354. if (obj3.cmd !== "obj") {
  63355. if (obj3.cmd.startsWith("obj")) {
  63356. num = parseInt(obj3.cmd.substring(3), 10);
  63357. if (!Number.isNaN(num)) {
  63358. return num;
  63359. }
  63360. }
  63361. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  63362. }
  63363. if (this.encrypt && !suppressEncryption) {
  63364. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  63365. } else {
  63366. xrefEntry = parser.getObj();
  63367. }
  63368. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  63369. this._cacheMap.set(num, xrefEntry);
  63370. }
  63371. return xrefEntry;
  63372. }
  63373. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  63374. const tableOffset = xrefEntry.offset;
  63375. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  63376. if (!(stream instanceof _base_stream.BaseStream)) {
  63377. throw new _util.FormatError("bad ObjStm stream");
  63378. }
  63379. const first = stream.dict.get("First");
  63380. const n = stream.dict.get("N");
  63381. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  63382. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  63383. }
  63384. let parser = new _parser.Parser({
  63385. lexer: new _parser.Lexer(stream),
  63386. xref: this,
  63387. allowStreams: true
  63388. });
  63389. const nums = new Array(n);
  63390. const offsets = new Array(n);
  63391. for (let i = 0; i < n; ++i) {
  63392. const num = parser.getObj();
  63393. if (!Number.isInteger(num)) {
  63394. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  63395. }
  63396. const offset = parser.getObj();
  63397. if (!Number.isInteger(offset)) {
  63398. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  63399. }
  63400. nums[i] = num;
  63401. offsets[i] = offset;
  63402. }
  63403. const start = (stream.start || 0) + first;
  63404. const entries = new Array(n);
  63405. for (let i = 0; i < n; ++i) {
  63406. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  63407. if (length < 0) {
  63408. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  63409. }
  63410. parser = new _parser.Parser({
  63411. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  63412. xref: this,
  63413. allowStreams: true
  63414. });
  63415. const obj = parser.getObj();
  63416. entries[i] = obj;
  63417. if (obj instanceof _base_stream.BaseStream) {
  63418. continue;
  63419. }
  63420. const num = nums[i],
  63421. entry = this.entries[num];
  63422. if (entry && entry.offset === tableOffset && entry.gen === i) {
  63423. this._cacheMap.set(num, obj);
  63424. }
  63425. }
  63426. xrefEntry = entries[xrefEntry.gen];
  63427. if (xrefEntry === undefined) {
  63428. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  63429. }
  63430. return xrefEntry;
  63431. }
  63432. async fetchIfRefAsync(obj, suppressEncryption) {
  63433. if (obj instanceof _primitives.Ref) {
  63434. return this.fetchAsync(obj, suppressEncryption);
  63435. }
  63436. return obj;
  63437. }
  63438. async fetchAsync(ref, suppressEncryption) {
  63439. try {
  63440. return this.fetch(ref, suppressEncryption);
  63441. } catch (ex) {
  63442. if (!(ex instanceof _core_utils.MissingDataException)) {
  63443. throw ex;
  63444. }
  63445. await this.pdfManager.requestRange(ex.begin, ex.end);
  63446. return this.fetchAsync(ref, suppressEncryption);
  63447. }
  63448. }
  63449. getCatalogObj() {
  63450. return this.root;
  63451. }
  63452. }
  63453. exports.XRef = XRef;
  63454. /***/ }),
  63455. /* 100 */
  63456. /***/ ((__unused_webpack_module, exports) => {
  63457. Object.defineProperty(exports, "__esModule", ({
  63458. value: true
  63459. }));
  63460. exports.isNodeJS = void 0;
  63461. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  63462. exports.isNodeJS = isNodeJS;
  63463. /***/ }),
  63464. /* 101 */
  63465. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63466. Object.defineProperty(exports, "__esModule", ({
  63467. value: true
  63468. }));
  63469. exports.MessageHandler = void 0;
  63470. var _util = __w_pdfjs_require__(2);
  63471. const CallbackKind = {
  63472. UNKNOWN: 0,
  63473. DATA: 1,
  63474. ERROR: 2
  63475. };
  63476. const StreamKind = {
  63477. UNKNOWN: 0,
  63478. CANCEL: 1,
  63479. CANCEL_COMPLETE: 2,
  63480. CLOSE: 3,
  63481. ENQUEUE: 4,
  63482. ERROR: 5,
  63483. PULL: 6,
  63484. PULL_COMPLETE: 7,
  63485. START_COMPLETE: 8
  63486. };
  63487. function wrapReason(reason) {
  63488. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  63489. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  63490. }
  63491. switch (reason.name) {
  63492. case "AbortException":
  63493. return new _util.AbortException(reason.message);
  63494. case "MissingPDFException":
  63495. return new _util.MissingPDFException(reason.message);
  63496. case "PasswordException":
  63497. return new _util.PasswordException(reason.message, reason.code);
  63498. case "UnexpectedResponseException":
  63499. return new _util.UnexpectedResponseException(reason.message, reason.status);
  63500. case "UnknownErrorException":
  63501. return new _util.UnknownErrorException(reason.message, reason.details);
  63502. default:
  63503. return new _util.UnknownErrorException(reason.message, reason.toString());
  63504. }
  63505. }
  63506. class MessageHandler {
  63507. constructor(sourceName, targetName, comObj) {
  63508. this.sourceName = sourceName;
  63509. this.targetName = targetName;
  63510. this.comObj = comObj;
  63511. this.callbackId = 1;
  63512. this.streamId = 1;
  63513. this.streamSinks = Object.create(null);
  63514. this.streamControllers = Object.create(null);
  63515. this.callbackCapabilities = Object.create(null);
  63516. this.actionHandler = Object.create(null);
  63517. this._onComObjOnMessage = event => {
  63518. const data = event.data;
  63519. if (data.targetName !== this.sourceName) {
  63520. return;
  63521. }
  63522. if (data.stream) {
  63523. this._processStreamMessage(data);
  63524. return;
  63525. }
  63526. if (data.callback) {
  63527. const callbackId = data.callbackId;
  63528. const capability = this.callbackCapabilities[callbackId];
  63529. if (!capability) {
  63530. throw new Error(`Cannot resolve callback ${callbackId}`);
  63531. }
  63532. delete this.callbackCapabilities[callbackId];
  63533. if (data.callback === CallbackKind.DATA) {
  63534. capability.resolve(data.data);
  63535. } else if (data.callback === CallbackKind.ERROR) {
  63536. capability.reject(wrapReason(data.reason));
  63537. } else {
  63538. throw new Error("Unexpected callback case");
  63539. }
  63540. return;
  63541. }
  63542. const action = this.actionHandler[data.action];
  63543. if (!action) {
  63544. throw new Error(`Unknown action from worker: ${data.action}`);
  63545. }
  63546. if (data.callbackId) {
  63547. const cbSourceName = this.sourceName;
  63548. const cbTargetName = data.sourceName;
  63549. new Promise(function (resolve) {
  63550. resolve(action(data.data));
  63551. }).then(function (result) {
  63552. comObj.postMessage({
  63553. sourceName: cbSourceName,
  63554. targetName: cbTargetName,
  63555. callback: CallbackKind.DATA,
  63556. callbackId: data.callbackId,
  63557. data: result
  63558. });
  63559. }, function (reason) {
  63560. comObj.postMessage({
  63561. sourceName: cbSourceName,
  63562. targetName: cbTargetName,
  63563. callback: CallbackKind.ERROR,
  63564. callbackId: data.callbackId,
  63565. reason: wrapReason(reason)
  63566. });
  63567. });
  63568. return;
  63569. }
  63570. if (data.streamId) {
  63571. this._createStreamSink(data);
  63572. return;
  63573. }
  63574. action(data.data);
  63575. };
  63576. comObj.addEventListener("message", this._onComObjOnMessage);
  63577. }
  63578. on(actionName, handler) {
  63579. const ah = this.actionHandler;
  63580. if (ah[actionName]) {
  63581. throw new Error(`There is already an actionName called "${actionName}"`);
  63582. }
  63583. ah[actionName] = handler;
  63584. }
  63585. send(actionName, data, transfers) {
  63586. this.comObj.postMessage({
  63587. sourceName: this.sourceName,
  63588. targetName: this.targetName,
  63589. action: actionName,
  63590. data
  63591. }, transfers);
  63592. }
  63593. sendWithPromise(actionName, data, transfers) {
  63594. const callbackId = this.callbackId++;
  63595. const capability = (0, _util.createPromiseCapability)();
  63596. this.callbackCapabilities[callbackId] = capability;
  63597. try {
  63598. this.comObj.postMessage({
  63599. sourceName: this.sourceName,
  63600. targetName: this.targetName,
  63601. action: actionName,
  63602. callbackId,
  63603. data
  63604. }, transfers);
  63605. } catch (ex) {
  63606. capability.reject(ex);
  63607. }
  63608. return capability.promise;
  63609. }
  63610. sendWithStream(actionName, data, queueingStrategy, transfers) {
  63611. const streamId = this.streamId++,
  63612. sourceName = this.sourceName,
  63613. targetName = this.targetName,
  63614. comObj = this.comObj;
  63615. return new ReadableStream({
  63616. start: controller => {
  63617. const startCapability = (0, _util.createPromiseCapability)();
  63618. this.streamControllers[streamId] = {
  63619. controller,
  63620. startCall: startCapability,
  63621. pullCall: null,
  63622. cancelCall: null,
  63623. isClosed: false
  63624. };
  63625. comObj.postMessage({
  63626. sourceName,
  63627. targetName,
  63628. action: actionName,
  63629. streamId,
  63630. data,
  63631. desiredSize: controller.desiredSize
  63632. }, transfers);
  63633. return startCapability.promise;
  63634. },
  63635. pull: controller => {
  63636. const pullCapability = (0, _util.createPromiseCapability)();
  63637. this.streamControllers[streamId].pullCall = pullCapability;
  63638. comObj.postMessage({
  63639. sourceName,
  63640. targetName,
  63641. stream: StreamKind.PULL,
  63642. streamId,
  63643. desiredSize: controller.desiredSize
  63644. });
  63645. return pullCapability.promise;
  63646. },
  63647. cancel: reason => {
  63648. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  63649. const cancelCapability = (0, _util.createPromiseCapability)();
  63650. this.streamControllers[streamId].cancelCall = cancelCapability;
  63651. this.streamControllers[streamId].isClosed = true;
  63652. comObj.postMessage({
  63653. sourceName,
  63654. targetName,
  63655. stream: StreamKind.CANCEL,
  63656. streamId,
  63657. reason: wrapReason(reason)
  63658. });
  63659. return cancelCapability.promise;
  63660. }
  63661. }, queueingStrategy);
  63662. }
  63663. _createStreamSink(data) {
  63664. const streamId = data.streamId,
  63665. sourceName = this.sourceName,
  63666. targetName = data.sourceName,
  63667. comObj = this.comObj;
  63668. const self = this,
  63669. action = this.actionHandler[data.action];
  63670. const streamSink = {
  63671. enqueue(chunk, size = 1, transfers) {
  63672. if (this.isCancelled) {
  63673. return;
  63674. }
  63675. const lastDesiredSize = this.desiredSize;
  63676. this.desiredSize -= size;
  63677. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  63678. this.sinkCapability = (0, _util.createPromiseCapability)();
  63679. this.ready = this.sinkCapability.promise;
  63680. }
  63681. comObj.postMessage({
  63682. sourceName,
  63683. targetName,
  63684. stream: StreamKind.ENQUEUE,
  63685. streamId,
  63686. chunk
  63687. }, transfers);
  63688. },
  63689. close() {
  63690. if (this.isCancelled) {
  63691. return;
  63692. }
  63693. this.isCancelled = true;
  63694. comObj.postMessage({
  63695. sourceName,
  63696. targetName,
  63697. stream: StreamKind.CLOSE,
  63698. streamId
  63699. });
  63700. delete self.streamSinks[streamId];
  63701. },
  63702. error(reason) {
  63703. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  63704. if (this.isCancelled) {
  63705. return;
  63706. }
  63707. this.isCancelled = true;
  63708. comObj.postMessage({
  63709. sourceName,
  63710. targetName,
  63711. stream: StreamKind.ERROR,
  63712. streamId,
  63713. reason: wrapReason(reason)
  63714. });
  63715. },
  63716. sinkCapability: (0, _util.createPromiseCapability)(),
  63717. onPull: null,
  63718. onCancel: null,
  63719. isCancelled: false,
  63720. desiredSize: data.desiredSize,
  63721. ready: null
  63722. };
  63723. streamSink.sinkCapability.resolve();
  63724. streamSink.ready = streamSink.sinkCapability.promise;
  63725. this.streamSinks[streamId] = streamSink;
  63726. new Promise(function (resolve) {
  63727. resolve(action(data.data, streamSink));
  63728. }).then(function () {
  63729. comObj.postMessage({
  63730. sourceName,
  63731. targetName,
  63732. stream: StreamKind.START_COMPLETE,
  63733. streamId,
  63734. success: true
  63735. });
  63736. }, function (reason) {
  63737. comObj.postMessage({
  63738. sourceName,
  63739. targetName,
  63740. stream: StreamKind.START_COMPLETE,
  63741. streamId,
  63742. reason: wrapReason(reason)
  63743. });
  63744. });
  63745. }
  63746. _processStreamMessage(data) {
  63747. const streamId = data.streamId,
  63748. sourceName = this.sourceName,
  63749. targetName = data.sourceName,
  63750. comObj = this.comObj;
  63751. const streamController = this.streamControllers[streamId],
  63752. streamSink = this.streamSinks[streamId];
  63753. switch (data.stream) {
  63754. case StreamKind.START_COMPLETE:
  63755. if (data.success) {
  63756. streamController.startCall.resolve();
  63757. } else {
  63758. streamController.startCall.reject(wrapReason(data.reason));
  63759. }
  63760. break;
  63761. case StreamKind.PULL_COMPLETE:
  63762. if (data.success) {
  63763. streamController.pullCall.resolve();
  63764. } else {
  63765. streamController.pullCall.reject(wrapReason(data.reason));
  63766. }
  63767. break;
  63768. case StreamKind.PULL:
  63769. if (!streamSink) {
  63770. comObj.postMessage({
  63771. sourceName,
  63772. targetName,
  63773. stream: StreamKind.PULL_COMPLETE,
  63774. streamId,
  63775. success: true
  63776. });
  63777. break;
  63778. }
  63779. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  63780. streamSink.sinkCapability.resolve();
  63781. }
  63782. streamSink.desiredSize = data.desiredSize;
  63783. new Promise(function (resolve) {
  63784. resolve(streamSink.onPull && streamSink.onPull());
  63785. }).then(function () {
  63786. comObj.postMessage({
  63787. sourceName,
  63788. targetName,
  63789. stream: StreamKind.PULL_COMPLETE,
  63790. streamId,
  63791. success: true
  63792. });
  63793. }, function (reason) {
  63794. comObj.postMessage({
  63795. sourceName,
  63796. targetName,
  63797. stream: StreamKind.PULL_COMPLETE,
  63798. streamId,
  63799. reason: wrapReason(reason)
  63800. });
  63801. });
  63802. break;
  63803. case StreamKind.ENQUEUE:
  63804. (0, _util.assert)(streamController, "enqueue should have stream controller");
  63805. if (streamController.isClosed) {
  63806. break;
  63807. }
  63808. streamController.controller.enqueue(data.chunk);
  63809. break;
  63810. case StreamKind.CLOSE:
  63811. (0, _util.assert)(streamController, "close should have stream controller");
  63812. if (streamController.isClosed) {
  63813. break;
  63814. }
  63815. streamController.isClosed = true;
  63816. streamController.controller.close();
  63817. this._deleteStreamController(streamController, streamId);
  63818. break;
  63819. case StreamKind.ERROR:
  63820. (0, _util.assert)(streamController, "error should have stream controller");
  63821. streamController.controller.error(wrapReason(data.reason));
  63822. this._deleteStreamController(streamController, streamId);
  63823. break;
  63824. case StreamKind.CANCEL_COMPLETE:
  63825. if (data.success) {
  63826. streamController.cancelCall.resolve();
  63827. } else {
  63828. streamController.cancelCall.reject(wrapReason(data.reason));
  63829. }
  63830. this._deleteStreamController(streamController, streamId);
  63831. break;
  63832. case StreamKind.CANCEL:
  63833. if (!streamSink) {
  63834. break;
  63835. }
  63836. new Promise(function (resolve) {
  63837. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  63838. }).then(function () {
  63839. comObj.postMessage({
  63840. sourceName,
  63841. targetName,
  63842. stream: StreamKind.CANCEL_COMPLETE,
  63843. streamId,
  63844. success: true
  63845. });
  63846. }, function (reason) {
  63847. comObj.postMessage({
  63848. sourceName,
  63849. targetName,
  63850. stream: StreamKind.CANCEL_COMPLETE,
  63851. streamId,
  63852. reason: wrapReason(reason)
  63853. });
  63854. });
  63855. streamSink.sinkCapability.reject(wrapReason(data.reason));
  63856. streamSink.isCancelled = true;
  63857. delete this.streamSinks[streamId];
  63858. break;
  63859. default:
  63860. throw new Error("Unexpected stream case");
  63861. }
  63862. }
  63863. async _deleteStreamController(streamController, streamId) {
  63864. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  63865. delete this.streamControllers[streamId];
  63866. }
  63867. destroy() {
  63868. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  63869. }
  63870. }
  63871. exports.MessageHandler = MessageHandler;
  63872. /***/ }),
  63873. /* 102 */
  63874. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63875. Object.defineProperty(exports, "__esModule", ({
  63876. value: true
  63877. }));
  63878. exports.PDFWorkerStream = void 0;
  63879. var _util = __w_pdfjs_require__(2);
  63880. class PDFWorkerStream {
  63881. constructor(msgHandler) {
  63882. this._msgHandler = msgHandler;
  63883. this._contentLength = null;
  63884. this._fullRequestReader = null;
  63885. this._rangeRequestReaders = [];
  63886. }
  63887. getFullReader() {
  63888. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  63889. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  63890. return this._fullRequestReader;
  63891. }
  63892. getRangeReader(begin, end) {
  63893. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  63894. this._rangeRequestReaders.push(reader);
  63895. return reader;
  63896. }
  63897. cancelAllRequests(reason) {
  63898. if (this._fullRequestReader) {
  63899. this._fullRequestReader.cancel(reason);
  63900. }
  63901. for (const reader of this._rangeRequestReaders.slice(0)) {
  63902. reader.cancel(reason);
  63903. }
  63904. }
  63905. }
  63906. exports.PDFWorkerStream = PDFWorkerStream;
  63907. class PDFWorkerStreamReader {
  63908. constructor(msgHandler) {
  63909. this._msgHandler = msgHandler;
  63910. this.onProgress = null;
  63911. this._contentLength = null;
  63912. this._isRangeSupported = false;
  63913. this._isStreamingSupported = false;
  63914. const readableStream = this._msgHandler.sendWithStream("GetReader");
  63915. this._reader = readableStream.getReader();
  63916. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  63917. this._isStreamingSupported = data.isStreamingSupported;
  63918. this._isRangeSupported = data.isRangeSupported;
  63919. this._contentLength = data.contentLength;
  63920. });
  63921. }
  63922. get headersReady() {
  63923. return this._headersReady;
  63924. }
  63925. get contentLength() {
  63926. return this._contentLength;
  63927. }
  63928. get isStreamingSupported() {
  63929. return this._isStreamingSupported;
  63930. }
  63931. get isRangeSupported() {
  63932. return this._isRangeSupported;
  63933. }
  63934. async read() {
  63935. const {
  63936. value,
  63937. done
  63938. } = await this._reader.read();
  63939. if (done) {
  63940. return {
  63941. value: undefined,
  63942. done: true
  63943. };
  63944. }
  63945. return {
  63946. value: value.buffer,
  63947. done: false
  63948. };
  63949. }
  63950. cancel(reason) {
  63951. this._reader.cancel(reason);
  63952. }
  63953. }
  63954. class PDFWorkerStreamRangeReader {
  63955. constructor(begin, end, msgHandler) {
  63956. this._msgHandler = msgHandler;
  63957. this.onProgress = null;
  63958. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  63959. begin,
  63960. end
  63961. });
  63962. this._reader = readableStream.getReader();
  63963. }
  63964. get isStreamingSupported() {
  63965. return false;
  63966. }
  63967. async read() {
  63968. const {
  63969. value,
  63970. done
  63971. } = await this._reader.read();
  63972. if (done) {
  63973. return {
  63974. value: undefined,
  63975. done: true
  63976. };
  63977. }
  63978. return {
  63979. value: value.buffer,
  63980. done: false
  63981. };
  63982. }
  63983. cancel(reason) {
  63984. this._reader.cancel(reason);
  63985. }
  63986. }
  63987. /***/ })
  63988. /******/ ]);
  63989. /************************************************************************/
  63990. /******/ // The module cache
  63991. /******/ var __webpack_module_cache__ = {};
  63992. /******/
  63993. /******/ // The require function
  63994. /******/ function __w_pdfjs_require__(moduleId) {
  63995. /******/ // Check if module is in cache
  63996. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  63997. /******/ if (cachedModule !== undefined) {
  63998. /******/ return cachedModule.exports;
  63999. /******/ }
  64000. /******/ // Create a new module (and put it into the cache)
  64001. /******/ var module = __webpack_module_cache__[moduleId] = {
  64002. /******/ // no module.id needed
  64003. /******/ // no module.loaded needed
  64004. /******/ exports: {}
  64005. /******/ };
  64006. /******/
  64007. /******/ // Execute the module function
  64008. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  64009. /******/
  64010. /******/ // Return the exports of the module
  64011. /******/ return module.exports;
  64012. /******/ }
  64013. /******/
  64014. /************************************************************************/
  64015. /******/ /* webpack/runtime/define property getters */
  64016. /******/ (() => {
  64017. /******/ // define getter functions for harmony exports
  64018. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  64019. /******/ for(var key in definition) {
  64020. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  64021. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  64022. /******/ }
  64023. /******/ }
  64024. /******/ };
  64025. /******/ })();
  64026. /******/
  64027. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  64028. /******/ (() => {
  64029. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  64030. /******/ })();
  64031. /******/
  64032. /******/ /* webpack/runtime/make namespace object */
  64033. /******/ (() => {
  64034. /******/ // define __esModule on exports
  64035. /******/ __w_pdfjs_require__.r = (exports) => {
  64036. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  64037. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  64038. /******/ }
  64039. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  64040. /******/ };
  64041. /******/ })();
  64042. /******/
  64043. /************************************************************************/
  64044. var __webpack_exports__ = {};
  64045. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  64046. (() => {
  64047. var exports = __webpack_exports__;
  64048. Object.defineProperty(exports, "__esModule", ({
  64049. value: true
  64050. }));
  64051. Object.defineProperty(exports, "WorkerMessageHandler", ({
  64052. enumerable: true,
  64053. get: function () {
  64054. return _worker.WorkerMessageHandler;
  64055. }
  64056. }));
  64057. var _worker = __w_pdfjs_require__(1);
  64058. const pdfjsVersion = '3.3.122';
  64059. const pdfjsBuild = '562045607';
  64060. })();
  64061. /******/ return __webpack_exports__;
  64062. /******/ })()
  64063. ;
  64064. });
  64065. //# sourceMappingURL=pdf.worker.js.map