pdf.worker.js 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/build/pdf.worker", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/build/pdf.worker"] = factory();
  29. else
  30. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
  31. })(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__(5);
  44. var _core_utils = __w_pdfjs_require__(6);
  45. var _pdf_manager = __w_pdfjs_require__(8);
  46. var _cleanup_helper = __w_pdfjs_require__(71);
  47. var _writer = __w_pdfjs_require__(65);
  48. var _is_node = __w_pdfjs_require__(4);
  49. var _message_handler = __w_pdfjs_require__(102);
  50. var _worker_stream = __w_pdfjs_require__(103);
  51. class WorkerTask {
  52. constructor(name) {
  53. this.name = name;
  54. this.terminated = false;
  55. this._capability = (0, _util.createPromiseCapability)();
  56. }
  57. get finished() {
  58. return this._capability.promise;
  59. }
  60. finish() {
  61. this._capability.resolve();
  62. }
  63. terminate() {
  64. this.terminated = true;
  65. }
  66. ensureNotTerminated() {
  67. if (this.terminated) {
  68. throw new Error("Worker task was terminated");
  69. }
  70. }
  71. }
  72. exports.WorkerTask = WorkerTask;
  73. class WorkerMessageHandler {
  74. static setup(handler, port) {
  75. let testMessageProcessed = false;
  76. handler.on("test", function wphSetupTest(data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function wphConfigure(data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function wphSetupDoc(data) {
  87. return WorkerMessageHandler.createDocumentHandler(data, port);
  88. });
  89. }
  90. static createDocumentHandler(docParams, port) {
  91. let pdfManager;
  92. let terminated = false;
  93. let cancelXHRs = null;
  94. const WorkerTasks = [];
  95. const verbosity = (0, _util.getVerbosityLevel)();
  96. const apiVersion = docParams.apiVersion;
  97. const workerVersion = '2.16.105';
  98. if (apiVersion !== workerVersion) {
  99. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  100. }
  101. const enumerableProperties = [];
  102. for (const property in []) {
  103. enumerableProperties.push(property);
  104. }
  105. if (enumerableProperties.length) {
  106. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  107. }
  108. if (typeof ReadableStream === "undefined") {
  109. const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  110. if (_is_node.isNodeJS) {
  111. throw new Error(partialMsg + "please use a `legacy`-build instead.");
  112. }
  113. throw new Error(partialMsg + "please update to a supported browser.");
  114. }
  115. const docId = docParams.docId;
  116. const docBaseUrl = docParams.docBaseUrl;
  117. const workerHandlerName = docParams.docId + "_worker";
  118. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  119. function ensureNotTerminated() {
  120. if (terminated) {
  121. throw new Error("Worker was terminated");
  122. }
  123. }
  124. function startWorkerTask(task) {
  125. WorkerTasks.push(task);
  126. }
  127. function finishWorkerTask(task) {
  128. task.finish();
  129. const i = WorkerTasks.indexOf(task);
  130. WorkerTasks.splice(i, 1);
  131. }
  132. async function loadDocument(recoveryMode) {
  133. await pdfManager.ensureDoc("checkHeader");
  134. await pdfManager.ensureDoc("parseStartXRef");
  135. await pdfManager.ensureDoc("parse", [recoveryMode]);
  136. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  137. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  138. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  139. if (isPureXfa) {
  140. const task = new WorkerTask("loadXfaFonts");
  141. startWorkerTask(task);
  142. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  143. }
  144. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  145. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  146. return {
  147. numPages,
  148. fingerprints,
  149. htmlForXfa
  150. };
  151. }
  152. function getPdfManager(data, evaluatorOptions, enableXfa) {
  153. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  154. let newPdfManager;
  155. const source = data.source;
  156. if (source.data) {
  157. try {
  158. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  159. pdfManagerCapability.resolve(newPdfManager);
  160. } catch (ex) {
  161. pdfManagerCapability.reject(ex);
  162. }
  163. return pdfManagerCapability.promise;
  164. }
  165. let pdfStream,
  166. cachedChunks = [];
  167. try {
  168. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  169. } catch (ex) {
  170. pdfManagerCapability.reject(ex);
  171. return pdfManagerCapability.promise;
  172. }
  173. const fullRequest = pdfStream.getFullReader();
  174. fullRequest.headersReady.then(function () {
  175. if (!fullRequest.isRangeSupported) {
  176. return;
  177. }
  178. const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  179. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  180. msgHandler: handler,
  181. password: source.password,
  182. length: fullRequest.contentLength,
  183. disableAutoFetch,
  184. rangeChunkSize: source.rangeChunkSize
  185. }, evaluatorOptions, enableXfa, docBaseUrl);
  186. for (const chunk of cachedChunks) {
  187. newPdfManager.sendProgressiveData(chunk);
  188. }
  189. cachedChunks = [];
  190. pdfManagerCapability.resolve(newPdfManager);
  191. cancelXHRs = null;
  192. }).catch(function (reason) {
  193. pdfManagerCapability.reject(reason);
  194. cancelXHRs = null;
  195. });
  196. let loaded = 0;
  197. const flushChunks = function () {
  198. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  199. if (source.length && pdfFile.length !== source.length) {
  200. (0, _util.warn)("reported HTTP length is different from actual");
  201. }
  202. try {
  203. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  204. pdfManagerCapability.resolve(newPdfManager);
  205. } catch (ex) {
  206. pdfManagerCapability.reject(ex);
  207. }
  208. cachedChunks = [];
  209. };
  210. const readPromise = new Promise(function (resolve, reject) {
  211. const readChunk = function ({
  212. value,
  213. done
  214. }) {
  215. try {
  216. ensureNotTerminated();
  217. if (done) {
  218. if (!newPdfManager) {
  219. flushChunks();
  220. }
  221. cancelXHRs = null;
  222. return;
  223. }
  224. loaded += (0, _util.arrayByteLength)(value);
  225. if (!fullRequest.isStreamingSupported) {
  226. handler.send("DocProgress", {
  227. loaded,
  228. total: Math.max(loaded, fullRequest.contentLength || 0)
  229. });
  230. }
  231. if (newPdfManager) {
  232. newPdfManager.sendProgressiveData(value);
  233. } else {
  234. cachedChunks.push(value);
  235. }
  236. fullRequest.read().then(readChunk, reject);
  237. } catch (e) {
  238. reject(e);
  239. }
  240. };
  241. fullRequest.read().then(readChunk, reject);
  242. });
  243. readPromise.catch(function (e) {
  244. pdfManagerCapability.reject(e);
  245. cancelXHRs = null;
  246. });
  247. cancelXHRs = function (reason) {
  248. pdfStream.cancelAllRequests(reason);
  249. };
  250. return pdfManagerCapability.promise;
  251. }
  252. function setupDoc(data) {
  253. function onSuccess(doc) {
  254. ensureNotTerminated();
  255. handler.send("GetDoc", {
  256. pdfInfo: doc
  257. });
  258. }
  259. function onFailure(ex) {
  260. ensureNotTerminated();
  261. if (ex instanceof _util.PasswordException) {
  262. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  263. startWorkerTask(task);
  264. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  265. password
  266. }) {
  267. finishWorkerTask(task);
  268. pdfManager.updatePassword(password);
  269. pdfManagerReady();
  270. }).catch(function () {
  271. finishWorkerTask(task);
  272. handler.send("DocException", ex);
  273. });
  274. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  275. handler.send("DocException", ex);
  276. } else {
  277. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  278. }
  279. }
  280. function pdfManagerReady() {
  281. ensureNotTerminated();
  282. loadDocument(false).then(onSuccess, function (reason) {
  283. ensureNotTerminated();
  284. if (!(reason instanceof _core_utils.XRefParseException)) {
  285. onFailure(reason);
  286. return;
  287. }
  288. pdfManager.requestLoadedStream();
  289. pdfManager.onLoadedStream().then(function () {
  290. ensureNotTerminated();
  291. loadDocument(true).then(onSuccess, onFailure);
  292. });
  293. });
  294. }
  295. ensureNotTerminated();
  296. const evaluatorOptions = {
  297. maxImageSize: data.maxImageSize,
  298. disableFontFace: data.disableFontFace,
  299. ignoreErrors: data.ignoreErrors,
  300. isEvalSupported: data.isEvalSupported,
  301. fontExtraProperties: data.fontExtraProperties,
  302. useSystemFonts: data.useSystemFonts,
  303. cMapUrl: data.cMapUrl,
  304. standardFontDataUrl: data.standardFontDataUrl
  305. };
  306. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  307. if (terminated) {
  308. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  309. throw new Error("Worker was terminated");
  310. }
  311. pdfManager = newPdfManager;
  312. pdfManager.onLoadedStream().then(function (stream) {
  313. handler.send("DataLoaded", {
  314. length: stream.bytes.byteLength
  315. });
  316. });
  317. }).then(pdfManagerReady, onFailure);
  318. }
  319. handler.on("GetPage", function wphSetupGetPage(data) {
  320. return pdfManager.getPage(data.pageIndex).then(function (page) {
  321. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  322. return {
  323. rotate,
  324. ref,
  325. userUnit,
  326. view
  327. };
  328. });
  329. });
  330. });
  331. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  332. const pageRef = _primitives.Ref.get(data.num, data.gen);
  333. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  334. });
  335. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  336. return pdfManager.ensureCatalog("destinations");
  337. });
  338. handler.on("GetDestination", function wphSetupGetDestination(data) {
  339. return pdfManager.ensureCatalog("getDestination", [data.id]);
  340. });
  341. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  342. return pdfManager.ensureCatalog("pageLabels");
  343. });
  344. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  345. return pdfManager.ensureCatalog("pageLayout");
  346. });
  347. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  348. return pdfManager.ensureCatalog("pageMode");
  349. });
  350. handler.on("GetViewerPreferences", function (data) {
  351. return pdfManager.ensureCatalog("viewerPreferences");
  352. });
  353. handler.on("GetOpenAction", function (data) {
  354. return pdfManager.ensureCatalog("openAction");
  355. });
  356. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  357. return pdfManager.ensureCatalog("attachments");
  358. });
  359. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  360. return pdfManager.ensureCatalog("javaScript");
  361. });
  362. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  363. return pdfManager.ensureCatalog("jsActions");
  364. });
  365. handler.on("GetPageJSActions", function ({
  366. pageIndex
  367. }) {
  368. return pdfManager.getPage(pageIndex).then(function (page) {
  369. return pdfManager.ensure(page, "jsActions");
  370. });
  371. });
  372. handler.on("GetOutline", function wphSetupGetOutline(data) {
  373. return pdfManager.ensureCatalog("documentOutline");
  374. });
  375. handler.on("GetOptionalContentConfig", function (data) {
  376. return pdfManager.ensureCatalog("optionalContentConfig");
  377. });
  378. handler.on("GetPermissions", function (data) {
  379. return pdfManager.ensureCatalog("permissions");
  380. });
  381. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  382. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  383. });
  384. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  385. return pdfManager.ensureCatalog("markInfo");
  386. });
  387. handler.on("GetData", function wphSetupGetData(data) {
  388. pdfManager.requestLoadedStream();
  389. return pdfManager.onLoadedStream().then(function (stream) {
  390. return stream.bytes;
  391. });
  392. });
  393. handler.on("GetAnnotations", function ({
  394. pageIndex,
  395. intent
  396. }) {
  397. return pdfManager.getPage(pageIndex).then(function (page) {
  398. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  399. startWorkerTask(task);
  400. return page.getAnnotationsData(handler, task, intent).then(data => {
  401. finishWorkerTask(task);
  402. return data;
  403. }, reason => {
  404. finishWorkerTask(task);
  405. });
  406. });
  407. });
  408. handler.on("GetFieldObjects", function (data) {
  409. return pdfManager.ensureDoc("fieldObjects");
  410. });
  411. handler.on("HasJSActions", function (data) {
  412. return pdfManager.ensureDoc("hasJSActions");
  413. });
  414. handler.on("GetCalculationOrderIds", function (data) {
  415. return pdfManager.ensureDoc("calculationOrderIds");
  416. });
  417. handler.on("SaveDocument", function ({
  418. isPureXfa,
  419. numPages,
  420. annotationStorage,
  421. filename
  422. }) {
  423. pdfManager.requestLoadedStream();
  424. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  425. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  426. if (newAnnotationsByPage) {
  427. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  428. promises.push(pdfManager.getPage(pageIndex).then(page => {
  429. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  430. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  431. finishWorkerTask(task);
  432. });
  433. }));
  434. }
  435. }
  436. if (isPureXfa) {
  437. promises.push(pdfManager.serializeXfaData(annotationStorage));
  438. } else {
  439. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  440. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  441. const task = new WorkerTask(`Save: page ${pageIndex}`);
  442. return page.save(handler, task, annotationStorage).finally(function () {
  443. finishWorkerTask(task);
  444. });
  445. }));
  446. }
  447. }
  448. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  449. let newRefs = [];
  450. let xfaData = null;
  451. if (isPureXfa) {
  452. xfaData = refs[0];
  453. if (!xfaData) {
  454. return stream.bytes;
  455. }
  456. } else {
  457. newRefs = refs.flat(2);
  458. if (newRefs.length === 0) {
  459. return stream.bytes;
  460. }
  461. }
  462. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  463. let xfaDatasetsRef = null;
  464. let hasXfaDatasetsEntry = false;
  465. if (Array.isArray(xfa)) {
  466. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  467. if (xfa[i] === "datasets") {
  468. xfaDatasetsRef = xfa[i + 1];
  469. acroFormRef = null;
  470. hasXfaDatasetsEntry = true;
  471. }
  472. }
  473. if (xfaDatasetsRef === null) {
  474. xfaDatasetsRef = xref.getNewRef();
  475. }
  476. } else if (xfa) {
  477. acroFormRef = null;
  478. (0, _util.warn)("Unsupported XFA type.");
  479. }
  480. let newXrefInfo = Object.create(null);
  481. if (xref.trailer) {
  482. const infoObj = Object.create(null);
  483. const xrefInfo = xref.trailer.get("Info") || null;
  484. if (xrefInfo instanceof _primitives.Dict) {
  485. xrefInfo.forEach((key, value) => {
  486. if (typeof value === "string") {
  487. infoObj[key] = (0, _util.stringToPDFString)(value);
  488. }
  489. });
  490. }
  491. newXrefInfo = {
  492. rootRef: xref.trailer.getRaw("Root") || null,
  493. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  494. newRef: xref.getNewRef(),
  495. infoRef: xref.trailer.getRaw("Info") || null,
  496. info: infoObj,
  497. fileIds: xref.trailer.get("ID") || null,
  498. startXRef,
  499. filename
  500. };
  501. }
  502. xref.resetNewRef();
  503. return (0, _writer.incrementalUpdate)({
  504. originalData: stream.bytes,
  505. xrefInfo: newXrefInfo,
  506. newRefs,
  507. xref,
  508. hasXfa: !!xfa,
  509. xfaDatasetsRef,
  510. hasXfaDatasetsEntry,
  511. acroFormRef,
  512. acroForm,
  513. xfaData
  514. });
  515. });
  516. });
  517. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  518. const pageIndex = data.pageIndex;
  519. pdfManager.getPage(pageIndex).then(function (page) {
  520. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  521. startWorkerTask(task);
  522. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  523. page.getOperatorList({
  524. handler,
  525. sink,
  526. task,
  527. intent: data.intent,
  528. cacheKey: data.cacheKey,
  529. annotationStorage: data.annotationStorage
  530. }).then(function (operatorListInfo) {
  531. finishWorkerTask(task);
  532. if (start) {
  533. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  534. }
  535. sink.close();
  536. }, function (reason) {
  537. finishWorkerTask(task);
  538. if (task.terminated) {
  539. return;
  540. }
  541. handler.send("UnsupportedFeature", {
  542. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  543. });
  544. sink.error(reason);
  545. });
  546. });
  547. });
  548. handler.on("GetTextContent", function wphExtractText(data, sink) {
  549. const pageIndex = data.pageIndex;
  550. pdfManager.getPage(pageIndex).then(function (page) {
  551. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  552. startWorkerTask(task);
  553. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  554. page.extractTextContent({
  555. handler,
  556. task,
  557. sink,
  558. includeMarkedContent: data.includeMarkedContent,
  559. combineTextItems: data.combineTextItems
  560. }).then(function () {
  561. finishWorkerTask(task);
  562. if (start) {
  563. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  564. }
  565. sink.close();
  566. }, function (reason) {
  567. finishWorkerTask(task);
  568. if (task.terminated) {
  569. return;
  570. }
  571. sink.error(reason);
  572. });
  573. });
  574. });
  575. handler.on("GetStructTree", function wphGetStructTree(data) {
  576. return pdfManager.getPage(data.pageIndex).then(function (page) {
  577. return pdfManager.ensure(page, "getStructTree");
  578. });
  579. });
  580. handler.on("FontFallback", function (data) {
  581. return pdfManager.fontFallback(data.id, handler);
  582. });
  583. handler.on("Cleanup", function wphCleanup(data) {
  584. return pdfManager.cleanup(true);
  585. });
  586. handler.on("Terminate", function wphTerminate(data) {
  587. terminated = true;
  588. const waitOn = [];
  589. if (pdfManager) {
  590. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  591. const cleanupPromise = pdfManager.cleanup();
  592. waitOn.push(cleanupPromise);
  593. pdfManager = null;
  594. } else {
  595. (0, _cleanup_helper.clearGlobalCaches)();
  596. }
  597. if (cancelXHRs) {
  598. cancelXHRs(new _util.AbortException("Worker was terminated."));
  599. }
  600. for (const task of WorkerTasks) {
  601. waitOn.push(task.finished);
  602. task.terminate();
  603. }
  604. return Promise.all(waitOn).then(function () {
  605. handler.destroy();
  606. handler = null;
  607. });
  608. });
  609. handler.on("Ready", function wphReady(data) {
  610. setupDoc(docParams);
  611. docParams = null;
  612. });
  613. return workerHandlerName;
  614. }
  615. static initializeFromPort(port) {
  616. const handler = new _message_handler.MessageHandler("worker", "main", port);
  617. WorkerMessageHandler.setup(handler, port);
  618. handler.send("ready", null);
  619. }
  620. }
  621. exports.WorkerMessageHandler = WorkerMessageHandler;
  622. function isMessagePort(maybePort) {
  623. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  624. }
  625. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  626. WorkerMessageHandler.initializeFromPort(self);
  627. }
  628. /***/ }),
  629. /* 2 */
  630. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  631. Object.defineProperty(exports, "__esModule", ({
  632. value: true
  633. }));
  634. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  635. exports.arrayByteLength = arrayByteLength;
  636. exports.arraysToBytes = arraysToBytes;
  637. exports.assert = assert;
  638. exports.bytesToString = bytesToString;
  639. exports.createPromiseCapability = createPromiseCapability;
  640. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  641. exports.escapeString = escapeString;
  642. exports.getModificationDate = getModificationDate;
  643. exports.getVerbosityLevel = getVerbosityLevel;
  644. exports.info = info;
  645. exports.isArrayBuffer = isArrayBuffer;
  646. exports.isArrayEqual = isArrayEqual;
  647. exports.isAscii = isAscii;
  648. exports.objectFromMap = objectFromMap;
  649. exports.objectSize = objectSize;
  650. exports.setVerbosityLevel = setVerbosityLevel;
  651. exports.shadow = shadow;
  652. exports.string32 = string32;
  653. exports.stringToBytes = stringToBytes;
  654. exports.stringToPDFString = stringToPDFString;
  655. exports.stringToUTF16BEString = stringToUTF16BEString;
  656. exports.stringToUTF8String = stringToUTF8String;
  657. exports.unreachable = unreachable;
  658. exports.utf8StringToString = utf8StringToString;
  659. exports.warn = warn;
  660. __w_pdfjs_require__(3);
  661. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  662. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  663. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  664. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  665. const LINE_FACTOR = 1.35;
  666. exports.LINE_FACTOR = LINE_FACTOR;
  667. const LINE_DESCENT_FACTOR = 0.35;
  668. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  669. const RenderingIntentFlag = {
  670. ANY: 0x01,
  671. DISPLAY: 0x02,
  672. PRINT: 0x04,
  673. ANNOTATIONS_FORMS: 0x10,
  674. ANNOTATIONS_STORAGE: 0x20,
  675. ANNOTATIONS_DISABLE: 0x40,
  676. OPLIST: 0x100
  677. };
  678. exports.RenderingIntentFlag = RenderingIntentFlag;
  679. const AnnotationMode = {
  680. DISABLE: 0,
  681. ENABLE: 1,
  682. ENABLE_FORMS: 2,
  683. ENABLE_STORAGE: 3
  684. };
  685. exports.AnnotationMode = AnnotationMode;
  686. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  687. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  688. const AnnotationEditorType = {
  689. DISABLE: -1,
  690. NONE: 0,
  691. FREETEXT: 3,
  692. INK: 15
  693. };
  694. exports.AnnotationEditorType = AnnotationEditorType;
  695. const AnnotationEditorParamsType = {
  696. FREETEXT_SIZE: 1,
  697. FREETEXT_COLOR: 2,
  698. FREETEXT_OPACITY: 3,
  699. INK_COLOR: 11,
  700. INK_THICKNESS: 12,
  701. INK_OPACITY: 13
  702. };
  703. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  704. const PermissionFlag = {
  705. PRINT: 0x04,
  706. MODIFY_CONTENTS: 0x08,
  707. COPY: 0x10,
  708. MODIFY_ANNOTATIONS: 0x20,
  709. FILL_INTERACTIVE_FORMS: 0x100,
  710. COPY_FOR_ACCESSIBILITY: 0x200,
  711. ASSEMBLE: 0x400,
  712. PRINT_HIGH_QUALITY: 0x800
  713. };
  714. exports.PermissionFlag = PermissionFlag;
  715. const TextRenderingMode = {
  716. FILL: 0,
  717. STROKE: 1,
  718. FILL_STROKE: 2,
  719. INVISIBLE: 3,
  720. FILL_ADD_TO_PATH: 4,
  721. STROKE_ADD_TO_PATH: 5,
  722. FILL_STROKE_ADD_TO_PATH: 6,
  723. ADD_TO_PATH: 7,
  724. FILL_STROKE_MASK: 3,
  725. ADD_TO_PATH_FLAG: 4
  726. };
  727. exports.TextRenderingMode = TextRenderingMode;
  728. const ImageKind = {
  729. GRAYSCALE_1BPP: 1,
  730. RGB_24BPP: 2,
  731. RGBA_32BPP: 3
  732. };
  733. exports.ImageKind = ImageKind;
  734. const AnnotationType = {
  735. TEXT: 1,
  736. LINK: 2,
  737. FREETEXT: 3,
  738. LINE: 4,
  739. SQUARE: 5,
  740. CIRCLE: 6,
  741. POLYGON: 7,
  742. POLYLINE: 8,
  743. HIGHLIGHT: 9,
  744. UNDERLINE: 10,
  745. SQUIGGLY: 11,
  746. STRIKEOUT: 12,
  747. STAMP: 13,
  748. CARET: 14,
  749. INK: 15,
  750. POPUP: 16,
  751. FILEATTACHMENT: 17,
  752. SOUND: 18,
  753. MOVIE: 19,
  754. WIDGET: 20,
  755. SCREEN: 21,
  756. PRINTERMARK: 22,
  757. TRAPNET: 23,
  758. WATERMARK: 24,
  759. THREED: 25,
  760. REDACT: 26
  761. };
  762. exports.AnnotationType = AnnotationType;
  763. const AnnotationStateModelType = {
  764. MARKED: "Marked",
  765. REVIEW: "Review"
  766. };
  767. exports.AnnotationStateModelType = AnnotationStateModelType;
  768. const AnnotationMarkedState = {
  769. MARKED: "Marked",
  770. UNMARKED: "Unmarked"
  771. };
  772. exports.AnnotationMarkedState = AnnotationMarkedState;
  773. const AnnotationReviewState = {
  774. ACCEPTED: "Accepted",
  775. REJECTED: "Rejected",
  776. CANCELLED: "Cancelled",
  777. COMPLETED: "Completed",
  778. NONE: "None"
  779. };
  780. exports.AnnotationReviewState = AnnotationReviewState;
  781. const AnnotationReplyType = {
  782. GROUP: "Group",
  783. REPLY: "R"
  784. };
  785. exports.AnnotationReplyType = AnnotationReplyType;
  786. const AnnotationFlag = {
  787. INVISIBLE: 0x01,
  788. HIDDEN: 0x02,
  789. PRINT: 0x04,
  790. NOZOOM: 0x08,
  791. NOROTATE: 0x10,
  792. NOVIEW: 0x20,
  793. READONLY: 0x40,
  794. LOCKED: 0x80,
  795. TOGGLENOVIEW: 0x100,
  796. LOCKEDCONTENTS: 0x200
  797. };
  798. exports.AnnotationFlag = AnnotationFlag;
  799. const AnnotationFieldFlag = {
  800. READONLY: 0x0000001,
  801. REQUIRED: 0x0000002,
  802. NOEXPORT: 0x0000004,
  803. MULTILINE: 0x0001000,
  804. PASSWORD: 0x0002000,
  805. NOTOGGLETOOFF: 0x0004000,
  806. RADIO: 0x0008000,
  807. PUSHBUTTON: 0x0010000,
  808. COMBO: 0x0020000,
  809. EDIT: 0x0040000,
  810. SORT: 0x0080000,
  811. FILESELECT: 0x0100000,
  812. MULTISELECT: 0x0200000,
  813. DONOTSPELLCHECK: 0x0400000,
  814. DONOTSCROLL: 0x0800000,
  815. COMB: 0x1000000,
  816. RICHTEXT: 0x2000000,
  817. RADIOSINUNISON: 0x2000000,
  818. COMMITONSELCHANGE: 0x4000000
  819. };
  820. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  821. const AnnotationBorderStyleType = {
  822. SOLID: 1,
  823. DASHED: 2,
  824. BEVELED: 3,
  825. INSET: 4,
  826. UNDERLINE: 5
  827. };
  828. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  829. const AnnotationActionEventType = {
  830. E: "Mouse Enter",
  831. X: "Mouse Exit",
  832. D: "Mouse Down",
  833. U: "Mouse Up",
  834. Fo: "Focus",
  835. Bl: "Blur",
  836. PO: "PageOpen",
  837. PC: "PageClose",
  838. PV: "PageVisible",
  839. PI: "PageInvisible",
  840. K: "Keystroke",
  841. F: "Format",
  842. V: "Validate",
  843. C: "Calculate"
  844. };
  845. exports.AnnotationActionEventType = AnnotationActionEventType;
  846. const DocumentActionEventType = {
  847. WC: "WillClose",
  848. WS: "WillSave",
  849. DS: "DidSave",
  850. WP: "WillPrint",
  851. DP: "DidPrint"
  852. };
  853. exports.DocumentActionEventType = DocumentActionEventType;
  854. const PageActionEventType = {
  855. O: "PageOpen",
  856. C: "PageClose"
  857. };
  858. exports.PageActionEventType = PageActionEventType;
  859. const StreamType = {
  860. UNKNOWN: "UNKNOWN",
  861. FLATE: "FLATE",
  862. LZW: "LZW",
  863. DCT: "DCT",
  864. JPX: "JPX",
  865. JBIG: "JBIG",
  866. A85: "A85",
  867. AHX: "AHX",
  868. CCF: "CCF",
  869. RLX: "RLX"
  870. };
  871. exports.StreamType = StreamType;
  872. const FontType = {
  873. UNKNOWN: "UNKNOWN",
  874. TYPE1: "TYPE1",
  875. TYPE1STANDARD: "TYPE1STANDARD",
  876. TYPE1C: "TYPE1C",
  877. CIDFONTTYPE0: "CIDFONTTYPE0",
  878. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  879. TRUETYPE: "TRUETYPE",
  880. CIDFONTTYPE2: "CIDFONTTYPE2",
  881. TYPE3: "TYPE3",
  882. OPENTYPE: "OPENTYPE",
  883. TYPE0: "TYPE0",
  884. MMTYPE1: "MMTYPE1"
  885. };
  886. exports.FontType = FontType;
  887. const VerbosityLevel = {
  888. ERRORS: 0,
  889. WARNINGS: 1,
  890. INFOS: 5
  891. };
  892. exports.VerbosityLevel = VerbosityLevel;
  893. const CMapCompressionType = {
  894. NONE: 0,
  895. BINARY: 1,
  896. STREAM: 2
  897. };
  898. exports.CMapCompressionType = CMapCompressionType;
  899. const OPS = {
  900. dependency: 1,
  901. setLineWidth: 2,
  902. setLineCap: 3,
  903. setLineJoin: 4,
  904. setMiterLimit: 5,
  905. setDash: 6,
  906. setRenderingIntent: 7,
  907. setFlatness: 8,
  908. setGState: 9,
  909. save: 10,
  910. restore: 11,
  911. transform: 12,
  912. moveTo: 13,
  913. lineTo: 14,
  914. curveTo: 15,
  915. curveTo2: 16,
  916. curveTo3: 17,
  917. closePath: 18,
  918. rectangle: 19,
  919. stroke: 20,
  920. closeStroke: 21,
  921. fill: 22,
  922. eoFill: 23,
  923. fillStroke: 24,
  924. eoFillStroke: 25,
  925. closeFillStroke: 26,
  926. closeEOFillStroke: 27,
  927. endPath: 28,
  928. clip: 29,
  929. eoClip: 30,
  930. beginText: 31,
  931. endText: 32,
  932. setCharSpacing: 33,
  933. setWordSpacing: 34,
  934. setHScale: 35,
  935. setLeading: 36,
  936. setFont: 37,
  937. setTextRenderingMode: 38,
  938. setTextRise: 39,
  939. moveText: 40,
  940. setLeadingMoveText: 41,
  941. setTextMatrix: 42,
  942. nextLine: 43,
  943. showText: 44,
  944. showSpacedText: 45,
  945. nextLineShowText: 46,
  946. nextLineSetSpacingShowText: 47,
  947. setCharWidth: 48,
  948. setCharWidthAndBounds: 49,
  949. setStrokeColorSpace: 50,
  950. setFillColorSpace: 51,
  951. setStrokeColor: 52,
  952. setStrokeColorN: 53,
  953. setFillColor: 54,
  954. setFillColorN: 55,
  955. setStrokeGray: 56,
  956. setFillGray: 57,
  957. setStrokeRGBColor: 58,
  958. setFillRGBColor: 59,
  959. setStrokeCMYKColor: 60,
  960. setFillCMYKColor: 61,
  961. shadingFill: 62,
  962. beginInlineImage: 63,
  963. beginImageData: 64,
  964. endInlineImage: 65,
  965. paintXObject: 66,
  966. markPoint: 67,
  967. markPointProps: 68,
  968. beginMarkedContent: 69,
  969. beginMarkedContentProps: 70,
  970. endMarkedContent: 71,
  971. beginCompat: 72,
  972. endCompat: 73,
  973. paintFormXObjectBegin: 74,
  974. paintFormXObjectEnd: 75,
  975. beginGroup: 76,
  976. endGroup: 77,
  977. beginAnnotations: 78,
  978. endAnnotations: 79,
  979. beginAnnotation: 80,
  980. endAnnotation: 81,
  981. paintJpegXObject: 82,
  982. paintImageMaskXObject: 83,
  983. paintImageMaskXObjectGroup: 84,
  984. paintImageXObject: 85,
  985. paintInlineImageXObject: 86,
  986. paintInlineImageXObjectGroup: 87,
  987. paintImageXObjectRepeat: 88,
  988. paintImageMaskXObjectRepeat: 89,
  989. paintSolidColorImageMask: 90,
  990. constructPath: 91
  991. };
  992. exports.OPS = OPS;
  993. const UNSUPPORTED_FEATURES = {
  994. unknown: "unknown",
  995. forms: "forms",
  996. javaScript: "javaScript",
  997. signatures: "signatures",
  998. smask: "smask",
  999. shadingPattern: "shadingPattern",
  1000. font: "font",
  1001. errorTilingPattern: "errorTilingPattern",
  1002. errorExtGState: "errorExtGState",
  1003. errorXObject: "errorXObject",
  1004. errorFontLoadType3: "errorFontLoadType3",
  1005. errorFontState: "errorFontState",
  1006. errorFontMissing: "errorFontMissing",
  1007. errorFontTranslate: "errorFontTranslate",
  1008. errorColorSpace: "errorColorSpace",
  1009. errorOperatorList: "errorOperatorList",
  1010. errorFontToUnicode: "errorFontToUnicode",
  1011. errorFontLoadNative: "errorFontLoadNative",
  1012. errorFontBuildPath: "errorFontBuildPath",
  1013. errorFontGetPath: "errorFontGetPath",
  1014. errorMarkedContent: "errorMarkedContent",
  1015. errorContentSubStream: "errorContentSubStream"
  1016. };
  1017. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1018. const PasswordResponses = {
  1019. NEED_PASSWORD: 1,
  1020. INCORRECT_PASSWORD: 2
  1021. };
  1022. exports.PasswordResponses = PasswordResponses;
  1023. let verbosity = VerbosityLevel.WARNINGS;
  1024. function setVerbosityLevel(level) {
  1025. if (Number.isInteger(level)) {
  1026. verbosity = level;
  1027. }
  1028. }
  1029. function getVerbosityLevel() {
  1030. return verbosity;
  1031. }
  1032. function info(msg) {
  1033. if (verbosity >= VerbosityLevel.INFOS) {
  1034. console.log(`Info: ${msg}`);
  1035. }
  1036. }
  1037. function warn(msg) {
  1038. if (verbosity >= VerbosityLevel.WARNINGS) {
  1039. console.log(`Warning: ${msg}`);
  1040. }
  1041. }
  1042. function unreachable(msg) {
  1043. throw new Error(msg);
  1044. }
  1045. function assert(cond, msg) {
  1046. if (!cond) {
  1047. unreachable(msg);
  1048. }
  1049. }
  1050. function _isValidProtocol(url) {
  1051. if (!url) {
  1052. return false;
  1053. }
  1054. switch (url.protocol) {
  1055. case "http:":
  1056. case "https:":
  1057. case "ftp:":
  1058. case "mailto:":
  1059. case "tel:":
  1060. return true;
  1061. default:
  1062. return false;
  1063. }
  1064. }
  1065. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1066. if (!url) {
  1067. return null;
  1068. }
  1069. try {
  1070. if (options && typeof url === "string") {
  1071. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1072. const dots = url.match(/\./g);
  1073. if (dots && dots.length >= 2) {
  1074. url = `http://${url}`;
  1075. }
  1076. }
  1077. if (options.tryConvertEncoding) {
  1078. try {
  1079. url = stringToUTF8String(url);
  1080. } catch (ex) {}
  1081. }
  1082. }
  1083. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1084. if (_isValidProtocol(absoluteUrl)) {
  1085. return absoluteUrl;
  1086. }
  1087. } catch (ex) {}
  1088. return null;
  1089. }
  1090. function shadow(obj, prop, value) {
  1091. Object.defineProperty(obj, prop, {
  1092. value,
  1093. enumerable: true,
  1094. configurable: true,
  1095. writable: false
  1096. });
  1097. return value;
  1098. }
  1099. const BaseException = function BaseExceptionClosure() {
  1100. function BaseException(message, name) {
  1101. if (this.constructor === BaseException) {
  1102. unreachable("Cannot initialize BaseException.");
  1103. }
  1104. this.message = message;
  1105. this.name = name;
  1106. }
  1107. BaseException.prototype = new Error();
  1108. BaseException.constructor = BaseException;
  1109. return BaseException;
  1110. }();
  1111. exports.BaseException = BaseException;
  1112. class PasswordException extends BaseException {
  1113. constructor(msg, code) {
  1114. super(msg, "PasswordException");
  1115. this.code = code;
  1116. }
  1117. }
  1118. exports.PasswordException = PasswordException;
  1119. class UnknownErrorException extends BaseException {
  1120. constructor(msg, details) {
  1121. super(msg, "UnknownErrorException");
  1122. this.details = details;
  1123. }
  1124. }
  1125. exports.UnknownErrorException = UnknownErrorException;
  1126. class InvalidPDFException extends BaseException {
  1127. constructor(msg) {
  1128. super(msg, "InvalidPDFException");
  1129. }
  1130. }
  1131. exports.InvalidPDFException = InvalidPDFException;
  1132. class MissingPDFException extends BaseException {
  1133. constructor(msg) {
  1134. super(msg, "MissingPDFException");
  1135. }
  1136. }
  1137. exports.MissingPDFException = MissingPDFException;
  1138. class UnexpectedResponseException extends BaseException {
  1139. constructor(msg, status) {
  1140. super(msg, "UnexpectedResponseException");
  1141. this.status = status;
  1142. }
  1143. }
  1144. exports.UnexpectedResponseException = UnexpectedResponseException;
  1145. class FormatError extends BaseException {
  1146. constructor(msg) {
  1147. super(msg, "FormatError");
  1148. }
  1149. }
  1150. exports.FormatError = FormatError;
  1151. class AbortException extends BaseException {
  1152. constructor(msg) {
  1153. super(msg, "AbortException");
  1154. }
  1155. }
  1156. exports.AbortException = AbortException;
  1157. function bytesToString(bytes) {
  1158. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1159. unreachable("Invalid argument for bytesToString");
  1160. }
  1161. const length = bytes.length;
  1162. const MAX_ARGUMENT_COUNT = 8192;
  1163. if (length < MAX_ARGUMENT_COUNT) {
  1164. return String.fromCharCode.apply(null, bytes);
  1165. }
  1166. const strBuf = [];
  1167. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1168. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1169. const chunk = bytes.subarray(i, chunkEnd);
  1170. strBuf.push(String.fromCharCode.apply(null, chunk));
  1171. }
  1172. return strBuf.join("");
  1173. }
  1174. function stringToBytes(str) {
  1175. if (typeof str !== "string") {
  1176. unreachable("Invalid argument for stringToBytes");
  1177. }
  1178. const length = str.length;
  1179. const bytes = new Uint8Array(length);
  1180. for (let i = 0; i < length; ++i) {
  1181. bytes[i] = str.charCodeAt(i) & 0xff;
  1182. }
  1183. return bytes;
  1184. }
  1185. function arrayByteLength(arr) {
  1186. if (arr.length !== undefined) {
  1187. return arr.length;
  1188. }
  1189. if (arr.byteLength !== undefined) {
  1190. return arr.byteLength;
  1191. }
  1192. unreachable("Invalid argument for arrayByteLength");
  1193. }
  1194. function arraysToBytes(arr) {
  1195. const length = arr.length;
  1196. if (length === 1 && arr[0] instanceof Uint8Array) {
  1197. return arr[0];
  1198. }
  1199. let resultLength = 0;
  1200. for (let i = 0; i < length; i++) {
  1201. resultLength += arrayByteLength(arr[i]);
  1202. }
  1203. let pos = 0;
  1204. const data = new Uint8Array(resultLength);
  1205. for (let i = 0; i < length; i++) {
  1206. let item = arr[i];
  1207. if (!(item instanceof Uint8Array)) {
  1208. if (typeof item === "string") {
  1209. item = stringToBytes(item);
  1210. } else {
  1211. item = new Uint8Array(item);
  1212. }
  1213. }
  1214. const itemLength = item.byteLength;
  1215. data.set(item, pos);
  1216. pos += itemLength;
  1217. }
  1218. return data;
  1219. }
  1220. function string32(value) {
  1221. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1222. }
  1223. function objectSize(obj) {
  1224. return Object.keys(obj).length;
  1225. }
  1226. function objectFromMap(map) {
  1227. const obj = Object.create(null);
  1228. for (const [key, value] of map) {
  1229. obj[key] = value;
  1230. }
  1231. return obj;
  1232. }
  1233. function isLittleEndian() {
  1234. const buffer8 = new Uint8Array(4);
  1235. buffer8[0] = 1;
  1236. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1237. return view32[0] === 1;
  1238. }
  1239. function isEvalSupported() {
  1240. try {
  1241. new Function("");
  1242. return true;
  1243. } catch (e) {
  1244. return false;
  1245. }
  1246. }
  1247. class FeatureTest {
  1248. static get isLittleEndian() {
  1249. return shadow(this, "isLittleEndian", isLittleEndian());
  1250. }
  1251. static get isEvalSupported() {
  1252. return shadow(this, "isEvalSupported", isEvalSupported());
  1253. }
  1254. static get isOffscreenCanvasSupported() {
  1255. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1256. }
  1257. }
  1258. exports.FeatureTest = FeatureTest;
  1259. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1260. class Util {
  1261. static makeHexColor(r, g, b) {
  1262. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1263. }
  1264. static scaleMinMax(transform, minMax) {
  1265. let temp;
  1266. if (transform[0]) {
  1267. if (transform[0] < 0) {
  1268. temp = minMax[0];
  1269. minMax[0] = minMax[1];
  1270. minMax[1] = temp;
  1271. }
  1272. minMax[0] *= transform[0];
  1273. minMax[1] *= transform[0];
  1274. if (transform[3] < 0) {
  1275. temp = minMax[2];
  1276. minMax[2] = minMax[3];
  1277. minMax[3] = temp;
  1278. }
  1279. minMax[2] *= transform[3];
  1280. minMax[3] *= transform[3];
  1281. } else {
  1282. temp = minMax[0];
  1283. minMax[0] = minMax[2];
  1284. minMax[2] = temp;
  1285. temp = minMax[1];
  1286. minMax[1] = minMax[3];
  1287. minMax[3] = temp;
  1288. if (transform[1] < 0) {
  1289. temp = minMax[2];
  1290. minMax[2] = minMax[3];
  1291. minMax[3] = temp;
  1292. }
  1293. minMax[2] *= transform[1];
  1294. minMax[3] *= transform[1];
  1295. if (transform[2] < 0) {
  1296. temp = minMax[0];
  1297. minMax[0] = minMax[1];
  1298. minMax[1] = temp;
  1299. }
  1300. minMax[0] *= transform[2];
  1301. minMax[1] *= transform[2];
  1302. }
  1303. minMax[0] += transform[4];
  1304. minMax[1] += transform[4];
  1305. minMax[2] += transform[5];
  1306. minMax[3] += transform[5];
  1307. }
  1308. static transform(m1, m2) {
  1309. 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]];
  1310. }
  1311. static applyTransform(p, m) {
  1312. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1313. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1314. return [xt, yt];
  1315. }
  1316. static applyInverseTransform(p, m) {
  1317. const d = m[0] * m[3] - m[1] * m[2];
  1318. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1319. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1320. return [xt, yt];
  1321. }
  1322. static getAxialAlignedBoundingBox(r, m) {
  1323. const p1 = Util.applyTransform(r, m);
  1324. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1325. const p3 = Util.applyTransform([r[0], r[3]], m);
  1326. const p4 = Util.applyTransform([r[2], r[1]], m);
  1327. 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])];
  1328. }
  1329. static inverseTransform(m) {
  1330. const d = m[0] * m[3] - m[1] * m[2];
  1331. 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];
  1332. }
  1333. static apply3dTransform(m, v) {
  1334. return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
  1335. }
  1336. static singularValueDecompose2dScale(m) {
  1337. const transpose = [m[0], m[2], m[1], m[3]];
  1338. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1339. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1340. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1341. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1342. const first = (a + d) / 2;
  1343. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1344. const sx = first + second || 1;
  1345. const sy = first - second || 1;
  1346. return [Math.sqrt(sx), Math.sqrt(sy)];
  1347. }
  1348. static normalizeRect(rect) {
  1349. const r = rect.slice(0);
  1350. if (rect[0] > rect[2]) {
  1351. r[0] = rect[2];
  1352. r[2] = rect[0];
  1353. }
  1354. if (rect[1] > rect[3]) {
  1355. r[1] = rect[3];
  1356. r[3] = rect[1];
  1357. }
  1358. return r;
  1359. }
  1360. static intersect(rect1, rect2) {
  1361. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1362. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1363. if (xLow > xHigh) {
  1364. return null;
  1365. }
  1366. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1367. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1368. if (yLow > yHigh) {
  1369. return null;
  1370. }
  1371. return [xLow, yLow, xHigh, yHigh];
  1372. }
  1373. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1374. const tvalues = [],
  1375. bounds = [[], []];
  1376. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1377. for (let i = 0; i < 2; ++i) {
  1378. if (i === 0) {
  1379. b = 6 * x0 - 12 * x1 + 6 * x2;
  1380. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1381. c = 3 * x1 - 3 * x0;
  1382. } else {
  1383. b = 6 * y0 - 12 * y1 + 6 * y2;
  1384. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1385. c = 3 * y1 - 3 * y0;
  1386. }
  1387. if (Math.abs(a) < 1e-12) {
  1388. if (Math.abs(b) < 1e-12) {
  1389. continue;
  1390. }
  1391. t = -c / b;
  1392. if (0 < t && t < 1) {
  1393. tvalues.push(t);
  1394. }
  1395. continue;
  1396. }
  1397. b2ac = b * b - 4 * c * a;
  1398. sqrtb2ac = Math.sqrt(b2ac);
  1399. if (b2ac < 0) {
  1400. continue;
  1401. }
  1402. t1 = (-b + sqrtb2ac) / (2 * a);
  1403. if (0 < t1 && t1 < 1) {
  1404. tvalues.push(t1);
  1405. }
  1406. t2 = (-b - sqrtb2ac) / (2 * a);
  1407. if (0 < t2 && t2 < 1) {
  1408. tvalues.push(t2);
  1409. }
  1410. }
  1411. let j = tvalues.length,
  1412. mt;
  1413. const jlen = j;
  1414. while (j--) {
  1415. t = tvalues[j];
  1416. mt = 1 - t;
  1417. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1418. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1419. }
  1420. bounds[0][jlen] = x0;
  1421. bounds[1][jlen] = y0;
  1422. bounds[0][jlen + 1] = x3;
  1423. bounds[1][jlen + 1] = y3;
  1424. bounds[0].length = bounds[1].length = jlen + 2;
  1425. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1426. }
  1427. }
  1428. exports.Util = Util;
  1429. 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];
  1430. function stringToPDFString(str) {
  1431. if (str[0] >= "\xEF") {
  1432. let encoding;
  1433. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1434. encoding = "utf-16be";
  1435. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1436. encoding = "utf-16le";
  1437. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1438. encoding = "utf-8";
  1439. }
  1440. if (encoding) {
  1441. try {
  1442. const decoder = new TextDecoder(encoding, {
  1443. fatal: true
  1444. });
  1445. const buffer = stringToBytes(str);
  1446. return decoder.decode(buffer);
  1447. } catch (ex) {
  1448. warn(`stringToPDFString: "${ex}".`);
  1449. }
  1450. }
  1451. }
  1452. const strBuf = [];
  1453. for (let i = 0, ii = str.length; i < ii; i++) {
  1454. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1455. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1456. }
  1457. return strBuf.join("");
  1458. }
  1459. function escapeString(str) {
  1460. return str.replace(/([()\\\n\r])/g, match => {
  1461. if (match === "\n") {
  1462. return "\\n";
  1463. } else if (match === "\r") {
  1464. return "\\r";
  1465. }
  1466. return `\\${match}`;
  1467. });
  1468. }
  1469. function isAscii(str) {
  1470. return /^[\x00-\x7F]*$/.test(str);
  1471. }
  1472. function stringToUTF16BEString(str) {
  1473. const buf = ["\xFE\xFF"];
  1474. for (let i = 0, ii = str.length; i < ii; i++) {
  1475. const char = str.charCodeAt(i);
  1476. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1477. }
  1478. return buf.join("");
  1479. }
  1480. function stringToUTF8String(str) {
  1481. return decodeURIComponent(escape(str));
  1482. }
  1483. function utf8StringToString(str) {
  1484. return unescape(encodeURIComponent(str));
  1485. }
  1486. function isArrayBuffer(v) {
  1487. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1488. }
  1489. function isArrayEqual(arr1, arr2) {
  1490. if (arr1.length !== arr2.length) {
  1491. return false;
  1492. }
  1493. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1494. if (arr1[i] !== arr2[i]) {
  1495. return false;
  1496. }
  1497. }
  1498. return true;
  1499. }
  1500. function getModificationDate(date = new Date()) {
  1501. 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")];
  1502. return buffer.join("");
  1503. }
  1504. function createPromiseCapability() {
  1505. const capability = Object.create(null);
  1506. let isSettled = false;
  1507. Object.defineProperty(capability, "settled", {
  1508. get() {
  1509. return isSettled;
  1510. }
  1511. });
  1512. capability.promise = new Promise(function (resolve, reject) {
  1513. capability.resolve = function (data) {
  1514. isSettled = true;
  1515. resolve(data);
  1516. };
  1517. capability.reject = function (reason) {
  1518. isSettled = true;
  1519. reject(reason);
  1520. };
  1521. });
  1522. return capability;
  1523. }
  1524. /***/ }),
  1525. /* 3 */
  1526. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1527. var _is_node = __w_pdfjs_require__(4);
  1528. ;
  1529. /***/ }),
  1530. /* 4 */
  1531. /***/ ((__unused_webpack_module, exports) => {
  1532. Object.defineProperty(exports, "__esModule", ({
  1533. value: true
  1534. }));
  1535. exports.isNodeJS = void 0;
  1536. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1537. exports.isNodeJS = isNodeJS;
  1538. /***/ }),
  1539. /* 5 */
  1540. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1541. Object.defineProperty(exports, "__esModule", ({
  1542. value: true
  1543. }));
  1544. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1545. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1546. exports.isCmd = isCmd;
  1547. exports.isDict = isDict;
  1548. exports.isName = isName;
  1549. exports.isRefsEqual = isRefsEqual;
  1550. var _util = __w_pdfjs_require__(2);
  1551. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1552. exports.CIRCULAR_REF = CIRCULAR_REF;
  1553. const EOF = Symbol("EOF");
  1554. exports.EOF = EOF;
  1555. const Name = function NameClosure() {
  1556. let nameCache = Object.create(null);
  1557. class Name {
  1558. constructor(name) {
  1559. this.name = name;
  1560. }
  1561. static get(name) {
  1562. return nameCache[name] || (nameCache[name] = new Name(name));
  1563. }
  1564. static _clearCache() {
  1565. nameCache = Object.create(null);
  1566. }
  1567. }
  1568. return Name;
  1569. }();
  1570. exports.Name = Name;
  1571. const Cmd = function CmdClosure() {
  1572. let cmdCache = Object.create(null);
  1573. class Cmd {
  1574. constructor(cmd) {
  1575. this.cmd = cmd;
  1576. }
  1577. static get(cmd) {
  1578. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  1579. }
  1580. static _clearCache() {
  1581. cmdCache = Object.create(null);
  1582. }
  1583. }
  1584. return Cmd;
  1585. }();
  1586. exports.Cmd = Cmd;
  1587. const nonSerializable = function nonSerializableClosure() {
  1588. return nonSerializable;
  1589. };
  1590. class Dict {
  1591. constructor(xref = null) {
  1592. this._map = Object.create(null);
  1593. this.xref = xref;
  1594. this.objId = null;
  1595. this.suppressEncryption = false;
  1596. this.__nonSerializable__ = nonSerializable;
  1597. }
  1598. assignXref(newXref) {
  1599. this.xref = newXref;
  1600. }
  1601. get size() {
  1602. return Object.keys(this._map).length;
  1603. }
  1604. get(key1, key2, key3) {
  1605. let value = this._map[key1];
  1606. if (value === undefined && key2 !== undefined) {
  1607. value = this._map[key2];
  1608. if (value === undefined && key3 !== undefined) {
  1609. value = this._map[key3];
  1610. }
  1611. }
  1612. if (value instanceof Ref && this.xref) {
  1613. return this.xref.fetch(value, this.suppressEncryption);
  1614. }
  1615. return value;
  1616. }
  1617. async getAsync(key1, key2, key3) {
  1618. let value = this._map[key1];
  1619. if (value === undefined && key2 !== undefined) {
  1620. value = this._map[key2];
  1621. if (value === undefined && key3 !== undefined) {
  1622. value = this._map[key3];
  1623. }
  1624. }
  1625. if (value instanceof Ref && this.xref) {
  1626. return this.xref.fetchAsync(value, this.suppressEncryption);
  1627. }
  1628. return value;
  1629. }
  1630. getArray(key1, key2, key3) {
  1631. let value = this._map[key1];
  1632. if (value === undefined && key2 !== undefined) {
  1633. value = this._map[key2];
  1634. if (value === undefined && key3 !== undefined) {
  1635. value = this._map[key3];
  1636. }
  1637. }
  1638. if (value instanceof Ref && this.xref) {
  1639. value = this.xref.fetch(value, this.suppressEncryption);
  1640. }
  1641. if (Array.isArray(value)) {
  1642. value = value.slice();
  1643. for (let i = 0, ii = value.length; i < ii; i++) {
  1644. if (value[i] instanceof Ref && this.xref) {
  1645. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1646. }
  1647. }
  1648. }
  1649. return value;
  1650. }
  1651. getRaw(key) {
  1652. return this._map[key];
  1653. }
  1654. getKeys() {
  1655. return Object.keys(this._map);
  1656. }
  1657. getRawValues() {
  1658. return Object.values(this._map);
  1659. }
  1660. set(key, value) {
  1661. this._map[key] = value;
  1662. }
  1663. has(key) {
  1664. return this._map[key] !== undefined;
  1665. }
  1666. forEach(callback) {
  1667. for (const key in this._map) {
  1668. callback(key, this.get(key));
  1669. }
  1670. }
  1671. static get empty() {
  1672. const emptyDict = new Dict(null);
  1673. emptyDict.set = (key, value) => {
  1674. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1675. };
  1676. return (0, _util.shadow)(this, "empty", emptyDict);
  1677. }
  1678. static merge({
  1679. xref,
  1680. dictArray,
  1681. mergeSubDicts = false
  1682. }) {
  1683. const mergedDict = new Dict(xref),
  1684. properties = new Map();
  1685. for (const dict of dictArray) {
  1686. if (!(dict instanceof Dict)) {
  1687. continue;
  1688. }
  1689. for (const [key, value] of Object.entries(dict._map)) {
  1690. let property = properties.get(key);
  1691. if (property === undefined) {
  1692. property = [];
  1693. properties.set(key, property);
  1694. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1695. continue;
  1696. }
  1697. property.push(value);
  1698. }
  1699. }
  1700. for (const [name, values] of properties) {
  1701. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1702. mergedDict._map[name] = values[0];
  1703. continue;
  1704. }
  1705. const subDict = new Dict(xref);
  1706. for (const dict of values) {
  1707. for (const [key, value] of Object.entries(dict._map)) {
  1708. if (subDict._map[key] === undefined) {
  1709. subDict._map[key] = value;
  1710. }
  1711. }
  1712. }
  1713. if (subDict.size > 0) {
  1714. mergedDict._map[name] = subDict;
  1715. }
  1716. }
  1717. properties.clear();
  1718. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1719. }
  1720. }
  1721. exports.Dict = Dict;
  1722. const Ref = function RefClosure() {
  1723. let refCache = Object.create(null);
  1724. class Ref {
  1725. constructor(num, gen) {
  1726. this.num = num;
  1727. this.gen = gen;
  1728. }
  1729. toString() {
  1730. if (this.gen === 0) {
  1731. return `${this.num}R`;
  1732. }
  1733. return `${this.num}R${this.gen}`;
  1734. }
  1735. static get(num, gen) {
  1736. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1737. return refCache[key] || (refCache[key] = new Ref(num, gen));
  1738. }
  1739. static _clearCache() {
  1740. refCache = Object.create(null);
  1741. }
  1742. }
  1743. return Ref;
  1744. }();
  1745. exports.Ref = Ref;
  1746. class RefSet {
  1747. constructor(parent = null) {
  1748. this._set = new Set(parent && parent._set);
  1749. }
  1750. has(ref) {
  1751. return this._set.has(ref.toString());
  1752. }
  1753. put(ref) {
  1754. this._set.add(ref.toString());
  1755. }
  1756. remove(ref) {
  1757. this._set.delete(ref.toString());
  1758. }
  1759. [Symbol.iterator]() {
  1760. return this._set.values();
  1761. }
  1762. clear() {
  1763. this._set.clear();
  1764. }
  1765. }
  1766. exports.RefSet = RefSet;
  1767. class RefSetCache {
  1768. constructor() {
  1769. this._map = new Map();
  1770. }
  1771. get size() {
  1772. return this._map.size;
  1773. }
  1774. get(ref) {
  1775. return this._map.get(ref.toString());
  1776. }
  1777. has(ref) {
  1778. return this._map.has(ref.toString());
  1779. }
  1780. put(ref, obj) {
  1781. this._map.set(ref.toString(), obj);
  1782. }
  1783. putAlias(ref, aliasRef) {
  1784. this._map.set(ref.toString(), this.get(aliasRef));
  1785. }
  1786. [Symbol.iterator]() {
  1787. return this._map.values();
  1788. }
  1789. clear() {
  1790. this._map.clear();
  1791. }
  1792. }
  1793. exports.RefSetCache = RefSetCache;
  1794. function isName(v, name) {
  1795. return v instanceof Name && (name === undefined || v.name === name);
  1796. }
  1797. function isCmd(v, cmd) {
  1798. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1799. }
  1800. function isDict(v, type) {
  1801. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1802. }
  1803. function isRefsEqual(v1, v2) {
  1804. return v1.num === v2.num && v1.gen === v2.gen;
  1805. }
  1806. function clearPrimitiveCaches() {
  1807. Cmd._clearCache();
  1808. Name._clearCache();
  1809. Ref._clearCache();
  1810. }
  1811. /***/ }),
  1812. /* 6 */
  1813. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1814. Object.defineProperty(exports, "__esModule", ({
  1815. value: true
  1816. }));
  1817. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0;
  1818. exports.collectActions = collectActions;
  1819. exports.encodeToXmlString = encodeToXmlString;
  1820. exports.escapePDFName = escapePDFName;
  1821. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  1822. exports.getInheritableProperty = getInheritableProperty;
  1823. exports.getLookupTableFactory = getLookupTableFactory;
  1824. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  1825. exports.isWhiteSpace = isWhiteSpace;
  1826. exports.log2 = log2;
  1827. exports.numberToString = numberToString;
  1828. exports.parseXFAPath = parseXFAPath;
  1829. exports.readInt8 = readInt8;
  1830. exports.readUint16 = readUint16;
  1831. exports.readUint32 = readUint32;
  1832. exports.recoverJsURL = recoverJsURL;
  1833. exports.toRomanNumerals = toRomanNumerals;
  1834. exports.validateCSSFont = validateCSSFont;
  1835. var _util = __w_pdfjs_require__(2);
  1836. var _primitives = __w_pdfjs_require__(5);
  1837. var _base_stream = __w_pdfjs_require__(7);
  1838. function getLookupTableFactory(initializer) {
  1839. let lookup;
  1840. return function () {
  1841. if (initializer) {
  1842. lookup = Object.create(null);
  1843. initializer(lookup);
  1844. initializer = null;
  1845. }
  1846. return lookup;
  1847. };
  1848. }
  1849. function getArrayLookupTableFactory(initializer) {
  1850. let lookup;
  1851. return function () {
  1852. if (initializer) {
  1853. let arr = initializer();
  1854. initializer = null;
  1855. lookup = Object.create(null);
  1856. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  1857. lookup[arr[i]] = arr[i + 1];
  1858. }
  1859. arr = null;
  1860. }
  1861. return lookup;
  1862. };
  1863. }
  1864. class MissingDataException extends _util.BaseException {
  1865. constructor(begin, end) {
  1866. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  1867. this.begin = begin;
  1868. this.end = end;
  1869. }
  1870. }
  1871. exports.MissingDataException = MissingDataException;
  1872. class ParserEOFException extends _util.BaseException {
  1873. constructor(msg) {
  1874. super(msg, "ParserEOFException");
  1875. }
  1876. }
  1877. exports.ParserEOFException = ParserEOFException;
  1878. class XRefEntryException extends _util.BaseException {
  1879. constructor(msg) {
  1880. super(msg, "XRefEntryException");
  1881. }
  1882. }
  1883. exports.XRefEntryException = XRefEntryException;
  1884. class XRefParseException extends _util.BaseException {
  1885. constructor(msg) {
  1886. super(msg, "XRefParseException");
  1887. }
  1888. }
  1889. exports.XRefParseException = XRefParseException;
  1890. class DocStats {
  1891. constructor(handler) {
  1892. this._handler = handler;
  1893. this._streamTypes = new Set();
  1894. this._fontTypes = new Set();
  1895. }
  1896. _send() {
  1897. const streamTypes = Object.create(null),
  1898. fontTypes = Object.create(null);
  1899. for (const type of this._streamTypes) {
  1900. streamTypes[type] = true;
  1901. }
  1902. for (const type of this._fontTypes) {
  1903. fontTypes[type] = true;
  1904. }
  1905. this._handler.send("DocStats", {
  1906. streamTypes,
  1907. fontTypes
  1908. });
  1909. }
  1910. addStreamType(type) {
  1911. if (this._streamTypes.has(type)) {
  1912. return;
  1913. }
  1914. this._streamTypes.add(type);
  1915. this._send();
  1916. }
  1917. addFontType(type) {
  1918. if (this._fontTypes.has(type)) {
  1919. return;
  1920. }
  1921. this._fontTypes.add(type);
  1922. this._send();
  1923. }
  1924. }
  1925. exports.DocStats = DocStats;
  1926. function getInheritableProperty({
  1927. dict,
  1928. key,
  1929. getArray = false,
  1930. stopWhenFound = true
  1931. }) {
  1932. let values;
  1933. const visited = new _primitives.RefSet();
  1934. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  1935. if (dict.objId) {
  1936. visited.put(dict.objId);
  1937. }
  1938. const value = getArray ? dict.getArray(key) : dict.get(key);
  1939. if (value !== undefined) {
  1940. if (stopWhenFound) {
  1941. return value;
  1942. }
  1943. if (!values) {
  1944. values = [];
  1945. }
  1946. values.push(value);
  1947. }
  1948. dict = dict.get("Parent");
  1949. }
  1950. return values;
  1951. }
  1952. 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"];
  1953. function toRomanNumerals(number, lowerCase = false) {
  1954. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  1955. const romanBuf = [];
  1956. let pos;
  1957. while (number >= 1000) {
  1958. number -= 1000;
  1959. romanBuf.push("M");
  1960. }
  1961. pos = number / 100 | 0;
  1962. number %= 100;
  1963. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  1964. pos = number / 10 | 0;
  1965. number %= 10;
  1966. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  1967. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  1968. const romanStr = romanBuf.join("");
  1969. return lowerCase ? romanStr.toLowerCase() : romanStr;
  1970. }
  1971. function log2(x) {
  1972. if (x <= 0) {
  1973. return 0;
  1974. }
  1975. return Math.ceil(Math.log2(x));
  1976. }
  1977. function readInt8(data, offset) {
  1978. return data[offset] << 24 >> 24;
  1979. }
  1980. function readUint16(data, offset) {
  1981. return data[offset] << 8 | data[offset + 1];
  1982. }
  1983. function readUint32(data, offset) {
  1984. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  1985. }
  1986. function isWhiteSpace(ch) {
  1987. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  1988. }
  1989. function parseXFAPath(path) {
  1990. const positionPattern = /(.+)\[(\d+)\]$/;
  1991. return path.split(".").map(component => {
  1992. const m = component.match(positionPattern);
  1993. if (m) {
  1994. return {
  1995. name: m[1],
  1996. pos: parseInt(m[2], 10)
  1997. };
  1998. }
  1999. return {
  2000. name: component,
  2001. pos: 0
  2002. };
  2003. });
  2004. }
  2005. function escapePDFName(str) {
  2006. const buffer = [];
  2007. let start = 0;
  2008. for (let i = 0, ii = str.length; i < ii; i++) {
  2009. const char = str.charCodeAt(i);
  2010. 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) {
  2011. if (start < i) {
  2012. buffer.push(str.substring(start, i));
  2013. }
  2014. buffer.push(`#${char.toString(16)}`);
  2015. start = i + 1;
  2016. }
  2017. }
  2018. if (buffer.length === 0) {
  2019. return str;
  2020. }
  2021. if (start < str.length) {
  2022. buffer.push(str.substring(start, str.length));
  2023. }
  2024. return buffer.join("");
  2025. }
  2026. function _collectJS(entry, xref, list, parents) {
  2027. if (!entry) {
  2028. return;
  2029. }
  2030. let parent = null;
  2031. if (entry instanceof _primitives.Ref) {
  2032. if (parents.has(entry)) {
  2033. return;
  2034. }
  2035. parent = entry;
  2036. parents.put(parent);
  2037. entry = xref.fetch(entry);
  2038. }
  2039. if (Array.isArray(entry)) {
  2040. for (const element of entry) {
  2041. _collectJS(element, xref, list, parents);
  2042. }
  2043. } else if (entry instanceof _primitives.Dict) {
  2044. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2045. const js = entry.get("JS");
  2046. let code;
  2047. if (js instanceof _base_stream.BaseStream) {
  2048. code = js.getString();
  2049. } else if (typeof js === "string") {
  2050. code = js;
  2051. }
  2052. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  2053. if (code) {
  2054. list.push(code);
  2055. }
  2056. }
  2057. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2058. }
  2059. if (parent) {
  2060. parents.remove(parent);
  2061. }
  2062. }
  2063. function collectActions(xref, dict, eventType) {
  2064. const actions = Object.create(null);
  2065. const additionalActionsDicts = getInheritableProperty({
  2066. dict,
  2067. key: "AA",
  2068. stopWhenFound: false
  2069. });
  2070. if (additionalActionsDicts) {
  2071. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2072. const additionalActions = additionalActionsDicts[i];
  2073. if (!(additionalActions instanceof _primitives.Dict)) {
  2074. continue;
  2075. }
  2076. for (const key of additionalActions.getKeys()) {
  2077. const action = eventType[key];
  2078. if (!action) {
  2079. continue;
  2080. }
  2081. const actionDict = additionalActions.getRaw(key);
  2082. const parents = new _primitives.RefSet();
  2083. const list = [];
  2084. _collectJS(actionDict, xref, list, parents);
  2085. if (list.length > 0) {
  2086. actions[action] = list;
  2087. }
  2088. }
  2089. }
  2090. }
  2091. if (dict.has("A")) {
  2092. const actionDict = dict.get("A");
  2093. const parents = new _primitives.RefSet();
  2094. const list = [];
  2095. _collectJS(actionDict, xref, list, parents);
  2096. if (list.length > 0) {
  2097. actions.Action = list;
  2098. }
  2099. }
  2100. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2101. }
  2102. const XMLEntities = {
  2103. 0x3c: "&lt;",
  2104. 0x3e: "&gt;",
  2105. 0x26: "&amp;",
  2106. 0x22: "&quot;",
  2107. 0x27: "&apos;"
  2108. };
  2109. function encodeToXmlString(str) {
  2110. const buffer = [];
  2111. let start = 0;
  2112. for (let i = 0, ii = str.length; i < ii; i++) {
  2113. const char = str.codePointAt(i);
  2114. if (0x20 <= char && char <= 0x7e) {
  2115. const entity = XMLEntities[char];
  2116. if (entity) {
  2117. if (start < i) {
  2118. buffer.push(str.substring(start, i));
  2119. }
  2120. buffer.push(entity);
  2121. start = i + 1;
  2122. }
  2123. } else {
  2124. if (start < i) {
  2125. buffer.push(str.substring(start, i));
  2126. }
  2127. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2128. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2129. i++;
  2130. }
  2131. start = i + 1;
  2132. }
  2133. }
  2134. if (buffer.length === 0) {
  2135. return str;
  2136. }
  2137. if (start < str.length) {
  2138. buffer.push(str.substring(start, str.length));
  2139. }
  2140. return buffer.join("");
  2141. }
  2142. function validateCSSFont(cssFontInfo) {
  2143. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2144. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2145. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2146. const {
  2147. fontFamily,
  2148. fontWeight,
  2149. italicAngle
  2150. } = cssFontInfo;
  2151. if (/^".*"$/.test(fontFamily)) {
  2152. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2153. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2154. return false;
  2155. }
  2156. } else if (/^'.*'$/.test(fontFamily)) {
  2157. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2158. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2159. return false;
  2160. }
  2161. } else {
  2162. for (const ident of fontFamily.split(/[ \t]+/)) {
  2163. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2164. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2165. return false;
  2166. }
  2167. }
  2168. }
  2169. const weight = fontWeight ? fontWeight.toString() : "";
  2170. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2171. const angle = parseFloat(italicAngle);
  2172. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2173. return true;
  2174. }
  2175. function recoverJsURL(str) {
  2176. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2177. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2178. const jsUrl = regex.exec(str);
  2179. if (jsUrl && jsUrl[2]) {
  2180. const url = jsUrl[2];
  2181. let newWindow = false;
  2182. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2183. newWindow = true;
  2184. }
  2185. return {
  2186. url,
  2187. newWindow
  2188. };
  2189. }
  2190. return null;
  2191. }
  2192. function numberToString(value) {
  2193. if (Number.isInteger(value)) {
  2194. return value.toString();
  2195. }
  2196. const roundedValue = Math.round(value * 100);
  2197. if (roundedValue % 100 === 0) {
  2198. return (roundedValue / 100).toString();
  2199. }
  2200. if (roundedValue % 10 === 0) {
  2201. return value.toFixed(1);
  2202. }
  2203. return value.toFixed(2);
  2204. }
  2205. function getNewAnnotationsMap(annotationStorage) {
  2206. if (!annotationStorage) {
  2207. return null;
  2208. }
  2209. const newAnnotationsByPage = new Map();
  2210. for (const [key, value] of annotationStorage) {
  2211. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  2212. continue;
  2213. }
  2214. let annotations = newAnnotationsByPage.get(value.pageIndex);
  2215. if (!annotations) {
  2216. annotations = [];
  2217. newAnnotationsByPage.set(value.pageIndex, annotations);
  2218. }
  2219. annotations.push(value);
  2220. }
  2221. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  2222. }
  2223. /***/ }),
  2224. /* 7 */
  2225. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2226. Object.defineProperty(exports, "__esModule", ({
  2227. value: true
  2228. }));
  2229. exports.BaseStream = void 0;
  2230. var _util = __w_pdfjs_require__(2);
  2231. class BaseStream {
  2232. constructor() {
  2233. if (this.constructor === BaseStream) {
  2234. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2235. }
  2236. }
  2237. get length() {
  2238. (0, _util.unreachable)("Abstract getter `length` accessed");
  2239. }
  2240. get isEmpty() {
  2241. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2242. }
  2243. get isDataLoaded() {
  2244. return (0, _util.shadow)(this, "isDataLoaded", true);
  2245. }
  2246. getByte() {
  2247. (0, _util.unreachable)("Abstract method `getByte` called");
  2248. }
  2249. getBytes(length) {
  2250. (0, _util.unreachable)("Abstract method `getBytes` called");
  2251. }
  2252. peekByte() {
  2253. const peekedByte = this.getByte();
  2254. if (peekedByte !== -1) {
  2255. this.pos--;
  2256. }
  2257. return peekedByte;
  2258. }
  2259. peekBytes(length) {
  2260. const bytes = this.getBytes(length);
  2261. this.pos -= bytes.length;
  2262. return bytes;
  2263. }
  2264. getUint16() {
  2265. const b0 = this.getByte();
  2266. const b1 = this.getByte();
  2267. if (b0 === -1 || b1 === -1) {
  2268. return -1;
  2269. }
  2270. return (b0 << 8) + b1;
  2271. }
  2272. getInt32() {
  2273. const b0 = this.getByte();
  2274. const b1 = this.getByte();
  2275. const b2 = this.getByte();
  2276. const b3 = this.getByte();
  2277. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2278. }
  2279. getByteRange(begin, end) {
  2280. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2281. }
  2282. getString(length) {
  2283. return (0, _util.bytesToString)(this.getBytes(length));
  2284. }
  2285. skip(n) {
  2286. this.pos += n || 1;
  2287. }
  2288. reset() {
  2289. (0, _util.unreachable)("Abstract method `reset` called");
  2290. }
  2291. moveStart() {
  2292. (0, _util.unreachable)("Abstract method `moveStart` called");
  2293. }
  2294. makeSubStream(start, length, dict = null) {
  2295. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2296. }
  2297. getBaseStreams() {
  2298. return null;
  2299. }
  2300. }
  2301. exports.BaseStream = BaseStream;
  2302. /***/ }),
  2303. /* 8 */
  2304. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2305. Object.defineProperty(exports, "__esModule", ({
  2306. value: true
  2307. }));
  2308. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  2309. var _util = __w_pdfjs_require__(2);
  2310. var _chunked_stream = __w_pdfjs_require__(9);
  2311. var _core_utils = __w_pdfjs_require__(6);
  2312. var _document = __w_pdfjs_require__(11);
  2313. var _stream = __w_pdfjs_require__(10);
  2314. function parseDocBaseUrl(url) {
  2315. if (url) {
  2316. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  2317. if (absoluteUrl) {
  2318. return absoluteUrl.href;
  2319. }
  2320. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  2321. }
  2322. return null;
  2323. }
  2324. class BasePdfManager {
  2325. constructor() {
  2326. if (this.constructor === BasePdfManager) {
  2327. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  2328. }
  2329. }
  2330. get docId() {
  2331. return this._docId;
  2332. }
  2333. get password() {
  2334. return this._password;
  2335. }
  2336. get docBaseUrl() {
  2337. const catalog = this.pdfDocument.catalog;
  2338. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  2339. }
  2340. onLoadedStream() {
  2341. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  2342. }
  2343. ensureDoc(prop, args) {
  2344. return this.ensure(this.pdfDocument, prop, args);
  2345. }
  2346. ensureXRef(prop, args) {
  2347. return this.ensure(this.pdfDocument.xref, prop, args);
  2348. }
  2349. ensureCatalog(prop, args) {
  2350. return this.ensure(this.pdfDocument.catalog, prop, args);
  2351. }
  2352. getPage(pageIndex) {
  2353. return this.pdfDocument.getPage(pageIndex);
  2354. }
  2355. fontFallback(id, handler) {
  2356. return this.pdfDocument.fontFallback(id, handler);
  2357. }
  2358. loadXfaFonts(handler, task) {
  2359. return this.pdfDocument.loadXfaFonts(handler, task);
  2360. }
  2361. loadXfaImages() {
  2362. return this.pdfDocument.loadXfaImages();
  2363. }
  2364. serializeXfaData(annotationStorage) {
  2365. return this.pdfDocument.serializeXfaData(annotationStorage);
  2366. }
  2367. cleanup(manuallyTriggered = false) {
  2368. return this.pdfDocument.cleanup(manuallyTriggered);
  2369. }
  2370. async ensure(obj, prop, args) {
  2371. (0, _util.unreachable)("Abstract method `ensure` called");
  2372. }
  2373. requestRange(begin, end) {
  2374. (0, _util.unreachable)("Abstract method `requestRange` called");
  2375. }
  2376. requestLoadedStream() {
  2377. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  2378. }
  2379. sendProgressiveData(chunk) {
  2380. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  2381. }
  2382. updatePassword(password) {
  2383. this._password = password;
  2384. }
  2385. terminate(reason) {
  2386. (0, _util.unreachable)("Abstract method `terminate` called");
  2387. }
  2388. }
  2389. class LocalPdfManager extends BasePdfManager {
  2390. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  2391. super();
  2392. this._docId = docId;
  2393. this._password = password;
  2394. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2395. this.msgHandler = msgHandler;
  2396. this.evaluatorOptions = evaluatorOptions;
  2397. this.enableXfa = enableXfa;
  2398. const stream = new _stream.Stream(data);
  2399. this.pdfDocument = new _document.PDFDocument(this, stream);
  2400. this._loadedStreamPromise = Promise.resolve(stream);
  2401. }
  2402. async ensure(obj, prop, args) {
  2403. const value = obj[prop];
  2404. if (typeof value === "function") {
  2405. return value.apply(obj, args);
  2406. }
  2407. return value;
  2408. }
  2409. requestRange(begin, end) {
  2410. return Promise.resolve();
  2411. }
  2412. requestLoadedStream() {}
  2413. onLoadedStream() {
  2414. return this._loadedStreamPromise;
  2415. }
  2416. terminate(reason) {}
  2417. }
  2418. exports.LocalPdfManager = LocalPdfManager;
  2419. class NetworkPdfManager extends BasePdfManager {
  2420. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  2421. super();
  2422. this._docId = docId;
  2423. this._password = args.password;
  2424. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  2425. this.msgHandler = args.msgHandler;
  2426. this.evaluatorOptions = evaluatorOptions;
  2427. this.enableXfa = enableXfa;
  2428. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  2429. msgHandler: args.msgHandler,
  2430. length: args.length,
  2431. disableAutoFetch: args.disableAutoFetch,
  2432. rangeChunkSize: args.rangeChunkSize
  2433. });
  2434. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  2435. }
  2436. async ensure(obj, prop, args) {
  2437. try {
  2438. const value = obj[prop];
  2439. if (typeof value === "function") {
  2440. return value.apply(obj, args);
  2441. }
  2442. return value;
  2443. } catch (ex) {
  2444. if (!(ex instanceof _core_utils.MissingDataException)) {
  2445. throw ex;
  2446. }
  2447. await this.requestRange(ex.begin, ex.end);
  2448. return this.ensure(obj, prop, args);
  2449. }
  2450. }
  2451. requestRange(begin, end) {
  2452. return this.streamManager.requestRange(begin, end);
  2453. }
  2454. requestLoadedStream() {
  2455. this.streamManager.requestAllChunks();
  2456. }
  2457. sendProgressiveData(chunk) {
  2458. this.streamManager.onReceiveData({
  2459. chunk
  2460. });
  2461. }
  2462. onLoadedStream() {
  2463. return this.streamManager.onLoadedStream();
  2464. }
  2465. terminate(reason) {
  2466. this.streamManager.abort(reason);
  2467. }
  2468. }
  2469. exports.NetworkPdfManager = NetworkPdfManager;
  2470. /***/ }),
  2471. /* 9 */
  2472. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2473. Object.defineProperty(exports, "__esModule", ({
  2474. value: true
  2475. }));
  2476. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2477. var _util = __w_pdfjs_require__(2);
  2478. var _core_utils = __w_pdfjs_require__(6);
  2479. var _stream = __w_pdfjs_require__(10);
  2480. class ChunkedStream extends _stream.Stream {
  2481. constructor(length, chunkSize, manager) {
  2482. super(new Uint8Array(length), 0, length, null);
  2483. this.chunkSize = chunkSize;
  2484. this._loadedChunks = new Set();
  2485. this.numChunks = Math.ceil(length / chunkSize);
  2486. this.manager = manager;
  2487. this.progressiveDataLength = 0;
  2488. this.lastSuccessfulEnsureByteChunk = -1;
  2489. }
  2490. getMissingChunks() {
  2491. const chunks = [];
  2492. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2493. if (!this._loadedChunks.has(chunk)) {
  2494. chunks.push(chunk);
  2495. }
  2496. }
  2497. return chunks;
  2498. }
  2499. get numChunksLoaded() {
  2500. return this._loadedChunks.size;
  2501. }
  2502. get isDataLoaded() {
  2503. return this.numChunksLoaded === this.numChunks;
  2504. }
  2505. onReceiveData(begin, chunk) {
  2506. const chunkSize = this.chunkSize;
  2507. if (begin % chunkSize !== 0) {
  2508. throw new Error(`Bad begin offset: ${begin}`);
  2509. }
  2510. const end = begin + chunk.byteLength;
  2511. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2512. throw new Error(`Bad end offset: ${end}`);
  2513. }
  2514. this.bytes.set(new Uint8Array(chunk), begin);
  2515. const beginChunk = Math.floor(begin / chunkSize);
  2516. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2517. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2518. this._loadedChunks.add(curChunk);
  2519. }
  2520. }
  2521. onReceiveProgressiveData(data) {
  2522. let position = this.progressiveDataLength;
  2523. const beginChunk = Math.floor(position / this.chunkSize);
  2524. this.bytes.set(new Uint8Array(data), position);
  2525. position += data.byteLength;
  2526. this.progressiveDataLength = position;
  2527. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2528. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2529. this._loadedChunks.add(curChunk);
  2530. }
  2531. }
  2532. ensureByte(pos) {
  2533. if (pos < this.progressiveDataLength) {
  2534. return;
  2535. }
  2536. const chunk = Math.floor(pos / this.chunkSize);
  2537. if (chunk > this.numChunks) {
  2538. return;
  2539. }
  2540. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2541. return;
  2542. }
  2543. if (!this._loadedChunks.has(chunk)) {
  2544. throw new _core_utils.MissingDataException(pos, pos + 1);
  2545. }
  2546. this.lastSuccessfulEnsureByteChunk = chunk;
  2547. }
  2548. ensureRange(begin, end) {
  2549. if (begin >= end) {
  2550. return;
  2551. }
  2552. if (end <= this.progressiveDataLength) {
  2553. return;
  2554. }
  2555. const beginChunk = Math.floor(begin / this.chunkSize);
  2556. if (beginChunk > this.numChunks) {
  2557. return;
  2558. }
  2559. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2560. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2561. if (!this._loadedChunks.has(chunk)) {
  2562. throw new _core_utils.MissingDataException(begin, end);
  2563. }
  2564. }
  2565. }
  2566. nextEmptyChunk(beginChunk) {
  2567. const numChunks = this.numChunks;
  2568. for (let i = 0; i < numChunks; ++i) {
  2569. const chunk = (beginChunk + i) % numChunks;
  2570. if (!this._loadedChunks.has(chunk)) {
  2571. return chunk;
  2572. }
  2573. }
  2574. return null;
  2575. }
  2576. hasChunk(chunk) {
  2577. return this._loadedChunks.has(chunk);
  2578. }
  2579. getByte() {
  2580. const pos = this.pos;
  2581. if (pos >= this.end) {
  2582. return -1;
  2583. }
  2584. if (pos >= this.progressiveDataLength) {
  2585. this.ensureByte(pos);
  2586. }
  2587. return this.bytes[this.pos++];
  2588. }
  2589. getBytes(length) {
  2590. const bytes = this.bytes;
  2591. const pos = this.pos;
  2592. const strEnd = this.end;
  2593. if (!length) {
  2594. if (strEnd > this.progressiveDataLength) {
  2595. this.ensureRange(pos, strEnd);
  2596. }
  2597. return bytes.subarray(pos, strEnd);
  2598. }
  2599. let end = pos + length;
  2600. if (end > strEnd) {
  2601. end = strEnd;
  2602. }
  2603. if (end > this.progressiveDataLength) {
  2604. this.ensureRange(pos, end);
  2605. }
  2606. this.pos = end;
  2607. return bytes.subarray(pos, end);
  2608. }
  2609. getByteRange(begin, end) {
  2610. if (begin < 0) {
  2611. begin = 0;
  2612. }
  2613. if (end > this.end) {
  2614. end = this.end;
  2615. }
  2616. if (end > this.progressiveDataLength) {
  2617. this.ensureRange(begin, end);
  2618. }
  2619. return this.bytes.subarray(begin, end);
  2620. }
  2621. makeSubStream(start, length, dict = null) {
  2622. if (length) {
  2623. if (start + length > this.progressiveDataLength) {
  2624. this.ensureRange(start, start + length);
  2625. }
  2626. } else {
  2627. if (start >= this.progressiveDataLength) {
  2628. this.ensureByte(start);
  2629. }
  2630. }
  2631. function ChunkedStreamSubstream() {}
  2632. ChunkedStreamSubstream.prototype = Object.create(this);
  2633. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2634. const chunkSize = this.chunkSize;
  2635. const beginChunk = Math.floor(this.start / chunkSize);
  2636. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2637. const missingChunks = [];
  2638. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2639. if (!this._loadedChunks.has(chunk)) {
  2640. missingChunks.push(chunk);
  2641. }
  2642. }
  2643. return missingChunks;
  2644. };
  2645. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2646. get() {
  2647. if (this.numChunksLoaded === this.numChunks) {
  2648. return true;
  2649. }
  2650. return this.getMissingChunks().length === 0;
  2651. },
  2652. configurable: true
  2653. });
  2654. const subStream = new ChunkedStreamSubstream();
  2655. subStream.pos = subStream.start = start;
  2656. subStream.end = start + length || this.end;
  2657. subStream.dict = dict;
  2658. return subStream;
  2659. }
  2660. getBaseStreams() {
  2661. return [this];
  2662. }
  2663. }
  2664. exports.ChunkedStream = ChunkedStream;
  2665. class ChunkedStreamManager {
  2666. constructor(pdfNetworkStream, args) {
  2667. this.length = args.length;
  2668. this.chunkSize = args.rangeChunkSize;
  2669. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2670. this.pdfNetworkStream = pdfNetworkStream;
  2671. this.disableAutoFetch = args.disableAutoFetch;
  2672. this.msgHandler = args.msgHandler;
  2673. this.currRequestId = 0;
  2674. this._chunksNeededByRequest = new Map();
  2675. this._requestsByChunk = new Map();
  2676. this._promisesByRequest = new Map();
  2677. this.progressiveDataLength = 0;
  2678. this.aborted = false;
  2679. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2680. }
  2681. onLoadedStream() {
  2682. return this._loadedStreamCapability.promise;
  2683. }
  2684. sendRequest(begin, end) {
  2685. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2686. if (!rangeReader.isStreamingSupported) {
  2687. rangeReader.onProgress = this.onProgress.bind(this);
  2688. }
  2689. let chunks = [],
  2690. loaded = 0;
  2691. return new Promise((resolve, reject) => {
  2692. const readChunk = chunk => {
  2693. try {
  2694. if (!chunk.done) {
  2695. const data = chunk.value;
  2696. chunks.push(data);
  2697. loaded += (0, _util.arrayByteLength)(data);
  2698. if (rangeReader.isStreamingSupported) {
  2699. this.onProgress({
  2700. loaded
  2701. });
  2702. }
  2703. rangeReader.read().then(readChunk, reject);
  2704. return;
  2705. }
  2706. const chunkData = (0, _util.arraysToBytes)(chunks);
  2707. chunks = null;
  2708. resolve(chunkData);
  2709. } catch (e) {
  2710. reject(e);
  2711. }
  2712. };
  2713. rangeReader.read().then(readChunk, reject);
  2714. }).then(data => {
  2715. if (this.aborted) {
  2716. return;
  2717. }
  2718. this.onReceiveData({
  2719. chunk: data,
  2720. begin
  2721. });
  2722. });
  2723. }
  2724. requestAllChunks() {
  2725. const missingChunks = this.stream.getMissingChunks();
  2726. this._requestChunks(missingChunks);
  2727. return this._loadedStreamCapability.promise;
  2728. }
  2729. _requestChunks(chunks) {
  2730. const requestId = this.currRequestId++;
  2731. const chunksNeeded = new Set();
  2732. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2733. for (const chunk of chunks) {
  2734. if (!this.stream.hasChunk(chunk)) {
  2735. chunksNeeded.add(chunk);
  2736. }
  2737. }
  2738. if (chunksNeeded.size === 0) {
  2739. return Promise.resolve();
  2740. }
  2741. const capability = (0, _util.createPromiseCapability)();
  2742. this._promisesByRequest.set(requestId, capability);
  2743. const chunksToRequest = [];
  2744. for (const chunk of chunksNeeded) {
  2745. let requestIds = this._requestsByChunk.get(chunk);
  2746. if (!requestIds) {
  2747. requestIds = [];
  2748. this._requestsByChunk.set(chunk, requestIds);
  2749. chunksToRequest.push(chunk);
  2750. }
  2751. requestIds.push(requestId);
  2752. }
  2753. if (chunksToRequest.length > 0) {
  2754. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2755. for (const groupedChunk of groupedChunksToRequest) {
  2756. const begin = groupedChunk.beginChunk * this.chunkSize;
  2757. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2758. this.sendRequest(begin, end).catch(capability.reject);
  2759. }
  2760. }
  2761. return capability.promise.catch(reason => {
  2762. if (this.aborted) {
  2763. return;
  2764. }
  2765. throw reason;
  2766. });
  2767. }
  2768. getStream() {
  2769. return this.stream;
  2770. }
  2771. requestRange(begin, end) {
  2772. end = Math.min(end, this.length);
  2773. const beginChunk = this.getBeginChunk(begin);
  2774. const endChunk = this.getEndChunk(end);
  2775. const chunks = [];
  2776. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2777. chunks.push(chunk);
  2778. }
  2779. return this._requestChunks(chunks);
  2780. }
  2781. requestRanges(ranges = []) {
  2782. const chunksToRequest = [];
  2783. for (const range of ranges) {
  2784. const beginChunk = this.getBeginChunk(range.begin);
  2785. const endChunk = this.getEndChunk(range.end);
  2786. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2787. if (!chunksToRequest.includes(chunk)) {
  2788. chunksToRequest.push(chunk);
  2789. }
  2790. }
  2791. }
  2792. chunksToRequest.sort(function (a, b) {
  2793. return a - b;
  2794. });
  2795. return this._requestChunks(chunksToRequest);
  2796. }
  2797. groupChunks(chunks) {
  2798. const groupedChunks = [];
  2799. let beginChunk = -1;
  2800. let prevChunk = -1;
  2801. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2802. const chunk = chunks[i];
  2803. if (beginChunk < 0) {
  2804. beginChunk = chunk;
  2805. }
  2806. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2807. groupedChunks.push({
  2808. beginChunk,
  2809. endChunk: prevChunk + 1
  2810. });
  2811. beginChunk = chunk;
  2812. }
  2813. if (i + 1 === chunks.length) {
  2814. groupedChunks.push({
  2815. beginChunk,
  2816. endChunk: chunk + 1
  2817. });
  2818. }
  2819. prevChunk = chunk;
  2820. }
  2821. return groupedChunks;
  2822. }
  2823. onProgress(args) {
  2824. this.msgHandler.send("DocProgress", {
  2825. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2826. total: this.length
  2827. });
  2828. }
  2829. onReceiveData(args) {
  2830. const chunk = args.chunk;
  2831. const isProgressive = args.begin === undefined;
  2832. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2833. const end = begin + chunk.byteLength;
  2834. const beginChunk = Math.floor(begin / this.chunkSize);
  2835. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2836. if (isProgressive) {
  2837. this.stream.onReceiveProgressiveData(chunk);
  2838. this.progressiveDataLength = end;
  2839. } else {
  2840. this.stream.onReceiveData(begin, chunk);
  2841. }
  2842. if (this.stream.isDataLoaded) {
  2843. this._loadedStreamCapability.resolve(this.stream);
  2844. }
  2845. const loadedRequests = [];
  2846. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2847. const requestIds = this._requestsByChunk.get(curChunk);
  2848. if (!requestIds) {
  2849. continue;
  2850. }
  2851. this._requestsByChunk.delete(curChunk);
  2852. for (const requestId of requestIds) {
  2853. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2854. if (chunksNeeded.has(curChunk)) {
  2855. chunksNeeded.delete(curChunk);
  2856. }
  2857. if (chunksNeeded.size > 0) {
  2858. continue;
  2859. }
  2860. loadedRequests.push(requestId);
  2861. }
  2862. }
  2863. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2864. let nextEmptyChunk;
  2865. if (this.stream.numChunksLoaded === 1) {
  2866. const lastChunk = this.stream.numChunks - 1;
  2867. if (!this.stream.hasChunk(lastChunk)) {
  2868. nextEmptyChunk = lastChunk;
  2869. }
  2870. } else {
  2871. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2872. }
  2873. if (Number.isInteger(nextEmptyChunk)) {
  2874. this._requestChunks([nextEmptyChunk]);
  2875. }
  2876. }
  2877. for (const requestId of loadedRequests) {
  2878. const capability = this._promisesByRequest.get(requestId);
  2879. this._promisesByRequest.delete(requestId);
  2880. capability.resolve();
  2881. }
  2882. this.msgHandler.send("DocProgress", {
  2883. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2884. total: this.length
  2885. });
  2886. }
  2887. onError(err) {
  2888. this._loadedStreamCapability.reject(err);
  2889. }
  2890. getBeginChunk(begin) {
  2891. return Math.floor(begin / this.chunkSize);
  2892. }
  2893. getEndChunk(end) {
  2894. return Math.floor((end - 1) / this.chunkSize) + 1;
  2895. }
  2896. abort(reason) {
  2897. this.aborted = true;
  2898. if (this.pdfNetworkStream) {
  2899. this.pdfNetworkStream.cancelAllRequests(reason);
  2900. }
  2901. for (const capability of this._promisesByRequest.values()) {
  2902. capability.reject(reason);
  2903. }
  2904. }
  2905. }
  2906. exports.ChunkedStreamManager = ChunkedStreamManager;
  2907. /***/ }),
  2908. /* 10 */
  2909. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2910. Object.defineProperty(exports, "__esModule", ({
  2911. value: true
  2912. }));
  2913. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2914. var _base_stream = __w_pdfjs_require__(7);
  2915. var _util = __w_pdfjs_require__(2);
  2916. class Stream extends _base_stream.BaseStream {
  2917. constructor(arrayBuffer, start, length, dict) {
  2918. super();
  2919. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2920. this.start = start || 0;
  2921. this.pos = this.start;
  2922. this.end = start + length || this.bytes.length;
  2923. this.dict = dict;
  2924. }
  2925. get length() {
  2926. return this.end - this.start;
  2927. }
  2928. get isEmpty() {
  2929. return this.length === 0;
  2930. }
  2931. getByte() {
  2932. if (this.pos >= this.end) {
  2933. return -1;
  2934. }
  2935. return this.bytes[this.pos++];
  2936. }
  2937. getBytes(length) {
  2938. const bytes = this.bytes;
  2939. const pos = this.pos;
  2940. const strEnd = this.end;
  2941. if (!length) {
  2942. return bytes.subarray(pos, strEnd);
  2943. }
  2944. let end = pos + length;
  2945. if (end > strEnd) {
  2946. end = strEnd;
  2947. }
  2948. this.pos = end;
  2949. return bytes.subarray(pos, end);
  2950. }
  2951. getByteRange(begin, end) {
  2952. if (begin < 0) {
  2953. begin = 0;
  2954. }
  2955. if (end > this.end) {
  2956. end = this.end;
  2957. }
  2958. return this.bytes.subarray(begin, end);
  2959. }
  2960. reset() {
  2961. this.pos = this.start;
  2962. }
  2963. moveStart() {
  2964. this.start = this.pos;
  2965. }
  2966. makeSubStream(start, length, dict = null) {
  2967. return new Stream(this.bytes.buffer, start, length, dict);
  2968. }
  2969. }
  2970. exports.Stream = Stream;
  2971. class StringStream extends Stream {
  2972. constructor(str) {
  2973. super((0, _util.stringToBytes)(str));
  2974. }
  2975. }
  2976. exports.StringStream = StringStream;
  2977. class NullStream extends Stream {
  2978. constructor() {
  2979. super(new Uint8Array(0));
  2980. }
  2981. }
  2982. exports.NullStream = NullStream;
  2983. /***/ }),
  2984. /* 11 */
  2985. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2986. Object.defineProperty(exports, "__esModule", ({
  2987. value: true
  2988. }));
  2989. exports.Page = exports.PDFDocument = void 0;
  2990. var _annotation = __w_pdfjs_require__(12);
  2991. var _util = __w_pdfjs_require__(2);
  2992. var _core_utils = __w_pdfjs_require__(6);
  2993. var _primitives = __w_pdfjs_require__(5);
  2994. var _xfa_fonts = __w_pdfjs_require__(51);
  2995. var _base_stream = __w_pdfjs_require__(7);
  2996. var _crypto = __w_pdfjs_require__(67);
  2997. var _catalog = __w_pdfjs_require__(69);
  2998. var _cleanup_helper = __w_pdfjs_require__(71);
  2999. var _dataset_reader = __w_pdfjs_require__(100);
  3000. var _parser = __w_pdfjs_require__(17);
  3001. var _stream = __w_pdfjs_require__(10);
  3002. var _object_loader = __w_pdfjs_require__(75);
  3003. var _operator_list = __w_pdfjs_require__(62);
  3004. var _evaluator = __w_pdfjs_require__(15);
  3005. var _decode_stream = __w_pdfjs_require__(19);
  3006. var _struct_tree = __w_pdfjs_require__(74);
  3007. var _writer = __w_pdfjs_require__(65);
  3008. var _factory = __w_pdfjs_require__(76);
  3009. var _xref = __w_pdfjs_require__(101);
  3010. const DEFAULT_USER_UNIT = 1.0;
  3011. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  3012. class Page {
  3013. constructor({
  3014. pdfManager,
  3015. xref,
  3016. pageIndex,
  3017. pageDict,
  3018. ref,
  3019. globalIdFactory,
  3020. fontCache,
  3021. builtInCMapCache,
  3022. standardFontDataCache,
  3023. globalImageCache,
  3024. nonBlendModesSet,
  3025. xfaFactory
  3026. }) {
  3027. this.pdfManager = pdfManager;
  3028. this.pageIndex = pageIndex;
  3029. this.pageDict = pageDict;
  3030. this.xref = xref;
  3031. this.ref = ref;
  3032. this.fontCache = fontCache;
  3033. this.builtInCMapCache = builtInCMapCache;
  3034. this.standardFontDataCache = standardFontDataCache;
  3035. this.globalImageCache = globalImageCache;
  3036. this.nonBlendModesSet = nonBlendModesSet;
  3037. this.evaluatorOptions = pdfManager.evaluatorOptions;
  3038. this.resourcesPromise = null;
  3039. this.xfaFactory = xfaFactory;
  3040. const idCounters = {
  3041. obj: 0
  3042. };
  3043. this._localIdFactory = class extends globalIdFactory {
  3044. static createObjId() {
  3045. return `p${pageIndex}_${++idCounters.obj}`;
  3046. }
  3047. static getPageObjId() {
  3048. return `page${ref.toString()}`;
  3049. }
  3050. };
  3051. }
  3052. _getInheritableProperty(key, getArray = false) {
  3053. const value = (0, _core_utils.getInheritableProperty)({
  3054. dict: this.pageDict,
  3055. key,
  3056. getArray,
  3057. stopWhenFound: false
  3058. });
  3059. if (!Array.isArray(value)) {
  3060. return value;
  3061. }
  3062. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  3063. return value[0];
  3064. }
  3065. return _primitives.Dict.merge({
  3066. xref: this.xref,
  3067. dictArray: value
  3068. });
  3069. }
  3070. get content() {
  3071. return this.pageDict.getArray("Contents");
  3072. }
  3073. get resources() {
  3074. const resources = this._getInheritableProperty("Resources");
  3075. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  3076. }
  3077. _getBoundingBox(name) {
  3078. if (this.xfaData) {
  3079. return this.xfaData.bbox;
  3080. }
  3081. const box = this._getInheritableProperty(name, true);
  3082. if (Array.isArray(box) && box.length === 4) {
  3083. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3084. return box;
  3085. }
  3086. (0, _util.warn)(`Empty /${name} entry.`);
  3087. }
  3088. return null;
  3089. }
  3090. get mediaBox() {
  3091. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3092. }
  3093. get cropBox() {
  3094. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3095. }
  3096. get userUnit() {
  3097. let obj = this.pageDict.get("UserUnit");
  3098. if (typeof obj !== "number" || obj <= 0) {
  3099. obj = DEFAULT_USER_UNIT;
  3100. }
  3101. return (0, _util.shadow)(this, "userUnit", obj);
  3102. }
  3103. get view() {
  3104. const {
  3105. cropBox,
  3106. mediaBox
  3107. } = this;
  3108. let view;
  3109. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3110. view = mediaBox;
  3111. } else {
  3112. const box = _util.Util.intersect(cropBox, mediaBox);
  3113. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3114. view = box;
  3115. } else {
  3116. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3117. }
  3118. }
  3119. return (0, _util.shadow)(this, "view", view || mediaBox);
  3120. }
  3121. get rotate() {
  3122. let rotate = this._getInheritableProperty("Rotate") || 0;
  3123. if (rotate % 90 !== 0) {
  3124. rotate = 0;
  3125. } else if (rotate >= 360) {
  3126. rotate %= 360;
  3127. } else if (rotate < 0) {
  3128. rotate = (rotate % 360 + 360) % 360;
  3129. }
  3130. return (0, _util.shadow)(this, "rotate", rotate);
  3131. }
  3132. _onSubStreamError(handler, reason, objId) {
  3133. if (this.evaluatorOptions.ignoreErrors) {
  3134. handler.send("UnsupportedFeature", {
  3135. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3136. });
  3137. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3138. return;
  3139. }
  3140. throw reason;
  3141. }
  3142. getContentStream(handler) {
  3143. return this.pdfManager.ensure(this, "content").then(content => {
  3144. if (content instanceof _base_stream.BaseStream) {
  3145. return content;
  3146. }
  3147. if (Array.isArray(content)) {
  3148. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3149. }
  3150. return new _stream.NullStream();
  3151. });
  3152. }
  3153. get xfaData() {
  3154. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3155. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3156. } : null);
  3157. }
  3158. async saveNewAnnotations(handler, task, annotations) {
  3159. if (this.xfaFactory) {
  3160. throw new Error("XFA: Cannot save new annotations.");
  3161. }
  3162. const partialEvaluator = new _evaluator.PartialEvaluator({
  3163. xref: this.xref,
  3164. handler,
  3165. pageIndex: this.pageIndex,
  3166. idFactory: this._localIdFactory,
  3167. fontCache: this.fontCache,
  3168. builtInCMapCache: this.builtInCMapCache,
  3169. standardFontDataCache: this.standardFontDataCache,
  3170. globalImageCache: this.globalImageCache,
  3171. options: this.evaluatorOptions
  3172. });
  3173. const pageDict = this.pageDict;
  3174. const annotationsArray = this.annotations.slice();
  3175. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  3176. for (const {
  3177. ref
  3178. } of newData.annotations) {
  3179. annotationsArray.push(ref);
  3180. }
  3181. const savedDict = pageDict.get("Annots");
  3182. pageDict.set("Annots", annotationsArray);
  3183. const buffer = [];
  3184. let transform = null;
  3185. if (this.xref.encrypt) {
  3186. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  3187. }
  3188. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  3189. if (savedDict) {
  3190. pageDict.set("Annots", savedDict);
  3191. }
  3192. const objects = newData.dependencies;
  3193. objects.push({
  3194. ref: this.ref,
  3195. data: buffer.join("")
  3196. }, ...newData.annotations);
  3197. return objects;
  3198. }
  3199. save(handler, task, annotationStorage) {
  3200. const partialEvaluator = new _evaluator.PartialEvaluator({
  3201. xref: this.xref,
  3202. handler,
  3203. pageIndex: this.pageIndex,
  3204. idFactory: this._localIdFactory,
  3205. fontCache: this.fontCache,
  3206. builtInCMapCache: this.builtInCMapCache,
  3207. standardFontDataCache: this.standardFontDataCache,
  3208. globalImageCache: this.globalImageCache,
  3209. options: this.evaluatorOptions
  3210. });
  3211. return this._parsedAnnotations.then(function (annotations) {
  3212. const newRefsPromises = [];
  3213. for (const annotation of annotations) {
  3214. if (!annotation.mustBePrinted(annotationStorage)) {
  3215. continue;
  3216. }
  3217. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3218. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3219. return null;
  3220. }));
  3221. }
  3222. return Promise.all(newRefsPromises).then(function (newRefs) {
  3223. return newRefs.filter(newRef => !!newRef);
  3224. });
  3225. });
  3226. }
  3227. loadResources(keys) {
  3228. if (!this.resourcesPromise) {
  3229. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3230. }
  3231. return this.resourcesPromise.then(() => {
  3232. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3233. return objectLoader.load();
  3234. });
  3235. }
  3236. getOperatorList({
  3237. handler,
  3238. sink,
  3239. task,
  3240. intent,
  3241. cacheKey,
  3242. annotationStorage = null
  3243. }) {
  3244. const contentStreamPromise = this.getContentStream(handler);
  3245. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3246. const partialEvaluator = new _evaluator.PartialEvaluator({
  3247. xref: this.xref,
  3248. handler,
  3249. pageIndex: this.pageIndex,
  3250. idFactory: this._localIdFactory,
  3251. fontCache: this.fontCache,
  3252. builtInCMapCache: this.builtInCMapCache,
  3253. standardFontDataCache: this.standardFontDataCache,
  3254. globalImageCache: this.globalImageCache,
  3255. options: this.evaluatorOptions
  3256. });
  3257. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  3258. let newAnnotationsPromise = Promise.resolve(null);
  3259. if (newAnnotationsByPage) {
  3260. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  3261. if (newAnnotations) {
  3262. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  3263. }
  3264. }
  3265. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3266. const pageListPromise = dataPromises.then(([contentStream]) => {
  3267. const opList = new _operator_list.OperatorList(intent, sink);
  3268. handler.send("StartRenderPage", {
  3269. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3270. pageIndex: this.pageIndex,
  3271. cacheKey
  3272. });
  3273. return partialEvaluator.getOperatorList({
  3274. stream: contentStream,
  3275. task,
  3276. resources: this.resources,
  3277. operatorList: opList
  3278. }).then(function () {
  3279. return opList;
  3280. });
  3281. });
  3282. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
  3283. if (newAnnotations) {
  3284. annotations = annotations.concat(newAnnotations);
  3285. }
  3286. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3287. pageOpList.flush(true);
  3288. return {
  3289. length: pageOpList.totalLength
  3290. };
  3291. }
  3292. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3293. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3294. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3295. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3296. const opListPromises = [];
  3297. for (const annotation of annotations) {
  3298. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3299. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3300. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3301. return null;
  3302. }));
  3303. }
  3304. }
  3305. return Promise.all(opListPromises).then(function (opLists) {
  3306. let form = false,
  3307. canvas = false;
  3308. for (const {
  3309. opList,
  3310. separateForm,
  3311. separateCanvas
  3312. } of opLists) {
  3313. pageOpList.addOpList(opList);
  3314. if (separateForm) {
  3315. form = separateForm;
  3316. }
  3317. if (separateCanvas) {
  3318. canvas = separateCanvas;
  3319. }
  3320. }
  3321. pageOpList.flush(true, {
  3322. form,
  3323. canvas
  3324. });
  3325. return {
  3326. length: pageOpList.totalLength
  3327. };
  3328. });
  3329. });
  3330. }
  3331. extractTextContent({
  3332. handler,
  3333. task,
  3334. includeMarkedContent,
  3335. sink,
  3336. combineTextItems
  3337. }) {
  3338. const contentStreamPromise = this.getContentStream(handler);
  3339. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3340. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3341. return dataPromises.then(([contentStream]) => {
  3342. const partialEvaluator = new _evaluator.PartialEvaluator({
  3343. xref: this.xref,
  3344. handler,
  3345. pageIndex: this.pageIndex,
  3346. idFactory: this._localIdFactory,
  3347. fontCache: this.fontCache,
  3348. builtInCMapCache: this.builtInCMapCache,
  3349. standardFontDataCache: this.standardFontDataCache,
  3350. globalImageCache: this.globalImageCache,
  3351. options: this.evaluatorOptions
  3352. });
  3353. return partialEvaluator.getTextContent({
  3354. stream: contentStream,
  3355. task,
  3356. resources: this.resources,
  3357. includeMarkedContent,
  3358. combineTextItems,
  3359. sink,
  3360. viewBox: this.view
  3361. });
  3362. });
  3363. }
  3364. async getStructTree() {
  3365. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3366. if (!structTreeRoot) {
  3367. return null;
  3368. }
  3369. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3370. return structTree.serializable;
  3371. }
  3372. _parseStructTree(structTreeRoot) {
  3373. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3374. tree.parse();
  3375. return tree;
  3376. }
  3377. async getAnnotationsData(handler, task, intent) {
  3378. const annotations = await this._parsedAnnotations;
  3379. if (annotations.length === 0) {
  3380. return [];
  3381. }
  3382. const textContentPromises = [];
  3383. const annotationsData = [];
  3384. let partialEvaluator;
  3385. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3386. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3387. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3388. for (const annotation of annotations) {
  3389. const isVisible = intentAny || intentDisplay && annotation.viewable;
  3390. if (isVisible || intentPrint && annotation.printable) {
  3391. annotationsData.push(annotation.data);
  3392. }
  3393. if (annotation.hasTextContent && isVisible) {
  3394. if (!partialEvaluator) {
  3395. partialEvaluator = new _evaluator.PartialEvaluator({
  3396. xref: this.xref,
  3397. handler,
  3398. pageIndex: this.pageIndex,
  3399. idFactory: this._localIdFactory,
  3400. fontCache: this.fontCache,
  3401. builtInCMapCache: this.builtInCMapCache,
  3402. standardFontDataCache: this.standardFontDataCache,
  3403. globalImageCache: this.globalImageCache,
  3404. options: this.evaluatorOptions
  3405. });
  3406. }
  3407. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  3408. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  3409. }));
  3410. }
  3411. }
  3412. await Promise.all(textContentPromises);
  3413. return annotationsData;
  3414. }
  3415. get annotations() {
  3416. const annots = this._getInheritableProperty("Annots");
  3417. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3418. }
  3419. get _parsedAnnotations() {
  3420. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3421. const annotationPromises = [];
  3422. for (const annotationRef of this.annotations) {
  3423. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3424. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3425. return null;
  3426. }));
  3427. }
  3428. return Promise.all(annotationPromises).then(function (annotations) {
  3429. if (annotations.length === 0) {
  3430. return annotations;
  3431. }
  3432. const sortedAnnotations = [];
  3433. let popupAnnotations;
  3434. for (const annotation of annotations) {
  3435. if (!annotation) {
  3436. continue;
  3437. }
  3438. if (annotation instanceof _annotation.PopupAnnotation) {
  3439. if (!popupAnnotations) {
  3440. popupAnnotations = [];
  3441. }
  3442. popupAnnotations.push(annotation);
  3443. continue;
  3444. }
  3445. sortedAnnotations.push(annotation);
  3446. }
  3447. if (popupAnnotations) {
  3448. sortedAnnotations.push(...popupAnnotations);
  3449. }
  3450. return sortedAnnotations;
  3451. });
  3452. });
  3453. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3454. }
  3455. get jsActions() {
  3456. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3457. return (0, _util.shadow)(this, "jsActions", actions);
  3458. }
  3459. }
  3460. exports.Page = Page;
  3461. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3462. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3463. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3464. const FINGERPRINT_FIRST_BYTES = 1024;
  3465. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3466. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  3467. function find(stream, signature, limit = 1024, backwards = false) {
  3468. const signatureLength = signature.length;
  3469. const scanBytes = stream.peekBytes(limit);
  3470. const scanLength = scanBytes.length - signatureLength;
  3471. if (scanLength <= 0) {
  3472. return false;
  3473. }
  3474. if (backwards) {
  3475. const signatureEnd = signatureLength - 1;
  3476. let pos = scanBytes.length - 1;
  3477. while (pos >= signatureEnd) {
  3478. let j = 0;
  3479. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3480. j++;
  3481. }
  3482. if (j >= signatureLength) {
  3483. stream.pos += pos - signatureEnd;
  3484. return true;
  3485. }
  3486. pos--;
  3487. }
  3488. } else {
  3489. let pos = 0;
  3490. while (pos <= scanLength) {
  3491. let j = 0;
  3492. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3493. j++;
  3494. }
  3495. if (j >= signatureLength) {
  3496. stream.pos += pos;
  3497. return true;
  3498. }
  3499. pos++;
  3500. }
  3501. }
  3502. return false;
  3503. }
  3504. class PDFDocument {
  3505. constructor(pdfManager, stream) {
  3506. if (stream.length <= 0) {
  3507. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3508. }
  3509. this.pdfManager = pdfManager;
  3510. this.stream = stream;
  3511. this.xref = new _xref.XRef(stream, pdfManager);
  3512. this._pagePromises = new Map();
  3513. this._version = null;
  3514. const idCounters = {
  3515. font: 0
  3516. };
  3517. this._globalIdFactory = class {
  3518. static getDocId() {
  3519. return `g_${pdfManager.docId}`;
  3520. }
  3521. static createFontId() {
  3522. return `f${++idCounters.font}`;
  3523. }
  3524. static createObjId() {
  3525. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3526. }
  3527. static getPageObjId() {
  3528. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3529. }
  3530. };
  3531. }
  3532. parse(recoveryMode) {
  3533. this.xref.parse(recoveryMode);
  3534. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3535. if (this.catalog.version) {
  3536. this._version = this.catalog.version;
  3537. }
  3538. }
  3539. get linearization() {
  3540. let linearization = null;
  3541. try {
  3542. linearization = _parser.Linearization.create(this.stream);
  3543. } catch (err) {
  3544. if (err instanceof _core_utils.MissingDataException) {
  3545. throw err;
  3546. }
  3547. (0, _util.info)(err);
  3548. }
  3549. return (0, _util.shadow)(this, "linearization", linearization);
  3550. }
  3551. get startXRef() {
  3552. const stream = this.stream;
  3553. let startXRef = 0;
  3554. if (this.linearization) {
  3555. stream.reset();
  3556. if (find(stream, ENDOBJ_SIGNATURE)) {
  3557. startXRef = stream.pos + 6 - stream.start;
  3558. }
  3559. } else {
  3560. const step = 1024;
  3561. const startXRefLength = STARTXREF_SIGNATURE.length;
  3562. let found = false,
  3563. pos = stream.end;
  3564. while (!found && pos > 0) {
  3565. pos -= step - startXRefLength;
  3566. if (pos < 0) {
  3567. pos = 0;
  3568. }
  3569. stream.pos = pos;
  3570. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3571. }
  3572. if (found) {
  3573. stream.skip(9);
  3574. let ch;
  3575. do {
  3576. ch = stream.getByte();
  3577. } while ((0, _core_utils.isWhiteSpace)(ch));
  3578. let str = "";
  3579. while (ch >= 0x20 && ch <= 0x39) {
  3580. str += String.fromCharCode(ch);
  3581. ch = stream.getByte();
  3582. }
  3583. startXRef = parseInt(str, 10);
  3584. if (isNaN(startXRef)) {
  3585. startXRef = 0;
  3586. }
  3587. }
  3588. }
  3589. return (0, _util.shadow)(this, "startXRef", startXRef);
  3590. }
  3591. checkHeader() {
  3592. const stream = this.stream;
  3593. stream.reset();
  3594. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3595. return;
  3596. }
  3597. stream.moveStart();
  3598. const MAX_PDF_VERSION_LENGTH = 12;
  3599. let version = "",
  3600. ch;
  3601. while ((ch = stream.getByte()) > 0x20) {
  3602. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3603. break;
  3604. }
  3605. version += String.fromCharCode(ch);
  3606. }
  3607. if (!this._version) {
  3608. this._version = version.substring(5);
  3609. }
  3610. }
  3611. parseStartXRef() {
  3612. this.xref.setStartXRef(this.startXRef);
  3613. }
  3614. get numPages() {
  3615. let num = 0;
  3616. if (this.catalog.hasActualNumPages) {
  3617. num = this.catalog.numPages;
  3618. } else if (this.xfaFactory) {
  3619. num = this.xfaFactory.getNumPages();
  3620. } else if (this.linearization) {
  3621. num = this.linearization.numPages;
  3622. } else {
  3623. num = this.catalog.numPages;
  3624. }
  3625. return (0, _util.shadow)(this, "numPages", num);
  3626. }
  3627. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3628. const RECURSION_LIMIT = 10;
  3629. if (!Array.isArray(fields)) {
  3630. return false;
  3631. }
  3632. return fields.every(field => {
  3633. field = this.xref.fetchIfRef(field);
  3634. if (!(field instanceof _primitives.Dict)) {
  3635. return false;
  3636. }
  3637. if (field.has("Kids")) {
  3638. if (++recursionDepth > RECURSION_LIMIT) {
  3639. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3640. return false;
  3641. }
  3642. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3643. }
  3644. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3645. const rectangle = field.get("Rect");
  3646. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3647. return isSignature && isInvisible;
  3648. });
  3649. }
  3650. get _xfaStreams() {
  3651. const acroForm = this.catalog.acroForm;
  3652. if (!acroForm) {
  3653. return null;
  3654. }
  3655. const xfa = acroForm.get("XFA");
  3656. const entries = {
  3657. "xdp:xdp": "",
  3658. template: "",
  3659. datasets: "",
  3660. config: "",
  3661. connectionSet: "",
  3662. localeSet: "",
  3663. stylesheet: "",
  3664. "/xdp:xdp": ""
  3665. };
  3666. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3667. entries["xdp:xdp"] = xfa;
  3668. return entries;
  3669. }
  3670. if (!Array.isArray(xfa) || xfa.length === 0) {
  3671. return null;
  3672. }
  3673. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3674. let name;
  3675. if (i === 0) {
  3676. name = "xdp:xdp";
  3677. } else if (i === ii - 2) {
  3678. name = "/xdp:xdp";
  3679. } else {
  3680. name = xfa[i];
  3681. }
  3682. if (!entries.hasOwnProperty(name)) {
  3683. continue;
  3684. }
  3685. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3686. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3687. continue;
  3688. }
  3689. entries[name] = data;
  3690. }
  3691. return entries;
  3692. }
  3693. get xfaDatasets() {
  3694. const streams = this._xfaStreams;
  3695. if (!streams) {
  3696. return (0, _util.shadow)(this, "xfaDatasets", null);
  3697. }
  3698. for (const key of ["datasets", "xdp:xdp"]) {
  3699. const stream = streams[key];
  3700. if (!stream) {
  3701. continue;
  3702. }
  3703. try {
  3704. const str = (0, _util.stringToUTF8String)(stream.getString());
  3705. const data = {
  3706. [key]: str
  3707. };
  3708. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  3709. } catch (_) {
  3710. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3711. break;
  3712. }
  3713. }
  3714. return (0, _util.shadow)(this, "xfaDatasets", null);
  3715. }
  3716. get xfaData() {
  3717. const streams = this._xfaStreams;
  3718. if (!streams) {
  3719. return null;
  3720. }
  3721. const data = Object.create(null);
  3722. for (const [key, stream] of Object.entries(streams)) {
  3723. if (!stream) {
  3724. continue;
  3725. }
  3726. try {
  3727. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  3728. } catch (_) {
  3729. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3730. return null;
  3731. }
  3732. }
  3733. return data;
  3734. }
  3735. get xfaFactory() {
  3736. let data;
  3737. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3738. data = this.xfaData;
  3739. }
  3740. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3741. }
  3742. get isPureXfa() {
  3743. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3744. }
  3745. get htmlForXfa() {
  3746. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3747. }
  3748. async loadXfaImages() {
  3749. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3750. if (!xfaImagesDict) {
  3751. return;
  3752. }
  3753. const keys = xfaImagesDict.getKeys();
  3754. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3755. await objectLoader.load();
  3756. const xfaImages = new Map();
  3757. for (const key of keys) {
  3758. const stream = xfaImagesDict.get(key);
  3759. if (stream instanceof _base_stream.BaseStream) {
  3760. xfaImages.set(key, stream.getBytes());
  3761. }
  3762. }
  3763. this.xfaFactory.setImages(xfaImages);
  3764. }
  3765. async loadXfaFonts(handler, task) {
  3766. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3767. if (!acroForm) {
  3768. return;
  3769. }
  3770. const resources = await acroForm.getAsync("DR");
  3771. if (!(resources instanceof _primitives.Dict)) {
  3772. return;
  3773. }
  3774. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3775. await objectLoader.load();
  3776. const fontRes = resources.get("Font");
  3777. if (!(fontRes instanceof _primitives.Dict)) {
  3778. return;
  3779. }
  3780. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3781. options.useSystemFonts = false;
  3782. const partialEvaluator = new _evaluator.PartialEvaluator({
  3783. xref: this.xref,
  3784. handler,
  3785. pageIndex: -1,
  3786. idFactory: this._globalIdFactory,
  3787. fontCache: this.catalog.fontCache,
  3788. builtInCMapCache: this.catalog.builtInCMapCache,
  3789. standardFontDataCache: this.catalog.standardFontDataCache,
  3790. options
  3791. });
  3792. const operatorList = new _operator_list.OperatorList();
  3793. const pdfFonts = [];
  3794. const initialState = {
  3795. get font() {
  3796. return pdfFonts.at(-1);
  3797. },
  3798. set font(font) {
  3799. pdfFonts.push(font);
  3800. },
  3801. clone() {
  3802. return this;
  3803. }
  3804. };
  3805. const fonts = new Map();
  3806. fontRes.forEach((fontName, font) => {
  3807. fonts.set(fontName, font);
  3808. });
  3809. const promises = [];
  3810. for (const [fontName, font] of fonts) {
  3811. const descriptor = font.get("FontDescriptor");
  3812. if (!(descriptor instanceof _primitives.Dict)) {
  3813. continue;
  3814. }
  3815. let fontFamily = descriptor.get("FontFamily");
  3816. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3817. const fontWeight = descriptor.get("FontWeight");
  3818. const italicAngle = -descriptor.get("ItalicAngle");
  3819. const cssFontInfo = {
  3820. fontFamily,
  3821. fontWeight,
  3822. italicAngle
  3823. };
  3824. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3825. continue;
  3826. }
  3827. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3828. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3829. return null;
  3830. }));
  3831. }
  3832. await Promise.all(promises);
  3833. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3834. if (!missingFonts) {
  3835. return;
  3836. }
  3837. options.ignoreErrors = true;
  3838. promises.length = 0;
  3839. pdfFonts.length = 0;
  3840. const reallyMissingFonts = new Set();
  3841. for (const missing of missingFonts) {
  3842. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3843. reallyMissingFonts.add(missing);
  3844. }
  3845. }
  3846. if (reallyMissingFonts.size) {
  3847. missingFonts.push("PdfJS-Fallback");
  3848. }
  3849. for (const missing of missingFonts) {
  3850. if (reallyMissingFonts.has(missing)) {
  3851. continue;
  3852. }
  3853. for (const fontInfo of [{
  3854. name: "Regular",
  3855. fontWeight: 400,
  3856. italicAngle: 0
  3857. }, {
  3858. name: "Bold",
  3859. fontWeight: 700,
  3860. italicAngle: 0
  3861. }, {
  3862. name: "Italic",
  3863. fontWeight: 400,
  3864. italicAngle: 12
  3865. }, {
  3866. name: "BoldItalic",
  3867. fontWeight: 700,
  3868. italicAngle: 12
  3869. }]) {
  3870. const name = `${missing}-${fontInfo.name}`;
  3871. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3872. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3873. fontFamily: missing,
  3874. fontWeight: fontInfo.fontWeight,
  3875. italicAngle: fontInfo.italicAngle
  3876. }).catch(function (reason) {
  3877. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3878. return null;
  3879. }));
  3880. }
  3881. }
  3882. await Promise.all(promises);
  3883. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3884. }
  3885. async serializeXfaData(annotationStorage) {
  3886. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3887. }
  3888. get formInfo() {
  3889. const formInfo = {
  3890. hasFields: false,
  3891. hasAcroForm: false,
  3892. hasXfa: false,
  3893. hasSignatures: false
  3894. };
  3895. const acroForm = this.catalog.acroForm;
  3896. if (!acroForm) {
  3897. return (0, _util.shadow)(this, "formInfo", formInfo);
  3898. }
  3899. try {
  3900. const fields = acroForm.get("Fields");
  3901. const hasFields = Array.isArray(fields) && fields.length > 0;
  3902. formInfo.hasFields = hasFields;
  3903. const xfa = acroForm.get("XFA");
  3904. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3905. const sigFlags = acroForm.get("SigFlags");
  3906. const hasSignatures = !!(sigFlags & 0x1);
  3907. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3908. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3909. formInfo.hasSignatures = hasSignatures;
  3910. } catch (ex) {
  3911. if (ex instanceof _core_utils.MissingDataException) {
  3912. throw ex;
  3913. }
  3914. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3915. }
  3916. return (0, _util.shadow)(this, "formInfo", formInfo);
  3917. }
  3918. get documentInfo() {
  3919. let version = this._version;
  3920. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3921. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3922. version = null;
  3923. }
  3924. const docInfo = {
  3925. PDFFormatVersion: version,
  3926. Language: this.catalog.lang,
  3927. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3928. IsLinearized: !!this.linearization,
  3929. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3930. IsXFAPresent: this.formInfo.hasXfa,
  3931. IsCollectionPresent: !!this.catalog.collection,
  3932. IsSignaturesPresent: this.formInfo.hasSignatures
  3933. };
  3934. let infoDict;
  3935. try {
  3936. infoDict = this.xref.trailer.get("Info");
  3937. } catch (err) {
  3938. if (err instanceof _core_utils.MissingDataException) {
  3939. throw err;
  3940. }
  3941. (0, _util.info)("The document information dictionary is invalid.");
  3942. }
  3943. if (!(infoDict instanceof _primitives.Dict)) {
  3944. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3945. }
  3946. for (const key of infoDict.getKeys()) {
  3947. const value = infoDict.get(key);
  3948. switch (key) {
  3949. case "Title":
  3950. case "Author":
  3951. case "Subject":
  3952. case "Keywords":
  3953. case "Creator":
  3954. case "Producer":
  3955. case "CreationDate":
  3956. case "ModDate":
  3957. if (typeof value === "string") {
  3958. docInfo[key] = (0, _util.stringToPDFString)(value);
  3959. continue;
  3960. }
  3961. break;
  3962. case "Trapped":
  3963. if (value instanceof _primitives.Name) {
  3964. docInfo[key] = value;
  3965. continue;
  3966. }
  3967. break;
  3968. default:
  3969. let customValue;
  3970. switch (typeof value) {
  3971. case "string":
  3972. customValue = (0, _util.stringToPDFString)(value);
  3973. break;
  3974. case "number":
  3975. case "boolean":
  3976. customValue = value;
  3977. break;
  3978. default:
  3979. if (value instanceof _primitives.Name) {
  3980. customValue = value;
  3981. }
  3982. break;
  3983. }
  3984. if (customValue === undefined) {
  3985. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3986. continue;
  3987. }
  3988. if (!docInfo.Custom) {
  3989. docInfo.Custom = Object.create(null);
  3990. }
  3991. docInfo.Custom[key] = customValue;
  3992. continue;
  3993. }
  3994. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3995. }
  3996. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3997. }
  3998. get fingerprints() {
  3999. function validate(data) {
  4000. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  4001. }
  4002. function hexString(hash) {
  4003. const buf = [];
  4004. for (let i = 0, ii = hash.length; i < ii; i++) {
  4005. const hex = hash[i].toString(16);
  4006. buf.push(hex.padStart(2, "0"));
  4007. }
  4008. return buf.join("");
  4009. }
  4010. const idArray = this.xref.trailer.get("ID");
  4011. let hashOriginal, hashModified;
  4012. if (Array.isArray(idArray) && validate(idArray[0])) {
  4013. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  4014. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  4015. hashModified = (0, _util.stringToBytes)(idArray[1]);
  4016. }
  4017. } else {
  4018. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  4019. }
  4020. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  4021. }
  4022. async _getLinearizationPage(pageIndex) {
  4023. const {
  4024. catalog,
  4025. linearization,
  4026. xref
  4027. } = this;
  4028. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  4029. try {
  4030. const obj = await xref.fetchAsync(ref);
  4031. if (obj instanceof _primitives.Dict) {
  4032. let type = obj.getRaw("Type");
  4033. if (type instanceof _primitives.Ref) {
  4034. type = await xref.fetchAsync(type);
  4035. }
  4036. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  4037. if (!catalog.pageKidsCountCache.has(ref)) {
  4038. catalog.pageKidsCountCache.put(ref, 1);
  4039. }
  4040. if (!catalog.pageIndexCache.has(ref)) {
  4041. catalog.pageIndexCache.put(ref, 0);
  4042. }
  4043. return [obj, ref];
  4044. }
  4045. }
  4046. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  4047. } catch (reason) {
  4048. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  4049. return catalog.getPageDict(pageIndex);
  4050. }
  4051. }
  4052. getPage(pageIndex) {
  4053. const cachedPromise = this._pagePromises.get(pageIndex);
  4054. if (cachedPromise) {
  4055. return cachedPromise;
  4056. }
  4057. const {
  4058. catalog,
  4059. linearization,
  4060. xfaFactory
  4061. } = this;
  4062. let promise;
  4063. if (xfaFactory) {
  4064. promise = Promise.resolve([_primitives.Dict.empty, null]);
  4065. } else if (linearization && linearization.pageFirst === pageIndex) {
  4066. promise = this._getLinearizationPage(pageIndex);
  4067. } else {
  4068. promise = catalog.getPageDict(pageIndex);
  4069. }
  4070. promise = promise.then(([pageDict, ref]) => {
  4071. return new Page({
  4072. pdfManager: this.pdfManager,
  4073. xref: this.xref,
  4074. pageIndex,
  4075. pageDict,
  4076. ref,
  4077. globalIdFactory: this._globalIdFactory,
  4078. fontCache: catalog.fontCache,
  4079. builtInCMapCache: catalog.builtInCMapCache,
  4080. standardFontDataCache: catalog.standardFontDataCache,
  4081. globalImageCache: catalog.globalImageCache,
  4082. nonBlendModesSet: catalog.nonBlendModesSet,
  4083. xfaFactory
  4084. });
  4085. });
  4086. this._pagePromises.set(pageIndex, promise);
  4087. return promise;
  4088. }
  4089. async checkFirstPage(recoveryMode = false) {
  4090. if (recoveryMode) {
  4091. return;
  4092. }
  4093. try {
  4094. await this.getPage(0);
  4095. } catch (reason) {
  4096. if (reason instanceof _core_utils.XRefEntryException) {
  4097. this._pagePromises.delete(0);
  4098. await this.cleanup();
  4099. throw new _core_utils.XRefParseException();
  4100. }
  4101. }
  4102. }
  4103. async checkLastPage(recoveryMode = false) {
  4104. const {
  4105. catalog,
  4106. pdfManager
  4107. } = this;
  4108. catalog.setActualNumPages();
  4109. let numPages;
  4110. try {
  4111. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  4112. if (this.xfaFactory) {
  4113. return;
  4114. } else if (this.linearization) {
  4115. numPages = this.linearization.numPages;
  4116. } else {
  4117. numPages = catalog.numPages;
  4118. }
  4119. if (!Number.isInteger(numPages)) {
  4120. throw new _util.FormatError("Page count is not an integer.");
  4121. } else if (numPages <= 1) {
  4122. return;
  4123. }
  4124. await this.getPage(numPages - 1);
  4125. } catch (reason) {
  4126. this._pagePromises.delete(numPages - 1);
  4127. await this.cleanup();
  4128. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4129. throw new _core_utils.XRefParseException();
  4130. }
  4131. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  4132. let pagesTree;
  4133. try {
  4134. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  4135. } catch (reasonAll) {
  4136. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  4137. throw new _core_utils.XRefParseException();
  4138. }
  4139. catalog.setActualNumPages(1);
  4140. return;
  4141. }
  4142. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  4143. let promise;
  4144. if (pageDict instanceof Error) {
  4145. promise = Promise.reject(pageDict);
  4146. promise.catch(() => {});
  4147. } else {
  4148. promise = Promise.resolve(new Page({
  4149. pdfManager,
  4150. xref: this.xref,
  4151. pageIndex,
  4152. pageDict,
  4153. ref,
  4154. globalIdFactory: this._globalIdFactory,
  4155. fontCache: catalog.fontCache,
  4156. builtInCMapCache: catalog.builtInCMapCache,
  4157. standardFontDataCache: catalog.standardFontDataCache,
  4158. globalImageCache: catalog.globalImageCache,
  4159. nonBlendModesSet: catalog.nonBlendModesSet,
  4160. xfaFactory: null
  4161. }));
  4162. }
  4163. this._pagePromises.set(pageIndex, promise);
  4164. }
  4165. catalog.setActualNumPages(pagesTree.size);
  4166. }
  4167. }
  4168. fontFallback(id, handler) {
  4169. return this.catalog.fontFallback(id, handler);
  4170. }
  4171. async cleanup(manuallyTriggered = false) {
  4172. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  4173. }
  4174. _collectFieldObjects(name, fieldRef, promises) {
  4175. const field = this.xref.fetchIfRef(fieldRef);
  4176. if (field.has("T")) {
  4177. const partName = (0, _util.stringToPDFString)(field.get("T"));
  4178. if (name === "") {
  4179. name = partName;
  4180. } else {
  4181. name = `${name}.${partName}`;
  4182. }
  4183. }
  4184. if (!promises.has(name)) {
  4185. promises.set(name, []);
  4186. }
  4187. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  4188. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4189. return null;
  4190. }));
  4191. if (field.has("Kids")) {
  4192. const kids = field.get("Kids");
  4193. for (const kid of kids) {
  4194. this._collectFieldObjects(name, kid, promises);
  4195. }
  4196. }
  4197. }
  4198. get fieldObjects() {
  4199. if (!this.formInfo.hasFields) {
  4200. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  4201. }
  4202. const allFields = Object.create(null);
  4203. const fieldPromises = new Map();
  4204. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4205. this._collectFieldObjects("", fieldRef, fieldPromises);
  4206. }
  4207. const allPromises = [];
  4208. for (const [name, promises] of fieldPromises) {
  4209. allPromises.push(Promise.all(promises).then(fields => {
  4210. fields = fields.filter(field => !!field);
  4211. if (fields.length > 0) {
  4212. allFields[name] = fields;
  4213. }
  4214. }));
  4215. }
  4216. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4217. }
  4218. get hasJSActions() {
  4219. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4220. return (0, _util.shadow)(this, "hasJSActions", promise);
  4221. }
  4222. async _parseHasJSActions() {
  4223. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4224. if (catalogJsActions) {
  4225. return true;
  4226. }
  4227. if (fieldObjects) {
  4228. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4229. }
  4230. return false;
  4231. }
  4232. get calculationOrderIds() {
  4233. const acroForm = this.catalog.acroForm;
  4234. if (!acroForm || !acroForm.has("CO")) {
  4235. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4236. }
  4237. const calculationOrder = acroForm.get("CO");
  4238. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4239. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4240. }
  4241. const ids = [];
  4242. for (const id of calculationOrder) {
  4243. if (id instanceof _primitives.Ref) {
  4244. ids.push(id.toString());
  4245. }
  4246. }
  4247. if (ids.length === 0) {
  4248. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4249. }
  4250. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4251. }
  4252. }
  4253. exports.PDFDocument = PDFDocument;
  4254. /***/ }),
  4255. /* 12 */
  4256. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4257. Object.defineProperty(exports, "__esModule", ({
  4258. value: true
  4259. }));
  4260. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  4261. exports.getQuadPoints = getQuadPoints;
  4262. var _util = __w_pdfjs_require__(2);
  4263. var _core_utils = __w_pdfjs_require__(6);
  4264. var _default_appearance = __w_pdfjs_require__(13);
  4265. var _primitives = __w_pdfjs_require__(5);
  4266. var _writer = __w_pdfjs_require__(65);
  4267. var _base_stream = __w_pdfjs_require__(7);
  4268. var _bidi = __w_pdfjs_require__(60);
  4269. var _catalog = __w_pdfjs_require__(69);
  4270. var _colorspace = __w_pdfjs_require__(14);
  4271. var _file_spec = __w_pdfjs_require__(72);
  4272. var _object_loader = __w_pdfjs_require__(75);
  4273. var _operator_list = __w_pdfjs_require__(62);
  4274. var _stream = __w_pdfjs_require__(10);
  4275. var _factory = __w_pdfjs_require__(76);
  4276. class AnnotationFactory {
  4277. static create(xref, ref, pdfManager, idFactory, collectFields) {
  4278. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, baseUrl, xfaDatasets, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex]));
  4279. }
  4280. static _create(xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex = -1) {
  4281. const dict = xref.fetchIfRef(ref);
  4282. if (!(dict instanceof _primitives.Dict)) {
  4283. return undefined;
  4284. }
  4285. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  4286. let subtype = dict.get("Subtype");
  4287. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  4288. const parameters = {
  4289. xref,
  4290. ref,
  4291. dict,
  4292. subtype,
  4293. id,
  4294. pdfManager,
  4295. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  4296. xfaDatasets,
  4297. collectFields,
  4298. pageIndex
  4299. };
  4300. switch (subtype) {
  4301. case "Link":
  4302. return new LinkAnnotation(parameters);
  4303. case "Text":
  4304. return new TextAnnotation(parameters);
  4305. case "Widget":
  4306. let fieldType = (0, _core_utils.getInheritableProperty)({
  4307. dict,
  4308. key: "FT"
  4309. });
  4310. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  4311. switch (fieldType) {
  4312. case "Tx":
  4313. return new TextWidgetAnnotation(parameters);
  4314. case "Btn":
  4315. return new ButtonWidgetAnnotation(parameters);
  4316. case "Ch":
  4317. return new ChoiceWidgetAnnotation(parameters);
  4318. case "Sig":
  4319. return new SignatureWidgetAnnotation(parameters);
  4320. }
  4321. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  4322. return new WidgetAnnotation(parameters);
  4323. case "Popup":
  4324. return new PopupAnnotation(parameters);
  4325. case "FreeText":
  4326. return new FreeTextAnnotation(parameters);
  4327. case "Line":
  4328. return new LineAnnotation(parameters);
  4329. case "Square":
  4330. return new SquareAnnotation(parameters);
  4331. case "Circle":
  4332. return new CircleAnnotation(parameters);
  4333. case "PolyLine":
  4334. return new PolylineAnnotation(parameters);
  4335. case "Polygon":
  4336. return new PolygonAnnotation(parameters);
  4337. case "Caret":
  4338. return new CaretAnnotation(parameters);
  4339. case "Ink":
  4340. return new InkAnnotation(parameters);
  4341. case "Highlight":
  4342. return new HighlightAnnotation(parameters);
  4343. case "Underline":
  4344. return new UnderlineAnnotation(parameters);
  4345. case "Squiggly":
  4346. return new SquigglyAnnotation(parameters);
  4347. case "StrikeOut":
  4348. return new StrikeOutAnnotation(parameters);
  4349. case "Stamp":
  4350. return new StampAnnotation(parameters);
  4351. case "FileAttachment":
  4352. return new FileAttachmentAnnotation(parameters);
  4353. default:
  4354. if (!collectFields) {
  4355. if (!subtype) {
  4356. (0, _util.warn)("Annotation is missing the required /Subtype.");
  4357. } else {
  4358. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  4359. }
  4360. }
  4361. return new Annotation(parameters);
  4362. }
  4363. }
  4364. static async _getPageIndex(xref, ref, pdfManager) {
  4365. try {
  4366. const annotDict = await xref.fetchIfRefAsync(ref);
  4367. if (!(annotDict instanceof _primitives.Dict)) {
  4368. return -1;
  4369. }
  4370. const pageRef = annotDict.getRaw("P");
  4371. if (!(pageRef instanceof _primitives.Ref)) {
  4372. return -1;
  4373. }
  4374. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  4375. return pageIndex;
  4376. } catch (ex) {
  4377. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  4378. return -1;
  4379. }
  4380. }
  4381. static async saveNewAnnotations(evaluator, task, annotations) {
  4382. const xref = evaluator.xref;
  4383. let baseFontRef;
  4384. const dependencies = [];
  4385. const promises = [];
  4386. for (const annotation of annotations) {
  4387. switch (annotation.annotationType) {
  4388. case _util.AnnotationEditorType.FREETEXT:
  4389. if (!baseFontRef) {
  4390. const baseFont = new _primitives.Dict(xref);
  4391. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  4392. baseFont.set("Type", _primitives.Name.get("Font"));
  4393. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  4394. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  4395. const buffer = [];
  4396. baseFontRef = xref.getNewRef();
  4397. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  4398. dependencies.push({
  4399. ref: baseFontRef,
  4400. data: buffer.join("")
  4401. });
  4402. }
  4403. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  4404. evaluator,
  4405. task,
  4406. baseFontRef
  4407. }));
  4408. break;
  4409. case _util.AnnotationEditorType.INK:
  4410. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  4411. }
  4412. }
  4413. return {
  4414. annotations: await Promise.all(promises),
  4415. dependencies
  4416. };
  4417. }
  4418. static async printNewAnnotations(evaluator, task, annotations) {
  4419. if (!annotations) {
  4420. return null;
  4421. }
  4422. const xref = evaluator.xref;
  4423. const promises = [];
  4424. for (const annotation of annotations) {
  4425. switch (annotation.annotationType) {
  4426. case _util.AnnotationEditorType.FREETEXT:
  4427. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  4428. evaluator,
  4429. task
  4430. }));
  4431. break;
  4432. case _util.AnnotationEditorType.INK:
  4433. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation));
  4434. break;
  4435. }
  4436. }
  4437. return Promise.all(promises);
  4438. }
  4439. }
  4440. exports.AnnotationFactory = AnnotationFactory;
  4441. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  4442. if (!Array.isArray(color)) {
  4443. return defaultColor;
  4444. }
  4445. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  4446. switch (color.length) {
  4447. case 0:
  4448. return null;
  4449. case 1:
  4450. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  4451. return rgbColor;
  4452. case 3:
  4453. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  4454. return rgbColor;
  4455. case 4:
  4456. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  4457. return rgbColor;
  4458. default:
  4459. return defaultColor;
  4460. }
  4461. }
  4462. function getQuadPoints(dict, rect) {
  4463. if (!dict.has("QuadPoints")) {
  4464. return null;
  4465. }
  4466. const quadPoints = dict.getArray("QuadPoints");
  4467. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  4468. return null;
  4469. }
  4470. const quadPointsLists = [];
  4471. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  4472. quadPointsLists.push([]);
  4473. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  4474. const x = quadPoints[j];
  4475. const y = quadPoints[j + 1];
  4476. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  4477. return null;
  4478. }
  4479. quadPointsLists[i].push({
  4480. x,
  4481. y
  4482. });
  4483. }
  4484. }
  4485. return quadPointsLists.map(quadPointsList => {
  4486. const [minX, maxX, minY, maxY] = quadPointsList.reduce(([mX, MX, mY, MY], quadPoint) => [Math.min(mX, quadPoint.x), Math.max(MX, quadPoint.x), Math.min(mY, quadPoint.y), Math.max(MY, quadPoint.y)], [Number.MAX_VALUE, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_VALUE]);
  4487. return [{
  4488. x: minX,
  4489. y: maxY
  4490. }, {
  4491. x: maxX,
  4492. y: maxY
  4493. }, {
  4494. x: minX,
  4495. y: minY
  4496. }, {
  4497. x: maxX,
  4498. y: minY
  4499. }];
  4500. });
  4501. }
  4502. function getTransformMatrix(rect, bbox, matrix) {
  4503. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  4504. if (minX === maxX || minY === maxY) {
  4505. return [1, 0, 0, 1, rect[0], rect[1]];
  4506. }
  4507. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  4508. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  4509. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  4510. }
  4511. class Annotation {
  4512. constructor(params) {
  4513. const dict = params.dict;
  4514. this.setTitle(dict.get("T"));
  4515. this.setContents(dict.get("Contents"));
  4516. this.setModificationDate(dict.get("M"));
  4517. this.setFlags(dict.get("F"));
  4518. this.setRectangle(dict.getArray("Rect"));
  4519. this.setColor(dict.getArray("C"));
  4520. this.setBorderStyle(dict);
  4521. this.setAppearance(dict);
  4522. this.setOptionalContent(dict);
  4523. const MK = dict.get("MK");
  4524. this.setBorderAndBackgroundColors(MK);
  4525. this.setRotation(MK);
  4526. this._streams = [];
  4527. if (this.appearance) {
  4528. this._streams.push(this.appearance);
  4529. }
  4530. this.data = {
  4531. annotationFlags: this.flags,
  4532. borderStyle: this.borderStyle,
  4533. color: this.color,
  4534. backgroundColor: this.backgroundColor,
  4535. borderColor: this.borderColor,
  4536. rotation: this.rotation,
  4537. contentsObj: this._contents,
  4538. hasAppearance: !!this.appearance,
  4539. id: params.id,
  4540. modificationDate: this.modificationDate,
  4541. rect: this.rectangle,
  4542. subtype: params.subtype,
  4543. hasOwnCanvas: false
  4544. };
  4545. if (params.collectFields) {
  4546. const kids = dict.get("Kids");
  4547. if (Array.isArray(kids)) {
  4548. const kidIds = [];
  4549. for (const kid of kids) {
  4550. if (kid instanceof _primitives.Ref) {
  4551. kidIds.push(kid.toString());
  4552. }
  4553. }
  4554. if (kidIds.length !== 0) {
  4555. this.data.kidIds = kidIds;
  4556. }
  4557. }
  4558. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  4559. this.data.fieldName = this._constructFieldName(dict);
  4560. this.data.pageIndex = params.pageIndex;
  4561. }
  4562. this._fallbackFontDict = null;
  4563. }
  4564. _hasFlag(flags, flag) {
  4565. return !!(flags & flag);
  4566. }
  4567. _isViewable(flags) {
  4568. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  4569. }
  4570. _isPrintable(flags) {
  4571. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  4572. }
  4573. mustBeViewed(annotationStorage) {
  4574. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4575. if (storageEntry && storageEntry.hidden !== undefined) {
  4576. return !storageEntry.hidden;
  4577. }
  4578. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  4579. }
  4580. mustBePrinted(annotationStorage) {
  4581. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  4582. if (storageEntry && storageEntry.print !== undefined) {
  4583. return storageEntry.print;
  4584. }
  4585. return this.printable;
  4586. }
  4587. get viewable() {
  4588. if (this.data.quadPoints === null) {
  4589. return false;
  4590. }
  4591. if (this.flags === 0) {
  4592. return true;
  4593. }
  4594. return this._isViewable(this.flags);
  4595. }
  4596. get printable() {
  4597. if (this.data.quadPoints === null) {
  4598. return false;
  4599. }
  4600. if (this.flags === 0) {
  4601. return false;
  4602. }
  4603. return this._isPrintable(this.flags);
  4604. }
  4605. _parseStringHelper(data) {
  4606. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  4607. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  4608. return {
  4609. str,
  4610. dir
  4611. };
  4612. }
  4613. setTitle(title) {
  4614. this._title = this._parseStringHelper(title);
  4615. }
  4616. setContents(contents) {
  4617. this._contents = this._parseStringHelper(contents);
  4618. }
  4619. setModificationDate(modificationDate) {
  4620. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  4621. }
  4622. setFlags(flags) {
  4623. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  4624. }
  4625. hasFlag(flag) {
  4626. return this._hasFlag(this.flags, flag);
  4627. }
  4628. setRectangle(rectangle) {
  4629. if (Array.isArray(rectangle) && rectangle.length === 4) {
  4630. this.rectangle = _util.Util.normalizeRect(rectangle);
  4631. } else {
  4632. this.rectangle = [0, 0, 0, 0];
  4633. }
  4634. }
  4635. setColor(color) {
  4636. this.color = getRgbColor(color);
  4637. }
  4638. setLineEndings(lineEndings) {
  4639. this.lineEndings = ["None", "None"];
  4640. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  4641. for (let i = 0; i < 2; i++) {
  4642. const obj = lineEndings[i];
  4643. if (obj instanceof _primitives.Name) {
  4644. switch (obj.name) {
  4645. case "None":
  4646. continue;
  4647. case "Square":
  4648. case "Circle":
  4649. case "Diamond":
  4650. case "OpenArrow":
  4651. case "ClosedArrow":
  4652. case "Butt":
  4653. case "ROpenArrow":
  4654. case "RClosedArrow":
  4655. case "Slash":
  4656. this.lineEndings[i] = obj.name;
  4657. continue;
  4658. }
  4659. }
  4660. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  4661. }
  4662. }
  4663. }
  4664. setRotation(mk) {
  4665. this.rotation = 0;
  4666. if (mk instanceof _primitives.Dict) {
  4667. let angle = mk.get("R") || 0;
  4668. if (Number.isInteger(angle) && angle !== 0) {
  4669. angle %= 360;
  4670. if (angle < 0) {
  4671. angle += 360;
  4672. }
  4673. if (angle % 90 === 0) {
  4674. this.rotation = angle;
  4675. }
  4676. }
  4677. }
  4678. }
  4679. setBorderAndBackgroundColors(mk) {
  4680. if (mk instanceof _primitives.Dict) {
  4681. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  4682. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  4683. } else {
  4684. this.borderColor = this.backgroundColor = null;
  4685. }
  4686. }
  4687. setBorderStyle(borderStyle) {
  4688. this.borderStyle = new AnnotationBorderStyle();
  4689. if (!(borderStyle instanceof _primitives.Dict)) {
  4690. return;
  4691. }
  4692. if (borderStyle.has("BS")) {
  4693. const dict = borderStyle.get("BS");
  4694. const dictType = dict.get("Type");
  4695. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  4696. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  4697. this.borderStyle.setStyle(dict.get("S"));
  4698. this.borderStyle.setDashArray(dict.getArray("D"));
  4699. }
  4700. } else if (borderStyle.has("Border")) {
  4701. const array = borderStyle.getArray("Border");
  4702. if (Array.isArray(array) && array.length >= 3) {
  4703. this.borderStyle.setHorizontalCornerRadius(array[0]);
  4704. this.borderStyle.setVerticalCornerRadius(array[1]);
  4705. this.borderStyle.setWidth(array[2], this.rectangle);
  4706. if (array.length === 4) {
  4707. this.borderStyle.setDashArray(array[3], true);
  4708. }
  4709. }
  4710. } else {
  4711. this.borderStyle.setWidth(0);
  4712. }
  4713. }
  4714. setAppearance(dict) {
  4715. this.appearance = null;
  4716. const appearanceStates = dict.get("AP");
  4717. if (!(appearanceStates instanceof _primitives.Dict)) {
  4718. return;
  4719. }
  4720. const normalAppearanceState = appearanceStates.get("N");
  4721. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  4722. this.appearance = normalAppearanceState;
  4723. return;
  4724. }
  4725. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  4726. return;
  4727. }
  4728. const as = dict.get("AS");
  4729. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  4730. return;
  4731. }
  4732. this.appearance = normalAppearanceState.get(as.name);
  4733. }
  4734. setOptionalContent(dict) {
  4735. this.oc = null;
  4736. const oc = dict.get("OC");
  4737. if (oc instanceof _primitives.Name) {
  4738. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  4739. } else if (oc instanceof _primitives.Dict) {
  4740. this.oc = oc;
  4741. }
  4742. }
  4743. loadResources(keys, appearance) {
  4744. return appearance.dict.getAsync("Resources").then(resources => {
  4745. if (!resources) {
  4746. return undefined;
  4747. }
  4748. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  4749. return objectLoader.load().then(function () {
  4750. return resources;
  4751. });
  4752. });
  4753. }
  4754. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  4755. const data = this.data;
  4756. let appearance = this.appearance;
  4757. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  4758. if (!appearance) {
  4759. if (!isUsingOwnCanvas) {
  4760. return {
  4761. opList: new _operator_list.OperatorList(),
  4762. separateForm: false,
  4763. separateCanvas: false
  4764. };
  4765. }
  4766. appearance = new _stream.StringStream("");
  4767. appearance.dict = new _primitives.Dict();
  4768. }
  4769. const appearanceDict = appearance.dict;
  4770. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  4771. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  4772. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  4773. const transform = getTransformMatrix(data.rect, bbox, matrix);
  4774. const opList = new _operator_list.OperatorList();
  4775. let optionalContent;
  4776. if (this.oc) {
  4777. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  4778. }
  4779. if (optionalContent !== undefined) {
  4780. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  4781. }
  4782. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  4783. await evaluator.getOperatorList({
  4784. stream: appearance,
  4785. task,
  4786. resources,
  4787. operatorList: opList,
  4788. fallbackFontDict: this._fallbackFontDict
  4789. });
  4790. opList.addOp(_util.OPS.endAnnotation, []);
  4791. if (optionalContent !== undefined) {
  4792. opList.addOp(_util.OPS.endMarkedContent, []);
  4793. }
  4794. this.reset();
  4795. return {
  4796. opList,
  4797. separateForm: false,
  4798. separateCanvas: isUsingOwnCanvas
  4799. };
  4800. }
  4801. async save(evaluator, task, annotationStorage) {
  4802. return null;
  4803. }
  4804. get hasTextContent() {
  4805. return false;
  4806. }
  4807. async extractTextContent(evaluator, task, viewBox) {
  4808. if (!this.appearance) {
  4809. return;
  4810. }
  4811. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  4812. const text = [];
  4813. const buffer = [];
  4814. const sink = {
  4815. desiredSize: Math.Infinity,
  4816. ready: true,
  4817. enqueue(chunk, size) {
  4818. for (const item of chunk.items) {
  4819. buffer.push(item.str);
  4820. if (item.hasEOL) {
  4821. text.push(buffer.join(""));
  4822. buffer.length = 0;
  4823. }
  4824. }
  4825. }
  4826. };
  4827. await evaluator.getTextContent({
  4828. stream: this.appearance,
  4829. task,
  4830. resources,
  4831. includeMarkedContent: true,
  4832. combineTextItems: true,
  4833. sink,
  4834. viewBox
  4835. });
  4836. this.reset();
  4837. if (buffer.length) {
  4838. text.push(buffer.join(""));
  4839. }
  4840. if (text.length > 0) {
  4841. this.data.textContent = text;
  4842. }
  4843. }
  4844. getFieldObject() {
  4845. if (this.data.kidIds) {
  4846. return {
  4847. id: this.data.id,
  4848. actions: this.data.actions,
  4849. name: this.data.fieldName,
  4850. strokeColor: this.data.borderColor,
  4851. fillColor: this.data.backgroundColor,
  4852. type: "",
  4853. kidIds: this.data.kidIds,
  4854. page: this.data.pageIndex,
  4855. rotation: this.rotation
  4856. };
  4857. }
  4858. return null;
  4859. }
  4860. reset() {
  4861. for (const stream of this._streams) {
  4862. stream.reset();
  4863. }
  4864. }
  4865. _constructFieldName(dict) {
  4866. if (!dict.has("T") && !dict.has("Parent")) {
  4867. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  4868. return "";
  4869. }
  4870. if (!dict.has("Parent")) {
  4871. return (0, _util.stringToPDFString)(dict.get("T"));
  4872. }
  4873. const fieldName = [];
  4874. if (dict.has("T")) {
  4875. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  4876. }
  4877. let loopDict = dict;
  4878. const visited = new _primitives.RefSet();
  4879. if (dict.objId) {
  4880. visited.put(dict.objId);
  4881. }
  4882. while (loopDict.has("Parent")) {
  4883. loopDict = loopDict.get("Parent");
  4884. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  4885. break;
  4886. }
  4887. if (loopDict.objId) {
  4888. visited.put(loopDict.objId);
  4889. }
  4890. if (loopDict.has("T")) {
  4891. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  4892. }
  4893. }
  4894. return fieldName.join(".");
  4895. }
  4896. }
  4897. exports.Annotation = Annotation;
  4898. class AnnotationBorderStyle {
  4899. constructor() {
  4900. this.width = 1;
  4901. this.style = _util.AnnotationBorderStyleType.SOLID;
  4902. this.dashArray = [3];
  4903. this.horizontalCornerRadius = 0;
  4904. this.verticalCornerRadius = 0;
  4905. }
  4906. setWidth(width, rect = [0, 0, 0, 0]) {
  4907. if (width instanceof _primitives.Name) {
  4908. this.width = 0;
  4909. return;
  4910. }
  4911. if (typeof width === "number") {
  4912. if (width > 0) {
  4913. const maxWidth = (rect[2] - rect[0]) / 2;
  4914. const maxHeight = (rect[3] - rect[1]) / 2;
  4915. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  4916. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  4917. width = 1;
  4918. }
  4919. }
  4920. this.width = width;
  4921. }
  4922. }
  4923. setStyle(style) {
  4924. if (!(style instanceof _primitives.Name)) {
  4925. return;
  4926. }
  4927. switch (style.name) {
  4928. case "S":
  4929. this.style = _util.AnnotationBorderStyleType.SOLID;
  4930. break;
  4931. case "D":
  4932. this.style = _util.AnnotationBorderStyleType.DASHED;
  4933. break;
  4934. case "B":
  4935. this.style = _util.AnnotationBorderStyleType.BEVELED;
  4936. break;
  4937. case "I":
  4938. this.style = _util.AnnotationBorderStyleType.INSET;
  4939. break;
  4940. case "U":
  4941. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  4942. break;
  4943. default:
  4944. break;
  4945. }
  4946. }
  4947. setDashArray(dashArray, forceStyle = false) {
  4948. if (Array.isArray(dashArray) && dashArray.length > 0) {
  4949. let isValid = true;
  4950. let allZeros = true;
  4951. for (const element of dashArray) {
  4952. const validNumber = +element >= 0;
  4953. if (!validNumber) {
  4954. isValid = false;
  4955. break;
  4956. } else if (element > 0) {
  4957. allZeros = false;
  4958. }
  4959. }
  4960. if (isValid && !allZeros) {
  4961. this.dashArray = dashArray;
  4962. if (forceStyle) {
  4963. this.setStyle(_primitives.Name.get("D"));
  4964. }
  4965. } else {
  4966. this.width = 0;
  4967. }
  4968. } else if (dashArray) {
  4969. this.width = 0;
  4970. }
  4971. }
  4972. setHorizontalCornerRadius(radius) {
  4973. if (Number.isInteger(radius)) {
  4974. this.horizontalCornerRadius = radius;
  4975. }
  4976. }
  4977. setVerticalCornerRadius(radius) {
  4978. if (Number.isInteger(radius)) {
  4979. this.verticalCornerRadius = radius;
  4980. }
  4981. }
  4982. }
  4983. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  4984. class MarkupAnnotation extends Annotation {
  4985. constructor(parameters) {
  4986. super(parameters);
  4987. const dict = parameters.dict;
  4988. if (dict.has("IRT")) {
  4989. const rawIRT = dict.getRaw("IRT");
  4990. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  4991. const rt = dict.get("RT");
  4992. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  4993. }
  4994. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  4995. const parent = dict.get("IRT");
  4996. this.setTitle(parent.get("T"));
  4997. this.data.titleObj = this._title;
  4998. this.setContents(parent.get("Contents"));
  4999. this.data.contentsObj = this._contents;
  5000. if (!parent.has("CreationDate")) {
  5001. this.data.creationDate = null;
  5002. } else {
  5003. this.setCreationDate(parent.get("CreationDate"));
  5004. this.data.creationDate = this.creationDate;
  5005. }
  5006. if (!parent.has("M")) {
  5007. this.data.modificationDate = null;
  5008. } else {
  5009. this.setModificationDate(parent.get("M"));
  5010. this.data.modificationDate = this.modificationDate;
  5011. }
  5012. this.data.hasPopup = parent.has("Popup");
  5013. if (!parent.has("C")) {
  5014. this.data.color = null;
  5015. } else {
  5016. this.setColor(parent.getArray("C"));
  5017. this.data.color = this.color;
  5018. }
  5019. } else {
  5020. this.data.titleObj = this._title;
  5021. this.setCreationDate(dict.get("CreationDate"));
  5022. this.data.creationDate = this.creationDate;
  5023. this.data.hasPopup = dict.has("Popup");
  5024. if (!dict.has("C")) {
  5025. this.data.color = null;
  5026. }
  5027. }
  5028. if (dict.has("RC")) {
  5029. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  5030. }
  5031. }
  5032. setCreationDate(creationDate) {
  5033. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  5034. }
  5035. _setDefaultAppearance({
  5036. xref,
  5037. extra,
  5038. strokeColor,
  5039. fillColor,
  5040. blendMode,
  5041. strokeAlpha,
  5042. fillAlpha,
  5043. pointsCallback
  5044. }) {
  5045. let minX = Number.MAX_VALUE;
  5046. let minY = Number.MAX_VALUE;
  5047. let maxX = Number.MIN_VALUE;
  5048. let maxY = Number.MIN_VALUE;
  5049. const buffer = ["q"];
  5050. if (extra) {
  5051. buffer.push(extra);
  5052. }
  5053. if (strokeColor) {
  5054. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  5055. }
  5056. if (fillColor) {
  5057. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  5058. }
  5059. let pointsArray = this.data.quadPoints;
  5060. if (!pointsArray) {
  5061. pointsArray = [[{
  5062. x: this.rectangle[0],
  5063. y: this.rectangle[3]
  5064. }, {
  5065. x: this.rectangle[2],
  5066. y: this.rectangle[3]
  5067. }, {
  5068. x: this.rectangle[0],
  5069. y: this.rectangle[1]
  5070. }, {
  5071. x: this.rectangle[2],
  5072. y: this.rectangle[1]
  5073. }]];
  5074. }
  5075. for (const points of pointsArray) {
  5076. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  5077. minX = Math.min(minX, mX);
  5078. maxX = Math.max(maxX, MX);
  5079. minY = Math.min(minY, mY);
  5080. maxY = Math.max(maxY, MY);
  5081. }
  5082. buffer.push("Q");
  5083. const formDict = new _primitives.Dict(xref);
  5084. const appearanceStreamDict = new _primitives.Dict(xref);
  5085. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  5086. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  5087. appearanceStream.dict = appearanceStreamDict;
  5088. formDict.set("Fm0", appearanceStream);
  5089. const gsDict = new _primitives.Dict(xref);
  5090. if (blendMode) {
  5091. gsDict.set("BM", _primitives.Name.get(blendMode));
  5092. }
  5093. if (typeof strokeAlpha === "number") {
  5094. gsDict.set("CA", strokeAlpha);
  5095. }
  5096. if (typeof fillAlpha === "number") {
  5097. gsDict.set("ca", fillAlpha);
  5098. }
  5099. const stateDict = new _primitives.Dict(xref);
  5100. stateDict.set("GS0", gsDict);
  5101. const resources = new _primitives.Dict(xref);
  5102. resources.set("ExtGState", stateDict);
  5103. resources.set("XObject", formDict);
  5104. const appearanceDict = new _primitives.Dict(xref);
  5105. appearanceDict.set("Resources", resources);
  5106. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  5107. appearanceDict.set("BBox", bbox);
  5108. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  5109. this.appearance.dict = appearanceDict;
  5110. this._streams.push(this.appearance, appearanceStream);
  5111. }
  5112. static async createNewAnnotation(xref, annotation, dependencies, params) {
  5113. const annotationRef = xref.getNewRef();
  5114. const apRef = xref.getNewRef();
  5115. const annotationDict = this.createNewDict(annotation, xref, {
  5116. apRef
  5117. });
  5118. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5119. const buffer = [];
  5120. let transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  5121. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  5122. dependencies.push({
  5123. ref: apRef,
  5124. data: buffer.join("")
  5125. });
  5126. buffer.length = 0;
  5127. transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  5128. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  5129. return {
  5130. ref: annotationRef,
  5131. data: buffer.join("")
  5132. };
  5133. }
  5134. static async createNewPrintAnnotation(xref, annotation, params) {
  5135. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  5136. const annotationDict = this.createNewDict(annotation, xref, {
  5137. ap
  5138. });
  5139. return new this.prototype.constructor({
  5140. dict: annotationDict,
  5141. xref
  5142. });
  5143. }
  5144. }
  5145. exports.MarkupAnnotation = MarkupAnnotation;
  5146. class WidgetAnnotation extends Annotation {
  5147. constructor(params) {
  5148. super(params);
  5149. const dict = params.dict;
  5150. const data = this.data;
  5151. this.ref = params.ref;
  5152. data.annotationType = _util.AnnotationType.WIDGET;
  5153. if (data.fieldName === undefined) {
  5154. data.fieldName = this._constructFieldName(dict);
  5155. }
  5156. if (data.actions === undefined) {
  5157. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  5158. }
  5159. let fieldValue = (0, _core_utils.getInheritableProperty)({
  5160. dict,
  5161. key: "V",
  5162. getArray: true
  5163. });
  5164. data.fieldValue = this._decodeFormValue(fieldValue);
  5165. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  5166. dict,
  5167. key: "DV",
  5168. getArray: true
  5169. });
  5170. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  5171. if (fieldValue === undefined && params.xfaDatasets) {
  5172. const path = this._title.str;
  5173. if (path) {
  5174. this._hasValueFromXFA = true;
  5175. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  5176. }
  5177. }
  5178. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  5179. data.fieldValue = data.defaultFieldValue;
  5180. }
  5181. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  5182. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  5183. dict,
  5184. key: "DA"
  5185. }) || params.acroForm.get("DA");
  5186. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  5187. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  5188. const fieldType = (0, _core_utils.getInheritableProperty)({
  5189. dict,
  5190. key: "FT"
  5191. });
  5192. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  5193. const localResources = (0, _core_utils.getInheritableProperty)({
  5194. dict,
  5195. key: "DR"
  5196. });
  5197. const acroFormResources = params.acroForm.get("DR");
  5198. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  5199. this._fieldResources = {
  5200. localResources,
  5201. acroFormResources,
  5202. appearanceResources,
  5203. mergedResources: _primitives.Dict.merge({
  5204. xref: params.xref,
  5205. dictArray: [localResources, appearanceResources, acroFormResources],
  5206. mergeSubDicts: true
  5207. })
  5208. };
  5209. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  5210. dict,
  5211. key: "Ff"
  5212. });
  5213. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  5214. data.fieldFlags = 0;
  5215. }
  5216. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  5217. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  5218. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  5219. }
  5220. _decodeFormValue(formValue) {
  5221. if (Array.isArray(formValue)) {
  5222. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  5223. } else if (formValue instanceof _primitives.Name) {
  5224. return (0, _util.stringToPDFString)(formValue.name);
  5225. } else if (typeof formValue === "string") {
  5226. return (0, _util.stringToPDFString)(formValue);
  5227. }
  5228. return null;
  5229. }
  5230. hasFieldFlag(flag) {
  5231. return !!(this.data.fieldFlags & flag);
  5232. }
  5233. static _getRotationMatrix(rotation, width, height) {
  5234. switch (rotation) {
  5235. case 90:
  5236. return [0, 1, -1, 0, width, 0];
  5237. case 180:
  5238. return [-1, 0, 0, -1, width, height];
  5239. case 270:
  5240. return [0, -1, 1, 0, 0, height];
  5241. default:
  5242. throw new Error("Invalid rotation");
  5243. }
  5244. }
  5245. getRotationMatrix(annotationStorage) {
  5246. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5247. let rotation = storageEntry && storageEntry.rotation;
  5248. if (rotation === undefined) {
  5249. rotation = this.rotation;
  5250. }
  5251. if (rotation === 0) {
  5252. return _util.IDENTITY_MATRIX;
  5253. }
  5254. const width = this.data.rect[2] - this.data.rect[0];
  5255. const height = this.data.rect[3] - this.data.rect[1];
  5256. return WidgetAnnotation._getRotationMatrix(rotation, width, height);
  5257. }
  5258. getBorderAndBackgroundAppearances(annotationStorage) {
  5259. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5260. let rotation = storageEntry && storageEntry.rotation;
  5261. if (rotation === undefined) {
  5262. rotation = this.rotation;
  5263. }
  5264. if (!this.backgroundColor && !this.borderColor) {
  5265. return "";
  5266. }
  5267. const width = this.data.rect[2] - this.data.rect[0];
  5268. const height = this.data.rect[3] - this.data.rect[1];
  5269. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  5270. let str = "";
  5271. if (this.backgroundColor) {
  5272. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  5273. }
  5274. if (this.borderColor) {
  5275. const borderWidth = this.borderStyle.width || 1;
  5276. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  5277. }
  5278. return str;
  5279. }
  5280. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5281. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  5282. return {
  5283. opList: new _operator_list.OperatorList(),
  5284. separateForm: true,
  5285. separateCanvas: false
  5286. };
  5287. }
  5288. if (!this._hasText) {
  5289. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5290. }
  5291. const content = await this._getAppearance(evaluator, task, annotationStorage);
  5292. if (this.appearance && content === null) {
  5293. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5294. }
  5295. const opList = new _operator_list.OperatorList();
  5296. if (!this._defaultAppearance || content === null) {
  5297. return {
  5298. opList,
  5299. separateForm: false,
  5300. separateCanvas: false
  5301. };
  5302. }
  5303. const matrix = [1, 0, 0, 1, 0, 0];
  5304. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  5305. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  5306. let optionalContent;
  5307. if (this.oc) {
  5308. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  5309. }
  5310. if (optionalContent !== undefined) {
  5311. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  5312. }
  5313. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  5314. const stream = new _stream.StringStream(content);
  5315. await evaluator.getOperatorList({
  5316. stream,
  5317. task,
  5318. resources: this._fieldResources.mergedResources,
  5319. operatorList: opList
  5320. });
  5321. opList.addOp(_util.OPS.endAnnotation, []);
  5322. if (optionalContent !== undefined) {
  5323. opList.addOp(_util.OPS.endMarkedContent, []);
  5324. }
  5325. return {
  5326. opList,
  5327. separateForm: false,
  5328. separateCanvas: false
  5329. };
  5330. }
  5331. _getMKDict(rotation) {
  5332. const mk = new _primitives.Dict(null);
  5333. if (rotation) {
  5334. mk.set("R", rotation);
  5335. }
  5336. if (this.borderColor) {
  5337. mk.set("BC", Array.from(this.borderColor).map(c => c / 255));
  5338. }
  5339. if (this.backgroundColor) {
  5340. mk.set("BG", Array.from(this.backgroundColor).map(c => c / 255));
  5341. }
  5342. return mk.size > 0 ? mk : null;
  5343. }
  5344. async save(evaluator, task, annotationStorage) {
  5345. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5346. let value = storageEntry && storageEntry.value;
  5347. let rotation = storageEntry && storageEntry.rotation;
  5348. if (value === this.data.fieldValue || value === undefined) {
  5349. if (!this._hasValueFromXFA && rotation === undefined) {
  5350. return null;
  5351. }
  5352. value = value || this.data.fieldValue;
  5353. }
  5354. 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])) {
  5355. return null;
  5356. }
  5357. if (rotation === undefined) {
  5358. rotation = this.rotation;
  5359. }
  5360. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  5361. if (appearance === null) {
  5362. return null;
  5363. }
  5364. const {
  5365. xref
  5366. } = evaluator;
  5367. const dict = xref.fetchIfRef(this.ref);
  5368. if (!(dict instanceof _primitives.Dict)) {
  5369. return null;
  5370. }
  5371. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  5372. const xfa = {
  5373. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5374. value
  5375. };
  5376. const newRef = xref.getNewRef();
  5377. const AP = new _primitives.Dict(xref);
  5378. AP.set("N", newRef);
  5379. const encrypt = xref.encrypt;
  5380. let originalTransform = null;
  5381. let newTransform = null;
  5382. if (encrypt) {
  5383. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5384. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  5385. appearance = newTransform.encryptString(appearance);
  5386. }
  5387. const encoder = val => (0, _util.isAscii)(val) ? val : (0, _util.stringToUTF16BEString)(val);
  5388. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  5389. dict.set("AP", AP);
  5390. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5391. const maybeMK = this._getMKDict(rotation);
  5392. if (maybeMK) {
  5393. dict.set("MK", maybeMK);
  5394. }
  5395. const appearanceDict = new _primitives.Dict(xref);
  5396. appearanceDict.set("Length", appearance.length);
  5397. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  5398. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  5399. appearanceDict.set("BBox", bbox);
  5400. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  5401. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  5402. appearanceDict.set("Matrix", rotationMatrix);
  5403. }
  5404. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5405. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  5406. bufferOriginal.push("\nendobj\n");
  5407. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  5408. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  5409. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  5410. return [{
  5411. ref: this.ref,
  5412. data: bufferOriginal.join(""),
  5413. xfa
  5414. }, {
  5415. ref: newRef,
  5416. data: bufferNew.join(""),
  5417. xfa: null
  5418. }];
  5419. }
  5420. async _getAppearance(evaluator, task, annotationStorage) {
  5421. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  5422. if (isPassword) {
  5423. return null;
  5424. }
  5425. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  5426. let value, rotation;
  5427. if (storageEntry) {
  5428. value = storageEntry.formattedValue || storageEntry.value;
  5429. rotation = storageEntry.rotation;
  5430. }
  5431. if (rotation === undefined && value === undefined) {
  5432. if (!this._hasValueFromXFA || this.appearance) {
  5433. return null;
  5434. }
  5435. }
  5436. if (value === undefined) {
  5437. value = this.data.fieldValue;
  5438. if (!value) {
  5439. return "";
  5440. }
  5441. }
  5442. if (Array.isArray(value) && value.length === 1) {
  5443. value = value[0];
  5444. }
  5445. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  5446. value = value.trim();
  5447. if (value === "") {
  5448. return "";
  5449. }
  5450. if (rotation === undefined) {
  5451. rotation = this.rotation;
  5452. }
  5453. let lineCount = -1;
  5454. if (this.data.multiLine) {
  5455. lineCount = value.split(/\r\n|\r|\n/).length;
  5456. }
  5457. const defaultPadding = 2;
  5458. const hPadding = defaultPadding;
  5459. let totalHeight = this.data.rect[3] - this.data.rect[1];
  5460. let totalWidth = this.data.rect[2] - this.data.rect[0];
  5461. if (rotation === 90 || rotation === 270) {
  5462. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  5463. }
  5464. if (!this._defaultAppearance) {
  5465. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  5466. }
  5467. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  5468. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount);
  5469. let descent = font.descent;
  5470. if (isNaN(descent)) {
  5471. descent = 0;
  5472. }
  5473. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  5474. const vPadding = defaultVPadding + Math.abs(descent) * fontSize;
  5475. const alignment = this.data.textAlignment;
  5476. if (this.data.multiLine) {
  5477. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding, annotationStorage);
  5478. }
  5479. const encodedString = font.encodeString(value).join("");
  5480. if (this.data.comb) {
  5481. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding, annotationStorage);
  5482. }
  5483. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5484. if (alignment === 0 || alignment > 2) {
  5485. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  5486. }
  5487. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  5488. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  5489. }
  5490. static async _getFontData(evaluator, task, appearanceData, resources) {
  5491. const operatorList = new _operator_list.OperatorList();
  5492. const initialState = {
  5493. font: null,
  5494. clone() {
  5495. return this;
  5496. }
  5497. };
  5498. const {
  5499. fontName,
  5500. fontSize
  5501. } = appearanceData;
  5502. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  5503. return initialState.font;
  5504. }
  5505. _getTextWidth(text, font) {
  5506. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  5507. }
  5508. _computeFontSize(height, width, text, font, lineCount) {
  5509. let {
  5510. fontSize
  5511. } = this.data.defaultAppearanceData;
  5512. if (!fontSize) {
  5513. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  5514. if (lineCount === -1) {
  5515. const textWidth = this._getTextWidth(text, font);
  5516. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, width / textWidth));
  5517. } else {
  5518. const lines = text.split(/\r\n?|\n/);
  5519. const cachedLines = [];
  5520. for (const line of lines) {
  5521. const encoded = font.encodeString(line).join("");
  5522. const glyphs = font.charsToGlyphs(encoded);
  5523. const positions = font.getCharPositions(encoded);
  5524. cachedLines.push({
  5525. line: encoded,
  5526. glyphs,
  5527. positions
  5528. });
  5529. }
  5530. const isTooBig = fsize => {
  5531. let totalHeight = 0;
  5532. for (const cache of cachedLines) {
  5533. const chunks = this._splitLine(null, font, fsize, width, cache);
  5534. totalHeight += chunks.length * fsize;
  5535. if (totalHeight > height) {
  5536. return true;
  5537. }
  5538. }
  5539. return false;
  5540. };
  5541. fontSize = 12;
  5542. let lineHeight = fontSize * _util.LINE_FACTOR;
  5543. let numberOfLines = Math.round(height / lineHeight);
  5544. numberOfLines = Math.max(numberOfLines, lineCount);
  5545. while (true) {
  5546. lineHeight = height / numberOfLines;
  5547. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  5548. if (isTooBig(fontSize)) {
  5549. numberOfLines++;
  5550. continue;
  5551. }
  5552. break;
  5553. }
  5554. }
  5555. const {
  5556. fontName,
  5557. fontColor
  5558. } = this.data.defaultAppearanceData;
  5559. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  5560. fontSize,
  5561. fontName,
  5562. fontColor
  5563. });
  5564. }
  5565. return [this._defaultAppearance, fontSize];
  5566. }
  5567. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  5568. let shift;
  5569. if (alignment === 1) {
  5570. const width = this._getTextWidth(text, font) * fontSize;
  5571. shift = (totalWidth - width) / 2;
  5572. } else if (alignment === 2) {
  5573. const width = this._getTextWidth(text, font) * fontSize;
  5574. shift = totalWidth - width - hPadding;
  5575. } else {
  5576. shift = hPadding;
  5577. }
  5578. shift = (0, _core_utils.numberToString)(shift);
  5579. vPadding = (0, _core_utils.numberToString)(vPadding);
  5580. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  5581. }
  5582. _getSaveFieldResources(xref) {
  5583. const {
  5584. localResources,
  5585. appearanceResources,
  5586. acroFormResources
  5587. } = this._fieldResources;
  5588. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  5589. if (!fontName) {
  5590. return localResources || _primitives.Dict.empty;
  5591. }
  5592. for (const resources of [localResources, appearanceResources]) {
  5593. if (resources instanceof _primitives.Dict) {
  5594. const localFont = resources.get("Font");
  5595. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  5596. return resources;
  5597. }
  5598. }
  5599. }
  5600. if (acroFormResources instanceof _primitives.Dict) {
  5601. const acroFormFont = acroFormResources.get("Font");
  5602. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  5603. const subFontDict = new _primitives.Dict(xref);
  5604. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  5605. const subResourcesDict = new _primitives.Dict(xref);
  5606. subResourcesDict.set("Font", subFontDict);
  5607. return _primitives.Dict.merge({
  5608. xref,
  5609. dictArray: [subResourcesDict, localResources],
  5610. mergeSubDicts: true
  5611. });
  5612. }
  5613. }
  5614. return localResources || _primitives.Dict.empty;
  5615. }
  5616. getFieldObject() {
  5617. return null;
  5618. }
  5619. }
  5620. class TextWidgetAnnotation extends WidgetAnnotation {
  5621. constructor(params) {
  5622. super(params);
  5623. this._hasText = true;
  5624. const dict = params.dict;
  5625. if (typeof this.data.fieldValue !== "string") {
  5626. this.data.fieldValue = "";
  5627. }
  5628. let alignment = (0, _core_utils.getInheritableProperty)({
  5629. dict,
  5630. key: "Q"
  5631. });
  5632. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  5633. alignment = null;
  5634. }
  5635. this.data.textAlignment = alignment;
  5636. let maximumLength = (0, _core_utils.getInheritableProperty)({
  5637. dict,
  5638. key: "MaxLen"
  5639. });
  5640. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  5641. maximumLength = 0;
  5642. }
  5643. this.data.maxLen = maximumLength;
  5644. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  5645. 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;
  5646. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  5647. }
  5648. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding, annotationStorage) {
  5649. const combWidth = (0, _core_utils.numberToString)(width / this.data.maxLen);
  5650. const buf = [];
  5651. const positions = font.getCharPositions(text);
  5652. for (const [start, end] of positions) {
  5653. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  5654. }
  5655. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5656. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  5657. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  5658. }
  5659. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding, annotationStorage) {
  5660. const lines = text.split(/\r\n?|\n/);
  5661. const buf = [];
  5662. const totalWidth = width - 2 * hPadding;
  5663. for (const line of lines) {
  5664. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  5665. for (const chunk of chunks) {
  5666. const padding = buf.length === 0 ? hPadding : 0;
  5667. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  5668. }
  5669. }
  5670. const renderedText = buf.join("\n");
  5671. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  5672. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  5673. }
  5674. _splitLine(line, font, fontSize, width, cache = {}) {
  5675. line = cache.line || font.encodeString(line).join("");
  5676. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  5677. if (glyphs.length <= 1) {
  5678. return [line];
  5679. }
  5680. const positions = cache.positions || font.getCharPositions(line);
  5681. const scale = fontSize / 1000;
  5682. const chunks = [];
  5683. let lastSpacePosInStringStart = -1,
  5684. lastSpacePosInStringEnd = -1,
  5685. lastSpacePos = -1,
  5686. startChunk = 0,
  5687. currentWidth = 0;
  5688. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  5689. const [start, end] = positions[i];
  5690. const glyph = glyphs[i];
  5691. const glyphWidth = glyph.width * scale;
  5692. if (glyph.unicode === " ") {
  5693. if (currentWidth + glyphWidth > width) {
  5694. chunks.push(line.substring(startChunk, start));
  5695. startChunk = start;
  5696. currentWidth = glyphWidth;
  5697. lastSpacePosInStringStart = -1;
  5698. lastSpacePos = -1;
  5699. } else {
  5700. currentWidth += glyphWidth;
  5701. lastSpacePosInStringStart = start;
  5702. lastSpacePosInStringEnd = end;
  5703. lastSpacePos = i;
  5704. }
  5705. } else {
  5706. if (currentWidth + glyphWidth > width) {
  5707. if (lastSpacePosInStringStart !== -1) {
  5708. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  5709. startChunk = lastSpacePosInStringEnd;
  5710. i = lastSpacePos + 1;
  5711. lastSpacePosInStringStart = -1;
  5712. currentWidth = 0;
  5713. } else {
  5714. chunks.push(line.substring(startChunk, start));
  5715. startChunk = start;
  5716. currentWidth = glyphWidth;
  5717. }
  5718. } else {
  5719. currentWidth += glyphWidth;
  5720. }
  5721. }
  5722. }
  5723. if (startChunk < line.length) {
  5724. chunks.push(line.substring(startChunk, line.length));
  5725. }
  5726. return chunks;
  5727. }
  5728. getFieldObject() {
  5729. return {
  5730. id: this.data.id,
  5731. value: this.data.fieldValue,
  5732. defaultValue: this.data.defaultFieldValue || "",
  5733. multiline: this.data.multiLine,
  5734. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  5735. charLimit: this.data.maxLen,
  5736. comb: this.data.comb,
  5737. editable: !this.data.readOnly,
  5738. hidden: this.data.hidden,
  5739. name: this.data.fieldName,
  5740. rect: this.data.rect,
  5741. actions: this.data.actions,
  5742. page: this.data.pageIndex,
  5743. strokeColor: this.data.borderColor,
  5744. fillColor: this.data.backgroundColor,
  5745. rotation: this.rotation,
  5746. type: "text"
  5747. };
  5748. }
  5749. }
  5750. class ButtonWidgetAnnotation extends WidgetAnnotation {
  5751. constructor(params) {
  5752. super(params);
  5753. this.checkedAppearance = null;
  5754. this.uncheckedAppearance = null;
  5755. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5756. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5757. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  5758. this.data.isTooltipOnly = false;
  5759. if (this.data.checkBox) {
  5760. this._processCheckBox(params);
  5761. } else if (this.data.radioButton) {
  5762. this._processRadioButton(params);
  5763. } else if (this.data.pushButton) {
  5764. this.data.hasOwnCanvas = true;
  5765. this._processPushButton(params);
  5766. } else {
  5767. (0, _util.warn)("Invalid field flags for button widget annotation");
  5768. }
  5769. }
  5770. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  5771. if (this.data.pushButton) {
  5772. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  5773. }
  5774. let value = null;
  5775. let rotation = null;
  5776. if (annotationStorage) {
  5777. const storageEntry = annotationStorage.get(this.data.id);
  5778. value = storageEntry ? storageEntry.value : null;
  5779. rotation = storageEntry ? storageEntry.rotation : null;
  5780. }
  5781. if (value === null && this.appearance) {
  5782. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5783. }
  5784. if (value === null || value === undefined) {
  5785. if (this.data.checkBox) {
  5786. value = this.data.fieldValue === this.data.exportValue;
  5787. } else {
  5788. value = this.data.fieldValue === this.data.buttonValue;
  5789. }
  5790. }
  5791. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  5792. if (appearance) {
  5793. const savedAppearance = this.appearance;
  5794. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  5795. if (rotation) {
  5796. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  5797. }
  5798. this.appearance = appearance;
  5799. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  5800. this.appearance = savedAppearance;
  5801. appearance.dict.set("Matrix", savedMatrix);
  5802. return operatorList;
  5803. }
  5804. return {
  5805. opList: new _operator_list.OperatorList(),
  5806. separateForm: false,
  5807. separateCanvas: false
  5808. };
  5809. }
  5810. async save(evaluator, task, annotationStorage) {
  5811. if (this.data.checkBox) {
  5812. return this._saveCheckbox(evaluator, task, annotationStorage);
  5813. }
  5814. if (this.data.radioButton) {
  5815. return this._saveRadioButton(evaluator, task, annotationStorage);
  5816. }
  5817. return null;
  5818. }
  5819. async _saveCheckbox(evaluator, task, annotationStorage) {
  5820. if (!annotationStorage) {
  5821. return null;
  5822. }
  5823. const storageEntry = annotationStorage.get(this.data.id);
  5824. let rotation = storageEntry && storageEntry.rotation;
  5825. let value = storageEntry && storageEntry.value;
  5826. if (rotation === undefined) {
  5827. if (value === undefined) {
  5828. return null;
  5829. }
  5830. const defaultValue = this.data.fieldValue === this.data.exportValue;
  5831. if (defaultValue === value) {
  5832. return null;
  5833. }
  5834. }
  5835. const dict = evaluator.xref.fetchIfRef(this.ref);
  5836. if (!(dict instanceof _primitives.Dict)) {
  5837. return null;
  5838. }
  5839. if (rotation === undefined) {
  5840. rotation = this.rotation;
  5841. }
  5842. if (value === undefined) {
  5843. value = this.data.fieldValue === this.data.exportValue;
  5844. }
  5845. const xfa = {
  5846. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5847. value: value ? this.data.exportValue : ""
  5848. };
  5849. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  5850. dict.set("V", name);
  5851. dict.set("AS", name);
  5852. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5853. const maybeMK = this._getMKDict(rotation);
  5854. if (maybeMK) {
  5855. dict.set("MK", maybeMK);
  5856. }
  5857. const encrypt = evaluator.xref.encrypt;
  5858. let originalTransform = null;
  5859. if (encrypt) {
  5860. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5861. }
  5862. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5863. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5864. buffer.push("\nendobj\n");
  5865. return [{
  5866. ref: this.ref,
  5867. data: buffer.join(""),
  5868. xfa
  5869. }];
  5870. }
  5871. async _saveRadioButton(evaluator, task, annotationStorage) {
  5872. if (!annotationStorage) {
  5873. return null;
  5874. }
  5875. const storageEntry = annotationStorage.get(this.data.id);
  5876. let rotation = storageEntry && storageEntry.rotation;
  5877. let value = storageEntry && storageEntry.value;
  5878. if (rotation === undefined) {
  5879. if (value === undefined) {
  5880. return null;
  5881. }
  5882. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  5883. if (defaultValue === value) {
  5884. return null;
  5885. }
  5886. }
  5887. const dict = evaluator.xref.fetchIfRef(this.ref);
  5888. if (!(dict instanceof _primitives.Dict)) {
  5889. return null;
  5890. }
  5891. if (value === undefined) {
  5892. value = this.data.fieldValue === this.data.buttonValue;
  5893. }
  5894. if (rotation === undefined) {
  5895. rotation = this.rotation;
  5896. }
  5897. const xfa = {
  5898. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  5899. value: value ? this.data.buttonValue : ""
  5900. };
  5901. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  5902. let parentBuffer = null;
  5903. const encrypt = evaluator.xref.encrypt;
  5904. if (value) {
  5905. if (this.parent instanceof _primitives.Ref) {
  5906. const parent = evaluator.xref.fetch(this.parent);
  5907. let parentTransform = null;
  5908. if (encrypt) {
  5909. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  5910. }
  5911. parent.set("V", name);
  5912. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  5913. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  5914. parentBuffer.push("\nendobj\n");
  5915. } else if (this.parent instanceof _primitives.Dict) {
  5916. this.parent.set("V", name);
  5917. }
  5918. }
  5919. dict.set("AS", name);
  5920. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  5921. const maybeMK = this._getMKDict(rotation);
  5922. if (maybeMK) {
  5923. dict.set("MK", maybeMK);
  5924. }
  5925. let originalTransform = null;
  5926. if (encrypt) {
  5927. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  5928. }
  5929. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  5930. (0, _writer.writeDict)(dict, buffer, originalTransform);
  5931. buffer.push("\nendobj\n");
  5932. const newRefs = [{
  5933. ref: this.ref,
  5934. data: buffer.join(""),
  5935. xfa
  5936. }];
  5937. if (parentBuffer !== null) {
  5938. newRefs.push({
  5939. ref: this.parent,
  5940. data: parentBuffer.join(""),
  5941. xfa: null
  5942. });
  5943. }
  5944. return newRefs;
  5945. }
  5946. _getDefaultCheckedAppearance(params, type) {
  5947. const width = this.data.rect[2] - this.data.rect[0];
  5948. const height = this.data.rect[3] - this.data.rect[1];
  5949. const bbox = [0, 0, width, height];
  5950. const FONT_RATIO = 0.8;
  5951. const fontSize = Math.min(width, height) * FONT_RATIO;
  5952. let metrics, char;
  5953. if (type === "check") {
  5954. metrics = {
  5955. width: 0.755 * fontSize,
  5956. height: 0.705 * fontSize
  5957. };
  5958. char = "\x33";
  5959. } else if (type === "disc") {
  5960. metrics = {
  5961. width: 0.791 * fontSize,
  5962. height: 0.705 * fontSize
  5963. };
  5964. char = "\x6C";
  5965. } else {
  5966. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  5967. }
  5968. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  5969. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  5970. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  5971. const appearanceStreamDict = new _primitives.Dict(params.xref);
  5972. appearanceStreamDict.set("FormType", 1);
  5973. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  5974. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  5975. appearanceStreamDict.set("BBox", bbox);
  5976. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  5977. appearanceStreamDict.set("Length", appearance.length);
  5978. const resources = new _primitives.Dict(params.xref);
  5979. const font = new _primitives.Dict(params.xref);
  5980. font.set("PdfJsZaDb", this.fallbackFontDict);
  5981. resources.set("Font", font);
  5982. appearanceStreamDict.set("Resources", resources);
  5983. this.checkedAppearance = new _stream.StringStream(appearance);
  5984. this.checkedAppearance.dict = appearanceStreamDict;
  5985. this._streams.push(this.checkedAppearance);
  5986. }
  5987. _processCheckBox(params) {
  5988. const customAppearance = params.dict.get("AP");
  5989. if (!(customAppearance instanceof _primitives.Dict)) {
  5990. return;
  5991. }
  5992. const normalAppearance = customAppearance.get("N");
  5993. if (!(normalAppearance instanceof _primitives.Dict)) {
  5994. return;
  5995. }
  5996. const asValue = this._decodeFormValue(params.dict.get("AS"));
  5997. if (typeof asValue === "string") {
  5998. this.data.fieldValue = asValue;
  5999. }
  6000. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  6001. const exportValues = normalAppearance.getKeys();
  6002. if (exportValues.length === 0) {
  6003. exportValues.push("Off", yes);
  6004. } else if (exportValues.length === 1) {
  6005. if (exportValues[0] === "Off") {
  6006. exportValues.push(yes);
  6007. } else {
  6008. exportValues.unshift("Off");
  6009. }
  6010. } else if (exportValues.includes(yes)) {
  6011. exportValues.length = 0;
  6012. exportValues.push("Off", yes);
  6013. } else {
  6014. const otherYes = exportValues.find(v => v !== "Off");
  6015. exportValues.length = 0;
  6016. exportValues.push("Off", otherYes);
  6017. }
  6018. if (!exportValues.includes(this.data.fieldValue)) {
  6019. this.data.fieldValue = "Off";
  6020. }
  6021. this.data.exportValue = exportValues[1];
  6022. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  6023. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  6024. if (this.checkedAppearance) {
  6025. this._streams.push(this.checkedAppearance);
  6026. } else {
  6027. this._getDefaultCheckedAppearance(params, "check");
  6028. }
  6029. if (this.uncheckedAppearance) {
  6030. this._streams.push(this.uncheckedAppearance);
  6031. }
  6032. this._fallbackFontDict = this.fallbackFontDict;
  6033. }
  6034. _processRadioButton(params) {
  6035. this.data.fieldValue = this.data.buttonValue = null;
  6036. const fieldParent = params.dict.get("Parent");
  6037. if (fieldParent instanceof _primitives.Dict) {
  6038. this.parent = params.dict.getRaw("Parent");
  6039. const fieldParentValue = fieldParent.get("V");
  6040. if (fieldParentValue instanceof _primitives.Name) {
  6041. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  6042. }
  6043. }
  6044. const appearanceStates = params.dict.get("AP");
  6045. if (!(appearanceStates instanceof _primitives.Dict)) {
  6046. return;
  6047. }
  6048. const normalAppearance = appearanceStates.get("N");
  6049. if (!(normalAppearance instanceof _primitives.Dict)) {
  6050. return;
  6051. }
  6052. for (const key of normalAppearance.getKeys()) {
  6053. if (key !== "Off") {
  6054. this.data.buttonValue = this._decodeFormValue(key);
  6055. break;
  6056. }
  6057. }
  6058. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  6059. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  6060. if (this.checkedAppearance) {
  6061. this._streams.push(this.checkedAppearance);
  6062. } else {
  6063. this._getDefaultCheckedAppearance(params, "disc");
  6064. }
  6065. if (this.uncheckedAppearance) {
  6066. this._streams.push(this.uncheckedAppearance);
  6067. }
  6068. this._fallbackFontDict = this.fallbackFontDict;
  6069. }
  6070. _processPushButton(params) {
  6071. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  6072. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  6073. return;
  6074. }
  6075. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  6076. _catalog.Catalog.parseDestDictionary({
  6077. destDict: params.dict,
  6078. resultObj: this.data,
  6079. docBaseUrl: params.pdfManager.docBaseUrl
  6080. });
  6081. }
  6082. getFieldObject() {
  6083. let type = "button";
  6084. let exportValues;
  6085. if (this.data.checkBox) {
  6086. type = "checkbox";
  6087. exportValues = this.data.exportValue;
  6088. } else if (this.data.radioButton) {
  6089. type = "radiobutton";
  6090. exportValues = this.data.buttonValue;
  6091. }
  6092. return {
  6093. id: this.data.id,
  6094. value: this.data.fieldValue || "Off",
  6095. defaultValue: this.data.defaultFieldValue,
  6096. exportValues,
  6097. editable: !this.data.readOnly,
  6098. name: this.data.fieldName,
  6099. rect: this.data.rect,
  6100. hidden: this.data.hidden,
  6101. actions: this.data.actions,
  6102. page: this.data.pageIndex,
  6103. strokeColor: this.data.borderColor,
  6104. fillColor: this.data.backgroundColor,
  6105. rotation: this.rotation,
  6106. type
  6107. };
  6108. }
  6109. get fallbackFontDict() {
  6110. const dict = new _primitives.Dict();
  6111. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  6112. dict.set("Type", _primitives.Name.get("FallbackType"));
  6113. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  6114. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  6115. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  6116. }
  6117. }
  6118. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  6119. constructor(params) {
  6120. super(params);
  6121. this.data.options = [];
  6122. const options = (0, _core_utils.getInheritableProperty)({
  6123. dict: params.dict,
  6124. key: "Opt"
  6125. });
  6126. if (Array.isArray(options)) {
  6127. const xref = params.xref;
  6128. for (let i = 0, ii = options.length; i < ii; i++) {
  6129. const option = xref.fetchIfRef(options[i]);
  6130. const isOptionArray = Array.isArray(option);
  6131. this.data.options[i] = {
  6132. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  6133. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  6134. };
  6135. }
  6136. }
  6137. if (typeof this.data.fieldValue === "string") {
  6138. this.data.fieldValue = [this.data.fieldValue];
  6139. } else if (!this.data.fieldValue) {
  6140. this.data.fieldValue = [];
  6141. }
  6142. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  6143. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  6144. this._hasText = true;
  6145. }
  6146. getFieldObject() {
  6147. const type = this.data.combo ? "combobox" : "listbox";
  6148. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  6149. return {
  6150. id: this.data.id,
  6151. value,
  6152. defaultValue: this.data.defaultFieldValue,
  6153. editable: !this.data.readOnly,
  6154. name: this.data.fieldName,
  6155. rect: this.data.rect,
  6156. numItems: this.data.fieldValue.length,
  6157. multipleSelection: this.data.multiSelect,
  6158. hidden: this.data.hidden,
  6159. actions: this.data.actions,
  6160. items: this.data.options,
  6161. page: this.data.pageIndex,
  6162. strokeColor: this.data.borderColor,
  6163. fillColor: this.data.backgroundColor,
  6164. rotation: this.rotation,
  6165. type
  6166. };
  6167. }
  6168. async _getAppearance(evaluator, task, annotationStorage) {
  6169. if (this.data.combo) {
  6170. return super._getAppearance(evaluator, task, annotationStorage);
  6171. }
  6172. if (!annotationStorage) {
  6173. return null;
  6174. }
  6175. const storageEntry = annotationStorage.get(this.data.id);
  6176. if (!storageEntry) {
  6177. return null;
  6178. }
  6179. const rotation = storageEntry.rotation;
  6180. let exportedValue = storageEntry.value;
  6181. if (rotation === undefined && exportedValue === undefined) {
  6182. return null;
  6183. }
  6184. if (exportedValue === undefined) {
  6185. exportedValue = this.data.fieldValue;
  6186. } else if (!Array.isArray(exportedValue)) {
  6187. exportedValue = [exportedValue];
  6188. }
  6189. const defaultPadding = 2;
  6190. const hPadding = defaultPadding;
  6191. let totalHeight = this.data.rect[3] - this.data.rect[1];
  6192. let totalWidth = this.data.rect[2] - this.data.rect[0];
  6193. if (rotation === 90 || rotation === 270) {
  6194. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  6195. }
  6196. const lineCount = this.data.options.length;
  6197. const valueIndices = [];
  6198. for (let i = 0; i < lineCount; i++) {
  6199. const {
  6200. exportValue
  6201. } = this.data.options[i];
  6202. if (exportedValue.includes(exportValue)) {
  6203. valueIndices.push(i);
  6204. }
  6205. }
  6206. if (!this._defaultAppearance) {
  6207. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  6208. }
  6209. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  6210. let defaultAppearance;
  6211. let {
  6212. fontSize
  6213. } = this.data.defaultAppearanceData;
  6214. if (!fontSize) {
  6215. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  6216. let lineWidth = -1;
  6217. let value;
  6218. for (const {
  6219. displayValue
  6220. } of this.data.options) {
  6221. const width = this._getTextWidth(displayValue, font);
  6222. if (width > lineWidth) {
  6223. lineWidth = width;
  6224. value = displayValue;
  6225. }
  6226. }
  6227. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * hPadding, value, font, -1);
  6228. } else {
  6229. defaultAppearance = this._defaultAppearance;
  6230. }
  6231. const lineHeight = fontSize * _util.LINE_FACTOR;
  6232. const vPadding = (lineHeight - fontSize) / 2;
  6233. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  6234. let firstIndex;
  6235. if (valueIndices.length === 1) {
  6236. const valuePosition = valueIndices[0];
  6237. const indexInPage = valuePosition % numberOfVisibleLines;
  6238. firstIndex = valuePosition - indexInPage;
  6239. } else {
  6240. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  6241. }
  6242. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  6243. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  6244. if (valueIndices.length) {
  6245. buf.push("0.600006 0.756866 0.854904 rg");
  6246. for (const index of valueIndices) {
  6247. if (firstIndex <= index && index < end) {
  6248. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  6249. }
  6250. }
  6251. }
  6252. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  6253. for (let i = firstIndex; i < end; i++) {
  6254. const {
  6255. displayValue
  6256. } = this.data.options[i];
  6257. const hpadding = i === firstIndex ? hPadding : 0;
  6258. const vpadding = i === firstIndex ? vPadding : 0;
  6259. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, hpadding, -lineHeight + vpadding));
  6260. }
  6261. buf.push("ET Q EMC");
  6262. return buf.join("\n");
  6263. }
  6264. }
  6265. class SignatureWidgetAnnotation extends WidgetAnnotation {
  6266. constructor(params) {
  6267. super(params);
  6268. this.data.fieldValue = null;
  6269. }
  6270. getFieldObject() {
  6271. return {
  6272. id: this.data.id,
  6273. value: null,
  6274. page: this.data.pageIndex,
  6275. type: "signature"
  6276. };
  6277. }
  6278. }
  6279. class TextAnnotation extends MarkupAnnotation {
  6280. constructor(parameters) {
  6281. const DEFAULT_ICON_SIZE = 22;
  6282. super(parameters);
  6283. const dict = parameters.dict;
  6284. this.data.annotationType = _util.AnnotationType.TEXT;
  6285. if (this.data.hasAppearance) {
  6286. this.data.name = "NoIcon";
  6287. } else {
  6288. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  6289. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  6290. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  6291. }
  6292. if (dict.has("State")) {
  6293. this.data.state = dict.get("State") || null;
  6294. this.data.stateModel = dict.get("StateModel") || null;
  6295. } else {
  6296. this.data.state = null;
  6297. this.data.stateModel = null;
  6298. }
  6299. }
  6300. }
  6301. class LinkAnnotation extends Annotation {
  6302. constructor(params) {
  6303. super(params);
  6304. this.data.annotationType = _util.AnnotationType.LINK;
  6305. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  6306. if (quadPoints) {
  6307. this.data.quadPoints = quadPoints;
  6308. }
  6309. this.data.borderColor = this.data.borderColor || this.data.color;
  6310. _catalog.Catalog.parseDestDictionary({
  6311. destDict: params.dict,
  6312. resultObj: this.data,
  6313. docBaseUrl: params.pdfManager.docBaseUrl
  6314. });
  6315. }
  6316. }
  6317. class PopupAnnotation extends Annotation {
  6318. constructor(parameters) {
  6319. super(parameters);
  6320. this.data.annotationType = _util.AnnotationType.POPUP;
  6321. let parentItem = parameters.dict.get("Parent");
  6322. if (!parentItem) {
  6323. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  6324. return;
  6325. }
  6326. const parentSubtype = parentItem.get("Subtype");
  6327. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  6328. const rawParent = parameters.dict.getRaw("Parent");
  6329. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  6330. const parentRect = parentItem.getArray("Rect");
  6331. if (Array.isArray(parentRect) && parentRect.length === 4) {
  6332. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  6333. } else {
  6334. this.data.parentRect = [0, 0, 0, 0];
  6335. }
  6336. const rt = parentItem.get("RT");
  6337. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  6338. parentItem = parentItem.get("IRT");
  6339. }
  6340. if (!parentItem.has("M")) {
  6341. this.data.modificationDate = null;
  6342. } else {
  6343. this.setModificationDate(parentItem.get("M"));
  6344. this.data.modificationDate = this.modificationDate;
  6345. }
  6346. if (!parentItem.has("C")) {
  6347. this.data.color = null;
  6348. } else {
  6349. this.setColor(parentItem.getArray("C"));
  6350. this.data.color = this.color;
  6351. }
  6352. if (!this.viewable) {
  6353. const parentFlags = parentItem.get("F");
  6354. if (this._isViewable(parentFlags)) {
  6355. this.setFlags(parentFlags);
  6356. }
  6357. }
  6358. this.setTitle(parentItem.get("T"));
  6359. this.data.titleObj = this._title;
  6360. this.setContents(parentItem.get("Contents"));
  6361. this.data.contentsObj = this._contents;
  6362. if (parentItem.has("RC")) {
  6363. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  6364. }
  6365. }
  6366. }
  6367. exports.PopupAnnotation = PopupAnnotation;
  6368. class FreeTextAnnotation extends MarkupAnnotation {
  6369. constructor(parameters) {
  6370. super(parameters);
  6371. this.data.annotationType = _util.AnnotationType.FREETEXT;
  6372. }
  6373. get hasTextContent() {
  6374. return !!this.appearance;
  6375. }
  6376. static createNewDict(annotation, xref, {
  6377. apRef,
  6378. ap
  6379. }) {
  6380. const {
  6381. color,
  6382. fontSize,
  6383. rect,
  6384. rotation,
  6385. user,
  6386. value
  6387. } = annotation;
  6388. const freetext = new _primitives.Dict(xref);
  6389. freetext.set("Type", _primitives.Name.get("Annot"));
  6390. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  6391. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6392. freetext.set("Rect", rect);
  6393. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  6394. freetext.set("DA", da);
  6395. freetext.set("Contents", value);
  6396. freetext.set("F", 4);
  6397. freetext.set("Border", [0, 0, 0]);
  6398. freetext.set("Rotate", rotation);
  6399. if (user) {
  6400. freetext.set("T", (0, _util.stringToUTF8String)(user));
  6401. }
  6402. const n = new _primitives.Dict(xref);
  6403. freetext.set("AP", n);
  6404. if (apRef) {
  6405. n.set("N", apRef);
  6406. } else {
  6407. n.set("N", ap);
  6408. }
  6409. return freetext;
  6410. }
  6411. static async createNewAppearanceStream(annotation, xref, params) {
  6412. const {
  6413. baseFontRef,
  6414. evaluator,
  6415. task
  6416. } = params;
  6417. const {
  6418. color,
  6419. fontSize,
  6420. rect,
  6421. rotation,
  6422. value
  6423. } = annotation;
  6424. const resources = new _primitives.Dict(xref);
  6425. const font = new _primitives.Dict(xref);
  6426. if (baseFontRef) {
  6427. font.set("Helv", baseFontRef);
  6428. } else {
  6429. const baseFont = new _primitives.Dict(xref);
  6430. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  6431. baseFont.set("Type", _primitives.Name.get("Font"));
  6432. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  6433. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  6434. font.set("Helv", baseFont);
  6435. }
  6436. resources.set("Font", font);
  6437. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  6438. fontName: "Helvetica",
  6439. fontSize
  6440. }, resources);
  6441. const [x1, y1, x2, y2] = rect;
  6442. let w = x2 - x1;
  6443. let h = y2 - y1;
  6444. if (rotation % 180 !== 0) {
  6445. [w, h] = [h, w];
  6446. }
  6447. const lines = value.split("\n");
  6448. const scale = fontSize / 1000;
  6449. let totalWidth = -Infinity;
  6450. const encodedLines = [];
  6451. for (let line of lines) {
  6452. line = helv.encodeString(line).join("");
  6453. encodedLines.push(line);
  6454. let lineWidth = 0;
  6455. const glyphs = helv.charsToGlyphs(line);
  6456. for (const glyph of glyphs) {
  6457. lineWidth += glyph.width * scale;
  6458. }
  6459. totalWidth = Math.max(totalWidth, lineWidth);
  6460. }
  6461. let hscale = 1;
  6462. if (totalWidth > w) {
  6463. hscale = w / totalWidth;
  6464. }
  6465. let vscale = 1;
  6466. const lineHeight = _util.LINE_FACTOR * fontSize;
  6467. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  6468. const totalHeight = lineHeight * lines.length;
  6469. if (totalHeight > h) {
  6470. vscale = h / totalHeight;
  6471. }
  6472. const fscale = Math.min(hscale, vscale);
  6473. const newFontSize = fontSize * fscale;
  6474. 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`];
  6475. const vShift = (0, _core_utils.numberToString)(lineHeight);
  6476. for (const line of encodedLines) {
  6477. buffer.push(`0 -${vShift} Td (${(0, _util.escapeString)(line)}) Tj`);
  6478. }
  6479. buffer.push("ET", "Q");
  6480. const appearance = buffer.join("\n");
  6481. const appearanceStreamDict = new _primitives.Dict(xref);
  6482. appearanceStreamDict.set("FormType", 1);
  6483. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6484. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6485. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6486. appearanceStreamDict.set("Length", appearance.length);
  6487. appearanceStreamDict.set("Resources", resources);
  6488. if (rotation) {
  6489. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  6490. appearanceStreamDict.set("Matrix", matrix);
  6491. }
  6492. const ap = new _stream.StringStream(appearance);
  6493. ap.dict = appearanceStreamDict;
  6494. return ap;
  6495. }
  6496. }
  6497. class LineAnnotation extends MarkupAnnotation {
  6498. constructor(parameters) {
  6499. super(parameters);
  6500. const {
  6501. dict
  6502. } = parameters;
  6503. this.data.annotationType = _util.AnnotationType.LINE;
  6504. const lineCoordinates = dict.getArray("L");
  6505. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  6506. this.setLineEndings(dict.getArray("LE"));
  6507. this.data.lineEndings = this.lineEndings;
  6508. if (!this.appearance) {
  6509. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  6510. const strokeAlpha = dict.get("CA");
  6511. let fillColor = null,
  6512. interiorColor = dict.getArray("IC");
  6513. if (interiorColor) {
  6514. interiorColor = getRgbColor(interiorColor, null);
  6515. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  6516. }
  6517. const fillAlpha = fillColor ? strokeAlpha : null;
  6518. const borderWidth = this.borderStyle.width || 1,
  6519. borderAdjust = 2 * borderWidth;
  6520. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  6521. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6522. this.rectangle = bbox;
  6523. }
  6524. this._setDefaultAppearance({
  6525. xref: parameters.xref,
  6526. extra: `${borderWidth} w`,
  6527. strokeColor,
  6528. fillColor,
  6529. strokeAlpha,
  6530. fillAlpha,
  6531. pointsCallback: (buffer, points) => {
  6532. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  6533. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  6534. }
  6535. });
  6536. }
  6537. }
  6538. }
  6539. class SquareAnnotation extends MarkupAnnotation {
  6540. constructor(parameters) {
  6541. super(parameters);
  6542. this.data.annotationType = _util.AnnotationType.SQUARE;
  6543. if (!this.appearance) {
  6544. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  6545. const strokeAlpha = parameters.dict.get("CA");
  6546. let fillColor = null,
  6547. interiorColor = parameters.dict.getArray("IC");
  6548. if (interiorColor) {
  6549. interiorColor = getRgbColor(interiorColor, null);
  6550. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  6551. }
  6552. const fillAlpha = fillColor ? strokeAlpha : null;
  6553. if (this.borderStyle.width === 0 && !fillColor) {
  6554. return;
  6555. }
  6556. this._setDefaultAppearance({
  6557. xref: parameters.xref,
  6558. extra: `${this.borderStyle.width} w`,
  6559. strokeColor,
  6560. fillColor,
  6561. strokeAlpha,
  6562. fillAlpha,
  6563. pointsCallback: (buffer, points) => {
  6564. const x = points[2].x + this.borderStyle.width / 2;
  6565. const y = points[2].y + this.borderStyle.width / 2;
  6566. const width = points[3].x - points[2].x - this.borderStyle.width;
  6567. const height = points[1].y - points[3].y - this.borderStyle.width;
  6568. buffer.push(`${x} ${y} ${width} ${height} re`);
  6569. if (fillColor) {
  6570. buffer.push("B");
  6571. } else {
  6572. buffer.push("S");
  6573. }
  6574. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6575. }
  6576. });
  6577. }
  6578. }
  6579. }
  6580. class CircleAnnotation extends MarkupAnnotation {
  6581. constructor(parameters) {
  6582. super(parameters);
  6583. this.data.annotationType = _util.AnnotationType.CIRCLE;
  6584. if (!this.appearance) {
  6585. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  6586. const strokeAlpha = parameters.dict.get("CA");
  6587. let fillColor = null;
  6588. let interiorColor = parameters.dict.getArray("IC");
  6589. if (interiorColor) {
  6590. interiorColor = getRgbColor(interiorColor, null);
  6591. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  6592. }
  6593. const fillAlpha = fillColor ? strokeAlpha : null;
  6594. if (this.borderStyle.width === 0 && !fillColor) {
  6595. return;
  6596. }
  6597. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  6598. this._setDefaultAppearance({
  6599. xref: parameters.xref,
  6600. extra: `${this.borderStyle.width} w`,
  6601. strokeColor,
  6602. fillColor,
  6603. strokeAlpha,
  6604. fillAlpha,
  6605. pointsCallback: (buffer, points) => {
  6606. const x0 = points[0].x + this.borderStyle.width / 2;
  6607. const y0 = points[0].y - this.borderStyle.width / 2;
  6608. const x1 = points[3].x - this.borderStyle.width / 2;
  6609. const y1 = points[3].y + this.borderStyle.width / 2;
  6610. const xMid = x0 + (x1 - x0) / 2;
  6611. const yMid = y0 + (y1 - y0) / 2;
  6612. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  6613. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  6614. 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");
  6615. if (fillColor) {
  6616. buffer.push("B");
  6617. } else {
  6618. buffer.push("S");
  6619. }
  6620. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6621. }
  6622. });
  6623. }
  6624. }
  6625. }
  6626. class PolylineAnnotation extends MarkupAnnotation {
  6627. constructor(parameters) {
  6628. super(parameters);
  6629. const {
  6630. dict
  6631. } = parameters;
  6632. this.data.annotationType = _util.AnnotationType.POLYLINE;
  6633. this.data.vertices = [];
  6634. if (!(this instanceof PolygonAnnotation)) {
  6635. this.setLineEndings(dict.getArray("LE"));
  6636. this.data.lineEndings = this.lineEndings;
  6637. }
  6638. const rawVertices = dict.getArray("Vertices");
  6639. if (!Array.isArray(rawVertices)) {
  6640. return;
  6641. }
  6642. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  6643. this.data.vertices.push({
  6644. x: rawVertices[i],
  6645. y: rawVertices[i + 1]
  6646. });
  6647. }
  6648. if (!this.appearance) {
  6649. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  6650. const strokeAlpha = dict.get("CA");
  6651. const borderWidth = this.borderStyle.width || 1,
  6652. borderAdjust = 2 * borderWidth;
  6653. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6654. for (const vertex of this.data.vertices) {
  6655. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6656. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6657. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6658. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6659. }
  6660. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6661. this.rectangle = bbox;
  6662. }
  6663. this._setDefaultAppearance({
  6664. xref: parameters.xref,
  6665. extra: `${borderWidth} w`,
  6666. strokeColor,
  6667. strokeAlpha,
  6668. pointsCallback: (buffer, points) => {
  6669. const vertices = this.data.vertices;
  6670. for (let i = 0, ii = vertices.length; i < ii; i++) {
  6671. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  6672. }
  6673. buffer.push("S");
  6674. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6675. }
  6676. });
  6677. }
  6678. }
  6679. }
  6680. class PolygonAnnotation extends PolylineAnnotation {
  6681. constructor(parameters) {
  6682. super(parameters);
  6683. this.data.annotationType = _util.AnnotationType.POLYGON;
  6684. }
  6685. }
  6686. class CaretAnnotation extends MarkupAnnotation {
  6687. constructor(parameters) {
  6688. super(parameters);
  6689. this.data.annotationType = _util.AnnotationType.CARET;
  6690. }
  6691. }
  6692. class InkAnnotation extends MarkupAnnotation {
  6693. constructor(parameters) {
  6694. super(parameters);
  6695. this.data.annotationType = _util.AnnotationType.INK;
  6696. this.data.inkLists = [];
  6697. const rawInkLists = parameters.dict.getArray("InkList");
  6698. if (!Array.isArray(rawInkLists)) {
  6699. return;
  6700. }
  6701. const xref = parameters.xref;
  6702. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  6703. this.data.inkLists.push([]);
  6704. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  6705. this.data.inkLists[i].push({
  6706. x: xref.fetchIfRef(rawInkLists[i][j]),
  6707. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  6708. });
  6709. }
  6710. }
  6711. if (!this.appearance) {
  6712. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  6713. const strokeAlpha = parameters.dict.get("CA");
  6714. const borderWidth = this.borderStyle.width || 1,
  6715. borderAdjust = 2 * borderWidth;
  6716. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  6717. for (const inkLists of this.data.inkLists) {
  6718. for (const vertex of inkLists) {
  6719. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  6720. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  6721. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  6722. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  6723. }
  6724. }
  6725. if (!_util.Util.intersect(this.rectangle, bbox)) {
  6726. this.rectangle = bbox;
  6727. }
  6728. this._setDefaultAppearance({
  6729. xref: parameters.xref,
  6730. extra: `${borderWidth} w`,
  6731. strokeColor,
  6732. strokeAlpha,
  6733. pointsCallback: (buffer, points) => {
  6734. for (const inkList of this.data.inkLists) {
  6735. for (let i = 0, ii = inkList.length; i < ii; i++) {
  6736. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  6737. }
  6738. buffer.push("S");
  6739. }
  6740. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6741. }
  6742. });
  6743. }
  6744. }
  6745. static createNewDict(annotation, xref, {
  6746. apRef,
  6747. ap
  6748. }) {
  6749. const {
  6750. paths,
  6751. rect,
  6752. rotation
  6753. } = annotation;
  6754. const ink = new _primitives.Dict(xref);
  6755. ink.set("Type", _primitives.Name.get("Annot"));
  6756. ink.set("Subtype", _primitives.Name.get("Ink"));
  6757. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  6758. ink.set("Rect", rect);
  6759. ink.set("InkList", paths.map(p => p.points));
  6760. ink.set("F", 4);
  6761. ink.set("Border", [0, 0, 0]);
  6762. ink.set("Rotate", rotation);
  6763. const n = new _primitives.Dict(xref);
  6764. ink.set("AP", n);
  6765. if (apRef) {
  6766. n.set("N", apRef);
  6767. } else {
  6768. n.set("N", ap);
  6769. }
  6770. return ink;
  6771. }
  6772. static async createNewAppearanceStream(annotation, xref, params) {
  6773. const {
  6774. color,
  6775. rect,
  6776. rotation,
  6777. paths,
  6778. thickness,
  6779. opacity
  6780. } = annotation;
  6781. const [x1, y1, x2, y2] = rect;
  6782. let w = x2 - x1;
  6783. let h = y2 - y1;
  6784. if (rotation % 180 !== 0) {
  6785. [w, h] = [h, w];
  6786. }
  6787. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  6788. if (opacity !== 1) {
  6789. appearanceBuffer.push("/R0 gs");
  6790. }
  6791. const buffer = [];
  6792. for (const {
  6793. bezier
  6794. } of paths) {
  6795. buffer.length = 0;
  6796. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  6797. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  6798. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  6799. buffer.push(`${curve} c`);
  6800. }
  6801. buffer.push("S");
  6802. appearanceBuffer.push(buffer.join("\n"));
  6803. }
  6804. const appearance = appearanceBuffer.join("\n");
  6805. const appearanceStreamDict = new _primitives.Dict(xref);
  6806. appearanceStreamDict.set("FormType", 1);
  6807. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  6808. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  6809. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  6810. appearanceStreamDict.set("Length", appearance.length);
  6811. if (rotation) {
  6812. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  6813. appearanceStreamDict.set("Matrix", matrix);
  6814. }
  6815. if (opacity !== 1) {
  6816. const resources = new _primitives.Dict(xref);
  6817. const extGState = new _primitives.Dict(xref);
  6818. const r0 = new _primitives.Dict(xref);
  6819. r0.set("CA", opacity);
  6820. r0.set("Type", _primitives.Name.get("ExtGState"));
  6821. extGState.set("R0", r0);
  6822. resources.set("ExtGState", extGState);
  6823. appearanceStreamDict.set("Resources", resources);
  6824. }
  6825. const ap = new _stream.StringStream(appearance);
  6826. ap.dict = appearanceStreamDict;
  6827. return ap;
  6828. }
  6829. }
  6830. class HighlightAnnotation extends MarkupAnnotation {
  6831. constructor(parameters) {
  6832. super(parameters);
  6833. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  6834. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  6835. if (quadPoints) {
  6836. const resources = this.appearance && this.appearance.dict.get("Resources");
  6837. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  6838. if (this.appearance) {
  6839. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  6840. }
  6841. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  6842. const fillAlpha = parameters.dict.get("CA");
  6843. this._setDefaultAppearance({
  6844. xref: parameters.xref,
  6845. fillColor,
  6846. blendMode: "Multiply",
  6847. fillAlpha,
  6848. pointsCallback: (buffer, points) => {
  6849. 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");
  6850. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6851. }
  6852. });
  6853. }
  6854. } else {
  6855. this.data.hasPopup = false;
  6856. }
  6857. }
  6858. }
  6859. class UnderlineAnnotation extends MarkupAnnotation {
  6860. constructor(parameters) {
  6861. super(parameters);
  6862. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  6863. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  6864. if (quadPoints) {
  6865. if (!this.appearance) {
  6866. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  6867. const strokeAlpha = parameters.dict.get("CA");
  6868. this._setDefaultAppearance({
  6869. xref: parameters.xref,
  6870. extra: "[] 0 d 1 w",
  6871. strokeColor,
  6872. strokeAlpha,
  6873. pointsCallback: (buffer, points) => {
  6874. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  6875. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6876. }
  6877. });
  6878. }
  6879. } else {
  6880. this.data.hasPopup = false;
  6881. }
  6882. }
  6883. }
  6884. class SquigglyAnnotation extends MarkupAnnotation {
  6885. constructor(parameters) {
  6886. super(parameters);
  6887. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  6888. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  6889. if (quadPoints) {
  6890. if (!this.appearance) {
  6891. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  6892. const strokeAlpha = parameters.dict.get("CA");
  6893. this._setDefaultAppearance({
  6894. xref: parameters.xref,
  6895. extra: "[] 0 d 1 w",
  6896. strokeColor,
  6897. strokeAlpha,
  6898. pointsCallback: (buffer, points) => {
  6899. const dy = (points[0].y - points[2].y) / 6;
  6900. let shift = dy;
  6901. let x = points[2].x;
  6902. const y = points[2].y;
  6903. const xEnd = points[3].x;
  6904. buffer.push(`${x} ${y + shift} m`);
  6905. do {
  6906. x += 2;
  6907. shift = shift === 0 ? dy : 0;
  6908. buffer.push(`${x} ${y + shift} l`);
  6909. } while (x < xEnd);
  6910. buffer.push("S");
  6911. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  6912. }
  6913. });
  6914. }
  6915. } else {
  6916. this.data.hasPopup = false;
  6917. }
  6918. }
  6919. }
  6920. class StrikeOutAnnotation extends MarkupAnnotation {
  6921. constructor(parameters) {
  6922. super(parameters);
  6923. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  6924. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  6925. if (quadPoints) {
  6926. if (!this.appearance) {
  6927. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  6928. const strokeAlpha = parameters.dict.get("CA");
  6929. this._setDefaultAppearance({
  6930. xref: parameters.xref,
  6931. extra: "[] 0 d 1 w",
  6932. strokeColor,
  6933. strokeAlpha,
  6934. pointsCallback: (buffer, points) => {
  6935. 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");
  6936. return [points[0].x, points[1].x, points[3].y, points[1].y];
  6937. }
  6938. });
  6939. }
  6940. } else {
  6941. this.data.hasPopup = false;
  6942. }
  6943. }
  6944. }
  6945. class StampAnnotation extends MarkupAnnotation {
  6946. constructor(parameters) {
  6947. super(parameters);
  6948. this.data.annotationType = _util.AnnotationType.STAMP;
  6949. }
  6950. }
  6951. class FileAttachmentAnnotation extends MarkupAnnotation {
  6952. constructor(parameters) {
  6953. super(parameters);
  6954. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  6955. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  6956. this.data.file = file.serializable;
  6957. }
  6958. }
  6959. /***/ }),
  6960. /* 13 */
  6961. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6962. Object.defineProperty(exports, "__esModule", ({
  6963. value: true
  6964. }));
  6965. exports.createDefaultAppearance = createDefaultAppearance;
  6966. exports.getPdfColor = getPdfColor;
  6967. exports.parseDefaultAppearance = parseDefaultAppearance;
  6968. var _core_utils = __w_pdfjs_require__(6);
  6969. var _util = __w_pdfjs_require__(2);
  6970. var _colorspace = __w_pdfjs_require__(14);
  6971. var _evaluator = __w_pdfjs_require__(15);
  6972. var _primitives = __w_pdfjs_require__(5);
  6973. var _stream = __w_pdfjs_require__(10);
  6974. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  6975. constructor(str) {
  6976. super(new _stream.StringStream(str));
  6977. }
  6978. parse() {
  6979. const operation = {
  6980. fn: 0,
  6981. args: []
  6982. };
  6983. const result = {
  6984. fontSize: 0,
  6985. fontName: "",
  6986. fontColor: new Uint8ClampedArray(3)
  6987. };
  6988. try {
  6989. while (true) {
  6990. operation.args.length = 0;
  6991. if (!this.read(operation)) {
  6992. break;
  6993. }
  6994. if (this.savedStatesDepth !== 0) {
  6995. continue;
  6996. }
  6997. const {
  6998. fn,
  6999. args
  7000. } = operation;
  7001. switch (fn | 0) {
  7002. case _util.OPS.setFont:
  7003. const [fontName, fontSize] = args;
  7004. if (fontName instanceof _primitives.Name) {
  7005. result.fontName = fontName.name;
  7006. }
  7007. if (typeof fontSize === "number" && fontSize > 0) {
  7008. result.fontSize = fontSize;
  7009. }
  7010. break;
  7011. case _util.OPS.setFillRGBColor:
  7012. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  7013. break;
  7014. case _util.OPS.setFillGray:
  7015. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  7016. break;
  7017. case _util.OPS.setFillColorSpace:
  7018. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  7019. break;
  7020. }
  7021. }
  7022. } catch (reason) {
  7023. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  7024. }
  7025. return result;
  7026. }
  7027. }
  7028. function parseDefaultAppearance(str) {
  7029. return new DefaultAppearanceEvaluator(str).parse();
  7030. }
  7031. function getPdfColor(color, isFill) {
  7032. if (color[0] === color[1] && color[1] === color[2]) {
  7033. const gray = color[0] / 255;
  7034. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  7035. }
  7036. return Array.from(color).map(c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  7037. }
  7038. function createDefaultAppearance({
  7039. fontSize,
  7040. fontName,
  7041. fontColor
  7042. }) {
  7043. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  7044. }
  7045. /***/ }),
  7046. /* 14 */
  7047. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7048. Object.defineProperty(exports, "__esModule", ({
  7049. value: true
  7050. }));
  7051. exports.ColorSpace = void 0;
  7052. var _util = __w_pdfjs_require__(2);
  7053. var _primitives = __w_pdfjs_require__(5);
  7054. var _base_stream = __w_pdfjs_require__(7);
  7055. var _core_utils = __w_pdfjs_require__(6);
  7056. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  7057. const COMPONENTS = 3;
  7058. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  7059. const xRatio = w1 / w2;
  7060. const yRatio = h1 / h2;
  7061. let newIndex = 0,
  7062. oldIndex;
  7063. const xScaled = new Uint16Array(w2);
  7064. const w1Scanline = w1 * COMPONENTS;
  7065. for (let i = 0; i < w2; i++) {
  7066. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  7067. }
  7068. for (let i = 0; i < h2; i++) {
  7069. const py = Math.floor(i * yRatio) * w1Scanline;
  7070. for (let j = 0; j < w2; j++) {
  7071. oldIndex = py + xScaled[j];
  7072. dest[newIndex++] = src[oldIndex++];
  7073. dest[newIndex++] = src[oldIndex++];
  7074. dest[newIndex++] = src[oldIndex++];
  7075. newIndex += alpha01;
  7076. }
  7077. }
  7078. }
  7079. class ColorSpace {
  7080. constructor(name, numComps) {
  7081. if (this.constructor === ColorSpace) {
  7082. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  7083. }
  7084. this.name = name;
  7085. this.numComps = numComps;
  7086. }
  7087. getRgb(src, srcOffset) {
  7088. const rgb = new Uint8ClampedArray(3);
  7089. this.getRgbItem(src, srcOffset, rgb, 0);
  7090. return rgb;
  7091. }
  7092. getRgbItem(src, srcOffset, dest, destOffset) {
  7093. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  7094. }
  7095. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7096. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  7097. }
  7098. getOutputLength(inputLength, alpha01) {
  7099. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  7100. }
  7101. isPassthrough(bits) {
  7102. return false;
  7103. }
  7104. isDefaultDecode(decodeMap, bpc) {
  7105. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  7106. }
  7107. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  7108. const count = originalWidth * originalHeight;
  7109. let rgbBuf = null;
  7110. const numComponentColors = 1 << bpc;
  7111. const needsResizing = originalHeight !== height || originalWidth !== width;
  7112. if (this.isPassthrough(bpc)) {
  7113. rgbBuf = comps;
  7114. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  7115. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  7116. for (let i = 0; i < numComponentColors; i++) {
  7117. allColors[i] = i;
  7118. }
  7119. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  7120. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  7121. if (!needsResizing) {
  7122. let destPos = 0;
  7123. for (let i = 0; i < count; ++i) {
  7124. const key = comps[i] * 3;
  7125. dest[destPos++] = colorMap[key];
  7126. dest[destPos++] = colorMap[key + 1];
  7127. dest[destPos++] = colorMap[key + 2];
  7128. destPos += alpha01;
  7129. }
  7130. } else {
  7131. rgbBuf = new Uint8Array(count * 3);
  7132. let rgbPos = 0;
  7133. for (let i = 0; i < count; ++i) {
  7134. const key = comps[i] * 3;
  7135. rgbBuf[rgbPos++] = colorMap[key];
  7136. rgbBuf[rgbPos++] = colorMap[key + 1];
  7137. rgbBuf[rgbPos++] = colorMap[key + 2];
  7138. }
  7139. }
  7140. } else {
  7141. if (!needsResizing) {
  7142. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  7143. } else {
  7144. rgbBuf = new Uint8ClampedArray(count * 3);
  7145. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  7146. }
  7147. }
  7148. if (rgbBuf) {
  7149. if (needsResizing) {
  7150. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  7151. } else {
  7152. let destPos = 0,
  7153. rgbPos = 0;
  7154. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  7155. dest[destPos++] = rgbBuf[rgbPos++];
  7156. dest[destPos++] = rgbBuf[rgbPos++];
  7157. dest[destPos++] = rgbBuf[rgbPos++];
  7158. destPos += alpha01;
  7159. }
  7160. }
  7161. }
  7162. }
  7163. get usesZeroToOneRange() {
  7164. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  7165. }
  7166. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  7167. if (!localColorSpaceCache) {
  7168. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  7169. }
  7170. if (!parsedColorSpace) {
  7171. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  7172. }
  7173. let csName, csRef;
  7174. if (cacheKey instanceof _primitives.Ref) {
  7175. csRef = cacheKey;
  7176. cacheKey = xref.fetch(cacheKey);
  7177. }
  7178. if (cacheKey instanceof _primitives.Name) {
  7179. csName = cacheKey.name;
  7180. }
  7181. if (csName || csRef) {
  7182. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  7183. }
  7184. }
  7185. static getCached(cacheKey, xref, localColorSpaceCache) {
  7186. if (!localColorSpaceCache) {
  7187. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  7188. }
  7189. if (cacheKey instanceof _primitives.Ref) {
  7190. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  7191. if (localColorSpace) {
  7192. return localColorSpace;
  7193. }
  7194. try {
  7195. cacheKey = xref.fetch(cacheKey);
  7196. } catch (ex) {
  7197. if (ex instanceof _core_utils.MissingDataException) {
  7198. throw ex;
  7199. }
  7200. }
  7201. }
  7202. if (cacheKey instanceof _primitives.Name) {
  7203. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  7204. if (localColorSpace) {
  7205. return localColorSpace;
  7206. }
  7207. }
  7208. return null;
  7209. }
  7210. static async parseAsync({
  7211. cs,
  7212. xref,
  7213. resources = null,
  7214. pdfFunctionFactory,
  7215. localColorSpaceCache
  7216. }) {
  7217. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7218. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7219. return parsedColorSpace;
  7220. }
  7221. static parse({
  7222. cs,
  7223. xref,
  7224. resources = null,
  7225. pdfFunctionFactory,
  7226. localColorSpaceCache
  7227. }) {
  7228. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  7229. if (cachedColorSpace) {
  7230. return cachedColorSpace;
  7231. }
  7232. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  7233. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  7234. return parsedColorSpace;
  7235. }
  7236. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  7237. cs = xref.fetchIfRef(cs);
  7238. if (cs instanceof _primitives.Name) {
  7239. switch (cs.name) {
  7240. case "G":
  7241. case "DeviceGray":
  7242. return this.singletons.gray;
  7243. case "RGB":
  7244. case "DeviceRGB":
  7245. return this.singletons.rgb;
  7246. case "CMYK":
  7247. case "DeviceCMYK":
  7248. return this.singletons.cmyk;
  7249. case "Pattern":
  7250. return new PatternCS(null);
  7251. default:
  7252. if (resources instanceof _primitives.Dict) {
  7253. const colorSpaces = resources.get("ColorSpace");
  7254. if (colorSpaces instanceof _primitives.Dict) {
  7255. const resourcesCS = colorSpaces.get(cs.name);
  7256. if (resourcesCS) {
  7257. if (resourcesCS instanceof _primitives.Name) {
  7258. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  7259. }
  7260. cs = resourcesCS;
  7261. break;
  7262. }
  7263. }
  7264. }
  7265. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  7266. }
  7267. }
  7268. if (Array.isArray(cs)) {
  7269. const mode = xref.fetchIfRef(cs[0]).name;
  7270. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  7271. switch (mode) {
  7272. case "G":
  7273. case "DeviceGray":
  7274. return this.singletons.gray;
  7275. case "RGB":
  7276. case "DeviceRGB":
  7277. return this.singletons.rgb;
  7278. case "CMYK":
  7279. case "DeviceCMYK":
  7280. return this.singletons.cmyk;
  7281. case "CalGray":
  7282. params = xref.fetchIfRef(cs[1]);
  7283. whitePoint = params.getArray("WhitePoint");
  7284. blackPoint = params.getArray("BlackPoint");
  7285. gamma = params.get("Gamma");
  7286. return new CalGrayCS(whitePoint, blackPoint, gamma);
  7287. case "CalRGB":
  7288. params = xref.fetchIfRef(cs[1]);
  7289. whitePoint = params.getArray("WhitePoint");
  7290. blackPoint = params.getArray("BlackPoint");
  7291. gamma = params.getArray("Gamma");
  7292. const matrix = params.getArray("Matrix");
  7293. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  7294. case "ICCBased":
  7295. const stream = xref.fetchIfRef(cs[1]);
  7296. const dict = stream.dict;
  7297. numComps = dict.get("N");
  7298. const alt = dict.get("Alternate");
  7299. if (alt) {
  7300. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  7301. if (altCS.numComps === numComps) {
  7302. return altCS;
  7303. }
  7304. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  7305. }
  7306. if (numComps === 1) {
  7307. return this.singletons.gray;
  7308. } else if (numComps === 3) {
  7309. return this.singletons.rgb;
  7310. } else if (numComps === 4) {
  7311. return this.singletons.cmyk;
  7312. }
  7313. break;
  7314. case "Pattern":
  7315. baseCS = cs[1] || null;
  7316. if (baseCS) {
  7317. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  7318. }
  7319. return new PatternCS(baseCS);
  7320. case "I":
  7321. case "Indexed":
  7322. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  7323. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  7324. const lookup = xref.fetchIfRef(cs[3]);
  7325. return new IndexedCS(baseCS, hiVal, lookup);
  7326. case "Separation":
  7327. case "DeviceN":
  7328. const name = xref.fetchIfRef(cs[1]);
  7329. numComps = Array.isArray(name) ? name.length : 1;
  7330. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  7331. const tintFn = pdfFunctionFactory.create(cs[3]);
  7332. return new AlternateCS(numComps, baseCS, tintFn);
  7333. case "Lab":
  7334. params = xref.fetchIfRef(cs[1]);
  7335. whitePoint = params.getArray("WhitePoint");
  7336. blackPoint = params.getArray("BlackPoint");
  7337. const range = params.getArray("Range");
  7338. return new LabCS(whitePoint, blackPoint, range);
  7339. default:
  7340. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  7341. }
  7342. }
  7343. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  7344. }
  7345. static isDefaultDecode(decode, numComps) {
  7346. if (!Array.isArray(decode)) {
  7347. return true;
  7348. }
  7349. if (numComps * 2 !== decode.length) {
  7350. (0, _util.warn)("The decode map is not the correct length");
  7351. return true;
  7352. }
  7353. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  7354. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  7355. return false;
  7356. }
  7357. }
  7358. return true;
  7359. }
  7360. static get singletons() {
  7361. return (0, _util.shadow)(this, "singletons", {
  7362. get gray() {
  7363. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  7364. },
  7365. get rgb() {
  7366. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  7367. },
  7368. get cmyk() {
  7369. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  7370. }
  7371. });
  7372. }
  7373. }
  7374. exports.ColorSpace = ColorSpace;
  7375. class AlternateCS extends ColorSpace {
  7376. constructor(numComps, base, tintFn) {
  7377. super("Alternate", numComps);
  7378. this.base = base;
  7379. this.tintFn = tintFn;
  7380. this.tmpBuf = new Float32Array(base.numComps);
  7381. }
  7382. getRgbItem(src, srcOffset, dest, destOffset) {
  7383. const tmpBuf = this.tmpBuf;
  7384. this.tintFn(src, srcOffset, tmpBuf, 0);
  7385. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  7386. }
  7387. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7388. const tintFn = this.tintFn;
  7389. const base = this.base;
  7390. const scale = 1 / ((1 << bits) - 1);
  7391. const baseNumComps = base.numComps;
  7392. const usesZeroToOneRange = base.usesZeroToOneRange;
  7393. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  7394. let pos = isPassthrough ? destOffset : 0;
  7395. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  7396. const numComps = this.numComps;
  7397. const scaled = new Float32Array(numComps);
  7398. const tinted = new Float32Array(baseNumComps);
  7399. let i, j;
  7400. for (i = 0; i < count; i++) {
  7401. for (j = 0; j < numComps; j++) {
  7402. scaled[j] = src[srcOffset++] * scale;
  7403. }
  7404. tintFn(scaled, 0, tinted, 0);
  7405. if (usesZeroToOneRange) {
  7406. for (j = 0; j < baseNumComps; j++) {
  7407. baseBuf[pos++] = tinted[j] * 255;
  7408. }
  7409. } else {
  7410. base.getRgbItem(tinted, 0, baseBuf, pos);
  7411. pos += baseNumComps;
  7412. }
  7413. }
  7414. if (!isPassthrough) {
  7415. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  7416. }
  7417. }
  7418. getOutputLength(inputLength, alpha01) {
  7419. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  7420. }
  7421. }
  7422. class PatternCS extends ColorSpace {
  7423. constructor(baseCS) {
  7424. super("Pattern", null);
  7425. this.base = baseCS;
  7426. }
  7427. isDefaultDecode(decodeMap, bpc) {
  7428. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  7429. }
  7430. }
  7431. class IndexedCS extends ColorSpace {
  7432. constructor(base, highVal, lookup) {
  7433. super("Indexed", 1);
  7434. this.base = base;
  7435. this.highVal = highVal;
  7436. const length = base.numComps * highVal;
  7437. this.lookup = new Uint8Array(length);
  7438. if (lookup instanceof _base_stream.BaseStream) {
  7439. const bytes = lookup.getBytes(length);
  7440. this.lookup.set(bytes);
  7441. } else if (typeof lookup === "string") {
  7442. for (let i = 0; i < length; ++i) {
  7443. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  7444. }
  7445. } else {
  7446. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  7447. }
  7448. }
  7449. getRgbItem(src, srcOffset, dest, destOffset) {
  7450. const numComps = this.base.numComps;
  7451. const start = src[srcOffset] * numComps;
  7452. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  7453. }
  7454. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7455. const base = this.base;
  7456. const numComps = base.numComps;
  7457. const outputDelta = base.getOutputLength(numComps, alpha01);
  7458. const lookup = this.lookup;
  7459. for (let i = 0; i < count; ++i) {
  7460. const lookupPos = src[srcOffset++] * numComps;
  7461. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  7462. destOffset += outputDelta;
  7463. }
  7464. }
  7465. getOutputLength(inputLength, alpha01) {
  7466. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  7467. }
  7468. isDefaultDecode(decodeMap, bpc) {
  7469. if (!Array.isArray(decodeMap)) {
  7470. return true;
  7471. }
  7472. if (decodeMap.length !== 2) {
  7473. (0, _util.warn)("Decode map length is not correct");
  7474. return true;
  7475. }
  7476. if (!Number.isInteger(bpc) || bpc < 1) {
  7477. (0, _util.warn)("Bits per component is not correct");
  7478. return true;
  7479. }
  7480. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  7481. }
  7482. }
  7483. class DeviceGrayCS extends ColorSpace {
  7484. constructor() {
  7485. super("DeviceGray", 1);
  7486. }
  7487. getRgbItem(src, srcOffset, dest, destOffset) {
  7488. const c = src[srcOffset] * 255;
  7489. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  7490. }
  7491. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7492. const scale = 255 / ((1 << bits) - 1);
  7493. let j = srcOffset,
  7494. q = destOffset;
  7495. for (let i = 0; i < count; ++i) {
  7496. const c = scale * src[j++];
  7497. dest[q++] = c;
  7498. dest[q++] = c;
  7499. dest[q++] = c;
  7500. q += alpha01;
  7501. }
  7502. }
  7503. getOutputLength(inputLength, alpha01) {
  7504. return inputLength * (3 + alpha01);
  7505. }
  7506. }
  7507. class DeviceRgbCS extends ColorSpace {
  7508. constructor() {
  7509. super("DeviceRGB", 3);
  7510. }
  7511. getRgbItem(src, srcOffset, dest, destOffset) {
  7512. dest[destOffset] = src[srcOffset] * 255;
  7513. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  7514. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  7515. }
  7516. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7517. if (bits === 8 && alpha01 === 0) {
  7518. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  7519. return;
  7520. }
  7521. const scale = 255 / ((1 << bits) - 1);
  7522. let j = srcOffset,
  7523. q = destOffset;
  7524. for (let i = 0; i < count; ++i) {
  7525. dest[q++] = scale * src[j++];
  7526. dest[q++] = scale * src[j++];
  7527. dest[q++] = scale * src[j++];
  7528. q += alpha01;
  7529. }
  7530. }
  7531. getOutputLength(inputLength, alpha01) {
  7532. return inputLength * (3 + alpha01) / 3 | 0;
  7533. }
  7534. isPassthrough(bits) {
  7535. return bits === 8;
  7536. }
  7537. }
  7538. const DeviceCmykCS = function DeviceCmykCSClosure() {
  7539. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  7540. const c = src[srcOffset] * srcScale;
  7541. const m = src[srcOffset + 1] * srcScale;
  7542. const y = src[srcOffset + 2] * srcScale;
  7543. const k = src[srcOffset + 3] * srcScale;
  7544. 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);
  7545. 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);
  7546. 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);
  7547. }
  7548. class DeviceCmykCS extends ColorSpace {
  7549. constructor() {
  7550. super("DeviceCMYK", 4);
  7551. }
  7552. getRgbItem(src, srcOffset, dest, destOffset) {
  7553. convertToRgb(src, srcOffset, 1, dest, destOffset);
  7554. }
  7555. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7556. const scale = 1 / ((1 << bits) - 1);
  7557. for (let i = 0; i < count; i++) {
  7558. convertToRgb(src, srcOffset, scale, dest, destOffset);
  7559. srcOffset += 4;
  7560. destOffset += 3 + alpha01;
  7561. }
  7562. }
  7563. getOutputLength(inputLength, alpha01) {
  7564. return inputLength / 4 * (3 + alpha01) | 0;
  7565. }
  7566. }
  7567. return DeviceCmykCS;
  7568. }();
  7569. const CalGrayCS = function CalGrayCSClosure() {
  7570. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  7571. const A = src[srcOffset] * scale;
  7572. const AG = A ** cs.G;
  7573. const L = cs.YW * AG;
  7574. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  7575. dest[destOffset] = val;
  7576. dest[destOffset + 1] = val;
  7577. dest[destOffset + 2] = val;
  7578. }
  7579. class CalGrayCS extends ColorSpace {
  7580. constructor(whitePoint, blackPoint, gamma) {
  7581. super("CalGray", 1);
  7582. if (!whitePoint) {
  7583. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  7584. }
  7585. blackPoint = blackPoint || [0, 0, 0];
  7586. gamma = gamma || 1;
  7587. this.XW = whitePoint[0];
  7588. this.YW = whitePoint[1];
  7589. this.ZW = whitePoint[2];
  7590. this.XB = blackPoint[0];
  7591. this.YB = blackPoint[1];
  7592. this.ZB = blackPoint[2];
  7593. this.G = gamma;
  7594. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  7595. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  7596. }
  7597. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  7598. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  7599. this.XB = this.YB = this.ZB = 0;
  7600. }
  7601. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  7602. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  7603. }
  7604. if (this.G < 1) {
  7605. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  7606. this.G = 1;
  7607. }
  7608. }
  7609. getRgbItem(src, srcOffset, dest, destOffset) {
  7610. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  7611. }
  7612. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7613. const scale = 1 / ((1 << bits) - 1);
  7614. for (let i = 0; i < count; ++i) {
  7615. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  7616. srcOffset += 1;
  7617. destOffset += 3 + alpha01;
  7618. }
  7619. }
  7620. getOutputLength(inputLength, alpha01) {
  7621. return inputLength * (3 + alpha01);
  7622. }
  7623. }
  7624. return CalGrayCS;
  7625. }();
  7626. const CalRGBCS = function CalRGBCSClosure() {
  7627. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  7628. 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]);
  7629. 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]);
  7630. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  7631. const tempNormalizeMatrix = new Float32Array(3);
  7632. const tempConvertMatrix1 = new Float32Array(3);
  7633. const tempConvertMatrix2 = new Float32Array(3);
  7634. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  7635. function matrixProduct(a, b, result) {
  7636. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  7637. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  7638. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  7639. }
  7640. function convertToFlat(sourceWhitePoint, LMS, result) {
  7641. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  7642. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  7643. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  7644. }
  7645. function convertToD65(sourceWhitePoint, LMS, result) {
  7646. const D65X = 0.95047;
  7647. const D65Y = 1;
  7648. const D65Z = 1.08883;
  7649. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  7650. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  7651. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  7652. }
  7653. function sRGBTransferFunction(color) {
  7654. if (color <= 0.0031308) {
  7655. return adjustToRange(0, 1, 12.92 * color);
  7656. }
  7657. if (color >= 0.99554525) {
  7658. return 1;
  7659. }
  7660. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  7661. }
  7662. function adjustToRange(min, max, value) {
  7663. return Math.max(min, Math.min(max, value));
  7664. }
  7665. function decodeL(L) {
  7666. if (L < 0) {
  7667. return -decodeL(-L);
  7668. }
  7669. if (L > 8.0) {
  7670. return ((L + 16) / 116) ** 3;
  7671. }
  7672. return L * DECODE_L_CONSTANT;
  7673. }
  7674. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  7675. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  7676. result[0] = XYZ_Flat[0];
  7677. result[1] = XYZ_Flat[1];
  7678. result[2] = XYZ_Flat[2];
  7679. return;
  7680. }
  7681. const zeroDecodeL = decodeL(0);
  7682. const X_DST = zeroDecodeL;
  7683. const X_SRC = decodeL(sourceBlackPoint[0]);
  7684. const Y_DST = zeroDecodeL;
  7685. const Y_SRC = decodeL(sourceBlackPoint[1]);
  7686. const Z_DST = zeroDecodeL;
  7687. const Z_SRC = decodeL(sourceBlackPoint[2]);
  7688. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  7689. const X_Offset = 1 - X_Scale;
  7690. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  7691. const Y_Offset = 1 - Y_Scale;
  7692. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  7693. const Z_Offset = 1 - Z_Scale;
  7694. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  7695. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  7696. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  7697. }
  7698. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  7699. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  7700. result[0] = XYZ_In[0];
  7701. result[1] = XYZ_In[1];
  7702. result[2] = XYZ_In[2];
  7703. return;
  7704. }
  7705. const LMS = result;
  7706. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  7707. const LMS_Flat = tempNormalizeMatrix;
  7708. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  7709. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  7710. }
  7711. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  7712. const LMS = result;
  7713. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  7714. const LMS_D65 = tempNormalizeMatrix;
  7715. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  7716. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  7717. }
  7718. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  7719. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  7720. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  7721. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  7722. const AGR = A === 1 ? 1 : A ** cs.GR;
  7723. const BGG = B === 1 ? 1 : B ** cs.GG;
  7724. const CGB = C === 1 ? 1 : C ** cs.GB;
  7725. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  7726. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  7727. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  7728. const XYZ = tempConvertMatrix1;
  7729. XYZ[0] = X;
  7730. XYZ[1] = Y;
  7731. XYZ[2] = Z;
  7732. const XYZ_Flat = tempConvertMatrix2;
  7733. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  7734. const XYZ_Black = tempConvertMatrix1;
  7735. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  7736. const XYZ_D65 = tempConvertMatrix2;
  7737. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  7738. const SRGB = tempConvertMatrix1;
  7739. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  7740. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  7741. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  7742. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  7743. }
  7744. class CalRGBCS extends ColorSpace {
  7745. constructor(whitePoint, blackPoint, gamma, matrix) {
  7746. super("CalRGB", 3);
  7747. if (!whitePoint) {
  7748. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  7749. }
  7750. blackPoint = blackPoint || new Float32Array(3);
  7751. gamma = gamma || new Float32Array([1, 1, 1]);
  7752. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  7753. const XW = whitePoint[0];
  7754. const YW = whitePoint[1];
  7755. const ZW = whitePoint[2];
  7756. this.whitePoint = whitePoint;
  7757. const XB = blackPoint[0];
  7758. const YB = blackPoint[1];
  7759. const ZB = blackPoint[2];
  7760. this.blackPoint = blackPoint;
  7761. this.GR = gamma[0];
  7762. this.GG = gamma[1];
  7763. this.GB = gamma[2];
  7764. this.MXA = matrix[0];
  7765. this.MYA = matrix[1];
  7766. this.MZA = matrix[2];
  7767. this.MXB = matrix[3];
  7768. this.MYB = matrix[4];
  7769. this.MZB = matrix[5];
  7770. this.MXC = matrix[6];
  7771. this.MYC = matrix[7];
  7772. this.MZC = matrix[8];
  7773. if (XW < 0 || ZW < 0 || YW !== 1) {
  7774. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  7775. }
  7776. if (XB < 0 || YB < 0 || ZB < 0) {
  7777. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  7778. this.blackPoint = new Float32Array(3);
  7779. }
  7780. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  7781. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  7782. this.GR = this.GG = this.GB = 1;
  7783. }
  7784. }
  7785. getRgbItem(src, srcOffset, dest, destOffset) {
  7786. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  7787. }
  7788. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7789. const scale = 1 / ((1 << bits) - 1);
  7790. for (let i = 0; i < count; ++i) {
  7791. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  7792. srcOffset += 3;
  7793. destOffset += 3 + alpha01;
  7794. }
  7795. }
  7796. getOutputLength(inputLength, alpha01) {
  7797. return inputLength * (3 + alpha01) / 3 | 0;
  7798. }
  7799. }
  7800. return CalRGBCS;
  7801. }();
  7802. const LabCS = function LabCSClosure() {
  7803. function fn_g(x) {
  7804. let result;
  7805. if (x >= 6 / 29) {
  7806. result = x ** 3;
  7807. } else {
  7808. result = 108 / 841 * (x - 4 / 29);
  7809. }
  7810. return result;
  7811. }
  7812. function decode(value, high1, low2, high2) {
  7813. return low2 + value * (high2 - low2) / high1;
  7814. }
  7815. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  7816. let Ls = src[srcOffset];
  7817. let as = src[srcOffset + 1];
  7818. let bs = src[srcOffset + 2];
  7819. if (maxVal !== false) {
  7820. Ls = decode(Ls, maxVal, 0, 100);
  7821. as = decode(as, maxVal, cs.amin, cs.amax);
  7822. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  7823. }
  7824. if (as > cs.amax) {
  7825. as = cs.amax;
  7826. } else if (as < cs.amin) {
  7827. as = cs.amin;
  7828. }
  7829. if (bs > cs.bmax) {
  7830. bs = cs.bmax;
  7831. } else if (bs < cs.bmin) {
  7832. bs = cs.bmin;
  7833. }
  7834. const M = (Ls + 16) / 116;
  7835. const L = M + as / 500;
  7836. const N = M - bs / 200;
  7837. const X = cs.XW * fn_g(L);
  7838. const Y = cs.YW * fn_g(M);
  7839. const Z = cs.ZW * fn_g(N);
  7840. let r, g, b;
  7841. if (cs.ZW < 1) {
  7842. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  7843. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  7844. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  7845. } else {
  7846. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  7847. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  7848. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  7849. }
  7850. dest[destOffset] = Math.sqrt(r) * 255;
  7851. dest[destOffset + 1] = Math.sqrt(g) * 255;
  7852. dest[destOffset + 2] = Math.sqrt(b) * 255;
  7853. }
  7854. class LabCS extends ColorSpace {
  7855. constructor(whitePoint, blackPoint, range) {
  7856. super("Lab", 3);
  7857. if (!whitePoint) {
  7858. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  7859. }
  7860. blackPoint = blackPoint || [0, 0, 0];
  7861. range = range || [-100, 100, -100, 100];
  7862. this.XW = whitePoint[0];
  7863. this.YW = whitePoint[1];
  7864. this.ZW = whitePoint[2];
  7865. this.amin = range[0];
  7866. this.amax = range[1];
  7867. this.bmin = range[2];
  7868. this.bmax = range[3];
  7869. this.XB = blackPoint[0];
  7870. this.YB = blackPoint[1];
  7871. this.ZB = blackPoint[2];
  7872. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  7873. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  7874. }
  7875. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  7876. (0, _util.info)("Invalid BlackPoint, falling back to default");
  7877. this.XB = this.YB = this.ZB = 0;
  7878. }
  7879. if (this.amin > this.amax || this.bmin > this.bmax) {
  7880. (0, _util.info)("Invalid Range, falling back to defaults");
  7881. this.amin = -100;
  7882. this.amax = 100;
  7883. this.bmin = -100;
  7884. this.bmax = 100;
  7885. }
  7886. }
  7887. getRgbItem(src, srcOffset, dest, destOffset) {
  7888. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  7889. }
  7890. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  7891. const maxVal = (1 << bits) - 1;
  7892. for (let i = 0; i < count; i++) {
  7893. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  7894. srcOffset += 3;
  7895. destOffset += 3 + alpha01;
  7896. }
  7897. }
  7898. getOutputLength(inputLength, alpha01) {
  7899. return inputLength * (3 + alpha01) / 3 | 0;
  7900. }
  7901. isDefaultDecode(decodeMap, bpc) {
  7902. return true;
  7903. }
  7904. get usesZeroToOneRange() {
  7905. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  7906. }
  7907. }
  7908. return LabCS;
  7909. }();
  7910. /***/ }),
  7911. /* 15 */
  7912. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7913. Object.defineProperty(exports, "__esModule", ({
  7914. value: true
  7915. }));
  7916. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  7917. var _util = __w_pdfjs_require__(2);
  7918. var _cmap = __w_pdfjs_require__(16);
  7919. var _primitives = __w_pdfjs_require__(5);
  7920. var _fonts = __w_pdfjs_require__(34);
  7921. var _fonts_utils = __w_pdfjs_require__(38);
  7922. var _encodings = __w_pdfjs_require__(37);
  7923. var _standard_fonts = __w_pdfjs_require__(41);
  7924. var _unicode = __w_pdfjs_require__(40);
  7925. var _pattern = __w_pdfjs_require__(50);
  7926. var _xfa_fonts = __w_pdfjs_require__(51);
  7927. var _to_unicode_map = __w_pdfjs_require__(42);
  7928. var _function = __w_pdfjs_require__(57);
  7929. var _parser = __w_pdfjs_require__(17);
  7930. var _image_utils = __w_pdfjs_require__(59);
  7931. var _stream = __w_pdfjs_require__(10);
  7932. var _base_stream = __w_pdfjs_require__(7);
  7933. var _bidi = __w_pdfjs_require__(60);
  7934. var _colorspace = __w_pdfjs_require__(14);
  7935. var _decode_stream = __w_pdfjs_require__(19);
  7936. var _glyphlist = __w_pdfjs_require__(39);
  7937. var _core_utils = __w_pdfjs_require__(6);
  7938. var _metrics = __w_pdfjs_require__(45);
  7939. var _murmurhash = __w_pdfjs_require__(61);
  7940. var _operator_list = __w_pdfjs_require__(62);
  7941. var _image = __w_pdfjs_require__(63);
  7942. const DefaultPartialEvaluatorOptions = Object.freeze({
  7943. maxImageSize: -1,
  7944. disableFontFace: false,
  7945. ignoreErrors: false,
  7946. isEvalSupported: true,
  7947. fontExtraProperties: false,
  7948. useSystemFonts: true,
  7949. cMapUrl: null,
  7950. standardFontDataUrl: null
  7951. });
  7952. const PatternType = {
  7953. TILING: 1,
  7954. SHADING: 2
  7955. };
  7956. const TEXT_CHUNK_BATCH_SIZE = 10;
  7957. const deferred = Promise.resolve();
  7958. function normalizeBlendMode(value, parsingArray = false) {
  7959. if (Array.isArray(value)) {
  7960. for (let i = 0, ii = value.length; i < ii; i++) {
  7961. const maybeBM = normalizeBlendMode(value[i], true);
  7962. if (maybeBM) {
  7963. return maybeBM;
  7964. }
  7965. }
  7966. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  7967. return "source-over";
  7968. }
  7969. if (!(value instanceof _primitives.Name)) {
  7970. if (parsingArray) {
  7971. return null;
  7972. }
  7973. return "source-over";
  7974. }
  7975. switch (value.name) {
  7976. case "Normal":
  7977. case "Compatible":
  7978. return "source-over";
  7979. case "Multiply":
  7980. return "multiply";
  7981. case "Screen":
  7982. return "screen";
  7983. case "Overlay":
  7984. return "overlay";
  7985. case "Darken":
  7986. return "darken";
  7987. case "Lighten":
  7988. return "lighten";
  7989. case "ColorDodge":
  7990. return "color-dodge";
  7991. case "ColorBurn":
  7992. return "color-burn";
  7993. case "HardLight":
  7994. return "hard-light";
  7995. case "SoftLight":
  7996. return "soft-light";
  7997. case "Difference":
  7998. return "difference";
  7999. case "Exclusion":
  8000. return "exclusion";
  8001. case "Hue":
  8002. return "hue";
  8003. case "Saturation":
  8004. return "saturation";
  8005. case "Color":
  8006. return "color";
  8007. case "Luminosity":
  8008. return "luminosity";
  8009. }
  8010. if (parsingArray) {
  8011. return null;
  8012. }
  8013. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  8014. return "source-over";
  8015. }
  8016. function incrementCachedImageMaskCount(data) {
  8017. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  8018. data.args[0].count++;
  8019. }
  8020. }
  8021. class TimeSlotManager {
  8022. static get TIME_SLOT_DURATION_MS() {
  8023. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  8024. }
  8025. static get CHECK_TIME_EVERY() {
  8026. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  8027. }
  8028. constructor() {
  8029. this.reset();
  8030. }
  8031. check() {
  8032. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  8033. return false;
  8034. }
  8035. this.checked = 0;
  8036. return this.endTime <= Date.now();
  8037. }
  8038. reset() {
  8039. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  8040. this.checked = 0;
  8041. }
  8042. }
  8043. class PartialEvaluator {
  8044. constructor({
  8045. xref,
  8046. handler,
  8047. pageIndex,
  8048. idFactory,
  8049. fontCache,
  8050. builtInCMapCache,
  8051. standardFontDataCache,
  8052. globalImageCache,
  8053. options = null
  8054. }) {
  8055. this.xref = xref;
  8056. this.handler = handler;
  8057. this.pageIndex = pageIndex;
  8058. this.idFactory = idFactory;
  8059. this.fontCache = fontCache;
  8060. this.builtInCMapCache = builtInCMapCache;
  8061. this.standardFontDataCache = standardFontDataCache;
  8062. this.globalImageCache = globalImageCache;
  8063. this.options = options || DefaultPartialEvaluatorOptions;
  8064. this.parsingType3Font = false;
  8065. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  8066. }
  8067. get _pdfFunctionFactory() {
  8068. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  8069. xref: this.xref,
  8070. isEvalSupported: this.options.isEvalSupported
  8071. });
  8072. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  8073. }
  8074. clone(newOptions = null) {
  8075. const newEvaluator = Object.create(this);
  8076. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  8077. return newEvaluator;
  8078. }
  8079. hasBlendModes(resources, nonBlendModesSet) {
  8080. if (!(resources instanceof _primitives.Dict)) {
  8081. return false;
  8082. }
  8083. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  8084. return false;
  8085. }
  8086. const processed = new _primitives.RefSet(nonBlendModesSet);
  8087. if (resources.objId) {
  8088. processed.put(resources.objId);
  8089. }
  8090. const nodes = [resources],
  8091. xref = this.xref;
  8092. while (nodes.length) {
  8093. const node = nodes.shift();
  8094. const graphicStates = node.get("ExtGState");
  8095. if (graphicStates instanceof _primitives.Dict) {
  8096. for (let graphicState of graphicStates.getRawValues()) {
  8097. if (graphicState instanceof _primitives.Ref) {
  8098. if (processed.has(graphicState)) {
  8099. continue;
  8100. }
  8101. try {
  8102. graphicState = xref.fetch(graphicState);
  8103. } catch (ex) {
  8104. processed.put(graphicState);
  8105. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  8106. continue;
  8107. }
  8108. }
  8109. if (!(graphicState instanceof _primitives.Dict)) {
  8110. continue;
  8111. }
  8112. if (graphicState.objId) {
  8113. processed.put(graphicState.objId);
  8114. }
  8115. const bm = graphicState.get("BM");
  8116. if (bm instanceof _primitives.Name) {
  8117. if (bm.name !== "Normal") {
  8118. return true;
  8119. }
  8120. continue;
  8121. }
  8122. if (bm !== undefined && Array.isArray(bm)) {
  8123. for (const element of bm) {
  8124. if (element instanceof _primitives.Name && element.name !== "Normal") {
  8125. return true;
  8126. }
  8127. }
  8128. }
  8129. }
  8130. }
  8131. const xObjects = node.get("XObject");
  8132. if (!(xObjects instanceof _primitives.Dict)) {
  8133. continue;
  8134. }
  8135. for (let xObject of xObjects.getRawValues()) {
  8136. if (xObject instanceof _primitives.Ref) {
  8137. if (processed.has(xObject)) {
  8138. continue;
  8139. }
  8140. try {
  8141. xObject = xref.fetch(xObject);
  8142. } catch (ex) {
  8143. processed.put(xObject);
  8144. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  8145. continue;
  8146. }
  8147. }
  8148. if (!(xObject instanceof _base_stream.BaseStream)) {
  8149. continue;
  8150. }
  8151. if (xObject.dict.objId) {
  8152. processed.put(xObject.dict.objId);
  8153. }
  8154. const xResources = xObject.dict.get("Resources");
  8155. if (!(xResources instanceof _primitives.Dict)) {
  8156. continue;
  8157. }
  8158. if (xResources.objId && processed.has(xResources.objId)) {
  8159. continue;
  8160. }
  8161. nodes.push(xResources);
  8162. if (xResources.objId) {
  8163. processed.put(xResources.objId);
  8164. }
  8165. }
  8166. }
  8167. for (const ref of processed) {
  8168. nonBlendModesSet.put(ref);
  8169. }
  8170. return false;
  8171. }
  8172. async fetchBuiltInCMap(name) {
  8173. const cachedData = this.builtInCMapCache.get(name);
  8174. if (cachedData) {
  8175. return cachedData;
  8176. }
  8177. let data;
  8178. if (this.options.cMapUrl !== null) {
  8179. const url = `${this.options.cMapUrl}${name}.bcmap`;
  8180. const response = await fetch(url);
  8181. if (!response.ok) {
  8182. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  8183. }
  8184. data = {
  8185. cMapData: new Uint8Array(await response.arrayBuffer()),
  8186. compressionType: _util.CMapCompressionType.BINARY
  8187. };
  8188. } else {
  8189. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  8190. name
  8191. });
  8192. }
  8193. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  8194. this.builtInCMapCache.set(name, data);
  8195. }
  8196. return data;
  8197. }
  8198. async fetchStandardFontData(name) {
  8199. const cachedData = this.standardFontDataCache.get(name);
  8200. if (cachedData) {
  8201. return new _stream.Stream(cachedData);
  8202. }
  8203. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  8204. return null;
  8205. }
  8206. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  8207. filename = standardFontNameToFileName[name];
  8208. let data;
  8209. if (this.options.standardFontDataUrl !== null) {
  8210. const url = `${this.options.standardFontDataUrl}${filename}`;
  8211. const response = await fetch(url);
  8212. if (!response.ok) {
  8213. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  8214. } else {
  8215. data = await response.arrayBuffer();
  8216. }
  8217. } else {
  8218. try {
  8219. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  8220. filename
  8221. });
  8222. } catch (e) {
  8223. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  8224. }
  8225. }
  8226. if (!data) {
  8227. return null;
  8228. }
  8229. this.standardFontDataCache.set(name, data);
  8230. return new _stream.Stream(data);
  8231. }
  8232. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  8233. const dict = xobj.dict;
  8234. const matrix = dict.getArray("Matrix");
  8235. let bbox = dict.getArray("BBox");
  8236. if (Array.isArray(bbox) && bbox.length === 4) {
  8237. bbox = _util.Util.normalizeRect(bbox);
  8238. } else {
  8239. bbox = null;
  8240. }
  8241. let optionalContent, groupOptions;
  8242. if (dict.has("OC")) {
  8243. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8244. }
  8245. if (optionalContent !== undefined) {
  8246. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8247. }
  8248. const group = dict.get("Group");
  8249. if (group) {
  8250. groupOptions = {
  8251. matrix,
  8252. bbox,
  8253. smask,
  8254. isolated: false,
  8255. knockout: false
  8256. };
  8257. const groupSubtype = group.get("S");
  8258. let colorSpace = null;
  8259. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  8260. groupOptions.isolated = group.get("I") || false;
  8261. groupOptions.knockout = group.get("K") || false;
  8262. if (group.has("CS")) {
  8263. const cs = group.getRaw("CS");
  8264. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  8265. if (cachedColorSpace) {
  8266. colorSpace = cachedColorSpace;
  8267. } else {
  8268. colorSpace = await this.parseColorSpace({
  8269. cs,
  8270. resources,
  8271. localColorSpaceCache
  8272. });
  8273. }
  8274. }
  8275. }
  8276. if (smask && smask.backdrop) {
  8277. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  8278. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  8279. }
  8280. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  8281. }
  8282. const args = group ? [matrix, null] : [matrix, bbox];
  8283. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  8284. return this.getOperatorList({
  8285. stream: xobj,
  8286. task,
  8287. resources: dict.get("Resources") || resources,
  8288. operatorList,
  8289. initialState
  8290. }).then(function () {
  8291. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  8292. if (group) {
  8293. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  8294. }
  8295. if (optionalContent !== undefined) {
  8296. operatorList.addOp(_util.OPS.endMarkedContent, []);
  8297. }
  8298. });
  8299. }
  8300. _sendImgData(objId, imgData, cacheGlobally = false) {
  8301. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  8302. if (this.parsingType3Font || cacheGlobally) {
  8303. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  8304. }
  8305. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  8306. }
  8307. async buildPaintImageXObject({
  8308. resources,
  8309. image,
  8310. isInline = false,
  8311. operatorList,
  8312. cacheKey,
  8313. localImageCache,
  8314. localColorSpaceCache
  8315. }) {
  8316. const dict = image.dict;
  8317. const imageRef = dict.objId;
  8318. const w = dict.get("W", "Width");
  8319. const h = dict.get("H", "Height");
  8320. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  8321. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  8322. return;
  8323. }
  8324. const maxImageSize = this.options.maxImageSize;
  8325. if (maxImageSize !== -1 && w * h > maxImageSize) {
  8326. const msg = "Image exceeded maximum allowed size and was removed.";
  8327. if (this.options.ignoreErrors) {
  8328. (0, _util.warn)(msg);
  8329. return;
  8330. }
  8331. throw new Error(msg);
  8332. }
  8333. let optionalContent;
  8334. if (dict.has("OC")) {
  8335. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  8336. }
  8337. const imageMask = dict.get("IM", "ImageMask") || false;
  8338. let imgData, args;
  8339. if (imageMask) {
  8340. const interpolate = dict.get("I", "Interpolate");
  8341. const bitStrideLength = w + 7 >> 3;
  8342. const imgArray = image.getBytes(bitStrideLength * h);
  8343. const decode = dict.getArray("D", "Decode");
  8344. if (this.parsingType3Font) {
  8345. imgData = _image.PDFImage.createRawMask({
  8346. imgArray,
  8347. width: w,
  8348. height: h,
  8349. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8350. inverseDecode: !!decode && decode[0] > 0,
  8351. interpolate
  8352. });
  8353. imgData.cached = !!cacheKey;
  8354. args = [imgData];
  8355. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8356. if (cacheKey) {
  8357. localImageCache.set(cacheKey, imageRef, {
  8358. fn: _util.OPS.paintImageMaskXObject,
  8359. args,
  8360. optionalContent
  8361. });
  8362. }
  8363. return;
  8364. }
  8365. imgData = _image.PDFImage.createMask({
  8366. imgArray,
  8367. width: w,
  8368. height: h,
  8369. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  8370. inverseDecode: !!decode && decode[0] > 0,
  8371. interpolate
  8372. });
  8373. if (imgData.isSingleOpaquePixel) {
  8374. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  8375. if (cacheKey) {
  8376. localImageCache.set(cacheKey, imageRef, {
  8377. fn: _util.OPS.paintSolidColorImageMask,
  8378. args: [],
  8379. optionalContent
  8380. });
  8381. }
  8382. return;
  8383. }
  8384. const objId = `mask_${this.idFactory.createObjId()}`;
  8385. operatorList.addDependency(objId);
  8386. this._sendImgData(objId, imgData);
  8387. args = [{
  8388. data: objId,
  8389. width: imgData.width,
  8390. height: imgData.height,
  8391. interpolate: imgData.interpolate,
  8392. count: 1
  8393. }];
  8394. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  8395. if (cacheKey) {
  8396. localImageCache.set(cacheKey, imageRef, {
  8397. fn: _util.OPS.paintImageMaskXObject,
  8398. args,
  8399. optionalContent
  8400. });
  8401. }
  8402. return;
  8403. }
  8404. const softMask = dict.get("SM", "SMask") || false;
  8405. const mask = dict.get("Mask") || false;
  8406. const SMALL_IMAGE_DIMENSIONS = 200;
  8407. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  8408. const imageObj = new _image.PDFImage({
  8409. xref: this.xref,
  8410. res: resources,
  8411. image,
  8412. isInline,
  8413. pdfFunctionFactory: this._pdfFunctionFactory,
  8414. localColorSpaceCache
  8415. });
  8416. imgData = imageObj.createImageData(true);
  8417. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  8418. return;
  8419. }
  8420. let objId = `img_${this.idFactory.createObjId()}`,
  8421. cacheGlobally = false;
  8422. if (this.parsingType3Font) {
  8423. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  8424. } else if (imageRef) {
  8425. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  8426. if (cacheGlobally) {
  8427. objId = `${this.idFactory.getDocId()}_${objId}`;
  8428. }
  8429. }
  8430. operatorList.addDependency(objId);
  8431. args = [objId, w, h];
  8432. _image.PDFImage.buildImage({
  8433. xref: this.xref,
  8434. res: resources,
  8435. image,
  8436. isInline,
  8437. pdfFunctionFactory: this._pdfFunctionFactory,
  8438. localColorSpaceCache
  8439. }).then(imageObj => {
  8440. imgData = imageObj.createImageData(false);
  8441. if (cacheKey && imageRef && cacheGlobally) {
  8442. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  8443. }
  8444. return this._sendImgData(objId, imgData, cacheGlobally);
  8445. }).catch(reason => {
  8446. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  8447. return this._sendImgData(objId, null, cacheGlobally);
  8448. });
  8449. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  8450. if (cacheKey) {
  8451. localImageCache.set(cacheKey, imageRef, {
  8452. fn: _util.OPS.paintImageXObject,
  8453. args,
  8454. optionalContent
  8455. });
  8456. if (imageRef) {
  8457. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  8458. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  8459. if (cacheGlobally) {
  8460. this.globalImageCache.setData(imageRef, {
  8461. objId,
  8462. fn: _util.OPS.paintImageXObject,
  8463. args,
  8464. optionalContent,
  8465. byteSize: 0
  8466. });
  8467. }
  8468. }
  8469. }
  8470. }
  8471. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  8472. const smaskContent = smask.get("G");
  8473. const smaskOptions = {
  8474. subtype: smask.get("S").name,
  8475. backdrop: smask.get("BC")
  8476. };
  8477. const transferObj = smask.get("TR");
  8478. if ((0, _function.isPDFFunction)(transferObj)) {
  8479. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8480. const transferMap = new Uint8Array(256);
  8481. const tmp = new Float32Array(1);
  8482. for (let i = 0; i < 256; i++) {
  8483. tmp[0] = i / 255;
  8484. transferFn(tmp, 0, tmp, 0);
  8485. transferMap[i] = tmp[0] * 255 | 0;
  8486. }
  8487. smaskOptions.transferMap = transferMap;
  8488. }
  8489. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  8490. }
  8491. handleTransferFunction(tr) {
  8492. let transferArray;
  8493. if (Array.isArray(tr)) {
  8494. transferArray = tr;
  8495. } else if ((0, _function.isPDFFunction)(tr)) {
  8496. transferArray = [tr];
  8497. } else {
  8498. return null;
  8499. }
  8500. const transferMaps = [];
  8501. let numFns = 0,
  8502. numEffectfulFns = 0;
  8503. for (const entry of transferArray) {
  8504. const transferObj = this.xref.fetchIfRef(entry);
  8505. numFns++;
  8506. if ((0, _primitives.isName)(transferObj, "Identity")) {
  8507. transferMaps.push(null);
  8508. continue;
  8509. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  8510. return null;
  8511. }
  8512. const transferFn = this._pdfFunctionFactory.create(transferObj);
  8513. const transferMap = new Uint8Array(256),
  8514. tmp = new Float32Array(1);
  8515. for (let j = 0; j < 256; j++) {
  8516. tmp[0] = j / 255;
  8517. transferFn(tmp, 0, tmp, 0);
  8518. transferMap[j] = tmp[0] * 255 | 0;
  8519. }
  8520. transferMaps.push(transferMap);
  8521. numEffectfulFns++;
  8522. }
  8523. if (!(numFns === 1 || numFns === 4)) {
  8524. return null;
  8525. }
  8526. if (numEffectfulFns === 0) {
  8527. return null;
  8528. }
  8529. return transferMaps;
  8530. }
  8531. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  8532. const tilingOpList = new _operator_list.OperatorList();
  8533. const patternResources = _primitives.Dict.merge({
  8534. xref: this.xref,
  8535. dictArray: [patternDict.get("Resources"), resources]
  8536. });
  8537. return this.getOperatorList({
  8538. stream: pattern,
  8539. task,
  8540. resources: patternResources,
  8541. operatorList: tilingOpList
  8542. }).then(function () {
  8543. const operatorListIR = tilingOpList.getIR();
  8544. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  8545. operatorList.addDependencies(tilingOpList.dependencies);
  8546. operatorList.addOp(fn, tilingPatternIR);
  8547. if (patternDict.objId) {
  8548. localTilingPatternCache.set(null, patternDict.objId, {
  8549. operatorListIR,
  8550. dict: patternDict
  8551. });
  8552. }
  8553. }).catch(reason => {
  8554. if (reason instanceof _util.AbortException) {
  8555. return;
  8556. }
  8557. if (this.options.ignoreErrors) {
  8558. this.handler.send("UnsupportedFeature", {
  8559. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  8560. });
  8561. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  8562. return;
  8563. }
  8564. throw reason;
  8565. });
  8566. }
  8567. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  8568. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  8569. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  8570. if (!translated.font.isType3Font) {
  8571. return translated;
  8572. }
  8573. return translated.loadType3Data(this, resources, task).then(function () {
  8574. operatorList.addDependencies(translated.type3Dependencies);
  8575. return translated;
  8576. }).catch(reason => {
  8577. this.handler.send("UnsupportedFeature", {
  8578. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  8579. });
  8580. return new TranslatedFont({
  8581. loadedName: "g_font_error",
  8582. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  8583. dict: translated.font,
  8584. evaluatorOptions: this.options
  8585. });
  8586. });
  8587. }).then(translated => {
  8588. state.font = translated.font;
  8589. translated.send(this.handler);
  8590. return translated.loadedName;
  8591. });
  8592. }
  8593. handleText(chars, state) {
  8594. const font = state.font;
  8595. const glyphs = font.charsToGlyphs(chars);
  8596. if (font.data) {
  8597. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  8598. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  8599. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  8600. }
  8601. }
  8602. return glyphs;
  8603. }
  8604. ensureStateFont(state) {
  8605. if (state.font) {
  8606. return;
  8607. }
  8608. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  8609. if (this.options.ignoreErrors) {
  8610. this.handler.send("UnsupportedFeature", {
  8611. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  8612. });
  8613. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  8614. return;
  8615. }
  8616. throw reason;
  8617. }
  8618. async setGState({
  8619. resources,
  8620. gState,
  8621. operatorList,
  8622. cacheKey,
  8623. task,
  8624. stateManager,
  8625. localGStateCache,
  8626. localColorSpaceCache
  8627. }) {
  8628. const gStateRef = gState.objId;
  8629. let isSimpleGState = true;
  8630. const gStateObj = [];
  8631. const gStateKeys = gState.getKeys();
  8632. let promise = Promise.resolve();
  8633. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  8634. const key = gStateKeys[i];
  8635. const value = gState.get(key);
  8636. switch (key) {
  8637. case "Type":
  8638. break;
  8639. case "LW":
  8640. case "LC":
  8641. case "LJ":
  8642. case "ML":
  8643. case "D":
  8644. case "RI":
  8645. case "FL":
  8646. case "CA":
  8647. case "ca":
  8648. gStateObj.push([key, value]);
  8649. break;
  8650. case "Font":
  8651. isSimpleGState = false;
  8652. promise = promise.then(() => {
  8653. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  8654. operatorList.addDependency(loadedName);
  8655. gStateObj.push([key, [loadedName, value[1]]]);
  8656. });
  8657. });
  8658. break;
  8659. case "BM":
  8660. gStateObj.push([key, normalizeBlendMode(value)]);
  8661. break;
  8662. case "SMask":
  8663. if ((0, _primitives.isName)(value, "None")) {
  8664. gStateObj.push([key, false]);
  8665. break;
  8666. }
  8667. if (value instanceof _primitives.Dict) {
  8668. isSimpleGState = false;
  8669. promise = promise.then(() => {
  8670. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  8671. });
  8672. gStateObj.push([key, true]);
  8673. } else {
  8674. (0, _util.warn)("Unsupported SMask type");
  8675. }
  8676. break;
  8677. case "TR":
  8678. const transferMaps = this.handleTransferFunction(value);
  8679. gStateObj.push([key, transferMaps]);
  8680. break;
  8681. case "OP":
  8682. case "op":
  8683. case "OPM":
  8684. case "BG":
  8685. case "BG2":
  8686. case "UCR":
  8687. case "UCR2":
  8688. case "TR2":
  8689. case "HT":
  8690. case "SM":
  8691. case "SA":
  8692. case "AIS":
  8693. case "TK":
  8694. (0, _util.info)("graphic state operator " + key);
  8695. break;
  8696. default:
  8697. (0, _util.info)("Unknown graphic state operator " + key);
  8698. break;
  8699. }
  8700. }
  8701. return promise.then(function () {
  8702. if (gStateObj.length > 0) {
  8703. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  8704. }
  8705. if (isSimpleGState) {
  8706. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  8707. }
  8708. });
  8709. }
  8710. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  8711. const errorFont = async () => {
  8712. return new TranslatedFont({
  8713. loadedName: "g_font_error",
  8714. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  8715. dict: font,
  8716. evaluatorOptions: this.options
  8717. });
  8718. };
  8719. const xref = this.xref;
  8720. let fontRef;
  8721. if (font) {
  8722. if (font instanceof _primitives.Ref) {
  8723. fontRef = font;
  8724. }
  8725. } else {
  8726. const fontRes = resources.get("Font");
  8727. if (fontRes) {
  8728. fontRef = fontRes.getRaw(fontName);
  8729. }
  8730. }
  8731. if (!fontRef) {
  8732. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  8733. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  8734. (0, _util.warn)(`${partialMsg}.`);
  8735. return errorFont();
  8736. }
  8737. this.handler.send("UnsupportedFeature", {
  8738. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  8739. });
  8740. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  8741. if (fallbackFontDict) {
  8742. fontRef = fallbackFontDict;
  8743. } else {
  8744. fontRef = PartialEvaluator.fallbackFontDict;
  8745. }
  8746. }
  8747. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  8748. return errorFont();
  8749. }
  8750. if (this.fontCache.has(fontRef)) {
  8751. return this.fontCache.get(fontRef);
  8752. }
  8753. font = xref.fetchIfRef(fontRef);
  8754. if (!(font instanceof _primitives.Dict)) {
  8755. return errorFont();
  8756. }
  8757. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  8758. return this.fontCache.get(font.cacheKey);
  8759. }
  8760. const fontCapability = (0, _util.createPromiseCapability)();
  8761. let preEvaluatedFont;
  8762. try {
  8763. preEvaluatedFont = this.preEvaluateFont(font);
  8764. preEvaluatedFont.cssFontInfo = cssFontInfo;
  8765. } catch (reason) {
  8766. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  8767. return errorFont();
  8768. }
  8769. const {
  8770. descriptor,
  8771. hash
  8772. } = preEvaluatedFont;
  8773. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  8774. let fontID;
  8775. if (fontRefIsRef) {
  8776. fontID = `f${fontRef.toString()}`;
  8777. }
  8778. if (hash && descriptor instanceof _primitives.Dict) {
  8779. if (!descriptor.fontAliases) {
  8780. descriptor.fontAliases = Object.create(null);
  8781. }
  8782. const fontAliases = descriptor.fontAliases;
  8783. if (fontAliases[hash]) {
  8784. const aliasFontRef = fontAliases[hash].aliasRef;
  8785. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  8786. this.fontCache.putAlias(fontRef, aliasFontRef);
  8787. return this.fontCache.get(fontRef);
  8788. }
  8789. } else {
  8790. fontAliases[hash] = {
  8791. fontID: this.idFactory.createFontId()
  8792. };
  8793. }
  8794. if (fontRefIsRef) {
  8795. fontAliases[hash].aliasRef = fontRef;
  8796. }
  8797. fontID = fontAliases[hash].fontID;
  8798. }
  8799. if (fontRefIsRef) {
  8800. this.fontCache.put(fontRef, fontCapability.promise);
  8801. } else {
  8802. if (!fontID) {
  8803. fontID = this.idFactory.createFontId();
  8804. }
  8805. font.cacheKey = `cacheKey_${fontID}`;
  8806. this.fontCache.put(font.cacheKey, fontCapability.promise);
  8807. }
  8808. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  8809. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  8810. this.translateFont(preEvaluatedFont).then(translatedFont => {
  8811. if (translatedFont.fontType !== undefined) {
  8812. xref.stats.addFontType(translatedFont.fontType);
  8813. }
  8814. fontCapability.resolve(new TranslatedFont({
  8815. loadedName: font.loadedName,
  8816. font: translatedFont,
  8817. dict: font,
  8818. evaluatorOptions: this.options
  8819. }));
  8820. }).catch(reason => {
  8821. this.handler.send("UnsupportedFeature", {
  8822. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  8823. });
  8824. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  8825. try {
  8826. const fontFile3 = descriptor && descriptor.get("FontFile3");
  8827. const subtype = fontFile3 && fontFile3.get("Subtype");
  8828. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  8829. if (fontType !== undefined) {
  8830. xref.stats.addFontType(fontType);
  8831. }
  8832. } catch (ex) {}
  8833. fontCapability.resolve(new TranslatedFont({
  8834. loadedName: font.loadedName,
  8835. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  8836. dict: font,
  8837. evaluatorOptions: this.options
  8838. }));
  8839. });
  8840. return fontCapability.promise;
  8841. }
  8842. buildPath(operatorList, fn, args, parsingText = false) {
  8843. const lastIndex = operatorList.length - 1;
  8844. if (!args) {
  8845. args = [];
  8846. }
  8847. let minMax;
  8848. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  8849. if (parsingText) {
  8850. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  8851. operatorList.addOp(_util.OPS.save, null);
  8852. }
  8853. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  8854. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  8855. if (parsingText) {
  8856. operatorList.addOp(_util.OPS.restore, null);
  8857. }
  8858. } else {
  8859. const opArgs = operatorList.argsArray[lastIndex];
  8860. opArgs[0].push(fn);
  8861. Array.prototype.push.apply(opArgs[1], args);
  8862. minMax = opArgs[2];
  8863. }
  8864. switch (fn) {
  8865. case _util.OPS.rectangle:
  8866. minMax[0] = Math.min(minMax[0], args[0], args[0] + args[2]);
  8867. minMax[1] = Math.max(minMax[1], args[0], args[0] + args[2]);
  8868. minMax[2] = Math.min(minMax[2], args[1], args[1] + args[3]);
  8869. minMax[3] = Math.max(minMax[3], args[1], args[1] + args[3]);
  8870. break;
  8871. case _util.OPS.moveTo:
  8872. case _util.OPS.lineTo:
  8873. minMax[0] = Math.min(minMax[0], args[0]);
  8874. minMax[1] = Math.max(minMax[1], args[0]);
  8875. minMax[2] = Math.min(minMax[2], args[1]);
  8876. minMax[3] = Math.max(minMax[3], args[1]);
  8877. break;
  8878. }
  8879. }
  8880. parseColorSpace({
  8881. cs,
  8882. resources,
  8883. localColorSpaceCache
  8884. }) {
  8885. return _colorspace.ColorSpace.parseAsync({
  8886. cs,
  8887. xref: this.xref,
  8888. resources,
  8889. pdfFunctionFactory: this._pdfFunctionFactory,
  8890. localColorSpaceCache
  8891. }).catch(reason => {
  8892. if (reason instanceof _util.AbortException) {
  8893. return null;
  8894. }
  8895. if (this.options.ignoreErrors) {
  8896. this.handler.send("UnsupportedFeature", {
  8897. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  8898. });
  8899. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  8900. return null;
  8901. }
  8902. throw reason;
  8903. });
  8904. }
  8905. parseShading({
  8906. shading,
  8907. resources,
  8908. localColorSpaceCache,
  8909. localShadingPatternCache
  8910. }) {
  8911. let id = localShadingPatternCache.get(shading);
  8912. if (!id) {
  8913. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  8914. const patternIR = shadingFill.getIR();
  8915. id = `pattern_${this.idFactory.createObjId()}`;
  8916. localShadingPatternCache.set(shading, id);
  8917. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  8918. }
  8919. return id;
  8920. }
  8921. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  8922. const patternName = args.pop();
  8923. if (patternName instanceof _primitives.Name) {
  8924. const rawPattern = patterns.getRaw(patternName.name);
  8925. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  8926. if (localTilingPattern) {
  8927. try {
  8928. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  8929. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  8930. operatorList.addOp(fn, tilingPatternIR);
  8931. return undefined;
  8932. } catch (ex) {}
  8933. }
  8934. const pattern = this.xref.fetchIfRef(rawPattern);
  8935. if (pattern) {
  8936. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  8937. const typeNum = dict.get("PatternType");
  8938. if (typeNum === PatternType.TILING) {
  8939. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  8940. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  8941. } else if (typeNum === PatternType.SHADING) {
  8942. const shading = dict.get("Shading");
  8943. const matrix = dict.getArray("Matrix");
  8944. const objId = this.parseShading({
  8945. shading,
  8946. resources,
  8947. localColorSpaceCache,
  8948. localShadingPatternCache
  8949. });
  8950. operatorList.addOp(fn, ["Shading", objId, matrix]);
  8951. return undefined;
  8952. }
  8953. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  8954. }
  8955. }
  8956. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  8957. }
  8958. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  8959. const MAX_NESTING = 10;
  8960. if (++nestingCounter > MAX_NESTING) {
  8961. (0, _util.warn)("Visibility expression is too deeply nested");
  8962. return;
  8963. }
  8964. const length = array.length;
  8965. const operator = this.xref.fetchIfRef(array[0]);
  8966. if (length < 2 || !(operator instanceof _primitives.Name)) {
  8967. (0, _util.warn)("Invalid visibility expression");
  8968. return;
  8969. }
  8970. switch (operator.name) {
  8971. case "And":
  8972. case "Or":
  8973. case "Not":
  8974. currentResult.push(operator.name);
  8975. break;
  8976. default:
  8977. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  8978. return;
  8979. }
  8980. for (let i = 1; i < length; i++) {
  8981. const raw = array[i];
  8982. const object = this.xref.fetchIfRef(raw);
  8983. if (Array.isArray(object)) {
  8984. const nestedResult = [];
  8985. currentResult.push(nestedResult);
  8986. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  8987. } else if (raw instanceof _primitives.Ref) {
  8988. currentResult.push(raw.toString());
  8989. }
  8990. }
  8991. }
  8992. async parseMarkedContentProps(contentProperties, resources) {
  8993. let optionalContent;
  8994. if (contentProperties instanceof _primitives.Name) {
  8995. const properties = resources.get("Properties");
  8996. optionalContent = properties.get(contentProperties.name);
  8997. } else if (contentProperties instanceof _primitives.Dict) {
  8998. optionalContent = contentProperties;
  8999. } else {
  9000. throw new _util.FormatError("Optional content properties malformed.");
  9001. }
  9002. const optionalContentType = optionalContent.get("Type").name;
  9003. if (optionalContentType === "OCG") {
  9004. return {
  9005. type: optionalContentType,
  9006. id: optionalContent.objId
  9007. };
  9008. } else if (optionalContentType === "OCMD") {
  9009. const expression = optionalContent.get("VE");
  9010. if (Array.isArray(expression)) {
  9011. const result = [];
  9012. this._parseVisibilityExpression(expression, 0, result);
  9013. if (result.length > 0) {
  9014. return {
  9015. type: "OCMD",
  9016. expression: result
  9017. };
  9018. }
  9019. }
  9020. const optionalContentGroups = optionalContent.get("OCGs");
  9021. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  9022. const groupIds = [];
  9023. if (Array.isArray(optionalContentGroups)) {
  9024. for (const ocg of optionalContentGroups) {
  9025. groupIds.push(ocg.toString());
  9026. }
  9027. } else {
  9028. groupIds.push(optionalContentGroups.objId);
  9029. }
  9030. return {
  9031. type: optionalContentType,
  9032. ids: groupIds,
  9033. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  9034. expression: null
  9035. };
  9036. } else if (optionalContentGroups instanceof _primitives.Ref) {
  9037. return {
  9038. type: optionalContentType,
  9039. id: optionalContentGroups.toString()
  9040. };
  9041. }
  9042. }
  9043. return null;
  9044. }
  9045. getOperatorList({
  9046. stream,
  9047. task,
  9048. resources,
  9049. operatorList,
  9050. initialState = null,
  9051. fallbackFontDict = null
  9052. }) {
  9053. resources = resources || _primitives.Dict.empty;
  9054. initialState = initialState || new EvalState();
  9055. if (!operatorList) {
  9056. throw new Error('getOperatorList: missing "operatorList" parameter');
  9057. }
  9058. const self = this;
  9059. const xref = this.xref;
  9060. let parsingText = false;
  9061. const localImageCache = new _image_utils.LocalImageCache();
  9062. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  9063. const localGStateCache = new _image_utils.LocalGStateCache();
  9064. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  9065. const localShadingPatternCache = new Map();
  9066. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  9067. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  9068. const stateManager = new StateManager(initialState);
  9069. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9070. const timeSlotManager = new TimeSlotManager();
  9071. function closePendingRestoreOPS(argument) {
  9072. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  9073. operatorList.addOp(_util.OPS.restore, []);
  9074. }
  9075. }
  9076. return new Promise(function promiseBody(resolve, reject) {
  9077. const next = function (promise) {
  9078. Promise.all([promise, operatorList.ready]).then(function () {
  9079. try {
  9080. promiseBody(resolve, reject);
  9081. } catch (ex) {
  9082. reject(ex);
  9083. }
  9084. }, reject);
  9085. };
  9086. task.ensureNotTerminated();
  9087. timeSlotManager.reset();
  9088. const operation = {};
  9089. let stop, i, ii, cs, name, isValidName;
  9090. while (!(stop = timeSlotManager.check())) {
  9091. operation.args = null;
  9092. if (!preprocessor.read(operation)) {
  9093. break;
  9094. }
  9095. let args = operation.args;
  9096. let fn = operation.fn;
  9097. switch (fn | 0) {
  9098. case _util.OPS.paintXObject:
  9099. isValidName = args[0] instanceof _primitives.Name;
  9100. name = args[0].name;
  9101. if (isValidName) {
  9102. const localImage = localImageCache.getByName(name);
  9103. if (localImage) {
  9104. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9105. incrementCachedImageMaskCount(localImage);
  9106. args = null;
  9107. continue;
  9108. }
  9109. }
  9110. next(new Promise(function (resolveXObject, rejectXObject) {
  9111. if (!isValidName) {
  9112. throw new _util.FormatError("XObject must be referred to by name.");
  9113. }
  9114. let xobj = xobjs.getRaw(name);
  9115. if (xobj instanceof _primitives.Ref) {
  9116. const localImage = localImageCache.getByRef(xobj);
  9117. if (localImage) {
  9118. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9119. incrementCachedImageMaskCount(localImage);
  9120. resolveXObject();
  9121. return;
  9122. }
  9123. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  9124. if (globalImage) {
  9125. operatorList.addDependency(globalImage.objId);
  9126. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  9127. resolveXObject();
  9128. return;
  9129. }
  9130. xobj = xref.fetch(xobj);
  9131. }
  9132. if (!(xobj instanceof _base_stream.BaseStream)) {
  9133. throw new _util.FormatError("XObject should be a stream");
  9134. }
  9135. const type = xobj.dict.get("Subtype");
  9136. if (!(type instanceof _primitives.Name)) {
  9137. throw new _util.FormatError("XObject should have a Name subtype");
  9138. }
  9139. if (type.name === "Form") {
  9140. stateManager.save();
  9141. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  9142. stateManager.restore();
  9143. resolveXObject();
  9144. }, rejectXObject);
  9145. return;
  9146. } else if (type.name === "Image") {
  9147. self.buildPaintImageXObject({
  9148. resources,
  9149. image: xobj,
  9150. operatorList,
  9151. cacheKey: name,
  9152. localImageCache,
  9153. localColorSpaceCache
  9154. }).then(resolveXObject, rejectXObject);
  9155. return;
  9156. } else if (type.name === "PS") {
  9157. (0, _util.info)("Ignored XObject subtype PS");
  9158. } else {
  9159. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  9160. }
  9161. resolveXObject();
  9162. }).catch(function (reason) {
  9163. if (reason instanceof _util.AbortException) {
  9164. return;
  9165. }
  9166. if (self.options.ignoreErrors) {
  9167. self.handler.send("UnsupportedFeature", {
  9168. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  9169. });
  9170. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  9171. return;
  9172. }
  9173. throw reason;
  9174. }));
  9175. return;
  9176. case _util.OPS.setFont:
  9177. var fontSize = args[1];
  9178. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  9179. operatorList.addDependency(loadedName);
  9180. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  9181. }));
  9182. return;
  9183. case _util.OPS.beginText:
  9184. parsingText = true;
  9185. break;
  9186. case _util.OPS.endText:
  9187. parsingText = false;
  9188. break;
  9189. case _util.OPS.endInlineImage:
  9190. var cacheKey = args[0].cacheKey;
  9191. if (cacheKey) {
  9192. const localImage = localImageCache.getByName(cacheKey);
  9193. if (localImage) {
  9194. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  9195. incrementCachedImageMaskCount(localImage);
  9196. args = null;
  9197. continue;
  9198. }
  9199. }
  9200. next(self.buildPaintImageXObject({
  9201. resources,
  9202. image: args[0],
  9203. isInline: true,
  9204. operatorList,
  9205. cacheKey,
  9206. localImageCache,
  9207. localColorSpaceCache
  9208. }));
  9209. return;
  9210. case _util.OPS.showText:
  9211. if (!stateManager.state.font) {
  9212. self.ensureStateFont(stateManager.state);
  9213. continue;
  9214. }
  9215. args[0] = self.handleText(args[0], stateManager.state);
  9216. break;
  9217. case _util.OPS.showSpacedText:
  9218. if (!stateManager.state.font) {
  9219. self.ensureStateFont(stateManager.state);
  9220. continue;
  9221. }
  9222. var arr = args[0];
  9223. var combinedGlyphs = [];
  9224. var arrLength = arr.length;
  9225. var state = stateManager.state;
  9226. for (i = 0; i < arrLength; ++i) {
  9227. const arrItem = arr[i];
  9228. if (typeof arrItem === "string") {
  9229. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  9230. } else if (typeof arrItem === "number") {
  9231. combinedGlyphs.push(arrItem);
  9232. }
  9233. }
  9234. args[0] = combinedGlyphs;
  9235. fn = _util.OPS.showText;
  9236. break;
  9237. case _util.OPS.nextLineShowText:
  9238. if (!stateManager.state.font) {
  9239. self.ensureStateFont(stateManager.state);
  9240. continue;
  9241. }
  9242. operatorList.addOp(_util.OPS.nextLine);
  9243. args[0] = self.handleText(args[0], stateManager.state);
  9244. fn = _util.OPS.showText;
  9245. break;
  9246. case _util.OPS.nextLineSetSpacingShowText:
  9247. if (!stateManager.state.font) {
  9248. self.ensureStateFont(stateManager.state);
  9249. continue;
  9250. }
  9251. operatorList.addOp(_util.OPS.nextLine);
  9252. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  9253. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  9254. args[0] = self.handleText(args[0], stateManager.state);
  9255. fn = _util.OPS.showText;
  9256. break;
  9257. case _util.OPS.setTextRenderingMode:
  9258. stateManager.state.textRenderingMode = args[0];
  9259. break;
  9260. case _util.OPS.setFillColorSpace:
  9261. {
  9262. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9263. if (cachedColorSpace) {
  9264. stateManager.state.fillColorSpace = cachedColorSpace;
  9265. continue;
  9266. }
  9267. next(self.parseColorSpace({
  9268. cs: args[0],
  9269. resources,
  9270. localColorSpaceCache
  9271. }).then(function (colorSpace) {
  9272. if (colorSpace) {
  9273. stateManager.state.fillColorSpace = colorSpace;
  9274. }
  9275. }));
  9276. return;
  9277. }
  9278. case _util.OPS.setStrokeColorSpace:
  9279. {
  9280. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  9281. if (cachedColorSpace) {
  9282. stateManager.state.strokeColorSpace = cachedColorSpace;
  9283. continue;
  9284. }
  9285. next(self.parseColorSpace({
  9286. cs: args[0],
  9287. resources,
  9288. localColorSpaceCache
  9289. }).then(function (colorSpace) {
  9290. if (colorSpace) {
  9291. stateManager.state.strokeColorSpace = colorSpace;
  9292. }
  9293. }));
  9294. return;
  9295. }
  9296. case _util.OPS.setFillColor:
  9297. cs = stateManager.state.fillColorSpace;
  9298. args = cs.getRgb(args, 0);
  9299. fn = _util.OPS.setFillRGBColor;
  9300. break;
  9301. case _util.OPS.setStrokeColor:
  9302. cs = stateManager.state.strokeColorSpace;
  9303. args = cs.getRgb(args, 0);
  9304. fn = _util.OPS.setStrokeRGBColor;
  9305. break;
  9306. case _util.OPS.setFillGray:
  9307. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  9308. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9309. fn = _util.OPS.setFillRGBColor;
  9310. break;
  9311. case _util.OPS.setStrokeGray:
  9312. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  9313. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  9314. fn = _util.OPS.setStrokeRGBColor;
  9315. break;
  9316. case _util.OPS.setFillCMYKColor:
  9317. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9318. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9319. fn = _util.OPS.setFillRGBColor;
  9320. break;
  9321. case _util.OPS.setStrokeCMYKColor:
  9322. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  9323. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  9324. fn = _util.OPS.setStrokeRGBColor;
  9325. break;
  9326. case _util.OPS.setFillRGBColor:
  9327. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9328. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9329. break;
  9330. case _util.OPS.setStrokeRGBColor:
  9331. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  9332. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  9333. break;
  9334. case _util.OPS.setFillColorN:
  9335. cs = stateManager.state.fillColorSpace;
  9336. if (cs.name === "Pattern") {
  9337. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9338. return;
  9339. }
  9340. args = cs.getRgb(args, 0);
  9341. fn = _util.OPS.setFillRGBColor;
  9342. break;
  9343. case _util.OPS.setStrokeColorN:
  9344. cs = stateManager.state.strokeColorSpace;
  9345. if (cs.name === "Pattern") {
  9346. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  9347. return;
  9348. }
  9349. args = cs.getRgb(args, 0);
  9350. fn = _util.OPS.setStrokeRGBColor;
  9351. break;
  9352. case _util.OPS.shadingFill:
  9353. var shadingRes = resources.get("Shading");
  9354. if (!shadingRes) {
  9355. throw new _util.FormatError("No shading resource found");
  9356. }
  9357. var shading = shadingRes.get(args[0].name);
  9358. if (!shading) {
  9359. throw new _util.FormatError("No shading object found");
  9360. }
  9361. const patternId = self.parseShading({
  9362. shading,
  9363. resources,
  9364. localColorSpaceCache,
  9365. localShadingPatternCache
  9366. });
  9367. args = [patternId];
  9368. fn = _util.OPS.shadingFill;
  9369. break;
  9370. case _util.OPS.setGState:
  9371. isValidName = args[0] instanceof _primitives.Name;
  9372. name = args[0].name;
  9373. if (isValidName) {
  9374. const localGStateObj = localGStateCache.getByName(name);
  9375. if (localGStateObj) {
  9376. if (localGStateObj.length > 0) {
  9377. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  9378. }
  9379. args = null;
  9380. continue;
  9381. }
  9382. }
  9383. next(new Promise(function (resolveGState, rejectGState) {
  9384. if (!isValidName) {
  9385. throw new _util.FormatError("GState must be referred to by name.");
  9386. }
  9387. const extGState = resources.get("ExtGState");
  9388. if (!(extGState instanceof _primitives.Dict)) {
  9389. throw new _util.FormatError("ExtGState should be a dictionary.");
  9390. }
  9391. const gState = extGState.get(name);
  9392. if (!(gState instanceof _primitives.Dict)) {
  9393. throw new _util.FormatError("GState should be a dictionary.");
  9394. }
  9395. self.setGState({
  9396. resources,
  9397. gState,
  9398. operatorList,
  9399. cacheKey: name,
  9400. task,
  9401. stateManager,
  9402. localGStateCache,
  9403. localColorSpaceCache
  9404. }).then(resolveGState, rejectGState);
  9405. }).catch(function (reason) {
  9406. if (reason instanceof _util.AbortException) {
  9407. return;
  9408. }
  9409. if (self.options.ignoreErrors) {
  9410. self.handler.send("UnsupportedFeature", {
  9411. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  9412. });
  9413. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  9414. return;
  9415. }
  9416. throw reason;
  9417. }));
  9418. return;
  9419. case _util.OPS.moveTo:
  9420. case _util.OPS.lineTo:
  9421. case _util.OPS.curveTo:
  9422. case _util.OPS.curveTo2:
  9423. case _util.OPS.curveTo3:
  9424. case _util.OPS.closePath:
  9425. case _util.OPS.rectangle:
  9426. self.buildPath(operatorList, fn, args, parsingText);
  9427. continue;
  9428. case _util.OPS.markPoint:
  9429. case _util.OPS.markPointProps:
  9430. case _util.OPS.beginCompat:
  9431. case _util.OPS.endCompat:
  9432. continue;
  9433. case _util.OPS.beginMarkedContentProps:
  9434. if (!(args[0] instanceof _primitives.Name)) {
  9435. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  9436. continue;
  9437. }
  9438. if (args[0].name === "OC") {
  9439. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  9440. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  9441. }).catch(reason => {
  9442. if (reason instanceof _util.AbortException) {
  9443. return;
  9444. }
  9445. if (self.options.ignoreErrors) {
  9446. self.handler.send("UnsupportedFeature", {
  9447. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  9448. });
  9449. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  9450. return;
  9451. }
  9452. throw reason;
  9453. }));
  9454. return;
  9455. }
  9456. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  9457. break;
  9458. case _util.OPS.beginMarkedContent:
  9459. case _util.OPS.endMarkedContent:
  9460. default:
  9461. if (args !== null) {
  9462. for (i = 0, ii = args.length; i < ii; i++) {
  9463. if (args[i] instanceof _primitives.Dict) {
  9464. break;
  9465. }
  9466. }
  9467. if (i < ii) {
  9468. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  9469. continue;
  9470. }
  9471. }
  9472. }
  9473. operatorList.addOp(fn, args);
  9474. }
  9475. if (stop) {
  9476. next(deferred);
  9477. return;
  9478. }
  9479. closePendingRestoreOPS();
  9480. resolve();
  9481. }).catch(reason => {
  9482. if (reason instanceof _util.AbortException) {
  9483. return;
  9484. }
  9485. if (this.options.ignoreErrors) {
  9486. this.handler.send("UnsupportedFeature", {
  9487. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  9488. });
  9489. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  9490. closePendingRestoreOPS();
  9491. return;
  9492. }
  9493. throw reason;
  9494. });
  9495. }
  9496. getTextContent({
  9497. stream,
  9498. task,
  9499. resources,
  9500. stateManager = null,
  9501. combineTextItems = false,
  9502. includeMarkedContent = false,
  9503. sink,
  9504. seenStyles = new Set(),
  9505. viewBox
  9506. }) {
  9507. resources = resources || _primitives.Dict.empty;
  9508. stateManager = stateManager || new StateManager(new TextState());
  9509. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  9510. const textContent = {
  9511. items: [],
  9512. styles: Object.create(null)
  9513. };
  9514. const textContentItem = {
  9515. initialized: false,
  9516. str: [],
  9517. totalWidth: 0,
  9518. totalHeight: 0,
  9519. width: 0,
  9520. height: 0,
  9521. vertical: false,
  9522. prevTransform: null,
  9523. textAdvanceScale: 0,
  9524. spaceInFlowMin: 0,
  9525. spaceInFlowMax: 0,
  9526. trackingSpaceMin: Infinity,
  9527. negativeSpaceMax: -Infinity,
  9528. notASpace: -Infinity,
  9529. transform: null,
  9530. fontName: null,
  9531. hasEOL: false
  9532. };
  9533. const twoLastChars = [" ", " "];
  9534. let twoLastCharsPos = 0;
  9535. function saveLastChar(char) {
  9536. const nextPos = (twoLastCharsPos + 1) % 2;
  9537. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  9538. twoLastChars[twoLastCharsPos] = char;
  9539. twoLastCharsPos = nextPos;
  9540. return ret;
  9541. }
  9542. function resetLastChars() {
  9543. twoLastChars[0] = twoLastChars[1] = " ";
  9544. twoLastCharsPos = 0;
  9545. }
  9546. const TRACKING_SPACE_FACTOR = 0.1;
  9547. const NOT_A_SPACE_FACTOR = 0.03;
  9548. const NEGATIVE_SPACE_FACTOR = -0.2;
  9549. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  9550. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  9551. const self = this;
  9552. const xref = this.xref;
  9553. const showSpacedTextBuffer = [];
  9554. let xobjs = null;
  9555. const emptyXObjectCache = new _image_utils.LocalImageCache();
  9556. const emptyGStateCache = new _image_utils.LocalGStateCache();
  9557. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  9558. let textState;
  9559. function getCurrentTextTransform() {
  9560. const font = textState.font;
  9561. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  9562. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  9563. const glyphHeight = font.bbox[3] - font.bbox[1];
  9564. if (glyphHeight > 0) {
  9565. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  9566. }
  9567. }
  9568. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  9569. }
  9570. function ensureTextContentItem() {
  9571. if (textContentItem.initialized) {
  9572. return textContentItem;
  9573. }
  9574. const font = textState.font,
  9575. loadedName = font.loadedName;
  9576. if (!seenStyles.has(loadedName)) {
  9577. seenStyles.add(loadedName);
  9578. textContent.styles[loadedName] = {
  9579. fontFamily: font.fallbackName,
  9580. ascent: font.ascent,
  9581. descent: font.descent,
  9582. vertical: font.vertical
  9583. };
  9584. }
  9585. textContentItem.fontName = loadedName;
  9586. const trm = textContentItem.transform = getCurrentTextTransform();
  9587. if (!font.vertical) {
  9588. textContentItem.width = textContentItem.totalWidth = 0;
  9589. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  9590. textContentItem.vertical = false;
  9591. } else {
  9592. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  9593. textContentItem.height = textContentItem.totalHeight = 0;
  9594. textContentItem.vertical = true;
  9595. }
  9596. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9597. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9598. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  9599. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  9600. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  9601. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  9602. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  9603. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  9604. textContentItem.hasEOL = false;
  9605. textContentItem.initialized = true;
  9606. return textContentItem;
  9607. }
  9608. function updateAdvanceScale() {
  9609. if (!textContentItem.initialized) {
  9610. return;
  9611. }
  9612. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  9613. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  9614. const scaleFactor = scaleCtmX * scaleLineX;
  9615. if (scaleFactor === textContentItem.textAdvanceScale) {
  9616. return;
  9617. }
  9618. if (!textContentItem.vertical) {
  9619. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  9620. textContentItem.width = 0;
  9621. } else {
  9622. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  9623. textContentItem.height = 0;
  9624. }
  9625. textContentItem.textAdvanceScale = scaleFactor;
  9626. }
  9627. function runBidiTransform(textChunk) {
  9628. const text = textChunk.str.join("");
  9629. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  9630. return {
  9631. str: bidiResult.str,
  9632. dir: bidiResult.dir,
  9633. width: Math.abs(textChunk.totalWidth),
  9634. height: Math.abs(textChunk.totalHeight),
  9635. transform: textChunk.transform,
  9636. fontName: textChunk.fontName,
  9637. hasEOL: textChunk.hasEOL
  9638. };
  9639. }
  9640. function handleSetFont(fontName, fontRef) {
  9641. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  9642. if (!translated.font.isType3Font) {
  9643. return translated;
  9644. }
  9645. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  9646. return translated;
  9647. });
  9648. }).then(function (translated) {
  9649. textState.font = translated.font;
  9650. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  9651. });
  9652. }
  9653. function applyInverseRotation(x, y, matrix) {
  9654. const scale = Math.hypot(matrix[0], matrix[1]);
  9655. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  9656. }
  9657. function compareWithLastPosition() {
  9658. const currentTransform = getCurrentTextTransform();
  9659. let posX = currentTransform[4];
  9660. let posY = currentTransform[5];
  9661. const shiftedX = posX - viewBox[0];
  9662. const shiftedY = posY - viewBox[1];
  9663. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  9664. return false;
  9665. }
  9666. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  9667. return true;
  9668. }
  9669. let lastPosX = textContentItem.prevTransform[4];
  9670. let lastPosY = textContentItem.prevTransform[5];
  9671. if (lastPosX === posX && lastPosY === posY) {
  9672. return true;
  9673. }
  9674. let rotate = -1;
  9675. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  9676. rotate = currentTransform[0] > 0 ? 0 : 180;
  9677. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  9678. rotate = currentTransform[1] > 0 ? 90 : 270;
  9679. }
  9680. switch (rotate) {
  9681. case 0:
  9682. break;
  9683. case 90:
  9684. [posX, posY] = [posY, posX];
  9685. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  9686. break;
  9687. case 180:
  9688. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  9689. break;
  9690. case 270:
  9691. [posX, posY] = [-posY, -posX];
  9692. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  9693. break;
  9694. default:
  9695. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  9696. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  9697. }
  9698. if (textState.font.vertical) {
  9699. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  9700. const advanceX = posX - lastPosX;
  9701. const textOrientation = Math.sign(textContentItem.height);
  9702. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  9703. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  9704. appendEOL();
  9705. return true;
  9706. }
  9707. resetLastChars();
  9708. flushTextContentItem();
  9709. return true;
  9710. }
  9711. if (Math.abs(advanceX) > textContentItem.width) {
  9712. appendEOL();
  9713. return true;
  9714. }
  9715. if (advanceY <= textOrientation * textContentItem.notASpace) {
  9716. resetLastChars();
  9717. }
  9718. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  9719. textContentItem.height += advanceY;
  9720. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  9721. if (textContentItem.str.length === 0) {
  9722. resetLastChars();
  9723. textContent.items.push({
  9724. str: " ",
  9725. dir: "ltr",
  9726. width: 0,
  9727. height: Math.abs(advanceY),
  9728. transform: textContentItem.prevTransform,
  9729. fontName: textContentItem.fontName,
  9730. hasEOL: false
  9731. });
  9732. } else {
  9733. textContentItem.height += advanceY;
  9734. }
  9735. }
  9736. return true;
  9737. }
  9738. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  9739. const advanceY = posY - lastPosY;
  9740. const textOrientation = Math.sign(textContentItem.width);
  9741. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  9742. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  9743. appendEOL();
  9744. return true;
  9745. }
  9746. resetLastChars();
  9747. flushTextContentItem();
  9748. return true;
  9749. }
  9750. if (Math.abs(advanceY) > textContentItem.height) {
  9751. appendEOL();
  9752. return true;
  9753. }
  9754. if (advanceX <= textOrientation * textContentItem.notASpace) {
  9755. resetLastChars();
  9756. }
  9757. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  9758. textContentItem.width += advanceX;
  9759. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  9760. if (textContentItem.str.length === 0) {
  9761. resetLastChars();
  9762. textContent.items.push({
  9763. str: " ",
  9764. dir: "ltr",
  9765. width: Math.abs(advanceX),
  9766. height: 0,
  9767. transform: textContentItem.prevTransform,
  9768. fontName: textContentItem.fontName,
  9769. hasEOL: false
  9770. });
  9771. } else {
  9772. textContentItem.width += advanceX;
  9773. }
  9774. }
  9775. return true;
  9776. }
  9777. function buildTextContentItem({
  9778. chars,
  9779. extraSpacing
  9780. }) {
  9781. const font = textState.font;
  9782. if (!chars) {
  9783. const charSpacing = textState.charSpacing + extraSpacing;
  9784. if (charSpacing) {
  9785. if (!font.vertical) {
  9786. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  9787. } else {
  9788. textState.translateTextMatrix(0, -charSpacing);
  9789. }
  9790. }
  9791. return;
  9792. }
  9793. const glyphs = font.charsToGlyphs(chars);
  9794. const scale = textState.fontMatrix[0] * textState.fontSize;
  9795. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  9796. const glyph = glyphs[i];
  9797. if (glyph.isInvisibleFormatMark) {
  9798. continue;
  9799. }
  9800. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  9801. let glyphWidth = glyph.width;
  9802. if (font.vertical) {
  9803. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  9804. }
  9805. let scaledDim = glyphWidth * scale;
  9806. if (glyph.isWhitespace) {
  9807. if (!font.vertical) {
  9808. charSpacing += scaledDim + textState.wordSpacing;
  9809. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  9810. } else {
  9811. charSpacing += -scaledDim + textState.wordSpacing;
  9812. textState.translateTextMatrix(0, -charSpacing);
  9813. }
  9814. saveLastChar(" ");
  9815. continue;
  9816. }
  9817. if (!compareWithLastPosition()) {
  9818. continue;
  9819. }
  9820. const textChunk = ensureTextContentItem();
  9821. if (glyph.isZeroWidthDiacritic) {
  9822. scaledDim = 0;
  9823. }
  9824. if (!font.vertical) {
  9825. scaledDim *= textState.textHScale;
  9826. textState.translateTextMatrix(scaledDim, 0);
  9827. textChunk.width += scaledDim;
  9828. } else {
  9829. textState.translateTextMatrix(0, scaledDim);
  9830. scaledDim = Math.abs(scaledDim);
  9831. textChunk.height += scaledDim;
  9832. }
  9833. if (scaledDim) {
  9834. textChunk.prevTransform = getCurrentTextTransform();
  9835. }
  9836. let glyphUnicode = glyph.unicode;
  9837. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  9838. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  9839. if (saveLastChar(glyphUnicode)) {
  9840. textChunk.str.push(" ");
  9841. }
  9842. textChunk.str.push(glyphUnicode);
  9843. if (charSpacing) {
  9844. if (!font.vertical) {
  9845. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  9846. } else {
  9847. textState.translateTextMatrix(0, -charSpacing);
  9848. }
  9849. }
  9850. }
  9851. }
  9852. function appendEOL() {
  9853. resetLastChars();
  9854. if (textContentItem.initialized) {
  9855. textContentItem.hasEOL = true;
  9856. flushTextContentItem();
  9857. } else {
  9858. textContent.items.push({
  9859. str: "",
  9860. dir: "ltr",
  9861. width: 0,
  9862. height: 0,
  9863. transform: getCurrentTextTransform(),
  9864. fontName: textState.font.loadedName,
  9865. hasEOL: true
  9866. });
  9867. }
  9868. }
  9869. function addFakeSpaces(width, transf, textOrientation) {
  9870. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  9871. if (textContentItem.initialized) {
  9872. resetLastChars();
  9873. textContentItem.str.push(" ");
  9874. }
  9875. return false;
  9876. }
  9877. const fontName = textContentItem.fontName;
  9878. let height = 0;
  9879. if (textContentItem.vertical) {
  9880. height = width;
  9881. width = 0;
  9882. }
  9883. flushTextContentItem();
  9884. resetLastChars();
  9885. textContent.items.push({
  9886. str: " ",
  9887. dir: "ltr",
  9888. width: Math.abs(width),
  9889. height: Math.abs(height),
  9890. transform: transf || getCurrentTextTransform(),
  9891. fontName,
  9892. hasEOL: false
  9893. });
  9894. return true;
  9895. }
  9896. function flushTextContentItem() {
  9897. if (!textContentItem.initialized || !textContentItem.str) {
  9898. return;
  9899. }
  9900. if (!textContentItem.vertical) {
  9901. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  9902. } else {
  9903. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  9904. }
  9905. textContent.items.push(runBidiTransform(textContentItem));
  9906. textContentItem.initialized = false;
  9907. textContentItem.str.length = 0;
  9908. }
  9909. function enqueueChunk(batch = false) {
  9910. const length = textContent.items.length;
  9911. if (length === 0) {
  9912. return;
  9913. }
  9914. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  9915. return;
  9916. }
  9917. sink.enqueue(textContent, length);
  9918. textContent.items = [];
  9919. textContent.styles = Object.create(null);
  9920. }
  9921. const timeSlotManager = new TimeSlotManager();
  9922. return new Promise(function promiseBody(resolve, reject) {
  9923. const next = function (promise) {
  9924. enqueueChunk(true);
  9925. Promise.all([promise, sink.ready]).then(function () {
  9926. try {
  9927. promiseBody(resolve, reject);
  9928. } catch (ex) {
  9929. reject(ex);
  9930. }
  9931. }, reject);
  9932. };
  9933. task.ensureNotTerminated();
  9934. timeSlotManager.reset();
  9935. const operation = {};
  9936. let stop,
  9937. args = [];
  9938. while (!(stop = timeSlotManager.check())) {
  9939. args.length = 0;
  9940. operation.args = args;
  9941. if (!preprocessor.read(operation)) {
  9942. break;
  9943. }
  9944. textState = stateManager.state;
  9945. const fn = operation.fn;
  9946. args = operation.args;
  9947. switch (fn | 0) {
  9948. case _util.OPS.setFont:
  9949. var fontNameArg = args[0].name,
  9950. fontSizeArg = args[1];
  9951. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  9952. break;
  9953. }
  9954. flushTextContentItem();
  9955. textState.fontName = fontNameArg;
  9956. textState.fontSize = fontSizeArg;
  9957. next(handleSetFont(fontNameArg, null));
  9958. return;
  9959. case _util.OPS.setTextRise:
  9960. textState.textRise = args[0];
  9961. break;
  9962. case _util.OPS.setHScale:
  9963. textState.textHScale = args[0] / 100;
  9964. break;
  9965. case _util.OPS.setLeading:
  9966. textState.leading = args[0];
  9967. break;
  9968. case _util.OPS.moveText:
  9969. textState.translateTextLineMatrix(args[0], args[1]);
  9970. textState.textMatrix = textState.textLineMatrix.slice();
  9971. break;
  9972. case _util.OPS.setLeadingMoveText:
  9973. textState.leading = -args[1];
  9974. textState.translateTextLineMatrix(args[0], args[1]);
  9975. textState.textMatrix = textState.textLineMatrix.slice();
  9976. break;
  9977. case _util.OPS.nextLine:
  9978. textState.carriageReturn();
  9979. break;
  9980. case _util.OPS.setTextMatrix:
  9981. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  9982. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  9983. updateAdvanceScale();
  9984. break;
  9985. case _util.OPS.setCharSpacing:
  9986. textState.charSpacing = args[0];
  9987. break;
  9988. case _util.OPS.setWordSpacing:
  9989. textState.wordSpacing = args[0];
  9990. break;
  9991. case _util.OPS.beginText:
  9992. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  9993. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  9994. break;
  9995. case _util.OPS.showSpacedText:
  9996. if (!stateManager.state.font) {
  9997. self.ensureStateFont(stateManager.state);
  9998. continue;
  9999. }
  10000. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  10001. const elements = args[0];
  10002. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  10003. const item = elements[i];
  10004. if (typeof item === "string") {
  10005. showSpacedTextBuffer.push(item);
  10006. } else if (typeof item === "number" && item !== 0) {
  10007. const str = showSpacedTextBuffer.join("");
  10008. showSpacedTextBuffer.length = 0;
  10009. buildTextContentItem({
  10010. chars: str,
  10011. extraSpacing: item * spaceFactor
  10012. });
  10013. }
  10014. }
  10015. const item = elements.at(-1);
  10016. if (typeof item === "string") {
  10017. showSpacedTextBuffer.push(item);
  10018. }
  10019. if (showSpacedTextBuffer.length > 0) {
  10020. const str = showSpacedTextBuffer.join("");
  10021. showSpacedTextBuffer.length = 0;
  10022. buildTextContentItem({
  10023. chars: str,
  10024. extraSpacing: 0
  10025. });
  10026. }
  10027. break;
  10028. case _util.OPS.showText:
  10029. if (!stateManager.state.font) {
  10030. self.ensureStateFont(stateManager.state);
  10031. continue;
  10032. }
  10033. buildTextContentItem({
  10034. chars: args[0],
  10035. extraSpacing: 0
  10036. });
  10037. break;
  10038. case _util.OPS.nextLineShowText:
  10039. if (!stateManager.state.font) {
  10040. self.ensureStateFont(stateManager.state);
  10041. continue;
  10042. }
  10043. textState.carriageReturn();
  10044. buildTextContentItem({
  10045. chars: args[0],
  10046. extraSpacing: 0
  10047. });
  10048. break;
  10049. case _util.OPS.nextLineSetSpacingShowText:
  10050. if (!stateManager.state.font) {
  10051. self.ensureStateFont(stateManager.state);
  10052. continue;
  10053. }
  10054. textState.wordSpacing = args[0];
  10055. textState.charSpacing = args[1];
  10056. textState.carriageReturn();
  10057. buildTextContentItem({
  10058. chars: args[2],
  10059. extraSpacing: 0
  10060. });
  10061. break;
  10062. case _util.OPS.paintXObject:
  10063. flushTextContentItem();
  10064. if (!xobjs) {
  10065. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  10066. }
  10067. var isValidName = args[0] instanceof _primitives.Name;
  10068. var name = args[0].name;
  10069. if (isValidName && emptyXObjectCache.getByName(name)) {
  10070. break;
  10071. }
  10072. next(new Promise(function (resolveXObject, rejectXObject) {
  10073. if (!isValidName) {
  10074. throw new _util.FormatError("XObject must be referred to by name.");
  10075. }
  10076. let xobj = xobjs.getRaw(name);
  10077. if (xobj instanceof _primitives.Ref) {
  10078. if (emptyXObjectCache.getByRef(xobj)) {
  10079. resolveXObject();
  10080. return;
  10081. }
  10082. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  10083. if (globalImage) {
  10084. resolveXObject();
  10085. return;
  10086. }
  10087. xobj = xref.fetch(xobj);
  10088. }
  10089. if (!(xobj instanceof _base_stream.BaseStream)) {
  10090. throw new _util.FormatError("XObject should be a stream");
  10091. }
  10092. const type = xobj.dict.get("Subtype");
  10093. if (!(type instanceof _primitives.Name)) {
  10094. throw new _util.FormatError("XObject should have a Name subtype");
  10095. }
  10096. if (type.name !== "Form") {
  10097. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10098. resolveXObject();
  10099. return;
  10100. }
  10101. const currentState = stateManager.state.clone();
  10102. const xObjStateManager = new StateManager(currentState);
  10103. const matrix = xobj.dict.getArray("Matrix");
  10104. if (Array.isArray(matrix) && matrix.length === 6) {
  10105. xObjStateManager.transform(matrix);
  10106. }
  10107. enqueueChunk();
  10108. const sinkWrapper = {
  10109. enqueueInvoked: false,
  10110. enqueue(chunk, size) {
  10111. this.enqueueInvoked = true;
  10112. sink.enqueue(chunk, size);
  10113. },
  10114. get desiredSize() {
  10115. return sink.desiredSize;
  10116. },
  10117. get ready() {
  10118. return sink.ready;
  10119. }
  10120. };
  10121. self.getTextContent({
  10122. stream: xobj,
  10123. task,
  10124. resources: xobj.dict.get("Resources") || resources,
  10125. stateManager: xObjStateManager,
  10126. combineTextItems,
  10127. includeMarkedContent,
  10128. sink: sinkWrapper,
  10129. seenStyles,
  10130. viewBox
  10131. }).then(function () {
  10132. if (!sinkWrapper.enqueueInvoked) {
  10133. emptyXObjectCache.set(name, xobj.dict.objId, true);
  10134. }
  10135. resolveXObject();
  10136. }, rejectXObject);
  10137. }).catch(function (reason) {
  10138. if (reason instanceof _util.AbortException) {
  10139. return;
  10140. }
  10141. if (self.options.ignoreErrors) {
  10142. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  10143. return;
  10144. }
  10145. throw reason;
  10146. }));
  10147. return;
  10148. case _util.OPS.setGState:
  10149. isValidName = args[0] instanceof _primitives.Name;
  10150. name = args[0].name;
  10151. if (isValidName && emptyGStateCache.getByName(name)) {
  10152. break;
  10153. }
  10154. next(new Promise(function (resolveGState, rejectGState) {
  10155. if (!isValidName) {
  10156. throw new _util.FormatError("GState must be referred to by name.");
  10157. }
  10158. const extGState = resources.get("ExtGState");
  10159. if (!(extGState instanceof _primitives.Dict)) {
  10160. throw new _util.FormatError("ExtGState should be a dictionary.");
  10161. }
  10162. const gState = extGState.get(name);
  10163. if (!(gState instanceof _primitives.Dict)) {
  10164. throw new _util.FormatError("GState should be a dictionary.");
  10165. }
  10166. const gStateFont = gState.get("Font");
  10167. if (!gStateFont) {
  10168. emptyGStateCache.set(name, gState.objId, true);
  10169. resolveGState();
  10170. return;
  10171. }
  10172. flushTextContentItem();
  10173. textState.fontName = null;
  10174. textState.fontSize = gStateFont[1];
  10175. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  10176. }).catch(function (reason) {
  10177. if (reason instanceof _util.AbortException) {
  10178. return;
  10179. }
  10180. if (self.options.ignoreErrors) {
  10181. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  10182. return;
  10183. }
  10184. throw reason;
  10185. }));
  10186. return;
  10187. case _util.OPS.beginMarkedContent:
  10188. flushTextContentItem();
  10189. if (includeMarkedContent) {
  10190. textContent.items.push({
  10191. type: "beginMarkedContent",
  10192. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10193. });
  10194. }
  10195. break;
  10196. case _util.OPS.beginMarkedContentProps:
  10197. flushTextContentItem();
  10198. if (includeMarkedContent) {
  10199. let mcid = null;
  10200. if (args[1] instanceof _primitives.Dict) {
  10201. mcid = args[1].get("MCID");
  10202. }
  10203. textContent.items.push({
  10204. type: "beginMarkedContentProps",
  10205. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  10206. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  10207. });
  10208. }
  10209. break;
  10210. case _util.OPS.endMarkedContent:
  10211. flushTextContentItem();
  10212. if (includeMarkedContent) {
  10213. textContent.items.push({
  10214. type: "endMarkedContent"
  10215. });
  10216. }
  10217. break;
  10218. }
  10219. if (textContent.items.length >= sink.desiredSize) {
  10220. stop = true;
  10221. break;
  10222. }
  10223. }
  10224. if (stop) {
  10225. next(deferred);
  10226. return;
  10227. }
  10228. flushTextContentItem();
  10229. enqueueChunk();
  10230. resolve();
  10231. }).catch(reason => {
  10232. if (reason instanceof _util.AbortException) {
  10233. return;
  10234. }
  10235. if (this.options.ignoreErrors) {
  10236. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  10237. flushTextContentItem();
  10238. enqueueChunk();
  10239. return;
  10240. }
  10241. throw reason;
  10242. });
  10243. }
  10244. extractDataStructures(dict, baseDict, properties) {
  10245. const xref = this.xref;
  10246. let cidToGidBytes;
  10247. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  10248. if (properties.composite) {
  10249. const cidSystemInfo = dict.get("CIDSystemInfo");
  10250. if (cidSystemInfo instanceof _primitives.Dict) {
  10251. properties.cidSystemInfo = {
  10252. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  10253. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  10254. supplement: cidSystemInfo.get("Supplement")
  10255. };
  10256. }
  10257. try {
  10258. const cidToGidMap = dict.get("CIDToGIDMap");
  10259. if (cidToGidMap instanceof _base_stream.BaseStream) {
  10260. cidToGidBytes = cidToGidMap.getBytes();
  10261. }
  10262. } catch (ex) {
  10263. if (!this.options.ignoreErrors) {
  10264. throw ex;
  10265. }
  10266. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  10267. }
  10268. }
  10269. const differences = [];
  10270. let baseEncodingName = null;
  10271. let encoding;
  10272. if (dict.has("Encoding")) {
  10273. encoding = dict.get("Encoding");
  10274. if (encoding instanceof _primitives.Dict) {
  10275. baseEncodingName = encoding.get("BaseEncoding");
  10276. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  10277. if (encoding.has("Differences")) {
  10278. const diffEncoding = encoding.get("Differences");
  10279. let index = 0;
  10280. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  10281. const data = xref.fetchIfRef(diffEncoding[j]);
  10282. if (typeof data === "number") {
  10283. index = data;
  10284. } else if (data instanceof _primitives.Name) {
  10285. differences[index++] = data.name;
  10286. } else {
  10287. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  10288. }
  10289. }
  10290. }
  10291. } else if (encoding instanceof _primitives.Name) {
  10292. baseEncodingName = encoding.name;
  10293. } else {
  10294. const msg = "Encoding is not a Name nor a Dict";
  10295. if (!this.options.ignoreErrors) {
  10296. throw new _util.FormatError(msg);
  10297. }
  10298. (0, _util.warn)(msg);
  10299. }
  10300. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  10301. baseEncodingName = null;
  10302. }
  10303. }
  10304. if (baseEncodingName) {
  10305. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10306. } else {
  10307. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  10308. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  10309. encoding = _encodings.StandardEncoding;
  10310. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  10311. encoding = _encodings.WinAnsiEncoding;
  10312. }
  10313. if (isSymbolicFont) {
  10314. encoding = _encodings.MacRomanEncoding;
  10315. if (!properties.file || properties.isInternalFont) {
  10316. if (/Symbol/i.test(properties.name)) {
  10317. encoding = _encodings.SymbolSetEncoding;
  10318. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  10319. encoding = _encodings.ZapfDingbatsEncoding;
  10320. }
  10321. }
  10322. }
  10323. properties.defaultEncoding = encoding;
  10324. }
  10325. properties.differences = differences;
  10326. properties.baseEncodingName = baseEncodingName;
  10327. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  10328. properties.dict = dict;
  10329. return toUnicodePromise.then(readToUnicode => {
  10330. properties.toUnicode = readToUnicode;
  10331. return this.buildToUnicode(properties);
  10332. }).then(builtToUnicode => {
  10333. properties.toUnicode = builtToUnicode;
  10334. if (cidToGidBytes) {
  10335. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  10336. }
  10337. return properties;
  10338. });
  10339. }
  10340. _simpleFontToUnicode(properties, forceGlyphs = false) {
  10341. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  10342. const toUnicode = [];
  10343. const encoding = properties.defaultEncoding.slice();
  10344. const baseEncodingName = properties.baseEncodingName;
  10345. const differences = properties.differences;
  10346. for (const charcode in differences) {
  10347. const glyphName = differences[charcode];
  10348. if (glyphName === ".notdef") {
  10349. continue;
  10350. }
  10351. encoding[charcode] = glyphName;
  10352. }
  10353. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  10354. for (const charcode in encoding) {
  10355. let glyphName = encoding[charcode];
  10356. if (glyphName === "") {
  10357. continue;
  10358. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  10359. let code = 0;
  10360. switch (glyphName[0]) {
  10361. case "G":
  10362. if (glyphName.length === 3) {
  10363. code = parseInt(glyphName.substring(1), 16);
  10364. }
  10365. break;
  10366. case "g":
  10367. if (glyphName.length === 5) {
  10368. code = parseInt(glyphName.substring(1), 16);
  10369. }
  10370. break;
  10371. case "C":
  10372. case "c":
  10373. if (glyphName.length >= 3 && glyphName.length <= 4) {
  10374. const codeStr = glyphName.substring(1);
  10375. if (forceGlyphs) {
  10376. code = parseInt(codeStr, 16);
  10377. break;
  10378. }
  10379. code = +codeStr;
  10380. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  10381. return this._simpleFontToUnicode(properties, true);
  10382. }
  10383. }
  10384. break;
  10385. default:
  10386. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  10387. if (unicode !== -1) {
  10388. code = unicode;
  10389. }
  10390. }
  10391. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  10392. if (baseEncodingName && code === +charcode) {
  10393. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  10394. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  10395. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  10396. continue;
  10397. }
  10398. }
  10399. toUnicode[charcode] = String.fromCodePoint(code);
  10400. }
  10401. continue;
  10402. }
  10403. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  10404. }
  10405. return toUnicode;
  10406. }
  10407. async buildToUnicode(properties) {
  10408. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  10409. if (properties.hasIncludedToUnicodeMap) {
  10410. if (!properties.composite && properties.hasEncoding) {
  10411. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  10412. }
  10413. return properties.toUnicode;
  10414. }
  10415. if (!properties.composite) {
  10416. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  10417. }
  10418. 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"))) {
  10419. const {
  10420. registry,
  10421. ordering
  10422. } = properties.cidSystemInfo;
  10423. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  10424. const ucs2CMap = await _cmap.CMapFactory.create({
  10425. encoding: ucs2CMapName,
  10426. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10427. useCMap: null
  10428. });
  10429. const toUnicode = [];
  10430. properties.cMap.forEach(function (charcode, cid) {
  10431. if (cid > 0xffff) {
  10432. throw new _util.FormatError("Max size of CID is 65,535");
  10433. }
  10434. const ucs2 = ucs2CMap.lookup(cid);
  10435. if (ucs2) {
  10436. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  10437. }
  10438. });
  10439. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  10440. }
  10441. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  10442. }
  10443. readToUnicode(cmapObj) {
  10444. if (!cmapObj) {
  10445. return Promise.resolve(null);
  10446. }
  10447. if (cmapObj instanceof _primitives.Name) {
  10448. return _cmap.CMapFactory.create({
  10449. encoding: cmapObj,
  10450. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10451. useCMap: null
  10452. }).then(function (cmap) {
  10453. if (cmap instanceof _cmap.IdentityCMap) {
  10454. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10455. }
  10456. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  10457. });
  10458. } else if (cmapObj instanceof _base_stream.BaseStream) {
  10459. return _cmap.CMapFactory.create({
  10460. encoding: cmapObj,
  10461. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10462. useCMap: null
  10463. }).then(function (cmap) {
  10464. if (cmap instanceof _cmap.IdentityCMap) {
  10465. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  10466. }
  10467. const map = new Array(cmap.length);
  10468. cmap.forEach(function (charCode, token) {
  10469. if (typeof token === "number") {
  10470. map[charCode] = String.fromCodePoint(token);
  10471. return;
  10472. }
  10473. const str = [];
  10474. for (let k = 0; k < token.length; k += 2) {
  10475. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10476. if ((w1 & 0xf800) !== 0xd800) {
  10477. str.push(w1);
  10478. continue;
  10479. }
  10480. k += 2;
  10481. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  10482. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  10483. }
  10484. map[charCode] = String.fromCodePoint(...str);
  10485. });
  10486. return new _to_unicode_map.ToUnicodeMap(map);
  10487. }, reason => {
  10488. if (reason instanceof _util.AbortException) {
  10489. return null;
  10490. }
  10491. if (this.options.ignoreErrors) {
  10492. this.handler.send("UnsupportedFeature", {
  10493. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  10494. });
  10495. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  10496. return null;
  10497. }
  10498. throw reason;
  10499. });
  10500. }
  10501. return Promise.resolve(null);
  10502. }
  10503. readCidToGidMap(glyphsData, toUnicode) {
  10504. const result = [];
  10505. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  10506. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  10507. const code = j >> 1;
  10508. if (glyphID === 0 && !toUnicode.has(code)) {
  10509. continue;
  10510. }
  10511. result[code] = glyphID;
  10512. }
  10513. return result;
  10514. }
  10515. extractWidths(dict, descriptor, properties) {
  10516. const xref = this.xref;
  10517. let glyphsWidths = [];
  10518. let defaultWidth = 0;
  10519. const glyphsVMetrics = [];
  10520. let defaultVMetrics;
  10521. let i, ii, j, jj, start, code, widths;
  10522. if (properties.composite) {
  10523. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  10524. widths = dict.get("W");
  10525. if (widths) {
  10526. for (i = 0, ii = widths.length; i < ii; i++) {
  10527. start = xref.fetchIfRef(widths[i++]);
  10528. code = xref.fetchIfRef(widths[i]);
  10529. if (Array.isArray(code)) {
  10530. for (j = 0, jj = code.length; j < jj; j++) {
  10531. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  10532. }
  10533. } else {
  10534. const width = xref.fetchIfRef(widths[++i]);
  10535. for (j = start; j <= code; j++) {
  10536. glyphsWidths[j] = width;
  10537. }
  10538. }
  10539. }
  10540. }
  10541. if (properties.vertical) {
  10542. let vmetrics = dict.getArray("DW2") || [880, -1000];
  10543. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  10544. vmetrics = dict.get("W2");
  10545. if (vmetrics) {
  10546. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  10547. start = xref.fetchIfRef(vmetrics[i++]);
  10548. code = xref.fetchIfRef(vmetrics[i]);
  10549. if (Array.isArray(code)) {
  10550. for (j = 0, jj = code.length; j < jj; j++) {
  10551. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  10552. }
  10553. } else {
  10554. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  10555. for (j = start; j <= code; j++) {
  10556. glyphsVMetrics[j] = vmetric;
  10557. }
  10558. }
  10559. }
  10560. }
  10561. }
  10562. } else {
  10563. const firstChar = properties.firstChar;
  10564. widths = dict.get("Widths");
  10565. if (widths) {
  10566. j = firstChar;
  10567. for (i = 0, ii = widths.length; i < ii; i++) {
  10568. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  10569. }
  10570. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  10571. } else {
  10572. const baseFontName = dict.get("BaseFont");
  10573. if (baseFontName instanceof _primitives.Name) {
  10574. const metrics = this.getBaseFontMetrics(baseFontName.name);
  10575. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  10576. defaultWidth = metrics.defaultWidth;
  10577. }
  10578. }
  10579. }
  10580. let isMonospace = true;
  10581. let firstWidth = defaultWidth;
  10582. for (const glyph in glyphsWidths) {
  10583. const glyphWidth = glyphsWidths[glyph];
  10584. if (!glyphWidth) {
  10585. continue;
  10586. }
  10587. if (!firstWidth) {
  10588. firstWidth = glyphWidth;
  10589. continue;
  10590. }
  10591. if (firstWidth !== glyphWidth) {
  10592. isMonospace = false;
  10593. break;
  10594. }
  10595. }
  10596. if (isMonospace) {
  10597. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  10598. }
  10599. properties.defaultWidth = defaultWidth;
  10600. properties.widths = glyphsWidths;
  10601. properties.defaultVMetrics = defaultVMetrics;
  10602. properties.vmetrics = glyphsVMetrics;
  10603. }
  10604. isSerifFont(baseFontName) {
  10605. const fontNameWoStyle = baseFontName.split("-")[0];
  10606. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  10607. }
  10608. getBaseFontMetrics(name) {
  10609. let defaultWidth = 0;
  10610. let widths = Object.create(null);
  10611. let monospace = false;
  10612. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  10613. let lookupName = stdFontMap[name] || name;
  10614. const Metrics = (0, _metrics.getMetrics)();
  10615. if (!(lookupName in Metrics)) {
  10616. if (this.isSerifFont(name)) {
  10617. lookupName = "Times-Roman";
  10618. } else {
  10619. lookupName = "Helvetica";
  10620. }
  10621. }
  10622. const glyphWidths = Metrics[lookupName];
  10623. if (typeof glyphWidths === "number") {
  10624. defaultWidth = glyphWidths;
  10625. monospace = true;
  10626. } else {
  10627. widths = glyphWidths();
  10628. }
  10629. return {
  10630. defaultWidth,
  10631. monospace,
  10632. widths
  10633. };
  10634. }
  10635. buildCharCodeToWidth(widthsByGlyphName, properties) {
  10636. const widths = Object.create(null);
  10637. const differences = properties.differences;
  10638. const encoding = properties.defaultEncoding;
  10639. for (let charCode = 0; charCode < 256; charCode++) {
  10640. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  10641. widths[charCode] = widthsByGlyphName[differences[charCode]];
  10642. continue;
  10643. }
  10644. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  10645. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  10646. continue;
  10647. }
  10648. }
  10649. return widths;
  10650. }
  10651. preEvaluateFont(dict) {
  10652. const baseDict = dict;
  10653. let type = dict.get("Subtype");
  10654. if (!(type instanceof _primitives.Name)) {
  10655. throw new _util.FormatError("invalid font Subtype");
  10656. }
  10657. let composite = false;
  10658. let hash, toUnicode;
  10659. if (type.name === "Type0") {
  10660. const df = dict.get("DescendantFonts");
  10661. if (!df) {
  10662. throw new _util.FormatError("Descendant fonts are not specified");
  10663. }
  10664. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  10665. if (!(dict instanceof _primitives.Dict)) {
  10666. throw new _util.FormatError("Descendant font is not a dictionary.");
  10667. }
  10668. type = dict.get("Subtype");
  10669. if (!(type instanceof _primitives.Name)) {
  10670. throw new _util.FormatError("invalid font Subtype");
  10671. }
  10672. composite = true;
  10673. }
  10674. const firstChar = dict.get("FirstChar") || 0,
  10675. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  10676. const descriptor = dict.get("FontDescriptor");
  10677. if (descriptor) {
  10678. hash = new _murmurhash.MurmurHash3_64();
  10679. const encoding = baseDict.getRaw("Encoding");
  10680. if (encoding instanceof _primitives.Name) {
  10681. hash.update(encoding.name);
  10682. } else if (encoding instanceof _primitives.Ref) {
  10683. hash.update(encoding.toString());
  10684. } else if (encoding instanceof _primitives.Dict) {
  10685. for (const entry of encoding.getRawValues()) {
  10686. if (entry instanceof _primitives.Name) {
  10687. hash.update(entry.name);
  10688. } else if (entry instanceof _primitives.Ref) {
  10689. hash.update(entry.toString());
  10690. } else if (Array.isArray(entry)) {
  10691. const diffLength = entry.length,
  10692. diffBuf = new Array(diffLength);
  10693. for (let j = 0; j < diffLength; j++) {
  10694. const diffEntry = entry[j];
  10695. if (diffEntry instanceof _primitives.Name) {
  10696. diffBuf[j] = diffEntry.name;
  10697. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  10698. diffBuf[j] = diffEntry.toString();
  10699. }
  10700. }
  10701. hash.update(diffBuf.join());
  10702. }
  10703. }
  10704. }
  10705. hash.update(`${firstChar}-${lastChar}`);
  10706. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  10707. if (toUnicode instanceof _base_stream.BaseStream) {
  10708. const stream = toUnicode.str || toUnicode;
  10709. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  10710. hash.update(uint8array);
  10711. } else if (toUnicode instanceof _primitives.Name) {
  10712. hash.update(toUnicode.name);
  10713. }
  10714. const widths = dict.get("Widths") || baseDict.get("Widths");
  10715. if (Array.isArray(widths)) {
  10716. const widthsBuf = [];
  10717. for (const entry of widths) {
  10718. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  10719. widthsBuf.push(entry.toString());
  10720. }
  10721. }
  10722. hash.update(widthsBuf.join());
  10723. }
  10724. if (composite) {
  10725. hash.update("compositeFont");
  10726. const compositeWidths = dict.get("W") || baseDict.get("W");
  10727. if (Array.isArray(compositeWidths)) {
  10728. const widthsBuf = [];
  10729. for (const entry of compositeWidths) {
  10730. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  10731. widthsBuf.push(entry.toString());
  10732. } else if (Array.isArray(entry)) {
  10733. const subWidthsBuf = [];
  10734. for (const element of entry) {
  10735. if (typeof element === "number" || element instanceof _primitives.Ref) {
  10736. subWidthsBuf.push(element.toString());
  10737. }
  10738. }
  10739. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  10740. }
  10741. }
  10742. hash.update(widthsBuf.join());
  10743. }
  10744. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  10745. if (cidToGidMap instanceof _primitives.Name) {
  10746. hash.update(cidToGidMap.name);
  10747. } else if (cidToGidMap instanceof _primitives.Ref) {
  10748. hash.update(cidToGidMap.toString());
  10749. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  10750. hash.update(cidToGidMap.peekBytes());
  10751. }
  10752. }
  10753. }
  10754. return {
  10755. descriptor,
  10756. dict,
  10757. baseDict,
  10758. composite,
  10759. type: type.name,
  10760. firstChar,
  10761. lastChar,
  10762. toUnicode,
  10763. hash: hash ? hash.hexdigest() : ""
  10764. };
  10765. }
  10766. async translateFont({
  10767. descriptor,
  10768. dict,
  10769. baseDict,
  10770. composite,
  10771. type,
  10772. firstChar,
  10773. lastChar,
  10774. toUnicode,
  10775. cssFontInfo
  10776. }) {
  10777. const isType3Font = type === "Type3";
  10778. let properties;
  10779. if (!descriptor) {
  10780. if (isType3Font) {
  10781. descriptor = new _primitives.Dict(null);
  10782. descriptor.set("FontName", _primitives.Name.get(type));
  10783. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  10784. } else {
  10785. let baseFontName = dict.get("BaseFont");
  10786. if (!(baseFontName instanceof _primitives.Name)) {
  10787. throw new _util.FormatError("Base font is not specified");
  10788. }
  10789. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  10790. const metrics = this.getBaseFontMetrics(baseFontName);
  10791. const fontNameWoStyle = baseFontName.split("-")[0];
  10792. 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);
  10793. properties = {
  10794. type,
  10795. name: baseFontName,
  10796. loadedName: baseDict.loadedName,
  10797. widths: metrics.widths,
  10798. defaultWidth: metrics.defaultWidth,
  10799. isSimulatedFlags: true,
  10800. flags,
  10801. firstChar,
  10802. lastChar,
  10803. toUnicode,
  10804. xHeight: 0,
  10805. capHeight: 0,
  10806. italicAngle: 0,
  10807. isType3Font
  10808. };
  10809. const widths = dict.get("Widths");
  10810. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  10811. let file = null;
  10812. if (standardFontName) {
  10813. properties.isStandardFont = true;
  10814. file = await this.fetchStandardFontData(standardFontName);
  10815. properties.isInternalFont = !!file;
  10816. }
  10817. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  10818. if (widths) {
  10819. const glyphWidths = [];
  10820. let j = firstChar;
  10821. for (let i = 0, ii = widths.length; i < ii; i++) {
  10822. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  10823. }
  10824. newProperties.widths = glyphWidths;
  10825. } else {
  10826. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  10827. }
  10828. return new _fonts.Font(baseFontName, file, newProperties);
  10829. });
  10830. }
  10831. }
  10832. let fontName = descriptor.get("FontName");
  10833. let baseFont = dict.get("BaseFont");
  10834. if (typeof fontName === "string") {
  10835. fontName = _primitives.Name.get(fontName);
  10836. }
  10837. if (typeof baseFont === "string") {
  10838. baseFont = _primitives.Name.get(baseFont);
  10839. }
  10840. if (!isType3Font) {
  10841. const fontNameStr = fontName && fontName.name;
  10842. const baseFontStr = baseFont && baseFont.name;
  10843. if (fontNameStr !== baseFontStr) {
  10844. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  10845. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  10846. fontName = baseFont;
  10847. }
  10848. }
  10849. }
  10850. fontName = fontName || baseFont;
  10851. if (!(fontName instanceof _primitives.Name)) {
  10852. throw new _util.FormatError("invalid font name");
  10853. }
  10854. let fontFile, subtype, length1, length2, length3;
  10855. try {
  10856. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  10857. } catch (ex) {
  10858. if (!this.options.ignoreErrors) {
  10859. throw ex;
  10860. }
  10861. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  10862. fontFile = new _stream.NullStream();
  10863. }
  10864. let isStandardFont = false;
  10865. let isInternalFont = false;
  10866. let glyphScaleFactors = null;
  10867. if (fontFile) {
  10868. if (fontFile.dict) {
  10869. const subtypeEntry = fontFile.dict.get("Subtype");
  10870. if (subtypeEntry instanceof _primitives.Name) {
  10871. subtype = subtypeEntry.name;
  10872. }
  10873. length1 = fontFile.dict.get("Length1");
  10874. length2 = fontFile.dict.get("Length2");
  10875. length3 = fontFile.dict.get("Length3");
  10876. }
  10877. } else if (cssFontInfo) {
  10878. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  10879. if (standardFontName) {
  10880. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  10881. cssFontInfo.metrics = standardFontName.metrics || null;
  10882. glyphScaleFactors = standardFontName.factors || null;
  10883. fontFile = await this.fetchStandardFontData(standardFontName.name);
  10884. isInternalFont = !!fontFile;
  10885. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  10886. composite = true;
  10887. }
  10888. } else if (!isType3Font) {
  10889. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  10890. if (standardFontName) {
  10891. isStandardFont = true;
  10892. fontFile = await this.fetchStandardFontData(standardFontName);
  10893. isInternalFont = !!fontFile;
  10894. }
  10895. }
  10896. properties = {
  10897. type,
  10898. name: fontName.name,
  10899. subtype,
  10900. file: fontFile,
  10901. length1,
  10902. length2,
  10903. length3,
  10904. isStandardFont,
  10905. isInternalFont,
  10906. loadedName: baseDict.loadedName,
  10907. composite,
  10908. fixedPitch: false,
  10909. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  10910. firstChar,
  10911. lastChar,
  10912. toUnicode,
  10913. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  10914. ascent: descriptor.get("Ascent"),
  10915. descent: descriptor.get("Descent"),
  10916. xHeight: descriptor.get("XHeight") || 0,
  10917. capHeight: descriptor.get("CapHeight") || 0,
  10918. flags: descriptor.get("Flags"),
  10919. italicAngle: descriptor.get("ItalicAngle") || 0,
  10920. isType3Font,
  10921. cssFontInfo,
  10922. scaleFactors: glyphScaleFactors
  10923. };
  10924. if (composite) {
  10925. const cidEncoding = baseDict.get("Encoding");
  10926. if (cidEncoding instanceof _primitives.Name) {
  10927. properties.cidEncoding = cidEncoding.name;
  10928. }
  10929. const cMap = await _cmap.CMapFactory.create({
  10930. encoding: cidEncoding,
  10931. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  10932. useCMap: null
  10933. });
  10934. properties.cMap = cMap;
  10935. properties.vertical = properties.cMap.vertical;
  10936. }
  10937. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  10938. this.extractWidths(dict, descriptor, newProperties);
  10939. return new _fonts.Font(fontName.name, fontFile, newProperties);
  10940. });
  10941. }
  10942. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  10943. function buildPath(fontChar) {
  10944. const glyphName = `${font.loadedName}_path_${fontChar}`;
  10945. try {
  10946. if (font.renderer.hasBuiltPath(fontChar)) {
  10947. return;
  10948. }
  10949. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  10950. } catch (reason) {
  10951. if (evaluatorOptions.ignoreErrors) {
  10952. handler.send("UnsupportedFeature", {
  10953. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  10954. });
  10955. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  10956. return;
  10957. }
  10958. throw reason;
  10959. }
  10960. }
  10961. for (const glyph of glyphs) {
  10962. buildPath(glyph.fontChar);
  10963. const accent = glyph.accent;
  10964. if (accent && accent.fontChar) {
  10965. buildPath(accent.fontChar);
  10966. }
  10967. }
  10968. }
  10969. static get fallbackFontDict() {
  10970. const dict = new _primitives.Dict();
  10971. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  10972. dict.set("Type", _primitives.Name.get("FallbackType"));
  10973. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  10974. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  10975. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  10976. }
  10977. }
  10978. exports.PartialEvaluator = PartialEvaluator;
  10979. class TranslatedFont {
  10980. constructor({
  10981. loadedName,
  10982. font,
  10983. dict,
  10984. evaluatorOptions
  10985. }) {
  10986. this.loadedName = loadedName;
  10987. this.font = font;
  10988. this.dict = dict;
  10989. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  10990. this.type3Loaded = null;
  10991. this.type3Dependencies = font.isType3Font ? new Set() : null;
  10992. this.sent = false;
  10993. }
  10994. send(handler) {
  10995. if (this.sent) {
  10996. return;
  10997. }
  10998. this.sent = true;
  10999. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  11000. }
  11001. fallback(handler) {
  11002. if (!this.font.data) {
  11003. return;
  11004. }
  11005. this.font.disableFontFace = true;
  11006. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  11007. }
  11008. loadType3Data(evaluator, resources, task) {
  11009. if (this.type3Loaded) {
  11010. return this.type3Loaded;
  11011. }
  11012. if (!this.font.isType3Font) {
  11013. throw new Error("Must be a Type3 font.");
  11014. }
  11015. const type3Evaluator = evaluator.clone({
  11016. ignoreErrors: false
  11017. });
  11018. type3Evaluator.parsingType3Font = true;
  11019. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  11020. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  11021. type3FontRefs.put(this.dict.objId);
  11022. }
  11023. type3Evaluator.type3FontRefs = type3FontRefs;
  11024. const translatedFont = this.font,
  11025. type3Dependencies = this.type3Dependencies;
  11026. let loadCharProcsPromise = Promise.resolve();
  11027. const charProcs = this.dict.get("CharProcs");
  11028. const fontResources = this.dict.get("Resources") || resources;
  11029. const charProcOperatorList = Object.create(null);
  11030. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  11031. width = fontBBox[2] - fontBBox[0],
  11032. height = fontBBox[3] - fontBBox[1];
  11033. const fontBBoxSize = Math.hypot(width, height);
  11034. for (const key of charProcs.getKeys()) {
  11035. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  11036. const glyphStream = charProcs.get(key);
  11037. const operatorList = new _operator_list.OperatorList();
  11038. return type3Evaluator.getOperatorList({
  11039. stream: glyphStream,
  11040. task,
  11041. resources: fontResources,
  11042. operatorList
  11043. }).then(() => {
  11044. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  11045. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  11046. }
  11047. charProcOperatorList[key] = operatorList.getIR();
  11048. for (const dependency of operatorList.dependencies) {
  11049. type3Dependencies.add(dependency);
  11050. }
  11051. }).catch(function (reason) {
  11052. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  11053. const dummyOperatorList = new _operator_list.OperatorList();
  11054. charProcOperatorList[key] = dummyOperatorList.getIR();
  11055. });
  11056. });
  11057. }
  11058. this.type3Loaded = loadCharProcsPromise.then(() => {
  11059. translatedFont.charProcOperatorList = charProcOperatorList;
  11060. if (this._bbox) {
  11061. translatedFont.isCharBBox = true;
  11062. translatedFont.bbox = this._bbox;
  11063. }
  11064. });
  11065. return this.type3Loaded;
  11066. }
  11067. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  11068. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  11069. width = charBBox[2] - charBBox[0],
  11070. height = charBBox[3] - charBBox[1];
  11071. const charBBoxSize = Math.hypot(width, height);
  11072. if (width === 0 || height === 0) {
  11073. operatorList.fnArray.splice(0, 1);
  11074. operatorList.argsArray.splice(0, 1);
  11075. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  11076. if (!this._bbox) {
  11077. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  11078. }
  11079. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  11080. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  11081. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  11082. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  11083. }
  11084. let i = 0,
  11085. ii = operatorList.length;
  11086. while (i < ii) {
  11087. switch (operatorList.fnArray[i]) {
  11088. case _util.OPS.setCharWidthAndBounds:
  11089. break;
  11090. case _util.OPS.setStrokeColorSpace:
  11091. case _util.OPS.setFillColorSpace:
  11092. case _util.OPS.setStrokeColor:
  11093. case _util.OPS.setStrokeColorN:
  11094. case _util.OPS.setFillColor:
  11095. case _util.OPS.setFillColorN:
  11096. case _util.OPS.setStrokeGray:
  11097. case _util.OPS.setFillGray:
  11098. case _util.OPS.setStrokeRGBColor:
  11099. case _util.OPS.setFillRGBColor:
  11100. case _util.OPS.setStrokeCMYKColor:
  11101. case _util.OPS.setFillCMYKColor:
  11102. case _util.OPS.shadingFill:
  11103. case _util.OPS.setRenderingIntent:
  11104. operatorList.fnArray.splice(i, 1);
  11105. operatorList.argsArray.splice(i, 1);
  11106. ii--;
  11107. continue;
  11108. case _util.OPS.setGState:
  11109. const [gStateObj] = operatorList.argsArray[i];
  11110. let j = 0,
  11111. jj = gStateObj.length;
  11112. while (j < jj) {
  11113. const [gStateKey] = gStateObj[j];
  11114. switch (gStateKey) {
  11115. case "TR":
  11116. case "TR2":
  11117. case "HT":
  11118. case "BG":
  11119. case "BG2":
  11120. case "UCR":
  11121. case "UCR2":
  11122. gStateObj.splice(j, 1);
  11123. jj--;
  11124. continue;
  11125. }
  11126. j++;
  11127. }
  11128. break;
  11129. }
  11130. i++;
  11131. }
  11132. }
  11133. }
  11134. class StateManager {
  11135. constructor(initialState = new EvalState()) {
  11136. this.state = initialState;
  11137. this.stateStack = [];
  11138. }
  11139. save() {
  11140. const old = this.state;
  11141. this.stateStack.push(this.state);
  11142. this.state = old.clone();
  11143. }
  11144. restore() {
  11145. const prev = this.stateStack.pop();
  11146. if (prev) {
  11147. this.state = prev;
  11148. }
  11149. }
  11150. transform(args) {
  11151. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  11152. }
  11153. }
  11154. class TextState {
  11155. constructor() {
  11156. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11157. this.fontName = null;
  11158. this.fontSize = 0;
  11159. this.font = null;
  11160. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  11161. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  11162. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  11163. this.charSpacing = 0;
  11164. this.wordSpacing = 0;
  11165. this.leading = 0;
  11166. this.textHScale = 1;
  11167. this.textRise = 0;
  11168. }
  11169. setTextMatrix(a, b, c, d, e, f) {
  11170. const m = this.textMatrix;
  11171. m[0] = a;
  11172. m[1] = b;
  11173. m[2] = c;
  11174. m[3] = d;
  11175. m[4] = e;
  11176. m[5] = f;
  11177. }
  11178. setTextLineMatrix(a, b, c, d, e, f) {
  11179. const m = this.textLineMatrix;
  11180. m[0] = a;
  11181. m[1] = b;
  11182. m[2] = c;
  11183. m[3] = d;
  11184. m[4] = e;
  11185. m[5] = f;
  11186. }
  11187. translateTextMatrix(x, y) {
  11188. const m = this.textMatrix;
  11189. m[4] = m[0] * x + m[2] * y + m[4];
  11190. m[5] = m[1] * x + m[3] * y + m[5];
  11191. }
  11192. translateTextLineMatrix(x, y) {
  11193. const m = this.textLineMatrix;
  11194. m[4] = m[0] * x + m[2] * y + m[4];
  11195. m[5] = m[1] * x + m[3] * y + m[5];
  11196. }
  11197. carriageReturn() {
  11198. this.translateTextLineMatrix(0, -this.leading);
  11199. this.textMatrix = this.textLineMatrix.slice();
  11200. }
  11201. clone() {
  11202. const clone = Object.create(this);
  11203. clone.textMatrix = this.textMatrix.slice();
  11204. clone.textLineMatrix = this.textLineMatrix.slice();
  11205. clone.fontMatrix = this.fontMatrix.slice();
  11206. return clone;
  11207. }
  11208. }
  11209. class EvalState {
  11210. constructor() {
  11211. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  11212. this.font = null;
  11213. this.textRenderingMode = _util.TextRenderingMode.FILL;
  11214. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  11215. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  11216. }
  11217. clone() {
  11218. return Object.create(this);
  11219. }
  11220. }
  11221. class EvaluatorPreprocessor {
  11222. static get opMap() {
  11223. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  11224. t.w = {
  11225. id: _util.OPS.setLineWidth,
  11226. numArgs: 1,
  11227. variableArgs: false
  11228. };
  11229. t.J = {
  11230. id: _util.OPS.setLineCap,
  11231. numArgs: 1,
  11232. variableArgs: false
  11233. };
  11234. t.j = {
  11235. id: _util.OPS.setLineJoin,
  11236. numArgs: 1,
  11237. variableArgs: false
  11238. };
  11239. t.M = {
  11240. id: _util.OPS.setMiterLimit,
  11241. numArgs: 1,
  11242. variableArgs: false
  11243. };
  11244. t.d = {
  11245. id: _util.OPS.setDash,
  11246. numArgs: 2,
  11247. variableArgs: false
  11248. };
  11249. t.ri = {
  11250. id: _util.OPS.setRenderingIntent,
  11251. numArgs: 1,
  11252. variableArgs: false
  11253. };
  11254. t.i = {
  11255. id: _util.OPS.setFlatness,
  11256. numArgs: 1,
  11257. variableArgs: false
  11258. };
  11259. t.gs = {
  11260. id: _util.OPS.setGState,
  11261. numArgs: 1,
  11262. variableArgs: false
  11263. };
  11264. t.q = {
  11265. id: _util.OPS.save,
  11266. numArgs: 0,
  11267. variableArgs: false
  11268. };
  11269. t.Q = {
  11270. id: _util.OPS.restore,
  11271. numArgs: 0,
  11272. variableArgs: false
  11273. };
  11274. t.cm = {
  11275. id: _util.OPS.transform,
  11276. numArgs: 6,
  11277. variableArgs: false
  11278. };
  11279. t.m = {
  11280. id: _util.OPS.moveTo,
  11281. numArgs: 2,
  11282. variableArgs: false
  11283. };
  11284. t.l = {
  11285. id: _util.OPS.lineTo,
  11286. numArgs: 2,
  11287. variableArgs: false
  11288. };
  11289. t.c = {
  11290. id: _util.OPS.curveTo,
  11291. numArgs: 6,
  11292. variableArgs: false
  11293. };
  11294. t.v = {
  11295. id: _util.OPS.curveTo2,
  11296. numArgs: 4,
  11297. variableArgs: false
  11298. };
  11299. t.y = {
  11300. id: _util.OPS.curveTo3,
  11301. numArgs: 4,
  11302. variableArgs: false
  11303. };
  11304. t.h = {
  11305. id: _util.OPS.closePath,
  11306. numArgs: 0,
  11307. variableArgs: false
  11308. };
  11309. t.re = {
  11310. id: _util.OPS.rectangle,
  11311. numArgs: 4,
  11312. variableArgs: false
  11313. };
  11314. t.S = {
  11315. id: _util.OPS.stroke,
  11316. numArgs: 0,
  11317. variableArgs: false
  11318. };
  11319. t.s = {
  11320. id: _util.OPS.closeStroke,
  11321. numArgs: 0,
  11322. variableArgs: false
  11323. };
  11324. t.f = {
  11325. id: _util.OPS.fill,
  11326. numArgs: 0,
  11327. variableArgs: false
  11328. };
  11329. t.F = {
  11330. id: _util.OPS.fill,
  11331. numArgs: 0,
  11332. variableArgs: false
  11333. };
  11334. t["f*"] = {
  11335. id: _util.OPS.eoFill,
  11336. numArgs: 0,
  11337. variableArgs: false
  11338. };
  11339. t.B = {
  11340. id: _util.OPS.fillStroke,
  11341. numArgs: 0,
  11342. variableArgs: false
  11343. };
  11344. t["B*"] = {
  11345. id: _util.OPS.eoFillStroke,
  11346. numArgs: 0,
  11347. variableArgs: false
  11348. };
  11349. t.b = {
  11350. id: _util.OPS.closeFillStroke,
  11351. numArgs: 0,
  11352. variableArgs: false
  11353. };
  11354. t["b*"] = {
  11355. id: _util.OPS.closeEOFillStroke,
  11356. numArgs: 0,
  11357. variableArgs: false
  11358. };
  11359. t.n = {
  11360. id: _util.OPS.endPath,
  11361. numArgs: 0,
  11362. variableArgs: false
  11363. };
  11364. t.W = {
  11365. id: _util.OPS.clip,
  11366. numArgs: 0,
  11367. variableArgs: false
  11368. };
  11369. t["W*"] = {
  11370. id: _util.OPS.eoClip,
  11371. numArgs: 0,
  11372. variableArgs: false
  11373. };
  11374. t.BT = {
  11375. id: _util.OPS.beginText,
  11376. numArgs: 0,
  11377. variableArgs: false
  11378. };
  11379. t.ET = {
  11380. id: _util.OPS.endText,
  11381. numArgs: 0,
  11382. variableArgs: false
  11383. };
  11384. t.Tc = {
  11385. id: _util.OPS.setCharSpacing,
  11386. numArgs: 1,
  11387. variableArgs: false
  11388. };
  11389. t.Tw = {
  11390. id: _util.OPS.setWordSpacing,
  11391. numArgs: 1,
  11392. variableArgs: false
  11393. };
  11394. t.Tz = {
  11395. id: _util.OPS.setHScale,
  11396. numArgs: 1,
  11397. variableArgs: false
  11398. };
  11399. t.TL = {
  11400. id: _util.OPS.setLeading,
  11401. numArgs: 1,
  11402. variableArgs: false
  11403. };
  11404. t.Tf = {
  11405. id: _util.OPS.setFont,
  11406. numArgs: 2,
  11407. variableArgs: false
  11408. };
  11409. t.Tr = {
  11410. id: _util.OPS.setTextRenderingMode,
  11411. numArgs: 1,
  11412. variableArgs: false
  11413. };
  11414. t.Ts = {
  11415. id: _util.OPS.setTextRise,
  11416. numArgs: 1,
  11417. variableArgs: false
  11418. };
  11419. t.Td = {
  11420. id: _util.OPS.moveText,
  11421. numArgs: 2,
  11422. variableArgs: false
  11423. };
  11424. t.TD = {
  11425. id: _util.OPS.setLeadingMoveText,
  11426. numArgs: 2,
  11427. variableArgs: false
  11428. };
  11429. t.Tm = {
  11430. id: _util.OPS.setTextMatrix,
  11431. numArgs: 6,
  11432. variableArgs: false
  11433. };
  11434. t["T*"] = {
  11435. id: _util.OPS.nextLine,
  11436. numArgs: 0,
  11437. variableArgs: false
  11438. };
  11439. t.Tj = {
  11440. id: _util.OPS.showText,
  11441. numArgs: 1,
  11442. variableArgs: false
  11443. };
  11444. t.TJ = {
  11445. id: _util.OPS.showSpacedText,
  11446. numArgs: 1,
  11447. variableArgs: false
  11448. };
  11449. t["'"] = {
  11450. id: _util.OPS.nextLineShowText,
  11451. numArgs: 1,
  11452. variableArgs: false
  11453. };
  11454. t['"'] = {
  11455. id: _util.OPS.nextLineSetSpacingShowText,
  11456. numArgs: 3,
  11457. variableArgs: false
  11458. };
  11459. t.d0 = {
  11460. id: _util.OPS.setCharWidth,
  11461. numArgs: 2,
  11462. variableArgs: false
  11463. };
  11464. t.d1 = {
  11465. id: _util.OPS.setCharWidthAndBounds,
  11466. numArgs: 6,
  11467. variableArgs: false
  11468. };
  11469. t.CS = {
  11470. id: _util.OPS.setStrokeColorSpace,
  11471. numArgs: 1,
  11472. variableArgs: false
  11473. };
  11474. t.cs = {
  11475. id: _util.OPS.setFillColorSpace,
  11476. numArgs: 1,
  11477. variableArgs: false
  11478. };
  11479. t.SC = {
  11480. id: _util.OPS.setStrokeColor,
  11481. numArgs: 4,
  11482. variableArgs: true
  11483. };
  11484. t.SCN = {
  11485. id: _util.OPS.setStrokeColorN,
  11486. numArgs: 33,
  11487. variableArgs: true
  11488. };
  11489. t.sc = {
  11490. id: _util.OPS.setFillColor,
  11491. numArgs: 4,
  11492. variableArgs: true
  11493. };
  11494. t.scn = {
  11495. id: _util.OPS.setFillColorN,
  11496. numArgs: 33,
  11497. variableArgs: true
  11498. };
  11499. t.G = {
  11500. id: _util.OPS.setStrokeGray,
  11501. numArgs: 1,
  11502. variableArgs: false
  11503. };
  11504. t.g = {
  11505. id: _util.OPS.setFillGray,
  11506. numArgs: 1,
  11507. variableArgs: false
  11508. };
  11509. t.RG = {
  11510. id: _util.OPS.setStrokeRGBColor,
  11511. numArgs: 3,
  11512. variableArgs: false
  11513. };
  11514. t.rg = {
  11515. id: _util.OPS.setFillRGBColor,
  11516. numArgs: 3,
  11517. variableArgs: false
  11518. };
  11519. t.K = {
  11520. id: _util.OPS.setStrokeCMYKColor,
  11521. numArgs: 4,
  11522. variableArgs: false
  11523. };
  11524. t.k = {
  11525. id: _util.OPS.setFillCMYKColor,
  11526. numArgs: 4,
  11527. variableArgs: false
  11528. };
  11529. t.sh = {
  11530. id: _util.OPS.shadingFill,
  11531. numArgs: 1,
  11532. variableArgs: false
  11533. };
  11534. t.BI = {
  11535. id: _util.OPS.beginInlineImage,
  11536. numArgs: 0,
  11537. variableArgs: false
  11538. };
  11539. t.ID = {
  11540. id: _util.OPS.beginImageData,
  11541. numArgs: 0,
  11542. variableArgs: false
  11543. };
  11544. t.EI = {
  11545. id: _util.OPS.endInlineImage,
  11546. numArgs: 1,
  11547. variableArgs: false
  11548. };
  11549. t.Do = {
  11550. id: _util.OPS.paintXObject,
  11551. numArgs: 1,
  11552. variableArgs: false
  11553. };
  11554. t.MP = {
  11555. id: _util.OPS.markPoint,
  11556. numArgs: 1,
  11557. variableArgs: false
  11558. };
  11559. t.DP = {
  11560. id: _util.OPS.markPointProps,
  11561. numArgs: 2,
  11562. variableArgs: false
  11563. };
  11564. t.BMC = {
  11565. id: _util.OPS.beginMarkedContent,
  11566. numArgs: 1,
  11567. variableArgs: false
  11568. };
  11569. t.BDC = {
  11570. id: _util.OPS.beginMarkedContentProps,
  11571. numArgs: 2,
  11572. variableArgs: false
  11573. };
  11574. t.EMC = {
  11575. id: _util.OPS.endMarkedContent,
  11576. numArgs: 0,
  11577. variableArgs: false
  11578. };
  11579. t.BX = {
  11580. id: _util.OPS.beginCompat,
  11581. numArgs: 0,
  11582. variableArgs: false
  11583. };
  11584. t.EX = {
  11585. id: _util.OPS.endCompat,
  11586. numArgs: 0,
  11587. variableArgs: false
  11588. };
  11589. t.BM = null;
  11590. t.BD = null;
  11591. t.true = null;
  11592. t.fa = null;
  11593. t.fal = null;
  11594. t.fals = null;
  11595. t.false = null;
  11596. t.nu = null;
  11597. t.nul = null;
  11598. t.null = null;
  11599. });
  11600. return (0, _util.shadow)(this, "opMap", getOPMap());
  11601. }
  11602. static get MAX_INVALID_PATH_OPS() {
  11603. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  11604. }
  11605. constructor(stream, xref, stateManager = new StateManager()) {
  11606. this.parser = new _parser.Parser({
  11607. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  11608. xref
  11609. });
  11610. this.stateManager = stateManager;
  11611. this.nonProcessedArgs = [];
  11612. this._isPathOp = false;
  11613. this._numInvalidPathOPS = 0;
  11614. }
  11615. get savedStatesDepth() {
  11616. return this.stateManager.stateStack.length;
  11617. }
  11618. read(operation) {
  11619. let args = operation.args;
  11620. while (true) {
  11621. const obj = this.parser.getObj();
  11622. if (obj instanceof _primitives.Cmd) {
  11623. const cmd = obj.cmd;
  11624. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  11625. if (!opSpec) {
  11626. (0, _util.warn)(`Unknown command "${cmd}".`);
  11627. continue;
  11628. }
  11629. const fn = opSpec.id;
  11630. const numArgs = opSpec.numArgs;
  11631. let argsLength = args !== null ? args.length : 0;
  11632. if (!this._isPathOp) {
  11633. this._numInvalidPathOPS = 0;
  11634. }
  11635. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  11636. if (!opSpec.variableArgs) {
  11637. if (argsLength !== numArgs) {
  11638. const nonProcessedArgs = this.nonProcessedArgs;
  11639. while (argsLength > numArgs) {
  11640. nonProcessedArgs.push(args.shift());
  11641. argsLength--;
  11642. }
  11643. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  11644. if (args === null) {
  11645. args = [];
  11646. }
  11647. args.unshift(nonProcessedArgs.pop());
  11648. argsLength++;
  11649. }
  11650. }
  11651. if (argsLength < numArgs) {
  11652. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  11653. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  11654. throw new _util.FormatError(`Invalid ${partialMsg}`);
  11655. }
  11656. (0, _util.warn)(`Skipping ${partialMsg}`);
  11657. if (args !== null) {
  11658. args.length = 0;
  11659. }
  11660. continue;
  11661. }
  11662. } else if (argsLength > numArgs) {
  11663. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  11664. }
  11665. this.preprocessCommand(fn, args);
  11666. operation.fn = fn;
  11667. operation.args = args;
  11668. return true;
  11669. }
  11670. if (obj === _primitives.EOF) {
  11671. return false;
  11672. }
  11673. if (obj !== null) {
  11674. if (args === null) {
  11675. args = [];
  11676. }
  11677. args.push(obj);
  11678. if (args.length > 33) {
  11679. throw new _util.FormatError("Too many arguments");
  11680. }
  11681. }
  11682. }
  11683. }
  11684. preprocessCommand(fn, args) {
  11685. switch (fn | 0) {
  11686. case _util.OPS.save:
  11687. this.stateManager.save();
  11688. break;
  11689. case _util.OPS.restore:
  11690. this.stateManager.restore();
  11691. break;
  11692. case _util.OPS.transform:
  11693. this.stateManager.transform(args);
  11694. break;
  11695. }
  11696. }
  11697. }
  11698. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  11699. /***/ }),
  11700. /* 16 */
  11701. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11702. Object.defineProperty(exports, "__esModule", ({
  11703. value: true
  11704. }));
  11705. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  11706. var _util = __w_pdfjs_require__(2);
  11707. var _primitives = __w_pdfjs_require__(5);
  11708. var _base_stream = __w_pdfjs_require__(7);
  11709. var _parser = __w_pdfjs_require__(17);
  11710. var _core_utils = __w_pdfjs_require__(6);
  11711. var _stream = __w_pdfjs_require__(10);
  11712. 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"];
  11713. const MAX_MAP_RANGE = 2 ** 24 - 1;
  11714. class CMap {
  11715. constructor(builtInCMap = false) {
  11716. this.codespaceRanges = [[], [], [], []];
  11717. this.numCodespaceRanges = 0;
  11718. this._map = [];
  11719. this.name = "";
  11720. this.vertical = false;
  11721. this.useCMap = null;
  11722. this.builtInCMap = builtInCMap;
  11723. }
  11724. addCodespaceRange(n, low, high) {
  11725. this.codespaceRanges[n - 1].push(low, high);
  11726. this.numCodespaceRanges++;
  11727. }
  11728. mapCidRange(low, high, dstLow) {
  11729. if (high - low > MAX_MAP_RANGE) {
  11730. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  11731. }
  11732. while (low <= high) {
  11733. this._map[low++] = dstLow++;
  11734. }
  11735. }
  11736. mapBfRange(low, high, dstLow) {
  11737. if (high - low > MAX_MAP_RANGE) {
  11738. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  11739. }
  11740. const lastByte = dstLow.length - 1;
  11741. while (low <= high) {
  11742. this._map[low++] = dstLow;
  11743. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  11744. if (nextCharCode > 0xff) {
  11745. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  11746. continue;
  11747. }
  11748. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  11749. }
  11750. }
  11751. mapBfRangeToArray(low, high, array) {
  11752. if (high - low > MAX_MAP_RANGE) {
  11753. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  11754. }
  11755. const ii = array.length;
  11756. let i = 0;
  11757. while (low <= high && i < ii) {
  11758. this._map[low] = array[i++];
  11759. ++low;
  11760. }
  11761. }
  11762. mapOne(src, dst) {
  11763. this._map[src] = dst;
  11764. }
  11765. lookup(code) {
  11766. return this._map[code];
  11767. }
  11768. contains(code) {
  11769. return this._map[code] !== undefined;
  11770. }
  11771. forEach(callback) {
  11772. const map = this._map;
  11773. const length = map.length;
  11774. if (length <= 0x10000) {
  11775. for (let i = 0; i < length; i++) {
  11776. if (map[i] !== undefined) {
  11777. callback(i, map[i]);
  11778. }
  11779. }
  11780. } else {
  11781. for (const i in map) {
  11782. callback(i, map[i]);
  11783. }
  11784. }
  11785. }
  11786. charCodeOf(value) {
  11787. const map = this._map;
  11788. if (map.length <= 0x10000) {
  11789. return map.indexOf(value);
  11790. }
  11791. for (const charCode in map) {
  11792. if (map[charCode] === value) {
  11793. return charCode | 0;
  11794. }
  11795. }
  11796. return -1;
  11797. }
  11798. getMap() {
  11799. return this._map;
  11800. }
  11801. readCharCode(str, offset, out) {
  11802. let c = 0;
  11803. const codespaceRanges = this.codespaceRanges;
  11804. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  11805. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  11806. const codespaceRange = codespaceRanges[n];
  11807. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  11808. const low = codespaceRange[k++];
  11809. const high = codespaceRange[k++];
  11810. if (c >= low && c <= high) {
  11811. out.charcode = c;
  11812. out.length = n + 1;
  11813. return;
  11814. }
  11815. }
  11816. }
  11817. out.charcode = 0;
  11818. out.length = 1;
  11819. }
  11820. getCharCodeLength(charCode) {
  11821. const codespaceRanges = this.codespaceRanges;
  11822. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  11823. const codespaceRange = codespaceRanges[n];
  11824. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  11825. const low = codespaceRange[k++];
  11826. const high = codespaceRange[k++];
  11827. if (charCode >= low && charCode <= high) {
  11828. return n + 1;
  11829. }
  11830. }
  11831. }
  11832. return 1;
  11833. }
  11834. get length() {
  11835. return this._map.length;
  11836. }
  11837. get isIdentityCMap() {
  11838. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  11839. return false;
  11840. }
  11841. if (this._map.length !== 0x10000) {
  11842. return false;
  11843. }
  11844. for (let i = 0; i < 0x10000; i++) {
  11845. if (this._map[i] !== i) {
  11846. return false;
  11847. }
  11848. }
  11849. return true;
  11850. }
  11851. }
  11852. exports.CMap = CMap;
  11853. class IdentityCMap extends CMap {
  11854. constructor(vertical, n) {
  11855. super();
  11856. this.vertical = vertical;
  11857. this.addCodespaceRange(n, 0, 0xffff);
  11858. }
  11859. mapCidRange(low, high, dstLow) {
  11860. (0, _util.unreachable)("should not call mapCidRange");
  11861. }
  11862. mapBfRange(low, high, dstLow) {
  11863. (0, _util.unreachable)("should not call mapBfRange");
  11864. }
  11865. mapBfRangeToArray(low, high, array) {
  11866. (0, _util.unreachable)("should not call mapBfRangeToArray");
  11867. }
  11868. mapOne(src, dst) {
  11869. (0, _util.unreachable)("should not call mapCidOne");
  11870. }
  11871. lookup(code) {
  11872. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  11873. }
  11874. contains(code) {
  11875. return Number.isInteger(code) && code <= 0xffff;
  11876. }
  11877. forEach(callback) {
  11878. for (let i = 0; i <= 0xffff; i++) {
  11879. callback(i, i);
  11880. }
  11881. }
  11882. charCodeOf(value) {
  11883. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  11884. }
  11885. getMap() {
  11886. const map = new Array(0x10000);
  11887. for (let i = 0; i <= 0xffff; i++) {
  11888. map[i] = i;
  11889. }
  11890. return map;
  11891. }
  11892. get length() {
  11893. return 0x10000;
  11894. }
  11895. get isIdentityCMap() {
  11896. (0, _util.unreachable)("should not access .isIdentityCMap");
  11897. }
  11898. }
  11899. exports.IdentityCMap = IdentityCMap;
  11900. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  11901. function hexToInt(a, size) {
  11902. let n = 0;
  11903. for (let i = 0; i <= size; i++) {
  11904. n = n << 8 | a[i];
  11905. }
  11906. return n >>> 0;
  11907. }
  11908. function hexToStr(a, size) {
  11909. if (size === 1) {
  11910. return String.fromCharCode(a[0], a[1]);
  11911. }
  11912. if (size === 3) {
  11913. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  11914. }
  11915. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  11916. }
  11917. function addHex(a, b, size) {
  11918. let c = 0;
  11919. for (let i = size; i >= 0; i--) {
  11920. c += a[i] + b[i];
  11921. a[i] = c & 255;
  11922. c >>= 8;
  11923. }
  11924. }
  11925. function incHex(a, size) {
  11926. let c = 1;
  11927. for (let i = size; i >= 0 && c > 0; i--) {
  11928. c += a[i];
  11929. a[i] = c & 255;
  11930. c >>= 8;
  11931. }
  11932. }
  11933. const MAX_NUM_SIZE = 16;
  11934. const MAX_ENCODED_NUM_SIZE = 19;
  11935. class BinaryCMapStream {
  11936. constructor(data) {
  11937. this.buffer = data;
  11938. this.pos = 0;
  11939. this.end = data.length;
  11940. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  11941. }
  11942. readByte() {
  11943. if (this.pos >= this.end) {
  11944. return -1;
  11945. }
  11946. return this.buffer[this.pos++];
  11947. }
  11948. readNumber() {
  11949. let n = 0;
  11950. let last;
  11951. do {
  11952. const b = this.readByte();
  11953. if (b < 0) {
  11954. throw new _util.FormatError("unexpected EOF in bcmap");
  11955. }
  11956. last = !(b & 0x80);
  11957. n = n << 7 | b & 0x7f;
  11958. } while (!last);
  11959. return n;
  11960. }
  11961. readSigned() {
  11962. const n = this.readNumber();
  11963. return n & 1 ? ~(n >>> 1) : n >>> 1;
  11964. }
  11965. readHex(num, size) {
  11966. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  11967. this.pos += size + 1;
  11968. }
  11969. readHexNumber(num, size) {
  11970. let last;
  11971. const stack = this.tmpBuf;
  11972. let sp = 0;
  11973. do {
  11974. const b = this.readByte();
  11975. if (b < 0) {
  11976. throw new _util.FormatError("unexpected EOF in bcmap");
  11977. }
  11978. last = !(b & 0x80);
  11979. stack[sp++] = b & 0x7f;
  11980. } while (!last);
  11981. let i = size,
  11982. buffer = 0,
  11983. bufferSize = 0;
  11984. while (i >= 0) {
  11985. while (bufferSize < 8 && stack.length > 0) {
  11986. buffer |= stack[--sp] << bufferSize;
  11987. bufferSize += 7;
  11988. }
  11989. num[i] = buffer & 255;
  11990. i--;
  11991. buffer >>= 8;
  11992. bufferSize -= 8;
  11993. }
  11994. }
  11995. readHexSigned(num, size) {
  11996. this.readHexNumber(num, size);
  11997. const sign = num[size] & 1 ? 255 : 0;
  11998. let c = 0;
  11999. for (let i = 0; i <= size; i++) {
  12000. c = (c & 1) << 8 | num[i];
  12001. num[i] = c >> 1 ^ sign;
  12002. }
  12003. }
  12004. readString() {
  12005. const len = this.readNumber();
  12006. let s = "";
  12007. for (let i = 0; i < len; i++) {
  12008. s += String.fromCharCode(this.readNumber());
  12009. }
  12010. return s;
  12011. }
  12012. }
  12013. class BinaryCMapReader {
  12014. async process(data, cMap, extend) {
  12015. const stream = new BinaryCMapStream(data);
  12016. const header = stream.readByte();
  12017. cMap.vertical = !!(header & 1);
  12018. let useCMap = null;
  12019. const start = new Uint8Array(MAX_NUM_SIZE);
  12020. const end = new Uint8Array(MAX_NUM_SIZE);
  12021. const char = new Uint8Array(MAX_NUM_SIZE);
  12022. const charCode = new Uint8Array(MAX_NUM_SIZE);
  12023. const tmp = new Uint8Array(MAX_NUM_SIZE);
  12024. let code;
  12025. let b;
  12026. while ((b = stream.readByte()) >= 0) {
  12027. const type = b >> 5;
  12028. if (type === 7) {
  12029. switch (b & 0x1f) {
  12030. case 0:
  12031. stream.readString();
  12032. break;
  12033. case 1:
  12034. useCMap = stream.readString();
  12035. break;
  12036. }
  12037. continue;
  12038. }
  12039. const sequence = !!(b & 0x10);
  12040. const dataSize = b & 15;
  12041. if (dataSize + 1 > MAX_NUM_SIZE) {
  12042. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  12043. }
  12044. const ucs2DataSize = 1;
  12045. const subitemsCount = stream.readNumber();
  12046. switch (type) {
  12047. case 0:
  12048. stream.readHex(start, dataSize);
  12049. stream.readHexNumber(end, dataSize);
  12050. addHex(end, start, dataSize);
  12051. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12052. for (let i = 1; i < subitemsCount; i++) {
  12053. incHex(end, dataSize);
  12054. stream.readHexNumber(start, dataSize);
  12055. addHex(start, end, dataSize);
  12056. stream.readHexNumber(end, dataSize);
  12057. addHex(end, start, dataSize);
  12058. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  12059. }
  12060. break;
  12061. case 1:
  12062. stream.readHex(start, dataSize);
  12063. stream.readHexNumber(end, dataSize);
  12064. addHex(end, start, dataSize);
  12065. stream.readNumber();
  12066. for (let i = 1; i < subitemsCount; i++) {
  12067. incHex(end, dataSize);
  12068. stream.readHexNumber(start, dataSize);
  12069. addHex(start, end, dataSize);
  12070. stream.readHexNumber(end, dataSize);
  12071. addHex(end, start, dataSize);
  12072. stream.readNumber();
  12073. }
  12074. break;
  12075. case 2:
  12076. stream.readHex(char, dataSize);
  12077. code = stream.readNumber();
  12078. cMap.mapOne(hexToInt(char, dataSize), code);
  12079. for (let i = 1; i < subitemsCount; i++) {
  12080. incHex(char, dataSize);
  12081. if (!sequence) {
  12082. stream.readHexNumber(tmp, dataSize);
  12083. addHex(char, tmp, dataSize);
  12084. }
  12085. code = stream.readSigned() + (code + 1);
  12086. cMap.mapOne(hexToInt(char, dataSize), code);
  12087. }
  12088. break;
  12089. case 3:
  12090. stream.readHex(start, dataSize);
  12091. stream.readHexNumber(end, dataSize);
  12092. addHex(end, start, dataSize);
  12093. code = stream.readNumber();
  12094. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12095. for (let i = 1; i < subitemsCount; i++) {
  12096. incHex(end, dataSize);
  12097. if (!sequence) {
  12098. stream.readHexNumber(start, dataSize);
  12099. addHex(start, end, dataSize);
  12100. } else {
  12101. start.set(end);
  12102. }
  12103. stream.readHexNumber(end, dataSize);
  12104. addHex(end, start, dataSize);
  12105. code = stream.readNumber();
  12106. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  12107. }
  12108. break;
  12109. case 4:
  12110. stream.readHex(char, ucs2DataSize);
  12111. stream.readHex(charCode, dataSize);
  12112. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12113. for (let i = 1; i < subitemsCount; i++) {
  12114. incHex(char, ucs2DataSize);
  12115. if (!sequence) {
  12116. stream.readHexNumber(tmp, ucs2DataSize);
  12117. addHex(char, tmp, ucs2DataSize);
  12118. }
  12119. incHex(charCode, dataSize);
  12120. stream.readHexSigned(tmp, dataSize);
  12121. addHex(charCode, tmp, dataSize);
  12122. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  12123. }
  12124. break;
  12125. case 5:
  12126. stream.readHex(start, ucs2DataSize);
  12127. stream.readHexNumber(end, ucs2DataSize);
  12128. addHex(end, start, ucs2DataSize);
  12129. stream.readHex(charCode, dataSize);
  12130. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12131. for (let i = 1; i < subitemsCount; i++) {
  12132. incHex(end, ucs2DataSize);
  12133. if (!sequence) {
  12134. stream.readHexNumber(start, ucs2DataSize);
  12135. addHex(start, end, ucs2DataSize);
  12136. } else {
  12137. start.set(end);
  12138. }
  12139. stream.readHexNumber(end, ucs2DataSize);
  12140. addHex(end, start, ucs2DataSize);
  12141. stream.readHex(charCode, dataSize);
  12142. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  12143. }
  12144. break;
  12145. default:
  12146. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  12147. }
  12148. }
  12149. if (useCMap) {
  12150. return extend(useCMap);
  12151. }
  12152. return cMap;
  12153. }
  12154. }
  12155. return BinaryCMapReader;
  12156. }();
  12157. const CMapFactory = function CMapFactoryClosure() {
  12158. function strToInt(str) {
  12159. let a = 0;
  12160. for (let i = 0; i < str.length; i++) {
  12161. a = a << 8 | str.charCodeAt(i);
  12162. }
  12163. return a >>> 0;
  12164. }
  12165. function expectString(obj) {
  12166. if (typeof obj !== "string") {
  12167. throw new _util.FormatError("Malformed CMap: expected string.");
  12168. }
  12169. }
  12170. function expectInt(obj) {
  12171. if (!Number.isInteger(obj)) {
  12172. throw new _util.FormatError("Malformed CMap: expected int.");
  12173. }
  12174. }
  12175. function parseBfChar(cMap, lexer) {
  12176. while (true) {
  12177. let obj = lexer.getObj();
  12178. if (obj === _primitives.EOF) {
  12179. break;
  12180. }
  12181. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  12182. return;
  12183. }
  12184. expectString(obj);
  12185. const src = strToInt(obj);
  12186. obj = lexer.getObj();
  12187. expectString(obj);
  12188. const dst = obj;
  12189. cMap.mapOne(src, dst);
  12190. }
  12191. }
  12192. function parseBfRange(cMap, lexer) {
  12193. while (true) {
  12194. let obj = lexer.getObj();
  12195. if (obj === _primitives.EOF) {
  12196. break;
  12197. }
  12198. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  12199. return;
  12200. }
  12201. expectString(obj);
  12202. const low = strToInt(obj);
  12203. obj = lexer.getObj();
  12204. expectString(obj);
  12205. const high = strToInt(obj);
  12206. obj = lexer.getObj();
  12207. if (Number.isInteger(obj) || typeof obj === "string") {
  12208. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  12209. cMap.mapBfRange(low, high, dstLow);
  12210. } else if ((0, _primitives.isCmd)(obj, "[")) {
  12211. obj = lexer.getObj();
  12212. const array = [];
  12213. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  12214. array.push(obj);
  12215. obj = lexer.getObj();
  12216. }
  12217. cMap.mapBfRangeToArray(low, high, array);
  12218. } else {
  12219. break;
  12220. }
  12221. }
  12222. throw new _util.FormatError("Invalid bf range.");
  12223. }
  12224. function parseCidChar(cMap, lexer) {
  12225. while (true) {
  12226. let obj = lexer.getObj();
  12227. if (obj === _primitives.EOF) {
  12228. break;
  12229. }
  12230. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  12231. return;
  12232. }
  12233. expectString(obj);
  12234. const src = strToInt(obj);
  12235. obj = lexer.getObj();
  12236. expectInt(obj);
  12237. const dst = obj;
  12238. cMap.mapOne(src, dst);
  12239. }
  12240. }
  12241. function parseCidRange(cMap, lexer) {
  12242. while (true) {
  12243. let obj = lexer.getObj();
  12244. if (obj === _primitives.EOF) {
  12245. break;
  12246. }
  12247. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  12248. return;
  12249. }
  12250. expectString(obj);
  12251. const low = strToInt(obj);
  12252. obj = lexer.getObj();
  12253. expectString(obj);
  12254. const high = strToInt(obj);
  12255. obj = lexer.getObj();
  12256. expectInt(obj);
  12257. const dstLow = obj;
  12258. cMap.mapCidRange(low, high, dstLow);
  12259. }
  12260. }
  12261. function parseCodespaceRange(cMap, lexer) {
  12262. while (true) {
  12263. let obj = lexer.getObj();
  12264. if (obj === _primitives.EOF) {
  12265. break;
  12266. }
  12267. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  12268. return;
  12269. }
  12270. if (typeof obj !== "string") {
  12271. break;
  12272. }
  12273. const low = strToInt(obj);
  12274. obj = lexer.getObj();
  12275. if (typeof obj !== "string") {
  12276. break;
  12277. }
  12278. const high = strToInt(obj);
  12279. cMap.addCodespaceRange(obj.length, low, high);
  12280. }
  12281. throw new _util.FormatError("Invalid codespace range.");
  12282. }
  12283. function parseWMode(cMap, lexer) {
  12284. const obj = lexer.getObj();
  12285. if (Number.isInteger(obj)) {
  12286. cMap.vertical = !!obj;
  12287. }
  12288. }
  12289. function parseCMapName(cMap, lexer) {
  12290. const obj = lexer.getObj();
  12291. if (obj instanceof _primitives.Name) {
  12292. cMap.name = obj.name;
  12293. }
  12294. }
  12295. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  12296. let previous, embeddedUseCMap;
  12297. objLoop: while (true) {
  12298. try {
  12299. const obj = lexer.getObj();
  12300. if (obj === _primitives.EOF) {
  12301. break;
  12302. } else if (obj instanceof _primitives.Name) {
  12303. if (obj.name === "WMode") {
  12304. parseWMode(cMap, lexer);
  12305. } else if (obj.name === "CMapName") {
  12306. parseCMapName(cMap, lexer);
  12307. }
  12308. previous = obj;
  12309. } else if (obj instanceof _primitives.Cmd) {
  12310. switch (obj.cmd) {
  12311. case "endcmap":
  12312. break objLoop;
  12313. case "usecmap":
  12314. if (previous instanceof _primitives.Name) {
  12315. embeddedUseCMap = previous.name;
  12316. }
  12317. break;
  12318. case "begincodespacerange":
  12319. parseCodespaceRange(cMap, lexer);
  12320. break;
  12321. case "beginbfchar":
  12322. parseBfChar(cMap, lexer);
  12323. break;
  12324. case "begincidchar":
  12325. parseCidChar(cMap, lexer);
  12326. break;
  12327. case "beginbfrange":
  12328. parseBfRange(cMap, lexer);
  12329. break;
  12330. case "begincidrange":
  12331. parseCidRange(cMap, lexer);
  12332. break;
  12333. }
  12334. }
  12335. } catch (ex) {
  12336. if (ex instanceof _core_utils.MissingDataException) {
  12337. throw ex;
  12338. }
  12339. (0, _util.warn)("Invalid cMap data: " + ex);
  12340. continue;
  12341. }
  12342. }
  12343. if (!useCMap && embeddedUseCMap) {
  12344. useCMap = embeddedUseCMap;
  12345. }
  12346. if (useCMap) {
  12347. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12348. }
  12349. return cMap;
  12350. }
  12351. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  12352. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  12353. if (cMap.numCodespaceRanges === 0) {
  12354. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  12355. for (let i = 0; i < useCodespaceRanges.length; i++) {
  12356. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  12357. }
  12358. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  12359. }
  12360. cMap.useCMap.forEach(function (key, value) {
  12361. if (!cMap.contains(key)) {
  12362. cMap.mapOne(key, cMap.useCMap.lookup(key));
  12363. }
  12364. });
  12365. return cMap;
  12366. }
  12367. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  12368. if (name === "Identity-H") {
  12369. return new IdentityCMap(false, 2);
  12370. } else if (name === "Identity-V") {
  12371. return new IdentityCMap(true, 2);
  12372. }
  12373. if (!BUILT_IN_CMAPS.includes(name)) {
  12374. throw new Error("Unknown CMap name: " + name);
  12375. }
  12376. if (!fetchBuiltInCMap) {
  12377. throw new Error("Built-in CMap parameters are not provided.");
  12378. }
  12379. const {
  12380. cMapData,
  12381. compressionType
  12382. } = await fetchBuiltInCMap(name);
  12383. const cMap = new CMap(true);
  12384. if (compressionType === _util.CMapCompressionType.BINARY) {
  12385. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  12386. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  12387. });
  12388. }
  12389. if (compressionType === _util.CMapCompressionType.NONE) {
  12390. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  12391. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  12392. }
  12393. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  12394. }
  12395. return {
  12396. async create(params) {
  12397. const encoding = params.encoding;
  12398. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  12399. const useCMap = params.useCMap;
  12400. if (encoding instanceof _primitives.Name) {
  12401. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  12402. } else if (encoding instanceof _base_stream.BaseStream) {
  12403. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  12404. if (parsedCMap.isIdentityCMap) {
  12405. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  12406. }
  12407. return parsedCMap;
  12408. }
  12409. throw new Error("Encoding required.");
  12410. }
  12411. };
  12412. }();
  12413. exports.CMapFactory = CMapFactory;
  12414. /***/ }),
  12415. /* 17 */
  12416. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  12417. Object.defineProperty(exports, "__esModule", ({
  12418. value: true
  12419. }));
  12420. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  12421. var _util = __w_pdfjs_require__(2);
  12422. var _primitives = __w_pdfjs_require__(5);
  12423. var _core_utils = __w_pdfjs_require__(6);
  12424. var _ascii_85_stream = __w_pdfjs_require__(18);
  12425. var _ascii_hex_stream = __w_pdfjs_require__(20);
  12426. var _ccitt_stream = __w_pdfjs_require__(21);
  12427. var _flate_stream = __w_pdfjs_require__(23);
  12428. var _jbig2_stream = __w_pdfjs_require__(24);
  12429. var _jpeg_stream = __w_pdfjs_require__(27);
  12430. var _jpx_stream = __w_pdfjs_require__(29);
  12431. var _lzw_stream = __w_pdfjs_require__(31);
  12432. var _stream = __w_pdfjs_require__(10);
  12433. var _predictor_stream = __w_pdfjs_require__(32);
  12434. var _run_length_stream = __w_pdfjs_require__(33);
  12435. const MAX_LENGTH_TO_CACHE = 1000;
  12436. const MAX_ADLER32_LENGTH = 5552;
  12437. function computeAdler32(bytes) {
  12438. const bytesLength = bytes.length;
  12439. let a = 1,
  12440. b = 0;
  12441. for (let i = 0; i < bytesLength; ++i) {
  12442. a += bytes[i] & 0xff;
  12443. b += a;
  12444. }
  12445. return b % 65521 << 16 | a % 65521;
  12446. }
  12447. class Parser {
  12448. constructor({
  12449. lexer,
  12450. xref,
  12451. allowStreams = false,
  12452. recoveryMode = false
  12453. }) {
  12454. this.lexer = lexer;
  12455. this.xref = xref;
  12456. this.allowStreams = allowStreams;
  12457. this.recoveryMode = recoveryMode;
  12458. this.imageCache = Object.create(null);
  12459. this.refill();
  12460. }
  12461. refill() {
  12462. this.buf1 = this.lexer.getObj();
  12463. this.buf2 = this.lexer.getObj();
  12464. }
  12465. shift() {
  12466. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  12467. this.buf1 = this.buf2;
  12468. this.buf2 = null;
  12469. } else {
  12470. this.buf1 = this.buf2;
  12471. this.buf2 = this.lexer.getObj();
  12472. }
  12473. }
  12474. tryShift() {
  12475. try {
  12476. this.shift();
  12477. return true;
  12478. } catch (e) {
  12479. if (e instanceof _core_utils.MissingDataException) {
  12480. throw e;
  12481. }
  12482. return false;
  12483. }
  12484. }
  12485. getObj(cipherTransform = null) {
  12486. const buf1 = this.buf1;
  12487. this.shift();
  12488. if (buf1 instanceof _primitives.Cmd) {
  12489. switch (buf1.cmd) {
  12490. case "BI":
  12491. return this.makeInlineImage(cipherTransform);
  12492. case "[":
  12493. const array = [];
  12494. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  12495. array.push(this.getObj(cipherTransform));
  12496. }
  12497. if (this.buf1 === _primitives.EOF) {
  12498. if (this.recoveryMode) {
  12499. return array;
  12500. }
  12501. throw new _core_utils.ParserEOFException("End of file inside array.");
  12502. }
  12503. this.shift();
  12504. return array;
  12505. case "<<":
  12506. const dict = new _primitives.Dict(this.xref);
  12507. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  12508. if (!(this.buf1 instanceof _primitives.Name)) {
  12509. (0, _util.info)("Malformed dictionary: key must be a name object");
  12510. this.shift();
  12511. continue;
  12512. }
  12513. const key = this.buf1.name;
  12514. this.shift();
  12515. if (this.buf1 === _primitives.EOF) {
  12516. break;
  12517. }
  12518. dict.set(key, this.getObj(cipherTransform));
  12519. }
  12520. if (this.buf1 === _primitives.EOF) {
  12521. if (this.recoveryMode) {
  12522. return dict;
  12523. }
  12524. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  12525. }
  12526. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  12527. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12528. }
  12529. this.shift();
  12530. return dict;
  12531. default:
  12532. return buf1;
  12533. }
  12534. }
  12535. if (Number.isInteger(buf1)) {
  12536. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  12537. const ref = _primitives.Ref.get(buf1, this.buf1);
  12538. this.shift();
  12539. this.shift();
  12540. return ref;
  12541. }
  12542. return buf1;
  12543. }
  12544. if (typeof buf1 === "string") {
  12545. if (cipherTransform) {
  12546. return cipherTransform.decryptString(buf1);
  12547. }
  12548. return buf1;
  12549. }
  12550. return buf1;
  12551. }
  12552. findDefaultInlineStreamEnd(stream) {
  12553. const E = 0x45,
  12554. I = 0x49,
  12555. SPACE = 0x20,
  12556. LF = 0xa,
  12557. CR = 0xd,
  12558. NUL = 0x0;
  12559. const lexer = this.lexer,
  12560. startPos = stream.pos,
  12561. n = 10;
  12562. let state = 0,
  12563. ch,
  12564. maybeEIPos;
  12565. while ((ch = stream.getByte()) !== -1) {
  12566. if (state === 0) {
  12567. state = ch === E ? 1 : 0;
  12568. } else if (state === 1) {
  12569. state = ch === I ? 2 : 0;
  12570. } else {
  12571. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  12572. if (ch === SPACE || ch === LF || ch === CR) {
  12573. maybeEIPos = stream.pos;
  12574. const followingBytes = stream.peekBytes(n);
  12575. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  12576. ch = followingBytes[i];
  12577. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  12578. continue;
  12579. }
  12580. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  12581. state = 0;
  12582. break;
  12583. }
  12584. }
  12585. if (state !== 2) {
  12586. continue;
  12587. }
  12588. if (lexer.knownCommands) {
  12589. const nextObj = lexer.peekObj();
  12590. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  12591. state = 0;
  12592. }
  12593. } else {
  12594. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  12595. }
  12596. if (state === 2) {
  12597. break;
  12598. }
  12599. } else {
  12600. state = 0;
  12601. }
  12602. }
  12603. }
  12604. if (ch === -1) {
  12605. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  12606. if (maybeEIPos) {
  12607. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  12608. stream.skip(-(stream.pos - maybeEIPos));
  12609. }
  12610. }
  12611. let endOffset = 4;
  12612. stream.skip(-endOffset);
  12613. ch = stream.peekByte();
  12614. stream.skip(endOffset);
  12615. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  12616. endOffset--;
  12617. }
  12618. return stream.pos - endOffset - startPos;
  12619. }
  12620. findDCTDecodeInlineStreamEnd(stream) {
  12621. const startPos = stream.pos;
  12622. let foundEOI = false,
  12623. b,
  12624. markerLength;
  12625. while ((b = stream.getByte()) !== -1) {
  12626. if (b !== 0xff) {
  12627. continue;
  12628. }
  12629. switch (stream.getByte()) {
  12630. case 0x00:
  12631. break;
  12632. case 0xff:
  12633. stream.skip(-1);
  12634. break;
  12635. case 0xd9:
  12636. foundEOI = true;
  12637. break;
  12638. case 0xc0:
  12639. case 0xc1:
  12640. case 0xc2:
  12641. case 0xc3:
  12642. case 0xc5:
  12643. case 0xc6:
  12644. case 0xc7:
  12645. case 0xc9:
  12646. case 0xca:
  12647. case 0xcb:
  12648. case 0xcd:
  12649. case 0xce:
  12650. case 0xcf:
  12651. case 0xc4:
  12652. case 0xcc:
  12653. case 0xda:
  12654. case 0xdb:
  12655. case 0xdc:
  12656. case 0xdd:
  12657. case 0xde:
  12658. case 0xdf:
  12659. case 0xe0:
  12660. case 0xe1:
  12661. case 0xe2:
  12662. case 0xe3:
  12663. case 0xe4:
  12664. case 0xe5:
  12665. case 0xe6:
  12666. case 0xe7:
  12667. case 0xe8:
  12668. case 0xe9:
  12669. case 0xea:
  12670. case 0xeb:
  12671. case 0xec:
  12672. case 0xed:
  12673. case 0xee:
  12674. case 0xef:
  12675. case 0xfe:
  12676. markerLength = stream.getUint16();
  12677. if (markerLength > 2) {
  12678. stream.skip(markerLength - 2);
  12679. } else {
  12680. stream.skip(-2);
  12681. }
  12682. break;
  12683. }
  12684. if (foundEOI) {
  12685. break;
  12686. }
  12687. }
  12688. const length = stream.pos - startPos;
  12689. if (b === -1) {
  12690. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  12691. stream.skip(-length);
  12692. return this.findDefaultInlineStreamEnd(stream);
  12693. }
  12694. this.inlineStreamSkipEI(stream);
  12695. return length;
  12696. }
  12697. findASCII85DecodeInlineStreamEnd(stream) {
  12698. const TILDE = 0x7e,
  12699. GT = 0x3e;
  12700. const startPos = stream.pos;
  12701. let ch;
  12702. while ((ch = stream.getByte()) !== -1) {
  12703. if (ch === TILDE) {
  12704. const tildePos = stream.pos;
  12705. ch = stream.peekByte();
  12706. while ((0, _core_utils.isWhiteSpace)(ch)) {
  12707. stream.skip();
  12708. ch = stream.peekByte();
  12709. }
  12710. if (ch === GT) {
  12711. stream.skip();
  12712. break;
  12713. }
  12714. if (stream.pos > tildePos) {
  12715. const maybeEI = stream.peekBytes(2);
  12716. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  12717. break;
  12718. }
  12719. }
  12720. }
  12721. }
  12722. const length = stream.pos - startPos;
  12723. if (ch === -1) {
  12724. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  12725. stream.skip(-length);
  12726. return this.findDefaultInlineStreamEnd(stream);
  12727. }
  12728. this.inlineStreamSkipEI(stream);
  12729. return length;
  12730. }
  12731. findASCIIHexDecodeInlineStreamEnd(stream) {
  12732. const GT = 0x3e;
  12733. const startPos = stream.pos;
  12734. let ch;
  12735. while ((ch = stream.getByte()) !== -1) {
  12736. if (ch === GT) {
  12737. break;
  12738. }
  12739. }
  12740. const length = stream.pos - startPos;
  12741. if (ch === -1) {
  12742. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  12743. stream.skip(-length);
  12744. return this.findDefaultInlineStreamEnd(stream);
  12745. }
  12746. this.inlineStreamSkipEI(stream);
  12747. return length;
  12748. }
  12749. inlineStreamSkipEI(stream) {
  12750. const E = 0x45,
  12751. I = 0x49;
  12752. let state = 0,
  12753. ch;
  12754. while ((ch = stream.getByte()) !== -1) {
  12755. if (state === 0) {
  12756. state = ch === E ? 1 : 0;
  12757. } else if (state === 1) {
  12758. state = ch === I ? 2 : 0;
  12759. } else if (state === 2) {
  12760. break;
  12761. }
  12762. }
  12763. }
  12764. makeInlineImage(cipherTransform) {
  12765. const lexer = this.lexer;
  12766. const stream = lexer.stream;
  12767. const dict = new _primitives.Dict(this.xref);
  12768. let dictLength;
  12769. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  12770. if (!(this.buf1 instanceof _primitives.Name)) {
  12771. throw new _util.FormatError("Dictionary key must be a name object");
  12772. }
  12773. const key = this.buf1.name;
  12774. this.shift();
  12775. if (this.buf1 === _primitives.EOF) {
  12776. break;
  12777. }
  12778. dict.set(key, this.getObj(cipherTransform));
  12779. }
  12780. if (lexer.beginInlineImagePos !== -1) {
  12781. dictLength = stream.pos - lexer.beginInlineImagePos;
  12782. }
  12783. const filter = dict.get("F", "Filter");
  12784. let filterName;
  12785. if (filter instanceof _primitives.Name) {
  12786. filterName = filter.name;
  12787. } else if (Array.isArray(filter)) {
  12788. const filterZero = this.xref.fetchIfRef(filter[0]);
  12789. if (filterZero instanceof _primitives.Name) {
  12790. filterName = filterZero.name;
  12791. }
  12792. }
  12793. const startPos = stream.pos;
  12794. let length;
  12795. switch (filterName) {
  12796. case "DCT":
  12797. case "DCTDecode":
  12798. length = this.findDCTDecodeInlineStreamEnd(stream);
  12799. break;
  12800. case "A85":
  12801. case "ASCII85Decode":
  12802. length = this.findASCII85DecodeInlineStreamEnd(stream);
  12803. break;
  12804. case "AHx":
  12805. case "ASCIIHexDecode":
  12806. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  12807. break;
  12808. default:
  12809. length = this.findDefaultInlineStreamEnd(stream);
  12810. }
  12811. let imageStream = stream.makeSubStream(startPos, length, dict);
  12812. let cacheKey;
  12813. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  12814. const imageBytes = imageStream.getBytes();
  12815. imageStream.reset();
  12816. const initialStreamPos = stream.pos;
  12817. stream.pos = lexer.beginInlineImagePos;
  12818. const dictBytes = stream.getBytes(dictLength);
  12819. stream.pos = initialStreamPos;
  12820. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  12821. const cacheEntry = this.imageCache[cacheKey];
  12822. if (cacheEntry !== undefined) {
  12823. this.buf2 = _primitives.Cmd.get("EI");
  12824. this.shift();
  12825. cacheEntry.reset();
  12826. return cacheEntry;
  12827. }
  12828. }
  12829. if (cipherTransform) {
  12830. imageStream = cipherTransform.createStream(imageStream, length);
  12831. }
  12832. imageStream = this.filter(imageStream, dict, length);
  12833. imageStream.dict = dict;
  12834. if (cacheKey !== undefined) {
  12835. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  12836. this.imageCache[cacheKey] = imageStream;
  12837. }
  12838. this.buf2 = _primitives.Cmd.get("EI");
  12839. this.shift();
  12840. return imageStream;
  12841. }
  12842. _findStreamLength(startPos, signature) {
  12843. const {
  12844. stream
  12845. } = this.lexer;
  12846. stream.pos = startPos;
  12847. const SCAN_BLOCK_LENGTH = 2048;
  12848. const signatureLength = signature.length;
  12849. while (stream.pos < stream.end) {
  12850. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  12851. const scanLength = scanBytes.length - signatureLength;
  12852. if (scanLength <= 0) {
  12853. break;
  12854. }
  12855. let pos = 0;
  12856. while (pos < scanLength) {
  12857. let j = 0;
  12858. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  12859. j++;
  12860. }
  12861. if (j >= signatureLength) {
  12862. stream.pos += pos;
  12863. return stream.pos - startPos;
  12864. }
  12865. pos++;
  12866. }
  12867. stream.pos += scanLength;
  12868. }
  12869. return -1;
  12870. }
  12871. makeStream(dict, cipherTransform) {
  12872. const lexer = this.lexer;
  12873. let stream = lexer.stream;
  12874. lexer.skipToNextLine();
  12875. const startPos = stream.pos - 1;
  12876. let length = dict.get("Length");
  12877. if (!Number.isInteger(length)) {
  12878. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  12879. length = 0;
  12880. }
  12881. stream.pos = startPos + length;
  12882. lexer.nextChar();
  12883. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  12884. this.shift();
  12885. } else {
  12886. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  12887. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  12888. if (actualLength < 0) {
  12889. const MAX_TRUNCATION = 1;
  12890. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  12891. const end = ENDSTREAM_SIGNATURE.length - i;
  12892. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  12893. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  12894. if (maybeLength >= 0) {
  12895. const lastByte = stream.peekBytes(end + 1)[end];
  12896. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  12897. break;
  12898. }
  12899. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  12900. actualLength = maybeLength;
  12901. break;
  12902. }
  12903. }
  12904. if (actualLength < 0) {
  12905. throw new _util.FormatError("Missing endstream command.");
  12906. }
  12907. }
  12908. length = actualLength;
  12909. lexer.nextChar();
  12910. this.shift();
  12911. this.shift();
  12912. }
  12913. this.shift();
  12914. stream = stream.makeSubStream(startPos, length, dict);
  12915. if (cipherTransform) {
  12916. stream = cipherTransform.createStream(stream, length);
  12917. }
  12918. stream = this.filter(stream, dict, length);
  12919. stream.dict = dict;
  12920. return stream;
  12921. }
  12922. filter(stream, dict, length) {
  12923. let filter = dict.get("F", "Filter");
  12924. let params = dict.get("DP", "DecodeParms");
  12925. if (filter instanceof _primitives.Name) {
  12926. if (Array.isArray(params)) {
  12927. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  12928. }
  12929. return this.makeFilter(stream, filter.name, length, params);
  12930. }
  12931. let maybeLength = length;
  12932. if (Array.isArray(filter)) {
  12933. const filterArray = filter;
  12934. const paramsArray = params;
  12935. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  12936. filter = this.xref.fetchIfRef(filterArray[i]);
  12937. if (!(filter instanceof _primitives.Name)) {
  12938. throw new _util.FormatError(`Bad filter name "${filter}"`);
  12939. }
  12940. params = null;
  12941. if (Array.isArray(paramsArray) && i in paramsArray) {
  12942. params = this.xref.fetchIfRef(paramsArray[i]);
  12943. }
  12944. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  12945. maybeLength = null;
  12946. }
  12947. }
  12948. return stream;
  12949. }
  12950. makeFilter(stream, name, maybeLength, params) {
  12951. if (maybeLength === 0) {
  12952. (0, _util.warn)(`Empty "${name}" stream.`);
  12953. return new _stream.NullStream();
  12954. }
  12955. const xrefStats = this.xref.stats;
  12956. try {
  12957. switch (name) {
  12958. case "Fl":
  12959. case "FlateDecode":
  12960. xrefStats.addStreamType(_util.StreamType.FLATE);
  12961. if (params) {
  12962. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  12963. }
  12964. return new _flate_stream.FlateStream(stream, maybeLength);
  12965. case "LZW":
  12966. case "LZWDecode":
  12967. xrefStats.addStreamType(_util.StreamType.LZW);
  12968. let earlyChange = 1;
  12969. if (params) {
  12970. if (params.has("EarlyChange")) {
  12971. earlyChange = params.get("EarlyChange");
  12972. }
  12973. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  12974. }
  12975. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  12976. case "DCT":
  12977. case "DCTDecode":
  12978. xrefStats.addStreamType(_util.StreamType.DCT);
  12979. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  12980. case "JPX":
  12981. case "JPXDecode":
  12982. xrefStats.addStreamType(_util.StreamType.JPX);
  12983. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  12984. case "A85":
  12985. case "ASCII85Decode":
  12986. xrefStats.addStreamType(_util.StreamType.A85);
  12987. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  12988. case "AHx":
  12989. case "ASCIIHexDecode":
  12990. xrefStats.addStreamType(_util.StreamType.AHX);
  12991. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  12992. case "CCF":
  12993. case "CCITTFaxDecode":
  12994. xrefStats.addStreamType(_util.StreamType.CCF);
  12995. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  12996. case "RL":
  12997. case "RunLengthDecode":
  12998. xrefStats.addStreamType(_util.StreamType.RLX);
  12999. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  13000. case "JBIG2Decode":
  13001. xrefStats.addStreamType(_util.StreamType.JBIG);
  13002. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  13003. }
  13004. (0, _util.warn)(`Filter "${name}" is not supported.`);
  13005. return stream;
  13006. } catch (ex) {
  13007. if (ex instanceof _core_utils.MissingDataException) {
  13008. throw ex;
  13009. }
  13010. (0, _util.warn)(`Invalid stream: "${ex}"`);
  13011. return new _stream.NullStream();
  13012. }
  13013. }
  13014. }
  13015. exports.Parser = Parser;
  13016. 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];
  13017. function toHexDigit(ch) {
  13018. if (ch >= 0x30 && ch <= 0x39) {
  13019. return ch & 0x0f;
  13020. }
  13021. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  13022. return (ch & 0x0f) + 9;
  13023. }
  13024. return -1;
  13025. }
  13026. class Lexer {
  13027. constructor(stream, knownCommands = null) {
  13028. this.stream = stream;
  13029. this.nextChar();
  13030. this.strBuf = [];
  13031. this.knownCommands = knownCommands;
  13032. this._hexStringNumWarn = 0;
  13033. this.beginInlineImagePos = -1;
  13034. }
  13035. nextChar() {
  13036. return this.currentChar = this.stream.getByte();
  13037. }
  13038. peekChar() {
  13039. return this.stream.peekByte();
  13040. }
  13041. getNumber() {
  13042. let ch = this.currentChar;
  13043. let eNotation = false;
  13044. let divideBy = 0;
  13045. let sign = 0;
  13046. if (ch === 0x2d) {
  13047. sign = -1;
  13048. ch = this.nextChar();
  13049. if (ch === 0x2d) {
  13050. ch = this.nextChar();
  13051. }
  13052. } else if (ch === 0x2b) {
  13053. sign = 1;
  13054. ch = this.nextChar();
  13055. }
  13056. if (ch === 0x0a || ch === 0x0d) {
  13057. do {
  13058. ch = this.nextChar();
  13059. } while (ch === 0x0a || ch === 0x0d);
  13060. }
  13061. if (ch === 0x2e) {
  13062. divideBy = 10;
  13063. ch = this.nextChar();
  13064. }
  13065. if (ch < 0x30 || ch > 0x39) {
  13066. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  13067. if (divideBy === 10 && sign === 0) {
  13068. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  13069. return 0;
  13070. }
  13071. if (divideBy === 0 && sign === -1) {
  13072. (0, _util.warn)("Lexer.getNumber - treating a single minus sign as zero.");
  13073. return 0;
  13074. }
  13075. }
  13076. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  13077. }
  13078. sign = sign || 1;
  13079. let baseValue = ch - 0x30;
  13080. let powerValue = 0;
  13081. let powerValueSign = 1;
  13082. while ((ch = this.nextChar()) >= 0) {
  13083. if (ch >= 0x30 && ch <= 0x39) {
  13084. const currentDigit = ch - 0x30;
  13085. if (eNotation) {
  13086. powerValue = powerValue * 10 + currentDigit;
  13087. } else {
  13088. if (divideBy !== 0) {
  13089. divideBy *= 10;
  13090. }
  13091. baseValue = baseValue * 10 + currentDigit;
  13092. }
  13093. } else if (ch === 0x2e) {
  13094. if (divideBy === 0) {
  13095. divideBy = 1;
  13096. } else {
  13097. break;
  13098. }
  13099. } else if (ch === 0x2d) {
  13100. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  13101. } else if (ch === 0x45 || ch === 0x65) {
  13102. ch = this.peekChar();
  13103. if (ch === 0x2b || ch === 0x2d) {
  13104. powerValueSign = ch === 0x2d ? -1 : 1;
  13105. this.nextChar();
  13106. } else if (ch < 0x30 || ch > 0x39) {
  13107. break;
  13108. }
  13109. eNotation = true;
  13110. } else {
  13111. break;
  13112. }
  13113. }
  13114. if (divideBy !== 0) {
  13115. baseValue /= divideBy;
  13116. }
  13117. if (eNotation) {
  13118. baseValue *= 10 ** (powerValueSign * powerValue);
  13119. }
  13120. return sign * baseValue;
  13121. }
  13122. getString() {
  13123. let numParen = 1;
  13124. let done = false;
  13125. const strBuf = this.strBuf;
  13126. strBuf.length = 0;
  13127. let ch = this.nextChar();
  13128. while (true) {
  13129. let charBuffered = false;
  13130. switch (ch | 0) {
  13131. case -1:
  13132. (0, _util.warn)("Unterminated string");
  13133. done = true;
  13134. break;
  13135. case 0x28:
  13136. ++numParen;
  13137. strBuf.push("(");
  13138. break;
  13139. case 0x29:
  13140. if (--numParen === 0) {
  13141. this.nextChar();
  13142. done = true;
  13143. } else {
  13144. strBuf.push(")");
  13145. }
  13146. break;
  13147. case 0x5c:
  13148. ch = this.nextChar();
  13149. switch (ch) {
  13150. case -1:
  13151. (0, _util.warn)("Unterminated string");
  13152. done = true;
  13153. break;
  13154. case 0x6e:
  13155. strBuf.push("\n");
  13156. break;
  13157. case 0x72:
  13158. strBuf.push("\r");
  13159. break;
  13160. case 0x74:
  13161. strBuf.push("\t");
  13162. break;
  13163. case 0x62:
  13164. strBuf.push("\b");
  13165. break;
  13166. case 0x66:
  13167. strBuf.push("\f");
  13168. break;
  13169. case 0x5c:
  13170. case 0x28:
  13171. case 0x29:
  13172. strBuf.push(String.fromCharCode(ch));
  13173. break;
  13174. case 0x30:
  13175. case 0x31:
  13176. case 0x32:
  13177. case 0x33:
  13178. case 0x34:
  13179. case 0x35:
  13180. case 0x36:
  13181. case 0x37:
  13182. let x = ch & 0x0f;
  13183. ch = this.nextChar();
  13184. charBuffered = true;
  13185. if (ch >= 0x30 && ch <= 0x37) {
  13186. x = (x << 3) + (ch & 0x0f);
  13187. ch = this.nextChar();
  13188. if (ch >= 0x30 && ch <= 0x37) {
  13189. charBuffered = false;
  13190. x = (x << 3) + (ch & 0x0f);
  13191. }
  13192. }
  13193. strBuf.push(String.fromCharCode(x));
  13194. break;
  13195. case 0x0d:
  13196. if (this.peekChar() === 0x0a) {
  13197. this.nextChar();
  13198. }
  13199. break;
  13200. case 0x0a:
  13201. break;
  13202. default:
  13203. strBuf.push(String.fromCharCode(ch));
  13204. break;
  13205. }
  13206. break;
  13207. default:
  13208. strBuf.push(String.fromCharCode(ch));
  13209. break;
  13210. }
  13211. if (done) {
  13212. break;
  13213. }
  13214. if (!charBuffered) {
  13215. ch = this.nextChar();
  13216. }
  13217. }
  13218. return strBuf.join("");
  13219. }
  13220. getName() {
  13221. let ch, previousCh;
  13222. const strBuf = this.strBuf;
  13223. strBuf.length = 0;
  13224. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13225. if (ch === 0x23) {
  13226. ch = this.nextChar();
  13227. if (specialChars[ch]) {
  13228. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  13229. strBuf.push("#");
  13230. break;
  13231. }
  13232. const x = toHexDigit(ch);
  13233. if (x !== -1) {
  13234. previousCh = ch;
  13235. ch = this.nextChar();
  13236. const x2 = toHexDigit(ch);
  13237. if (x2 === -1) {
  13238. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  13239. strBuf.push("#", String.fromCharCode(previousCh));
  13240. if (specialChars[ch]) {
  13241. break;
  13242. }
  13243. strBuf.push(String.fromCharCode(ch));
  13244. continue;
  13245. }
  13246. strBuf.push(String.fromCharCode(x << 4 | x2));
  13247. } else {
  13248. strBuf.push("#", String.fromCharCode(ch));
  13249. }
  13250. } else {
  13251. strBuf.push(String.fromCharCode(ch));
  13252. }
  13253. }
  13254. if (strBuf.length > 127) {
  13255. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  13256. }
  13257. return _primitives.Name.get(strBuf.join(""));
  13258. }
  13259. _hexStringWarn(ch) {
  13260. const MAX_HEX_STRING_NUM_WARN = 5;
  13261. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  13262. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  13263. return;
  13264. }
  13265. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  13266. return;
  13267. }
  13268. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  13269. }
  13270. getHexString() {
  13271. const strBuf = this.strBuf;
  13272. strBuf.length = 0;
  13273. let ch = this.currentChar;
  13274. let isFirstHex = true;
  13275. let firstDigit, secondDigit;
  13276. this._hexStringNumWarn = 0;
  13277. while (true) {
  13278. if (ch < 0) {
  13279. (0, _util.warn)("Unterminated hex string");
  13280. break;
  13281. } else if (ch === 0x3e) {
  13282. this.nextChar();
  13283. break;
  13284. } else if (specialChars[ch] === 1) {
  13285. ch = this.nextChar();
  13286. continue;
  13287. } else {
  13288. if (isFirstHex) {
  13289. firstDigit = toHexDigit(ch);
  13290. if (firstDigit === -1) {
  13291. this._hexStringWarn(ch);
  13292. ch = this.nextChar();
  13293. continue;
  13294. }
  13295. } else {
  13296. secondDigit = toHexDigit(ch);
  13297. if (secondDigit === -1) {
  13298. this._hexStringWarn(ch);
  13299. ch = this.nextChar();
  13300. continue;
  13301. }
  13302. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  13303. }
  13304. isFirstHex = !isFirstHex;
  13305. ch = this.nextChar();
  13306. }
  13307. }
  13308. return strBuf.join("");
  13309. }
  13310. getObj() {
  13311. let comment = false;
  13312. let ch = this.currentChar;
  13313. while (true) {
  13314. if (ch < 0) {
  13315. return _primitives.EOF;
  13316. }
  13317. if (comment) {
  13318. if (ch === 0x0a || ch === 0x0d) {
  13319. comment = false;
  13320. }
  13321. } else if (ch === 0x25) {
  13322. comment = true;
  13323. } else if (specialChars[ch] !== 1) {
  13324. break;
  13325. }
  13326. ch = this.nextChar();
  13327. }
  13328. switch (ch | 0) {
  13329. case 0x30:
  13330. case 0x31:
  13331. case 0x32:
  13332. case 0x33:
  13333. case 0x34:
  13334. case 0x35:
  13335. case 0x36:
  13336. case 0x37:
  13337. case 0x38:
  13338. case 0x39:
  13339. case 0x2b:
  13340. case 0x2d:
  13341. case 0x2e:
  13342. return this.getNumber();
  13343. case 0x28:
  13344. return this.getString();
  13345. case 0x2f:
  13346. return this.getName();
  13347. case 0x5b:
  13348. this.nextChar();
  13349. return _primitives.Cmd.get("[");
  13350. case 0x5d:
  13351. this.nextChar();
  13352. return _primitives.Cmd.get("]");
  13353. case 0x3c:
  13354. ch = this.nextChar();
  13355. if (ch === 0x3c) {
  13356. this.nextChar();
  13357. return _primitives.Cmd.get("<<");
  13358. }
  13359. return this.getHexString();
  13360. case 0x3e:
  13361. ch = this.nextChar();
  13362. if (ch === 0x3e) {
  13363. this.nextChar();
  13364. return _primitives.Cmd.get(">>");
  13365. }
  13366. return _primitives.Cmd.get(">");
  13367. case 0x7b:
  13368. this.nextChar();
  13369. return _primitives.Cmd.get("{");
  13370. case 0x7d:
  13371. this.nextChar();
  13372. return _primitives.Cmd.get("}");
  13373. case 0x29:
  13374. this.nextChar();
  13375. throw new _util.FormatError(`Illegal character: ${ch}`);
  13376. }
  13377. let str = String.fromCharCode(ch);
  13378. if (ch < 0x20 || ch > 0x7f) {
  13379. const nextCh = this.peekChar();
  13380. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  13381. this.nextChar();
  13382. return _primitives.Cmd.get(str);
  13383. }
  13384. }
  13385. const knownCommands = this.knownCommands;
  13386. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13387. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13388. const possibleCommand = str + String.fromCharCode(ch);
  13389. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13390. break;
  13391. }
  13392. if (str.length === 128) {
  13393. throw new _util.FormatError(`Command token too long: ${str.length}`);
  13394. }
  13395. str = possibleCommand;
  13396. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13397. }
  13398. if (str === "true") {
  13399. return true;
  13400. }
  13401. if (str === "false") {
  13402. return false;
  13403. }
  13404. if (str === "null") {
  13405. return null;
  13406. }
  13407. if (str === "BI") {
  13408. this.beginInlineImagePos = this.stream.pos;
  13409. }
  13410. return _primitives.Cmd.get(str);
  13411. }
  13412. peekObj() {
  13413. const streamPos = this.stream.pos,
  13414. currentChar = this.currentChar,
  13415. beginInlineImagePos = this.beginInlineImagePos;
  13416. let nextObj;
  13417. try {
  13418. nextObj = this.getObj();
  13419. } catch (ex) {
  13420. if (ex instanceof _core_utils.MissingDataException) {
  13421. throw ex;
  13422. }
  13423. (0, _util.warn)(`peekObj: ${ex}`);
  13424. }
  13425. this.stream.pos = streamPos;
  13426. this.currentChar = currentChar;
  13427. this.beginInlineImagePos = beginInlineImagePos;
  13428. return nextObj;
  13429. }
  13430. skipToNextLine() {
  13431. let ch = this.currentChar;
  13432. while (ch >= 0) {
  13433. if (ch === 0x0d) {
  13434. ch = this.nextChar();
  13435. if (ch === 0x0a) {
  13436. this.nextChar();
  13437. }
  13438. break;
  13439. } else if (ch === 0x0a) {
  13440. this.nextChar();
  13441. break;
  13442. }
  13443. ch = this.nextChar();
  13444. }
  13445. }
  13446. }
  13447. exports.Lexer = Lexer;
  13448. class Linearization {
  13449. static create(stream) {
  13450. function getInt(linDict, name, allowZeroValue = false) {
  13451. const obj = linDict.get(name);
  13452. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13453. return obj;
  13454. }
  13455. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  13456. }
  13457. function getHints(linDict) {
  13458. const hints = linDict.get("H");
  13459. let hintsLength;
  13460. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13461. for (let index = 0; index < hintsLength; index++) {
  13462. const hint = hints[index];
  13463. if (!(Number.isInteger(hint) && hint > 0)) {
  13464. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  13465. }
  13466. }
  13467. return hints;
  13468. }
  13469. throw new Error("Hint array in the linearization dictionary is invalid.");
  13470. }
  13471. const parser = new Parser({
  13472. lexer: new Lexer(stream),
  13473. xref: null
  13474. });
  13475. const obj1 = parser.getObj();
  13476. const obj2 = parser.getObj();
  13477. const obj3 = parser.getObj();
  13478. const linDict = parser.getObj();
  13479. let obj, length;
  13480. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  13481. return null;
  13482. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  13483. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  13484. }
  13485. return {
  13486. length,
  13487. hints: getHints(linDict),
  13488. objectNumberFirst: getInt(linDict, "O"),
  13489. endFirst: getInt(linDict, "E"),
  13490. numPages: getInt(linDict, "N"),
  13491. mainXRefEntriesOffset: getInt(linDict, "T"),
  13492. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  13493. };
  13494. }
  13495. }
  13496. exports.Linearization = Linearization;
  13497. /***/ }),
  13498. /* 18 */
  13499. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13500. Object.defineProperty(exports, "__esModule", ({
  13501. value: true
  13502. }));
  13503. exports.Ascii85Stream = void 0;
  13504. var _decode_stream = __w_pdfjs_require__(19);
  13505. var _core_utils = __w_pdfjs_require__(6);
  13506. class Ascii85Stream extends _decode_stream.DecodeStream {
  13507. constructor(str, maybeLength) {
  13508. if (maybeLength) {
  13509. maybeLength *= 0.8;
  13510. }
  13511. super(maybeLength);
  13512. this.str = str;
  13513. this.dict = str.dict;
  13514. this.input = new Uint8Array(5);
  13515. }
  13516. readBlock() {
  13517. const TILDA_CHAR = 0x7e;
  13518. const Z_LOWER_CHAR = 0x7a;
  13519. const EOF = -1;
  13520. const str = this.str;
  13521. let c = str.getByte();
  13522. while ((0, _core_utils.isWhiteSpace)(c)) {
  13523. c = str.getByte();
  13524. }
  13525. if (c === EOF || c === TILDA_CHAR) {
  13526. this.eof = true;
  13527. return;
  13528. }
  13529. const bufferLength = this.bufferLength;
  13530. let buffer, i;
  13531. if (c === Z_LOWER_CHAR) {
  13532. buffer = this.ensureBuffer(bufferLength + 4);
  13533. for (i = 0; i < 4; ++i) {
  13534. buffer[bufferLength + i] = 0;
  13535. }
  13536. this.bufferLength += 4;
  13537. } else {
  13538. const input = this.input;
  13539. input[0] = c;
  13540. for (i = 1; i < 5; ++i) {
  13541. c = str.getByte();
  13542. while ((0, _core_utils.isWhiteSpace)(c)) {
  13543. c = str.getByte();
  13544. }
  13545. input[i] = c;
  13546. if (c === EOF || c === TILDA_CHAR) {
  13547. break;
  13548. }
  13549. }
  13550. buffer = this.ensureBuffer(bufferLength + i - 1);
  13551. this.bufferLength += i - 1;
  13552. if (i < 5) {
  13553. for (; i < 5; ++i) {
  13554. input[i] = 0x21 + 84;
  13555. }
  13556. this.eof = true;
  13557. }
  13558. let t = 0;
  13559. for (i = 0; i < 5; ++i) {
  13560. t = t * 85 + (input[i] - 0x21);
  13561. }
  13562. for (i = 3; i >= 0; --i) {
  13563. buffer[bufferLength + i] = t & 0xff;
  13564. t >>= 8;
  13565. }
  13566. }
  13567. }
  13568. }
  13569. exports.Ascii85Stream = Ascii85Stream;
  13570. /***/ }),
  13571. /* 19 */
  13572. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13573. Object.defineProperty(exports, "__esModule", ({
  13574. value: true
  13575. }));
  13576. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  13577. var _base_stream = __w_pdfjs_require__(7);
  13578. var _stream = __w_pdfjs_require__(10);
  13579. const emptyBuffer = new Uint8Array(0);
  13580. class DecodeStream extends _base_stream.BaseStream {
  13581. constructor(maybeMinBufferLength) {
  13582. super();
  13583. this._rawMinBufferLength = maybeMinBufferLength || 0;
  13584. this.pos = 0;
  13585. this.bufferLength = 0;
  13586. this.eof = false;
  13587. this.buffer = emptyBuffer;
  13588. this.minBufferLength = 512;
  13589. if (maybeMinBufferLength) {
  13590. while (this.minBufferLength < maybeMinBufferLength) {
  13591. this.minBufferLength *= 2;
  13592. }
  13593. }
  13594. }
  13595. get isEmpty() {
  13596. while (!this.eof && this.bufferLength === 0) {
  13597. this.readBlock();
  13598. }
  13599. return this.bufferLength === 0;
  13600. }
  13601. ensureBuffer(requested) {
  13602. const buffer = this.buffer;
  13603. if (requested <= buffer.byteLength) {
  13604. return buffer;
  13605. }
  13606. let size = this.minBufferLength;
  13607. while (size < requested) {
  13608. size *= 2;
  13609. }
  13610. const buffer2 = new Uint8Array(size);
  13611. buffer2.set(buffer);
  13612. return this.buffer = buffer2;
  13613. }
  13614. getByte() {
  13615. const pos = this.pos;
  13616. while (this.bufferLength <= pos) {
  13617. if (this.eof) {
  13618. return -1;
  13619. }
  13620. this.readBlock();
  13621. }
  13622. return this.buffer[this.pos++];
  13623. }
  13624. getBytes(length) {
  13625. const pos = this.pos;
  13626. let end;
  13627. if (length) {
  13628. this.ensureBuffer(pos + length);
  13629. end = pos + length;
  13630. while (!this.eof && this.bufferLength < end) {
  13631. this.readBlock();
  13632. }
  13633. const bufEnd = this.bufferLength;
  13634. if (end > bufEnd) {
  13635. end = bufEnd;
  13636. }
  13637. } else {
  13638. while (!this.eof) {
  13639. this.readBlock();
  13640. }
  13641. end = this.bufferLength;
  13642. }
  13643. this.pos = end;
  13644. return this.buffer.subarray(pos, end);
  13645. }
  13646. reset() {
  13647. this.pos = 0;
  13648. }
  13649. makeSubStream(start, length, dict = null) {
  13650. if (length === undefined) {
  13651. while (!this.eof) {
  13652. this.readBlock();
  13653. }
  13654. } else {
  13655. const end = start + length;
  13656. while (this.bufferLength <= end && !this.eof) {
  13657. this.readBlock();
  13658. }
  13659. }
  13660. return new _stream.Stream(this.buffer, start, length, dict);
  13661. }
  13662. getBaseStreams() {
  13663. return this.str ? this.str.getBaseStreams() : null;
  13664. }
  13665. }
  13666. exports.DecodeStream = DecodeStream;
  13667. class StreamsSequenceStream extends DecodeStream {
  13668. constructor(streams, onError = null) {
  13669. let maybeLength = 0;
  13670. for (const stream of streams) {
  13671. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  13672. }
  13673. super(maybeLength);
  13674. this.streams = streams;
  13675. this._onError = onError;
  13676. }
  13677. readBlock() {
  13678. const streams = this.streams;
  13679. if (streams.length === 0) {
  13680. this.eof = true;
  13681. return;
  13682. }
  13683. const stream = streams.shift();
  13684. let chunk;
  13685. try {
  13686. chunk = stream.getBytes();
  13687. } catch (reason) {
  13688. if (this._onError) {
  13689. this._onError(reason, stream.dict && stream.dict.objId);
  13690. return;
  13691. }
  13692. throw reason;
  13693. }
  13694. const bufferLength = this.bufferLength;
  13695. const newLength = bufferLength + chunk.length;
  13696. const buffer = this.ensureBuffer(newLength);
  13697. buffer.set(chunk, bufferLength);
  13698. this.bufferLength = newLength;
  13699. }
  13700. getBaseStreams() {
  13701. const baseStreamsBuf = [];
  13702. for (const stream of this.streams) {
  13703. const baseStreams = stream.getBaseStreams();
  13704. if (baseStreams) {
  13705. baseStreamsBuf.push(...baseStreams);
  13706. }
  13707. }
  13708. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  13709. }
  13710. }
  13711. exports.StreamsSequenceStream = StreamsSequenceStream;
  13712. /***/ }),
  13713. /* 20 */
  13714. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13715. Object.defineProperty(exports, "__esModule", ({
  13716. value: true
  13717. }));
  13718. exports.AsciiHexStream = void 0;
  13719. var _decode_stream = __w_pdfjs_require__(19);
  13720. class AsciiHexStream extends _decode_stream.DecodeStream {
  13721. constructor(str, maybeLength) {
  13722. if (maybeLength) {
  13723. maybeLength *= 0.5;
  13724. }
  13725. super(maybeLength);
  13726. this.str = str;
  13727. this.dict = str.dict;
  13728. this.firstDigit = -1;
  13729. }
  13730. readBlock() {
  13731. const UPSTREAM_BLOCK_SIZE = 8000;
  13732. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  13733. if (!bytes.length) {
  13734. this.eof = true;
  13735. return;
  13736. }
  13737. const maxDecodeLength = bytes.length + 1 >> 1;
  13738. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  13739. let bufferLength = this.bufferLength;
  13740. let firstDigit = this.firstDigit;
  13741. for (const ch of bytes) {
  13742. let digit;
  13743. if (ch >= 0x30 && ch <= 0x39) {
  13744. digit = ch & 0x0f;
  13745. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  13746. digit = (ch & 0x0f) + 9;
  13747. } else if (ch === 0x3e) {
  13748. this.eof = true;
  13749. break;
  13750. } else {
  13751. continue;
  13752. }
  13753. if (firstDigit < 0) {
  13754. firstDigit = digit;
  13755. } else {
  13756. buffer[bufferLength++] = firstDigit << 4 | digit;
  13757. firstDigit = -1;
  13758. }
  13759. }
  13760. if (firstDigit >= 0 && this.eof) {
  13761. buffer[bufferLength++] = firstDigit << 4;
  13762. firstDigit = -1;
  13763. }
  13764. this.firstDigit = firstDigit;
  13765. this.bufferLength = bufferLength;
  13766. }
  13767. }
  13768. exports.AsciiHexStream = AsciiHexStream;
  13769. /***/ }),
  13770. /* 21 */
  13771. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13772. Object.defineProperty(exports, "__esModule", ({
  13773. value: true
  13774. }));
  13775. exports.CCITTFaxStream = void 0;
  13776. var _ccitt = __w_pdfjs_require__(22);
  13777. var _decode_stream = __w_pdfjs_require__(19);
  13778. var _primitives = __w_pdfjs_require__(5);
  13779. class CCITTFaxStream extends _decode_stream.DecodeStream {
  13780. constructor(str, maybeLength, params) {
  13781. super(maybeLength);
  13782. this.str = str;
  13783. this.dict = str.dict;
  13784. if (!(params instanceof _primitives.Dict)) {
  13785. params = _primitives.Dict.empty;
  13786. }
  13787. const source = {
  13788. next() {
  13789. return str.getByte();
  13790. }
  13791. };
  13792. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  13793. K: params.get("K"),
  13794. EndOfLine: params.get("EndOfLine"),
  13795. EncodedByteAlign: params.get("EncodedByteAlign"),
  13796. Columns: params.get("Columns"),
  13797. Rows: params.get("Rows"),
  13798. EndOfBlock: params.get("EndOfBlock"),
  13799. BlackIs1: params.get("BlackIs1")
  13800. });
  13801. }
  13802. readBlock() {
  13803. while (!this.eof) {
  13804. const c = this.ccittFaxDecoder.readNextChar();
  13805. if (c === -1) {
  13806. this.eof = true;
  13807. return;
  13808. }
  13809. this.ensureBuffer(this.bufferLength + 1);
  13810. this.buffer[this.bufferLength++] = c;
  13811. }
  13812. }
  13813. }
  13814. exports.CCITTFaxStream = CCITTFaxStream;
  13815. /***/ }),
  13816. /* 22 */
  13817. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13818. Object.defineProperty(exports, "__esModule", ({
  13819. value: true
  13820. }));
  13821. exports.CCITTFaxDecoder = void 0;
  13822. var _util = __w_pdfjs_require__(2);
  13823. const ccittEOL = -2;
  13824. const ccittEOF = -1;
  13825. const twoDimPass = 0;
  13826. const twoDimHoriz = 1;
  13827. const twoDimVert0 = 2;
  13828. const twoDimVertR1 = 3;
  13829. const twoDimVertL1 = 4;
  13830. const twoDimVertR2 = 5;
  13831. const twoDimVertL2 = 6;
  13832. const twoDimVertR3 = 7;
  13833. const twoDimVertL3 = 8;
  13834. 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]];
  13835. 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]];
  13836. 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]];
  13837. 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]];
  13838. 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]];
  13839. 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]];
  13840. class CCITTFaxDecoder {
  13841. constructor(source, options = {}) {
  13842. if (!source || typeof source.next !== "function") {
  13843. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  13844. }
  13845. this.source = source;
  13846. this.eof = false;
  13847. this.encoding = options.K || 0;
  13848. this.eoline = options.EndOfLine || false;
  13849. this.byteAlign = options.EncodedByteAlign || false;
  13850. this.columns = options.Columns || 1728;
  13851. this.rows = options.Rows || 0;
  13852. let eoblock = options.EndOfBlock;
  13853. if (eoblock === null || eoblock === undefined) {
  13854. eoblock = true;
  13855. }
  13856. this.eoblock = eoblock;
  13857. this.black = options.BlackIs1 || false;
  13858. this.codingLine = new Uint32Array(this.columns + 1);
  13859. this.refLine = new Uint32Array(this.columns + 2);
  13860. this.codingLine[0] = this.columns;
  13861. this.codingPos = 0;
  13862. this.row = 0;
  13863. this.nextLine2D = this.encoding < 0;
  13864. this.inputBits = 0;
  13865. this.inputBuf = 0;
  13866. this.outputBits = 0;
  13867. this.rowsDone = false;
  13868. let code1;
  13869. while ((code1 = this._lookBits(12)) === 0) {
  13870. this._eatBits(1);
  13871. }
  13872. if (code1 === 1) {
  13873. this._eatBits(12);
  13874. }
  13875. if (this.encoding > 0) {
  13876. this.nextLine2D = !this._lookBits(1);
  13877. this._eatBits(1);
  13878. }
  13879. }
  13880. readNextChar() {
  13881. if (this.eof) {
  13882. return -1;
  13883. }
  13884. const refLine = this.refLine;
  13885. const codingLine = this.codingLine;
  13886. const columns = this.columns;
  13887. let refPos, blackPixels, bits, i;
  13888. if (this.outputBits === 0) {
  13889. if (this.rowsDone) {
  13890. this.eof = true;
  13891. }
  13892. if (this.eof) {
  13893. return -1;
  13894. }
  13895. this.err = false;
  13896. let code1, code2, code3;
  13897. if (this.nextLine2D) {
  13898. for (i = 0; codingLine[i] < columns; ++i) {
  13899. refLine[i] = codingLine[i];
  13900. }
  13901. refLine[i++] = columns;
  13902. refLine[i] = columns;
  13903. codingLine[0] = 0;
  13904. this.codingPos = 0;
  13905. refPos = 0;
  13906. blackPixels = 0;
  13907. while (codingLine[this.codingPos] < columns) {
  13908. code1 = this._getTwoDimCode();
  13909. switch (code1) {
  13910. case twoDimPass:
  13911. this._addPixels(refLine[refPos + 1], blackPixels);
  13912. if (refLine[refPos + 1] < columns) {
  13913. refPos += 2;
  13914. }
  13915. break;
  13916. case twoDimHoriz:
  13917. code1 = code2 = 0;
  13918. if (blackPixels) {
  13919. do {
  13920. code1 += code3 = this._getBlackCode();
  13921. } while (code3 >= 64);
  13922. do {
  13923. code2 += code3 = this._getWhiteCode();
  13924. } while (code3 >= 64);
  13925. } else {
  13926. do {
  13927. code1 += code3 = this._getWhiteCode();
  13928. } while (code3 >= 64);
  13929. do {
  13930. code2 += code3 = this._getBlackCode();
  13931. } while (code3 >= 64);
  13932. }
  13933. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  13934. if (codingLine[this.codingPos] < columns) {
  13935. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  13936. }
  13937. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13938. refPos += 2;
  13939. }
  13940. break;
  13941. case twoDimVertR3:
  13942. this._addPixels(refLine[refPos] + 3, blackPixels);
  13943. blackPixels ^= 1;
  13944. if (codingLine[this.codingPos] < columns) {
  13945. ++refPos;
  13946. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13947. refPos += 2;
  13948. }
  13949. }
  13950. break;
  13951. case twoDimVertR2:
  13952. this._addPixels(refLine[refPos] + 2, blackPixels);
  13953. blackPixels ^= 1;
  13954. if (codingLine[this.codingPos] < columns) {
  13955. ++refPos;
  13956. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13957. refPos += 2;
  13958. }
  13959. }
  13960. break;
  13961. case twoDimVertR1:
  13962. this._addPixels(refLine[refPos] + 1, blackPixels);
  13963. blackPixels ^= 1;
  13964. if (codingLine[this.codingPos] < columns) {
  13965. ++refPos;
  13966. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13967. refPos += 2;
  13968. }
  13969. }
  13970. break;
  13971. case twoDimVert0:
  13972. this._addPixels(refLine[refPos], blackPixels);
  13973. blackPixels ^= 1;
  13974. if (codingLine[this.codingPos] < columns) {
  13975. ++refPos;
  13976. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13977. refPos += 2;
  13978. }
  13979. }
  13980. break;
  13981. case twoDimVertL3:
  13982. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  13983. blackPixels ^= 1;
  13984. if (codingLine[this.codingPos] < columns) {
  13985. if (refPos > 0) {
  13986. --refPos;
  13987. } else {
  13988. ++refPos;
  13989. }
  13990. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  13991. refPos += 2;
  13992. }
  13993. }
  13994. break;
  13995. case twoDimVertL2:
  13996. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  13997. blackPixels ^= 1;
  13998. if (codingLine[this.codingPos] < columns) {
  13999. if (refPos > 0) {
  14000. --refPos;
  14001. } else {
  14002. ++refPos;
  14003. }
  14004. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14005. refPos += 2;
  14006. }
  14007. }
  14008. break;
  14009. case twoDimVertL1:
  14010. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  14011. blackPixels ^= 1;
  14012. if (codingLine[this.codingPos] < columns) {
  14013. if (refPos > 0) {
  14014. --refPos;
  14015. } else {
  14016. ++refPos;
  14017. }
  14018. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  14019. refPos += 2;
  14020. }
  14021. }
  14022. break;
  14023. case ccittEOF:
  14024. this._addPixels(columns, 0);
  14025. this.eof = true;
  14026. break;
  14027. default:
  14028. (0, _util.info)("bad 2d code");
  14029. this._addPixels(columns, 0);
  14030. this.err = true;
  14031. }
  14032. }
  14033. } else {
  14034. codingLine[0] = 0;
  14035. this.codingPos = 0;
  14036. blackPixels = 0;
  14037. while (codingLine[this.codingPos] < columns) {
  14038. code1 = 0;
  14039. if (blackPixels) {
  14040. do {
  14041. code1 += code3 = this._getBlackCode();
  14042. } while (code3 >= 64);
  14043. } else {
  14044. do {
  14045. code1 += code3 = this._getWhiteCode();
  14046. } while (code3 >= 64);
  14047. }
  14048. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  14049. blackPixels ^= 1;
  14050. }
  14051. }
  14052. let gotEOL = false;
  14053. if (this.byteAlign) {
  14054. this.inputBits &= ~7;
  14055. }
  14056. if (!this.eoblock && this.row === this.rows - 1) {
  14057. this.rowsDone = true;
  14058. } else {
  14059. code1 = this._lookBits(12);
  14060. if (this.eoline) {
  14061. while (code1 !== ccittEOF && code1 !== 1) {
  14062. this._eatBits(1);
  14063. code1 = this._lookBits(12);
  14064. }
  14065. } else {
  14066. while (code1 === 0) {
  14067. this._eatBits(1);
  14068. code1 = this._lookBits(12);
  14069. }
  14070. }
  14071. if (code1 === 1) {
  14072. this._eatBits(12);
  14073. gotEOL = true;
  14074. } else if (code1 === ccittEOF) {
  14075. this.eof = true;
  14076. }
  14077. }
  14078. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  14079. this.nextLine2D = !this._lookBits(1);
  14080. this._eatBits(1);
  14081. }
  14082. if (this.eoblock && gotEOL && this.byteAlign) {
  14083. code1 = this._lookBits(12);
  14084. if (code1 === 1) {
  14085. this._eatBits(12);
  14086. if (this.encoding > 0) {
  14087. this._lookBits(1);
  14088. this._eatBits(1);
  14089. }
  14090. if (this.encoding >= 0) {
  14091. for (i = 0; i < 4; ++i) {
  14092. code1 = this._lookBits(12);
  14093. if (code1 !== 1) {
  14094. (0, _util.info)("bad rtc code: " + code1);
  14095. }
  14096. this._eatBits(12);
  14097. if (this.encoding > 0) {
  14098. this._lookBits(1);
  14099. this._eatBits(1);
  14100. }
  14101. }
  14102. }
  14103. this.eof = true;
  14104. }
  14105. } else if (this.err && this.eoline) {
  14106. while (true) {
  14107. code1 = this._lookBits(13);
  14108. if (code1 === ccittEOF) {
  14109. this.eof = true;
  14110. return -1;
  14111. }
  14112. if (code1 >> 1 === 1) {
  14113. break;
  14114. }
  14115. this._eatBits(1);
  14116. }
  14117. this._eatBits(12);
  14118. if (this.encoding > 0) {
  14119. this._eatBits(1);
  14120. this.nextLine2D = !(code1 & 1);
  14121. }
  14122. }
  14123. if (codingLine[0] > 0) {
  14124. this.outputBits = codingLine[this.codingPos = 0];
  14125. } else {
  14126. this.outputBits = codingLine[this.codingPos = 1];
  14127. }
  14128. this.row++;
  14129. }
  14130. let c;
  14131. if (this.outputBits >= 8) {
  14132. c = this.codingPos & 1 ? 0 : 0xff;
  14133. this.outputBits -= 8;
  14134. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  14135. this.codingPos++;
  14136. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14137. }
  14138. } else {
  14139. bits = 8;
  14140. c = 0;
  14141. do {
  14142. if (typeof this.outputBits !== "number") {
  14143. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  14144. }
  14145. if (this.outputBits > bits) {
  14146. c <<= bits;
  14147. if (!(this.codingPos & 1)) {
  14148. c |= 0xff >> 8 - bits;
  14149. }
  14150. this.outputBits -= bits;
  14151. bits = 0;
  14152. } else {
  14153. c <<= this.outputBits;
  14154. if (!(this.codingPos & 1)) {
  14155. c |= 0xff >> 8 - this.outputBits;
  14156. }
  14157. bits -= this.outputBits;
  14158. this.outputBits = 0;
  14159. if (codingLine[this.codingPos] < columns) {
  14160. this.codingPos++;
  14161. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  14162. } else if (bits > 0) {
  14163. c <<= bits;
  14164. bits = 0;
  14165. }
  14166. }
  14167. } while (bits);
  14168. }
  14169. if (this.black) {
  14170. c ^= 0xff;
  14171. }
  14172. return c;
  14173. }
  14174. _addPixels(a1, blackPixels) {
  14175. const codingLine = this.codingLine;
  14176. let codingPos = this.codingPos;
  14177. if (a1 > codingLine[codingPos]) {
  14178. if (a1 > this.columns) {
  14179. (0, _util.info)("row is wrong length");
  14180. this.err = true;
  14181. a1 = this.columns;
  14182. }
  14183. if (codingPos & 1 ^ blackPixels) {
  14184. ++codingPos;
  14185. }
  14186. codingLine[codingPos] = a1;
  14187. }
  14188. this.codingPos = codingPos;
  14189. }
  14190. _addPixelsNeg(a1, blackPixels) {
  14191. const codingLine = this.codingLine;
  14192. let codingPos = this.codingPos;
  14193. if (a1 > codingLine[codingPos]) {
  14194. if (a1 > this.columns) {
  14195. (0, _util.info)("row is wrong length");
  14196. this.err = true;
  14197. a1 = this.columns;
  14198. }
  14199. if (codingPos & 1 ^ blackPixels) {
  14200. ++codingPos;
  14201. }
  14202. codingLine[codingPos] = a1;
  14203. } else if (a1 < codingLine[codingPos]) {
  14204. if (a1 < 0) {
  14205. (0, _util.info)("invalid code");
  14206. this.err = true;
  14207. a1 = 0;
  14208. }
  14209. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  14210. --codingPos;
  14211. }
  14212. codingLine[codingPos] = a1;
  14213. }
  14214. this.codingPos = codingPos;
  14215. }
  14216. _findTableCode(start, end, table, limit) {
  14217. const limitValue = limit || 0;
  14218. for (let i = start; i <= end; ++i) {
  14219. let code = this._lookBits(i);
  14220. if (code === ccittEOF) {
  14221. return [true, 1, false];
  14222. }
  14223. if (i < end) {
  14224. code <<= end - i;
  14225. }
  14226. if (!limitValue || code >= limitValue) {
  14227. const p = table[code - limitValue];
  14228. if (p[0] === i) {
  14229. this._eatBits(i);
  14230. return [true, p[1], true];
  14231. }
  14232. }
  14233. }
  14234. return [false, 0, false];
  14235. }
  14236. _getTwoDimCode() {
  14237. let code = 0;
  14238. let p;
  14239. if (this.eoblock) {
  14240. code = this._lookBits(7);
  14241. p = twoDimTable[code];
  14242. if (p && p[0] > 0) {
  14243. this._eatBits(p[0]);
  14244. return p[1];
  14245. }
  14246. } else {
  14247. const result = this._findTableCode(1, 7, twoDimTable);
  14248. if (result[0] && result[2]) {
  14249. return result[1];
  14250. }
  14251. }
  14252. (0, _util.info)("Bad two dim code");
  14253. return ccittEOF;
  14254. }
  14255. _getWhiteCode() {
  14256. let code = 0;
  14257. let p;
  14258. if (this.eoblock) {
  14259. code = this._lookBits(12);
  14260. if (code === ccittEOF) {
  14261. return 1;
  14262. }
  14263. if (code >> 5 === 0) {
  14264. p = whiteTable1[code];
  14265. } else {
  14266. p = whiteTable2[code >> 3];
  14267. }
  14268. if (p[0] > 0) {
  14269. this._eatBits(p[0]);
  14270. return p[1];
  14271. }
  14272. } else {
  14273. let result = this._findTableCode(1, 9, whiteTable2);
  14274. if (result[0]) {
  14275. return result[1];
  14276. }
  14277. result = this._findTableCode(11, 12, whiteTable1);
  14278. if (result[0]) {
  14279. return result[1];
  14280. }
  14281. }
  14282. (0, _util.info)("bad white code");
  14283. this._eatBits(1);
  14284. return 1;
  14285. }
  14286. _getBlackCode() {
  14287. let code, p;
  14288. if (this.eoblock) {
  14289. code = this._lookBits(13);
  14290. if (code === ccittEOF) {
  14291. return 1;
  14292. }
  14293. if (code >> 7 === 0) {
  14294. p = blackTable1[code];
  14295. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  14296. p = blackTable2[(code >> 1) - 64];
  14297. } else {
  14298. p = blackTable3[code >> 7];
  14299. }
  14300. if (p[0] > 0) {
  14301. this._eatBits(p[0]);
  14302. return p[1];
  14303. }
  14304. } else {
  14305. let result = this._findTableCode(2, 6, blackTable3);
  14306. if (result[0]) {
  14307. return result[1];
  14308. }
  14309. result = this._findTableCode(7, 12, blackTable2, 64);
  14310. if (result[0]) {
  14311. return result[1];
  14312. }
  14313. result = this._findTableCode(10, 13, blackTable1);
  14314. if (result[0]) {
  14315. return result[1];
  14316. }
  14317. }
  14318. (0, _util.info)("bad black code");
  14319. this._eatBits(1);
  14320. return 1;
  14321. }
  14322. _lookBits(n) {
  14323. let c;
  14324. while (this.inputBits < n) {
  14325. if ((c = this.source.next()) === -1) {
  14326. if (this.inputBits === 0) {
  14327. return ccittEOF;
  14328. }
  14329. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  14330. }
  14331. this.inputBuf = this.inputBuf << 8 | c;
  14332. this.inputBits += 8;
  14333. }
  14334. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  14335. }
  14336. _eatBits(n) {
  14337. if ((this.inputBits -= n) < 0) {
  14338. this.inputBits = 0;
  14339. }
  14340. }
  14341. }
  14342. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  14343. /***/ }),
  14344. /* 23 */
  14345. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14346. Object.defineProperty(exports, "__esModule", ({
  14347. value: true
  14348. }));
  14349. exports.FlateStream = void 0;
  14350. var _decode_stream = __w_pdfjs_require__(19);
  14351. var _util = __w_pdfjs_require__(2);
  14352. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  14353. 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]);
  14354. 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]);
  14355. 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];
  14356. 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];
  14357. class FlateStream extends _decode_stream.DecodeStream {
  14358. constructor(str, maybeLength) {
  14359. super(maybeLength);
  14360. this.str = str;
  14361. this.dict = str.dict;
  14362. const cmf = str.getByte();
  14363. const flg = str.getByte();
  14364. if (cmf === -1 || flg === -1) {
  14365. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  14366. }
  14367. if ((cmf & 0x0f) !== 0x08) {
  14368. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  14369. }
  14370. if (((cmf << 8) + flg) % 31 !== 0) {
  14371. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  14372. }
  14373. if (flg & 0x20) {
  14374. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  14375. }
  14376. this.codeSize = 0;
  14377. this.codeBuf = 0;
  14378. }
  14379. getBits(bits) {
  14380. const str = this.str;
  14381. let codeSize = this.codeSize;
  14382. let codeBuf = this.codeBuf;
  14383. let b;
  14384. while (codeSize < bits) {
  14385. if ((b = str.getByte()) === -1) {
  14386. throw new _util.FormatError("Bad encoding in flate stream");
  14387. }
  14388. codeBuf |= b << codeSize;
  14389. codeSize += 8;
  14390. }
  14391. b = codeBuf & (1 << bits) - 1;
  14392. this.codeBuf = codeBuf >> bits;
  14393. this.codeSize = codeSize -= bits;
  14394. return b;
  14395. }
  14396. getCode(table) {
  14397. const str = this.str;
  14398. const codes = table[0];
  14399. const maxLen = table[1];
  14400. let codeSize = this.codeSize;
  14401. let codeBuf = this.codeBuf;
  14402. let b;
  14403. while (codeSize < maxLen) {
  14404. if ((b = str.getByte()) === -1) {
  14405. break;
  14406. }
  14407. codeBuf |= b << codeSize;
  14408. codeSize += 8;
  14409. }
  14410. const code = codes[codeBuf & (1 << maxLen) - 1];
  14411. const codeLen = code >> 16;
  14412. const codeVal = code & 0xffff;
  14413. if (codeLen < 1 || codeSize < codeLen) {
  14414. throw new _util.FormatError("Bad encoding in flate stream");
  14415. }
  14416. this.codeBuf = codeBuf >> codeLen;
  14417. this.codeSize = codeSize - codeLen;
  14418. return codeVal;
  14419. }
  14420. generateHuffmanTable(lengths) {
  14421. const n = lengths.length;
  14422. let maxLen = 0;
  14423. let i;
  14424. for (i = 0; i < n; ++i) {
  14425. if (lengths[i] > maxLen) {
  14426. maxLen = lengths[i];
  14427. }
  14428. }
  14429. const size = 1 << maxLen;
  14430. const codes = new Int32Array(size);
  14431. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  14432. for (let val = 0; val < n; ++val) {
  14433. if (lengths[val] === len) {
  14434. let code2 = 0;
  14435. let t = code;
  14436. for (i = 0; i < len; ++i) {
  14437. code2 = code2 << 1 | t & 1;
  14438. t >>= 1;
  14439. }
  14440. for (i = code2; i < size; i += skip) {
  14441. codes[i] = len << 16 | val;
  14442. }
  14443. ++code;
  14444. }
  14445. }
  14446. }
  14447. return [codes, maxLen];
  14448. }
  14449. readBlock() {
  14450. let buffer, len;
  14451. const str = this.str;
  14452. let hdr = this.getBits(3);
  14453. if (hdr & 1) {
  14454. this.eof = true;
  14455. }
  14456. hdr >>= 1;
  14457. if (hdr === 0) {
  14458. let b;
  14459. if ((b = str.getByte()) === -1) {
  14460. throw new _util.FormatError("Bad block header in flate stream");
  14461. }
  14462. let blockLen = b;
  14463. if ((b = str.getByte()) === -1) {
  14464. throw new _util.FormatError("Bad block header in flate stream");
  14465. }
  14466. blockLen |= b << 8;
  14467. if ((b = str.getByte()) === -1) {
  14468. throw new _util.FormatError("Bad block header in flate stream");
  14469. }
  14470. let check = b;
  14471. if ((b = str.getByte()) === -1) {
  14472. throw new _util.FormatError("Bad block header in flate stream");
  14473. }
  14474. check |= b << 8;
  14475. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  14476. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  14477. }
  14478. this.codeBuf = 0;
  14479. this.codeSize = 0;
  14480. const bufferLength = this.bufferLength,
  14481. end = bufferLength + blockLen;
  14482. buffer = this.ensureBuffer(end);
  14483. this.bufferLength = end;
  14484. if (blockLen === 0) {
  14485. if (str.peekByte() === -1) {
  14486. this.eof = true;
  14487. }
  14488. } else {
  14489. const block = str.getBytes(blockLen);
  14490. buffer.set(block, bufferLength);
  14491. if (block.length < blockLen) {
  14492. this.eof = true;
  14493. }
  14494. }
  14495. return;
  14496. }
  14497. let litCodeTable;
  14498. let distCodeTable;
  14499. if (hdr === 1) {
  14500. litCodeTable = fixedLitCodeTab;
  14501. distCodeTable = fixedDistCodeTab;
  14502. } else if (hdr === 2) {
  14503. const numLitCodes = this.getBits(5) + 257;
  14504. const numDistCodes = this.getBits(5) + 1;
  14505. const numCodeLenCodes = this.getBits(4) + 4;
  14506. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  14507. let i;
  14508. for (i = 0; i < numCodeLenCodes; ++i) {
  14509. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  14510. }
  14511. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  14512. len = 0;
  14513. i = 0;
  14514. const codes = numLitCodes + numDistCodes;
  14515. const codeLengths = new Uint8Array(codes);
  14516. let bitsLength, bitsOffset, what;
  14517. while (i < codes) {
  14518. const code = this.getCode(codeLenCodeTab);
  14519. if (code === 16) {
  14520. bitsLength = 2;
  14521. bitsOffset = 3;
  14522. what = len;
  14523. } else if (code === 17) {
  14524. bitsLength = 3;
  14525. bitsOffset = 3;
  14526. what = len = 0;
  14527. } else if (code === 18) {
  14528. bitsLength = 7;
  14529. bitsOffset = 11;
  14530. what = len = 0;
  14531. } else {
  14532. codeLengths[i++] = len = code;
  14533. continue;
  14534. }
  14535. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  14536. while (repeatLength-- > 0) {
  14537. codeLengths[i++] = what;
  14538. }
  14539. }
  14540. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  14541. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  14542. } else {
  14543. throw new _util.FormatError("Unknown block type in flate stream");
  14544. }
  14545. buffer = this.buffer;
  14546. let limit = buffer ? buffer.length : 0;
  14547. let pos = this.bufferLength;
  14548. while (true) {
  14549. let code1 = this.getCode(litCodeTable);
  14550. if (code1 < 256) {
  14551. if (pos + 1 >= limit) {
  14552. buffer = this.ensureBuffer(pos + 1);
  14553. limit = buffer.length;
  14554. }
  14555. buffer[pos++] = code1;
  14556. continue;
  14557. }
  14558. if (code1 === 256) {
  14559. this.bufferLength = pos;
  14560. return;
  14561. }
  14562. code1 -= 257;
  14563. code1 = lengthDecode[code1];
  14564. let code2 = code1 >> 16;
  14565. if (code2 > 0) {
  14566. code2 = this.getBits(code2);
  14567. }
  14568. len = (code1 & 0xffff) + code2;
  14569. code1 = this.getCode(distCodeTable);
  14570. code1 = distDecode[code1];
  14571. code2 = code1 >> 16;
  14572. if (code2 > 0) {
  14573. code2 = this.getBits(code2);
  14574. }
  14575. const dist = (code1 & 0xffff) + code2;
  14576. if (pos + len >= limit) {
  14577. buffer = this.ensureBuffer(pos + len);
  14578. limit = buffer.length;
  14579. }
  14580. for (let k = 0; k < len; ++k, ++pos) {
  14581. buffer[pos] = buffer[pos - dist];
  14582. }
  14583. }
  14584. }
  14585. }
  14586. exports.FlateStream = FlateStream;
  14587. /***/ }),
  14588. /* 24 */
  14589. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14590. Object.defineProperty(exports, "__esModule", ({
  14591. value: true
  14592. }));
  14593. exports.Jbig2Stream = void 0;
  14594. var _base_stream = __w_pdfjs_require__(7);
  14595. var _decode_stream = __w_pdfjs_require__(19);
  14596. var _primitives = __w_pdfjs_require__(5);
  14597. var _jbig = __w_pdfjs_require__(25);
  14598. var _util = __w_pdfjs_require__(2);
  14599. class Jbig2Stream extends _decode_stream.DecodeStream {
  14600. constructor(stream, maybeLength, params) {
  14601. super(maybeLength);
  14602. this.stream = stream;
  14603. this.dict = stream.dict;
  14604. this.maybeLength = maybeLength;
  14605. this.params = params;
  14606. }
  14607. get bytes() {
  14608. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  14609. }
  14610. ensureBuffer(requested) {}
  14611. readBlock() {
  14612. if (this.eof) {
  14613. return;
  14614. }
  14615. const jbig2Image = new _jbig.Jbig2Image();
  14616. const chunks = [];
  14617. if (this.params instanceof _primitives.Dict) {
  14618. const globalsStream = this.params.get("JBIG2Globals");
  14619. if (globalsStream instanceof _base_stream.BaseStream) {
  14620. const globals = globalsStream.getBytes();
  14621. chunks.push({
  14622. data: globals,
  14623. start: 0,
  14624. end: globals.length
  14625. });
  14626. }
  14627. }
  14628. chunks.push({
  14629. data: this.bytes,
  14630. start: 0,
  14631. end: this.bytes.length
  14632. });
  14633. const data = jbig2Image.parseChunks(chunks);
  14634. const dataLength = data.length;
  14635. for (let i = 0; i < dataLength; i++) {
  14636. data[i] ^= 0xff;
  14637. }
  14638. this.buffer = data;
  14639. this.bufferLength = dataLength;
  14640. this.eof = true;
  14641. }
  14642. }
  14643. exports.Jbig2Stream = Jbig2Stream;
  14644. /***/ }),
  14645. /* 25 */
  14646. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14647. Object.defineProperty(exports, "__esModule", ({
  14648. value: true
  14649. }));
  14650. exports.Jbig2Image = void 0;
  14651. var _util = __w_pdfjs_require__(2);
  14652. var _core_utils = __w_pdfjs_require__(6);
  14653. var _arithmetic_decoder = __w_pdfjs_require__(26);
  14654. var _ccitt = __w_pdfjs_require__(22);
  14655. class Jbig2Error extends _util.BaseException {
  14656. constructor(msg) {
  14657. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  14658. }
  14659. }
  14660. class ContextCache {
  14661. getContexts(id) {
  14662. if (id in this) {
  14663. return this[id];
  14664. }
  14665. return this[id] = new Int8Array(1 << 16);
  14666. }
  14667. }
  14668. class DecodingContext {
  14669. constructor(data, start, end) {
  14670. this.data = data;
  14671. this.start = start;
  14672. this.end = end;
  14673. }
  14674. get decoder() {
  14675. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  14676. return (0, _util.shadow)(this, "decoder", decoder);
  14677. }
  14678. get contextCache() {
  14679. const cache = new ContextCache();
  14680. return (0, _util.shadow)(this, "contextCache", cache);
  14681. }
  14682. }
  14683. function decodeInteger(contextCache, procedure, decoder) {
  14684. const contexts = contextCache.getContexts(procedure);
  14685. let prev = 1;
  14686. function readBits(length) {
  14687. let v = 0;
  14688. for (let i = 0; i < length; i++) {
  14689. const bit = decoder.readBit(contexts, prev);
  14690. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  14691. v = v << 1 | bit;
  14692. }
  14693. return v >>> 0;
  14694. }
  14695. const sign = readBits(1);
  14696. 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);
  14697. if (sign === 0) {
  14698. return value;
  14699. } else if (value > 0) {
  14700. return -value;
  14701. }
  14702. return null;
  14703. }
  14704. function decodeIAID(contextCache, decoder, codeLength) {
  14705. const contexts = contextCache.getContexts("IAID");
  14706. let prev = 1;
  14707. for (let i = 0; i < codeLength; i++) {
  14708. const bit = decoder.readBit(contexts, prev);
  14709. prev = prev << 1 | bit;
  14710. }
  14711. if (codeLength < 31) {
  14712. return prev & (1 << codeLength) - 1;
  14713. }
  14714. return prev & 0x7fffffff;
  14715. }
  14716. 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"];
  14717. const CodingTemplates = [[{
  14718. x: -1,
  14719. y: -2
  14720. }, {
  14721. x: 0,
  14722. y: -2
  14723. }, {
  14724. x: 1,
  14725. y: -2
  14726. }, {
  14727. x: -2,
  14728. y: -1
  14729. }, {
  14730. x: -1,
  14731. y: -1
  14732. }, {
  14733. x: 0,
  14734. y: -1
  14735. }, {
  14736. x: 1,
  14737. y: -1
  14738. }, {
  14739. x: 2,
  14740. y: -1
  14741. }, {
  14742. x: -4,
  14743. y: 0
  14744. }, {
  14745. x: -3,
  14746. y: 0
  14747. }, {
  14748. x: -2,
  14749. y: 0
  14750. }, {
  14751. x: -1,
  14752. y: 0
  14753. }], [{
  14754. x: -1,
  14755. y: -2
  14756. }, {
  14757. x: 0,
  14758. y: -2
  14759. }, {
  14760. x: 1,
  14761. y: -2
  14762. }, {
  14763. x: 2,
  14764. y: -2
  14765. }, {
  14766. x: -2,
  14767. y: -1
  14768. }, {
  14769. x: -1,
  14770. y: -1
  14771. }, {
  14772. x: 0,
  14773. y: -1
  14774. }, {
  14775. x: 1,
  14776. y: -1
  14777. }, {
  14778. x: 2,
  14779. y: -1
  14780. }, {
  14781. x: -3,
  14782. y: 0
  14783. }, {
  14784. x: -2,
  14785. y: 0
  14786. }, {
  14787. x: -1,
  14788. y: 0
  14789. }], [{
  14790. x: -1,
  14791. y: -2
  14792. }, {
  14793. x: 0,
  14794. y: -2
  14795. }, {
  14796. x: 1,
  14797. y: -2
  14798. }, {
  14799. x: -2,
  14800. y: -1
  14801. }, {
  14802. x: -1,
  14803. y: -1
  14804. }, {
  14805. x: 0,
  14806. y: -1
  14807. }, {
  14808. x: 1,
  14809. y: -1
  14810. }, {
  14811. x: -2,
  14812. y: 0
  14813. }, {
  14814. x: -1,
  14815. y: 0
  14816. }], [{
  14817. x: -3,
  14818. y: -1
  14819. }, {
  14820. x: -2,
  14821. y: -1
  14822. }, {
  14823. x: -1,
  14824. y: -1
  14825. }, {
  14826. x: 0,
  14827. y: -1
  14828. }, {
  14829. x: 1,
  14830. y: -1
  14831. }, {
  14832. x: -4,
  14833. y: 0
  14834. }, {
  14835. x: -3,
  14836. y: 0
  14837. }, {
  14838. x: -2,
  14839. y: 0
  14840. }, {
  14841. x: -1,
  14842. y: 0
  14843. }]];
  14844. const RefinementTemplates = [{
  14845. coding: [{
  14846. x: 0,
  14847. y: -1
  14848. }, {
  14849. x: 1,
  14850. y: -1
  14851. }, {
  14852. x: -1,
  14853. y: 0
  14854. }],
  14855. reference: [{
  14856. x: 0,
  14857. y: -1
  14858. }, {
  14859. x: 1,
  14860. y: -1
  14861. }, {
  14862. x: -1,
  14863. y: 0
  14864. }, {
  14865. x: 0,
  14866. y: 0
  14867. }, {
  14868. x: 1,
  14869. y: 0
  14870. }, {
  14871. x: -1,
  14872. y: 1
  14873. }, {
  14874. x: 0,
  14875. y: 1
  14876. }, {
  14877. x: 1,
  14878. y: 1
  14879. }]
  14880. }, {
  14881. coding: [{
  14882. x: -1,
  14883. y: -1
  14884. }, {
  14885. x: 0,
  14886. y: -1
  14887. }, {
  14888. x: 1,
  14889. y: -1
  14890. }, {
  14891. x: -1,
  14892. y: 0
  14893. }],
  14894. reference: [{
  14895. x: 0,
  14896. y: -1
  14897. }, {
  14898. x: -1,
  14899. y: 0
  14900. }, {
  14901. x: 0,
  14902. y: 0
  14903. }, {
  14904. x: 1,
  14905. y: 0
  14906. }, {
  14907. x: 0,
  14908. y: 1
  14909. }, {
  14910. x: 1,
  14911. y: 1
  14912. }]
  14913. }];
  14914. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  14915. const RefinementReusedContexts = [0x0020, 0x0008];
  14916. function decodeBitmapTemplate0(width, height, decodingContext) {
  14917. const decoder = decodingContext.decoder;
  14918. const contexts = decodingContext.contextCache.getContexts("GB");
  14919. const bitmap = [];
  14920. let contextLabel, i, j, pixel, row, row1, row2;
  14921. const OLD_PIXEL_MASK = 0x7bf7;
  14922. for (i = 0; i < height; i++) {
  14923. row = bitmap[i] = new Uint8Array(width);
  14924. row1 = i < 1 ? row : bitmap[i - 1];
  14925. row2 = i < 2 ? row : bitmap[i - 2];
  14926. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  14927. for (j = 0; j < width; j++) {
  14928. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  14929. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  14930. }
  14931. }
  14932. return bitmap;
  14933. }
  14934. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  14935. if (mmr) {
  14936. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  14937. return decodeMMRBitmap(input, width, height, false);
  14938. }
  14939. 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) {
  14940. return decodeBitmapTemplate0(width, height, decodingContext);
  14941. }
  14942. const useskip = !!skip;
  14943. const template = CodingTemplates[templateIndex].concat(at);
  14944. template.sort(function (a, b) {
  14945. return a.y - b.y || a.x - b.x;
  14946. });
  14947. const templateLength = template.length;
  14948. const templateX = new Int8Array(templateLength);
  14949. const templateY = new Int8Array(templateLength);
  14950. const changingTemplateEntries = [];
  14951. let reuseMask = 0,
  14952. minX = 0,
  14953. maxX = 0,
  14954. minY = 0;
  14955. let c, k;
  14956. for (k = 0; k < templateLength; k++) {
  14957. templateX[k] = template[k].x;
  14958. templateY[k] = template[k].y;
  14959. minX = Math.min(minX, template[k].x);
  14960. maxX = Math.max(maxX, template[k].x);
  14961. minY = Math.min(minY, template[k].y);
  14962. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  14963. reuseMask |= 1 << templateLength - 1 - k;
  14964. } else {
  14965. changingTemplateEntries.push(k);
  14966. }
  14967. }
  14968. const changingEntriesLength = changingTemplateEntries.length;
  14969. const changingTemplateX = new Int8Array(changingEntriesLength);
  14970. const changingTemplateY = new Int8Array(changingEntriesLength);
  14971. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  14972. for (c = 0; c < changingEntriesLength; c++) {
  14973. k = changingTemplateEntries[c];
  14974. changingTemplateX[c] = template[k].x;
  14975. changingTemplateY[c] = template[k].y;
  14976. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  14977. }
  14978. const sbb_left = -minX;
  14979. const sbb_top = -minY;
  14980. const sbb_right = width - maxX;
  14981. const pseudoPixelContext = ReusedContexts[templateIndex];
  14982. let row = new Uint8Array(width);
  14983. const bitmap = [];
  14984. const decoder = decodingContext.decoder;
  14985. const contexts = decodingContext.contextCache.getContexts("GB");
  14986. let ltp = 0,
  14987. j,
  14988. i0,
  14989. j0,
  14990. contextLabel = 0,
  14991. bit,
  14992. shift;
  14993. for (let i = 0; i < height; i++) {
  14994. if (prediction) {
  14995. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  14996. ltp ^= sltp;
  14997. if (ltp) {
  14998. bitmap.push(row);
  14999. continue;
  15000. }
  15001. }
  15002. row = new Uint8Array(row);
  15003. bitmap.push(row);
  15004. for (j = 0; j < width; j++) {
  15005. if (useskip && skip[i][j]) {
  15006. row[j] = 0;
  15007. continue;
  15008. }
  15009. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  15010. contextLabel = contextLabel << 1 & reuseMask;
  15011. for (k = 0; k < changingEntriesLength; k++) {
  15012. i0 = i + changingTemplateY[k];
  15013. j0 = j + changingTemplateX[k];
  15014. bit = bitmap[i0][j0];
  15015. if (bit) {
  15016. bit = changingTemplateBit[k];
  15017. contextLabel |= bit;
  15018. }
  15019. }
  15020. } else {
  15021. contextLabel = 0;
  15022. shift = templateLength - 1;
  15023. for (k = 0; k < templateLength; k++, shift--) {
  15024. j0 = j + templateX[k];
  15025. if (j0 >= 0 && j0 < width) {
  15026. i0 = i + templateY[k];
  15027. if (i0 >= 0) {
  15028. bit = bitmap[i0][j0];
  15029. if (bit) {
  15030. contextLabel |= bit << shift;
  15031. }
  15032. }
  15033. }
  15034. }
  15035. }
  15036. const pixel = decoder.readBit(contexts, contextLabel);
  15037. row[j] = pixel;
  15038. }
  15039. }
  15040. return bitmap;
  15041. }
  15042. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  15043. let codingTemplate = RefinementTemplates[templateIndex].coding;
  15044. if (templateIndex === 0) {
  15045. codingTemplate = codingTemplate.concat([at[0]]);
  15046. }
  15047. const codingTemplateLength = codingTemplate.length;
  15048. const codingTemplateX = new Int32Array(codingTemplateLength);
  15049. const codingTemplateY = new Int32Array(codingTemplateLength);
  15050. let k;
  15051. for (k = 0; k < codingTemplateLength; k++) {
  15052. codingTemplateX[k] = codingTemplate[k].x;
  15053. codingTemplateY[k] = codingTemplate[k].y;
  15054. }
  15055. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  15056. if (templateIndex === 0) {
  15057. referenceTemplate = referenceTemplate.concat([at[1]]);
  15058. }
  15059. const referenceTemplateLength = referenceTemplate.length;
  15060. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  15061. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  15062. for (k = 0; k < referenceTemplateLength; k++) {
  15063. referenceTemplateX[k] = referenceTemplate[k].x;
  15064. referenceTemplateY[k] = referenceTemplate[k].y;
  15065. }
  15066. const referenceWidth = referenceBitmap[0].length;
  15067. const referenceHeight = referenceBitmap.length;
  15068. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  15069. const bitmap = [];
  15070. const decoder = decodingContext.decoder;
  15071. const contexts = decodingContext.contextCache.getContexts("GR");
  15072. let ltp = 0;
  15073. for (let i = 0; i < height; i++) {
  15074. if (prediction) {
  15075. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  15076. ltp ^= sltp;
  15077. if (ltp) {
  15078. throw new Jbig2Error("prediction is not supported");
  15079. }
  15080. }
  15081. const row = new Uint8Array(width);
  15082. bitmap.push(row);
  15083. for (let j = 0; j < width; j++) {
  15084. let i0, j0;
  15085. let contextLabel = 0;
  15086. for (k = 0; k < codingTemplateLength; k++) {
  15087. i0 = i + codingTemplateY[k];
  15088. j0 = j + codingTemplateX[k];
  15089. if (i0 < 0 || j0 < 0 || j0 >= width) {
  15090. contextLabel <<= 1;
  15091. } else {
  15092. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  15093. }
  15094. }
  15095. for (k = 0; k < referenceTemplateLength; k++) {
  15096. i0 = i + referenceTemplateY[k] - offsetY;
  15097. j0 = j + referenceTemplateX[k] - offsetX;
  15098. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  15099. contextLabel <<= 1;
  15100. } else {
  15101. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  15102. }
  15103. }
  15104. const pixel = decoder.readBit(contexts, contextLabel);
  15105. row[j] = pixel;
  15106. }
  15107. }
  15108. return bitmap;
  15109. }
  15110. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  15111. if (huffman && refinement) {
  15112. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  15113. }
  15114. const newSymbols = [];
  15115. let currentHeight = 0;
  15116. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  15117. const decoder = decodingContext.decoder;
  15118. const contextCache = decodingContext.contextCache;
  15119. let tableB1, symbolWidths;
  15120. if (huffman) {
  15121. tableB1 = getStandardTable(1);
  15122. symbolWidths = [];
  15123. symbolCodeLength = Math.max(symbolCodeLength, 1);
  15124. }
  15125. while (newSymbols.length < numberOfNewSymbols) {
  15126. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  15127. currentHeight += deltaHeight;
  15128. let currentWidth = 0,
  15129. totalWidth = 0;
  15130. const firstSymbol = huffman ? symbolWidths.length : 0;
  15131. while (true) {
  15132. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  15133. if (deltaWidth === null) {
  15134. break;
  15135. }
  15136. currentWidth += deltaWidth;
  15137. totalWidth += currentWidth;
  15138. let bitmap;
  15139. if (refinement) {
  15140. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  15141. if (numberOfInstances > 1) {
  15142. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  15143. } else {
  15144. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  15145. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15146. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15147. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  15148. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  15149. }
  15150. newSymbols.push(bitmap);
  15151. } else if (huffman) {
  15152. symbolWidths.push(currentWidth);
  15153. } else {
  15154. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  15155. newSymbols.push(bitmap);
  15156. }
  15157. }
  15158. if (huffman && !refinement) {
  15159. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  15160. huffmanInput.byteAlign();
  15161. let collectiveBitmap;
  15162. if (bitmapSize === 0) {
  15163. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  15164. } else {
  15165. const originalEnd = huffmanInput.end;
  15166. const bitmapEnd = huffmanInput.position + bitmapSize;
  15167. huffmanInput.end = bitmapEnd;
  15168. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  15169. huffmanInput.end = originalEnd;
  15170. huffmanInput.position = bitmapEnd;
  15171. }
  15172. const numberOfSymbolsDecoded = symbolWidths.length;
  15173. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  15174. newSymbols.push(collectiveBitmap);
  15175. } else {
  15176. let i,
  15177. y,
  15178. xMin = 0,
  15179. xMax,
  15180. bitmapWidth,
  15181. symbolBitmap;
  15182. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  15183. bitmapWidth = symbolWidths[i];
  15184. xMax = xMin + bitmapWidth;
  15185. symbolBitmap = [];
  15186. for (y = 0; y < currentHeight; y++) {
  15187. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15188. }
  15189. newSymbols.push(symbolBitmap);
  15190. xMin = xMax;
  15191. }
  15192. }
  15193. }
  15194. }
  15195. const exportedSymbols = [],
  15196. flags = [];
  15197. let currentFlag = false,
  15198. i,
  15199. ii;
  15200. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  15201. while (flags.length < totalSymbolsLength) {
  15202. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  15203. while (runLength--) {
  15204. flags.push(currentFlag);
  15205. }
  15206. currentFlag = !currentFlag;
  15207. }
  15208. for (i = 0, ii = symbols.length; i < ii; i++) {
  15209. if (flags[i]) {
  15210. exportedSymbols.push(symbols[i]);
  15211. }
  15212. }
  15213. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  15214. if (flags[i]) {
  15215. exportedSymbols.push(newSymbols[j]);
  15216. }
  15217. }
  15218. return exportedSymbols;
  15219. }
  15220. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  15221. if (huffman && refinement) {
  15222. throw new Jbig2Error("refinement with Huffman is not supported");
  15223. }
  15224. const bitmap = [];
  15225. let i, row;
  15226. for (i = 0; i < height; i++) {
  15227. row = new Uint8Array(width);
  15228. if (defaultPixelValue) {
  15229. for (let j = 0; j < width; j++) {
  15230. row[j] = defaultPixelValue;
  15231. }
  15232. }
  15233. bitmap.push(row);
  15234. }
  15235. const decoder = decodingContext.decoder;
  15236. const contextCache = decodingContext.contextCache;
  15237. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  15238. let firstS = 0;
  15239. i = 0;
  15240. while (i < numberOfSymbolInstances) {
  15241. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  15242. stripT += deltaT;
  15243. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  15244. firstS += deltaFirstS;
  15245. let currentS = firstS;
  15246. do {
  15247. let currentT = 0;
  15248. if (stripSize > 1) {
  15249. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  15250. }
  15251. const t = stripSize * stripT + currentT;
  15252. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  15253. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  15254. let symbolBitmap = inputSymbols[symbolId];
  15255. let symbolWidth = symbolBitmap[0].length;
  15256. let symbolHeight = symbolBitmap.length;
  15257. if (applyRefinement) {
  15258. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  15259. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  15260. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  15261. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  15262. symbolWidth += rdw;
  15263. symbolHeight += rdh;
  15264. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  15265. }
  15266. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  15267. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  15268. let s2, t2, symbolRow;
  15269. if (transposed) {
  15270. for (s2 = 0; s2 < symbolHeight; s2++) {
  15271. row = bitmap[offsetS + s2];
  15272. if (!row) {
  15273. continue;
  15274. }
  15275. symbolRow = symbolBitmap[s2];
  15276. const maxWidth = Math.min(width - offsetT, symbolWidth);
  15277. switch (combinationOperator) {
  15278. case 0:
  15279. for (t2 = 0; t2 < maxWidth; t2++) {
  15280. row[offsetT + t2] |= symbolRow[t2];
  15281. }
  15282. break;
  15283. case 2:
  15284. for (t2 = 0; t2 < maxWidth; t2++) {
  15285. row[offsetT + t2] ^= symbolRow[t2];
  15286. }
  15287. break;
  15288. default:
  15289. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15290. }
  15291. }
  15292. currentS += symbolHeight - 1;
  15293. } else {
  15294. for (t2 = 0; t2 < symbolHeight; t2++) {
  15295. row = bitmap[offsetT + t2];
  15296. if (!row) {
  15297. continue;
  15298. }
  15299. symbolRow = symbolBitmap[t2];
  15300. switch (combinationOperator) {
  15301. case 0:
  15302. for (s2 = 0; s2 < symbolWidth; s2++) {
  15303. row[offsetS + s2] |= symbolRow[s2];
  15304. }
  15305. break;
  15306. case 2:
  15307. for (s2 = 0; s2 < symbolWidth; s2++) {
  15308. row[offsetS + s2] ^= symbolRow[s2];
  15309. }
  15310. break;
  15311. default:
  15312. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15313. }
  15314. }
  15315. currentS += symbolWidth - 1;
  15316. }
  15317. i++;
  15318. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  15319. if (deltaS === null) {
  15320. break;
  15321. }
  15322. currentS += deltaS + dsOffset;
  15323. } while (true);
  15324. }
  15325. return bitmap;
  15326. }
  15327. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  15328. const at = [];
  15329. if (!mmr) {
  15330. at.push({
  15331. x: -patternWidth,
  15332. y: 0
  15333. });
  15334. if (template === 0) {
  15335. at.push({
  15336. x: -3,
  15337. y: -1
  15338. }, {
  15339. x: 2,
  15340. y: -2
  15341. }, {
  15342. x: -2,
  15343. y: -2
  15344. });
  15345. }
  15346. }
  15347. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  15348. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  15349. const patterns = [];
  15350. for (let i = 0; i <= maxPatternIndex; i++) {
  15351. const patternBitmap = [];
  15352. const xMin = patternWidth * i;
  15353. const xMax = xMin + patternWidth;
  15354. for (let y = 0; y < patternHeight; y++) {
  15355. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  15356. }
  15357. patterns.push(patternBitmap);
  15358. }
  15359. return patterns;
  15360. }
  15361. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  15362. const skip = null;
  15363. if (enableSkip) {
  15364. throw new Jbig2Error("skip is not supported");
  15365. }
  15366. if (combinationOperator !== 0) {
  15367. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  15368. }
  15369. const regionBitmap = [];
  15370. let i, j, row;
  15371. for (i = 0; i < regionHeight; i++) {
  15372. row = new Uint8Array(regionWidth);
  15373. if (defaultPixelValue) {
  15374. for (j = 0; j < regionWidth; j++) {
  15375. row[j] = defaultPixelValue;
  15376. }
  15377. }
  15378. regionBitmap.push(row);
  15379. }
  15380. const numberOfPatterns = patterns.length;
  15381. const pattern0 = patterns[0];
  15382. const patternWidth = pattern0[0].length,
  15383. patternHeight = pattern0.length;
  15384. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  15385. const at = [];
  15386. if (!mmr) {
  15387. at.push({
  15388. x: template <= 1 ? 3 : 2,
  15389. y: -1
  15390. });
  15391. if (template === 0) {
  15392. at.push({
  15393. x: -3,
  15394. y: -1
  15395. }, {
  15396. x: 2,
  15397. y: -2
  15398. }, {
  15399. x: -2,
  15400. y: -2
  15401. });
  15402. }
  15403. }
  15404. const grayScaleBitPlanes = [];
  15405. let mmrInput, bitmap;
  15406. if (mmr) {
  15407. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  15408. }
  15409. for (i = bitsPerValue - 1; i >= 0; i--) {
  15410. if (mmr) {
  15411. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  15412. } else {
  15413. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  15414. }
  15415. grayScaleBitPlanes[i] = bitmap;
  15416. }
  15417. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  15418. for (mg = 0; mg < gridHeight; mg++) {
  15419. for (ng = 0; ng < gridWidth; ng++) {
  15420. bit = 0;
  15421. patternIndex = 0;
  15422. for (j = bitsPerValue - 1; j >= 0; j--) {
  15423. bit ^= grayScaleBitPlanes[j][mg][ng];
  15424. patternIndex |= bit << j;
  15425. }
  15426. patternBitmap = patterns[patternIndex];
  15427. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  15428. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  15429. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  15430. for (i = 0; i < patternHeight; i++) {
  15431. regionRow = regionBitmap[y + i];
  15432. patternRow = patternBitmap[i];
  15433. for (j = 0; j < patternWidth; j++) {
  15434. regionRow[x + j] |= patternRow[j];
  15435. }
  15436. }
  15437. } else {
  15438. let regionX, regionY;
  15439. for (i = 0; i < patternHeight; i++) {
  15440. regionY = y + i;
  15441. if (regionY < 0 || regionY >= regionHeight) {
  15442. continue;
  15443. }
  15444. regionRow = regionBitmap[regionY];
  15445. patternRow = patternBitmap[i];
  15446. for (j = 0; j < patternWidth; j++) {
  15447. regionX = x + j;
  15448. if (regionX >= 0 && regionX < regionWidth) {
  15449. regionRow[regionX] |= patternRow[j];
  15450. }
  15451. }
  15452. }
  15453. }
  15454. }
  15455. }
  15456. return regionBitmap;
  15457. }
  15458. function readSegmentHeader(data, start) {
  15459. const segmentHeader = {};
  15460. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  15461. const flags = data[start + 4];
  15462. const segmentType = flags & 0x3f;
  15463. if (!SegmentTypes[segmentType]) {
  15464. throw new Jbig2Error("invalid segment type: " + segmentType);
  15465. }
  15466. segmentHeader.type = segmentType;
  15467. segmentHeader.typeName = SegmentTypes[segmentType];
  15468. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  15469. const pageAssociationFieldSize = !!(flags & 0x40);
  15470. const referredFlags = data[start + 5];
  15471. let referredToCount = referredFlags >> 5 & 7;
  15472. const retainBits = [referredFlags & 31];
  15473. let position = start + 6;
  15474. if (referredFlags === 7) {
  15475. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  15476. position += 3;
  15477. let bytes = referredToCount + 7 >> 3;
  15478. retainBits[0] = data[position++];
  15479. while (--bytes > 0) {
  15480. retainBits.push(data[position++]);
  15481. }
  15482. } else if (referredFlags === 5 || referredFlags === 6) {
  15483. throw new Jbig2Error("invalid referred-to flags");
  15484. }
  15485. segmentHeader.retainBits = retainBits;
  15486. let referredToSegmentNumberSize = 4;
  15487. if (segmentHeader.number <= 256) {
  15488. referredToSegmentNumberSize = 1;
  15489. } else if (segmentHeader.number <= 65536) {
  15490. referredToSegmentNumberSize = 2;
  15491. }
  15492. const referredTo = [];
  15493. let i, ii;
  15494. for (i = 0; i < referredToCount; i++) {
  15495. let number;
  15496. if (referredToSegmentNumberSize === 1) {
  15497. number = data[position];
  15498. } else if (referredToSegmentNumberSize === 2) {
  15499. number = (0, _core_utils.readUint16)(data, position);
  15500. } else {
  15501. number = (0, _core_utils.readUint32)(data, position);
  15502. }
  15503. referredTo.push(number);
  15504. position += referredToSegmentNumberSize;
  15505. }
  15506. segmentHeader.referredTo = referredTo;
  15507. if (!pageAssociationFieldSize) {
  15508. segmentHeader.pageAssociation = data[position++];
  15509. } else {
  15510. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  15511. position += 4;
  15512. }
  15513. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  15514. position += 4;
  15515. if (segmentHeader.length === 0xffffffff) {
  15516. if (segmentType === 38) {
  15517. const genericRegionInfo = readRegionSegmentInformation(data, position);
  15518. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  15519. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  15520. const searchPatternLength = 6;
  15521. const searchPattern = new Uint8Array(searchPatternLength);
  15522. if (!genericRegionMmr) {
  15523. searchPattern[0] = 0xff;
  15524. searchPattern[1] = 0xac;
  15525. }
  15526. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  15527. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  15528. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  15529. searchPattern[5] = genericRegionInfo.height & 0xff;
  15530. for (i = position, ii = data.length; i < ii; i++) {
  15531. let j = 0;
  15532. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  15533. j++;
  15534. }
  15535. if (j === searchPatternLength) {
  15536. segmentHeader.length = i + searchPatternLength;
  15537. break;
  15538. }
  15539. }
  15540. if (segmentHeader.length === 0xffffffff) {
  15541. throw new Jbig2Error("segment end was not found");
  15542. }
  15543. } else {
  15544. throw new Jbig2Error("invalid unknown segment length");
  15545. }
  15546. }
  15547. segmentHeader.headerEnd = position;
  15548. return segmentHeader;
  15549. }
  15550. function readSegments(header, data, start, end) {
  15551. const segments = [];
  15552. let position = start;
  15553. while (position < end) {
  15554. const segmentHeader = readSegmentHeader(data, position);
  15555. position = segmentHeader.headerEnd;
  15556. const segment = {
  15557. header: segmentHeader,
  15558. data
  15559. };
  15560. if (!header.randomAccess) {
  15561. segment.start = position;
  15562. position += segmentHeader.length;
  15563. segment.end = position;
  15564. }
  15565. segments.push(segment);
  15566. if (segmentHeader.type === 51) {
  15567. break;
  15568. }
  15569. }
  15570. if (header.randomAccess) {
  15571. for (let i = 0, ii = segments.length; i < ii; i++) {
  15572. segments[i].start = position;
  15573. position += segments[i].header.length;
  15574. segments[i].end = position;
  15575. }
  15576. }
  15577. return segments;
  15578. }
  15579. function readRegionSegmentInformation(data, start) {
  15580. return {
  15581. width: (0, _core_utils.readUint32)(data, start),
  15582. height: (0, _core_utils.readUint32)(data, start + 4),
  15583. x: (0, _core_utils.readUint32)(data, start + 8),
  15584. y: (0, _core_utils.readUint32)(data, start + 12),
  15585. combinationOperator: data[start + 16] & 7
  15586. };
  15587. }
  15588. const RegionSegmentInformationFieldLength = 17;
  15589. function processSegment(segment, visitor) {
  15590. const header = segment.header;
  15591. const data = segment.data,
  15592. end = segment.end;
  15593. let position = segment.start;
  15594. let args, at, i, atLength;
  15595. switch (header.type) {
  15596. case 0:
  15597. const dictionary = {};
  15598. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  15599. dictionary.huffman = !!(dictionaryFlags & 1);
  15600. dictionary.refinement = !!(dictionaryFlags & 2);
  15601. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  15602. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  15603. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  15604. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  15605. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  15606. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  15607. dictionary.template = dictionaryFlags >> 10 & 3;
  15608. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  15609. position += 2;
  15610. if (!dictionary.huffman) {
  15611. atLength = dictionary.template === 0 ? 4 : 1;
  15612. at = [];
  15613. for (i = 0; i < atLength; i++) {
  15614. at.push({
  15615. x: (0, _core_utils.readInt8)(data, position),
  15616. y: (0, _core_utils.readInt8)(data, position + 1)
  15617. });
  15618. position += 2;
  15619. }
  15620. dictionary.at = at;
  15621. }
  15622. if (dictionary.refinement && !dictionary.refinementTemplate) {
  15623. at = [];
  15624. for (i = 0; i < 2; i++) {
  15625. at.push({
  15626. x: (0, _core_utils.readInt8)(data, position),
  15627. y: (0, _core_utils.readInt8)(data, position + 1)
  15628. });
  15629. position += 2;
  15630. }
  15631. dictionary.refinementAt = at;
  15632. }
  15633. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  15634. position += 4;
  15635. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  15636. position += 4;
  15637. args = [dictionary, header.number, header.referredTo, data, position, end];
  15638. break;
  15639. case 6:
  15640. case 7:
  15641. const textRegion = {};
  15642. textRegion.info = readRegionSegmentInformation(data, position);
  15643. position += RegionSegmentInformationFieldLength;
  15644. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  15645. position += 2;
  15646. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  15647. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  15648. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  15649. textRegion.stripSize = 1 << textRegion.logStripSize;
  15650. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  15651. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  15652. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  15653. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  15654. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  15655. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  15656. if (textRegion.huffman) {
  15657. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  15658. position += 2;
  15659. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  15660. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  15661. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  15662. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  15663. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  15664. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  15665. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  15666. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  15667. }
  15668. if (textRegion.refinement && !textRegion.refinementTemplate) {
  15669. at = [];
  15670. for (i = 0; i < 2; i++) {
  15671. at.push({
  15672. x: (0, _core_utils.readInt8)(data, position),
  15673. y: (0, _core_utils.readInt8)(data, position + 1)
  15674. });
  15675. position += 2;
  15676. }
  15677. textRegion.refinementAt = at;
  15678. }
  15679. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  15680. position += 4;
  15681. args = [textRegion, header.referredTo, data, position, end];
  15682. break;
  15683. case 16:
  15684. const patternDictionary = {};
  15685. const patternDictionaryFlags = data[position++];
  15686. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  15687. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  15688. patternDictionary.patternWidth = data[position++];
  15689. patternDictionary.patternHeight = data[position++];
  15690. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  15691. position += 4;
  15692. args = [patternDictionary, header.number, data, position, end];
  15693. break;
  15694. case 22:
  15695. case 23:
  15696. const halftoneRegion = {};
  15697. halftoneRegion.info = readRegionSegmentInformation(data, position);
  15698. position += RegionSegmentInformationFieldLength;
  15699. const halftoneRegionFlags = data[position++];
  15700. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  15701. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  15702. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  15703. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  15704. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  15705. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  15706. position += 4;
  15707. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  15708. position += 4;
  15709. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  15710. position += 4;
  15711. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  15712. position += 4;
  15713. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  15714. position += 2;
  15715. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  15716. position += 2;
  15717. args = [halftoneRegion, header.referredTo, data, position, end];
  15718. break;
  15719. case 38:
  15720. case 39:
  15721. const genericRegion = {};
  15722. genericRegion.info = readRegionSegmentInformation(data, position);
  15723. position += RegionSegmentInformationFieldLength;
  15724. const genericRegionSegmentFlags = data[position++];
  15725. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  15726. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  15727. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  15728. if (!genericRegion.mmr) {
  15729. atLength = genericRegion.template === 0 ? 4 : 1;
  15730. at = [];
  15731. for (i = 0; i < atLength; i++) {
  15732. at.push({
  15733. x: (0, _core_utils.readInt8)(data, position),
  15734. y: (0, _core_utils.readInt8)(data, position + 1)
  15735. });
  15736. position += 2;
  15737. }
  15738. genericRegion.at = at;
  15739. }
  15740. args = [genericRegion, data, position, end];
  15741. break;
  15742. case 48:
  15743. const pageInfo = {
  15744. width: (0, _core_utils.readUint32)(data, position),
  15745. height: (0, _core_utils.readUint32)(data, position + 4),
  15746. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  15747. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  15748. };
  15749. if (pageInfo.height === 0xffffffff) {
  15750. delete pageInfo.height;
  15751. }
  15752. const pageSegmentFlags = data[position + 16];
  15753. (0, _core_utils.readUint16)(data, position + 17);
  15754. pageInfo.lossless = !!(pageSegmentFlags & 1);
  15755. pageInfo.refinement = !!(pageSegmentFlags & 2);
  15756. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  15757. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  15758. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  15759. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  15760. args = [pageInfo];
  15761. break;
  15762. case 49:
  15763. break;
  15764. case 50:
  15765. break;
  15766. case 51:
  15767. break;
  15768. case 53:
  15769. args = [header.number, data, position, end];
  15770. break;
  15771. case 62:
  15772. break;
  15773. default:
  15774. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  15775. }
  15776. const callbackName = "on" + header.typeName;
  15777. if (callbackName in visitor) {
  15778. visitor[callbackName].apply(visitor, args);
  15779. }
  15780. }
  15781. function processSegments(segments, visitor) {
  15782. for (let i = 0, ii = segments.length; i < ii; i++) {
  15783. processSegment(segments[i], visitor);
  15784. }
  15785. }
  15786. function parseJbig2Chunks(chunks) {
  15787. const visitor = new SimpleSegmentVisitor();
  15788. for (let i = 0, ii = chunks.length; i < ii; i++) {
  15789. const chunk = chunks[i];
  15790. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  15791. processSegments(segments, visitor);
  15792. }
  15793. return visitor.buffer;
  15794. }
  15795. function parseJbig2(data) {
  15796. throw new Error("Not implemented: parseJbig2");
  15797. }
  15798. class SimpleSegmentVisitor {
  15799. onPageInformation(info) {
  15800. this.currentPageInfo = info;
  15801. const rowSize = info.width + 7 >> 3;
  15802. const buffer = new Uint8ClampedArray(rowSize * info.height);
  15803. if (info.defaultPixelValue) {
  15804. buffer.fill(0xff);
  15805. }
  15806. this.buffer = buffer;
  15807. }
  15808. drawBitmap(regionInfo, bitmap) {
  15809. const pageInfo = this.currentPageInfo;
  15810. const width = regionInfo.width,
  15811. height = regionInfo.height;
  15812. const rowSize = pageInfo.width + 7 >> 3;
  15813. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  15814. const buffer = this.buffer;
  15815. const mask0 = 128 >> (regionInfo.x & 7);
  15816. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  15817. let i, j, mask, offset;
  15818. switch (combinationOperator) {
  15819. case 0:
  15820. for (i = 0; i < height; i++) {
  15821. mask = mask0;
  15822. offset = offset0;
  15823. for (j = 0; j < width; j++) {
  15824. if (bitmap[i][j]) {
  15825. buffer[offset] |= mask;
  15826. }
  15827. mask >>= 1;
  15828. if (!mask) {
  15829. mask = 128;
  15830. offset++;
  15831. }
  15832. }
  15833. offset0 += rowSize;
  15834. }
  15835. break;
  15836. case 2:
  15837. for (i = 0; i < height; i++) {
  15838. mask = mask0;
  15839. offset = offset0;
  15840. for (j = 0; j < width; j++) {
  15841. if (bitmap[i][j]) {
  15842. buffer[offset] ^= mask;
  15843. }
  15844. mask >>= 1;
  15845. if (!mask) {
  15846. mask = 128;
  15847. offset++;
  15848. }
  15849. }
  15850. offset0 += rowSize;
  15851. }
  15852. break;
  15853. default:
  15854. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  15855. }
  15856. }
  15857. onImmediateGenericRegion(region, data, start, end) {
  15858. const regionInfo = region.info;
  15859. const decodingContext = new DecodingContext(data, start, end);
  15860. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  15861. this.drawBitmap(regionInfo, bitmap);
  15862. }
  15863. onImmediateLosslessGenericRegion() {
  15864. this.onImmediateGenericRegion(...arguments);
  15865. }
  15866. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  15867. let huffmanTables, huffmanInput;
  15868. if (dictionary.huffman) {
  15869. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  15870. huffmanInput = new Reader(data, start, end);
  15871. }
  15872. let symbols = this.symbols;
  15873. if (!symbols) {
  15874. this.symbols = symbols = {};
  15875. }
  15876. const inputSymbols = [];
  15877. for (const referredSegment of referredSegments) {
  15878. const referredSymbols = symbols[referredSegment];
  15879. if (referredSymbols) {
  15880. inputSymbols.push(...referredSymbols);
  15881. }
  15882. }
  15883. const decodingContext = new DecodingContext(data, start, end);
  15884. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  15885. }
  15886. onImmediateTextRegion(region, referredSegments, data, start, end) {
  15887. const regionInfo = region.info;
  15888. let huffmanTables, huffmanInput;
  15889. const symbols = this.symbols;
  15890. const inputSymbols = [];
  15891. for (const referredSegment of referredSegments) {
  15892. const referredSymbols = symbols[referredSegment];
  15893. if (referredSymbols) {
  15894. inputSymbols.push(...referredSymbols);
  15895. }
  15896. }
  15897. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  15898. if (region.huffman) {
  15899. huffmanInput = new Reader(data, start, end);
  15900. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  15901. }
  15902. const decodingContext = new DecodingContext(data, start, end);
  15903. 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);
  15904. this.drawBitmap(regionInfo, bitmap);
  15905. }
  15906. onImmediateLosslessTextRegion() {
  15907. this.onImmediateTextRegion(...arguments);
  15908. }
  15909. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  15910. let patterns = this.patterns;
  15911. if (!patterns) {
  15912. this.patterns = patterns = {};
  15913. }
  15914. const decodingContext = new DecodingContext(data, start, end);
  15915. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  15916. }
  15917. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  15918. const patterns = this.patterns[referredSegments[0]];
  15919. const regionInfo = region.info;
  15920. const decodingContext = new DecodingContext(data, start, end);
  15921. 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);
  15922. this.drawBitmap(regionInfo, bitmap);
  15923. }
  15924. onImmediateLosslessHalftoneRegion() {
  15925. this.onImmediateHalftoneRegion(...arguments);
  15926. }
  15927. onTables(currentSegment, data, start, end) {
  15928. let customTables = this.customTables;
  15929. if (!customTables) {
  15930. this.customTables = customTables = {};
  15931. }
  15932. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  15933. }
  15934. }
  15935. class HuffmanLine {
  15936. constructor(lineData) {
  15937. if (lineData.length === 2) {
  15938. this.isOOB = true;
  15939. this.rangeLow = 0;
  15940. this.prefixLength = lineData[0];
  15941. this.rangeLength = 0;
  15942. this.prefixCode = lineData[1];
  15943. this.isLowerRange = false;
  15944. } else {
  15945. this.isOOB = false;
  15946. this.rangeLow = lineData[0];
  15947. this.prefixLength = lineData[1];
  15948. this.rangeLength = lineData[2];
  15949. this.prefixCode = lineData[3];
  15950. this.isLowerRange = lineData[4] === "lower";
  15951. }
  15952. }
  15953. }
  15954. class HuffmanTreeNode {
  15955. constructor(line) {
  15956. this.children = [];
  15957. if (line) {
  15958. this.isLeaf = true;
  15959. this.rangeLength = line.rangeLength;
  15960. this.rangeLow = line.rangeLow;
  15961. this.isLowerRange = line.isLowerRange;
  15962. this.isOOB = line.isOOB;
  15963. } else {
  15964. this.isLeaf = false;
  15965. }
  15966. }
  15967. buildTree(line, shift) {
  15968. const bit = line.prefixCode >> shift & 1;
  15969. if (shift <= 0) {
  15970. this.children[bit] = new HuffmanTreeNode(line);
  15971. } else {
  15972. let node = this.children[bit];
  15973. if (!node) {
  15974. this.children[bit] = node = new HuffmanTreeNode(null);
  15975. }
  15976. node.buildTree(line, shift - 1);
  15977. }
  15978. }
  15979. decodeNode(reader) {
  15980. if (this.isLeaf) {
  15981. if (this.isOOB) {
  15982. return null;
  15983. }
  15984. const htOffset = reader.readBits(this.rangeLength);
  15985. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  15986. }
  15987. const node = this.children[reader.readBit()];
  15988. if (!node) {
  15989. throw new Jbig2Error("invalid Huffman data");
  15990. }
  15991. return node.decodeNode(reader);
  15992. }
  15993. }
  15994. class HuffmanTable {
  15995. constructor(lines, prefixCodesDone) {
  15996. if (!prefixCodesDone) {
  15997. this.assignPrefixCodes(lines);
  15998. }
  15999. this.rootNode = new HuffmanTreeNode(null);
  16000. for (let i = 0, ii = lines.length; i < ii; i++) {
  16001. const line = lines[i];
  16002. if (line.prefixLength > 0) {
  16003. this.rootNode.buildTree(line, line.prefixLength - 1);
  16004. }
  16005. }
  16006. }
  16007. decode(reader) {
  16008. return this.rootNode.decodeNode(reader);
  16009. }
  16010. assignPrefixCodes(lines) {
  16011. const linesLength = lines.length;
  16012. let prefixLengthMax = 0;
  16013. for (let i = 0; i < linesLength; i++) {
  16014. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  16015. }
  16016. const histogram = new Uint32Array(prefixLengthMax + 1);
  16017. for (let i = 0; i < linesLength; i++) {
  16018. histogram[lines[i].prefixLength]++;
  16019. }
  16020. let currentLength = 1,
  16021. firstCode = 0,
  16022. currentCode,
  16023. currentTemp,
  16024. line;
  16025. histogram[0] = 0;
  16026. while (currentLength <= prefixLengthMax) {
  16027. firstCode = firstCode + histogram[currentLength - 1] << 1;
  16028. currentCode = firstCode;
  16029. currentTemp = 0;
  16030. while (currentTemp < linesLength) {
  16031. line = lines[currentTemp];
  16032. if (line.prefixLength === currentLength) {
  16033. line.prefixCode = currentCode;
  16034. currentCode++;
  16035. }
  16036. currentTemp++;
  16037. }
  16038. currentLength++;
  16039. }
  16040. }
  16041. }
  16042. function decodeTablesSegment(data, start, end) {
  16043. const flags = data[start];
  16044. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  16045. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  16046. const reader = new Reader(data, start + 9, end);
  16047. const prefixSizeBits = (flags >> 1 & 7) + 1;
  16048. const rangeSizeBits = (flags >> 4 & 7) + 1;
  16049. const lines = [];
  16050. let prefixLength,
  16051. rangeLength,
  16052. currentRangeLow = lowestValue;
  16053. do {
  16054. prefixLength = reader.readBits(prefixSizeBits);
  16055. rangeLength = reader.readBits(rangeSizeBits);
  16056. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  16057. currentRangeLow += 1 << rangeLength;
  16058. } while (currentRangeLow < highestValue);
  16059. prefixLength = reader.readBits(prefixSizeBits);
  16060. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  16061. prefixLength = reader.readBits(prefixSizeBits);
  16062. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  16063. if (flags & 1) {
  16064. prefixLength = reader.readBits(prefixSizeBits);
  16065. lines.push(new HuffmanLine([prefixLength, 0]));
  16066. }
  16067. return new HuffmanTable(lines, false);
  16068. }
  16069. const standardTablesCache = {};
  16070. function getStandardTable(number) {
  16071. let table = standardTablesCache[number];
  16072. if (table) {
  16073. return table;
  16074. }
  16075. let lines;
  16076. switch (number) {
  16077. case 1:
  16078. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  16079. break;
  16080. case 2:
  16081. 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]];
  16082. break;
  16083. case 3:
  16084. 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]];
  16085. break;
  16086. case 4:
  16087. 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]];
  16088. break;
  16089. case 5:
  16090. 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]];
  16091. break;
  16092. case 6:
  16093. 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]];
  16094. break;
  16095. case 7:
  16096. 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]];
  16097. break;
  16098. case 8:
  16099. 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]];
  16100. break;
  16101. case 9:
  16102. 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]];
  16103. break;
  16104. case 10:
  16105. 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]];
  16106. break;
  16107. case 11:
  16108. 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]];
  16109. break;
  16110. case 12:
  16111. 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]];
  16112. break;
  16113. case 13:
  16114. 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]];
  16115. break;
  16116. case 14:
  16117. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  16118. break;
  16119. case 15:
  16120. 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]];
  16121. break;
  16122. default:
  16123. throw new Jbig2Error(`standard table B.${number} does not exist`);
  16124. }
  16125. for (let i = 0, ii = lines.length; i < ii; i++) {
  16126. lines[i] = new HuffmanLine(lines[i]);
  16127. }
  16128. table = new HuffmanTable(lines, true);
  16129. standardTablesCache[number] = table;
  16130. return table;
  16131. }
  16132. class Reader {
  16133. constructor(data, start, end) {
  16134. this.data = data;
  16135. this.start = start;
  16136. this.end = end;
  16137. this.position = start;
  16138. this.shift = -1;
  16139. this.currentByte = 0;
  16140. }
  16141. readBit() {
  16142. if (this.shift < 0) {
  16143. if (this.position >= this.end) {
  16144. throw new Jbig2Error("end of data while reading bit");
  16145. }
  16146. this.currentByte = this.data[this.position++];
  16147. this.shift = 7;
  16148. }
  16149. const bit = this.currentByte >> this.shift & 1;
  16150. this.shift--;
  16151. return bit;
  16152. }
  16153. readBits(numBits) {
  16154. let result = 0,
  16155. i;
  16156. for (i = numBits - 1; i >= 0; i--) {
  16157. result |= this.readBit() << i;
  16158. }
  16159. return result;
  16160. }
  16161. byteAlign() {
  16162. this.shift = -1;
  16163. }
  16164. next() {
  16165. if (this.position >= this.end) {
  16166. return -1;
  16167. }
  16168. return this.data[this.position++];
  16169. }
  16170. }
  16171. function getCustomHuffmanTable(index, referredTo, customTables) {
  16172. let currentIndex = 0;
  16173. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  16174. const table = customTables[referredTo[i]];
  16175. if (table) {
  16176. if (index === currentIndex) {
  16177. return table;
  16178. }
  16179. currentIndex++;
  16180. }
  16181. }
  16182. throw new Jbig2Error("can't find custom Huffman table");
  16183. }
  16184. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  16185. const codes = [];
  16186. for (let i = 0; i <= 34; i++) {
  16187. const codeLength = reader.readBits(4);
  16188. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16189. }
  16190. const runCodesTable = new HuffmanTable(codes, false);
  16191. codes.length = 0;
  16192. for (let i = 0; i < numberOfSymbols;) {
  16193. const codeLength = runCodesTable.decode(reader);
  16194. if (codeLength >= 32) {
  16195. let repeatedLength, numberOfRepeats, j;
  16196. switch (codeLength) {
  16197. case 32:
  16198. if (i === 0) {
  16199. throw new Jbig2Error("no previous value in symbol ID table");
  16200. }
  16201. numberOfRepeats = reader.readBits(2) + 3;
  16202. repeatedLength = codes[i - 1].prefixLength;
  16203. break;
  16204. case 33:
  16205. numberOfRepeats = reader.readBits(3) + 3;
  16206. repeatedLength = 0;
  16207. break;
  16208. case 34:
  16209. numberOfRepeats = reader.readBits(7) + 11;
  16210. repeatedLength = 0;
  16211. break;
  16212. default:
  16213. throw new Jbig2Error("invalid code length in symbol ID table");
  16214. }
  16215. for (j = 0; j < numberOfRepeats; j++) {
  16216. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  16217. i++;
  16218. }
  16219. } else {
  16220. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  16221. i++;
  16222. }
  16223. }
  16224. reader.byteAlign();
  16225. const symbolIDTable = new HuffmanTable(codes, false);
  16226. let customIndex = 0,
  16227. tableFirstS,
  16228. tableDeltaS,
  16229. tableDeltaT;
  16230. switch (textRegion.huffmanFS) {
  16231. case 0:
  16232. case 1:
  16233. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  16234. break;
  16235. case 3:
  16236. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16237. customIndex++;
  16238. break;
  16239. default:
  16240. throw new Jbig2Error("invalid Huffman FS selector");
  16241. }
  16242. switch (textRegion.huffmanDS) {
  16243. case 0:
  16244. case 1:
  16245. case 2:
  16246. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  16247. break;
  16248. case 3:
  16249. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16250. customIndex++;
  16251. break;
  16252. default:
  16253. throw new Jbig2Error("invalid Huffman DS selector");
  16254. }
  16255. switch (textRegion.huffmanDT) {
  16256. case 0:
  16257. case 1:
  16258. case 2:
  16259. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  16260. break;
  16261. case 3:
  16262. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16263. customIndex++;
  16264. break;
  16265. default:
  16266. throw new Jbig2Error("invalid Huffman DT selector");
  16267. }
  16268. if (textRegion.refinement) {
  16269. throw new Jbig2Error("refinement with Huffman is not supported");
  16270. }
  16271. return {
  16272. symbolIDTable,
  16273. tableFirstS,
  16274. tableDeltaS,
  16275. tableDeltaT
  16276. };
  16277. }
  16278. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  16279. let customIndex = 0,
  16280. tableDeltaHeight,
  16281. tableDeltaWidth;
  16282. switch (dictionary.huffmanDHSelector) {
  16283. case 0:
  16284. case 1:
  16285. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  16286. break;
  16287. case 3:
  16288. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16289. customIndex++;
  16290. break;
  16291. default:
  16292. throw new Jbig2Error("invalid Huffman DH selector");
  16293. }
  16294. switch (dictionary.huffmanDWSelector) {
  16295. case 0:
  16296. case 1:
  16297. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  16298. break;
  16299. case 3:
  16300. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16301. customIndex++;
  16302. break;
  16303. default:
  16304. throw new Jbig2Error("invalid Huffman DW selector");
  16305. }
  16306. let tableBitmapSize, tableAggregateInstances;
  16307. if (dictionary.bitmapSizeSelector) {
  16308. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16309. customIndex++;
  16310. } else {
  16311. tableBitmapSize = getStandardTable(1);
  16312. }
  16313. if (dictionary.aggregationInstancesSelector) {
  16314. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  16315. } else {
  16316. tableAggregateInstances = getStandardTable(1);
  16317. }
  16318. return {
  16319. tableDeltaHeight,
  16320. tableDeltaWidth,
  16321. tableBitmapSize,
  16322. tableAggregateInstances
  16323. };
  16324. }
  16325. function readUncompressedBitmap(reader, width, height) {
  16326. const bitmap = [];
  16327. for (let y = 0; y < height; y++) {
  16328. const row = new Uint8Array(width);
  16329. bitmap.push(row);
  16330. for (let x = 0; x < width; x++) {
  16331. row[x] = reader.readBit();
  16332. }
  16333. reader.byteAlign();
  16334. }
  16335. return bitmap;
  16336. }
  16337. function decodeMMRBitmap(input, width, height, endOfBlock) {
  16338. const params = {
  16339. K: -1,
  16340. Columns: width,
  16341. Rows: height,
  16342. BlackIs1: true,
  16343. EndOfBlock: endOfBlock
  16344. };
  16345. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  16346. const bitmap = [];
  16347. let currentByte,
  16348. eof = false;
  16349. for (let y = 0; y < height; y++) {
  16350. const row = new Uint8Array(width);
  16351. bitmap.push(row);
  16352. let shift = -1;
  16353. for (let x = 0; x < width; x++) {
  16354. if (shift < 0) {
  16355. currentByte = decoder.readNextChar();
  16356. if (currentByte === -1) {
  16357. currentByte = 0;
  16358. eof = true;
  16359. }
  16360. shift = 7;
  16361. }
  16362. row[x] = currentByte >> shift & 1;
  16363. shift--;
  16364. }
  16365. }
  16366. if (endOfBlock && !eof) {
  16367. const lookForEOFLimit = 5;
  16368. for (let i = 0; i < lookForEOFLimit; i++) {
  16369. if (decoder.readNextChar() === -1) {
  16370. break;
  16371. }
  16372. }
  16373. }
  16374. return bitmap;
  16375. }
  16376. class Jbig2Image {
  16377. parseChunks(chunks) {
  16378. return parseJbig2Chunks(chunks);
  16379. }
  16380. parse(data) {
  16381. throw new Error("Not implemented: Jbig2Image.parse");
  16382. }
  16383. }
  16384. exports.Jbig2Image = Jbig2Image;
  16385. /***/ }),
  16386. /* 26 */
  16387. /***/ ((__unused_webpack_module, exports) => {
  16388. Object.defineProperty(exports, "__esModule", ({
  16389. value: true
  16390. }));
  16391. exports.ArithmeticDecoder = void 0;
  16392. const QeTable = [{
  16393. qe: 0x5601,
  16394. nmps: 1,
  16395. nlps: 1,
  16396. switchFlag: 1
  16397. }, {
  16398. qe: 0x3401,
  16399. nmps: 2,
  16400. nlps: 6,
  16401. switchFlag: 0
  16402. }, {
  16403. qe: 0x1801,
  16404. nmps: 3,
  16405. nlps: 9,
  16406. switchFlag: 0
  16407. }, {
  16408. qe: 0x0ac1,
  16409. nmps: 4,
  16410. nlps: 12,
  16411. switchFlag: 0
  16412. }, {
  16413. qe: 0x0521,
  16414. nmps: 5,
  16415. nlps: 29,
  16416. switchFlag: 0
  16417. }, {
  16418. qe: 0x0221,
  16419. nmps: 38,
  16420. nlps: 33,
  16421. switchFlag: 0
  16422. }, {
  16423. qe: 0x5601,
  16424. nmps: 7,
  16425. nlps: 6,
  16426. switchFlag: 1
  16427. }, {
  16428. qe: 0x5401,
  16429. nmps: 8,
  16430. nlps: 14,
  16431. switchFlag: 0
  16432. }, {
  16433. qe: 0x4801,
  16434. nmps: 9,
  16435. nlps: 14,
  16436. switchFlag: 0
  16437. }, {
  16438. qe: 0x3801,
  16439. nmps: 10,
  16440. nlps: 14,
  16441. switchFlag: 0
  16442. }, {
  16443. qe: 0x3001,
  16444. nmps: 11,
  16445. nlps: 17,
  16446. switchFlag: 0
  16447. }, {
  16448. qe: 0x2401,
  16449. nmps: 12,
  16450. nlps: 18,
  16451. switchFlag: 0
  16452. }, {
  16453. qe: 0x1c01,
  16454. nmps: 13,
  16455. nlps: 20,
  16456. switchFlag: 0
  16457. }, {
  16458. qe: 0x1601,
  16459. nmps: 29,
  16460. nlps: 21,
  16461. switchFlag: 0
  16462. }, {
  16463. qe: 0x5601,
  16464. nmps: 15,
  16465. nlps: 14,
  16466. switchFlag: 1
  16467. }, {
  16468. qe: 0x5401,
  16469. nmps: 16,
  16470. nlps: 14,
  16471. switchFlag: 0
  16472. }, {
  16473. qe: 0x5101,
  16474. nmps: 17,
  16475. nlps: 15,
  16476. switchFlag: 0
  16477. }, {
  16478. qe: 0x4801,
  16479. nmps: 18,
  16480. nlps: 16,
  16481. switchFlag: 0
  16482. }, {
  16483. qe: 0x3801,
  16484. nmps: 19,
  16485. nlps: 17,
  16486. switchFlag: 0
  16487. }, {
  16488. qe: 0x3401,
  16489. nmps: 20,
  16490. nlps: 18,
  16491. switchFlag: 0
  16492. }, {
  16493. qe: 0x3001,
  16494. nmps: 21,
  16495. nlps: 19,
  16496. switchFlag: 0
  16497. }, {
  16498. qe: 0x2801,
  16499. nmps: 22,
  16500. nlps: 19,
  16501. switchFlag: 0
  16502. }, {
  16503. qe: 0x2401,
  16504. nmps: 23,
  16505. nlps: 20,
  16506. switchFlag: 0
  16507. }, {
  16508. qe: 0x2201,
  16509. nmps: 24,
  16510. nlps: 21,
  16511. switchFlag: 0
  16512. }, {
  16513. qe: 0x1c01,
  16514. nmps: 25,
  16515. nlps: 22,
  16516. switchFlag: 0
  16517. }, {
  16518. qe: 0x1801,
  16519. nmps: 26,
  16520. nlps: 23,
  16521. switchFlag: 0
  16522. }, {
  16523. qe: 0x1601,
  16524. nmps: 27,
  16525. nlps: 24,
  16526. switchFlag: 0
  16527. }, {
  16528. qe: 0x1401,
  16529. nmps: 28,
  16530. nlps: 25,
  16531. switchFlag: 0
  16532. }, {
  16533. qe: 0x1201,
  16534. nmps: 29,
  16535. nlps: 26,
  16536. switchFlag: 0
  16537. }, {
  16538. qe: 0x1101,
  16539. nmps: 30,
  16540. nlps: 27,
  16541. switchFlag: 0
  16542. }, {
  16543. qe: 0x0ac1,
  16544. nmps: 31,
  16545. nlps: 28,
  16546. switchFlag: 0
  16547. }, {
  16548. qe: 0x09c1,
  16549. nmps: 32,
  16550. nlps: 29,
  16551. switchFlag: 0
  16552. }, {
  16553. qe: 0x08a1,
  16554. nmps: 33,
  16555. nlps: 30,
  16556. switchFlag: 0
  16557. }, {
  16558. qe: 0x0521,
  16559. nmps: 34,
  16560. nlps: 31,
  16561. switchFlag: 0
  16562. }, {
  16563. qe: 0x0441,
  16564. nmps: 35,
  16565. nlps: 32,
  16566. switchFlag: 0
  16567. }, {
  16568. qe: 0x02a1,
  16569. nmps: 36,
  16570. nlps: 33,
  16571. switchFlag: 0
  16572. }, {
  16573. qe: 0x0221,
  16574. nmps: 37,
  16575. nlps: 34,
  16576. switchFlag: 0
  16577. }, {
  16578. qe: 0x0141,
  16579. nmps: 38,
  16580. nlps: 35,
  16581. switchFlag: 0
  16582. }, {
  16583. qe: 0x0111,
  16584. nmps: 39,
  16585. nlps: 36,
  16586. switchFlag: 0
  16587. }, {
  16588. qe: 0x0085,
  16589. nmps: 40,
  16590. nlps: 37,
  16591. switchFlag: 0
  16592. }, {
  16593. qe: 0x0049,
  16594. nmps: 41,
  16595. nlps: 38,
  16596. switchFlag: 0
  16597. }, {
  16598. qe: 0x0025,
  16599. nmps: 42,
  16600. nlps: 39,
  16601. switchFlag: 0
  16602. }, {
  16603. qe: 0x0015,
  16604. nmps: 43,
  16605. nlps: 40,
  16606. switchFlag: 0
  16607. }, {
  16608. qe: 0x0009,
  16609. nmps: 44,
  16610. nlps: 41,
  16611. switchFlag: 0
  16612. }, {
  16613. qe: 0x0005,
  16614. nmps: 45,
  16615. nlps: 42,
  16616. switchFlag: 0
  16617. }, {
  16618. qe: 0x0001,
  16619. nmps: 45,
  16620. nlps: 43,
  16621. switchFlag: 0
  16622. }, {
  16623. qe: 0x5601,
  16624. nmps: 46,
  16625. nlps: 46,
  16626. switchFlag: 0
  16627. }];
  16628. class ArithmeticDecoder {
  16629. constructor(data, start, end) {
  16630. this.data = data;
  16631. this.bp = start;
  16632. this.dataEnd = end;
  16633. this.chigh = data[start];
  16634. this.clow = 0;
  16635. this.byteIn();
  16636. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  16637. this.clow = this.clow << 7 & 0xffff;
  16638. this.ct -= 7;
  16639. this.a = 0x8000;
  16640. }
  16641. byteIn() {
  16642. const data = this.data;
  16643. let bp = this.bp;
  16644. if (data[bp] === 0xff) {
  16645. if (data[bp + 1] > 0x8f) {
  16646. this.clow += 0xff00;
  16647. this.ct = 8;
  16648. } else {
  16649. bp++;
  16650. this.clow += data[bp] << 9;
  16651. this.ct = 7;
  16652. this.bp = bp;
  16653. }
  16654. } else {
  16655. bp++;
  16656. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  16657. this.ct = 8;
  16658. this.bp = bp;
  16659. }
  16660. if (this.clow > 0xffff) {
  16661. this.chigh += this.clow >> 16;
  16662. this.clow &= 0xffff;
  16663. }
  16664. }
  16665. readBit(contexts, pos) {
  16666. let cx_index = contexts[pos] >> 1,
  16667. cx_mps = contexts[pos] & 1;
  16668. const qeTableIcx = QeTable[cx_index];
  16669. const qeIcx = qeTableIcx.qe;
  16670. let d;
  16671. let a = this.a - qeIcx;
  16672. if (this.chigh < qeIcx) {
  16673. if (a < qeIcx) {
  16674. a = qeIcx;
  16675. d = cx_mps;
  16676. cx_index = qeTableIcx.nmps;
  16677. } else {
  16678. a = qeIcx;
  16679. d = 1 ^ cx_mps;
  16680. if (qeTableIcx.switchFlag === 1) {
  16681. cx_mps = d;
  16682. }
  16683. cx_index = qeTableIcx.nlps;
  16684. }
  16685. } else {
  16686. this.chigh -= qeIcx;
  16687. if ((a & 0x8000) !== 0) {
  16688. this.a = a;
  16689. return cx_mps;
  16690. }
  16691. if (a < qeIcx) {
  16692. d = 1 ^ cx_mps;
  16693. if (qeTableIcx.switchFlag === 1) {
  16694. cx_mps = d;
  16695. }
  16696. cx_index = qeTableIcx.nlps;
  16697. } else {
  16698. d = cx_mps;
  16699. cx_index = qeTableIcx.nmps;
  16700. }
  16701. }
  16702. do {
  16703. if (this.ct === 0) {
  16704. this.byteIn();
  16705. }
  16706. a <<= 1;
  16707. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  16708. this.clow = this.clow << 1 & 0xffff;
  16709. this.ct--;
  16710. } while ((a & 0x8000) === 0);
  16711. this.a = a;
  16712. contexts[pos] = cx_index << 1 | cx_mps;
  16713. return d;
  16714. }
  16715. }
  16716. exports.ArithmeticDecoder = ArithmeticDecoder;
  16717. /***/ }),
  16718. /* 27 */
  16719. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16720. Object.defineProperty(exports, "__esModule", ({
  16721. value: true
  16722. }));
  16723. exports.JpegStream = void 0;
  16724. var _decode_stream = __w_pdfjs_require__(19);
  16725. var _primitives = __w_pdfjs_require__(5);
  16726. var _jpg = __w_pdfjs_require__(28);
  16727. var _util = __w_pdfjs_require__(2);
  16728. class JpegStream extends _decode_stream.DecodeStream {
  16729. constructor(stream, maybeLength, params) {
  16730. let ch;
  16731. while ((ch = stream.getByte()) !== -1) {
  16732. if (ch === 0xff) {
  16733. stream.skip(-1);
  16734. break;
  16735. }
  16736. }
  16737. super(maybeLength);
  16738. this.stream = stream;
  16739. this.dict = stream.dict;
  16740. this.maybeLength = maybeLength;
  16741. this.params = params;
  16742. }
  16743. get bytes() {
  16744. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  16745. }
  16746. ensureBuffer(requested) {}
  16747. readBlock() {
  16748. if (this.eof) {
  16749. return;
  16750. }
  16751. const jpegOptions = {
  16752. decodeTransform: undefined,
  16753. colorTransform: undefined
  16754. };
  16755. const decodeArr = this.dict.getArray("D", "Decode");
  16756. if (this.forceRGB && Array.isArray(decodeArr)) {
  16757. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  16758. const decodeArrLength = decodeArr.length;
  16759. const transform = new Int32Array(decodeArrLength);
  16760. let transformNeeded = false;
  16761. const maxValue = (1 << bitsPerComponent) - 1;
  16762. for (let i = 0; i < decodeArrLength; i += 2) {
  16763. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  16764. transform[i + 1] = decodeArr[i] * maxValue | 0;
  16765. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  16766. transformNeeded = true;
  16767. }
  16768. }
  16769. if (transformNeeded) {
  16770. jpegOptions.decodeTransform = transform;
  16771. }
  16772. }
  16773. if (this.params instanceof _primitives.Dict) {
  16774. const colorTransform = this.params.get("ColorTransform");
  16775. if (Number.isInteger(colorTransform)) {
  16776. jpegOptions.colorTransform = colorTransform;
  16777. }
  16778. }
  16779. const jpegImage = new _jpg.JpegImage(jpegOptions);
  16780. jpegImage.parse(this.bytes);
  16781. const data = jpegImage.getData({
  16782. width: this.drawWidth,
  16783. height: this.drawHeight,
  16784. forceRGB: this.forceRGB,
  16785. isSourcePDF: true
  16786. });
  16787. this.buffer = data;
  16788. this.bufferLength = data.length;
  16789. this.eof = true;
  16790. }
  16791. }
  16792. exports.JpegStream = JpegStream;
  16793. /***/ }),
  16794. /* 28 */
  16795. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16796. Object.defineProperty(exports, "__esModule", ({
  16797. value: true
  16798. }));
  16799. exports.JpegImage = void 0;
  16800. var _util = __w_pdfjs_require__(2);
  16801. var _core_utils = __w_pdfjs_require__(6);
  16802. class JpegError extends _util.BaseException {
  16803. constructor(msg) {
  16804. super(`JPEG error: ${msg}`, "JpegError");
  16805. }
  16806. }
  16807. class DNLMarkerError extends _util.BaseException {
  16808. constructor(message, scanLines) {
  16809. super(message, "DNLMarkerError");
  16810. this.scanLines = scanLines;
  16811. }
  16812. }
  16813. class EOIMarkerError extends _util.BaseException {
  16814. constructor(msg) {
  16815. super(msg, "EOIMarkerError");
  16816. }
  16817. }
  16818. 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]);
  16819. const dctCos1 = 4017;
  16820. const dctSin1 = 799;
  16821. const dctCos3 = 3406;
  16822. const dctSin3 = 2276;
  16823. const dctCos6 = 1567;
  16824. const dctSin6 = 3784;
  16825. const dctSqrt2 = 5793;
  16826. const dctSqrt1d2 = 2896;
  16827. function buildHuffmanTable(codeLengths, values) {
  16828. let k = 0,
  16829. i,
  16830. j,
  16831. length = 16;
  16832. while (length > 0 && !codeLengths[length - 1]) {
  16833. length--;
  16834. }
  16835. const code = [{
  16836. children: [],
  16837. index: 0
  16838. }];
  16839. let p = code[0],
  16840. q;
  16841. for (i = 0; i < length; i++) {
  16842. for (j = 0; j < codeLengths[i]; j++) {
  16843. p = code.pop();
  16844. p.children[p.index] = values[k];
  16845. while (p.index > 0) {
  16846. p = code.pop();
  16847. }
  16848. p.index++;
  16849. code.push(p);
  16850. while (code.length <= i) {
  16851. code.push(q = {
  16852. children: [],
  16853. index: 0
  16854. });
  16855. p.children[p.index] = q.children;
  16856. p = q;
  16857. }
  16858. k++;
  16859. }
  16860. if (i + 1 < length) {
  16861. code.push(q = {
  16862. children: [],
  16863. index: 0
  16864. });
  16865. p.children[p.index] = q.children;
  16866. p = q;
  16867. }
  16868. }
  16869. return code[0].children;
  16870. }
  16871. function getBlockBufferOffset(component, row, col) {
  16872. return 64 * ((component.blocksPerLine + 1) * row + col);
  16873. }
  16874. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  16875. const mcusPerLine = frame.mcusPerLine;
  16876. const progressive = frame.progressive;
  16877. const startOffset = offset;
  16878. let bitsData = 0,
  16879. bitsCount = 0;
  16880. function readBit() {
  16881. if (bitsCount > 0) {
  16882. bitsCount--;
  16883. return bitsData >> bitsCount & 1;
  16884. }
  16885. bitsData = data[offset++];
  16886. if (bitsData === 0xff) {
  16887. const nextByte = data[offset++];
  16888. if (nextByte) {
  16889. if (nextByte === 0xdc && parseDNLMarker) {
  16890. offset += 2;
  16891. const scanLines = (0, _core_utils.readUint16)(data, offset);
  16892. offset += 2;
  16893. if (scanLines > 0 && scanLines !== frame.scanLines) {
  16894. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  16895. }
  16896. } else if (nextByte === 0xd9) {
  16897. if (parseDNLMarker) {
  16898. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  16899. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  16900. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  16901. }
  16902. }
  16903. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  16904. }
  16905. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  16906. }
  16907. }
  16908. bitsCount = 7;
  16909. return bitsData >>> 7;
  16910. }
  16911. function decodeHuffman(tree) {
  16912. let node = tree;
  16913. while (true) {
  16914. node = node[readBit()];
  16915. switch (typeof node) {
  16916. case "number":
  16917. return node;
  16918. case "object":
  16919. continue;
  16920. }
  16921. throw new JpegError("invalid huffman sequence");
  16922. }
  16923. }
  16924. function receive(length) {
  16925. let n = 0;
  16926. while (length > 0) {
  16927. n = n << 1 | readBit();
  16928. length--;
  16929. }
  16930. return n;
  16931. }
  16932. function receiveAndExtend(length) {
  16933. if (length === 1) {
  16934. return readBit() === 1 ? 1 : -1;
  16935. }
  16936. const n = receive(length);
  16937. if (n >= 1 << length - 1) {
  16938. return n;
  16939. }
  16940. return n + (-1 << length) + 1;
  16941. }
  16942. function decodeBaseline(component, blockOffset) {
  16943. const t = decodeHuffman(component.huffmanTableDC);
  16944. const diff = t === 0 ? 0 : receiveAndExtend(t);
  16945. component.blockData[blockOffset] = component.pred += diff;
  16946. let k = 1;
  16947. while (k < 64) {
  16948. const rs = decodeHuffman(component.huffmanTableAC);
  16949. const s = rs & 15,
  16950. r = rs >> 4;
  16951. if (s === 0) {
  16952. if (r < 15) {
  16953. break;
  16954. }
  16955. k += 16;
  16956. continue;
  16957. }
  16958. k += r;
  16959. const z = dctZigZag[k];
  16960. component.blockData[blockOffset + z] = receiveAndExtend(s);
  16961. k++;
  16962. }
  16963. }
  16964. function decodeDCFirst(component, blockOffset) {
  16965. const t = decodeHuffman(component.huffmanTableDC);
  16966. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  16967. component.blockData[blockOffset] = component.pred += diff;
  16968. }
  16969. function decodeDCSuccessive(component, blockOffset) {
  16970. component.blockData[blockOffset] |= readBit() << successive;
  16971. }
  16972. let eobrun = 0;
  16973. function decodeACFirst(component, blockOffset) {
  16974. if (eobrun > 0) {
  16975. eobrun--;
  16976. return;
  16977. }
  16978. let k = spectralStart;
  16979. const e = spectralEnd;
  16980. while (k <= e) {
  16981. const rs = decodeHuffman(component.huffmanTableAC);
  16982. const s = rs & 15,
  16983. r = rs >> 4;
  16984. if (s === 0) {
  16985. if (r < 15) {
  16986. eobrun = receive(r) + (1 << r) - 1;
  16987. break;
  16988. }
  16989. k += 16;
  16990. continue;
  16991. }
  16992. k += r;
  16993. const z = dctZigZag[k];
  16994. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  16995. k++;
  16996. }
  16997. }
  16998. let successiveACState = 0,
  16999. successiveACNextValue;
  17000. function decodeACSuccessive(component, blockOffset) {
  17001. let k = spectralStart;
  17002. const e = spectralEnd;
  17003. let r = 0;
  17004. let s;
  17005. let rs;
  17006. while (k <= e) {
  17007. const offsetZ = blockOffset + dctZigZag[k];
  17008. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  17009. switch (successiveACState) {
  17010. case 0:
  17011. rs = decodeHuffman(component.huffmanTableAC);
  17012. s = rs & 15;
  17013. r = rs >> 4;
  17014. if (s === 0) {
  17015. if (r < 15) {
  17016. eobrun = receive(r) + (1 << r);
  17017. successiveACState = 4;
  17018. } else {
  17019. r = 16;
  17020. successiveACState = 1;
  17021. }
  17022. } else {
  17023. if (s !== 1) {
  17024. throw new JpegError("invalid ACn encoding");
  17025. }
  17026. successiveACNextValue = receiveAndExtend(s);
  17027. successiveACState = r ? 2 : 3;
  17028. }
  17029. continue;
  17030. case 1:
  17031. case 2:
  17032. if (component.blockData[offsetZ]) {
  17033. component.blockData[offsetZ] += sign * (readBit() << successive);
  17034. } else {
  17035. r--;
  17036. if (r === 0) {
  17037. successiveACState = successiveACState === 2 ? 3 : 0;
  17038. }
  17039. }
  17040. break;
  17041. case 3:
  17042. if (component.blockData[offsetZ]) {
  17043. component.blockData[offsetZ] += sign * (readBit() << successive);
  17044. } else {
  17045. component.blockData[offsetZ] = successiveACNextValue << successive;
  17046. successiveACState = 0;
  17047. }
  17048. break;
  17049. case 4:
  17050. if (component.blockData[offsetZ]) {
  17051. component.blockData[offsetZ] += sign * (readBit() << successive);
  17052. }
  17053. break;
  17054. }
  17055. k++;
  17056. }
  17057. if (successiveACState === 4) {
  17058. eobrun--;
  17059. if (eobrun === 0) {
  17060. successiveACState = 0;
  17061. }
  17062. }
  17063. }
  17064. let blockRow = 0;
  17065. function decodeMcu(component, decode, mcu, row, col) {
  17066. const mcuRow = mcu / mcusPerLine | 0;
  17067. const mcuCol = mcu % mcusPerLine;
  17068. blockRow = mcuRow * component.v + row;
  17069. const blockCol = mcuCol * component.h + col;
  17070. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17071. decode(component, blockOffset);
  17072. }
  17073. function decodeBlock(component, decode, mcu) {
  17074. blockRow = mcu / component.blocksPerLine | 0;
  17075. const blockCol = mcu % component.blocksPerLine;
  17076. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  17077. decode(component, blockOffset);
  17078. }
  17079. const componentsLength = components.length;
  17080. let component, i, j, k, n;
  17081. let decodeFn;
  17082. if (progressive) {
  17083. if (spectralStart === 0) {
  17084. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  17085. } else {
  17086. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  17087. }
  17088. } else {
  17089. decodeFn = decodeBaseline;
  17090. }
  17091. let mcu = 0,
  17092. fileMarker;
  17093. let mcuExpected;
  17094. if (componentsLength === 1) {
  17095. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  17096. } else {
  17097. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  17098. }
  17099. let h, v;
  17100. while (mcu <= mcuExpected) {
  17101. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  17102. if (mcuToRead > 0) {
  17103. for (i = 0; i < componentsLength; i++) {
  17104. components[i].pred = 0;
  17105. }
  17106. eobrun = 0;
  17107. if (componentsLength === 1) {
  17108. component = components[0];
  17109. for (n = 0; n < mcuToRead; n++) {
  17110. decodeBlock(component, decodeFn, mcu);
  17111. mcu++;
  17112. }
  17113. } else {
  17114. for (n = 0; n < mcuToRead; n++) {
  17115. for (i = 0; i < componentsLength; i++) {
  17116. component = components[i];
  17117. h = component.h;
  17118. v = component.v;
  17119. for (j = 0; j < v; j++) {
  17120. for (k = 0; k < h; k++) {
  17121. decodeMcu(component, decodeFn, mcu, j, k);
  17122. }
  17123. }
  17124. }
  17125. mcu++;
  17126. }
  17127. }
  17128. }
  17129. bitsCount = 0;
  17130. fileMarker = findNextFileMarker(data, offset);
  17131. if (!fileMarker) {
  17132. break;
  17133. }
  17134. if (fileMarker.invalid) {
  17135. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  17136. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  17137. offset = fileMarker.offset;
  17138. }
  17139. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  17140. offset += 2;
  17141. } else {
  17142. break;
  17143. }
  17144. }
  17145. return offset - startOffset;
  17146. }
  17147. function quantizeAndInverse(component, blockBufferOffset, p) {
  17148. const qt = component.quantizationTable,
  17149. blockData = component.blockData;
  17150. let v0, v1, v2, v3, v4, v5, v6, v7;
  17151. let p0, p1, p2, p3, p4, p5, p6, p7;
  17152. let t;
  17153. if (!qt) {
  17154. throw new JpegError("missing required Quantization Table.");
  17155. }
  17156. for (let row = 0; row < 64; row += 8) {
  17157. p0 = blockData[blockBufferOffset + row];
  17158. p1 = blockData[blockBufferOffset + row + 1];
  17159. p2 = blockData[blockBufferOffset + row + 2];
  17160. p3 = blockData[blockBufferOffset + row + 3];
  17161. p4 = blockData[blockBufferOffset + row + 4];
  17162. p5 = blockData[blockBufferOffset + row + 5];
  17163. p6 = blockData[blockBufferOffset + row + 6];
  17164. p7 = blockData[blockBufferOffset + row + 7];
  17165. p0 *= qt[row];
  17166. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17167. t = dctSqrt2 * p0 + 512 >> 10;
  17168. p[row] = t;
  17169. p[row + 1] = t;
  17170. p[row + 2] = t;
  17171. p[row + 3] = t;
  17172. p[row + 4] = t;
  17173. p[row + 5] = t;
  17174. p[row + 6] = t;
  17175. p[row + 7] = t;
  17176. continue;
  17177. }
  17178. p1 *= qt[row + 1];
  17179. p2 *= qt[row + 2];
  17180. p3 *= qt[row + 3];
  17181. p4 *= qt[row + 4];
  17182. p5 *= qt[row + 5];
  17183. p6 *= qt[row + 6];
  17184. p7 *= qt[row + 7];
  17185. v0 = dctSqrt2 * p0 + 128 >> 8;
  17186. v1 = dctSqrt2 * p4 + 128 >> 8;
  17187. v2 = p2;
  17188. v3 = p6;
  17189. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  17190. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  17191. v5 = p3 << 4;
  17192. v6 = p5 << 4;
  17193. v0 = v0 + v1 + 1 >> 1;
  17194. v1 = v0 - v1;
  17195. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  17196. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  17197. v3 = t;
  17198. v4 = v4 + v6 + 1 >> 1;
  17199. v6 = v4 - v6;
  17200. v7 = v7 + v5 + 1 >> 1;
  17201. v5 = v7 - v5;
  17202. v0 = v0 + v3 + 1 >> 1;
  17203. v3 = v0 - v3;
  17204. v1 = v1 + v2 + 1 >> 1;
  17205. v2 = v1 - v2;
  17206. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17207. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17208. v7 = t;
  17209. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17210. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17211. v6 = t;
  17212. p[row] = v0 + v7;
  17213. p[row + 7] = v0 - v7;
  17214. p[row + 1] = v1 + v6;
  17215. p[row + 6] = v1 - v6;
  17216. p[row + 2] = v2 + v5;
  17217. p[row + 5] = v2 - v5;
  17218. p[row + 3] = v3 + v4;
  17219. p[row + 4] = v3 - v4;
  17220. }
  17221. for (let col = 0; col < 8; ++col) {
  17222. p0 = p[col];
  17223. p1 = p[col + 8];
  17224. p2 = p[col + 16];
  17225. p3 = p[col + 24];
  17226. p4 = p[col + 32];
  17227. p5 = p[col + 40];
  17228. p6 = p[col + 48];
  17229. p7 = p[col + 56];
  17230. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  17231. t = dctSqrt2 * p0 + 8192 >> 14;
  17232. if (t < -2040) {
  17233. t = 0;
  17234. } else if (t >= 2024) {
  17235. t = 255;
  17236. } else {
  17237. t = t + 2056 >> 4;
  17238. }
  17239. blockData[blockBufferOffset + col] = t;
  17240. blockData[blockBufferOffset + col + 8] = t;
  17241. blockData[blockBufferOffset + col + 16] = t;
  17242. blockData[blockBufferOffset + col + 24] = t;
  17243. blockData[blockBufferOffset + col + 32] = t;
  17244. blockData[blockBufferOffset + col + 40] = t;
  17245. blockData[blockBufferOffset + col + 48] = t;
  17246. blockData[blockBufferOffset + col + 56] = t;
  17247. continue;
  17248. }
  17249. v0 = dctSqrt2 * p0 + 2048 >> 12;
  17250. v1 = dctSqrt2 * p4 + 2048 >> 12;
  17251. v2 = p2;
  17252. v3 = p6;
  17253. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  17254. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  17255. v5 = p3;
  17256. v6 = p5;
  17257. v0 = (v0 + v1 + 1 >> 1) + 4112;
  17258. v1 = v0 - v1;
  17259. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  17260. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  17261. v3 = t;
  17262. v4 = v4 + v6 + 1 >> 1;
  17263. v6 = v4 - v6;
  17264. v7 = v7 + v5 + 1 >> 1;
  17265. v5 = v7 - v5;
  17266. v0 = v0 + v3 + 1 >> 1;
  17267. v3 = v0 - v3;
  17268. v1 = v1 + v2 + 1 >> 1;
  17269. v2 = v1 - v2;
  17270. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  17271. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  17272. v7 = t;
  17273. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  17274. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  17275. v6 = t;
  17276. p0 = v0 + v7;
  17277. p7 = v0 - v7;
  17278. p1 = v1 + v6;
  17279. p6 = v1 - v6;
  17280. p2 = v2 + v5;
  17281. p5 = v2 - v5;
  17282. p3 = v3 + v4;
  17283. p4 = v3 - v4;
  17284. if (p0 < 16) {
  17285. p0 = 0;
  17286. } else if (p0 >= 4080) {
  17287. p0 = 255;
  17288. } else {
  17289. p0 >>= 4;
  17290. }
  17291. if (p1 < 16) {
  17292. p1 = 0;
  17293. } else if (p1 >= 4080) {
  17294. p1 = 255;
  17295. } else {
  17296. p1 >>= 4;
  17297. }
  17298. if (p2 < 16) {
  17299. p2 = 0;
  17300. } else if (p2 >= 4080) {
  17301. p2 = 255;
  17302. } else {
  17303. p2 >>= 4;
  17304. }
  17305. if (p3 < 16) {
  17306. p3 = 0;
  17307. } else if (p3 >= 4080) {
  17308. p3 = 255;
  17309. } else {
  17310. p3 >>= 4;
  17311. }
  17312. if (p4 < 16) {
  17313. p4 = 0;
  17314. } else if (p4 >= 4080) {
  17315. p4 = 255;
  17316. } else {
  17317. p4 >>= 4;
  17318. }
  17319. if (p5 < 16) {
  17320. p5 = 0;
  17321. } else if (p5 >= 4080) {
  17322. p5 = 255;
  17323. } else {
  17324. p5 >>= 4;
  17325. }
  17326. if (p6 < 16) {
  17327. p6 = 0;
  17328. } else if (p6 >= 4080) {
  17329. p6 = 255;
  17330. } else {
  17331. p6 >>= 4;
  17332. }
  17333. if (p7 < 16) {
  17334. p7 = 0;
  17335. } else if (p7 >= 4080) {
  17336. p7 = 255;
  17337. } else {
  17338. p7 >>= 4;
  17339. }
  17340. blockData[blockBufferOffset + col] = p0;
  17341. blockData[blockBufferOffset + col + 8] = p1;
  17342. blockData[blockBufferOffset + col + 16] = p2;
  17343. blockData[blockBufferOffset + col + 24] = p3;
  17344. blockData[blockBufferOffset + col + 32] = p4;
  17345. blockData[blockBufferOffset + col + 40] = p5;
  17346. blockData[blockBufferOffset + col + 48] = p6;
  17347. blockData[blockBufferOffset + col + 56] = p7;
  17348. }
  17349. }
  17350. function buildComponentData(frame, component) {
  17351. const blocksPerLine = component.blocksPerLine;
  17352. const blocksPerColumn = component.blocksPerColumn;
  17353. const computationBuffer = new Int16Array(64);
  17354. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  17355. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  17356. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  17357. quantizeAndInverse(component, offset, computationBuffer);
  17358. }
  17359. }
  17360. return component.blockData;
  17361. }
  17362. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  17363. const maxPos = data.length - 1;
  17364. let newPos = startPos < currentPos ? startPos : currentPos;
  17365. if (currentPos >= maxPos) {
  17366. return null;
  17367. }
  17368. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  17369. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  17370. return {
  17371. invalid: null,
  17372. marker: currentMarker,
  17373. offset: currentPos
  17374. };
  17375. }
  17376. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  17377. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  17378. if (++newPos >= maxPos) {
  17379. return null;
  17380. }
  17381. newMarker = (0, _core_utils.readUint16)(data, newPos);
  17382. }
  17383. return {
  17384. invalid: currentMarker.toString(16),
  17385. marker: newMarker,
  17386. offset: newPos
  17387. };
  17388. }
  17389. class JpegImage {
  17390. constructor({
  17391. decodeTransform = null,
  17392. colorTransform = -1
  17393. } = {}) {
  17394. this._decodeTransform = decodeTransform;
  17395. this._colorTransform = colorTransform;
  17396. }
  17397. parse(data, {
  17398. dnlScanLines = null
  17399. } = {}) {
  17400. function readDataBlock() {
  17401. const length = (0, _core_utils.readUint16)(data, offset);
  17402. offset += 2;
  17403. let endOffset = offset + length - 2;
  17404. const fileMarker = findNextFileMarker(data, endOffset, offset);
  17405. if (fileMarker && fileMarker.invalid) {
  17406. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  17407. endOffset = fileMarker.offset;
  17408. }
  17409. const array = data.subarray(offset, endOffset);
  17410. offset += array.length;
  17411. return array;
  17412. }
  17413. function prepareComponents(frame) {
  17414. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  17415. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  17416. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  17417. const component = frame.components[i];
  17418. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  17419. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  17420. const blocksPerLineForMcu = mcusPerLine * component.h;
  17421. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  17422. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  17423. component.blockData = new Int16Array(blocksBufferSize);
  17424. component.blocksPerLine = blocksPerLine;
  17425. component.blocksPerColumn = blocksPerColumn;
  17426. }
  17427. frame.mcusPerLine = mcusPerLine;
  17428. frame.mcusPerColumn = mcusPerColumn;
  17429. }
  17430. let offset = 0;
  17431. let jfif = null;
  17432. let adobe = null;
  17433. let frame, resetInterval;
  17434. let numSOSMarkers = 0;
  17435. const quantizationTables = [];
  17436. const huffmanTablesAC = [],
  17437. huffmanTablesDC = [];
  17438. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  17439. offset += 2;
  17440. if (fileMarker !== 0xffd8) {
  17441. throw new JpegError("SOI not found");
  17442. }
  17443. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17444. offset += 2;
  17445. markerLoop: while (fileMarker !== 0xffd9) {
  17446. let i, j, l;
  17447. switch (fileMarker) {
  17448. case 0xffe0:
  17449. case 0xffe1:
  17450. case 0xffe2:
  17451. case 0xffe3:
  17452. case 0xffe4:
  17453. case 0xffe5:
  17454. case 0xffe6:
  17455. case 0xffe7:
  17456. case 0xffe8:
  17457. case 0xffe9:
  17458. case 0xffea:
  17459. case 0xffeb:
  17460. case 0xffec:
  17461. case 0xffed:
  17462. case 0xffee:
  17463. case 0xffef:
  17464. case 0xfffe:
  17465. const appData = readDataBlock();
  17466. if (fileMarker === 0xffe0) {
  17467. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  17468. jfif = {
  17469. version: {
  17470. major: appData[5],
  17471. minor: appData[6]
  17472. },
  17473. densityUnits: appData[7],
  17474. xDensity: appData[8] << 8 | appData[9],
  17475. yDensity: appData[10] << 8 | appData[11],
  17476. thumbWidth: appData[12],
  17477. thumbHeight: appData[13],
  17478. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  17479. };
  17480. }
  17481. }
  17482. if (fileMarker === 0xffee) {
  17483. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  17484. adobe = {
  17485. version: appData[5] << 8 | appData[6],
  17486. flags0: appData[7] << 8 | appData[8],
  17487. flags1: appData[9] << 8 | appData[10],
  17488. transformCode: appData[11]
  17489. };
  17490. }
  17491. }
  17492. break;
  17493. case 0xffdb:
  17494. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  17495. offset += 2;
  17496. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  17497. let z;
  17498. while (offset < quantizationTablesEnd) {
  17499. const quantizationTableSpec = data[offset++];
  17500. const tableData = new Uint16Array(64);
  17501. if (quantizationTableSpec >> 4 === 0) {
  17502. for (j = 0; j < 64; j++) {
  17503. z = dctZigZag[j];
  17504. tableData[z] = data[offset++];
  17505. }
  17506. } else if (quantizationTableSpec >> 4 === 1) {
  17507. for (j = 0; j < 64; j++) {
  17508. z = dctZigZag[j];
  17509. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  17510. offset += 2;
  17511. }
  17512. } else {
  17513. throw new JpegError("DQT - invalid table spec");
  17514. }
  17515. quantizationTables[quantizationTableSpec & 15] = tableData;
  17516. }
  17517. break;
  17518. case 0xffc0:
  17519. case 0xffc1:
  17520. case 0xffc2:
  17521. if (frame) {
  17522. throw new JpegError("Only single frame JPEGs supported");
  17523. }
  17524. offset += 2;
  17525. frame = {};
  17526. frame.extended = fileMarker === 0xffc1;
  17527. frame.progressive = fileMarker === 0xffc2;
  17528. frame.precision = data[offset++];
  17529. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  17530. offset += 2;
  17531. frame.scanLines = dnlScanLines || sofScanLines;
  17532. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  17533. offset += 2;
  17534. frame.components = [];
  17535. frame.componentIds = {};
  17536. const componentsCount = data[offset++];
  17537. let maxH = 0,
  17538. maxV = 0;
  17539. for (i = 0; i < componentsCount; i++) {
  17540. const componentId = data[offset];
  17541. const h = data[offset + 1] >> 4;
  17542. const v = data[offset + 1] & 15;
  17543. if (maxH < h) {
  17544. maxH = h;
  17545. }
  17546. if (maxV < v) {
  17547. maxV = v;
  17548. }
  17549. const qId = data[offset + 2];
  17550. l = frame.components.push({
  17551. h,
  17552. v,
  17553. quantizationId: qId,
  17554. quantizationTable: null
  17555. });
  17556. frame.componentIds[componentId] = l - 1;
  17557. offset += 3;
  17558. }
  17559. frame.maxH = maxH;
  17560. frame.maxV = maxV;
  17561. prepareComponents(frame);
  17562. break;
  17563. case 0xffc4:
  17564. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  17565. offset += 2;
  17566. for (i = 2; i < huffmanLength;) {
  17567. const huffmanTableSpec = data[offset++];
  17568. const codeLengths = new Uint8Array(16);
  17569. let codeLengthSum = 0;
  17570. for (j = 0; j < 16; j++, offset++) {
  17571. codeLengthSum += codeLengths[j] = data[offset];
  17572. }
  17573. const huffmanValues = new Uint8Array(codeLengthSum);
  17574. for (j = 0; j < codeLengthSum; j++, offset++) {
  17575. huffmanValues[j] = data[offset];
  17576. }
  17577. i += 17 + codeLengthSum;
  17578. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  17579. }
  17580. break;
  17581. case 0xffdd:
  17582. offset += 2;
  17583. resetInterval = (0, _core_utils.readUint16)(data, offset);
  17584. offset += 2;
  17585. break;
  17586. case 0xffda:
  17587. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  17588. offset += 2;
  17589. const selectorsCount = data[offset++],
  17590. components = [];
  17591. for (i = 0; i < selectorsCount; i++) {
  17592. const index = data[offset++];
  17593. const componentIndex = frame.componentIds[index];
  17594. const component = frame.components[componentIndex];
  17595. component.index = index;
  17596. const tableSpec = data[offset++];
  17597. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  17598. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  17599. components.push(component);
  17600. }
  17601. const spectralStart = data[offset++],
  17602. spectralEnd = data[offset++],
  17603. successiveApproximation = data[offset++];
  17604. try {
  17605. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  17606. offset += processed;
  17607. } catch (ex) {
  17608. if (ex instanceof DNLMarkerError) {
  17609. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  17610. return this.parse(data, {
  17611. dnlScanLines: ex.scanLines
  17612. });
  17613. } else if (ex instanceof EOIMarkerError) {
  17614. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  17615. break markerLoop;
  17616. }
  17617. throw ex;
  17618. }
  17619. break;
  17620. case 0xffdc:
  17621. offset += 4;
  17622. break;
  17623. case 0xffff:
  17624. if (data[offset] !== 0xff) {
  17625. offset--;
  17626. }
  17627. break;
  17628. default:
  17629. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  17630. if (nextFileMarker && nextFileMarker.invalid) {
  17631. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  17632. offset = nextFileMarker.offset;
  17633. break;
  17634. }
  17635. if (!nextFileMarker || offset >= data.length - 1) {
  17636. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  17637. break markerLoop;
  17638. }
  17639. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  17640. }
  17641. fileMarker = (0, _core_utils.readUint16)(data, offset);
  17642. offset += 2;
  17643. }
  17644. this.width = frame.samplesPerLine;
  17645. this.height = frame.scanLines;
  17646. this.jfif = jfif;
  17647. this.adobe = adobe;
  17648. this.components = [];
  17649. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  17650. const component = frame.components[i];
  17651. const quantizationTable = quantizationTables[component.quantizationId];
  17652. if (quantizationTable) {
  17653. component.quantizationTable = quantizationTable;
  17654. }
  17655. this.components.push({
  17656. index: component.index,
  17657. output: buildComponentData(frame, component),
  17658. scaleX: component.h / frame.maxH,
  17659. scaleY: component.v / frame.maxV,
  17660. blocksPerLine: component.blocksPerLine,
  17661. blocksPerColumn: component.blocksPerColumn
  17662. });
  17663. }
  17664. this.numComponents = this.components.length;
  17665. return undefined;
  17666. }
  17667. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  17668. const scaleX = this.width / width,
  17669. scaleY = this.height / height;
  17670. let component, componentScaleX, componentScaleY, blocksPerScanline;
  17671. let x, y, i, j, k;
  17672. let index;
  17673. let offset = 0;
  17674. let output;
  17675. const numComponents = this.components.length;
  17676. const dataLength = width * height * numComponents;
  17677. const data = new Uint8ClampedArray(dataLength);
  17678. const xScaleBlockOffset = new Uint32Array(width);
  17679. const mask3LSB = 0xfffffff8;
  17680. let lastComponentScaleX;
  17681. for (i = 0; i < numComponents; i++) {
  17682. component = this.components[i];
  17683. componentScaleX = component.scaleX * scaleX;
  17684. componentScaleY = component.scaleY * scaleY;
  17685. offset = i;
  17686. output = component.output;
  17687. blocksPerScanline = component.blocksPerLine + 1 << 3;
  17688. if (componentScaleX !== lastComponentScaleX) {
  17689. for (x = 0; x < width; x++) {
  17690. j = 0 | x * componentScaleX;
  17691. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  17692. }
  17693. lastComponentScaleX = componentScaleX;
  17694. }
  17695. for (y = 0; y < height; y++) {
  17696. j = 0 | y * componentScaleY;
  17697. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  17698. for (x = 0; x < width; x++) {
  17699. data[offset] = output[index + xScaleBlockOffset[x]];
  17700. offset += numComponents;
  17701. }
  17702. }
  17703. }
  17704. let transform = this._decodeTransform;
  17705. if (!isSourcePDF && numComponents === 4 && !transform) {
  17706. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  17707. }
  17708. if (transform) {
  17709. for (i = 0; i < dataLength;) {
  17710. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  17711. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  17712. }
  17713. }
  17714. }
  17715. return data;
  17716. }
  17717. get _isColorConversionNeeded() {
  17718. if (this.adobe) {
  17719. return !!this.adobe.transformCode;
  17720. }
  17721. if (this.numComponents === 3) {
  17722. if (this._colorTransform === 0) {
  17723. return false;
  17724. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  17725. return false;
  17726. }
  17727. return true;
  17728. }
  17729. if (this._colorTransform === 1) {
  17730. return true;
  17731. }
  17732. return false;
  17733. }
  17734. _convertYccToRgb(data) {
  17735. let Y, Cb, Cr;
  17736. for (let i = 0, length = data.length; i < length; i += 3) {
  17737. Y = data[i];
  17738. Cb = data[i + 1];
  17739. Cr = data[i + 2];
  17740. data[i] = Y - 179.456 + 1.402 * Cr;
  17741. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  17742. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  17743. }
  17744. return data;
  17745. }
  17746. _convertYcckToRgb(data) {
  17747. let Y, Cb, Cr, k;
  17748. let offset = 0;
  17749. for (let i = 0, length = data.length; i < length; i += 4) {
  17750. Y = data[i];
  17751. Cb = data[i + 1];
  17752. Cr = data[i + 2];
  17753. k = data[i + 3];
  17754. 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);
  17755. 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);
  17756. 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);
  17757. }
  17758. return data.subarray(0, offset);
  17759. }
  17760. _convertYcckToCmyk(data) {
  17761. let Y, Cb, Cr;
  17762. for (let i = 0, length = data.length; i < length; i += 4) {
  17763. Y = data[i];
  17764. Cb = data[i + 1];
  17765. Cr = data[i + 2];
  17766. data[i] = 434.456 - Y - 1.402 * Cr;
  17767. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  17768. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  17769. }
  17770. return data;
  17771. }
  17772. _convertCmykToRgb(data) {
  17773. let c, m, y, k;
  17774. let offset = 0;
  17775. for (let i = 0, length = data.length; i < length; i += 4) {
  17776. c = data[i];
  17777. m = data[i + 1];
  17778. y = data[i + 2];
  17779. k = data[i + 3];
  17780. 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);
  17781. 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);
  17782. 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);
  17783. }
  17784. return data.subarray(0, offset);
  17785. }
  17786. getData({
  17787. width,
  17788. height,
  17789. forceRGB = false,
  17790. isSourcePDF = false
  17791. }) {
  17792. if (this.numComponents > 4) {
  17793. throw new JpegError("Unsupported color mode");
  17794. }
  17795. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  17796. if (this.numComponents === 1 && forceRGB) {
  17797. const dataLength = data.length;
  17798. const rgbData = new Uint8ClampedArray(dataLength * 3);
  17799. let offset = 0;
  17800. for (let i = 0; i < dataLength; i++) {
  17801. const grayColor = data[i];
  17802. rgbData[offset++] = grayColor;
  17803. rgbData[offset++] = grayColor;
  17804. rgbData[offset++] = grayColor;
  17805. }
  17806. return rgbData;
  17807. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  17808. return this._convertYccToRgb(data);
  17809. } else if (this.numComponents === 4) {
  17810. if (this._isColorConversionNeeded) {
  17811. if (forceRGB) {
  17812. return this._convertYcckToRgb(data);
  17813. }
  17814. return this._convertYcckToCmyk(data);
  17815. } else if (forceRGB) {
  17816. return this._convertCmykToRgb(data);
  17817. }
  17818. }
  17819. return data;
  17820. }
  17821. }
  17822. exports.JpegImage = JpegImage;
  17823. /***/ }),
  17824. /* 29 */
  17825. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17826. Object.defineProperty(exports, "__esModule", ({
  17827. value: true
  17828. }));
  17829. exports.JpxStream = void 0;
  17830. var _decode_stream = __w_pdfjs_require__(19);
  17831. var _jpx = __w_pdfjs_require__(30);
  17832. var _util = __w_pdfjs_require__(2);
  17833. class JpxStream extends _decode_stream.DecodeStream {
  17834. constructor(stream, maybeLength, params) {
  17835. super(maybeLength);
  17836. this.stream = stream;
  17837. this.dict = stream.dict;
  17838. this.maybeLength = maybeLength;
  17839. this.params = params;
  17840. }
  17841. get bytes() {
  17842. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  17843. }
  17844. ensureBuffer(requested) {}
  17845. readBlock() {
  17846. if (this.eof) {
  17847. return;
  17848. }
  17849. const jpxImage = new _jpx.JpxImage();
  17850. jpxImage.parse(this.bytes);
  17851. const width = jpxImage.width;
  17852. const height = jpxImage.height;
  17853. const componentsCount = jpxImage.componentsCount;
  17854. const tileCount = jpxImage.tiles.length;
  17855. if (tileCount === 1) {
  17856. this.buffer = jpxImage.tiles[0].items;
  17857. } else {
  17858. const data = new Uint8ClampedArray(width * height * componentsCount);
  17859. for (let k = 0; k < tileCount; k++) {
  17860. const tileComponents = jpxImage.tiles[k];
  17861. const tileWidth = tileComponents.width;
  17862. const tileHeight = tileComponents.height;
  17863. const tileLeft = tileComponents.left;
  17864. const tileTop = tileComponents.top;
  17865. const src = tileComponents.items;
  17866. let srcPosition = 0;
  17867. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  17868. const imgRowSize = width * componentsCount;
  17869. const tileRowSize = tileWidth * componentsCount;
  17870. for (let j = 0; j < tileHeight; j++) {
  17871. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  17872. data.set(rowBytes, dataPosition);
  17873. srcPosition += tileRowSize;
  17874. dataPosition += imgRowSize;
  17875. }
  17876. }
  17877. this.buffer = data;
  17878. }
  17879. this.bufferLength = this.buffer.length;
  17880. this.eof = true;
  17881. }
  17882. }
  17883. exports.JpxStream = JpxStream;
  17884. /***/ }),
  17885. /* 30 */
  17886. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17887. Object.defineProperty(exports, "__esModule", ({
  17888. value: true
  17889. }));
  17890. exports.JpxImage = void 0;
  17891. var _util = __w_pdfjs_require__(2);
  17892. var _core_utils = __w_pdfjs_require__(6);
  17893. var _arithmetic_decoder = __w_pdfjs_require__(26);
  17894. class JpxError extends _util.BaseException {
  17895. constructor(msg) {
  17896. super(`JPX error: ${msg}`, "JpxError");
  17897. }
  17898. }
  17899. const SubbandsGainLog2 = {
  17900. LL: 0,
  17901. LH: 1,
  17902. HL: 1,
  17903. HH: 2
  17904. };
  17905. class JpxImage {
  17906. constructor() {
  17907. this.failOnCorruptedImage = false;
  17908. }
  17909. parse(data) {
  17910. const head = (0, _core_utils.readUint16)(data, 0);
  17911. if (head === 0xff4f) {
  17912. this.parseCodestream(data, 0, data.length);
  17913. return;
  17914. }
  17915. const length = data.length;
  17916. let position = 0;
  17917. while (position < length) {
  17918. let headerSize = 8;
  17919. let lbox = (0, _core_utils.readUint32)(data, position);
  17920. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  17921. position += headerSize;
  17922. if (lbox === 1) {
  17923. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  17924. position += 8;
  17925. headerSize += 8;
  17926. }
  17927. if (lbox === 0) {
  17928. lbox = length - position + headerSize;
  17929. }
  17930. if (lbox < headerSize) {
  17931. throw new JpxError("Invalid box field size");
  17932. }
  17933. const dataLength = lbox - headerSize;
  17934. let jumpDataLength = true;
  17935. switch (tbox) {
  17936. case 0x6a703268:
  17937. jumpDataLength = false;
  17938. break;
  17939. case 0x636f6c72:
  17940. const method = data[position];
  17941. if (method === 1) {
  17942. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  17943. switch (colorspace) {
  17944. case 16:
  17945. case 17:
  17946. case 18:
  17947. break;
  17948. default:
  17949. (0, _util.warn)("Unknown colorspace " + colorspace);
  17950. break;
  17951. }
  17952. } else if (method === 2) {
  17953. (0, _util.info)("ICC profile not supported");
  17954. }
  17955. break;
  17956. case 0x6a703263:
  17957. this.parseCodestream(data, position, position + dataLength);
  17958. break;
  17959. case 0x6a502020:
  17960. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  17961. (0, _util.warn)("Invalid JP2 signature");
  17962. }
  17963. break;
  17964. case 0x6a501a1a:
  17965. case 0x66747970:
  17966. case 0x72726571:
  17967. case 0x72657320:
  17968. case 0x69686472:
  17969. break;
  17970. default:
  17971. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  17972. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  17973. break;
  17974. }
  17975. if (jumpDataLength) {
  17976. position += dataLength;
  17977. }
  17978. }
  17979. }
  17980. parseImageProperties(stream) {
  17981. let newByte = stream.getByte();
  17982. while (newByte >= 0) {
  17983. const oldByte = newByte;
  17984. newByte = stream.getByte();
  17985. const code = oldByte << 8 | newByte;
  17986. if (code === 0xff51) {
  17987. stream.skip(4);
  17988. const Xsiz = stream.getInt32() >>> 0;
  17989. const Ysiz = stream.getInt32() >>> 0;
  17990. const XOsiz = stream.getInt32() >>> 0;
  17991. const YOsiz = stream.getInt32() >>> 0;
  17992. stream.skip(16);
  17993. const Csiz = stream.getUint16();
  17994. this.width = Xsiz - XOsiz;
  17995. this.height = Ysiz - YOsiz;
  17996. this.componentsCount = Csiz;
  17997. this.bitsPerComponent = 8;
  17998. return;
  17999. }
  18000. }
  18001. throw new JpxError("No size marker found in JPX stream");
  18002. }
  18003. parseCodestream(data, start, end) {
  18004. const context = {};
  18005. let doNotRecover = false;
  18006. try {
  18007. let position = start;
  18008. while (position + 1 < end) {
  18009. const code = (0, _core_utils.readUint16)(data, position);
  18010. position += 2;
  18011. let length = 0,
  18012. j,
  18013. sqcd,
  18014. spqcds,
  18015. spqcdSize,
  18016. scalarExpounded,
  18017. tile;
  18018. switch (code) {
  18019. case 0xff4f:
  18020. context.mainHeader = true;
  18021. break;
  18022. case 0xffd9:
  18023. break;
  18024. case 0xff51:
  18025. length = (0, _core_utils.readUint16)(data, position);
  18026. const siz = {};
  18027. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  18028. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  18029. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  18030. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  18031. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  18032. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  18033. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  18034. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  18035. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  18036. siz.Csiz = componentsCount;
  18037. const components = [];
  18038. j = position + 38;
  18039. for (let i = 0; i < componentsCount; i++) {
  18040. const component = {
  18041. precision: (data[j] & 0x7f) + 1,
  18042. isSigned: !!(data[j] & 0x80),
  18043. XRsiz: data[j + 1],
  18044. YRsiz: data[j + 2]
  18045. };
  18046. j += 3;
  18047. calculateComponentDimensions(component, siz);
  18048. components.push(component);
  18049. }
  18050. context.SIZ = siz;
  18051. context.components = components;
  18052. calculateTileGrids(context, components);
  18053. context.QCC = [];
  18054. context.COC = [];
  18055. break;
  18056. case 0xff5c:
  18057. length = (0, _core_utils.readUint16)(data, position);
  18058. const qcd = {};
  18059. j = position + 2;
  18060. sqcd = data[j++];
  18061. switch (sqcd & 0x1f) {
  18062. case 0:
  18063. spqcdSize = 8;
  18064. scalarExpounded = true;
  18065. break;
  18066. case 1:
  18067. spqcdSize = 16;
  18068. scalarExpounded = false;
  18069. break;
  18070. case 2:
  18071. spqcdSize = 16;
  18072. scalarExpounded = true;
  18073. break;
  18074. default:
  18075. throw new Error("Invalid SQcd value " + sqcd);
  18076. }
  18077. qcd.noQuantization = spqcdSize === 8;
  18078. qcd.scalarExpounded = scalarExpounded;
  18079. qcd.guardBits = sqcd >> 5;
  18080. spqcds = [];
  18081. while (j < length + position) {
  18082. const spqcd = {};
  18083. if (spqcdSize === 8) {
  18084. spqcd.epsilon = data[j++] >> 3;
  18085. spqcd.mu = 0;
  18086. } else {
  18087. spqcd.epsilon = data[j] >> 3;
  18088. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18089. j += 2;
  18090. }
  18091. spqcds.push(spqcd);
  18092. }
  18093. qcd.SPqcds = spqcds;
  18094. if (context.mainHeader) {
  18095. context.QCD = qcd;
  18096. } else {
  18097. context.currentTile.QCD = qcd;
  18098. context.currentTile.QCC = [];
  18099. }
  18100. break;
  18101. case 0xff5d:
  18102. length = (0, _core_utils.readUint16)(data, position);
  18103. const qcc = {};
  18104. j = position + 2;
  18105. let cqcc;
  18106. if (context.SIZ.Csiz < 257) {
  18107. cqcc = data[j++];
  18108. } else {
  18109. cqcc = (0, _core_utils.readUint16)(data, j);
  18110. j += 2;
  18111. }
  18112. sqcd = data[j++];
  18113. switch (sqcd & 0x1f) {
  18114. case 0:
  18115. spqcdSize = 8;
  18116. scalarExpounded = true;
  18117. break;
  18118. case 1:
  18119. spqcdSize = 16;
  18120. scalarExpounded = false;
  18121. break;
  18122. case 2:
  18123. spqcdSize = 16;
  18124. scalarExpounded = true;
  18125. break;
  18126. default:
  18127. throw new Error("Invalid SQcd value " + sqcd);
  18128. }
  18129. qcc.noQuantization = spqcdSize === 8;
  18130. qcc.scalarExpounded = scalarExpounded;
  18131. qcc.guardBits = sqcd >> 5;
  18132. spqcds = [];
  18133. while (j < length + position) {
  18134. const spqcd = {};
  18135. if (spqcdSize === 8) {
  18136. spqcd.epsilon = data[j++] >> 3;
  18137. spqcd.mu = 0;
  18138. } else {
  18139. spqcd.epsilon = data[j] >> 3;
  18140. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18141. j += 2;
  18142. }
  18143. spqcds.push(spqcd);
  18144. }
  18145. qcc.SPqcds = spqcds;
  18146. if (context.mainHeader) {
  18147. context.QCC[cqcc] = qcc;
  18148. } else {
  18149. context.currentTile.QCC[cqcc] = qcc;
  18150. }
  18151. break;
  18152. case 0xff52:
  18153. length = (0, _core_utils.readUint16)(data, position);
  18154. const cod = {};
  18155. j = position + 2;
  18156. const scod = data[j++];
  18157. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  18158. cod.sopMarkerUsed = !!(scod & 2);
  18159. cod.ephMarkerUsed = !!(scod & 4);
  18160. cod.progressionOrder = data[j++];
  18161. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  18162. j += 2;
  18163. cod.multipleComponentTransform = data[j++];
  18164. cod.decompositionLevelsCount = data[j++];
  18165. cod.xcb = (data[j++] & 0xf) + 2;
  18166. cod.ycb = (data[j++] & 0xf) + 2;
  18167. const blockStyle = data[j++];
  18168. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  18169. cod.resetContextProbabilities = !!(blockStyle & 2);
  18170. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  18171. cod.verticallyStripe = !!(blockStyle & 8);
  18172. cod.predictableTermination = !!(blockStyle & 16);
  18173. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  18174. cod.reversibleTransformation = data[j++];
  18175. if (cod.entropyCoderWithCustomPrecincts) {
  18176. const precinctsSizes = [];
  18177. while (j < length + position) {
  18178. const precinctsSize = data[j++];
  18179. precinctsSizes.push({
  18180. PPx: precinctsSize & 0xf,
  18181. PPy: precinctsSize >> 4
  18182. });
  18183. }
  18184. cod.precinctsSizes = precinctsSizes;
  18185. }
  18186. const unsupported = [];
  18187. if (cod.selectiveArithmeticCodingBypass) {
  18188. unsupported.push("selectiveArithmeticCodingBypass");
  18189. }
  18190. if (cod.terminationOnEachCodingPass) {
  18191. unsupported.push("terminationOnEachCodingPass");
  18192. }
  18193. if (cod.verticallyStripe) {
  18194. unsupported.push("verticallyStripe");
  18195. }
  18196. if (cod.predictableTermination) {
  18197. unsupported.push("predictableTermination");
  18198. }
  18199. if (unsupported.length > 0) {
  18200. doNotRecover = true;
  18201. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  18202. }
  18203. if (context.mainHeader) {
  18204. context.COD = cod;
  18205. } else {
  18206. context.currentTile.COD = cod;
  18207. context.currentTile.COC = [];
  18208. }
  18209. break;
  18210. case 0xff90:
  18211. length = (0, _core_utils.readUint16)(data, position);
  18212. tile = {};
  18213. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  18214. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  18215. tile.dataEnd = tile.length + position - 2;
  18216. tile.partIndex = data[position + 8];
  18217. tile.partsCount = data[position + 9];
  18218. context.mainHeader = false;
  18219. if (tile.partIndex === 0) {
  18220. tile.COD = context.COD;
  18221. tile.COC = context.COC.slice(0);
  18222. tile.QCD = context.QCD;
  18223. tile.QCC = context.QCC.slice(0);
  18224. }
  18225. context.currentTile = tile;
  18226. break;
  18227. case 0xff93:
  18228. tile = context.currentTile;
  18229. if (tile.partIndex === 0) {
  18230. initializeTile(context, tile.index);
  18231. buildPackets(context);
  18232. }
  18233. length = tile.dataEnd - position;
  18234. parseTilePackets(context, data, position, length);
  18235. break;
  18236. case 0xff53:
  18237. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  18238. case 0xff55:
  18239. case 0xff57:
  18240. case 0xff58:
  18241. case 0xff64:
  18242. length = (0, _core_utils.readUint16)(data, position);
  18243. break;
  18244. default:
  18245. throw new Error("Unknown codestream code: " + code.toString(16));
  18246. }
  18247. position += length;
  18248. }
  18249. } catch (e) {
  18250. if (doNotRecover || this.failOnCorruptedImage) {
  18251. throw new JpxError(e.message);
  18252. } else {
  18253. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  18254. }
  18255. }
  18256. this.tiles = transformComponents(context);
  18257. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  18258. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  18259. this.componentsCount = context.SIZ.Csiz;
  18260. }
  18261. }
  18262. exports.JpxImage = JpxImage;
  18263. function calculateComponentDimensions(component, siz) {
  18264. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  18265. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  18266. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  18267. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  18268. component.width = component.x1 - component.x0;
  18269. component.height = component.y1 - component.y0;
  18270. }
  18271. function calculateTileGrids(context, components) {
  18272. const siz = context.SIZ;
  18273. const tiles = [];
  18274. let tile;
  18275. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  18276. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  18277. for (let q = 0; q < numYtiles; q++) {
  18278. for (let p = 0; p < numXtiles; p++) {
  18279. tile = {};
  18280. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  18281. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  18282. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  18283. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  18284. tile.width = tile.tx1 - tile.tx0;
  18285. tile.height = tile.ty1 - tile.ty0;
  18286. tile.components = [];
  18287. tiles.push(tile);
  18288. }
  18289. }
  18290. context.tiles = tiles;
  18291. const componentsCount = siz.Csiz;
  18292. for (let i = 0, ii = componentsCount; i < ii; i++) {
  18293. const component = components[i];
  18294. for (let j = 0, jj = tiles.length; j < jj; j++) {
  18295. const tileComponent = {};
  18296. tile = tiles[j];
  18297. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  18298. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  18299. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  18300. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  18301. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  18302. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  18303. tile.components[i] = tileComponent;
  18304. }
  18305. }
  18306. }
  18307. function getBlocksDimensions(context, component, r) {
  18308. const codOrCoc = component.codingStyleParameters;
  18309. const result = {};
  18310. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  18311. result.PPx = 15;
  18312. result.PPy = 15;
  18313. } else {
  18314. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  18315. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  18316. }
  18317. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  18318. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  18319. return result;
  18320. }
  18321. function buildPrecincts(context, resolution, dimensions) {
  18322. const precinctWidth = 1 << dimensions.PPx;
  18323. const precinctHeight = 1 << dimensions.PPy;
  18324. const isZeroRes = resolution.resLevel === 0;
  18325. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  18326. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  18327. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  18328. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  18329. const numprecincts = numprecinctswide * numprecinctshigh;
  18330. resolution.precinctParameters = {
  18331. precinctWidth,
  18332. precinctHeight,
  18333. numprecinctswide,
  18334. numprecinctshigh,
  18335. numprecincts,
  18336. precinctWidthInSubband,
  18337. precinctHeightInSubband
  18338. };
  18339. }
  18340. function buildCodeblocks(context, subband, dimensions) {
  18341. const xcb_ = dimensions.xcb_;
  18342. const ycb_ = dimensions.ycb_;
  18343. const codeblockWidth = 1 << xcb_;
  18344. const codeblockHeight = 1 << ycb_;
  18345. const cbx0 = subband.tbx0 >> xcb_;
  18346. const cby0 = subband.tby0 >> ycb_;
  18347. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  18348. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  18349. const precinctParameters = subband.resolution.precinctParameters;
  18350. const codeblocks = [];
  18351. const precincts = [];
  18352. let i, j, codeblock, precinctNumber;
  18353. for (j = cby0; j < cby1; j++) {
  18354. for (i = cbx0; i < cbx1; i++) {
  18355. codeblock = {
  18356. cbx: i,
  18357. cby: j,
  18358. tbx0: codeblockWidth * i,
  18359. tby0: codeblockHeight * j,
  18360. tbx1: codeblockWidth * (i + 1),
  18361. tby1: codeblockHeight * (j + 1)
  18362. };
  18363. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  18364. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  18365. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  18366. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  18367. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  18368. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  18369. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  18370. codeblock.precinctNumber = precinctNumber;
  18371. codeblock.subbandType = subband.type;
  18372. codeblock.Lblock = 3;
  18373. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  18374. continue;
  18375. }
  18376. codeblocks.push(codeblock);
  18377. let precinct = precincts[precinctNumber];
  18378. if (precinct !== undefined) {
  18379. if (i < precinct.cbxMin) {
  18380. precinct.cbxMin = i;
  18381. } else if (i > precinct.cbxMax) {
  18382. precinct.cbxMax = i;
  18383. }
  18384. if (j < precinct.cbyMin) {
  18385. precinct.cbxMin = j;
  18386. } else if (j > precinct.cbyMax) {
  18387. precinct.cbyMax = j;
  18388. }
  18389. } else {
  18390. precincts[precinctNumber] = precinct = {
  18391. cbxMin: i,
  18392. cbyMin: j,
  18393. cbxMax: i,
  18394. cbyMax: j
  18395. };
  18396. }
  18397. codeblock.precinct = precinct;
  18398. }
  18399. }
  18400. subband.codeblockParameters = {
  18401. codeblockWidth: xcb_,
  18402. codeblockHeight: ycb_,
  18403. numcodeblockwide: cbx1 - cbx0 + 1,
  18404. numcodeblockhigh: cby1 - cby0 + 1
  18405. };
  18406. subband.codeblocks = codeblocks;
  18407. subband.precincts = precincts;
  18408. }
  18409. function createPacket(resolution, precinctNumber, layerNumber) {
  18410. const precinctCodeblocks = [];
  18411. const subbands = resolution.subbands;
  18412. for (let i = 0, ii = subbands.length; i < ii; i++) {
  18413. const subband = subbands[i];
  18414. const codeblocks = subband.codeblocks;
  18415. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  18416. const codeblock = codeblocks[j];
  18417. if (codeblock.precinctNumber !== precinctNumber) {
  18418. continue;
  18419. }
  18420. precinctCodeblocks.push(codeblock);
  18421. }
  18422. }
  18423. return {
  18424. layerNumber,
  18425. codeblocks: precinctCodeblocks
  18426. };
  18427. }
  18428. function LayerResolutionComponentPositionIterator(context) {
  18429. const siz = context.SIZ;
  18430. const tileIndex = context.currentTile.index;
  18431. const tile = context.tiles[tileIndex];
  18432. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18433. const componentsCount = siz.Csiz;
  18434. let maxDecompositionLevelsCount = 0;
  18435. for (let q = 0; q < componentsCount; q++) {
  18436. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18437. }
  18438. let l = 0,
  18439. r = 0,
  18440. i = 0,
  18441. k = 0;
  18442. this.nextPacket = function JpxImage_nextPacket() {
  18443. for (; l < layersCount; l++) {
  18444. for (; r <= maxDecompositionLevelsCount; r++) {
  18445. for (; i < componentsCount; i++) {
  18446. const component = tile.components[i];
  18447. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18448. continue;
  18449. }
  18450. const resolution = component.resolutions[r];
  18451. const numprecincts = resolution.precinctParameters.numprecincts;
  18452. for (; k < numprecincts;) {
  18453. const packet = createPacket(resolution, k, l);
  18454. k++;
  18455. return packet;
  18456. }
  18457. k = 0;
  18458. }
  18459. i = 0;
  18460. }
  18461. r = 0;
  18462. }
  18463. throw new JpxError("Out of packets");
  18464. };
  18465. }
  18466. function ResolutionLayerComponentPositionIterator(context) {
  18467. const siz = context.SIZ;
  18468. const tileIndex = context.currentTile.index;
  18469. const tile = context.tiles[tileIndex];
  18470. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18471. const componentsCount = siz.Csiz;
  18472. let maxDecompositionLevelsCount = 0;
  18473. for (let q = 0; q < componentsCount; q++) {
  18474. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18475. }
  18476. let r = 0,
  18477. l = 0,
  18478. i = 0,
  18479. k = 0;
  18480. this.nextPacket = function JpxImage_nextPacket() {
  18481. for (; r <= maxDecompositionLevelsCount; r++) {
  18482. for (; l < layersCount; l++) {
  18483. for (; i < componentsCount; i++) {
  18484. const component = tile.components[i];
  18485. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18486. continue;
  18487. }
  18488. const resolution = component.resolutions[r];
  18489. const numprecincts = resolution.precinctParameters.numprecincts;
  18490. for (; k < numprecincts;) {
  18491. const packet = createPacket(resolution, k, l);
  18492. k++;
  18493. return packet;
  18494. }
  18495. k = 0;
  18496. }
  18497. i = 0;
  18498. }
  18499. l = 0;
  18500. }
  18501. throw new JpxError("Out of packets");
  18502. };
  18503. }
  18504. function ResolutionPositionComponentLayerIterator(context) {
  18505. const siz = context.SIZ;
  18506. const tileIndex = context.currentTile.index;
  18507. const tile = context.tiles[tileIndex];
  18508. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18509. const componentsCount = siz.Csiz;
  18510. let l, r, c, p;
  18511. let maxDecompositionLevelsCount = 0;
  18512. for (c = 0; c < componentsCount; c++) {
  18513. const component = tile.components[c];
  18514. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  18515. }
  18516. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  18517. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  18518. let maxNumPrecincts = 0;
  18519. for (c = 0; c < componentsCount; ++c) {
  18520. const resolutions = tile.components[c].resolutions;
  18521. if (r < resolutions.length) {
  18522. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  18523. }
  18524. }
  18525. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  18526. }
  18527. l = 0;
  18528. r = 0;
  18529. c = 0;
  18530. p = 0;
  18531. this.nextPacket = function JpxImage_nextPacket() {
  18532. for (; r <= maxDecompositionLevelsCount; r++) {
  18533. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  18534. for (; c < componentsCount; c++) {
  18535. const component = tile.components[c];
  18536. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18537. continue;
  18538. }
  18539. const resolution = component.resolutions[r];
  18540. const numprecincts = resolution.precinctParameters.numprecincts;
  18541. if (p >= numprecincts) {
  18542. continue;
  18543. }
  18544. for (; l < layersCount;) {
  18545. const packet = createPacket(resolution, p, l);
  18546. l++;
  18547. return packet;
  18548. }
  18549. l = 0;
  18550. }
  18551. c = 0;
  18552. }
  18553. p = 0;
  18554. }
  18555. throw new JpxError("Out of packets");
  18556. };
  18557. }
  18558. function PositionComponentResolutionLayerIterator(context) {
  18559. const siz = context.SIZ;
  18560. const tileIndex = context.currentTile.index;
  18561. const tile = context.tiles[tileIndex];
  18562. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18563. const componentsCount = siz.Csiz;
  18564. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18565. const precinctsIterationSizes = precinctsSizes;
  18566. let l = 0,
  18567. r = 0,
  18568. c = 0,
  18569. px = 0,
  18570. py = 0;
  18571. this.nextPacket = function JpxImage_nextPacket() {
  18572. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18573. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18574. for (; c < componentsCount; c++) {
  18575. const component = tile.components[c];
  18576. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18577. for (; r <= decompositionLevelsCount; r++) {
  18578. const resolution = component.resolutions[r];
  18579. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  18580. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18581. if (k === null) {
  18582. continue;
  18583. }
  18584. for (; l < layersCount;) {
  18585. const packet = createPacket(resolution, k, l);
  18586. l++;
  18587. return packet;
  18588. }
  18589. l = 0;
  18590. }
  18591. r = 0;
  18592. }
  18593. c = 0;
  18594. }
  18595. px = 0;
  18596. }
  18597. throw new JpxError("Out of packets");
  18598. };
  18599. }
  18600. function ComponentPositionResolutionLayerIterator(context) {
  18601. const siz = context.SIZ;
  18602. const tileIndex = context.currentTile.index;
  18603. const tile = context.tiles[tileIndex];
  18604. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  18605. const componentsCount = siz.Csiz;
  18606. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  18607. let l = 0,
  18608. r = 0,
  18609. c = 0,
  18610. px = 0,
  18611. py = 0;
  18612. this.nextPacket = function JpxImage_nextPacket() {
  18613. for (; c < componentsCount; ++c) {
  18614. const component = tile.components[c];
  18615. const precinctsIterationSizes = precinctsSizes.components[c];
  18616. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18617. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18618. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18619. for (; r <= decompositionLevelsCount; r++) {
  18620. const resolution = component.resolutions[r];
  18621. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  18622. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18623. if (k === null) {
  18624. continue;
  18625. }
  18626. for (; l < layersCount;) {
  18627. const packet = createPacket(resolution, k, l);
  18628. l++;
  18629. return packet;
  18630. }
  18631. l = 0;
  18632. }
  18633. r = 0;
  18634. }
  18635. px = 0;
  18636. }
  18637. py = 0;
  18638. }
  18639. throw new JpxError("Out of packets");
  18640. };
  18641. }
  18642. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  18643. const posX = pxIndex * precinctIterationSizes.minWidth;
  18644. const posY = pyIndex * precinctIterationSizes.minHeight;
  18645. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  18646. return null;
  18647. }
  18648. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  18649. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  18650. }
  18651. function getPrecinctSizesInImageScale(tile) {
  18652. const componentsCount = tile.components.length;
  18653. let minWidth = Number.MAX_VALUE;
  18654. let minHeight = Number.MAX_VALUE;
  18655. let maxNumWide = 0;
  18656. let maxNumHigh = 0;
  18657. const sizePerComponent = new Array(componentsCount);
  18658. for (let c = 0; c < componentsCount; c++) {
  18659. const component = tile.components[c];
  18660. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18661. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  18662. let minWidthCurrentComponent = Number.MAX_VALUE;
  18663. let minHeightCurrentComponent = Number.MAX_VALUE;
  18664. let maxNumWideCurrentComponent = 0;
  18665. let maxNumHighCurrentComponent = 0;
  18666. let scale = 1;
  18667. for (let r = decompositionLevelsCount; r >= 0; --r) {
  18668. const resolution = component.resolutions[r];
  18669. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  18670. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  18671. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  18672. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  18673. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  18674. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  18675. sizePerResolution[r] = {
  18676. width: widthCurrentResolution,
  18677. height: heightCurrentResolution
  18678. };
  18679. scale <<= 1;
  18680. }
  18681. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  18682. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  18683. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  18684. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  18685. sizePerComponent[c] = {
  18686. resolutions: sizePerResolution,
  18687. minWidth: minWidthCurrentComponent,
  18688. minHeight: minHeightCurrentComponent,
  18689. maxNumWide: maxNumWideCurrentComponent,
  18690. maxNumHigh: maxNumHighCurrentComponent
  18691. };
  18692. }
  18693. return {
  18694. components: sizePerComponent,
  18695. minWidth,
  18696. minHeight,
  18697. maxNumWide,
  18698. maxNumHigh
  18699. };
  18700. }
  18701. function buildPackets(context) {
  18702. const siz = context.SIZ;
  18703. const tileIndex = context.currentTile.index;
  18704. const tile = context.tiles[tileIndex];
  18705. const componentsCount = siz.Csiz;
  18706. for (let c = 0; c < componentsCount; c++) {
  18707. const component = tile.components[c];
  18708. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18709. const resolutions = [];
  18710. const subbands = [];
  18711. for (let r = 0; r <= decompositionLevelsCount; r++) {
  18712. const blocksDimensions = getBlocksDimensions(context, component, r);
  18713. const resolution = {};
  18714. const scale = 1 << decompositionLevelsCount - r;
  18715. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  18716. resolution.try0 = Math.ceil(component.tcy0 / scale);
  18717. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  18718. resolution.try1 = Math.ceil(component.tcy1 / scale);
  18719. resolution.resLevel = r;
  18720. buildPrecincts(context, resolution, blocksDimensions);
  18721. resolutions.push(resolution);
  18722. let subband;
  18723. if (r === 0) {
  18724. subband = {};
  18725. subband.type = "LL";
  18726. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  18727. subband.tby0 = Math.ceil(component.tcy0 / scale);
  18728. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  18729. subband.tby1 = Math.ceil(component.tcy1 / scale);
  18730. subband.resolution = resolution;
  18731. buildCodeblocks(context, subband, blocksDimensions);
  18732. subbands.push(subband);
  18733. resolution.subbands = [subband];
  18734. } else {
  18735. const bscale = 1 << decompositionLevelsCount - r + 1;
  18736. const resolutionSubbands = [];
  18737. subband = {};
  18738. subband.type = "HL";
  18739. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  18740. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  18741. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  18742. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  18743. subband.resolution = resolution;
  18744. buildCodeblocks(context, subband, blocksDimensions);
  18745. subbands.push(subband);
  18746. resolutionSubbands.push(subband);
  18747. subband = {};
  18748. subband.type = "LH";
  18749. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  18750. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  18751. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  18752. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  18753. subband.resolution = resolution;
  18754. buildCodeblocks(context, subband, blocksDimensions);
  18755. subbands.push(subband);
  18756. resolutionSubbands.push(subband);
  18757. subband = {};
  18758. subband.type = "HH";
  18759. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  18760. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  18761. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  18762. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  18763. subband.resolution = resolution;
  18764. buildCodeblocks(context, subband, blocksDimensions);
  18765. subbands.push(subband);
  18766. resolutionSubbands.push(subband);
  18767. resolution.subbands = resolutionSubbands;
  18768. }
  18769. }
  18770. component.resolutions = resolutions;
  18771. component.subbands = subbands;
  18772. }
  18773. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  18774. switch (progressionOrder) {
  18775. case 0:
  18776. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  18777. break;
  18778. case 1:
  18779. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  18780. break;
  18781. case 2:
  18782. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  18783. break;
  18784. case 3:
  18785. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  18786. break;
  18787. case 4:
  18788. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  18789. break;
  18790. default:
  18791. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  18792. }
  18793. }
  18794. function parseTilePackets(context, data, offset, dataLength) {
  18795. let position = 0;
  18796. let buffer,
  18797. bufferSize = 0,
  18798. skipNextBit = false;
  18799. function readBits(count) {
  18800. while (bufferSize < count) {
  18801. const b = data[offset + position];
  18802. position++;
  18803. if (skipNextBit) {
  18804. buffer = buffer << 7 | b;
  18805. bufferSize += 7;
  18806. skipNextBit = false;
  18807. } else {
  18808. buffer = buffer << 8 | b;
  18809. bufferSize += 8;
  18810. }
  18811. if (b === 0xff) {
  18812. skipNextBit = true;
  18813. }
  18814. }
  18815. bufferSize -= count;
  18816. return buffer >>> bufferSize & (1 << count) - 1;
  18817. }
  18818. function skipMarkerIfEqual(value) {
  18819. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  18820. skipBytes(1);
  18821. return true;
  18822. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  18823. skipBytes(2);
  18824. return true;
  18825. }
  18826. return false;
  18827. }
  18828. function skipBytes(count) {
  18829. position += count;
  18830. }
  18831. function alignToByte() {
  18832. bufferSize = 0;
  18833. if (skipNextBit) {
  18834. position++;
  18835. skipNextBit = false;
  18836. }
  18837. }
  18838. function readCodingpasses() {
  18839. if (readBits(1) === 0) {
  18840. return 1;
  18841. }
  18842. if (readBits(1) === 0) {
  18843. return 2;
  18844. }
  18845. let value = readBits(2);
  18846. if (value < 3) {
  18847. return value + 3;
  18848. }
  18849. value = readBits(5);
  18850. if (value < 31) {
  18851. return value + 6;
  18852. }
  18853. value = readBits(7);
  18854. return value + 37;
  18855. }
  18856. const tileIndex = context.currentTile.index;
  18857. const tile = context.tiles[tileIndex];
  18858. const sopMarkerUsed = context.COD.sopMarkerUsed;
  18859. const ephMarkerUsed = context.COD.ephMarkerUsed;
  18860. const packetsIterator = tile.packetsIterator;
  18861. while (position < dataLength) {
  18862. alignToByte();
  18863. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  18864. skipBytes(4);
  18865. }
  18866. const packet = packetsIterator.nextPacket();
  18867. if (!readBits(1)) {
  18868. continue;
  18869. }
  18870. const layerNumber = packet.layerNumber,
  18871. queue = [];
  18872. let codeblock;
  18873. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  18874. codeblock = packet.codeblocks[i];
  18875. let precinct = codeblock.precinct;
  18876. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  18877. const codeblockRow = codeblock.cby - precinct.cbyMin;
  18878. let codeblockIncluded = false;
  18879. let firstTimeInclusion = false;
  18880. let valueReady, zeroBitPlanesTree;
  18881. if (codeblock.included !== undefined) {
  18882. codeblockIncluded = !!readBits(1);
  18883. } else {
  18884. precinct = codeblock.precinct;
  18885. let inclusionTree;
  18886. if (precinct.inclusionTree !== undefined) {
  18887. inclusionTree = precinct.inclusionTree;
  18888. } else {
  18889. const width = precinct.cbxMax - precinct.cbxMin + 1;
  18890. const height = precinct.cbyMax - precinct.cbyMin + 1;
  18891. inclusionTree = new InclusionTree(width, height, layerNumber);
  18892. zeroBitPlanesTree = new TagTree(width, height);
  18893. precinct.inclusionTree = inclusionTree;
  18894. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  18895. for (let l = 0; l < layerNumber; l++) {
  18896. if (readBits(1) !== 0) {
  18897. throw new JpxError("Invalid tag tree");
  18898. }
  18899. }
  18900. }
  18901. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  18902. while (true) {
  18903. if (readBits(1)) {
  18904. valueReady = !inclusionTree.nextLevel();
  18905. if (valueReady) {
  18906. codeblock.included = true;
  18907. codeblockIncluded = firstTimeInclusion = true;
  18908. break;
  18909. }
  18910. } else {
  18911. inclusionTree.incrementValue(layerNumber);
  18912. break;
  18913. }
  18914. }
  18915. }
  18916. }
  18917. if (!codeblockIncluded) {
  18918. continue;
  18919. }
  18920. if (firstTimeInclusion) {
  18921. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  18922. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  18923. while (true) {
  18924. if (readBits(1)) {
  18925. valueReady = !zeroBitPlanesTree.nextLevel();
  18926. if (valueReady) {
  18927. break;
  18928. }
  18929. } else {
  18930. zeroBitPlanesTree.incrementValue();
  18931. }
  18932. }
  18933. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  18934. }
  18935. const codingpasses = readCodingpasses();
  18936. while (readBits(1)) {
  18937. codeblock.Lblock++;
  18938. }
  18939. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  18940. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  18941. const codedDataLength = readBits(bits);
  18942. queue.push({
  18943. codeblock,
  18944. codingpasses,
  18945. dataLength: codedDataLength
  18946. });
  18947. }
  18948. alignToByte();
  18949. if (ephMarkerUsed) {
  18950. skipMarkerIfEqual(0x92);
  18951. }
  18952. while (queue.length > 0) {
  18953. const packetItem = queue.shift();
  18954. codeblock = packetItem.codeblock;
  18955. if (codeblock.data === undefined) {
  18956. codeblock.data = [];
  18957. }
  18958. codeblock.data.push({
  18959. data,
  18960. start: offset + position,
  18961. end: offset + position + packetItem.dataLength,
  18962. codingpasses: packetItem.codingpasses
  18963. });
  18964. position += packetItem.dataLength;
  18965. }
  18966. }
  18967. return position;
  18968. }
  18969. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  18970. const x0 = subband.tbx0;
  18971. const y0 = subband.tby0;
  18972. const width = subband.tbx1 - subband.tbx0;
  18973. const codeblocks = subband.codeblocks;
  18974. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  18975. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  18976. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  18977. const codeblock = codeblocks[i];
  18978. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  18979. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  18980. if (blockWidth === 0 || blockHeight === 0) {
  18981. continue;
  18982. }
  18983. if (codeblock.data === undefined) {
  18984. continue;
  18985. }
  18986. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  18987. let currentCodingpassType = 2;
  18988. const data = codeblock.data;
  18989. let totalLength = 0,
  18990. codingpasses = 0;
  18991. let j, jj, dataItem;
  18992. for (j = 0, jj = data.length; j < jj; j++) {
  18993. dataItem = data[j];
  18994. totalLength += dataItem.end - dataItem.start;
  18995. codingpasses += dataItem.codingpasses;
  18996. }
  18997. const encodedData = new Uint8Array(totalLength);
  18998. let position = 0;
  18999. for (j = 0, jj = data.length; j < jj; j++) {
  19000. dataItem = data[j];
  19001. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  19002. encodedData.set(chunk, position);
  19003. position += chunk.length;
  19004. }
  19005. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  19006. bitModel.setDecoder(decoder);
  19007. for (j = 0; j < codingpasses; j++) {
  19008. switch (currentCodingpassType) {
  19009. case 0:
  19010. bitModel.runSignificancePropagationPass();
  19011. break;
  19012. case 1:
  19013. bitModel.runMagnitudeRefinementPass();
  19014. break;
  19015. case 2:
  19016. bitModel.runCleanupPass();
  19017. if (segmentationSymbolUsed) {
  19018. bitModel.checkSegmentationSymbol();
  19019. }
  19020. break;
  19021. }
  19022. if (resetContextProbabilities) {
  19023. bitModel.reset();
  19024. }
  19025. currentCodingpassType = (currentCodingpassType + 1) % 3;
  19026. }
  19027. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  19028. const sign = bitModel.coefficentsSign;
  19029. const magnitude = bitModel.coefficentsMagnitude;
  19030. const bitsDecoded = bitModel.bitsDecoded;
  19031. const magnitudeCorrection = reversible ? 0 : 0.5;
  19032. let k, n, nb;
  19033. position = 0;
  19034. const interleave = subband.type !== "LL";
  19035. for (j = 0; j < blockHeight; j++) {
  19036. const row = offset / width | 0;
  19037. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  19038. for (k = 0; k < blockWidth; k++) {
  19039. n = magnitude[position];
  19040. if (n !== 0) {
  19041. n = (n + magnitudeCorrection) * delta;
  19042. if (sign[position] !== 0) {
  19043. n = -n;
  19044. }
  19045. nb = bitsDecoded[position];
  19046. const pos = interleave ? levelOffset + (offset << 1) : offset;
  19047. if (reversible && nb >= mb) {
  19048. coefficients[pos] = n;
  19049. } else {
  19050. coefficients[pos] = n * (1 << mb - nb);
  19051. }
  19052. }
  19053. offset++;
  19054. position++;
  19055. }
  19056. offset += width - blockWidth;
  19057. }
  19058. }
  19059. }
  19060. function transformTile(context, tile, c) {
  19061. const component = tile.components[c];
  19062. const codingStyleParameters = component.codingStyleParameters;
  19063. const quantizationParameters = component.quantizationParameters;
  19064. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  19065. const spqcds = quantizationParameters.SPqcds;
  19066. const scalarExpounded = quantizationParameters.scalarExpounded;
  19067. const guardBits = quantizationParameters.guardBits;
  19068. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  19069. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  19070. const precision = context.components[c].precision;
  19071. const reversible = codingStyleParameters.reversibleTransformation;
  19072. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  19073. const subbandCoefficients = [];
  19074. let b = 0;
  19075. for (let i = 0; i <= decompositionLevelsCount; i++) {
  19076. const resolution = component.resolutions[i];
  19077. const width = resolution.trx1 - resolution.trx0;
  19078. const height = resolution.try1 - resolution.try0;
  19079. const coefficients = new Float32Array(width * height);
  19080. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  19081. let mu, epsilon;
  19082. if (!scalarExpounded) {
  19083. mu = spqcds[0].mu;
  19084. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  19085. } else {
  19086. mu = spqcds[b].mu;
  19087. epsilon = spqcds[b].epsilon;
  19088. b++;
  19089. }
  19090. const subband = resolution.subbands[j];
  19091. const gainLog2 = SubbandsGainLog2[subband.type];
  19092. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  19093. const mb = guardBits + epsilon - 1;
  19094. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  19095. }
  19096. subbandCoefficients.push({
  19097. width,
  19098. height,
  19099. items: coefficients
  19100. });
  19101. }
  19102. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  19103. return {
  19104. left: component.tcx0,
  19105. top: component.tcy0,
  19106. width: result.width,
  19107. height: result.height,
  19108. items: result.items
  19109. };
  19110. }
  19111. function transformComponents(context) {
  19112. const siz = context.SIZ;
  19113. const components = context.components;
  19114. const componentsCount = siz.Csiz;
  19115. const resultImages = [];
  19116. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  19117. const tile = context.tiles[i];
  19118. const transformedTiles = [];
  19119. for (let c = 0; c < componentsCount; c++) {
  19120. transformedTiles[c] = transformTile(context, tile, c);
  19121. }
  19122. const tile0 = transformedTiles[0];
  19123. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  19124. const result = {
  19125. left: tile0.left,
  19126. top: tile0.top,
  19127. width: tile0.width,
  19128. height: tile0.height,
  19129. items: out
  19130. };
  19131. let shift, offset;
  19132. let pos = 0,
  19133. j,
  19134. jj,
  19135. y0,
  19136. y1,
  19137. y2;
  19138. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  19139. const fourComponents = componentsCount === 4;
  19140. const y0items = transformedTiles[0].items;
  19141. const y1items = transformedTiles[1].items;
  19142. const y2items = transformedTiles[2].items;
  19143. const y3items = fourComponents ? transformedTiles[3].items : null;
  19144. shift = components[0].precision - 8;
  19145. offset = (128 << shift) + 0.5;
  19146. const component0 = tile.components[0];
  19147. const alpha01 = componentsCount - 3;
  19148. jj = y0items.length;
  19149. if (!component0.codingStyleParameters.reversibleTransformation) {
  19150. for (j = 0; j < jj; j++, pos += alpha01) {
  19151. y0 = y0items[j] + offset;
  19152. y1 = y1items[j];
  19153. y2 = y2items[j];
  19154. out[pos++] = y0 + 1.402 * y2 >> shift;
  19155. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  19156. out[pos++] = y0 + 1.772 * y1 >> shift;
  19157. }
  19158. } else {
  19159. for (j = 0; j < jj; j++, pos += alpha01) {
  19160. y0 = y0items[j] + offset;
  19161. y1 = y1items[j];
  19162. y2 = y2items[j];
  19163. const g = y0 - (y2 + y1 >> 2);
  19164. out[pos++] = g + y2 >> shift;
  19165. out[pos++] = g >> shift;
  19166. out[pos++] = g + y1 >> shift;
  19167. }
  19168. }
  19169. if (fourComponents) {
  19170. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  19171. out[pos] = y3items[j] + offset >> shift;
  19172. }
  19173. }
  19174. } else {
  19175. for (let c = 0; c < componentsCount; c++) {
  19176. const items = transformedTiles[c].items;
  19177. shift = components[c].precision - 8;
  19178. offset = (128 << shift) + 0.5;
  19179. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  19180. out[pos] = items[j] + offset >> shift;
  19181. pos += componentsCount;
  19182. }
  19183. }
  19184. }
  19185. resultImages.push(result);
  19186. }
  19187. return resultImages;
  19188. }
  19189. function initializeTile(context, tileIndex) {
  19190. const siz = context.SIZ;
  19191. const componentsCount = siz.Csiz;
  19192. const tile = context.tiles[tileIndex];
  19193. for (let c = 0; c < componentsCount; c++) {
  19194. const component = tile.components[c];
  19195. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  19196. component.quantizationParameters = qcdOrQcc;
  19197. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  19198. component.codingStyleParameters = codOrCoc;
  19199. }
  19200. tile.codingStyleDefaultParameters = context.currentTile.COD;
  19201. }
  19202. class TagTree {
  19203. constructor(width, height) {
  19204. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19205. this.levels = [];
  19206. for (let i = 0; i < levelsLength; i++) {
  19207. const level = {
  19208. width,
  19209. height,
  19210. items: []
  19211. };
  19212. this.levels.push(level);
  19213. width = Math.ceil(width / 2);
  19214. height = Math.ceil(height / 2);
  19215. }
  19216. }
  19217. reset(i, j) {
  19218. let currentLevel = 0,
  19219. value = 0,
  19220. level;
  19221. while (currentLevel < this.levels.length) {
  19222. level = this.levels[currentLevel];
  19223. const index = i + j * level.width;
  19224. if (level.items[index] !== undefined) {
  19225. value = level.items[index];
  19226. break;
  19227. }
  19228. level.index = index;
  19229. i >>= 1;
  19230. j >>= 1;
  19231. currentLevel++;
  19232. }
  19233. currentLevel--;
  19234. level = this.levels[currentLevel];
  19235. level.items[level.index] = value;
  19236. this.currentLevel = currentLevel;
  19237. delete this.value;
  19238. }
  19239. incrementValue() {
  19240. const level = this.levels[this.currentLevel];
  19241. level.items[level.index]++;
  19242. }
  19243. nextLevel() {
  19244. let currentLevel = this.currentLevel;
  19245. let level = this.levels[currentLevel];
  19246. const value = level.items[level.index];
  19247. currentLevel--;
  19248. if (currentLevel < 0) {
  19249. this.value = value;
  19250. return false;
  19251. }
  19252. this.currentLevel = currentLevel;
  19253. level = this.levels[currentLevel];
  19254. level.items[level.index] = value;
  19255. return true;
  19256. }
  19257. }
  19258. class InclusionTree {
  19259. constructor(width, height, defaultValue) {
  19260. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  19261. this.levels = [];
  19262. for (let i = 0; i < levelsLength; i++) {
  19263. const items = new Uint8Array(width * height);
  19264. for (let j = 0, jj = items.length; j < jj; j++) {
  19265. items[j] = defaultValue;
  19266. }
  19267. const level = {
  19268. width,
  19269. height,
  19270. items
  19271. };
  19272. this.levels.push(level);
  19273. width = Math.ceil(width / 2);
  19274. height = Math.ceil(height / 2);
  19275. }
  19276. }
  19277. reset(i, j, stopValue) {
  19278. let currentLevel = 0;
  19279. while (currentLevel < this.levels.length) {
  19280. const level = this.levels[currentLevel];
  19281. const index = i + j * level.width;
  19282. level.index = index;
  19283. const value = level.items[index];
  19284. if (value === 0xff) {
  19285. break;
  19286. }
  19287. if (value > stopValue) {
  19288. this.currentLevel = currentLevel;
  19289. this.propagateValues();
  19290. return false;
  19291. }
  19292. i >>= 1;
  19293. j >>= 1;
  19294. currentLevel++;
  19295. }
  19296. this.currentLevel = currentLevel - 1;
  19297. return true;
  19298. }
  19299. incrementValue(stopValue) {
  19300. const level = this.levels[this.currentLevel];
  19301. level.items[level.index] = stopValue + 1;
  19302. this.propagateValues();
  19303. }
  19304. propagateValues() {
  19305. let levelIndex = this.currentLevel;
  19306. let level = this.levels[levelIndex];
  19307. const currentValue = level.items[level.index];
  19308. while (--levelIndex >= 0) {
  19309. level = this.levels[levelIndex];
  19310. level.items[level.index] = currentValue;
  19311. }
  19312. }
  19313. nextLevel() {
  19314. let currentLevel = this.currentLevel;
  19315. let level = this.levels[currentLevel];
  19316. const value = level.items[level.index];
  19317. level.items[level.index] = 0xff;
  19318. currentLevel--;
  19319. if (currentLevel < 0) {
  19320. return false;
  19321. }
  19322. this.currentLevel = currentLevel;
  19323. level = this.levels[currentLevel];
  19324. level.items[level.index] = value;
  19325. return true;
  19326. }
  19327. }
  19328. const BitModel = function BitModelClosure() {
  19329. const UNIFORM_CONTEXT = 17;
  19330. const RUNLENGTH_CONTEXT = 18;
  19331. 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]);
  19332. 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]);
  19333. 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]);
  19334. class BitModel {
  19335. constructor(width, height, subband, zeroBitPlanes, mb) {
  19336. this.width = width;
  19337. this.height = height;
  19338. let contextLabelTable;
  19339. if (subband === "HH") {
  19340. contextLabelTable = HHContextLabel;
  19341. } else if (subband === "HL") {
  19342. contextLabelTable = HLContextLabel;
  19343. } else {
  19344. contextLabelTable = LLAndLHContextsLabel;
  19345. }
  19346. this.contextLabelTable = contextLabelTable;
  19347. const coefficientCount = width * height;
  19348. this.neighborsSignificance = new Uint8Array(coefficientCount);
  19349. this.coefficentsSign = new Uint8Array(coefficientCount);
  19350. let coefficentsMagnitude;
  19351. if (mb > 14) {
  19352. coefficentsMagnitude = new Uint32Array(coefficientCount);
  19353. } else if (mb > 6) {
  19354. coefficentsMagnitude = new Uint16Array(coefficientCount);
  19355. } else {
  19356. coefficentsMagnitude = new Uint8Array(coefficientCount);
  19357. }
  19358. this.coefficentsMagnitude = coefficentsMagnitude;
  19359. this.processingFlags = new Uint8Array(coefficientCount);
  19360. const bitsDecoded = new Uint8Array(coefficientCount);
  19361. if (zeroBitPlanes !== 0) {
  19362. for (let i = 0; i < coefficientCount; i++) {
  19363. bitsDecoded[i] = zeroBitPlanes;
  19364. }
  19365. }
  19366. this.bitsDecoded = bitsDecoded;
  19367. this.reset();
  19368. }
  19369. setDecoder(decoder) {
  19370. this.decoder = decoder;
  19371. }
  19372. reset() {
  19373. this.contexts = new Int8Array(19);
  19374. this.contexts[0] = 4 << 1 | 0;
  19375. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  19376. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  19377. }
  19378. setNeighborsSignificance(row, column, index) {
  19379. const neighborsSignificance = this.neighborsSignificance;
  19380. const width = this.width,
  19381. height = this.height;
  19382. const left = column > 0;
  19383. const right = column + 1 < width;
  19384. let i;
  19385. if (row > 0) {
  19386. i = index - width;
  19387. if (left) {
  19388. neighborsSignificance[i - 1] += 0x10;
  19389. }
  19390. if (right) {
  19391. neighborsSignificance[i + 1] += 0x10;
  19392. }
  19393. neighborsSignificance[i] += 0x04;
  19394. }
  19395. if (row + 1 < height) {
  19396. i = index + width;
  19397. if (left) {
  19398. neighborsSignificance[i - 1] += 0x10;
  19399. }
  19400. if (right) {
  19401. neighborsSignificance[i + 1] += 0x10;
  19402. }
  19403. neighborsSignificance[i] += 0x04;
  19404. }
  19405. if (left) {
  19406. neighborsSignificance[index - 1] += 0x01;
  19407. }
  19408. if (right) {
  19409. neighborsSignificance[index + 1] += 0x01;
  19410. }
  19411. neighborsSignificance[index] |= 0x80;
  19412. }
  19413. runSignificancePropagationPass() {
  19414. const decoder = this.decoder;
  19415. const width = this.width,
  19416. height = this.height;
  19417. const coefficentsMagnitude = this.coefficentsMagnitude;
  19418. const coefficentsSign = this.coefficentsSign;
  19419. const neighborsSignificance = this.neighborsSignificance;
  19420. const processingFlags = this.processingFlags;
  19421. const contexts = this.contexts;
  19422. const labels = this.contextLabelTable;
  19423. const bitsDecoded = this.bitsDecoded;
  19424. const processedInverseMask = ~1;
  19425. const processedMask = 1;
  19426. const firstMagnitudeBitMask = 2;
  19427. for (let i0 = 0; i0 < height; i0 += 4) {
  19428. for (let j = 0; j < width; j++) {
  19429. let index = i0 * width + j;
  19430. for (let i1 = 0; i1 < 4; i1++, index += width) {
  19431. const i = i0 + i1;
  19432. if (i >= height) {
  19433. break;
  19434. }
  19435. processingFlags[index] &= processedInverseMask;
  19436. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  19437. continue;
  19438. }
  19439. const contextLabel = labels[neighborsSignificance[index]];
  19440. const decision = decoder.readBit(contexts, contextLabel);
  19441. if (decision) {
  19442. const sign = this.decodeSignBit(i, j, index);
  19443. coefficentsSign[index] = sign;
  19444. coefficentsMagnitude[index] = 1;
  19445. this.setNeighborsSignificance(i, j, index);
  19446. processingFlags[index] |= firstMagnitudeBitMask;
  19447. }
  19448. bitsDecoded[index]++;
  19449. processingFlags[index] |= processedMask;
  19450. }
  19451. }
  19452. }
  19453. }
  19454. decodeSignBit(row, column, index) {
  19455. const width = this.width,
  19456. height = this.height;
  19457. const coefficentsMagnitude = this.coefficentsMagnitude;
  19458. const coefficentsSign = this.coefficentsSign;
  19459. let contribution, sign0, sign1, significance1;
  19460. let contextLabel, decoded;
  19461. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  19462. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  19463. sign1 = coefficentsSign[index + 1];
  19464. if (significance1) {
  19465. sign0 = coefficentsSign[index - 1];
  19466. contribution = 1 - sign1 - sign0;
  19467. } else {
  19468. contribution = 1 - sign1 - sign1;
  19469. }
  19470. } else if (significance1) {
  19471. sign0 = coefficentsSign[index - 1];
  19472. contribution = 1 - sign0 - sign0;
  19473. } else {
  19474. contribution = 0;
  19475. }
  19476. const horizontalContribution = 3 * contribution;
  19477. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  19478. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  19479. sign1 = coefficentsSign[index + width];
  19480. if (significance1) {
  19481. sign0 = coefficentsSign[index - width];
  19482. contribution = 1 - sign1 - sign0 + horizontalContribution;
  19483. } else {
  19484. contribution = 1 - sign1 - sign1 + horizontalContribution;
  19485. }
  19486. } else if (significance1) {
  19487. sign0 = coefficentsSign[index - width];
  19488. contribution = 1 - sign0 - sign0 + horizontalContribution;
  19489. } else {
  19490. contribution = horizontalContribution;
  19491. }
  19492. if (contribution >= 0) {
  19493. contextLabel = 9 + contribution;
  19494. decoded = this.decoder.readBit(this.contexts, contextLabel);
  19495. } else {
  19496. contextLabel = 9 - contribution;
  19497. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  19498. }
  19499. return decoded;
  19500. }
  19501. runMagnitudeRefinementPass() {
  19502. const decoder = this.decoder;
  19503. const width = this.width,
  19504. height = this.height;
  19505. const coefficentsMagnitude = this.coefficentsMagnitude;
  19506. const neighborsSignificance = this.neighborsSignificance;
  19507. const contexts = this.contexts;
  19508. const bitsDecoded = this.bitsDecoded;
  19509. const processingFlags = this.processingFlags;
  19510. const processedMask = 1;
  19511. const firstMagnitudeBitMask = 2;
  19512. const length = width * height;
  19513. const width4 = width * 4;
  19514. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  19515. indexNext = Math.min(length, index0 + width4);
  19516. for (let j = 0; j < width; j++) {
  19517. for (let index = index0 + j; index < indexNext; index += width) {
  19518. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19519. continue;
  19520. }
  19521. let contextLabel = 16;
  19522. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  19523. processingFlags[index] ^= firstMagnitudeBitMask;
  19524. const significance = neighborsSignificance[index] & 127;
  19525. contextLabel = significance === 0 ? 15 : 14;
  19526. }
  19527. const bit = decoder.readBit(contexts, contextLabel);
  19528. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  19529. bitsDecoded[index]++;
  19530. processingFlags[index] |= processedMask;
  19531. }
  19532. }
  19533. }
  19534. }
  19535. runCleanupPass() {
  19536. const decoder = this.decoder;
  19537. const width = this.width,
  19538. height = this.height;
  19539. const neighborsSignificance = this.neighborsSignificance;
  19540. const coefficentsMagnitude = this.coefficentsMagnitude;
  19541. const coefficentsSign = this.coefficentsSign;
  19542. const contexts = this.contexts;
  19543. const labels = this.contextLabelTable;
  19544. const bitsDecoded = this.bitsDecoded;
  19545. const processingFlags = this.processingFlags;
  19546. const processedMask = 1;
  19547. const firstMagnitudeBitMask = 2;
  19548. const oneRowDown = width;
  19549. const twoRowsDown = width * 2;
  19550. const threeRowsDown = width * 3;
  19551. let iNext;
  19552. for (let i0 = 0; i0 < height; i0 = iNext) {
  19553. iNext = Math.min(i0 + 4, height);
  19554. const indexBase = i0 * width;
  19555. const checkAllEmpty = i0 + 3 < height;
  19556. for (let j = 0; j < width; j++) {
  19557. const index0 = indexBase + j;
  19558. 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;
  19559. let i1 = 0,
  19560. index = index0;
  19561. let i = i0,
  19562. sign;
  19563. if (allEmpty) {
  19564. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  19565. if (!hasSignificantCoefficent) {
  19566. bitsDecoded[index0]++;
  19567. bitsDecoded[index0 + oneRowDown]++;
  19568. bitsDecoded[index0 + twoRowsDown]++;
  19569. bitsDecoded[index0 + threeRowsDown]++;
  19570. continue;
  19571. }
  19572. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  19573. if (i1 !== 0) {
  19574. i = i0 + i1;
  19575. index += i1 * width;
  19576. }
  19577. sign = this.decodeSignBit(i, j, index);
  19578. coefficentsSign[index] = sign;
  19579. coefficentsMagnitude[index] = 1;
  19580. this.setNeighborsSignificance(i, j, index);
  19581. processingFlags[index] |= firstMagnitudeBitMask;
  19582. index = index0;
  19583. for (let i2 = i0; i2 <= i; i2++, index += width) {
  19584. bitsDecoded[index]++;
  19585. }
  19586. i1++;
  19587. }
  19588. for (i = i0 + i1; i < iNext; i++, index += width) {
  19589. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19590. continue;
  19591. }
  19592. const contextLabel = labels[neighborsSignificance[index]];
  19593. const decision = decoder.readBit(contexts, contextLabel);
  19594. if (decision === 1) {
  19595. sign = this.decodeSignBit(i, j, index);
  19596. coefficentsSign[index] = sign;
  19597. coefficentsMagnitude[index] = 1;
  19598. this.setNeighborsSignificance(i, j, index);
  19599. processingFlags[index] |= firstMagnitudeBitMask;
  19600. }
  19601. bitsDecoded[index]++;
  19602. }
  19603. }
  19604. }
  19605. }
  19606. checkSegmentationSymbol() {
  19607. const decoder = this.decoder;
  19608. const contexts = this.contexts;
  19609. 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);
  19610. if (symbol !== 0xa) {
  19611. throw new JpxError("Invalid segmentation symbol");
  19612. }
  19613. }
  19614. }
  19615. return BitModel;
  19616. }();
  19617. class Transform {
  19618. constructor() {
  19619. if (this.constructor === Transform) {
  19620. (0, _util.unreachable)("Cannot initialize Transform.");
  19621. }
  19622. }
  19623. calculate(subbands, u0, v0) {
  19624. let ll = subbands[0];
  19625. for (let i = 1, ii = subbands.length; i < ii; i++) {
  19626. ll = this.iterate(ll, subbands[i], u0, v0);
  19627. }
  19628. return ll;
  19629. }
  19630. extend(buffer, offset, size) {
  19631. let i1 = offset - 1,
  19632. j1 = offset + 1;
  19633. let i2 = offset + size - 2,
  19634. j2 = offset + size;
  19635. buffer[i1--] = buffer[j1++];
  19636. buffer[j2++] = buffer[i2--];
  19637. buffer[i1--] = buffer[j1++];
  19638. buffer[j2++] = buffer[i2--];
  19639. buffer[i1--] = buffer[j1++];
  19640. buffer[j2++] = buffer[i2--];
  19641. buffer[i1] = buffer[j1];
  19642. buffer[j2] = buffer[i2];
  19643. }
  19644. filter(x, offset, length) {
  19645. (0, _util.unreachable)("Abstract method `filter` called");
  19646. }
  19647. iterate(ll, hl_lh_hh, u0, v0) {
  19648. const llWidth = ll.width,
  19649. llHeight = ll.height;
  19650. let llItems = ll.items;
  19651. const width = hl_lh_hh.width;
  19652. const height = hl_lh_hh.height;
  19653. const items = hl_lh_hh.items;
  19654. let i, j, k, l, u, v;
  19655. for (k = 0, i = 0; i < llHeight; i++) {
  19656. l = i * 2 * width;
  19657. for (j = 0; j < llWidth; j++, k++, l += 2) {
  19658. items[l] = llItems[k];
  19659. }
  19660. }
  19661. llItems = ll.items = null;
  19662. const bufferPadding = 4;
  19663. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  19664. if (width === 1) {
  19665. if ((u0 & 1) !== 0) {
  19666. for (v = 0, k = 0; v < height; v++, k += width) {
  19667. items[k] *= 0.5;
  19668. }
  19669. }
  19670. } else {
  19671. for (v = 0, k = 0; v < height; v++, k += width) {
  19672. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  19673. this.extend(rowBuffer, bufferPadding, width);
  19674. this.filter(rowBuffer, bufferPadding, width);
  19675. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  19676. }
  19677. }
  19678. let numBuffers = 16;
  19679. const colBuffers = [];
  19680. for (i = 0; i < numBuffers; i++) {
  19681. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  19682. }
  19683. let b,
  19684. currentBuffer = 0;
  19685. ll = bufferPadding + height;
  19686. if (height === 1) {
  19687. if ((v0 & 1) !== 0) {
  19688. for (u = 0; u < width; u++) {
  19689. items[u] *= 0.5;
  19690. }
  19691. }
  19692. } else {
  19693. for (u = 0; u < width; u++) {
  19694. if (currentBuffer === 0) {
  19695. numBuffers = Math.min(width - u, numBuffers);
  19696. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  19697. for (b = 0; b < numBuffers; b++) {
  19698. colBuffers[b][l] = items[k + b];
  19699. }
  19700. }
  19701. currentBuffer = numBuffers;
  19702. }
  19703. currentBuffer--;
  19704. const buffer = colBuffers[currentBuffer];
  19705. this.extend(buffer, bufferPadding, height);
  19706. this.filter(buffer, bufferPadding, height);
  19707. if (currentBuffer === 0) {
  19708. k = u - numBuffers + 1;
  19709. for (l = bufferPadding; l < ll; k += width, l++) {
  19710. for (b = 0; b < numBuffers; b++) {
  19711. items[k + b] = colBuffers[b][l];
  19712. }
  19713. }
  19714. }
  19715. }
  19716. }
  19717. return {
  19718. width,
  19719. height,
  19720. items
  19721. };
  19722. }
  19723. }
  19724. class IrreversibleTransform extends Transform {
  19725. filter(x, offset, length) {
  19726. const len = length >> 1;
  19727. offset |= 0;
  19728. let j, n, current, next;
  19729. const alpha = -1.586134342059924;
  19730. const beta = -0.052980118572961;
  19731. const gamma = 0.882911075530934;
  19732. const delta = 0.443506852043971;
  19733. const K = 1.230174104914001;
  19734. const K_ = 1 / K;
  19735. j = offset - 3;
  19736. for (n = len + 4; n--; j += 2) {
  19737. x[j] *= K_;
  19738. }
  19739. j = offset - 2;
  19740. current = delta * x[j - 1];
  19741. for (n = len + 3; n--; j += 2) {
  19742. next = delta * x[j + 1];
  19743. x[j] = K * x[j] - current - next;
  19744. if (n--) {
  19745. j += 2;
  19746. current = delta * x[j + 1];
  19747. x[j] = K * x[j] - current - next;
  19748. } else {
  19749. break;
  19750. }
  19751. }
  19752. j = offset - 1;
  19753. current = gamma * x[j - 1];
  19754. for (n = len + 2; n--; j += 2) {
  19755. next = gamma * x[j + 1];
  19756. x[j] -= current + next;
  19757. if (n--) {
  19758. j += 2;
  19759. current = gamma * x[j + 1];
  19760. x[j] -= current + next;
  19761. } else {
  19762. break;
  19763. }
  19764. }
  19765. j = offset;
  19766. current = beta * x[j - 1];
  19767. for (n = len + 1; n--; j += 2) {
  19768. next = beta * x[j + 1];
  19769. x[j] -= current + next;
  19770. if (n--) {
  19771. j += 2;
  19772. current = beta * x[j + 1];
  19773. x[j] -= current + next;
  19774. } else {
  19775. break;
  19776. }
  19777. }
  19778. if (len !== 0) {
  19779. j = offset + 1;
  19780. current = alpha * x[j - 1];
  19781. for (n = len; n--; j += 2) {
  19782. next = alpha * x[j + 1];
  19783. x[j] -= current + next;
  19784. if (n--) {
  19785. j += 2;
  19786. current = alpha * x[j + 1];
  19787. x[j] -= current + next;
  19788. } else {
  19789. break;
  19790. }
  19791. }
  19792. }
  19793. }
  19794. }
  19795. class ReversibleTransform extends Transform {
  19796. filter(x, offset, length) {
  19797. const len = length >> 1;
  19798. offset |= 0;
  19799. let j, n;
  19800. for (j = offset, n = len + 1; n--; j += 2) {
  19801. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  19802. }
  19803. for (j = offset + 1, n = len; n--; j += 2) {
  19804. x[j] += x[j - 1] + x[j + 1] >> 1;
  19805. }
  19806. }
  19807. }
  19808. /***/ }),
  19809. /* 31 */
  19810. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19811. Object.defineProperty(exports, "__esModule", ({
  19812. value: true
  19813. }));
  19814. exports.LZWStream = void 0;
  19815. var _decode_stream = __w_pdfjs_require__(19);
  19816. class LZWStream extends _decode_stream.DecodeStream {
  19817. constructor(str, maybeLength, earlyChange) {
  19818. super(maybeLength);
  19819. this.str = str;
  19820. this.dict = str.dict;
  19821. this.cachedData = 0;
  19822. this.bitsCached = 0;
  19823. const maxLzwDictionarySize = 4096;
  19824. const lzwState = {
  19825. earlyChange,
  19826. codeLength: 9,
  19827. nextCode: 258,
  19828. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  19829. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  19830. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  19831. currentSequence: new Uint8Array(maxLzwDictionarySize),
  19832. currentSequenceLength: 0
  19833. };
  19834. for (let i = 0; i < 256; ++i) {
  19835. lzwState.dictionaryValues[i] = i;
  19836. lzwState.dictionaryLengths[i] = 1;
  19837. }
  19838. this.lzwState = lzwState;
  19839. }
  19840. readBits(n) {
  19841. let bitsCached = this.bitsCached;
  19842. let cachedData = this.cachedData;
  19843. while (bitsCached < n) {
  19844. const c = this.str.getByte();
  19845. if (c === -1) {
  19846. this.eof = true;
  19847. return null;
  19848. }
  19849. cachedData = cachedData << 8 | c;
  19850. bitsCached += 8;
  19851. }
  19852. this.bitsCached = bitsCached -= n;
  19853. this.cachedData = cachedData;
  19854. this.lastCode = null;
  19855. return cachedData >>> bitsCached & (1 << n) - 1;
  19856. }
  19857. readBlock() {
  19858. const blockSize = 512,
  19859. decodedSizeDelta = blockSize;
  19860. let estimatedDecodedSize = blockSize * 2;
  19861. let i, j, q;
  19862. const lzwState = this.lzwState;
  19863. if (!lzwState) {
  19864. return;
  19865. }
  19866. const earlyChange = lzwState.earlyChange;
  19867. let nextCode = lzwState.nextCode;
  19868. const dictionaryValues = lzwState.dictionaryValues;
  19869. const dictionaryLengths = lzwState.dictionaryLengths;
  19870. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  19871. let codeLength = lzwState.codeLength;
  19872. let prevCode = lzwState.prevCode;
  19873. const currentSequence = lzwState.currentSequence;
  19874. let currentSequenceLength = lzwState.currentSequenceLength;
  19875. let decodedLength = 0;
  19876. let currentBufferLength = this.bufferLength;
  19877. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  19878. for (i = 0; i < blockSize; i++) {
  19879. const code = this.readBits(codeLength);
  19880. const hasPrev = currentSequenceLength > 0;
  19881. if (code < 256) {
  19882. currentSequence[0] = code;
  19883. currentSequenceLength = 1;
  19884. } else if (code >= 258) {
  19885. if (code < nextCode) {
  19886. currentSequenceLength = dictionaryLengths[code];
  19887. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  19888. currentSequence[j] = dictionaryValues[q];
  19889. q = dictionaryPrevCodes[q];
  19890. }
  19891. } else {
  19892. currentSequence[currentSequenceLength++] = currentSequence[0];
  19893. }
  19894. } else if (code === 256) {
  19895. codeLength = 9;
  19896. nextCode = 258;
  19897. currentSequenceLength = 0;
  19898. continue;
  19899. } else {
  19900. this.eof = true;
  19901. delete this.lzwState;
  19902. break;
  19903. }
  19904. if (hasPrev) {
  19905. dictionaryPrevCodes[nextCode] = prevCode;
  19906. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  19907. dictionaryValues[nextCode] = currentSequence[0];
  19908. nextCode++;
  19909. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  19910. }
  19911. prevCode = code;
  19912. decodedLength += currentSequenceLength;
  19913. if (estimatedDecodedSize < decodedLength) {
  19914. do {
  19915. estimatedDecodedSize += decodedSizeDelta;
  19916. } while (estimatedDecodedSize < decodedLength);
  19917. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  19918. }
  19919. for (j = 0; j < currentSequenceLength; j++) {
  19920. buffer[currentBufferLength++] = currentSequence[j];
  19921. }
  19922. }
  19923. lzwState.nextCode = nextCode;
  19924. lzwState.codeLength = codeLength;
  19925. lzwState.prevCode = prevCode;
  19926. lzwState.currentSequenceLength = currentSequenceLength;
  19927. this.bufferLength = currentBufferLength;
  19928. }
  19929. }
  19930. exports.LZWStream = LZWStream;
  19931. /***/ }),
  19932. /* 32 */
  19933. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19934. Object.defineProperty(exports, "__esModule", ({
  19935. value: true
  19936. }));
  19937. exports.PredictorStream = void 0;
  19938. var _decode_stream = __w_pdfjs_require__(19);
  19939. var _primitives = __w_pdfjs_require__(5);
  19940. var _util = __w_pdfjs_require__(2);
  19941. class PredictorStream extends _decode_stream.DecodeStream {
  19942. constructor(str, maybeLength, params) {
  19943. super(maybeLength);
  19944. if (!(params instanceof _primitives.Dict)) {
  19945. return str;
  19946. }
  19947. const predictor = this.predictor = params.get("Predictor") || 1;
  19948. if (predictor <= 1) {
  19949. return str;
  19950. }
  19951. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  19952. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  19953. }
  19954. if (predictor === 2) {
  19955. this.readBlock = this.readBlockTiff;
  19956. } else {
  19957. this.readBlock = this.readBlockPng;
  19958. }
  19959. this.str = str;
  19960. this.dict = str.dict;
  19961. const colors = this.colors = params.get("Colors") || 1;
  19962. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  19963. const columns = this.columns = params.get("Columns") || 1;
  19964. this.pixBytes = colors * bits + 7 >> 3;
  19965. this.rowBytes = columns * colors * bits + 7 >> 3;
  19966. return this;
  19967. }
  19968. readBlockTiff() {
  19969. const rowBytes = this.rowBytes;
  19970. const bufferLength = this.bufferLength;
  19971. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  19972. const bits = this.bits;
  19973. const colors = this.colors;
  19974. const rawBytes = this.str.getBytes(rowBytes);
  19975. this.eof = !rawBytes.length;
  19976. if (this.eof) {
  19977. return;
  19978. }
  19979. let inbuf = 0,
  19980. outbuf = 0;
  19981. let inbits = 0,
  19982. outbits = 0;
  19983. let pos = bufferLength;
  19984. let i;
  19985. if (bits === 1 && colors === 1) {
  19986. for (i = 0; i < rowBytes; ++i) {
  19987. let c = rawBytes[i] ^ inbuf;
  19988. c ^= c >> 1;
  19989. c ^= c >> 2;
  19990. c ^= c >> 4;
  19991. inbuf = (c & 1) << 7;
  19992. buffer[pos++] = c;
  19993. }
  19994. } else if (bits === 8) {
  19995. for (i = 0; i < colors; ++i) {
  19996. buffer[pos++] = rawBytes[i];
  19997. }
  19998. for (; i < rowBytes; ++i) {
  19999. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  20000. pos++;
  20001. }
  20002. } else if (bits === 16) {
  20003. const bytesPerPixel = colors * 2;
  20004. for (i = 0; i < bytesPerPixel; ++i) {
  20005. buffer[pos++] = rawBytes[i];
  20006. }
  20007. for (; i < rowBytes; i += 2) {
  20008. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  20009. buffer[pos++] = sum >> 8 & 0xff;
  20010. buffer[pos++] = sum & 0xff;
  20011. }
  20012. } else {
  20013. const compArray = new Uint8Array(colors + 1);
  20014. const bitMask = (1 << bits) - 1;
  20015. let j = 0,
  20016. k = bufferLength;
  20017. const columns = this.columns;
  20018. for (i = 0; i < columns; ++i) {
  20019. for (let kk = 0; kk < colors; ++kk) {
  20020. if (inbits < bits) {
  20021. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  20022. inbits += 8;
  20023. }
  20024. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  20025. inbits -= bits;
  20026. outbuf = outbuf << bits | compArray[kk];
  20027. outbits += bits;
  20028. if (outbits >= 8) {
  20029. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  20030. outbits -= 8;
  20031. }
  20032. }
  20033. }
  20034. if (outbits > 0) {
  20035. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  20036. }
  20037. }
  20038. this.bufferLength += rowBytes;
  20039. }
  20040. readBlockPng() {
  20041. const rowBytes = this.rowBytes;
  20042. const pixBytes = this.pixBytes;
  20043. const predictor = this.str.getByte();
  20044. const rawBytes = this.str.getBytes(rowBytes);
  20045. this.eof = !rawBytes.length;
  20046. if (this.eof) {
  20047. return;
  20048. }
  20049. const bufferLength = this.bufferLength;
  20050. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  20051. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  20052. if (prevRow.length === 0) {
  20053. prevRow = new Uint8Array(rowBytes);
  20054. }
  20055. let i,
  20056. j = bufferLength,
  20057. up,
  20058. c;
  20059. switch (predictor) {
  20060. case 0:
  20061. for (i = 0; i < rowBytes; ++i) {
  20062. buffer[j++] = rawBytes[i];
  20063. }
  20064. break;
  20065. case 1:
  20066. for (i = 0; i < pixBytes; ++i) {
  20067. buffer[j++] = rawBytes[i];
  20068. }
  20069. for (; i < rowBytes; ++i) {
  20070. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  20071. j++;
  20072. }
  20073. break;
  20074. case 2:
  20075. for (i = 0; i < rowBytes; ++i) {
  20076. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  20077. }
  20078. break;
  20079. case 3:
  20080. for (i = 0; i < pixBytes; ++i) {
  20081. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  20082. }
  20083. for (; i < rowBytes; ++i) {
  20084. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  20085. j++;
  20086. }
  20087. break;
  20088. case 4:
  20089. for (i = 0; i < pixBytes; ++i) {
  20090. up = prevRow[i];
  20091. c = rawBytes[i];
  20092. buffer[j++] = up + c;
  20093. }
  20094. for (; i < rowBytes; ++i) {
  20095. up = prevRow[i];
  20096. const upLeft = prevRow[i - pixBytes];
  20097. const left = buffer[j - pixBytes];
  20098. const p = left + up - upLeft;
  20099. let pa = p - left;
  20100. if (pa < 0) {
  20101. pa = -pa;
  20102. }
  20103. let pb = p - up;
  20104. if (pb < 0) {
  20105. pb = -pb;
  20106. }
  20107. let pc = p - upLeft;
  20108. if (pc < 0) {
  20109. pc = -pc;
  20110. }
  20111. c = rawBytes[i];
  20112. if (pa <= pb && pa <= pc) {
  20113. buffer[j++] = left + c;
  20114. } else if (pb <= pc) {
  20115. buffer[j++] = up + c;
  20116. } else {
  20117. buffer[j++] = upLeft + c;
  20118. }
  20119. }
  20120. break;
  20121. default:
  20122. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  20123. }
  20124. this.bufferLength += rowBytes;
  20125. }
  20126. }
  20127. exports.PredictorStream = PredictorStream;
  20128. /***/ }),
  20129. /* 33 */
  20130. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20131. Object.defineProperty(exports, "__esModule", ({
  20132. value: true
  20133. }));
  20134. exports.RunLengthStream = void 0;
  20135. var _decode_stream = __w_pdfjs_require__(19);
  20136. class RunLengthStream extends _decode_stream.DecodeStream {
  20137. constructor(str, maybeLength) {
  20138. super(maybeLength);
  20139. this.str = str;
  20140. this.dict = str.dict;
  20141. }
  20142. readBlock() {
  20143. const repeatHeader = this.str.getBytes(2);
  20144. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  20145. this.eof = true;
  20146. return;
  20147. }
  20148. let buffer;
  20149. let bufferLength = this.bufferLength;
  20150. let n = repeatHeader[0];
  20151. if (n < 128) {
  20152. buffer = this.ensureBuffer(bufferLength + n + 1);
  20153. buffer[bufferLength++] = repeatHeader[1];
  20154. if (n > 0) {
  20155. const source = this.str.getBytes(n);
  20156. buffer.set(source, bufferLength);
  20157. bufferLength += n;
  20158. }
  20159. } else {
  20160. n = 257 - n;
  20161. const b = repeatHeader[1];
  20162. buffer = this.ensureBuffer(bufferLength + n + 1);
  20163. for (let i = 0; i < n; i++) {
  20164. buffer[bufferLength++] = b;
  20165. }
  20166. }
  20167. this.bufferLength = bufferLength;
  20168. }
  20169. }
  20170. exports.RunLengthStream = RunLengthStream;
  20171. /***/ }),
  20172. /* 34 */
  20173. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20174. Object.defineProperty(exports, "__esModule", ({
  20175. value: true
  20176. }));
  20177. exports.Font = exports.ErrorFont = void 0;
  20178. var _util = __w_pdfjs_require__(2);
  20179. var _cff_parser = __w_pdfjs_require__(35);
  20180. var _fonts_utils = __w_pdfjs_require__(38);
  20181. var _unicode = __w_pdfjs_require__(40);
  20182. var _glyphlist = __w_pdfjs_require__(39);
  20183. var _encodings = __w_pdfjs_require__(37);
  20184. var _standard_fonts = __w_pdfjs_require__(41);
  20185. var _to_unicode_map = __w_pdfjs_require__(42);
  20186. var _cff_font = __w_pdfjs_require__(43);
  20187. var _font_renderer = __w_pdfjs_require__(44);
  20188. var _metrics = __w_pdfjs_require__(45);
  20189. var _glyf = __w_pdfjs_require__(46);
  20190. var _cmap = __w_pdfjs_require__(16);
  20191. var _opentype_file_builder = __w_pdfjs_require__(47);
  20192. var _core_utils = __w_pdfjs_require__(6);
  20193. var _stream = __w_pdfjs_require__(10);
  20194. var _type1_font = __w_pdfjs_require__(48);
  20195. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  20196. const PDF_GLYPH_SPACE_UNITS = 1000;
  20197. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  20198. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  20199. function adjustWidths(properties) {
  20200. if (!properties.fontMatrix) {
  20201. return;
  20202. }
  20203. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  20204. return;
  20205. }
  20206. const scale = 0.001 / properties.fontMatrix[0];
  20207. const glyphsWidths = properties.widths;
  20208. for (const glyph in glyphsWidths) {
  20209. glyphsWidths[glyph] *= scale;
  20210. }
  20211. properties.defaultWidth *= scale;
  20212. }
  20213. function adjustToUnicode(properties, builtInEncoding) {
  20214. if (properties.isInternalFont) {
  20215. return;
  20216. }
  20217. if (builtInEncoding === properties.defaultEncoding) {
  20218. return;
  20219. }
  20220. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20221. return;
  20222. }
  20223. const toUnicode = [],
  20224. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20225. for (const charCode in builtInEncoding) {
  20226. if (properties.hasIncludedToUnicodeMap) {
  20227. if (properties.toUnicode.has(charCode)) {
  20228. continue;
  20229. }
  20230. } else if (properties.hasEncoding) {
  20231. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  20232. continue;
  20233. }
  20234. }
  20235. const glyphName = builtInEncoding[charCode];
  20236. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20237. if (unicode !== -1) {
  20238. toUnicode[charCode] = String.fromCharCode(unicode);
  20239. }
  20240. }
  20241. if (toUnicode.length > 0) {
  20242. properties.toUnicode.amend(toUnicode);
  20243. }
  20244. }
  20245. function amendFallbackToUnicode(properties) {
  20246. if (!properties.fallbackToUnicode) {
  20247. return;
  20248. }
  20249. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20250. return;
  20251. }
  20252. const toUnicode = [];
  20253. for (const charCode in properties.fallbackToUnicode) {
  20254. if (properties.toUnicode.has(charCode)) {
  20255. continue;
  20256. }
  20257. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  20258. }
  20259. if (toUnicode.length > 0) {
  20260. properties.toUnicode.amend(toUnicode);
  20261. }
  20262. }
  20263. class Glyph {
  20264. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20265. this.originalCharCode = originalCharCode;
  20266. this.fontChar = fontChar;
  20267. this.unicode = unicode;
  20268. this.accent = accent;
  20269. this.width = width;
  20270. this.vmetric = vmetric;
  20271. this.operatorListId = operatorListId;
  20272. this.isSpace = isSpace;
  20273. this.isInFont = isInFont;
  20274. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  20275. this.isWhitespace = category.isWhitespace;
  20276. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  20277. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  20278. }
  20279. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20280. return this.originalCharCode === originalCharCode && this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
  20281. }
  20282. }
  20283. function int16(b0, b1) {
  20284. return (b0 << 8) + b1;
  20285. }
  20286. function writeSignedInt16(bytes, index, value) {
  20287. bytes[index + 1] = value;
  20288. bytes[index] = value >>> 8;
  20289. }
  20290. function signedInt16(b0, b1) {
  20291. const value = (b0 << 8) + b1;
  20292. return value & 1 << 15 ? value - 0x10000 : value;
  20293. }
  20294. function int32(b0, b1, b2, b3) {
  20295. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  20296. }
  20297. function string16(value) {
  20298. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20299. }
  20300. function safeString16(value) {
  20301. if (value > 0x7fff) {
  20302. value = 0x7fff;
  20303. } else if (value < -0x8000) {
  20304. value = -0x8000;
  20305. }
  20306. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20307. }
  20308. function isTrueTypeFile(file) {
  20309. const header = file.peekBytes(4);
  20310. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  20311. }
  20312. function isTrueTypeCollectionFile(file) {
  20313. const header = file.peekBytes(4);
  20314. return (0, _util.bytesToString)(header) === "ttcf";
  20315. }
  20316. function isOpenTypeFile(file) {
  20317. const header = file.peekBytes(4);
  20318. return (0, _util.bytesToString)(header) === "OTTO";
  20319. }
  20320. function isType1File(file) {
  20321. const header = file.peekBytes(2);
  20322. if (header[0] === 0x25 && header[1] === 0x21) {
  20323. return true;
  20324. }
  20325. if (header[0] === 0x80 && header[1] === 0x01) {
  20326. return true;
  20327. }
  20328. return false;
  20329. }
  20330. function isCFFFile(file) {
  20331. const header = file.peekBytes(4);
  20332. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  20333. return true;
  20334. }
  20335. return false;
  20336. }
  20337. function getFontFileType(file, {
  20338. type,
  20339. subtype,
  20340. composite
  20341. }) {
  20342. let fileType, fileSubtype;
  20343. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  20344. if (composite) {
  20345. fileType = "CIDFontType2";
  20346. } else {
  20347. fileType = "TrueType";
  20348. }
  20349. } else if (isOpenTypeFile(file)) {
  20350. if (composite) {
  20351. fileType = "CIDFontType2";
  20352. } else {
  20353. fileType = "OpenType";
  20354. }
  20355. } else if (isType1File(file)) {
  20356. if (composite) {
  20357. fileType = "CIDFontType0";
  20358. } else {
  20359. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20360. }
  20361. } else if (isCFFFile(file)) {
  20362. if (composite) {
  20363. fileType = "CIDFontType0";
  20364. fileSubtype = "CIDFontType0C";
  20365. } else {
  20366. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20367. fileSubtype = "Type1C";
  20368. }
  20369. } else {
  20370. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  20371. fileType = type;
  20372. fileSubtype = subtype;
  20373. }
  20374. return [fileType, fileSubtype];
  20375. }
  20376. function applyStandardFontGlyphMap(map, glyphMap) {
  20377. for (const charCode in glyphMap) {
  20378. map[+charCode] = glyphMap[charCode];
  20379. }
  20380. }
  20381. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  20382. const toFontChar = [];
  20383. let unicode;
  20384. for (let i = 0, ii = encoding.length; i < ii; i++) {
  20385. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  20386. if (unicode !== -1) {
  20387. toFontChar[i] = unicode;
  20388. }
  20389. }
  20390. for (const charCode in differences) {
  20391. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  20392. if (unicode !== -1) {
  20393. toFontChar[+charCode] = unicode;
  20394. }
  20395. }
  20396. return toFontChar;
  20397. }
  20398. function convertCidString(charCode, cid, shouldThrow = false) {
  20399. switch (cid.length) {
  20400. case 1:
  20401. return cid.charCodeAt(0);
  20402. case 2:
  20403. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  20404. }
  20405. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  20406. if (shouldThrow) {
  20407. throw new _util.FormatError(msg);
  20408. }
  20409. (0, _util.warn)(msg);
  20410. return cid;
  20411. }
  20412. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  20413. const newMap = Object.create(null);
  20414. const toUnicodeExtraMap = new Map();
  20415. const toFontChar = [];
  20416. const usedGlyphIds = new Set();
  20417. let privateUseAreaIndex = 0;
  20418. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20419. let nextAvailableFontCharCode = privateUseOffetStart;
  20420. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20421. for (let originalCharCode in charCodeToGlyphId) {
  20422. originalCharCode |= 0;
  20423. let glyphId = charCodeToGlyphId[originalCharCode];
  20424. if (!hasGlyph(glyphId)) {
  20425. continue;
  20426. }
  20427. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  20428. privateUseAreaIndex++;
  20429. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  20430. (0, _util.warn)("Ran out of space in font private use area.");
  20431. break;
  20432. }
  20433. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20434. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20435. }
  20436. const fontCharCode = nextAvailableFontCharCode++;
  20437. if (glyphId === 0) {
  20438. glyphId = newGlyphZeroId;
  20439. }
  20440. let unicode = toUnicode.get(originalCharCode);
  20441. if (typeof unicode === "string") {
  20442. unicode = unicode.codePointAt(0);
  20443. }
  20444. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  20445. toUnicodeExtraMap.set(unicode, glyphId);
  20446. usedGlyphIds.add(glyphId);
  20447. }
  20448. newMap[fontCharCode] = glyphId;
  20449. toFontChar[originalCharCode] = fontCharCode;
  20450. }
  20451. return {
  20452. toFontChar,
  20453. charCodeToGlyphId: newMap,
  20454. toUnicodeExtraMap,
  20455. nextAvailableFontCharCode
  20456. };
  20457. }
  20458. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  20459. const codes = [];
  20460. for (const charCode in glyphs) {
  20461. if (glyphs[charCode] >= numGlyphs) {
  20462. continue;
  20463. }
  20464. codes.push({
  20465. fontCharCode: charCode | 0,
  20466. glyphId: glyphs[charCode]
  20467. });
  20468. }
  20469. if (toUnicodeExtraMap) {
  20470. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  20471. if (glyphId >= numGlyphs) {
  20472. continue;
  20473. }
  20474. codes.push({
  20475. fontCharCode: unicode,
  20476. glyphId
  20477. });
  20478. }
  20479. }
  20480. if (codes.length === 0) {
  20481. codes.push({
  20482. fontCharCode: 0,
  20483. glyphId: 0
  20484. });
  20485. }
  20486. codes.sort(function fontGetRangesSort(a, b) {
  20487. return a.fontCharCode - b.fontCharCode;
  20488. });
  20489. const ranges = [];
  20490. const length = codes.length;
  20491. for (let n = 0; n < length;) {
  20492. const start = codes[n].fontCharCode;
  20493. const codeIndices = [codes[n].glyphId];
  20494. ++n;
  20495. let end = start;
  20496. while (n < length && end + 1 === codes[n].fontCharCode) {
  20497. codeIndices.push(codes[n].glyphId);
  20498. ++end;
  20499. ++n;
  20500. if (end === 0xffff) {
  20501. break;
  20502. }
  20503. }
  20504. ranges.push([start, end, codeIndices]);
  20505. }
  20506. return ranges;
  20507. }
  20508. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  20509. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  20510. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  20511. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  20512. let i, ii, j, jj;
  20513. for (i = ranges.length - 1; i >= 0; --i) {
  20514. if (ranges[i][0] <= 0xffff) {
  20515. break;
  20516. }
  20517. }
  20518. const bmpLength = i + 1;
  20519. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  20520. ranges[i][1] = 0xfffe;
  20521. }
  20522. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  20523. const segCount = bmpLength + trailingRangesCount;
  20524. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  20525. let startCount = "";
  20526. let endCount = "";
  20527. let idDeltas = "";
  20528. let idRangeOffsets = "";
  20529. let glyphsIds = "";
  20530. let bias = 0;
  20531. let range, start, end, codes;
  20532. for (i = 0, ii = bmpLength; i < ii; i++) {
  20533. range = ranges[i];
  20534. start = range[0];
  20535. end = range[1];
  20536. startCount += string16(start);
  20537. endCount += string16(end);
  20538. codes = range[2];
  20539. let contiguous = true;
  20540. for (j = 1, jj = codes.length; j < jj; ++j) {
  20541. if (codes[j] !== codes[j - 1] + 1) {
  20542. contiguous = false;
  20543. break;
  20544. }
  20545. }
  20546. if (!contiguous) {
  20547. const offset = (segCount - i) * 2 + bias * 2;
  20548. bias += end - start + 1;
  20549. idDeltas += string16(0);
  20550. idRangeOffsets += string16(offset);
  20551. for (j = 0, jj = codes.length; j < jj; ++j) {
  20552. glyphsIds += string16(codes[j]);
  20553. }
  20554. } else {
  20555. const startCode = codes[0];
  20556. idDeltas += string16(startCode - start & 0xffff);
  20557. idRangeOffsets += string16(0);
  20558. }
  20559. }
  20560. if (trailingRangesCount > 0) {
  20561. endCount += "\xFF\xFF";
  20562. startCount += "\xFF\xFF";
  20563. idDeltas += "\x00\x01";
  20564. idRangeOffsets += "\x00\x00";
  20565. }
  20566. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  20567. let format31012 = "";
  20568. let header31012 = "";
  20569. if (numTables > 1) {
  20570. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  20571. format31012 = "";
  20572. for (i = 0, ii = ranges.length; i < ii; i++) {
  20573. range = ranges[i];
  20574. start = range[0];
  20575. codes = range[2];
  20576. let code = codes[0];
  20577. for (j = 1, jj = codes.length; j < jj; ++j) {
  20578. if (codes[j] !== codes[j - 1] + 1) {
  20579. end = range[0] + j - 1;
  20580. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  20581. start = end + 1;
  20582. code = codes[j];
  20583. }
  20584. }
  20585. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  20586. }
  20587. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  20588. }
  20589. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  20590. }
  20591. function validateOS2Table(os2, file) {
  20592. file.pos = (file.start || 0) + os2.offset;
  20593. const version = file.getUint16();
  20594. file.skip(60);
  20595. const selection = file.getUint16();
  20596. if (version < 4 && selection & 0x0300) {
  20597. return false;
  20598. }
  20599. const firstChar = file.getUint16();
  20600. const lastChar = file.getUint16();
  20601. if (firstChar > lastChar) {
  20602. return false;
  20603. }
  20604. file.skip(6);
  20605. const usWinAscent = file.getUint16();
  20606. if (usWinAscent === 0) {
  20607. return false;
  20608. }
  20609. os2.data[8] = os2.data[9] = 0;
  20610. return true;
  20611. }
  20612. function createOS2Table(properties, charstrings, override) {
  20613. override = override || {
  20614. unitsPerEm: 0,
  20615. yMax: 0,
  20616. yMin: 0,
  20617. ascent: 0,
  20618. descent: 0
  20619. };
  20620. let ulUnicodeRange1 = 0;
  20621. let ulUnicodeRange2 = 0;
  20622. let ulUnicodeRange3 = 0;
  20623. let ulUnicodeRange4 = 0;
  20624. let firstCharIndex = null;
  20625. let lastCharIndex = 0;
  20626. if (charstrings) {
  20627. for (let code in charstrings) {
  20628. code |= 0;
  20629. if (firstCharIndex > code || !firstCharIndex) {
  20630. firstCharIndex = code;
  20631. }
  20632. if (lastCharIndex < code) {
  20633. lastCharIndex = code;
  20634. }
  20635. const position = (0, _unicode.getUnicodeRangeFor)(code);
  20636. if (position < 32) {
  20637. ulUnicodeRange1 |= 1 << position;
  20638. } else if (position < 64) {
  20639. ulUnicodeRange2 |= 1 << position - 32;
  20640. } else if (position < 96) {
  20641. ulUnicodeRange3 |= 1 << position - 64;
  20642. } else if (position < 123) {
  20643. ulUnicodeRange4 |= 1 << position - 96;
  20644. } else {
  20645. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  20646. }
  20647. }
  20648. if (lastCharIndex > 0xffff) {
  20649. lastCharIndex = 0xffff;
  20650. }
  20651. } else {
  20652. firstCharIndex = 0;
  20653. lastCharIndex = 255;
  20654. }
  20655. const bbox = properties.bbox || [0, 0, 0, 0];
  20656. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  20657. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  20658. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  20659. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  20660. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  20661. typoDescent = -typoDescent;
  20662. }
  20663. const winAscent = override.yMax || typoAscent;
  20664. const winDescent = -override.yMin || -typoDescent;
  20665. 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";
  20666. }
  20667. function createPostTable(properties) {
  20668. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  20669. 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";
  20670. }
  20671. function createPostscriptName(name) {
  20672. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  20673. }
  20674. function createNameTable(name, proto) {
  20675. if (!proto) {
  20676. proto = [[], []];
  20677. }
  20678. 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"];
  20679. const stringsUnicode = [];
  20680. let i, ii, j, jj, str;
  20681. for (i = 0, ii = strings.length; i < ii; i++) {
  20682. str = proto[1][i] || strings[i];
  20683. const strBufUnicode = [];
  20684. for (j = 0, jj = str.length; j < jj; j++) {
  20685. strBufUnicode.push(string16(str.charCodeAt(j)));
  20686. }
  20687. stringsUnicode.push(strBufUnicode.join(""));
  20688. }
  20689. const names = [strings, stringsUnicode];
  20690. const platforms = ["\x00\x01", "\x00\x03"];
  20691. const encodings = ["\x00\x00", "\x00\x01"];
  20692. const languages = ["\x00\x00", "\x04\x09"];
  20693. const namesRecordCount = strings.length * platforms.length;
  20694. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  20695. let strOffset = 0;
  20696. for (i = 0, ii = platforms.length; i < ii; i++) {
  20697. const strs = names[i];
  20698. for (j = 0, jj = strs.length; j < jj; j++) {
  20699. str = strs[j];
  20700. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  20701. nameTable += nameRecord;
  20702. strOffset += str.length;
  20703. }
  20704. }
  20705. nameTable += strings.join("") + stringsUnicode.join("");
  20706. return nameTable;
  20707. }
  20708. class Font {
  20709. constructor(name, file, properties) {
  20710. this.name = name;
  20711. this.psName = null;
  20712. this.mimetype = null;
  20713. this.disableFontFace = false;
  20714. this.loadedName = properties.loadedName;
  20715. this.isType3Font = properties.isType3Font;
  20716. this.missingFile = false;
  20717. this.cssFontInfo = properties.cssFontInfo;
  20718. this._charsCache = Object.create(null);
  20719. this._glyphCache = Object.create(null);
  20720. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  20721. if (!isSerifFont && !properties.isSimulatedFlags) {
  20722. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  20723. serifFonts = (0, _standard_fonts.getSerifFonts)();
  20724. for (const namePart of baseName.split("+")) {
  20725. if (serifFonts[namePart]) {
  20726. isSerifFont = true;
  20727. break;
  20728. }
  20729. }
  20730. }
  20731. this.isSerifFont = isSerifFont;
  20732. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  20733. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  20734. let type = properties.type;
  20735. let subtype = properties.subtype;
  20736. this.type = type;
  20737. this.subtype = subtype;
  20738. let fallbackName = "sans-serif";
  20739. if (this.isMonospace) {
  20740. fallbackName = "monospace";
  20741. } else if (this.isSerifFont) {
  20742. fallbackName = "serif";
  20743. }
  20744. this.fallbackName = fallbackName;
  20745. this.differences = properties.differences;
  20746. this.widths = properties.widths;
  20747. this.defaultWidth = properties.defaultWidth;
  20748. this.composite = properties.composite;
  20749. this.cMap = properties.cMap;
  20750. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  20751. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  20752. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  20753. this.lineHeight = this.ascent - this.descent;
  20754. this.fontMatrix = properties.fontMatrix;
  20755. this.bbox = properties.bbox;
  20756. this.defaultEncoding = properties.defaultEncoding;
  20757. this.toUnicode = properties.toUnicode;
  20758. this.toFontChar = [];
  20759. if (properties.type === "Type3") {
  20760. for (let charCode = 0; charCode < 256; charCode++) {
  20761. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  20762. }
  20763. this.fontType = _util.FontType.TYPE3;
  20764. return;
  20765. }
  20766. this.cidEncoding = properties.cidEncoding || "";
  20767. this.vertical = !!properties.vertical;
  20768. if (this.vertical) {
  20769. this.vmetrics = properties.vmetrics;
  20770. this.defaultVMetrics = properties.defaultVMetrics;
  20771. }
  20772. if (!file || file.isEmpty) {
  20773. if (file) {
  20774. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  20775. }
  20776. this.fallbackToSystemFont(properties);
  20777. return;
  20778. }
  20779. [type, subtype] = getFontFileType(file, properties);
  20780. if (type !== this.type || subtype !== this.subtype) {
  20781. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  20782. }
  20783. let data;
  20784. try {
  20785. switch (type) {
  20786. case "MMType1":
  20787. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  20788. case "Type1":
  20789. case "CIDFontType0":
  20790. this.mimetype = "font/opentype";
  20791. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  20792. adjustWidths(properties);
  20793. data = this.convert(name, cff, properties);
  20794. break;
  20795. case "OpenType":
  20796. case "TrueType":
  20797. case "CIDFontType2":
  20798. this.mimetype = "font/opentype";
  20799. data = this.checkAndRepair(name, file, properties);
  20800. if (this.isOpenType) {
  20801. adjustWidths(properties);
  20802. type = "OpenType";
  20803. }
  20804. break;
  20805. default:
  20806. throw new _util.FormatError(`Font ${type} is not supported`);
  20807. }
  20808. } catch (e) {
  20809. (0, _util.warn)(e);
  20810. this.fallbackToSystemFont(properties);
  20811. return;
  20812. }
  20813. amendFallbackToUnicode(properties);
  20814. this.data = data;
  20815. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  20816. this.fontMatrix = properties.fontMatrix;
  20817. this.widths = properties.widths;
  20818. this.defaultWidth = properties.defaultWidth;
  20819. this.toUnicode = properties.toUnicode;
  20820. this.seacMap = properties.seacMap;
  20821. }
  20822. get renderer() {
  20823. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  20824. return (0, _util.shadow)(this, "renderer", renderer);
  20825. }
  20826. exportData(extraProperties = false) {
  20827. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  20828. const data = Object.create(null);
  20829. let property, value;
  20830. for (property of exportDataProperties) {
  20831. value = this[property];
  20832. if (value !== undefined) {
  20833. data[property] = value;
  20834. }
  20835. }
  20836. return data;
  20837. }
  20838. fallbackToSystemFont(properties) {
  20839. this.missingFile = true;
  20840. const name = this.name;
  20841. const type = this.type;
  20842. const subtype = this.subtype;
  20843. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  20844. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  20845. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  20846. const isStandardFont = !!stdFontMap[fontName];
  20847. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  20848. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  20849. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  20850. const metrics = fontBasicMetricsMap[fontName];
  20851. if (metrics) {
  20852. if (isNaN(this.ascent)) {
  20853. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  20854. }
  20855. if (isNaN(this.descent)) {
  20856. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  20857. }
  20858. if (isNaN(this.capHeight)) {
  20859. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  20860. }
  20861. }
  20862. this.bold = fontName.search(/bold/gi) !== -1;
  20863. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  20864. this.black = name.search(/Black/g) !== -1;
  20865. const isNarrow = name.search(/Narrow/g) !== -1;
  20866. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  20867. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  20868. const cidToGidMap = properties.cidToGidMap;
  20869. const map = [];
  20870. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  20871. if (/Arial-?Black/i.test(name)) {
  20872. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  20873. } else if (/Calibri/i.test(name)) {
  20874. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  20875. }
  20876. if (cidToGidMap) {
  20877. for (const charCode in map) {
  20878. const cid = map[charCode];
  20879. if (cidToGidMap[cid] !== undefined) {
  20880. map[+charCode] = cidToGidMap[cid];
  20881. }
  20882. }
  20883. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20884. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  20885. const cid = map[charCode];
  20886. if (cidToGidMap[cid] === undefined) {
  20887. map[+charCode] = unicodeCharCode;
  20888. }
  20889. });
  20890. }
  20891. }
  20892. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  20893. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  20894. map[+charCode] = unicodeCharCode;
  20895. });
  20896. }
  20897. this.toFontChar = map;
  20898. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  20899. } else if (/Symbol/i.test(fontName)) {
  20900. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  20901. } else if (/Dingbats/i.test(fontName)) {
  20902. if (/Wingdings/i.test(name)) {
  20903. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  20904. }
  20905. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  20906. } else if (isStandardFont) {
  20907. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  20908. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  20909. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  20910. map[+charCode] = unicodeCharCode;
  20911. });
  20912. }
  20913. this.toFontChar = map;
  20914. } else {
  20915. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20916. const map = [];
  20917. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  20918. if (!this.composite) {
  20919. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  20920. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20921. if (unicode !== -1) {
  20922. unicodeCharCode = unicode;
  20923. }
  20924. }
  20925. map[+charCode] = unicodeCharCode;
  20926. });
  20927. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  20928. if (/Verdana/i.test(name)) {
  20929. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  20930. }
  20931. }
  20932. this.toFontChar = map;
  20933. }
  20934. amendFallbackToUnicode(properties);
  20935. this.loadedName = fontName.split("-")[0];
  20936. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  20937. }
  20938. checkAndRepair(name, font, properties) {
  20939. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  20940. function readTables(file, numTables) {
  20941. const tables = Object.create(null);
  20942. tables["OS/2"] = null;
  20943. tables.cmap = null;
  20944. tables.head = null;
  20945. tables.hhea = null;
  20946. tables.hmtx = null;
  20947. tables.maxp = null;
  20948. tables.name = null;
  20949. tables.post = null;
  20950. for (let i = 0; i < numTables; i++) {
  20951. const table = readTableEntry(file);
  20952. if (!VALID_TABLES.includes(table.tag)) {
  20953. continue;
  20954. }
  20955. if (table.length === 0) {
  20956. continue;
  20957. }
  20958. tables[table.tag] = table;
  20959. }
  20960. return tables;
  20961. }
  20962. function readTableEntry(file) {
  20963. const tag = file.getString(4);
  20964. const checksum = file.getInt32() >>> 0;
  20965. const offset = file.getInt32() >>> 0;
  20966. const length = file.getInt32() >>> 0;
  20967. const previousPosition = file.pos;
  20968. file.pos = file.start || 0;
  20969. file.skip(offset);
  20970. const data = file.getBytes(length);
  20971. file.pos = previousPosition;
  20972. if (tag === "head") {
  20973. data[8] = data[9] = data[10] = data[11] = 0;
  20974. data[17] |= 0x20;
  20975. }
  20976. return {
  20977. tag,
  20978. checksum,
  20979. length,
  20980. offset,
  20981. data
  20982. };
  20983. }
  20984. function readOpenTypeHeader(ttf) {
  20985. return {
  20986. version: ttf.getString(4),
  20987. numTables: ttf.getUint16(),
  20988. searchRange: ttf.getUint16(),
  20989. entrySelector: ttf.getUint16(),
  20990. rangeShift: ttf.getUint16()
  20991. };
  20992. }
  20993. function readTrueTypeCollectionHeader(ttc) {
  20994. const ttcTag = ttc.getString(4);
  20995. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  20996. const majorVersion = ttc.getUint16();
  20997. const minorVersion = ttc.getUint16();
  20998. const numFonts = ttc.getInt32() >>> 0;
  20999. const offsetTable = [];
  21000. for (let i = 0; i < numFonts; i++) {
  21001. offsetTable.push(ttc.getInt32() >>> 0);
  21002. }
  21003. const header = {
  21004. ttcTag,
  21005. majorVersion,
  21006. minorVersion,
  21007. numFonts,
  21008. offsetTable
  21009. };
  21010. switch (majorVersion) {
  21011. case 1:
  21012. return header;
  21013. case 2:
  21014. header.dsigTag = ttc.getInt32() >>> 0;
  21015. header.dsigLength = ttc.getInt32() >>> 0;
  21016. header.dsigOffset = ttc.getInt32() >>> 0;
  21017. return header;
  21018. }
  21019. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  21020. }
  21021. function readTrueTypeCollectionData(ttc, fontName) {
  21022. const {
  21023. numFonts,
  21024. offsetTable
  21025. } = readTrueTypeCollectionHeader(ttc);
  21026. const fontNameParts = fontName.split("+");
  21027. let fallbackData;
  21028. for (let i = 0; i < numFonts; i++) {
  21029. ttc.pos = (ttc.start || 0) + offsetTable[i];
  21030. const potentialHeader = readOpenTypeHeader(ttc);
  21031. const potentialTables = readTables(ttc, potentialHeader.numTables);
  21032. if (!potentialTables.name) {
  21033. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  21034. }
  21035. const nameTable = readNameTable(potentialTables.name);
  21036. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  21037. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  21038. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  21039. if (!nameEntry) {
  21040. continue;
  21041. }
  21042. if (nameEntry === fontName) {
  21043. return {
  21044. header: potentialHeader,
  21045. tables: potentialTables
  21046. };
  21047. }
  21048. if (fontNameParts.length < 2) {
  21049. continue;
  21050. }
  21051. for (const part of fontNameParts) {
  21052. if (nameEntry === part) {
  21053. fallbackData = {
  21054. name: part,
  21055. header: potentialHeader,
  21056. tables: potentialTables
  21057. };
  21058. }
  21059. }
  21060. }
  21061. }
  21062. }
  21063. if (fallbackData) {
  21064. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  21065. return {
  21066. header: fallbackData.header,
  21067. tables: fallbackData.tables
  21068. };
  21069. }
  21070. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  21071. }
  21072. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  21073. if (!cmap) {
  21074. (0, _util.warn)("No cmap table available.");
  21075. return {
  21076. platformId: -1,
  21077. encodingId: -1,
  21078. mappings: [],
  21079. hasShortCmap: false
  21080. };
  21081. }
  21082. let segment;
  21083. let start = (file.start || 0) + cmap.offset;
  21084. file.pos = start;
  21085. file.skip(2);
  21086. const numTables = file.getUint16();
  21087. let potentialTable;
  21088. let canBreak = false;
  21089. for (let i = 0; i < numTables; i++) {
  21090. const platformId = file.getUint16();
  21091. const encodingId = file.getUint16();
  21092. const offset = file.getInt32() >>> 0;
  21093. let useTable = false;
  21094. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  21095. continue;
  21096. }
  21097. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  21098. useTable = true;
  21099. } else if (platformId === 1 && encodingId === 0) {
  21100. useTable = true;
  21101. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  21102. useTable = true;
  21103. if (!isSymbolicFont) {
  21104. canBreak = true;
  21105. }
  21106. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  21107. useTable = true;
  21108. let correctlySorted = true;
  21109. if (i < numTables - 1) {
  21110. const nextBytes = file.peekBytes(2),
  21111. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  21112. if (nextPlatformId < platformId) {
  21113. correctlySorted = false;
  21114. }
  21115. }
  21116. if (correctlySorted) {
  21117. canBreak = true;
  21118. }
  21119. }
  21120. if (useTable) {
  21121. potentialTable = {
  21122. platformId,
  21123. encodingId,
  21124. offset
  21125. };
  21126. }
  21127. if (canBreak) {
  21128. break;
  21129. }
  21130. }
  21131. if (potentialTable) {
  21132. file.pos = start + potentialTable.offset;
  21133. }
  21134. if (!potentialTable || file.peekByte() === -1) {
  21135. (0, _util.warn)("Could not find a preferred cmap table.");
  21136. return {
  21137. platformId: -1,
  21138. encodingId: -1,
  21139. mappings: [],
  21140. hasShortCmap: false
  21141. };
  21142. }
  21143. const format = file.getUint16();
  21144. let hasShortCmap = false;
  21145. const mappings = [];
  21146. let j, glyphId;
  21147. if (format === 0) {
  21148. file.skip(2 + 2);
  21149. for (j = 0; j < 256; j++) {
  21150. const index = file.getByte();
  21151. if (!index) {
  21152. continue;
  21153. }
  21154. mappings.push({
  21155. charCode: j,
  21156. glyphId: index
  21157. });
  21158. }
  21159. hasShortCmap = true;
  21160. } else if (format === 2) {
  21161. file.skip(2 + 2);
  21162. const subHeaderKeys = [];
  21163. let maxSubHeaderKey = 0;
  21164. for (let i = 0; i < 256; i++) {
  21165. const subHeaderKey = file.getUint16() >> 3;
  21166. subHeaderKeys.push(subHeaderKey);
  21167. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  21168. }
  21169. const subHeaders = [];
  21170. for (let i = 0; i <= maxSubHeaderKey; i++) {
  21171. subHeaders.push({
  21172. firstCode: file.getUint16(),
  21173. entryCount: file.getUint16(),
  21174. idDelta: signedInt16(file.getByte(), file.getByte()),
  21175. idRangePos: file.pos + file.getUint16()
  21176. });
  21177. }
  21178. for (let i = 0; i < 256; i++) {
  21179. if (subHeaderKeys[i] === 0) {
  21180. file.pos = subHeaders[0].idRangePos + 2 * i;
  21181. glyphId = file.getUint16();
  21182. mappings.push({
  21183. charCode: i,
  21184. glyphId
  21185. });
  21186. } else {
  21187. const s = subHeaders[subHeaderKeys[i]];
  21188. for (j = 0; j < s.entryCount; j++) {
  21189. const charCode = (i << 8) + j + s.firstCode;
  21190. file.pos = s.idRangePos + 2 * j;
  21191. glyphId = file.getUint16();
  21192. if (glyphId !== 0) {
  21193. glyphId = (glyphId + s.idDelta) % 65536;
  21194. }
  21195. mappings.push({
  21196. charCode,
  21197. glyphId
  21198. });
  21199. }
  21200. }
  21201. }
  21202. } else if (format === 4) {
  21203. file.skip(2 + 2);
  21204. const segCount = file.getUint16() >> 1;
  21205. file.skip(6);
  21206. const segments = [];
  21207. let segIndex;
  21208. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21209. segments.push({
  21210. end: file.getUint16()
  21211. });
  21212. }
  21213. file.skip(2);
  21214. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21215. segments[segIndex].start = file.getUint16();
  21216. }
  21217. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21218. segments[segIndex].delta = file.getUint16();
  21219. }
  21220. let offsetsCount = 0,
  21221. offsetIndex;
  21222. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21223. segment = segments[segIndex];
  21224. const rangeOffset = file.getUint16();
  21225. if (!rangeOffset) {
  21226. segment.offsetIndex = -1;
  21227. continue;
  21228. }
  21229. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  21230. segment.offsetIndex = offsetIndex;
  21231. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  21232. }
  21233. const offsets = [];
  21234. for (j = 0; j < offsetsCount; j++) {
  21235. offsets.push(file.getUint16());
  21236. }
  21237. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21238. segment = segments[segIndex];
  21239. start = segment.start;
  21240. const end = segment.end;
  21241. const delta = segment.delta;
  21242. offsetIndex = segment.offsetIndex;
  21243. for (j = start; j <= end; j++) {
  21244. if (j === 0xffff) {
  21245. continue;
  21246. }
  21247. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  21248. glyphId = glyphId + delta & 0xffff;
  21249. mappings.push({
  21250. charCode: j,
  21251. glyphId
  21252. });
  21253. }
  21254. }
  21255. } else if (format === 6) {
  21256. file.skip(2 + 2);
  21257. const firstCode = file.getUint16();
  21258. const entryCount = file.getUint16();
  21259. for (j = 0; j < entryCount; j++) {
  21260. glyphId = file.getUint16();
  21261. const charCode = firstCode + j;
  21262. mappings.push({
  21263. charCode,
  21264. glyphId
  21265. });
  21266. }
  21267. } else if (format === 12) {
  21268. file.skip(2 + 4 + 4);
  21269. const nGroups = file.getInt32() >>> 0;
  21270. for (j = 0; j < nGroups; j++) {
  21271. const startCharCode = file.getInt32() >>> 0;
  21272. const endCharCode = file.getInt32() >>> 0;
  21273. let glyphCode = file.getInt32() >>> 0;
  21274. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  21275. mappings.push({
  21276. charCode,
  21277. glyphId: glyphCode++
  21278. });
  21279. }
  21280. }
  21281. } else {
  21282. (0, _util.warn)("cmap table has unsupported format: " + format);
  21283. return {
  21284. platformId: -1,
  21285. encodingId: -1,
  21286. mappings: [],
  21287. hasShortCmap: false
  21288. };
  21289. }
  21290. mappings.sort(function (a, b) {
  21291. return a.charCode - b.charCode;
  21292. });
  21293. for (let i = 1; i < mappings.length; i++) {
  21294. if (mappings[i - 1].charCode === mappings[i].charCode) {
  21295. mappings.splice(i, 1);
  21296. i--;
  21297. }
  21298. }
  21299. return {
  21300. platformId: potentialTable.platformId,
  21301. encodingId: potentialTable.encodingId,
  21302. mappings,
  21303. hasShortCmap
  21304. };
  21305. }
  21306. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  21307. if (!header) {
  21308. if (metrics) {
  21309. metrics.data = null;
  21310. }
  21311. return;
  21312. }
  21313. file.pos = (file.start || 0) + header.offset;
  21314. file.pos += 4;
  21315. file.pos += 2;
  21316. file.pos += 2;
  21317. file.pos += 2;
  21318. file.pos += 2;
  21319. file.pos += 2;
  21320. file.pos += 2;
  21321. file.pos += 2;
  21322. file.pos += 2;
  21323. file.pos += 2;
  21324. const caretOffset = file.getUint16();
  21325. file.pos += 8;
  21326. file.pos += 2;
  21327. let numOfMetrics = file.getUint16();
  21328. if (caretOffset !== 0) {
  21329. const macStyle = int16(headTable.data[44], headTable.data[45]);
  21330. if (!(macStyle & 2)) {
  21331. header.data[22] = 0;
  21332. header.data[23] = 0;
  21333. }
  21334. }
  21335. if (numOfMetrics > numGlyphs) {
  21336. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  21337. numOfMetrics = numGlyphs;
  21338. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  21339. header.data[35] = numOfMetrics & 0x00ff;
  21340. }
  21341. const numOfSidebearings = numGlyphs - numOfMetrics;
  21342. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  21343. if (numMissing > 0) {
  21344. const entries = new Uint8Array(metrics.length + numMissing * 2);
  21345. entries.set(metrics.data);
  21346. if (dupFirstEntry) {
  21347. entries[metrics.length] = metrics.data[2];
  21348. entries[metrics.length + 1] = metrics.data[3];
  21349. }
  21350. metrics.data = entries;
  21351. }
  21352. }
  21353. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  21354. const glyphProfile = {
  21355. length: 0,
  21356. sizeOfInstructions: 0
  21357. };
  21358. if (sourceEnd - sourceStart <= 12) {
  21359. return glyphProfile;
  21360. }
  21361. const glyf = source.subarray(sourceStart, sourceEnd);
  21362. let contoursCount = signedInt16(glyf[0], glyf[1]);
  21363. if (contoursCount < 0) {
  21364. contoursCount = -1;
  21365. writeSignedInt16(glyf, 0, contoursCount);
  21366. dest.set(glyf, destStart);
  21367. glyphProfile.length = glyf.length;
  21368. return glyphProfile;
  21369. }
  21370. let i,
  21371. j = 10,
  21372. flagsCount = 0;
  21373. for (i = 0; i < contoursCount; i++) {
  21374. const endPoint = glyf[j] << 8 | glyf[j + 1];
  21375. flagsCount = endPoint + 1;
  21376. j += 2;
  21377. }
  21378. const instructionsStart = j;
  21379. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  21380. glyphProfile.sizeOfInstructions = instructionsLength;
  21381. j += 2 + instructionsLength;
  21382. const instructionsEnd = j;
  21383. let coordinatesLength = 0;
  21384. for (i = 0; i < flagsCount; i++) {
  21385. const flag = glyf[j++];
  21386. if (flag & 0xc0) {
  21387. glyf[j - 1] = flag & 0x3f;
  21388. }
  21389. let xLength = 2;
  21390. if (flag & 2) {
  21391. xLength = 1;
  21392. } else if (flag & 16) {
  21393. xLength = 0;
  21394. }
  21395. let yLength = 2;
  21396. if (flag & 4) {
  21397. yLength = 1;
  21398. } else if (flag & 32) {
  21399. yLength = 0;
  21400. }
  21401. const xyLength = xLength + yLength;
  21402. coordinatesLength += xyLength;
  21403. if (flag & 8) {
  21404. const repeat = glyf[j++];
  21405. i += repeat;
  21406. coordinatesLength += repeat * xyLength;
  21407. }
  21408. }
  21409. if (coordinatesLength === 0) {
  21410. return glyphProfile;
  21411. }
  21412. let glyphDataLength = j + coordinatesLength;
  21413. if (glyphDataLength > glyf.length) {
  21414. return glyphProfile;
  21415. }
  21416. if (!hintsValid && instructionsLength > 0) {
  21417. dest.set(glyf.subarray(0, instructionsStart), destStart);
  21418. dest.set([0, 0], destStart + instructionsStart);
  21419. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  21420. glyphDataLength -= instructionsLength;
  21421. if (glyf.length - glyphDataLength > 3) {
  21422. glyphDataLength = glyphDataLength + 3 & ~3;
  21423. }
  21424. glyphProfile.length = glyphDataLength;
  21425. return glyphProfile;
  21426. }
  21427. if (glyf.length - glyphDataLength > 3) {
  21428. glyphDataLength = glyphDataLength + 3 & ~3;
  21429. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  21430. glyphProfile.length = glyphDataLength;
  21431. return glyphProfile;
  21432. }
  21433. dest.set(glyf, destStart);
  21434. glyphProfile.length = glyf.length;
  21435. return glyphProfile;
  21436. }
  21437. function sanitizeHead(head, numGlyphs, locaLength) {
  21438. const data = head.data;
  21439. const version = int32(data[0], data[1], data[2], data[3]);
  21440. if (version >> 16 !== 1) {
  21441. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  21442. data[0] = 0;
  21443. data[1] = 1;
  21444. data[2] = 0;
  21445. data[3] = 0;
  21446. }
  21447. const indexToLocFormat = int16(data[50], data[51]);
  21448. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  21449. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  21450. const numGlyphsPlusOne = numGlyphs + 1;
  21451. if (locaLength === numGlyphsPlusOne << 1) {
  21452. data[50] = 0;
  21453. data[51] = 0;
  21454. } else if (locaLength === numGlyphsPlusOne << 2) {
  21455. data[50] = 0;
  21456. data[51] = 1;
  21457. } else {
  21458. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  21459. }
  21460. }
  21461. }
  21462. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  21463. let itemSize, itemDecode, itemEncode;
  21464. if (isGlyphLocationsLong) {
  21465. itemSize = 4;
  21466. itemDecode = function fontItemDecodeLong(data, offset) {
  21467. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  21468. };
  21469. itemEncode = function fontItemEncodeLong(data, offset, value) {
  21470. data[offset] = value >>> 24 & 0xff;
  21471. data[offset + 1] = value >> 16 & 0xff;
  21472. data[offset + 2] = value >> 8 & 0xff;
  21473. data[offset + 3] = value & 0xff;
  21474. };
  21475. } else {
  21476. itemSize = 2;
  21477. itemDecode = function fontItemDecode(data, offset) {
  21478. return data[offset] << 9 | data[offset + 1] << 1;
  21479. };
  21480. itemEncode = function fontItemEncode(data, offset, value) {
  21481. data[offset] = value >> 9 & 0xff;
  21482. data[offset + 1] = value >> 1 & 0xff;
  21483. };
  21484. }
  21485. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  21486. const locaDataSize = itemSize * (1 + numGlyphsOut);
  21487. const locaData = new Uint8Array(locaDataSize);
  21488. locaData.set(loca.data.subarray(0, locaDataSize));
  21489. loca.data = locaData;
  21490. const oldGlyfData = glyf.data;
  21491. const oldGlyfDataLength = oldGlyfData.length;
  21492. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  21493. let i, j;
  21494. const locaEntries = [];
  21495. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  21496. let offset = itemDecode(locaData, j);
  21497. if (offset > oldGlyfDataLength) {
  21498. offset = oldGlyfDataLength;
  21499. }
  21500. locaEntries.push({
  21501. index: i,
  21502. offset,
  21503. endOffset: 0
  21504. });
  21505. }
  21506. locaEntries.sort((a, b) => {
  21507. return a.offset - b.offset;
  21508. });
  21509. for (i = 0; i < numGlyphs; i++) {
  21510. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  21511. }
  21512. locaEntries.sort((a, b) => {
  21513. return a.index - b.index;
  21514. });
  21515. for (i = 0; i < numGlyphs; i++) {
  21516. const {
  21517. offset,
  21518. endOffset
  21519. } = locaEntries[i];
  21520. if (offset !== 0 || endOffset !== 0) {
  21521. break;
  21522. }
  21523. const nextOffset = locaEntries[i + 1].offset;
  21524. if (nextOffset === 0) {
  21525. continue;
  21526. }
  21527. locaEntries[i].endOffset = nextOffset;
  21528. break;
  21529. }
  21530. const missingGlyphs = Object.create(null);
  21531. let writeOffset = 0;
  21532. itemEncode(locaData, 0, writeOffset);
  21533. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  21534. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  21535. const newLength = glyphProfile.length;
  21536. if (newLength === 0) {
  21537. missingGlyphs[i] = true;
  21538. }
  21539. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  21540. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  21541. }
  21542. writeOffset += newLength;
  21543. itemEncode(locaData, j, writeOffset);
  21544. }
  21545. if (writeOffset === 0) {
  21546. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  21547. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  21548. itemEncode(locaData, j, simpleGlyph.length);
  21549. }
  21550. glyf.data = simpleGlyph;
  21551. } else if (dupFirstEntry) {
  21552. const firstEntryLength = itemDecode(locaData, itemSize);
  21553. if (newGlyfData.length > firstEntryLength + writeOffset) {
  21554. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  21555. } else {
  21556. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  21557. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  21558. }
  21559. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  21560. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  21561. } else {
  21562. glyf.data = newGlyfData.subarray(0, writeOffset);
  21563. }
  21564. return {
  21565. missingGlyphs,
  21566. maxSizeOfInstructions
  21567. };
  21568. }
  21569. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  21570. const start = (font.start || 0) + post.offset;
  21571. font.pos = start;
  21572. const length = post.length,
  21573. end = start + length;
  21574. const version = font.getInt32();
  21575. font.skip(28);
  21576. let glyphNames;
  21577. let valid = true;
  21578. let i;
  21579. switch (version) {
  21580. case 0x00010000:
  21581. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  21582. break;
  21583. case 0x00020000:
  21584. const numGlyphs = font.getUint16();
  21585. if (numGlyphs !== maxpNumGlyphs) {
  21586. valid = false;
  21587. break;
  21588. }
  21589. const glyphNameIndexes = [];
  21590. for (i = 0; i < numGlyphs; ++i) {
  21591. const index = font.getUint16();
  21592. if (index >= 32768) {
  21593. valid = false;
  21594. break;
  21595. }
  21596. glyphNameIndexes.push(index);
  21597. }
  21598. if (!valid) {
  21599. break;
  21600. }
  21601. const customNames = [],
  21602. strBuf = [];
  21603. while (font.pos < end) {
  21604. const stringLength = font.getByte();
  21605. strBuf.length = stringLength;
  21606. for (i = 0; i < stringLength; ++i) {
  21607. strBuf[i] = String.fromCharCode(font.getByte());
  21608. }
  21609. customNames.push(strBuf.join(""));
  21610. }
  21611. glyphNames = [];
  21612. for (i = 0; i < numGlyphs; ++i) {
  21613. const j = glyphNameIndexes[i];
  21614. if (j < 258) {
  21615. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  21616. continue;
  21617. }
  21618. glyphNames.push(customNames[j - 258]);
  21619. }
  21620. break;
  21621. case 0x00030000:
  21622. break;
  21623. default:
  21624. (0, _util.warn)("Unknown/unsupported post table version " + version);
  21625. valid = false;
  21626. if (propertiesObj.defaultEncoding) {
  21627. glyphNames = propertiesObj.defaultEncoding;
  21628. }
  21629. break;
  21630. }
  21631. propertiesObj.glyphNames = glyphNames;
  21632. return valid;
  21633. }
  21634. function readNameTable(nameTable) {
  21635. const start = (font.start || 0) + nameTable.offset;
  21636. font.pos = start;
  21637. const names = [[], []];
  21638. const length = nameTable.length,
  21639. end = start + length;
  21640. const format = font.getUint16();
  21641. const FORMAT_0_HEADER_LENGTH = 6;
  21642. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  21643. return names;
  21644. }
  21645. const numRecords = font.getUint16();
  21646. const stringsStart = font.getUint16();
  21647. const records = [];
  21648. const NAME_RECORD_LENGTH = 12;
  21649. let i, ii;
  21650. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  21651. const r = {
  21652. platform: font.getUint16(),
  21653. encoding: font.getUint16(),
  21654. language: font.getUint16(),
  21655. name: font.getUint16(),
  21656. length: font.getUint16(),
  21657. offset: font.getUint16()
  21658. };
  21659. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  21660. records.push(r);
  21661. }
  21662. }
  21663. for (i = 0, ii = records.length; i < ii; i++) {
  21664. const record = records[i];
  21665. if (record.length <= 0) {
  21666. continue;
  21667. }
  21668. const pos = start + stringsStart + record.offset;
  21669. if (pos + record.length > end) {
  21670. continue;
  21671. }
  21672. font.pos = pos;
  21673. const nameIndex = record.name;
  21674. if (record.encoding) {
  21675. let str = "";
  21676. for (let j = 0, jj = record.length; j < jj; j += 2) {
  21677. str += String.fromCharCode(font.getUint16());
  21678. }
  21679. names[1][nameIndex] = str;
  21680. } else {
  21681. names[0][nameIndex] = font.getString(record.length);
  21682. }
  21683. }
  21684. return names;
  21685. }
  21686. 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];
  21687. function sanitizeTTProgram(table, ttContext) {
  21688. let data = table.data;
  21689. let i = 0,
  21690. j,
  21691. n,
  21692. b,
  21693. funcId,
  21694. pc,
  21695. lastEndf = 0,
  21696. lastDeff = 0;
  21697. const stack = [];
  21698. const callstack = [];
  21699. const functionsCalled = [];
  21700. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  21701. let inFDEF = false,
  21702. ifLevel = 0,
  21703. inELSE = 0;
  21704. for (let ii = data.length; i < ii;) {
  21705. const op = data[i++];
  21706. if (op === 0x40) {
  21707. n = data[i++];
  21708. if (inFDEF || inELSE) {
  21709. i += n;
  21710. } else {
  21711. for (j = 0; j < n; j++) {
  21712. stack.push(data[i++]);
  21713. }
  21714. }
  21715. } else if (op === 0x41) {
  21716. n = data[i++];
  21717. if (inFDEF || inELSE) {
  21718. i += n * 2;
  21719. } else {
  21720. for (j = 0; j < n; j++) {
  21721. b = data[i++];
  21722. stack.push(b << 8 | data[i++]);
  21723. }
  21724. }
  21725. } else if ((op & 0xf8) === 0xb0) {
  21726. n = op - 0xb0 + 1;
  21727. if (inFDEF || inELSE) {
  21728. i += n;
  21729. } else {
  21730. for (j = 0; j < n; j++) {
  21731. stack.push(data[i++]);
  21732. }
  21733. }
  21734. } else if ((op & 0xf8) === 0xb8) {
  21735. n = op - 0xb8 + 1;
  21736. if (inFDEF || inELSE) {
  21737. i += n * 2;
  21738. } else {
  21739. for (j = 0; j < n; j++) {
  21740. b = data[i++];
  21741. stack.push(b << 8 | data[i++]);
  21742. }
  21743. }
  21744. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  21745. if (!inFDEF && !inELSE) {
  21746. funcId = stack.at(-1);
  21747. if (isNaN(funcId)) {
  21748. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  21749. } else {
  21750. ttContext.functionsUsed[funcId] = true;
  21751. if (funcId in ttContext.functionsStackDeltas) {
  21752. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  21753. if (newStackLength < 0) {
  21754. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  21755. ttContext.hintsValid = false;
  21756. return;
  21757. }
  21758. stack.length = newStackLength;
  21759. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  21760. callstack.push({
  21761. data,
  21762. i,
  21763. stackTop: stack.length - 1
  21764. });
  21765. functionsCalled.push(funcId);
  21766. pc = ttContext.functionsDefined[funcId];
  21767. if (!pc) {
  21768. (0, _util.warn)("TT: CALL non-existent function");
  21769. ttContext.hintsValid = false;
  21770. return;
  21771. }
  21772. data = pc.data;
  21773. i = pc.i;
  21774. }
  21775. }
  21776. }
  21777. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  21778. if (inFDEF || inELSE) {
  21779. (0, _util.warn)("TT: nested FDEFs not allowed");
  21780. tooComplexToFollowFunctions = true;
  21781. }
  21782. inFDEF = true;
  21783. lastDeff = i;
  21784. funcId = stack.pop();
  21785. ttContext.functionsDefined[funcId] = {
  21786. data,
  21787. i
  21788. };
  21789. } else if (op === 0x2d) {
  21790. if (inFDEF) {
  21791. inFDEF = false;
  21792. lastEndf = i;
  21793. } else {
  21794. pc = callstack.pop();
  21795. if (!pc) {
  21796. (0, _util.warn)("TT: ENDF bad stack");
  21797. ttContext.hintsValid = false;
  21798. return;
  21799. }
  21800. funcId = functionsCalled.pop();
  21801. data = pc.data;
  21802. i = pc.i;
  21803. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  21804. }
  21805. } else if (op === 0x89) {
  21806. if (inFDEF || inELSE) {
  21807. (0, _util.warn)("TT: nested IDEFs not allowed");
  21808. tooComplexToFollowFunctions = true;
  21809. }
  21810. inFDEF = true;
  21811. lastDeff = i;
  21812. } else if (op === 0x58) {
  21813. ++ifLevel;
  21814. } else if (op === 0x1b) {
  21815. inELSE = ifLevel;
  21816. } else if (op === 0x59) {
  21817. if (inELSE === ifLevel) {
  21818. inELSE = 0;
  21819. }
  21820. --ifLevel;
  21821. } else if (op === 0x1c) {
  21822. if (!inFDEF && !inELSE) {
  21823. const offset = stack.at(-1);
  21824. if (offset > 0) {
  21825. i += offset - 1;
  21826. }
  21827. }
  21828. }
  21829. if (!inFDEF && !inELSE) {
  21830. let stackDelta = 0;
  21831. if (op <= 0x8e) {
  21832. stackDelta = TTOpsStackDeltas[op];
  21833. } else if (op >= 0xc0 && op <= 0xdf) {
  21834. stackDelta = -1;
  21835. } else if (op >= 0xe0) {
  21836. stackDelta = -2;
  21837. }
  21838. if (op >= 0x71 && op <= 0x75) {
  21839. n = stack.pop();
  21840. if (!isNaN(n)) {
  21841. stackDelta = -n * 2;
  21842. }
  21843. }
  21844. while (stackDelta < 0 && stack.length > 0) {
  21845. stack.pop();
  21846. stackDelta++;
  21847. }
  21848. while (stackDelta > 0) {
  21849. stack.push(NaN);
  21850. stackDelta--;
  21851. }
  21852. }
  21853. }
  21854. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  21855. const content = [data];
  21856. if (i > data.length) {
  21857. content.push(new Uint8Array(i - data.length));
  21858. }
  21859. if (lastDeff > lastEndf) {
  21860. (0, _util.warn)("TT: complementing a missing function tail");
  21861. content.push(new Uint8Array([0x22, 0x2d]));
  21862. }
  21863. foldTTTable(table, content);
  21864. }
  21865. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  21866. if (ttContext.tooComplexToFollowFunctions) {
  21867. return;
  21868. }
  21869. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  21870. (0, _util.warn)("TT: more functions defined than expected");
  21871. ttContext.hintsValid = false;
  21872. return;
  21873. }
  21874. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  21875. if (j > maxFunctionDefs) {
  21876. (0, _util.warn)("TT: invalid function id: " + j);
  21877. ttContext.hintsValid = false;
  21878. return;
  21879. }
  21880. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  21881. (0, _util.warn)("TT: undefined function: " + j);
  21882. ttContext.hintsValid = false;
  21883. return;
  21884. }
  21885. }
  21886. }
  21887. function foldTTTable(table, content) {
  21888. if (content.length > 1) {
  21889. let newLength = 0;
  21890. let j, jj;
  21891. for (j = 0, jj = content.length; j < jj; j++) {
  21892. newLength += content[j].length;
  21893. }
  21894. newLength = newLength + 3 & ~3;
  21895. const result = new Uint8Array(newLength);
  21896. let pos = 0;
  21897. for (j = 0, jj = content.length; j < jj; j++) {
  21898. result.set(content[j], pos);
  21899. pos += content[j].length;
  21900. }
  21901. table.data = result;
  21902. table.length = newLength;
  21903. }
  21904. }
  21905. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  21906. const ttContext = {
  21907. functionsDefined: [],
  21908. functionsUsed: [],
  21909. functionsStackDeltas: [],
  21910. tooComplexToFollowFunctions: false,
  21911. hintsValid: true
  21912. };
  21913. if (fpgm) {
  21914. sanitizeTTProgram(fpgm, ttContext);
  21915. }
  21916. if (prep) {
  21917. sanitizeTTProgram(prep, ttContext);
  21918. }
  21919. if (fpgm) {
  21920. checkInvalidFunctions(ttContext, maxFunctionDefs);
  21921. }
  21922. if (cvt && cvt.length & 1) {
  21923. const cvtData = new Uint8Array(cvt.length + 1);
  21924. cvtData.set(cvt.data);
  21925. cvt.data = cvtData;
  21926. }
  21927. return ttContext.hintsValid;
  21928. }
  21929. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  21930. let header, tables;
  21931. if (isTrueTypeCollectionFile(font)) {
  21932. const ttcData = readTrueTypeCollectionData(font, this.name);
  21933. header = ttcData.header;
  21934. tables = ttcData.tables;
  21935. } else {
  21936. header = readOpenTypeHeader(font);
  21937. tables = readTables(font, header.numTables);
  21938. }
  21939. let cff, cffFile;
  21940. const isTrueType = !tables["CFF "];
  21941. if (!isTrueType) {
  21942. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  21943. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  21944. cffFile = new _stream.Stream(tables["CFF "].data);
  21945. cff = new _cff_font.CFFFont(cffFile, properties);
  21946. adjustWidths(properties);
  21947. return this.convert(name, cff, properties);
  21948. }
  21949. delete tables.glyf;
  21950. delete tables.loca;
  21951. delete tables.fpgm;
  21952. delete tables.prep;
  21953. delete tables["cvt "];
  21954. this.isOpenType = true;
  21955. } else {
  21956. if (!tables.loca) {
  21957. throw new _util.FormatError('Required "loca" table is not found');
  21958. }
  21959. if (!tables.glyf) {
  21960. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  21961. tables.glyf = {
  21962. tag: "glyf",
  21963. data: new Uint8Array(0)
  21964. };
  21965. }
  21966. this.isOpenType = false;
  21967. }
  21968. if (!tables.maxp) {
  21969. throw new _util.FormatError('Required "maxp" table is not found');
  21970. }
  21971. font.pos = (font.start || 0) + tables.maxp.offset;
  21972. const version = font.getInt32();
  21973. const numGlyphs = font.getUint16();
  21974. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  21975. const {
  21976. scaleFactors
  21977. } = properties;
  21978. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  21979. const glyphs = new _glyf.GlyfTable({
  21980. glyfTable: tables.glyf.data,
  21981. isGlyphLocationsLong,
  21982. locaTable: tables.loca.data,
  21983. numGlyphs
  21984. });
  21985. glyphs.scale(scaleFactors);
  21986. const {
  21987. glyf,
  21988. loca,
  21989. isLocationLong
  21990. } = glyphs.write();
  21991. tables.glyf.data = glyf;
  21992. tables.loca.data = loca;
  21993. if (isLocationLong !== !!isGlyphLocationsLong) {
  21994. tables.head.data[50] = 0;
  21995. tables.head.data[51] = isLocationLong ? 1 : 0;
  21996. }
  21997. const metrics = tables.hmtx.data;
  21998. for (let i = 0; i < numGlyphs; i++) {
  21999. const j = 4 * i;
  22000. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  22001. metrics[j] = advanceWidth >> 8 & 0xff;
  22002. metrics[j + 1] = advanceWidth & 0xff;
  22003. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  22004. writeSignedInt16(metrics, j + 2, lsb);
  22005. }
  22006. }
  22007. let numGlyphsOut = numGlyphs + 1;
  22008. let dupFirstEntry = true;
  22009. if (numGlyphsOut > 0xffff) {
  22010. dupFirstEntry = false;
  22011. numGlyphsOut = numGlyphs;
  22012. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  22013. }
  22014. let maxFunctionDefs = 0;
  22015. let maxSizeOfInstructions = 0;
  22016. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22017. font.pos += 8;
  22018. const maxZones = font.getUint16();
  22019. if (maxZones > 2) {
  22020. tables.maxp.data[14] = 0;
  22021. tables.maxp.data[15] = 2;
  22022. }
  22023. font.pos += 4;
  22024. maxFunctionDefs = font.getUint16();
  22025. font.pos += 4;
  22026. maxSizeOfInstructions = font.getUint16();
  22027. }
  22028. tables.maxp.data[4] = numGlyphsOut >> 8;
  22029. tables.maxp.data[5] = numGlyphsOut & 255;
  22030. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  22031. if (!hintsValid) {
  22032. delete tables.fpgm;
  22033. delete tables.prep;
  22034. delete tables["cvt "];
  22035. }
  22036. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  22037. if (!tables.head) {
  22038. throw new _util.FormatError('Required "head" table is not found');
  22039. }
  22040. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  22041. let missingGlyphs = Object.create(null);
  22042. if (isTrueType) {
  22043. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  22044. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  22045. missingGlyphs = glyphsInfo.missingGlyphs;
  22046. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  22047. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  22048. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  22049. }
  22050. }
  22051. if (!tables.hhea) {
  22052. throw new _util.FormatError('Required "hhea" table is not found');
  22053. }
  22054. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  22055. tables.hhea.data[10] = 0xff;
  22056. tables.hhea.data[11] = 0xff;
  22057. }
  22058. const metricsOverride = {
  22059. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  22060. yMax: int16(tables.head.data[42], tables.head.data[43]),
  22061. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  22062. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  22063. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  22064. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  22065. };
  22066. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  22067. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  22068. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  22069. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  22070. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  22071. this.lineGap = this.cssFontInfo.metrics.lineGap;
  22072. } else {
  22073. this.lineHeight = this.ascent - this.descent + this.lineGap;
  22074. }
  22075. if (tables.post) {
  22076. readPostScriptTable(tables.post, properties, numGlyphs);
  22077. }
  22078. tables.post = {
  22079. tag: "post",
  22080. data: createPostTable(properties)
  22081. };
  22082. const charCodeToGlyphId = [];
  22083. function hasGlyph(glyphId) {
  22084. return !missingGlyphs[glyphId];
  22085. }
  22086. if (properties.composite) {
  22087. const cidToGidMap = properties.cidToGidMap || [];
  22088. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  22089. properties.cMap.forEach(function (charCode, cid) {
  22090. if (typeof cid === "string") {
  22091. cid = convertCidString(charCode, cid, true);
  22092. }
  22093. if (cid > 0xffff) {
  22094. throw new _util.FormatError("Max size of CID is 65,535");
  22095. }
  22096. let glyphId = -1;
  22097. if (isCidToGidMapEmpty) {
  22098. glyphId = cid;
  22099. } else if (cidToGidMap[cid] !== undefined) {
  22100. glyphId = cidToGidMap[cid];
  22101. }
  22102. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  22103. charCodeToGlyphId[charCode] = glyphId;
  22104. }
  22105. });
  22106. } else {
  22107. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  22108. const cmapPlatformId = cmapTable.platformId;
  22109. const cmapEncodingId = cmapTable.encodingId;
  22110. const cmapMappings = cmapTable.mappings;
  22111. const cmapMappingsLength = cmapMappings.length;
  22112. let baseEncoding = [],
  22113. forcePostTable = false;
  22114. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  22115. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22116. }
  22117. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  22118. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22119. for (let charCode = 0; charCode < 256; charCode++) {
  22120. let glyphName;
  22121. if (this.differences[charCode] !== undefined) {
  22122. glyphName = this.differences[charCode];
  22123. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  22124. glyphName = baseEncoding[charCode];
  22125. } else {
  22126. glyphName = _encodings.StandardEncoding[charCode];
  22127. }
  22128. if (!glyphName) {
  22129. continue;
  22130. }
  22131. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  22132. let unicodeOrCharCode;
  22133. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  22134. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  22135. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  22136. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  22137. }
  22138. if (unicodeOrCharCode === undefined) {
  22139. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  22140. const unicode = this.toUnicode.get(charCode);
  22141. if (unicode) {
  22142. unicodeOrCharCode = unicode.codePointAt(0);
  22143. }
  22144. }
  22145. if (unicodeOrCharCode === undefined) {
  22146. continue;
  22147. }
  22148. }
  22149. for (let i = 0; i < cmapMappingsLength; ++i) {
  22150. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  22151. continue;
  22152. }
  22153. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  22154. break;
  22155. }
  22156. }
  22157. } else if (cmapPlatformId === 0) {
  22158. for (let i = 0; i < cmapMappingsLength; ++i) {
  22159. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  22160. }
  22161. forcePostTable = true;
  22162. } else {
  22163. for (let i = 0; i < cmapMappingsLength; ++i) {
  22164. let charCode = cmapMappings[i].charCode;
  22165. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  22166. charCode &= 0xff;
  22167. }
  22168. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  22169. }
  22170. }
  22171. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  22172. for (let i = 0; i < 256; ++i) {
  22173. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  22174. continue;
  22175. }
  22176. const glyphName = this.differences[i] || baseEncoding[i];
  22177. if (!glyphName) {
  22178. continue;
  22179. }
  22180. const glyphId = properties.glyphNames.indexOf(glyphName);
  22181. if (glyphId > 0 && hasGlyph(glyphId)) {
  22182. charCodeToGlyphId[i] = glyphId;
  22183. }
  22184. }
  22185. }
  22186. }
  22187. if (charCodeToGlyphId.length === 0) {
  22188. charCodeToGlyphId[0] = 0;
  22189. }
  22190. let glyphZeroId = numGlyphsOut - 1;
  22191. if (!dupFirstEntry) {
  22192. glyphZeroId = 0;
  22193. }
  22194. if (!properties.cssFontInfo) {
  22195. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  22196. this.toFontChar = newMapping.toFontChar;
  22197. tables.cmap = {
  22198. tag: "cmap",
  22199. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  22200. };
  22201. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  22202. tables["OS/2"] = {
  22203. tag: "OS/2",
  22204. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  22205. };
  22206. }
  22207. }
  22208. if (!isTrueType) {
  22209. try {
  22210. cffFile = new _stream.Stream(tables["CFF "].data);
  22211. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  22212. cff = parser.parse();
  22213. cff.duplicateFirstGlyph();
  22214. const compiler = new _cff_parser.CFFCompiler(cff);
  22215. tables["CFF "].data = compiler.compile();
  22216. } catch (e) {
  22217. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  22218. }
  22219. }
  22220. if (!tables.name) {
  22221. tables.name = {
  22222. tag: "name",
  22223. data: createNameTable(this.name)
  22224. };
  22225. } else {
  22226. const namePrototype = readNameTable(tables.name);
  22227. tables.name.data = createNameTable(name, namePrototype);
  22228. this.psName = namePrototype[0][6] || null;
  22229. }
  22230. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  22231. for (const tableTag in tables) {
  22232. builder.addTable(tableTag, tables[tableTag].data);
  22233. }
  22234. return builder.toArray();
  22235. }
  22236. convert(fontName, font, properties) {
  22237. properties.fixedPitch = false;
  22238. if (properties.builtInEncoding) {
  22239. adjustToUnicode(properties, properties.builtInEncoding);
  22240. }
  22241. let glyphZeroId = 1;
  22242. if (font instanceof _cff_font.CFFFont) {
  22243. glyphZeroId = font.numGlyphs - 1;
  22244. }
  22245. const mapping = font.getGlyphMapping(properties);
  22246. let newMapping = null;
  22247. let newCharCodeToGlyphId = mapping;
  22248. let toUnicodeExtraMap = null;
  22249. if (!properties.cssFontInfo) {
  22250. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  22251. this.toFontChar = newMapping.toFontChar;
  22252. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  22253. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  22254. }
  22255. const numGlyphs = font.numGlyphs;
  22256. function getCharCodes(charCodeToGlyphId, glyphId) {
  22257. let charCodes = null;
  22258. for (const charCode in charCodeToGlyphId) {
  22259. if (glyphId === charCodeToGlyphId[charCode]) {
  22260. if (!charCodes) {
  22261. charCodes = [];
  22262. }
  22263. charCodes.push(charCode | 0);
  22264. }
  22265. }
  22266. return charCodes;
  22267. }
  22268. function createCharCode(charCodeToGlyphId, glyphId) {
  22269. for (const charCode in charCodeToGlyphId) {
  22270. if (glyphId === charCodeToGlyphId[charCode]) {
  22271. return charCode | 0;
  22272. }
  22273. }
  22274. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  22275. return newMapping.nextAvailableFontCharCode++;
  22276. }
  22277. const seacs = font.seacs;
  22278. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  22279. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  22280. const charset = font.getCharset();
  22281. const seacMap = Object.create(null);
  22282. for (let glyphId in seacs) {
  22283. glyphId |= 0;
  22284. const seac = seacs[glyphId];
  22285. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  22286. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  22287. const baseGlyphId = charset.indexOf(baseGlyphName);
  22288. const accentGlyphId = charset.indexOf(accentGlyphName);
  22289. if (baseGlyphId < 0 || accentGlyphId < 0) {
  22290. continue;
  22291. }
  22292. const accentOffset = {
  22293. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  22294. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  22295. };
  22296. const charCodes = getCharCodes(mapping, glyphId);
  22297. if (!charCodes) {
  22298. continue;
  22299. }
  22300. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  22301. const charCode = charCodes[i];
  22302. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  22303. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  22304. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  22305. seacMap[charCode] = {
  22306. baseFontCharCode,
  22307. accentFontCharCode,
  22308. accentOffset
  22309. };
  22310. }
  22311. }
  22312. properties.seacMap = seacMap;
  22313. }
  22314. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  22315. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  22316. builder.addTable("CFF ", font.data);
  22317. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  22318. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  22319. 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");
  22320. 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));
  22321. builder.addTable("hmtx", function fontFieldsHmtx() {
  22322. const charstrings = font.charstrings;
  22323. const cffWidths = font.cff ? font.cff.widths : null;
  22324. let hmtx = "\x00\x00\x00\x00";
  22325. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  22326. let width = 0;
  22327. if (charstrings) {
  22328. const charstring = charstrings[i - 1];
  22329. width = "width" in charstring ? charstring.width : 0;
  22330. } else if (cffWidths) {
  22331. width = Math.ceil(cffWidths[i] || 0);
  22332. }
  22333. hmtx += string16(width) + string16(0);
  22334. }
  22335. return hmtx;
  22336. }());
  22337. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  22338. builder.addTable("name", createNameTable(fontName));
  22339. builder.addTable("post", createPostTable(properties));
  22340. return builder.toArray();
  22341. }
  22342. get spaceWidth() {
  22343. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  22344. let width;
  22345. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  22346. const glyphName = possibleSpaceReplacements[i];
  22347. if (glyphName in this.widths) {
  22348. width = this.widths[glyphName];
  22349. break;
  22350. }
  22351. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22352. const glyphUnicode = glyphsUnicodeMap[glyphName];
  22353. let charcode = 0;
  22354. if (this.composite && this.cMap.contains(glyphUnicode)) {
  22355. charcode = this.cMap.lookup(glyphUnicode);
  22356. if (typeof charcode === "string") {
  22357. charcode = convertCidString(glyphUnicode, charcode);
  22358. }
  22359. }
  22360. if (!charcode && this.toUnicode) {
  22361. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  22362. }
  22363. if (charcode <= 0) {
  22364. charcode = glyphUnicode;
  22365. }
  22366. width = this.widths[charcode];
  22367. if (width) {
  22368. break;
  22369. }
  22370. }
  22371. width = width || this.defaultWidth;
  22372. return (0, _util.shadow)(this, "spaceWidth", width);
  22373. }
  22374. _charToGlyph(charcode, isSpace = false) {
  22375. let fontCharCode, width, operatorListId;
  22376. let widthCode = charcode;
  22377. if (this.cMap && this.cMap.contains(charcode)) {
  22378. widthCode = this.cMap.lookup(charcode);
  22379. if (typeof widthCode === "string") {
  22380. widthCode = convertCidString(charcode, widthCode);
  22381. }
  22382. }
  22383. width = this.widths[widthCode];
  22384. if (typeof width !== "number") {
  22385. width = this.defaultWidth;
  22386. }
  22387. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  22388. let unicode = this.toUnicode.get(charcode) || charcode;
  22389. if (typeof unicode === "number") {
  22390. unicode = String.fromCharCode(unicode);
  22391. }
  22392. let isInFont = this.toFontChar[charcode] !== undefined;
  22393. fontCharCode = this.toFontChar[charcode] || charcode;
  22394. if (this.missingFile) {
  22395. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  22396. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  22397. fontCharCode = 0x20;
  22398. }
  22399. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  22400. }
  22401. if (this.isType3Font) {
  22402. operatorListId = fontCharCode;
  22403. }
  22404. let accent = null;
  22405. if (this.seacMap && this.seacMap[charcode]) {
  22406. isInFont = true;
  22407. const seac = this.seacMap[charcode];
  22408. fontCharCode = seac.baseFontCharCode;
  22409. accent = {
  22410. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  22411. offset: seac.accentOffset
  22412. };
  22413. }
  22414. let fontChar = "";
  22415. if (typeof fontCharCode === "number") {
  22416. if (fontCharCode <= 0x10ffff) {
  22417. fontChar = String.fromCodePoint(fontCharCode);
  22418. } else {
  22419. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  22420. }
  22421. }
  22422. let glyph = this._glyphCache[charcode];
  22423. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  22424. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  22425. this._glyphCache[charcode] = glyph;
  22426. }
  22427. return glyph;
  22428. }
  22429. charsToGlyphs(chars) {
  22430. let glyphs = this._charsCache[chars];
  22431. if (glyphs) {
  22432. return glyphs;
  22433. }
  22434. glyphs = [];
  22435. if (this.cMap) {
  22436. const c = Object.create(null),
  22437. ii = chars.length;
  22438. let i = 0;
  22439. while (i < ii) {
  22440. this.cMap.readCharCode(chars, i, c);
  22441. const {
  22442. charcode,
  22443. length
  22444. } = c;
  22445. i += length;
  22446. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  22447. glyphs.push(glyph);
  22448. }
  22449. } else {
  22450. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22451. const charcode = chars.charCodeAt(i);
  22452. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  22453. glyphs.push(glyph);
  22454. }
  22455. }
  22456. return this._charsCache[chars] = glyphs;
  22457. }
  22458. getCharPositions(chars) {
  22459. const positions = [];
  22460. if (this.cMap) {
  22461. const c = Object.create(null);
  22462. let i = 0;
  22463. while (i < chars.length) {
  22464. this.cMap.readCharCode(chars, i, c);
  22465. const length = c.length;
  22466. positions.push([i, i + length]);
  22467. i += length;
  22468. }
  22469. } else {
  22470. for (let i = 0, ii = chars.length; i < ii; ++i) {
  22471. positions.push([i, i + 1]);
  22472. }
  22473. }
  22474. return positions;
  22475. }
  22476. get glyphCacheValues() {
  22477. return Object.values(this._glyphCache);
  22478. }
  22479. encodeString(str) {
  22480. const buffers = [];
  22481. const currentBuf = [];
  22482. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  22483. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  22484. for (let i = 0, ii = str.length; i < ii; i++) {
  22485. const unicode = str.codePointAt(i);
  22486. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  22487. i++;
  22488. }
  22489. if (this.toUnicode) {
  22490. const charCode = getCharCode(unicode);
  22491. if (charCode !== -1) {
  22492. if (hasCurrentBufErrors()) {
  22493. buffers.push(currentBuf.join(""));
  22494. currentBuf.length = 0;
  22495. }
  22496. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  22497. for (let j = charCodeLength - 1; j >= 0; j--) {
  22498. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  22499. }
  22500. continue;
  22501. }
  22502. }
  22503. if (!hasCurrentBufErrors()) {
  22504. buffers.push(currentBuf.join(""));
  22505. currentBuf.length = 0;
  22506. }
  22507. currentBuf.push(String.fromCodePoint(unicode));
  22508. }
  22509. buffers.push(currentBuf.join(""));
  22510. return buffers;
  22511. }
  22512. }
  22513. exports.Font = Font;
  22514. class ErrorFont {
  22515. constructor(error) {
  22516. this.error = error;
  22517. this.loadedName = "g_font_error";
  22518. this.missingFile = true;
  22519. }
  22520. charsToGlyphs() {
  22521. return [];
  22522. }
  22523. encodeString(chars) {
  22524. return [chars];
  22525. }
  22526. exportData(extraProperties = false) {
  22527. return {
  22528. error: this.error
  22529. };
  22530. }
  22531. }
  22532. exports.ErrorFont = ErrorFont;
  22533. /***/ }),
  22534. /* 35 */
  22535. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22536. Object.defineProperty(exports, "__esModule", ({
  22537. value: true
  22538. }));
  22539. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  22540. var _util = __w_pdfjs_require__(2);
  22541. var _charsets = __w_pdfjs_require__(36);
  22542. var _encodings = __w_pdfjs_require__(37);
  22543. const MAX_SUBR_NESTING = 10;
  22544. 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"];
  22545. exports.CFFStandardStrings = CFFStandardStrings;
  22546. const NUM_STANDARD_CFF_STRINGS = 391;
  22547. const CharstringValidationData = [null, {
  22548. id: "hstem",
  22549. min: 2,
  22550. stackClearing: true,
  22551. stem: true
  22552. }, null, {
  22553. id: "vstem",
  22554. min: 2,
  22555. stackClearing: true,
  22556. stem: true
  22557. }, {
  22558. id: "vmoveto",
  22559. min: 1,
  22560. stackClearing: true
  22561. }, {
  22562. id: "rlineto",
  22563. min: 2,
  22564. resetStack: true
  22565. }, {
  22566. id: "hlineto",
  22567. min: 1,
  22568. resetStack: true
  22569. }, {
  22570. id: "vlineto",
  22571. min: 1,
  22572. resetStack: true
  22573. }, {
  22574. id: "rrcurveto",
  22575. min: 6,
  22576. resetStack: true
  22577. }, null, {
  22578. id: "callsubr",
  22579. min: 1,
  22580. undefStack: true
  22581. }, {
  22582. id: "return",
  22583. min: 0,
  22584. undefStack: true
  22585. }, null, null, {
  22586. id: "endchar",
  22587. min: 0,
  22588. stackClearing: true
  22589. }, null, null, null, {
  22590. id: "hstemhm",
  22591. min: 2,
  22592. stackClearing: true,
  22593. stem: true
  22594. }, {
  22595. id: "hintmask",
  22596. min: 0,
  22597. stackClearing: true
  22598. }, {
  22599. id: "cntrmask",
  22600. min: 0,
  22601. stackClearing: true
  22602. }, {
  22603. id: "rmoveto",
  22604. min: 2,
  22605. stackClearing: true
  22606. }, {
  22607. id: "hmoveto",
  22608. min: 1,
  22609. stackClearing: true
  22610. }, {
  22611. id: "vstemhm",
  22612. min: 2,
  22613. stackClearing: true,
  22614. stem: true
  22615. }, {
  22616. id: "rcurveline",
  22617. min: 8,
  22618. resetStack: true
  22619. }, {
  22620. id: "rlinecurve",
  22621. min: 8,
  22622. resetStack: true
  22623. }, {
  22624. id: "vvcurveto",
  22625. min: 4,
  22626. resetStack: true
  22627. }, {
  22628. id: "hhcurveto",
  22629. min: 4,
  22630. resetStack: true
  22631. }, null, {
  22632. id: "callgsubr",
  22633. min: 1,
  22634. undefStack: true
  22635. }, {
  22636. id: "vhcurveto",
  22637. min: 4,
  22638. resetStack: true
  22639. }, {
  22640. id: "hvcurveto",
  22641. min: 4,
  22642. resetStack: true
  22643. }];
  22644. const CharstringValidationData12 = [null, null, null, {
  22645. id: "and",
  22646. min: 2,
  22647. stackDelta: -1
  22648. }, {
  22649. id: "or",
  22650. min: 2,
  22651. stackDelta: -1
  22652. }, {
  22653. id: "not",
  22654. min: 1,
  22655. stackDelta: 0
  22656. }, null, null, null, {
  22657. id: "abs",
  22658. min: 1,
  22659. stackDelta: 0
  22660. }, {
  22661. id: "add",
  22662. min: 2,
  22663. stackDelta: -1,
  22664. stackFn(stack, index) {
  22665. stack[index - 2] = stack[index - 2] + stack[index - 1];
  22666. }
  22667. }, {
  22668. id: "sub",
  22669. min: 2,
  22670. stackDelta: -1,
  22671. stackFn(stack, index) {
  22672. stack[index - 2] = stack[index - 2] - stack[index - 1];
  22673. }
  22674. }, {
  22675. id: "div",
  22676. min: 2,
  22677. stackDelta: -1,
  22678. stackFn(stack, index) {
  22679. stack[index - 2] = stack[index - 2] / stack[index - 1];
  22680. }
  22681. }, null, {
  22682. id: "neg",
  22683. min: 1,
  22684. stackDelta: 0,
  22685. stackFn(stack, index) {
  22686. stack[index - 1] = -stack[index - 1];
  22687. }
  22688. }, {
  22689. id: "eq",
  22690. min: 2,
  22691. stackDelta: -1
  22692. }, null, null, {
  22693. id: "drop",
  22694. min: 1,
  22695. stackDelta: -1
  22696. }, null, {
  22697. id: "put",
  22698. min: 2,
  22699. stackDelta: -2
  22700. }, {
  22701. id: "get",
  22702. min: 1,
  22703. stackDelta: 0
  22704. }, {
  22705. id: "ifelse",
  22706. min: 4,
  22707. stackDelta: -3
  22708. }, {
  22709. id: "random",
  22710. min: 0,
  22711. stackDelta: 1
  22712. }, {
  22713. id: "mul",
  22714. min: 2,
  22715. stackDelta: -1,
  22716. stackFn(stack, index) {
  22717. stack[index - 2] = stack[index - 2] * stack[index - 1];
  22718. }
  22719. }, null, {
  22720. id: "sqrt",
  22721. min: 1,
  22722. stackDelta: 0
  22723. }, {
  22724. id: "dup",
  22725. min: 1,
  22726. stackDelta: 1
  22727. }, {
  22728. id: "exch",
  22729. min: 2,
  22730. stackDelta: 0
  22731. }, {
  22732. id: "index",
  22733. min: 2,
  22734. stackDelta: 0
  22735. }, {
  22736. id: "roll",
  22737. min: 3,
  22738. stackDelta: -2
  22739. }, null, null, null, {
  22740. id: "hflex",
  22741. min: 7,
  22742. resetStack: true
  22743. }, {
  22744. id: "flex",
  22745. min: 13,
  22746. resetStack: true
  22747. }, {
  22748. id: "hflex1",
  22749. min: 9,
  22750. resetStack: true
  22751. }, {
  22752. id: "flex1",
  22753. min: 11,
  22754. resetStack: true
  22755. }];
  22756. class CFFParser {
  22757. constructor(file, properties, seacAnalysisEnabled) {
  22758. this.bytes = file.getBytes();
  22759. this.properties = properties;
  22760. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  22761. }
  22762. parse() {
  22763. const properties = this.properties;
  22764. const cff = new CFF();
  22765. this.cff = cff;
  22766. const header = this.parseHeader();
  22767. const nameIndex = this.parseIndex(header.endPos);
  22768. const topDictIndex = this.parseIndex(nameIndex.endPos);
  22769. const stringIndex = this.parseIndex(topDictIndex.endPos);
  22770. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  22771. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  22772. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  22773. cff.header = header.obj;
  22774. cff.names = this.parseNameIndex(nameIndex.obj);
  22775. cff.strings = this.parseStringIndex(stringIndex.obj);
  22776. cff.topDict = topDict;
  22777. cff.globalSubrIndex = globalSubrIndex.obj;
  22778. this.parsePrivateDict(cff.topDict);
  22779. cff.isCIDFont = topDict.hasName("ROS");
  22780. const charStringOffset = topDict.getByName("CharStrings");
  22781. const charStringIndex = this.parseIndex(charStringOffset).obj;
  22782. const fontMatrix = topDict.getByName("FontMatrix");
  22783. if (fontMatrix) {
  22784. properties.fontMatrix = fontMatrix;
  22785. }
  22786. const fontBBox = topDict.getByName("FontBBox");
  22787. if (fontBBox) {
  22788. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  22789. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  22790. properties.ascentScaled = true;
  22791. }
  22792. let charset, encoding;
  22793. if (cff.isCIDFont) {
  22794. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  22795. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  22796. const dictRaw = fdArrayIndex.get(i);
  22797. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  22798. this.parsePrivateDict(fontDict);
  22799. cff.fdArray.push(fontDict);
  22800. }
  22801. encoding = null;
  22802. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  22803. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  22804. } else {
  22805. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  22806. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  22807. }
  22808. cff.charset = charset;
  22809. cff.encoding = encoding;
  22810. const charStringsAndSeacs = this.parseCharStrings({
  22811. charStrings: charStringIndex,
  22812. localSubrIndex: topDict.privateDict.subrsIndex,
  22813. globalSubrIndex: globalSubrIndex.obj,
  22814. fdSelect: cff.fdSelect,
  22815. fdArray: cff.fdArray,
  22816. privateDict: topDict.privateDict
  22817. });
  22818. cff.charStrings = charStringsAndSeacs.charStrings;
  22819. cff.seacs = charStringsAndSeacs.seacs;
  22820. cff.widths = charStringsAndSeacs.widths;
  22821. return cff;
  22822. }
  22823. parseHeader() {
  22824. let bytes = this.bytes;
  22825. const bytesLength = bytes.length;
  22826. let offset = 0;
  22827. while (offset < bytesLength && bytes[offset] !== 1) {
  22828. ++offset;
  22829. }
  22830. if (offset >= bytesLength) {
  22831. throw new _util.FormatError("Invalid CFF header");
  22832. }
  22833. if (offset !== 0) {
  22834. (0, _util.info)("cff data is shifted");
  22835. bytes = bytes.subarray(offset);
  22836. this.bytes = bytes;
  22837. }
  22838. const major = bytes[0];
  22839. const minor = bytes[1];
  22840. const hdrSize = bytes[2];
  22841. const offSize = bytes[3];
  22842. const header = new CFFHeader(major, minor, hdrSize, offSize);
  22843. return {
  22844. obj: header,
  22845. endPos: hdrSize
  22846. };
  22847. }
  22848. parseDict(dict) {
  22849. let pos = 0;
  22850. function parseOperand() {
  22851. let value = dict[pos++];
  22852. if (value === 30) {
  22853. return parseFloatOperand();
  22854. } else if (value === 28) {
  22855. value = dict[pos++];
  22856. value = (value << 24 | dict[pos++] << 16) >> 16;
  22857. return value;
  22858. } else if (value === 29) {
  22859. value = dict[pos++];
  22860. value = value << 8 | dict[pos++];
  22861. value = value << 8 | dict[pos++];
  22862. value = value << 8 | dict[pos++];
  22863. return value;
  22864. } else if (value >= 32 && value <= 246) {
  22865. return value - 139;
  22866. } else if (value >= 247 && value <= 250) {
  22867. return (value - 247) * 256 + dict[pos++] + 108;
  22868. } else if (value >= 251 && value <= 254) {
  22869. return -((value - 251) * 256) - dict[pos++] - 108;
  22870. }
  22871. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  22872. return NaN;
  22873. }
  22874. function parseFloatOperand() {
  22875. let str = "";
  22876. const eof = 15;
  22877. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  22878. const length = dict.length;
  22879. while (pos < length) {
  22880. const b = dict[pos++];
  22881. const b1 = b >> 4;
  22882. const b2 = b & 15;
  22883. if (b1 === eof) {
  22884. break;
  22885. }
  22886. str += lookup[b1];
  22887. if (b2 === eof) {
  22888. break;
  22889. }
  22890. str += lookup[b2];
  22891. }
  22892. return parseFloat(str);
  22893. }
  22894. let operands = [];
  22895. const entries = [];
  22896. pos = 0;
  22897. const end = dict.length;
  22898. while (pos < end) {
  22899. let b = dict[pos];
  22900. if (b <= 21) {
  22901. if (b === 12) {
  22902. b = b << 8 | dict[++pos];
  22903. }
  22904. entries.push([b, operands]);
  22905. operands = [];
  22906. ++pos;
  22907. } else {
  22908. operands.push(parseOperand());
  22909. }
  22910. }
  22911. return entries;
  22912. }
  22913. parseIndex(pos) {
  22914. const cffIndex = new CFFIndex();
  22915. const bytes = this.bytes;
  22916. const count = bytes[pos++] << 8 | bytes[pos++];
  22917. const offsets = [];
  22918. let end = pos;
  22919. let i, ii;
  22920. if (count !== 0) {
  22921. const offsetSize = bytes[pos++];
  22922. const startPos = pos + (count + 1) * offsetSize - 1;
  22923. for (i = 0, ii = count + 1; i < ii; ++i) {
  22924. let offset = 0;
  22925. for (let j = 0; j < offsetSize; ++j) {
  22926. offset <<= 8;
  22927. offset += bytes[pos++];
  22928. }
  22929. offsets.push(startPos + offset);
  22930. }
  22931. end = offsets[count];
  22932. }
  22933. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  22934. const offsetStart = offsets[i];
  22935. const offsetEnd = offsets[i + 1];
  22936. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  22937. }
  22938. return {
  22939. obj: cffIndex,
  22940. endPos: end
  22941. };
  22942. }
  22943. parseNameIndex(index) {
  22944. const names = [];
  22945. for (let i = 0, ii = index.count; i < ii; ++i) {
  22946. const name = index.get(i);
  22947. names.push((0, _util.bytesToString)(name));
  22948. }
  22949. return names;
  22950. }
  22951. parseStringIndex(index) {
  22952. const strings = new CFFStrings();
  22953. for (let i = 0, ii = index.count; i < ii; ++i) {
  22954. const data = index.get(i);
  22955. strings.add((0, _util.bytesToString)(data));
  22956. }
  22957. return strings;
  22958. }
  22959. createDict(Type, dict, strings) {
  22960. const cffDict = new Type(strings);
  22961. for (let i = 0, ii = dict.length; i < ii; ++i) {
  22962. const pair = dict[i];
  22963. const key = pair[0];
  22964. const value = pair[1];
  22965. cffDict.setByKey(key, value);
  22966. }
  22967. return cffDict;
  22968. }
  22969. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  22970. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  22971. return false;
  22972. }
  22973. let stackSize = state.stackSize;
  22974. const stack = state.stack;
  22975. const length = data.length;
  22976. for (let j = 0; j < length;) {
  22977. const value = data[j++];
  22978. let validationCommand = null;
  22979. if (value === 12) {
  22980. const q = data[j++];
  22981. if (q === 0) {
  22982. data[j - 2] = 139;
  22983. data[j - 1] = 22;
  22984. stackSize = 0;
  22985. } else {
  22986. validationCommand = CharstringValidationData12[q];
  22987. }
  22988. } else if (value === 28) {
  22989. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  22990. j += 2;
  22991. stackSize++;
  22992. } else if (value === 14) {
  22993. if (stackSize >= 4) {
  22994. stackSize -= 4;
  22995. if (this.seacAnalysisEnabled) {
  22996. state.seac = stack.slice(stackSize, stackSize + 4);
  22997. return false;
  22998. }
  22999. }
  23000. validationCommand = CharstringValidationData[value];
  23001. } else if (value >= 32 && value <= 246) {
  23002. stack[stackSize] = value - 139;
  23003. stackSize++;
  23004. } else if (value >= 247 && value <= 254) {
  23005. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  23006. j++;
  23007. stackSize++;
  23008. } else if (value === 255) {
  23009. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  23010. j += 4;
  23011. stackSize++;
  23012. } else if (value === 19 || value === 20) {
  23013. state.hints += stackSize >> 1;
  23014. j += state.hints + 7 >> 3;
  23015. stackSize %= 2;
  23016. validationCommand = CharstringValidationData[value];
  23017. } else if (value === 10 || value === 29) {
  23018. let subrsIndex;
  23019. if (value === 10) {
  23020. subrsIndex = localSubrIndex;
  23021. } else {
  23022. subrsIndex = globalSubrIndex;
  23023. }
  23024. if (!subrsIndex) {
  23025. validationCommand = CharstringValidationData[value];
  23026. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  23027. return false;
  23028. }
  23029. let bias = 32768;
  23030. if (subrsIndex.count < 1240) {
  23031. bias = 107;
  23032. } else if (subrsIndex.count < 33900) {
  23033. bias = 1131;
  23034. }
  23035. const subrNumber = stack[--stackSize] + bias;
  23036. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  23037. validationCommand = CharstringValidationData[value];
  23038. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  23039. return false;
  23040. }
  23041. state.stackSize = stackSize;
  23042. state.callDepth++;
  23043. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  23044. if (!valid) {
  23045. return false;
  23046. }
  23047. state.callDepth--;
  23048. stackSize = state.stackSize;
  23049. continue;
  23050. } else if (value === 11) {
  23051. state.stackSize = stackSize;
  23052. return true;
  23053. } else if (value === 0 && j === data.length) {
  23054. data[j - 1] = 14;
  23055. validationCommand = CharstringValidationData[14];
  23056. } else {
  23057. validationCommand = CharstringValidationData[value];
  23058. }
  23059. if (validationCommand) {
  23060. if (validationCommand.stem) {
  23061. state.hints += stackSize >> 1;
  23062. if (value === 3 || value === 23) {
  23063. state.hasVStems = true;
  23064. } else if (state.hasVStems && (value === 1 || value === 18)) {
  23065. (0, _util.warn)("CFF stem hints are in wrong order");
  23066. data[j - 1] = value === 1 ? 3 : 23;
  23067. }
  23068. }
  23069. if ("min" in validationCommand) {
  23070. if (!state.undefStack && stackSize < validationCommand.min) {
  23071. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  23072. if (stackSize === 0) {
  23073. data[j - 1] = 14;
  23074. return true;
  23075. }
  23076. return false;
  23077. }
  23078. }
  23079. if (state.firstStackClearing && validationCommand.stackClearing) {
  23080. state.firstStackClearing = false;
  23081. stackSize -= validationCommand.min;
  23082. if (stackSize >= 2 && validationCommand.stem) {
  23083. stackSize %= 2;
  23084. } else if (stackSize > 1) {
  23085. (0, _util.warn)("Found too many parameters for stack-clearing command");
  23086. }
  23087. if (stackSize > 0) {
  23088. state.width = stack[stackSize - 1];
  23089. }
  23090. }
  23091. if ("stackDelta" in validationCommand) {
  23092. if ("stackFn" in validationCommand) {
  23093. validationCommand.stackFn(stack, stackSize);
  23094. }
  23095. stackSize += validationCommand.stackDelta;
  23096. } else if (validationCommand.stackClearing) {
  23097. stackSize = 0;
  23098. } else if (validationCommand.resetStack) {
  23099. stackSize = 0;
  23100. state.undefStack = false;
  23101. } else if (validationCommand.undefStack) {
  23102. stackSize = 0;
  23103. state.undefStack = true;
  23104. state.firstStackClearing = false;
  23105. }
  23106. }
  23107. }
  23108. state.stackSize = stackSize;
  23109. return true;
  23110. }
  23111. parseCharStrings({
  23112. charStrings,
  23113. localSubrIndex,
  23114. globalSubrIndex,
  23115. fdSelect,
  23116. fdArray,
  23117. privateDict
  23118. }) {
  23119. const seacs = [];
  23120. const widths = [];
  23121. const count = charStrings.count;
  23122. for (let i = 0; i < count; i++) {
  23123. const charstring = charStrings.get(i);
  23124. const state = {
  23125. callDepth: 0,
  23126. stackSize: 0,
  23127. stack: [],
  23128. undefStack: true,
  23129. hints: 0,
  23130. firstStackClearing: true,
  23131. seac: null,
  23132. width: null,
  23133. hasVStems: false
  23134. };
  23135. let valid = true;
  23136. let localSubrToUse = null;
  23137. let privateDictToUse = privateDict;
  23138. if (fdSelect && fdArray.length) {
  23139. const fdIndex = fdSelect.getFDIndex(i);
  23140. if (fdIndex === -1) {
  23141. (0, _util.warn)("Glyph index is not in fd select.");
  23142. valid = false;
  23143. }
  23144. if (fdIndex >= fdArray.length) {
  23145. (0, _util.warn)("Invalid fd index for glyph index.");
  23146. valid = false;
  23147. }
  23148. if (valid) {
  23149. privateDictToUse = fdArray[fdIndex].privateDict;
  23150. localSubrToUse = privateDictToUse.subrsIndex;
  23151. }
  23152. } else if (localSubrIndex) {
  23153. localSubrToUse = localSubrIndex;
  23154. }
  23155. if (valid) {
  23156. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  23157. }
  23158. if (state.width !== null) {
  23159. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  23160. widths[i] = nominalWidth + state.width;
  23161. } else {
  23162. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  23163. widths[i] = defaultWidth;
  23164. }
  23165. if (state.seac !== null) {
  23166. seacs[i] = state.seac;
  23167. }
  23168. if (!valid) {
  23169. charStrings.set(i, new Uint8Array([14]));
  23170. }
  23171. }
  23172. return {
  23173. charStrings,
  23174. seacs,
  23175. widths
  23176. };
  23177. }
  23178. emptyPrivateDictionary(parentDict) {
  23179. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  23180. parentDict.setByKey(18, [0, 0]);
  23181. parentDict.privateDict = privateDict;
  23182. }
  23183. parsePrivateDict(parentDict) {
  23184. if (!parentDict.hasName("Private")) {
  23185. this.emptyPrivateDictionary(parentDict);
  23186. return;
  23187. }
  23188. const privateOffset = parentDict.getByName("Private");
  23189. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  23190. parentDict.removeByName("Private");
  23191. return;
  23192. }
  23193. const size = privateOffset[0];
  23194. const offset = privateOffset[1];
  23195. if (size === 0 || offset >= this.bytes.length) {
  23196. this.emptyPrivateDictionary(parentDict);
  23197. return;
  23198. }
  23199. const privateDictEnd = offset + size;
  23200. const dictData = this.bytes.subarray(offset, privateDictEnd);
  23201. const dict = this.parseDict(dictData);
  23202. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  23203. parentDict.privateDict = privateDict;
  23204. if (!privateDict.getByName("Subrs")) {
  23205. return;
  23206. }
  23207. const subrsOffset = privateDict.getByName("Subrs");
  23208. const relativeOffset = offset + subrsOffset;
  23209. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  23210. this.emptyPrivateDictionary(parentDict);
  23211. return;
  23212. }
  23213. const subrsIndex = this.parseIndex(relativeOffset);
  23214. privateDict.subrsIndex = subrsIndex.obj;
  23215. }
  23216. parseCharsets(pos, length, strings, cid) {
  23217. if (pos === 0) {
  23218. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  23219. } else if (pos === 1) {
  23220. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  23221. } else if (pos === 2) {
  23222. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  23223. }
  23224. const bytes = this.bytes;
  23225. const start = pos;
  23226. const format = bytes[pos++];
  23227. const charset = [cid ? 0 : ".notdef"];
  23228. let id, count, i;
  23229. length -= 1;
  23230. switch (format) {
  23231. case 0:
  23232. for (i = 0; i < length; i++) {
  23233. id = bytes[pos++] << 8 | bytes[pos++];
  23234. charset.push(cid ? id : strings.get(id));
  23235. }
  23236. break;
  23237. case 1:
  23238. while (charset.length <= length) {
  23239. id = bytes[pos++] << 8 | bytes[pos++];
  23240. count = bytes[pos++];
  23241. for (i = 0; i <= count; i++) {
  23242. charset.push(cid ? id++ : strings.get(id++));
  23243. }
  23244. }
  23245. break;
  23246. case 2:
  23247. while (charset.length <= length) {
  23248. id = bytes[pos++] << 8 | bytes[pos++];
  23249. count = bytes[pos++] << 8 | bytes[pos++];
  23250. for (i = 0; i <= count; i++) {
  23251. charset.push(cid ? id++ : strings.get(id++));
  23252. }
  23253. }
  23254. break;
  23255. default:
  23256. throw new _util.FormatError("Unknown charset format");
  23257. }
  23258. const end = pos;
  23259. const raw = bytes.subarray(start, end);
  23260. return new CFFCharset(false, format, charset, raw);
  23261. }
  23262. parseEncoding(pos, properties, strings, charset) {
  23263. const encoding = Object.create(null);
  23264. const bytes = this.bytes;
  23265. let predefined = false;
  23266. let format, i, ii;
  23267. let raw = null;
  23268. function readSupplement() {
  23269. const supplementsCount = bytes[pos++];
  23270. for (i = 0; i < supplementsCount; i++) {
  23271. const code = bytes[pos++];
  23272. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  23273. encoding[code] = charset.indexOf(strings.get(sid));
  23274. }
  23275. }
  23276. if (pos === 0 || pos === 1) {
  23277. predefined = true;
  23278. format = pos;
  23279. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  23280. for (i = 0, ii = charset.length; i < ii; i++) {
  23281. const index = baseEncoding.indexOf(charset[i]);
  23282. if (index !== -1) {
  23283. encoding[index] = i;
  23284. }
  23285. }
  23286. } else {
  23287. const dataStart = pos;
  23288. format = bytes[pos++];
  23289. switch (format & 0x7f) {
  23290. case 0:
  23291. const glyphsCount = bytes[pos++];
  23292. for (i = 1; i <= glyphsCount; i++) {
  23293. encoding[bytes[pos++]] = i;
  23294. }
  23295. break;
  23296. case 1:
  23297. const rangesCount = bytes[pos++];
  23298. let gid = 1;
  23299. for (i = 0; i < rangesCount; i++) {
  23300. const start = bytes[pos++];
  23301. const left = bytes[pos++];
  23302. for (let j = start; j <= start + left; j++) {
  23303. encoding[j] = gid++;
  23304. }
  23305. }
  23306. break;
  23307. default:
  23308. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  23309. }
  23310. const dataEnd = pos;
  23311. if (format & 0x80) {
  23312. bytes[dataStart] &= 0x7f;
  23313. readSupplement();
  23314. }
  23315. raw = bytes.subarray(dataStart, dataEnd);
  23316. }
  23317. format &= 0x7f;
  23318. return new CFFEncoding(predefined, format, encoding, raw);
  23319. }
  23320. parseFDSelect(pos, length) {
  23321. const bytes = this.bytes;
  23322. const format = bytes[pos++];
  23323. const fdSelect = [];
  23324. let i;
  23325. switch (format) {
  23326. case 0:
  23327. for (i = 0; i < length; ++i) {
  23328. const id = bytes[pos++];
  23329. fdSelect.push(id);
  23330. }
  23331. break;
  23332. case 3:
  23333. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  23334. for (i = 0; i < rangesCount; ++i) {
  23335. let first = bytes[pos++] << 8 | bytes[pos++];
  23336. if (i === 0 && first !== 0) {
  23337. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  23338. first = 0;
  23339. }
  23340. const fdIndex = bytes[pos++];
  23341. const next = bytes[pos] << 8 | bytes[pos + 1];
  23342. for (let j = first; j < next; ++j) {
  23343. fdSelect.push(fdIndex);
  23344. }
  23345. }
  23346. pos += 2;
  23347. break;
  23348. default:
  23349. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  23350. }
  23351. if (fdSelect.length !== length) {
  23352. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  23353. }
  23354. return new CFFFDSelect(format, fdSelect);
  23355. }
  23356. }
  23357. exports.CFFParser = CFFParser;
  23358. class CFF {
  23359. constructor() {
  23360. this.header = null;
  23361. this.names = [];
  23362. this.topDict = null;
  23363. this.strings = new CFFStrings();
  23364. this.globalSubrIndex = null;
  23365. this.encoding = null;
  23366. this.charset = null;
  23367. this.charStrings = null;
  23368. this.fdArray = [];
  23369. this.fdSelect = null;
  23370. this.isCIDFont = false;
  23371. }
  23372. duplicateFirstGlyph() {
  23373. if (this.charStrings.count >= 65535) {
  23374. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  23375. return;
  23376. }
  23377. const glyphZero = this.charStrings.get(0);
  23378. this.charStrings.add(glyphZero);
  23379. if (this.isCIDFont) {
  23380. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  23381. }
  23382. }
  23383. hasGlyphId(id) {
  23384. if (id < 0 || id >= this.charStrings.count) {
  23385. return false;
  23386. }
  23387. const glyph = this.charStrings.get(id);
  23388. return glyph.length > 0;
  23389. }
  23390. }
  23391. exports.CFF = CFF;
  23392. class CFFHeader {
  23393. constructor(major, minor, hdrSize, offSize) {
  23394. this.major = major;
  23395. this.minor = minor;
  23396. this.hdrSize = hdrSize;
  23397. this.offSize = offSize;
  23398. }
  23399. }
  23400. exports.CFFHeader = CFFHeader;
  23401. class CFFStrings {
  23402. constructor() {
  23403. this.strings = [];
  23404. }
  23405. get(index) {
  23406. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  23407. return CFFStandardStrings[index];
  23408. }
  23409. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  23410. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  23411. }
  23412. return CFFStandardStrings[0];
  23413. }
  23414. getSID(str) {
  23415. let index = CFFStandardStrings.indexOf(str);
  23416. if (index !== -1) {
  23417. return index;
  23418. }
  23419. index = this.strings.indexOf(str);
  23420. if (index !== -1) {
  23421. return index + NUM_STANDARD_CFF_STRINGS;
  23422. }
  23423. return -1;
  23424. }
  23425. add(value) {
  23426. this.strings.push(value);
  23427. }
  23428. get count() {
  23429. return this.strings.length;
  23430. }
  23431. }
  23432. exports.CFFStrings = CFFStrings;
  23433. class CFFIndex {
  23434. constructor() {
  23435. this.objects = [];
  23436. this.length = 0;
  23437. }
  23438. add(data) {
  23439. this.length += data.length;
  23440. this.objects.push(data);
  23441. }
  23442. set(index, data) {
  23443. this.length += data.length - this.objects[index].length;
  23444. this.objects[index] = data;
  23445. }
  23446. get(index) {
  23447. return this.objects[index];
  23448. }
  23449. get count() {
  23450. return this.objects.length;
  23451. }
  23452. }
  23453. exports.CFFIndex = CFFIndex;
  23454. class CFFDict {
  23455. constructor(tables, strings) {
  23456. this.keyToNameMap = tables.keyToNameMap;
  23457. this.nameToKeyMap = tables.nameToKeyMap;
  23458. this.defaults = tables.defaults;
  23459. this.types = tables.types;
  23460. this.opcodes = tables.opcodes;
  23461. this.order = tables.order;
  23462. this.strings = strings;
  23463. this.values = Object.create(null);
  23464. }
  23465. setByKey(key, value) {
  23466. if (!(key in this.keyToNameMap)) {
  23467. return false;
  23468. }
  23469. const valueLength = value.length;
  23470. if (valueLength === 0) {
  23471. return true;
  23472. }
  23473. for (let i = 0; i < valueLength; i++) {
  23474. if (isNaN(value[i])) {
  23475. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  23476. return true;
  23477. }
  23478. }
  23479. const type = this.types[key];
  23480. if (type === "num" || type === "sid" || type === "offset") {
  23481. value = value[0];
  23482. }
  23483. this.values[key] = value;
  23484. return true;
  23485. }
  23486. setByName(name, value) {
  23487. if (!(name in this.nameToKeyMap)) {
  23488. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  23489. }
  23490. this.values[this.nameToKeyMap[name]] = value;
  23491. }
  23492. hasName(name) {
  23493. return this.nameToKeyMap[name] in this.values;
  23494. }
  23495. getByName(name) {
  23496. if (!(name in this.nameToKeyMap)) {
  23497. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  23498. }
  23499. const key = this.nameToKeyMap[name];
  23500. if (!(key in this.values)) {
  23501. return this.defaults[key];
  23502. }
  23503. return this.values[key];
  23504. }
  23505. removeByName(name) {
  23506. delete this.values[this.nameToKeyMap[name]];
  23507. }
  23508. static createTables(layout) {
  23509. const tables = {
  23510. keyToNameMap: {},
  23511. nameToKeyMap: {},
  23512. defaults: {},
  23513. types: {},
  23514. opcodes: {},
  23515. order: []
  23516. };
  23517. for (let i = 0, ii = layout.length; i < ii; ++i) {
  23518. const entry = layout[i];
  23519. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  23520. tables.keyToNameMap[key] = entry[1];
  23521. tables.nameToKeyMap[entry[1]] = key;
  23522. tables.types[key] = entry[2];
  23523. tables.defaults[key] = entry[3];
  23524. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  23525. tables.order.push(key);
  23526. }
  23527. return tables;
  23528. }
  23529. }
  23530. 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]];
  23531. class CFFTopDict extends CFFDict {
  23532. static get tables() {
  23533. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  23534. }
  23535. constructor(strings) {
  23536. super(CFFTopDict.tables, strings);
  23537. this.privateDict = null;
  23538. }
  23539. }
  23540. exports.CFFTopDict = CFFTopDict;
  23541. 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]];
  23542. class CFFPrivateDict extends CFFDict {
  23543. static get tables() {
  23544. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  23545. }
  23546. constructor(strings) {
  23547. super(CFFPrivateDict.tables, strings);
  23548. this.subrsIndex = null;
  23549. }
  23550. }
  23551. exports.CFFPrivateDict = CFFPrivateDict;
  23552. const CFFCharsetPredefinedTypes = {
  23553. ISO_ADOBE: 0,
  23554. EXPERT: 1,
  23555. EXPERT_SUBSET: 2
  23556. };
  23557. class CFFCharset {
  23558. constructor(predefined, format, charset, raw) {
  23559. this.predefined = predefined;
  23560. this.format = format;
  23561. this.charset = charset;
  23562. this.raw = raw;
  23563. }
  23564. }
  23565. exports.CFFCharset = CFFCharset;
  23566. class CFFEncoding {
  23567. constructor(predefined, format, encoding, raw) {
  23568. this.predefined = predefined;
  23569. this.format = format;
  23570. this.encoding = encoding;
  23571. this.raw = raw;
  23572. }
  23573. }
  23574. class CFFFDSelect {
  23575. constructor(format, fdSelect) {
  23576. this.format = format;
  23577. this.fdSelect = fdSelect;
  23578. }
  23579. getFDIndex(glyphIndex) {
  23580. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  23581. return -1;
  23582. }
  23583. return this.fdSelect[glyphIndex];
  23584. }
  23585. }
  23586. exports.CFFFDSelect = CFFFDSelect;
  23587. class CFFOffsetTracker {
  23588. constructor() {
  23589. this.offsets = Object.create(null);
  23590. }
  23591. isTracking(key) {
  23592. return key in this.offsets;
  23593. }
  23594. track(key, location) {
  23595. if (key in this.offsets) {
  23596. throw new _util.FormatError(`Already tracking location of ${key}`);
  23597. }
  23598. this.offsets[key] = location;
  23599. }
  23600. offset(value) {
  23601. for (const key in this.offsets) {
  23602. this.offsets[key] += value;
  23603. }
  23604. }
  23605. setEntryLocation(key, values, output) {
  23606. if (!(key in this.offsets)) {
  23607. throw new _util.FormatError(`Not tracking location of ${key}`);
  23608. }
  23609. const data = output.data;
  23610. const dataOffset = this.offsets[key];
  23611. const size = 5;
  23612. for (let i = 0, ii = values.length; i < ii; ++i) {
  23613. const offset0 = i * size + dataOffset;
  23614. const offset1 = offset0 + 1;
  23615. const offset2 = offset0 + 2;
  23616. const offset3 = offset0 + 3;
  23617. const offset4 = offset0 + 4;
  23618. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  23619. throw new _util.FormatError("writing to an offset that is not empty");
  23620. }
  23621. const value = values[i];
  23622. data[offset0] = 0x1d;
  23623. data[offset1] = value >> 24 & 0xff;
  23624. data[offset2] = value >> 16 & 0xff;
  23625. data[offset3] = value >> 8 & 0xff;
  23626. data[offset4] = value & 0xff;
  23627. }
  23628. }
  23629. }
  23630. class CFFCompiler {
  23631. constructor(cff) {
  23632. this.cff = cff;
  23633. }
  23634. compile() {
  23635. const cff = this.cff;
  23636. const output = {
  23637. data: [],
  23638. length: 0,
  23639. add(data) {
  23640. this.data = this.data.concat(data);
  23641. this.length = this.data.length;
  23642. }
  23643. };
  23644. const header = this.compileHeader(cff.header);
  23645. output.add(header);
  23646. const nameIndex = this.compileNameIndex(cff.names);
  23647. output.add(nameIndex);
  23648. if (cff.isCIDFont) {
  23649. if (cff.topDict.hasName("FontMatrix")) {
  23650. const base = cff.topDict.getByName("FontMatrix");
  23651. cff.topDict.removeByName("FontMatrix");
  23652. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  23653. const subDict = cff.fdArray[i];
  23654. let matrix = base.slice(0);
  23655. if (subDict.hasName("FontMatrix")) {
  23656. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  23657. }
  23658. subDict.setByName("FontMatrix", matrix);
  23659. }
  23660. }
  23661. }
  23662. const xuid = cff.topDict.getByName("XUID");
  23663. if (xuid && xuid.length > 16) {
  23664. cff.topDict.removeByName("XUID");
  23665. }
  23666. cff.topDict.setByName("charset", 0);
  23667. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  23668. output.add(compiled.output);
  23669. const topDictTracker = compiled.trackers[0];
  23670. const stringIndex = this.compileStringIndex(cff.strings.strings);
  23671. output.add(stringIndex);
  23672. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  23673. output.add(globalSubrIndex);
  23674. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  23675. if (cff.encoding.predefined) {
  23676. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  23677. } else {
  23678. const encoding = this.compileEncoding(cff.encoding);
  23679. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  23680. output.add(encoding);
  23681. }
  23682. }
  23683. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  23684. topDictTracker.setEntryLocation("charset", [output.length], output);
  23685. output.add(charset);
  23686. const charStrings = this.compileCharStrings(cff.charStrings);
  23687. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  23688. output.add(charStrings);
  23689. if (cff.isCIDFont) {
  23690. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  23691. const fdSelect = this.compileFDSelect(cff.fdSelect);
  23692. output.add(fdSelect);
  23693. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  23694. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  23695. output.add(compiled.output);
  23696. const fontDictTrackers = compiled.trackers;
  23697. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  23698. }
  23699. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  23700. output.add([0]);
  23701. return output.data;
  23702. }
  23703. encodeNumber(value) {
  23704. if (Number.isInteger(value)) {
  23705. return this.encodeInteger(value);
  23706. }
  23707. return this.encodeFloat(value);
  23708. }
  23709. static get EncodeFloatRegExp() {
  23710. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  23711. }
  23712. encodeFloat(num) {
  23713. let value = num.toString();
  23714. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  23715. if (m) {
  23716. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  23717. value = (Math.round(num * epsilon) / epsilon).toString();
  23718. }
  23719. let nibbles = "";
  23720. let i, ii;
  23721. for (i = 0, ii = value.length; i < ii; ++i) {
  23722. const a = value[i];
  23723. if (a === "e") {
  23724. nibbles += value[++i] === "-" ? "c" : "b";
  23725. } else if (a === ".") {
  23726. nibbles += "a";
  23727. } else if (a === "-") {
  23728. nibbles += "e";
  23729. } else {
  23730. nibbles += a;
  23731. }
  23732. }
  23733. nibbles += nibbles.length & 1 ? "f" : "ff";
  23734. const out = [30];
  23735. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  23736. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  23737. }
  23738. return out;
  23739. }
  23740. encodeInteger(value) {
  23741. let code;
  23742. if (value >= -107 && value <= 107) {
  23743. code = [value + 139];
  23744. } else if (value >= 108 && value <= 1131) {
  23745. value -= 108;
  23746. code = [(value >> 8) + 247, value & 0xff];
  23747. } else if (value >= -1131 && value <= -108) {
  23748. value = -value - 108;
  23749. code = [(value >> 8) + 251, value & 0xff];
  23750. } else if (value >= -32768 && value <= 32767) {
  23751. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  23752. } else {
  23753. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  23754. }
  23755. return code;
  23756. }
  23757. compileHeader(header) {
  23758. return [header.major, header.minor, 4, header.offSize];
  23759. }
  23760. compileNameIndex(names) {
  23761. const nameIndex = new CFFIndex();
  23762. for (let i = 0, ii = names.length; i < ii; ++i) {
  23763. const name = names[i];
  23764. const length = Math.min(name.length, 127);
  23765. let sanitizedName = new Array(length);
  23766. for (let j = 0; j < length; j++) {
  23767. let char = name[j];
  23768. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  23769. char = "_";
  23770. }
  23771. sanitizedName[j] = char;
  23772. }
  23773. sanitizedName = sanitizedName.join("");
  23774. if (sanitizedName === "") {
  23775. sanitizedName = "Bad_Font_Name";
  23776. }
  23777. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  23778. }
  23779. return this.compileIndex(nameIndex);
  23780. }
  23781. compileTopDicts(dicts, length, removeCidKeys) {
  23782. const fontDictTrackers = [];
  23783. let fdArrayIndex = new CFFIndex();
  23784. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  23785. const fontDict = dicts[i];
  23786. if (removeCidKeys) {
  23787. fontDict.removeByName("CIDFontVersion");
  23788. fontDict.removeByName("CIDFontRevision");
  23789. fontDict.removeByName("CIDFontType");
  23790. fontDict.removeByName("CIDCount");
  23791. fontDict.removeByName("UIDBase");
  23792. }
  23793. const fontDictTracker = new CFFOffsetTracker();
  23794. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  23795. fontDictTrackers.push(fontDictTracker);
  23796. fdArrayIndex.add(fontDictData);
  23797. fontDictTracker.offset(length);
  23798. }
  23799. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  23800. return {
  23801. trackers: fontDictTrackers,
  23802. output: fdArrayIndex
  23803. };
  23804. }
  23805. compilePrivateDicts(dicts, trackers, output) {
  23806. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  23807. const fontDict = dicts[i];
  23808. const privateDict = fontDict.privateDict;
  23809. if (!privateDict || !fontDict.hasName("Private")) {
  23810. throw new _util.FormatError("There must be a private dictionary.");
  23811. }
  23812. const privateDictTracker = new CFFOffsetTracker();
  23813. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  23814. let outputLength = output.length;
  23815. privateDictTracker.offset(outputLength);
  23816. if (!privateDictData.length) {
  23817. outputLength = 0;
  23818. }
  23819. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  23820. output.add(privateDictData);
  23821. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  23822. const subrs = this.compileIndex(privateDict.subrsIndex);
  23823. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  23824. output.add(subrs);
  23825. }
  23826. }
  23827. }
  23828. compileDict(dict, offsetTracker) {
  23829. const out = [];
  23830. for (const key of dict.order) {
  23831. if (!(key in dict.values)) {
  23832. continue;
  23833. }
  23834. let values = dict.values[key];
  23835. let types = dict.types[key];
  23836. if (!Array.isArray(types)) {
  23837. types = [types];
  23838. }
  23839. if (!Array.isArray(values)) {
  23840. values = [values];
  23841. }
  23842. if (values.length === 0) {
  23843. continue;
  23844. }
  23845. for (let j = 0, jj = types.length; j < jj; ++j) {
  23846. const type = types[j];
  23847. const value = values[j];
  23848. switch (type) {
  23849. case "num":
  23850. case "sid":
  23851. out.push(...this.encodeNumber(value));
  23852. break;
  23853. case "offset":
  23854. const name = dict.keyToNameMap[key];
  23855. if (!offsetTracker.isTracking(name)) {
  23856. offsetTracker.track(name, out.length);
  23857. }
  23858. out.push(0x1d, 0, 0, 0, 0);
  23859. break;
  23860. case "array":
  23861. case "delta":
  23862. out.push(...this.encodeNumber(value));
  23863. for (let k = 1, kk = values.length; k < kk; ++k) {
  23864. out.push(...this.encodeNumber(values[k]));
  23865. }
  23866. break;
  23867. default:
  23868. throw new _util.FormatError(`Unknown data type of ${type}`);
  23869. }
  23870. }
  23871. out.push(...dict.opcodes[key]);
  23872. }
  23873. return out;
  23874. }
  23875. compileStringIndex(strings) {
  23876. const stringIndex = new CFFIndex();
  23877. for (let i = 0, ii = strings.length; i < ii; ++i) {
  23878. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  23879. }
  23880. return this.compileIndex(stringIndex);
  23881. }
  23882. compileGlobalSubrIndex() {
  23883. const globalSubrIndex = this.cff.globalSubrIndex;
  23884. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  23885. }
  23886. compileCharStrings(charStrings) {
  23887. const charStringsIndex = new CFFIndex();
  23888. for (let i = 0; i < charStrings.count; i++) {
  23889. const glyph = charStrings.get(i);
  23890. if (glyph.length === 0) {
  23891. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  23892. continue;
  23893. }
  23894. charStringsIndex.add(glyph);
  23895. }
  23896. return this.compileIndex(charStringsIndex);
  23897. }
  23898. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  23899. let out;
  23900. const numGlyphsLessNotDef = numGlyphs - 1;
  23901. if (isCIDFont) {
  23902. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  23903. } else {
  23904. const length = 1 + numGlyphsLessNotDef * 2;
  23905. out = new Uint8Array(length);
  23906. out[0] = 0;
  23907. let charsetIndex = 0;
  23908. const numCharsets = charset.charset.length;
  23909. let warned = false;
  23910. for (let i = 1; i < out.length; i += 2) {
  23911. let sid = 0;
  23912. if (charsetIndex < numCharsets) {
  23913. const name = charset.charset[charsetIndex++];
  23914. sid = strings.getSID(name);
  23915. if (sid === -1) {
  23916. sid = 0;
  23917. if (!warned) {
  23918. warned = true;
  23919. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  23920. }
  23921. }
  23922. }
  23923. out[i] = sid >> 8 & 0xff;
  23924. out[i + 1] = sid & 0xff;
  23925. }
  23926. }
  23927. return this.compileTypedArray(out);
  23928. }
  23929. compileEncoding(encoding) {
  23930. return this.compileTypedArray(encoding.raw);
  23931. }
  23932. compileFDSelect(fdSelect) {
  23933. const format = fdSelect.format;
  23934. let out, i;
  23935. switch (format) {
  23936. case 0:
  23937. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  23938. out[0] = format;
  23939. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  23940. out[i + 1] = fdSelect.fdSelect[i];
  23941. }
  23942. break;
  23943. case 3:
  23944. const start = 0;
  23945. let lastFD = fdSelect.fdSelect[0];
  23946. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  23947. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  23948. const currentFD = fdSelect.fdSelect[i];
  23949. if (currentFD !== lastFD) {
  23950. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  23951. lastFD = currentFD;
  23952. }
  23953. }
  23954. const numRanges = (ranges.length - 3) / 3;
  23955. ranges[1] = numRanges >> 8 & 0xff;
  23956. ranges[2] = numRanges & 0xff;
  23957. ranges.push(i >> 8 & 0xff, i & 0xff);
  23958. out = new Uint8Array(ranges);
  23959. break;
  23960. }
  23961. return this.compileTypedArray(out);
  23962. }
  23963. compileTypedArray(data) {
  23964. const out = [];
  23965. for (let i = 0, ii = data.length; i < ii; ++i) {
  23966. out[i] = data[i];
  23967. }
  23968. return out;
  23969. }
  23970. compileIndex(index, trackers = []) {
  23971. const objects = index.objects;
  23972. const count = objects.length;
  23973. if (count === 0) {
  23974. return [0, 0];
  23975. }
  23976. const data = [count >> 8 & 0xff, count & 0xff];
  23977. let lastOffset = 1,
  23978. i;
  23979. for (i = 0; i < count; ++i) {
  23980. lastOffset += objects[i].length;
  23981. }
  23982. let offsetSize;
  23983. if (lastOffset < 0x100) {
  23984. offsetSize = 1;
  23985. } else if (lastOffset < 0x10000) {
  23986. offsetSize = 2;
  23987. } else if (lastOffset < 0x1000000) {
  23988. offsetSize = 3;
  23989. } else {
  23990. offsetSize = 4;
  23991. }
  23992. data.push(offsetSize);
  23993. let relativeOffset = 1;
  23994. for (i = 0; i < count + 1; i++) {
  23995. if (offsetSize === 1) {
  23996. data.push(relativeOffset & 0xff);
  23997. } else if (offsetSize === 2) {
  23998. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  23999. } else if (offsetSize === 3) {
  24000. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24001. } else {
  24002. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24003. }
  24004. if (objects[i]) {
  24005. relativeOffset += objects[i].length;
  24006. }
  24007. }
  24008. for (i = 0; i < count; i++) {
  24009. if (trackers[i]) {
  24010. trackers[i].offset(data.length);
  24011. }
  24012. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  24013. data.push(objects[i][j]);
  24014. }
  24015. }
  24016. return data;
  24017. }
  24018. }
  24019. exports.CFFCompiler = CFFCompiler;
  24020. /***/ }),
  24021. /* 36 */
  24022. /***/ ((__unused_webpack_module, exports) => {
  24023. Object.defineProperty(exports, "__esModule", ({
  24024. value: true
  24025. }));
  24026. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  24027. 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"];
  24028. exports.ISOAdobeCharset = ISOAdobeCharset;
  24029. 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"];
  24030. exports.ExpertCharset = ExpertCharset;
  24031. 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"];
  24032. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  24033. /***/ }),
  24034. /* 37 */
  24035. /***/ ((__unused_webpack_module, exports) => {
  24036. Object.defineProperty(exports, "__esModule", ({
  24037. value: true
  24038. }));
  24039. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  24040. exports.getEncoding = getEncoding;
  24041. 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"];
  24042. exports.ExpertEncoding = ExpertEncoding;
  24043. 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", "", "", "", ""];
  24044. 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"];
  24045. exports.MacRomanEncoding = MacRomanEncoding;
  24046. 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", "", "", "", ""];
  24047. exports.StandardEncoding = StandardEncoding;
  24048. 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"];
  24049. exports.WinAnsiEncoding = WinAnsiEncoding;
  24050. 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", ""];
  24051. exports.SymbolSetEncoding = SymbolSetEncoding;
  24052. 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", ""];
  24053. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  24054. function getEncoding(encodingName) {
  24055. switch (encodingName) {
  24056. case "WinAnsiEncoding":
  24057. return WinAnsiEncoding;
  24058. case "StandardEncoding":
  24059. return StandardEncoding;
  24060. case "MacRomanEncoding":
  24061. return MacRomanEncoding;
  24062. case "SymbolSetEncoding":
  24063. return SymbolSetEncoding;
  24064. case "ZapfDingbatsEncoding":
  24065. return ZapfDingbatsEncoding;
  24066. case "ExpertEncoding":
  24067. return ExpertEncoding;
  24068. case "MacExpertEncoding":
  24069. return MacExpertEncoding;
  24070. default:
  24071. return null;
  24072. }
  24073. }
  24074. /***/ }),
  24075. /* 38 */
  24076. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24077. Object.defineProperty(exports, "__esModule", ({
  24078. value: true
  24079. }));
  24080. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  24081. exports.getFontType = getFontType;
  24082. exports.normalizeFontName = normalizeFontName;
  24083. exports.recoverGlyphName = recoverGlyphName;
  24084. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  24085. var _util = __w_pdfjs_require__(2);
  24086. var _encodings = __w_pdfjs_require__(37);
  24087. var _glyphlist = __w_pdfjs_require__(39);
  24088. var _unicode = __w_pdfjs_require__(40);
  24089. const SEAC_ANALYSIS_ENABLED = true;
  24090. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  24091. const FontFlags = {
  24092. FixedPitch: 1,
  24093. Serif: 2,
  24094. Symbolic: 4,
  24095. Script: 8,
  24096. Nonsymbolic: 32,
  24097. Italic: 64,
  24098. AllCap: 65536,
  24099. SmallCap: 131072,
  24100. ForceBold: 262144
  24101. };
  24102. exports.FontFlags = FontFlags;
  24103. 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"];
  24104. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  24105. function getFontType(type, subtype, isStandardFont = false) {
  24106. switch (type) {
  24107. case "Type1":
  24108. if (isStandardFont) {
  24109. return _util.FontType.TYPE1STANDARD;
  24110. }
  24111. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  24112. case "CIDFontType0":
  24113. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  24114. case "OpenType":
  24115. return _util.FontType.OPENTYPE;
  24116. case "TrueType":
  24117. return _util.FontType.TRUETYPE;
  24118. case "CIDFontType2":
  24119. return _util.FontType.CIDFONTTYPE2;
  24120. case "MMType1":
  24121. return _util.FontType.MMTYPE1;
  24122. case "Type0":
  24123. return _util.FontType.TYPE0;
  24124. default:
  24125. return _util.FontType.UNKNOWN;
  24126. }
  24127. }
  24128. function recoverGlyphName(name, glyphsUnicodeMap) {
  24129. if (glyphsUnicodeMap[name] !== undefined) {
  24130. return name;
  24131. }
  24132. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  24133. if (unicode !== -1) {
  24134. for (const key in glyphsUnicodeMap) {
  24135. if (glyphsUnicodeMap[key] === unicode) {
  24136. return key;
  24137. }
  24138. }
  24139. }
  24140. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  24141. return name;
  24142. }
  24143. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  24144. const charCodeToGlyphId = Object.create(null);
  24145. let glyphId, charCode, baseEncoding;
  24146. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  24147. if (properties.isInternalFont) {
  24148. baseEncoding = builtInEncoding;
  24149. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24150. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24151. if (glyphId >= 0) {
  24152. charCodeToGlyphId[charCode] = glyphId;
  24153. } else {
  24154. charCodeToGlyphId[charCode] = 0;
  24155. }
  24156. }
  24157. } else if (properties.baseEncodingName) {
  24158. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  24159. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24160. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24161. if (glyphId >= 0) {
  24162. charCodeToGlyphId[charCode] = glyphId;
  24163. } else {
  24164. charCodeToGlyphId[charCode] = 0;
  24165. }
  24166. }
  24167. } else if (isSymbolicFont) {
  24168. for (charCode in builtInEncoding) {
  24169. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  24170. }
  24171. } else {
  24172. baseEncoding = _encodings.StandardEncoding;
  24173. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24174. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24175. if (glyphId >= 0) {
  24176. charCodeToGlyphId[charCode] = glyphId;
  24177. } else {
  24178. charCodeToGlyphId[charCode] = 0;
  24179. }
  24180. }
  24181. }
  24182. const differences = properties.differences;
  24183. let glyphsUnicodeMap;
  24184. if (differences) {
  24185. for (charCode in differences) {
  24186. const glyphName = differences[charCode];
  24187. glyphId = glyphNames.indexOf(glyphName);
  24188. if (glyphId === -1) {
  24189. if (!glyphsUnicodeMap) {
  24190. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24191. }
  24192. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24193. if (standardGlyphName !== glyphName) {
  24194. glyphId = glyphNames.indexOf(standardGlyphName);
  24195. }
  24196. }
  24197. if (glyphId >= 0) {
  24198. charCodeToGlyphId[charCode] = glyphId;
  24199. } else {
  24200. charCodeToGlyphId[charCode] = 0;
  24201. }
  24202. }
  24203. }
  24204. return charCodeToGlyphId;
  24205. }
  24206. function normalizeFontName(name) {
  24207. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  24208. }
  24209. /***/ }),
  24210. /* 39 */
  24211. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  24212. __w_pdfjs_require__.r(__webpack_exports__);
  24213. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  24214. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  24215. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  24216. /* harmony export */ });
  24217. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(6);
  24218. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  24219. return [
  24220. "A",
  24221. 0x0041,
  24222. "AE",
  24223. 0x00c6,
  24224. "AEacute",
  24225. 0x01fc,
  24226. "AEmacron",
  24227. 0x01e2,
  24228. "AEsmall",
  24229. 0xf7e6,
  24230. "Aacute",
  24231. 0x00c1,
  24232. "Aacutesmall",
  24233. 0xf7e1,
  24234. "Abreve",
  24235. 0x0102,
  24236. "Abreveacute",
  24237. 0x1eae,
  24238. "Abrevecyrillic",
  24239. 0x04d0,
  24240. "Abrevedotbelow",
  24241. 0x1eb6,
  24242. "Abrevegrave",
  24243. 0x1eb0,
  24244. "Abrevehookabove",
  24245. 0x1eb2,
  24246. "Abrevetilde",
  24247. 0x1eb4,
  24248. "Acaron",
  24249. 0x01cd,
  24250. "Acircle",
  24251. 0x24b6,
  24252. "Acircumflex",
  24253. 0x00c2,
  24254. "Acircumflexacute",
  24255. 0x1ea4,
  24256. "Acircumflexdotbelow",
  24257. 0x1eac,
  24258. "Acircumflexgrave",
  24259. 0x1ea6,
  24260. "Acircumflexhookabove",
  24261. 0x1ea8,
  24262. "Acircumflexsmall",
  24263. 0xf7e2,
  24264. "Acircumflextilde",
  24265. 0x1eaa,
  24266. "Acute",
  24267. 0xf6c9,
  24268. "Acutesmall",
  24269. 0xf7b4,
  24270. "Acyrillic",
  24271. 0x0410,
  24272. "Adblgrave",
  24273. 0x0200,
  24274. "Adieresis",
  24275. 0x00c4,
  24276. "Adieresiscyrillic",
  24277. 0x04d2,
  24278. "Adieresismacron",
  24279. 0x01de,
  24280. "Adieresissmall",
  24281. 0xf7e4,
  24282. "Adotbelow",
  24283. 0x1ea0,
  24284. "Adotmacron",
  24285. 0x01e0,
  24286. "Agrave",
  24287. 0x00c0,
  24288. "Agravesmall",
  24289. 0xf7e0,
  24290. "Ahookabove",
  24291. 0x1ea2,
  24292. "Aiecyrillic",
  24293. 0x04d4,
  24294. "Ainvertedbreve",
  24295. 0x0202,
  24296. "Alpha",
  24297. 0x0391,
  24298. "Alphatonos",
  24299. 0x0386,
  24300. "Amacron",
  24301. 0x0100,
  24302. "Amonospace",
  24303. 0xff21,
  24304. "Aogonek",
  24305. 0x0104,
  24306. "Aring",
  24307. 0x00c5,
  24308. "Aringacute",
  24309. 0x01fa,
  24310. "Aringbelow",
  24311. 0x1e00,
  24312. "Aringsmall",
  24313. 0xf7e5,
  24314. "Asmall",
  24315. 0xf761,
  24316. "Atilde",
  24317. 0x00c3,
  24318. "Atildesmall",
  24319. 0xf7e3,
  24320. "Aybarmenian",
  24321. 0x0531,
  24322. "B",
  24323. 0x0042,
  24324. "Bcircle",
  24325. 0x24b7,
  24326. "Bdotaccent",
  24327. 0x1e02,
  24328. "Bdotbelow",
  24329. 0x1e04,
  24330. "Becyrillic",
  24331. 0x0411,
  24332. "Benarmenian",
  24333. 0x0532,
  24334. "Beta",
  24335. 0x0392,
  24336. "Bhook",
  24337. 0x0181,
  24338. "Blinebelow",
  24339. 0x1e06,
  24340. "Bmonospace",
  24341. 0xff22,
  24342. "Brevesmall",
  24343. 0xf6f4,
  24344. "Bsmall",
  24345. 0xf762,
  24346. "Btopbar",
  24347. 0x0182,
  24348. "C",
  24349. 0x0043,
  24350. "Caarmenian",
  24351. 0x053e,
  24352. "Cacute",
  24353. 0x0106,
  24354. "Caron",
  24355. 0xf6ca,
  24356. "Caronsmall",
  24357. 0xf6f5,
  24358. "Ccaron",
  24359. 0x010c,
  24360. "Ccedilla",
  24361. 0x00c7,
  24362. "Ccedillaacute",
  24363. 0x1e08,
  24364. "Ccedillasmall",
  24365. 0xf7e7,
  24366. "Ccircle",
  24367. 0x24b8,
  24368. "Ccircumflex",
  24369. 0x0108,
  24370. "Cdot",
  24371. 0x010a,
  24372. "Cdotaccent",
  24373. 0x010a,
  24374. "Cedillasmall",
  24375. 0xf7b8,
  24376. "Chaarmenian",
  24377. 0x0549,
  24378. "Cheabkhasiancyrillic",
  24379. 0x04bc,
  24380. "Checyrillic",
  24381. 0x0427,
  24382. "Chedescenderabkhasiancyrillic",
  24383. 0x04be,
  24384. "Chedescendercyrillic",
  24385. 0x04b6,
  24386. "Chedieresiscyrillic",
  24387. 0x04f4,
  24388. "Cheharmenian",
  24389. 0x0543,
  24390. "Chekhakassiancyrillic",
  24391. 0x04cb,
  24392. "Cheverticalstrokecyrillic",
  24393. 0x04b8,
  24394. "Chi",
  24395. 0x03a7,
  24396. "Chook",
  24397. 0x0187,
  24398. "Circumflexsmall",
  24399. 0xf6f6,
  24400. "Cmonospace",
  24401. 0xff23,
  24402. "Coarmenian",
  24403. 0x0551,
  24404. "Csmall",
  24405. 0xf763,
  24406. "D",
  24407. 0x0044,
  24408. "DZ",
  24409. 0x01f1,
  24410. "DZcaron",
  24411. 0x01c4,
  24412. "Daarmenian",
  24413. 0x0534,
  24414. "Dafrican",
  24415. 0x0189,
  24416. "Dcaron",
  24417. 0x010e,
  24418. "Dcedilla",
  24419. 0x1e10,
  24420. "Dcircle",
  24421. 0x24b9,
  24422. "Dcircumflexbelow",
  24423. 0x1e12,
  24424. "Dcroat",
  24425. 0x0110,
  24426. "Ddotaccent",
  24427. 0x1e0a,
  24428. "Ddotbelow",
  24429. 0x1e0c,
  24430. "Decyrillic",
  24431. 0x0414,
  24432. "Deicoptic",
  24433. 0x03ee,
  24434. "Delta",
  24435. 0x2206,
  24436. "Deltagreek",
  24437. 0x0394,
  24438. "Dhook",
  24439. 0x018a,
  24440. "Dieresis",
  24441. 0xf6cb,
  24442. "DieresisAcute",
  24443. 0xf6cc,
  24444. "DieresisGrave",
  24445. 0xf6cd,
  24446. "Dieresissmall",
  24447. 0xf7a8,
  24448. "Digammagreek",
  24449. 0x03dc,
  24450. "Djecyrillic",
  24451. 0x0402,
  24452. "Dlinebelow",
  24453. 0x1e0e,
  24454. "Dmonospace",
  24455. 0xff24,
  24456. "Dotaccentsmall",
  24457. 0xf6f7,
  24458. "Dslash",
  24459. 0x0110,
  24460. "Dsmall",
  24461. 0xf764,
  24462. "Dtopbar",
  24463. 0x018b,
  24464. "Dz",
  24465. 0x01f2,
  24466. "Dzcaron",
  24467. 0x01c5,
  24468. "Dzeabkhasiancyrillic",
  24469. 0x04e0,
  24470. "Dzecyrillic",
  24471. 0x0405,
  24472. "Dzhecyrillic",
  24473. 0x040f,
  24474. "E",
  24475. 0x0045,
  24476. "Eacute",
  24477. 0x00c9,
  24478. "Eacutesmall",
  24479. 0xf7e9,
  24480. "Ebreve",
  24481. 0x0114,
  24482. "Ecaron",
  24483. 0x011a,
  24484. "Ecedillabreve",
  24485. 0x1e1c,
  24486. "Echarmenian",
  24487. 0x0535,
  24488. "Ecircle",
  24489. 0x24ba,
  24490. "Ecircumflex",
  24491. 0x00ca,
  24492. "Ecircumflexacute",
  24493. 0x1ebe,
  24494. "Ecircumflexbelow",
  24495. 0x1e18,
  24496. "Ecircumflexdotbelow",
  24497. 0x1ec6,
  24498. "Ecircumflexgrave",
  24499. 0x1ec0,
  24500. "Ecircumflexhookabove",
  24501. 0x1ec2,
  24502. "Ecircumflexsmall",
  24503. 0xf7ea,
  24504. "Ecircumflextilde",
  24505. 0x1ec4,
  24506. "Ecyrillic",
  24507. 0x0404,
  24508. "Edblgrave",
  24509. 0x0204,
  24510. "Edieresis",
  24511. 0x00cb,
  24512. "Edieresissmall",
  24513. 0xf7eb,
  24514. "Edot",
  24515. 0x0116,
  24516. "Edotaccent",
  24517. 0x0116,
  24518. "Edotbelow",
  24519. 0x1eb8,
  24520. "Efcyrillic",
  24521. 0x0424,
  24522. "Egrave",
  24523. 0x00c8,
  24524. "Egravesmall",
  24525. 0xf7e8,
  24526. "Eharmenian",
  24527. 0x0537,
  24528. "Ehookabove",
  24529. 0x1eba,
  24530. "Eightroman",
  24531. 0x2167,
  24532. "Einvertedbreve",
  24533. 0x0206,
  24534. "Eiotifiedcyrillic",
  24535. 0x0464,
  24536. "Elcyrillic",
  24537. 0x041b,
  24538. "Elevenroman",
  24539. 0x216a,
  24540. "Emacron",
  24541. 0x0112,
  24542. "Emacronacute",
  24543. 0x1e16,
  24544. "Emacrongrave",
  24545. 0x1e14,
  24546. "Emcyrillic",
  24547. 0x041c,
  24548. "Emonospace",
  24549. 0xff25,
  24550. "Encyrillic",
  24551. 0x041d,
  24552. "Endescendercyrillic",
  24553. 0x04a2,
  24554. "Eng",
  24555. 0x014a,
  24556. "Enghecyrillic",
  24557. 0x04a4,
  24558. "Enhookcyrillic",
  24559. 0x04c7,
  24560. "Eogonek",
  24561. 0x0118,
  24562. "Eopen",
  24563. 0x0190,
  24564. "Epsilon",
  24565. 0x0395,
  24566. "Epsilontonos",
  24567. 0x0388,
  24568. "Ercyrillic",
  24569. 0x0420,
  24570. "Ereversed",
  24571. 0x018e,
  24572. "Ereversedcyrillic",
  24573. 0x042d,
  24574. "Escyrillic",
  24575. 0x0421,
  24576. "Esdescendercyrillic",
  24577. 0x04aa,
  24578. "Esh",
  24579. 0x01a9,
  24580. "Esmall",
  24581. 0xf765,
  24582. "Eta",
  24583. 0x0397,
  24584. "Etarmenian",
  24585. 0x0538,
  24586. "Etatonos",
  24587. 0x0389,
  24588. "Eth",
  24589. 0x00d0,
  24590. "Ethsmall",
  24591. 0xf7f0,
  24592. "Etilde",
  24593. 0x1ebc,
  24594. "Etildebelow",
  24595. 0x1e1a,
  24596. "Euro",
  24597. 0x20ac,
  24598. "Ezh",
  24599. 0x01b7,
  24600. "Ezhcaron",
  24601. 0x01ee,
  24602. "Ezhreversed",
  24603. 0x01b8,
  24604. "F",
  24605. 0x0046,
  24606. "Fcircle",
  24607. 0x24bb,
  24608. "Fdotaccent",
  24609. 0x1e1e,
  24610. "Feharmenian",
  24611. 0x0556,
  24612. "Feicoptic",
  24613. 0x03e4,
  24614. "Fhook",
  24615. 0x0191,
  24616. "Fitacyrillic",
  24617. 0x0472,
  24618. "Fiveroman",
  24619. 0x2164,
  24620. "Fmonospace",
  24621. 0xff26,
  24622. "Fourroman",
  24623. 0x2163,
  24624. "Fsmall",
  24625. 0xf766,
  24626. "G",
  24627. 0x0047,
  24628. "GBsquare",
  24629. 0x3387,
  24630. "Gacute",
  24631. 0x01f4,
  24632. "Gamma",
  24633. 0x0393,
  24634. "Gammaafrican",
  24635. 0x0194,
  24636. "Gangiacoptic",
  24637. 0x03ea,
  24638. "Gbreve",
  24639. 0x011e,
  24640. "Gcaron",
  24641. 0x01e6,
  24642. "Gcedilla",
  24643. 0x0122,
  24644. "Gcircle",
  24645. 0x24bc,
  24646. "Gcircumflex",
  24647. 0x011c,
  24648. "Gcommaaccent",
  24649. 0x0122,
  24650. "Gdot",
  24651. 0x0120,
  24652. "Gdotaccent",
  24653. 0x0120,
  24654. "Gecyrillic",
  24655. 0x0413,
  24656. "Ghadarmenian",
  24657. 0x0542,
  24658. "Ghemiddlehookcyrillic",
  24659. 0x0494,
  24660. "Ghestrokecyrillic",
  24661. 0x0492,
  24662. "Gheupturncyrillic",
  24663. 0x0490,
  24664. "Ghook",
  24665. 0x0193,
  24666. "Gimarmenian",
  24667. 0x0533,
  24668. "Gjecyrillic",
  24669. 0x0403,
  24670. "Gmacron",
  24671. 0x1e20,
  24672. "Gmonospace",
  24673. 0xff27,
  24674. "Grave",
  24675. 0xf6ce,
  24676. "Gravesmall",
  24677. 0xf760,
  24678. "Gsmall",
  24679. 0xf767,
  24680. "Gsmallhook",
  24681. 0x029b,
  24682. "Gstroke",
  24683. 0x01e4,
  24684. "H",
  24685. 0x0048,
  24686. "H18533",
  24687. 0x25cf,
  24688. "H18543",
  24689. 0x25aa,
  24690. "H18551",
  24691. 0x25ab,
  24692. "H22073",
  24693. 0x25a1,
  24694. "HPsquare",
  24695. 0x33cb,
  24696. "Haabkhasiancyrillic",
  24697. 0x04a8,
  24698. "Hadescendercyrillic",
  24699. 0x04b2,
  24700. "Hardsigncyrillic",
  24701. 0x042a,
  24702. "Hbar",
  24703. 0x0126,
  24704. "Hbrevebelow",
  24705. 0x1e2a,
  24706. "Hcedilla",
  24707. 0x1e28,
  24708. "Hcircle",
  24709. 0x24bd,
  24710. "Hcircumflex",
  24711. 0x0124,
  24712. "Hdieresis",
  24713. 0x1e26,
  24714. "Hdotaccent",
  24715. 0x1e22,
  24716. "Hdotbelow",
  24717. 0x1e24,
  24718. "Hmonospace",
  24719. 0xff28,
  24720. "Hoarmenian",
  24721. 0x0540,
  24722. "Horicoptic",
  24723. 0x03e8,
  24724. "Hsmall",
  24725. 0xf768,
  24726. "Hungarumlaut",
  24727. 0xf6cf,
  24728. "Hungarumlautsmall",
  24729. 0xf6f8,
  24730. "Hzsquare",
  24731. 0x3390,
  24732. "I",
  24733. 0x0049,
  24734. "IAcyrillic",
  24735. 0x042f,
  24736. "IJ",
  24737. 0x0132,
  24738. "IUcyrillic",
  24739. 0x042e,
  24740. "Iacute",
  24741. 0x00cd,
  24742. "Iacutesmall",
  24743. 0xf7ed,
  24744. "Ibreve",
  24745. 0x012c,
  24746. "Icaron",
  24747. 0x01cf,
  24748. "Icircle",
  24749. 0x24be,
  24750. "Icircumflex",
  24751. 0x00ce,
  24752. "Icircumflexsmall",
  24753. 0xf7ee,
  24754. "Icyrillic",
  24755. 0x0406,
  24756. "Idblgrave",
  24757. 0x0208,
  24758. "Idieresis",
  24759. 0x00cf,
  24760. "Idieresisacute",
  24761. 0x1e2e,
  24762. "Idieresiscyrillic",
  24763. 0x04e4,
  24764. "Idieresissmall",
  24765. 0xf7ef,
  24766. "Idot",
  24767. 0x0130,
  24768. "Idotaccent",
  24769. 0x0130,
  24770. "Idotbelow",
  24771. 0x1eca,
  24772. "Iebrevecyrillic",
  24773. 0x04d6,
  24774. "Iecyrillic",
  24775. 0x0415,
  24776. "Ifraktur",
  24777. 0x2111,
  24778. "Igrave",
  24779. 0x00cc,
  24780. "Igravesmall",
  24781. 0xf7ec,
  24782. "Ihookabove",
  24783. 0x1ec8,
  24784. "Iicyrillic",
  24785. 0x0418,
  24786. "Iinvertedbreve",
  24787. 0x020a,
  24788. "Iishortcyrillic",
  24789. 0x0419,
  24790. "Imacron",
  24791. 0x012a,
  24792. "Imacroncyrillic",
  24793. 0x04e2,
  24794. "Imonospace",
  24795. 0xff29,
  24796. "Iniarmenian",
  24797. 0x053b,
  24798. "Iocyrillic",
  24799. 0x0401,
  24800. "Iogonek",
  24801. 0x012e,
  24802. "Iota",
  24803. 0x0399,
  24804. "Iotaafrican",
  24805. 0x0196,
  24806. "Iotadieresis",
  24807. 0x03aa,
  24808. "Iotatonos",
  24809. 0x038a,
  24810. "Ismall",
  24811. 0xf769,
  24812. "Istroke",
  24813. 0x0197,
  24814. "Itilde",
  24815. 0x0128,
  24816. "Itildebelow",
  24817. 0x1e2c,
  24818. "Izhitsacyrillic",
  24819. 0x0474,
  24820. "Izhitsadblgravecyrillic",
  24821. 0x0476,
  24822. "J",
  24823. 0x004a,
  24824. "Jaarmenian",
  24825. 0x0541,
  24826. "Jcircle",
  24827. 0x24bf,
  24828. "Jcircumflex",
  24829. 0x0134,
  24830. "Jecyrillic",
  24831. 0x0408,
  24832. "Jheharmenian",
  24833. 0x054b,
  24834. "Jmonospace",
  24835. 0xff2a,
  24836. "Jsmall",
  24837. 0xf76a,
  24838. "K",
  24839. 0x004b,
  24840. "KBsquare",
  24841. 0x3385,
  24842. "KKsquare",
  24843. 0x33cd,
  24844. "Kabashkircyrillic",
  24845. 0x04a0,
  24846. "Kacute",
  24847. 0x1e30,
  24848. "Kacyrillic",
  24849. 0x041a,
  24850. "Kadescendercyrillic",
  24851. 0x049a,
  24852. "Kahookcyrillic",
  24853. 0x04c3,
  24854. "Kappa",
  24855. 0x039a,
  24856. "Kastrokecyrillic",
  24857. 0x049e,
  24858. "Kaverticalstrokecyrillic",
  24859. 0x049c,
  24860. "Kcaron",
  24861. 0x01e8,
  24862. "Kcedilla",
  24863. 0x0136,
  24864. "Kcircle",
  24865. 0x24c0,
  24866. "Kcommaaccent",
  24867. 0x0136,
  24868. "Kdotbelow",
  24869. 0x1e32,
  24870. "Keharmenian",
  24871. 0x0554,
  24872. "Kenarmenian",
  24873. 0x053f,
  24874. "Khacyrillic",
  24875. 0x0425,
  24876. "Kheicoptic",
  24877. 0x03e6,
  24878. "Khook",
  24879. 0x0198,
  24880. "Kjecyrillic",
  24881. 0x040c,
  24882. "Klinebelow",
  24883. 0x1e34,
  24884. "Kmonospace",
  24885. 0xff2b,
  24886. "Koppacyrillic",
  24887. 0x0480,
  24888. "Koppagreek",
  24889. 0x03de,
  24890. "Ksicyrillic",
  24891. 0x046e,
  24892. "Ksmall",
  24893. 0xf76b,
  24894. "L",
  24895. 0x004c,
  24896. "LJ",
  24897. 0x01c7,
  24898. "LL",
  24899. 0xf6bf,
  24900. "Lacute",
  24901. 0x0139,
  24902. "Lambda",
  24903. 0x039b,
  24904. "Lcaron",
  24905. 0x013d,
  24906. "Lcedilla",
  24907. 0x013b,
  24908. "Lcircle",
  24909. 0x24c1,
  24910. "Lcircumflexbelow",
  24911. 0x1e3c,
  24912. "Lcommaaccent",
  24913. 0x013b,
  24914. "Ldot",
  24915. 0x013f,
  24916. "Ldotaccent",
  24917. 0x013f,
  24918. "Ldotbelow",
  24919. 0x1e36,
  24920. "Ldotbelowmacron",
  24921. 0x1e38,
  24922. "Liwnarmenian",
  24923. 0x053c,
  24924. "Lj",
  24925. 0x01c8,
  24926. "Ljecyrillic",
  24927. 0x0409,
  24928. "Llinebelow",
  24929. 0x1e3a,
  24930. "Lmonospace",
  24931. 0xff2c,
  24932. "Lslash",
  24933. 0x0141,
  24934. "Lslashsmall",
  24935. 0xf6f9,
  24936. "Lsmall",
  24937. 0xf76c,
  24938. "M",
  24939. 0x004d,
  24940. "MBsquare",
  24941. 0x3386,
  24942. "Macron",
  24943. 0xf6d0,
  24944. "Macronsmall",
  24945. 0xf7af,
  24946. "Macute",
  24947. 0x1e3e,
  24948. "Mcircle",
  24949. 0x24c2,
  24950. "Mdotaccent",
  24951. 0x1e40,
  24952. "Mdotbelow",
  24953. 0x1e42,
  24954. "Menarmenian",
  24955. 0x0544,
  24956. "Mmonospace",
  24957. 0xff2d,
  24958. "Msmall",
  24959. 0xf76d,
  24960. "Mturned",
  24961. 0x019c,
  24962. "Mu",
  24963. 0x039c,
  24964. "N",
  24965. 0x004e,
  24966. "NJ",
  24967. 0x01ca,
  24968. "Nacute",
  24969. 0x0143,
  24970. "Ncaron",
  24971. 0x0147,
  24972. "Ncedilla",
  24973. 0x0145,
  24974. "Ncircle",
  24975. 0x24c3,
  24976. "Ncircumflexbelow",
  24977. 0x1e4a,
  24978. "Ncommaaccent",
  24979. 0x0145,
  24980. "Ndotaccent",
  24981. 0x1e44,
  24982. "Ndotbelow",
  24983. 0x1e46,
  24984. "Nhookleft",
  24985. 0x019d,
  24986. "Nineroman",
  24987. 0x2168,
  24988. "Nj",
  24989. 0x01cb,
  24990. "Njecyrillic",
  24991. 0x040a,
  24992. "Nlinebelow",
  24993. 0x1e48,
  24994. "Nmonospace",
  24995. 0xff2e,
  24996. "Nowarmenian",
  24997. 0x0546,
  24998. "Nsmall",
  24999. 0xf76e,
  25000. "Ntilde",
  25001. 0x00d1,
  25002. "Ntildesmall",
  25003. 0xf7f1,
  25004. "Nu",
  25005. 0x039d,
  25006. "O",
  25007. 0x004f,
  25008. "OE",
  25009. 0x0152,
  25010. "OEsmall",
  25011. 0xf6fa,
  25012. "Oacute",
  25013. 0x00d3,
  25014. "Oacutesmall",
  25015. 0xf7f3,
  25016. "Obarredcyrillic",
  25017. 0x04e8,
  25018. "Obarreddieresiscyrillic",
  25019. 0x04ea,
  25020. "Obreve",
  25021. 0x014e,
  25022. "Ocaron",
  25023. 0x01d1,
  25024. "Ocenteredtilde",
  25025. 0x019f,
  25026. "Ocircle",
  25027. 0x24c4,
  25028. "Ocircumflex",
  25029. 0x00d4,
  25030. "Ocircumflexacute",
  25031. 0x1ed0,
  25032. "Ocircumflexdotbelow",
  25033. 0x1ed8,
  25034. "Ocircumflexgrave",
  25035. 0x1ed2,
  25036. "Ocircumflexhookabove",
  25037. 0x1ed4,
  25038. "Ocircumflexsmall",
  25039. 0xf7f4,
  25040. "Ocircumflextilde",
  25041. 0x1ed6,
  25042. "Ocyrillic",
  25043. 0x041e,
  25044. "Odblacute",
  25045. 0x0150,
  25046. "Odblgrave",
  25047. 0x020c,
  25048. "Odieresis",
  25049. 0x00d6,
  25050. "Odieresiscyrillic",
  25051. 0x04e6,
  25052. "Odieresissmall",
  25053. 0xf7f6,
  25054. "Odotbelow",
  25055. 0x1ecc,
  25056. "Ogoneksmall",
  25057. 0xf6fb,
  25058. "Ograve",
  25059. 0x00d2,
  25060. "Ogravesmall",
  25061. 0xf7f2,
  25062. "Oharmenian",
  25063. 0x0555,
  25064. "Ohm",
  25065. 0x2126,
  25066. "Ohookabove",
  25067. 0x1ece,
  25068. "Ohorn",
  25069. 0x01a0,
  25070. "Ohornacute",
  25071. 0x1eda,
  25072. "Ohorndotbelow",
  25073. 0x1ee2,
  25074. "Ohorngrave",
  25075. 0x1edc,
  25076. "Ohornhookabove",
  25077. 0x1ede,
  25078. "Ohorntilde",
  25079. 0x1ee0,
  25080. "Ohungarumlaut",
  25081. 0x0150,
  25082. "Oi",
  25083. 0x01a2,
  25084. "Oinvertedbreve",
  25085. 0x020e,
  25086. "Omacron",
  25087. 0x014c,
  25088. "Omacronacute",
  25089. 0x1e52,
  25090. "Omacrongrave",
  25091. 0x1e50,
  25092. "Omega",
  25093. 0x2126,
  25094. "Omegacyrillic",
  25095. 0x0460,
  25096. "Omegagreek",
  25097. 0x03a9,
  25098. "Omegaroundcyrillic",
  25099. 0x047a,
  25100. "Omegatitlocyrillic",
  25101. 0x047c,
  25102. "Omegatonos",
  25103. 0x038f,
  25104. "Omicron",
  25105. 0x039f,
  25106. "Omicrontonos",
  25107. 0x038c,
  25108. "Omonospace",
  25109. 0xff2f,
  25110. "Oneroman",
  25111. 0x2160,
  25112. "Oogonek",
  25113. 0x01ea,
  25114. "Oogonekmacron",
  25115. 0x01ec,
  25116. "Oopen",
  25117. 0x0186,
  25118. "Oslash",
  25119. 0x00d8,
  25120. "Oslashacute",
  25121. 0x01fe,
  25122. "Oslashsmall",
  25123. 0xf7f8,
  25124. "Osmall",
  25125. 0xf76f,
  25126. "Ostrokeacute",
  25127. 0x01fe,
  25128. "Otcyrillic",
  25129. 0x047e,
  25130. "Otilde",
  25131. 0x00d5,
  25132. "Otildeacute",
  25133. 0x1e4c,
  25134. "Otildedieresis",
  25135. 0x1e4e,
  25136. "Otildesmall",
  25137. 0xf7f5,
  25138. "P",
  25139. 0x0050,
  25140. "Pacute",
  25141. 0x1e54,
  25142. "Pcircle",
  25143. 0x24c5,
  25144. "Pdotaccent",
  25145. 0x1e56,
  25146. "Pecyrillic",
  25147. 0x041f,
  25148. "Peharmenian",
  25149. 0x054a,
  25150. "Pemiddlehookcyrillic",
  25151. 0x04a6,
  25152. "Phi",
  25153. 0x03a6,
  25154. "Phook",
  25155. 0x01a4,
  25156. "Pi",
  25157. 0x03a0,
  25158. "Piwrarmenian",
  25159. 0x0553,
  25160. "Pmonospace",
  25161. 0xff30,
  25162. "Psi",
  25163. 0x03a8,
  25164. "Psicyrillic",
  25165. 0x0470,
  25166. "Psmall",
  25167. 0xf770,
  25168. "Q",
  25169. 0x0051,
  25170. "Qcircle",
  25171. 0x24c6,
  25172. "Qmonospace",
  25173. 0xff31,
  25174. "Qsmall",
  25175. 0xf771,
  25176. "R",
  25177. 0x0052,
  25178. "Raarmenian",
  25179. 0x054c,
  25180. "Racute",
  25181. 0x0154,
  25182. "Rcaron",
  25183. 0x0158,
  25184. "Rcedilla",
  25185. 0x0156,
  25186. "Rcircle",
  25187. 0x24c7,
  25188. "Rcommaaccent",
  25189. 0x0156,
  25190. "Rdblgrave",
  25191. 0x0210,
  25192. "Rdotaccent",
  25193. 0x1e58,
  25194. "Rdotbelow",
  25195. 0x1e5a,
  25196. "Rdotbelowmacron",
  25197. 0x1e5c,
  25198. "Reharmenian",
  25199. 0x0550,
  25200. "Rfraktur",
  25201. 0x211c,
  25202. "Rho",
  25203. 0x03a1,
  25204. "Ringsmall",
  25205. 0xf6fc,
  25206. "Rinvertedbreve",
  25207. 0x0212,
  25208. "Rlinebelow",
  25209. 0x1e5e,
  25210. "Rmonospace",
  25211. 0xff32,
  25212. "Rsmall",
  25213. 0xf772,
  25214. "Rsmallinverted",
  25215. 0x0281,
  25216. "Rsmallinvertedsuperior",
  25217. 0x02b6,
  25218. "S",
  25219. 0x0053,
  25220. "SF010000",
  25221. 0x250c,
  25222. "SF020000",
  25223. 0x2514,
  25224. "SF030000",
  25225. 0x2510,
  25226. "SF040000",
  25227. 0x2518,
  25228. "SF050000",
  25229. 0x253c,
  25230. "SF060000",
  25231. 0x252c,
  25232. "SF070000",
  25233. 0x2534,
  25234. "SF080000",
  25235. 0x251c,
  25236. "SF090000",
  25237. 0x2524,
  25238. "SF100000",
  25239. 0x2500,
  25240. "SF110000",
  25241. 0x2502,
  25242. "SF190000",
  25243. 0x2561,
  25244. "SF200000",
  25245. 0x2562,
  25246. "SF210000",
  25247. 0x2556,
  25248. "SF220000",
  25249. 0x2555,
  25250. "SF230000",
  25251. 0x2563,
  25252. "SF240000",
  25253. 0x2551,
  25254. "SF250000",
  25255. 0x2557,
  25256. "SF260000",
  25257. 0x255d,
  25258. "SF270000",
  25259. 0x255c,
  25260. "SF280000",
  25261. 0x255b,
  25262. "SF360000",
  25263. 0x255e,
  25264. "SF370000",
  25265. 0x255f,
  25266. "SF380000",
  25267. 0x255a,
  25268. "SF390000",
  25269. 0x2554,
  25270. "SF400000",
  25271. 0x2569,
  25272. "SF410000",
  25273. 0x2566,
  25274. "SF420000",
  25275. 0x2560,
  25276. "SF430000",
  25277. 0x2550,
  25278. "SF440000",
  25279. 0x256c,
  25280. "SF450000",
  25281. 0x2567,
  25282. "SF460000",
  25283. 0x2568,
  25284. "SF470000",
  25285. 0x2564,
  25286. "SF480000",
  25287. 0x2565,
  25288. "SF490000",
  25289. 0x2559,
  25290. "SF500000",
  25291. 0x2558,
  25292. "SF510000",
  25293. 0x2552,
  25294. "SF520000",
  25295. 0x2553,
  25296. "SF530000",
  25297. 0x256b,
  25298. "SF540000",
  25299. 0x256a,
  25300. "Sacute",
  25301. 0x015a,
  25302. "Sacutedotaccent",
  25303. 0x1e64,
  25304. "Sampigreek",
  25305. 0x03e0,
  25306. "Scaron",
  25307. 0x0160,
  25308. "Scarondotaccent",
  25309. 0x1e66,
  25310. "Scaronsmall",
  25311. 0xf6fd,
  25312. "Scedilla",
  25313. 0x015e,
  25314. "Schwa",
  25315. 0x018f,
  25316. "Schwacyrillic",
  25317. 0x04d8,
  25318. "Schwadieresiscyrillic",
  25319. 0x04da,
  25320. "Scircle",
  25321. 0x24c8,
  25322. "Scircumflex",
  25323. 0x015c,
  25324. "Scommaaccent",
  25325. 0x0218,
  25326. "Sdotaccent",
  25327. 0x1e60,
  25328. "Sdotbelow",
  25329. 0x1e62,
  25330. "Sdotbelowdotaccent",
  25331. 0x1e68,
  25332. "Seharmenian",
  25333. 0x054d,
  25334. "Sevenroman",
  25335. 0x2166,
  25336. "Shaarmenian",
  25337. 0x0547,
  25338. "Shacyrillic",
  25339. 0x0428,
  25340. "Shchacyrillic",
  25341. 0x0429,
  25342. "Sheicoptic",
  25343. 0x03e2,
  25344. "Shhacyrillic",
  25345. 0x04ba,
  25346. "Shimacoptic",
  25347. 0x03ec,
  25348. "Sigma",
  25349. 0x03a3,
  25350. "Sixroman",
  25351. 0x2165,
  25352. "Smonospace",
  25353. 0xff33,
  25354. "Softsigncyrillic",
  25355. 0x042c,
  25356. "Ssmall",
  25357. 0xf773,
  25358. "Stigmagreek",
  25359. 0x03da,
  25360. "T",
  25361. 0x0054,
  25362. "Tau",
  25363. 0x03a4,
  25364. "Tbar",
  25365. 0x0166,
  25366. "Tcaron",
  25367. 0x0164,
  25368. "Tcedilla",
  25369. 0x0162,
  25370. "Tcircle",
  25371. 0x24c9,
  25372. "Tcircumflexbelow",
  25373. 0x1e70,
  25374. "Tcommaaccent",
  25375. 0x0162,
  25376. "Tdotaccent",
  25377. 0x1e6a,
  25378. "Tdotbelow",
  25379. 0x1e6c,
  25380. "Tecyrillic",
  25381. 0x0422,
  25382. "Tedescendercyrillic",
  25383. 0x04ac,
  25384. "Tenroman",
  25385. 0x2169,
  25386. "Tetsecyrillic",
  25387. 0x04b4,
  25388. "Theta",
  25389. 0x0398,
  25390. "Thook",
  25391. 0x01ac,
  25392. "Thorn",
  25393. 0x00de,
  25394. "Thornsmall",
  25395. 0xf7fe,
  25396. "Threeroman",
  25397. 0x2162,
  25398. "Tildesmall",
  25399. 0xf6fe,
  25400. "Tiwnarmenian",
  25401. 0x054f,
  25402. "Tlinebelow",
  25403. 0x1e6e,
  25404. "Tmonospace",
  25405. 0xff34,
  25406. "Toarmenian",
  25407. 0x0539,
  25408. "Tonefive",
  25409. 0x01bc,
  25410. "Tonesix",
  25411. 0x0184,
  25412. "Tonetwo",
  25413. 0x01a7,
  25414. "Tretroflexhook",
  25415. 0x01ae,
  25416. "Tsecyrillic",
  25417. 0x0426,
  25418. "Tshecyrillic",
  25419. 0x040b,
  25420. "Tsmall",
  25421. 0xf774,
  25422. "Twelveroman",
  25423. 0x216b,
  25424. "Tworoman",
  25425. 0x2161,
  25426. "U",
  25427. 0x0055,
  25428. "Uacute",
  25429. 0x00da,
  25430. "Uacutesmall",
  25431. 0xf7fa,
  25432. "Ubreve",
  25433. 0x016c,
  25434. "Ucaron",
  25435. 0x01d3,
  25436. "Ucircle",
  25437. 0x24ca,
  25438. "Ucircumflex",
  25439. 0x00db,
  25440. "Ucircumflexbelow",
  25441. 0x1e76,
  25442. "Ucircumflexsmall",
  25443. 0xf7fb,
  25444. "Ucyrillic",
  25445. 0x0423,
  25446. "Udblacute",
  25447. 0x0170,
  25448. "Udblgrave",
  25449. 0x0214,
  25450. "Udieresis",
  25451. 0x00dc,
  25452. "Udieresisacute",
  25453. 0x01d7,
  25454. "Udieresisbelow",
  25455. 0x1e72,
  25456. "Udieresiscaron",
  25457. 0x01d9,
  25458. "Udieresiscyrillic",
  25459. 0x04f0,
  25460. "Udieresisgrave",
  25461. 0x01db,
  25462. "Udieresismacron",
  25463. 0x01d5,
  25464. "Udieresissmall",
  25465. 0xf7fc,
  25466. "Udotbelow",
  25467. 0x1ee4,
  25468. "Ugrave",
  25469. 0x00d9,
  25470. "Ugravesmall",
  25471. 0xf7f9,
  25472. "Uhookabove",
  25473. 0x1ee6,
  25474. "Uhorn",
  25475. 0x01af,
  25476. "Uhornacute",
  25477. 0x1ee8,
  25478. "Uhorndotbelow",
  25479. 0x1ef0,
  25480. "Uhorngrave",
  25481. 0x1eea,
  25482. "Uhornhookabove",
  25483. 0x1eec,
  25484. "Uhorntilde",
  25485. 0x1eee,
  25486. "Uhungarumlaut",
  25487. 0x0170,
  25488. "Uhungarumlautcyrillic",
  25489. 0x04f2,
  25490. "Uinvertedbreve",
  25491. 0x0216,
  25492. "Ukcyrillic",
  25493. 0x0478,
  25494. "Umacron",
  25495. 0x016a,
  25496. "Umacroncyrillic",
  25497. 0x04ee,
  25498. "Umacrondieresis",
  25499. 0x1e7a,
  25500. "Umonospace",
  25501. 0xff35,
  25502. "Uogonek",
  25503. 0x0172,
  25504. "Upsilon",
  25505. 0x03a5,
  25506. "Upsilon1",
  25507. 0x03d2,
  25508. "Upsilonacutehooksymbolgreek",
  25509. 0x03d3,
  25510. "Upsilonafrican",
  25511. 0x01b1,
  25512. "Upsilondieresis",
  25513. 0x03ab,
  25514. "Upsilondieresishooksymbolgreek",
  25515. 0x03d4,
  25516. "Upsilonhooksymbol",
  25517. 0x03d2,
  25518. "Upsilontonos",
  25519. 0x038e,
  25520. "Uring",
  25521. 0x016e,
  25522. "Ushortcyrillic",
  25523. 0x040e,
  25524. "Usmall",
  25525. 0xf775,
  25526. "Ustraightcyrillic",
  25527. 0x04ae,
  25528. "Ustraightstrokecyrillic",
  25529. 0x04b0,
  25530. "Utilde",
  25531. 0x0168,
  25532. "Utildeacute",
  25533. 0x1e78,
  25534. "Utildebelow",
  25535. 0x1e74,
  25536. "V",
  25537. 0x0056,
  25538. "Vcircle",
  25539. 0x24cb,
  25540. "Vdotbelow",
  25541. 0x1e7e,
  25542. "Vecyrillic",
  25543. 0x0412,
  25544. "Vewarmenian",
  25545. 0x054e,
  25546. "Vhook",
  25547. 0x01b2,
  25548. "Vmonospace",
  25549. 0xff36,
  25550. "Voarmenian",
  25551. 0x0548,
  25552. "Vsmall",
  25553. 0xf776,
  25554. "Vtilde",
  25555. 0x1e7c,
  25556. "W",
  25557. 0x0057,
  25558. "Wacute",
  25559. 0x1e82,
  25560. "Wcircle",
  25561. 0x24cc,
  25562. "Wcircumflex",
  25563. 0x0174,
  25564. "Wdieresis",
  25565. 0x1e84,
  25566. "Wdotaccent",
  25567. 0x1e86,
  25568. "Wdotbelow",
  25569. 0x1e88,
  25570. "Wgrave",
  25571. 0x1e80,
  25572. "Wmonospace",
  25573. 0xff37,
  25574. "Wsmall",
  25575. 0xf777,
  25576. "X",
  25577. 0x0058,
  25578. "Xcircle",
  25579. 0x24cd,
  25580. "Xdieresis",
  25581. 0x1e8c,
  25582. "Xdotaccent",
  25583. 0x1e8a,
  25584. "Xeharmenian",
  25585. 0x053d,
  25586. "Xi",
  25587. 0x039e,
  25588. "Xmonospace",
  25589. 0xff38,
  25590. "Xsmall",
  25591. 0xf778,
  25592. "Y",
  25593. 0x0059,
  25594. "Yacute",
  25595. 0x00dd,
  25596. "Yacutesmall",
  25597. 0xf7fd,
  25598. "Yatcyrillic",
  25599. 0x0462,
  25600. "Ycircle",
  25601. 0x24ce,
  25602. "Ycircumflex",
  25603. 0x0176,
  25604. "Ydieresis",
  25605. 0x0178,
  25606. "Ydieresissmall",
  25607. 0xf7ff,
  25608. "Ydotaccent",
  25609. 0x1e8e,
  25610. "Ydotbelow",
  25611. 0x1ef4,
  25612. "Yericyrillic",
  25613. 0x042b,
  25614. "Yerudieresiscyrillic",
  25615. 0x04f8,
  25616. "Ygrave",
  25617. 0x1ef2,
  25618. "Yhook",
  25619. 0x01b3,
  25620. "Yhookabove",
  25621. 0x1ef6,
  25622. "Yiarmenian",
  25623. 0x0545,
  25624. "Yicyrillic",
  25625. 0x0407,
  25626. "Yiwnarmenian",
  25627. 0x0552,
  25628. "Ymonospace",
  25629. 0xff39,
  25630. "Ysmall",
  25631. 0xf779,
  25632. "Ytilde",
  25633. 0x1ef8,
  25634. "Yusbigcyrillic",
  25635. 0x046a,
  25636. "Yusbigiotifiedcyrillic",
  25637. 0x046c,
  25638. "Yuslittlecyrillic",
  25639. 0x0466,
  25640. "Yuslittleiotifiedcyrillic",
  25641. 0x0468,
  25642. "Z",
  25643. 0x005a,
  25644. "Zaarmenian",
  25645. 0x0536,
  25646. "Zacute",
  25647. 0x0179,
  25648. "Zcaron",
  25649. 0x017d,
  25650. "Zcaronsmall",
  25651. 0xf6ff,
  25652. "Zcircle",
  25653. 0x24cf,
  25654. "Zcircumflex",
  25655. 0x1e90,
  25656. "Zdot",
  25657. 0x017b,
  25658. "Zdotaccent",
  25659. 0x017b,
  25660. "Zdotbelow",
  25661. 0x1e92,
  25662. "Zecyrillic",
  25663. 0x0417,
  25664. "Zedescendercyrillic",
  25665. 0x0498,
  25666. "Zedieresiscyrillic",
  25667. 0x04de,
  25668. "Zeta",
  25669. 0x0396,
  25670. "Zhearmenian",
  25671. 0x053a,
  25672. "Zhebrevecyrillic",
  25673. 0x04c1,
  25674. "Zhecyrillic",
  25675. 0x0416,
  25676. "Zhedescendercyrillic",
  25677. 0x0496,
  25678. "Zhedieresiscyrillic",
  25679. 0x04dc,
  25680. "Zlinebelow",
  25681. 0x1e94,
  25682. "Zmonospace",
  25683. 0xff3a,
  25684. "Zsmall",
  25685. 0xf77a,
  25686. "Zstroke",
  25687. 0x01b5,
  25688. "a",
  25689. 0x0061,
  25690. "aabengali",
  25691. 0x0986,
  25692. "aacute",
  25693. 0x00e1,
  25694. "aadeva",
  25695. 0x0906,
  25696. "aagujarati",
  25697. 0x0a86,
  25698. "aagurmukhi",
  25699. 0x0a06,
  25700. "aamatragurmukhi",
  25701. 0x0a3e,
  25702. "aarusquare",
  25703. 0x3303,
  25704. "aavowelsignbengali",
  25705. 0x09be,
  25706. "aavowelsigndeva",
  25707. 0x093e,
  25708. "aavowelsigngujarati",
  25709. 0x0abe,
  25710. "abbreviationmarkarmenian",
  25711. 0x055f,
  25712. "abbreviationsigndeva",
  25713. 0x0970,
  25714. "abengali",
  25715. 0x0985,
  25716. "abopomofo",
  25717. 0x311a,
  25718. "abreve",
  25719. 0x0103,
  25720. "abreveacute",
  25721. 0x1eaf,
  25722. "abrevecyrillic",
  25723. 0x04d1,
  25724. "abrevedotbelow",
  25725. 0x1eb7,
  25726. "abrevegrave",
  25727. 0x1eb1,
  25728. "abrevehookabove",
  25729. 0x1eb3,
  25730. "abrevetilde",
  25731. 0x1eb5,
  25732. "acaron",
  25733. 0x01ce,
  25734. "acircle",
  25735. 0x24d0,
  25736. "acircumflex",
  25737. 0x00e2,
  25738. "acircumflexacute",
  25739. 0x1ea5,
  25740. "acircumflexdotbelow",
  25741. 0x1ead,
  25742. "acircumflexgrave",
  25743. 0x1ea7,
  25744. "acircumflexhookabove",
  25745. 0x1ea9,
  25746. "acircumflextilde",
  25747. 0x1eab,
  25748. "acute",
  25749. 0x00b4,
  25750. "acutebelowcmb",
  25751. 0x0317,
  25752. "acutecmb",
  25753. 0x0301,
  25754. "acutecomb",
  25755. 0x0301,
  25756. "acutedeva",
  25757. 0x0954,
  25758. "acutelowmod",
  25759. 0x02cf,
  25760. "acutetonecmb",
  25761. 0x0341,
  25762. "acyrillic",
  25763. 0x0430,
  25764. "adblgrave",
  25765. 0x0201,
  25766. "addakgurmukhi",
  25767. 0x0a71,
  25768. "adeva",
  25769. 0x0905,
  25770. "adieresis",
  25771. 0x00e4,
  25772. "adieresiscyrillic",
  25773. 0x04d3,
  25774. "adieresismacron",
  25775. 0x01df,
  25776. "adotbelow",
  25777. 0x1ea1,
  25778. "adotmacron",
  25779. 0x01e1,
  25780. "ae",
  25781. 0x00e6,
  25782. "aeacute",
  25783. 0x01fd,
  25784. "aekorean",
  25785. 0x3150,
  25786. "aemacron",
  25787. 0x01e3,
  25788. "afii00208",
  25789. 0x2015,
  25790. "afii08941",
  25791. 0x20a4,
  25792. "afii10017",
  25793. 0x0410,
  25794. "afii10018",
  25795. 0x0411,
  25796. "afii10019",
  25797. 0x0412,
  25798. "afii10020",
  25799. 0x0413,
  25800. "afii10021",
  25801. 0x0414,
  25802. "afii10022",
  25803. 0x0415,
  25804. "afii10023",
  25805. 0x0401,
  25806. "afii10024",
  25807. 0x0416,
  25808. "afii10025",
  25809. 0x0417,
  25810. "afii10026",
  25811. 0x0418,
  25812. "afii10027",
  25813. 0x0419,
  25814. "afii10028",
  25815. 0x041a,
  25816. "afii10029",
  25817. 0x041b,
  25818. "afii10030",
  25819. 0x041c,
  25820. "afii10031",
  25821. 0x041d,
  25822. "afii10032",
  25823. 0x041e,
  25824. "afii10033",
  25825. 0x041f,
  25826. "afii10034",
  25827. 0x0420,
  25828. "afii10035",
  25829. 0x0421,
  25830. "afii10036",
  25831. 0x0422,
  25832. "afii10037",
  25833. 0x0423,
  25834. "afii10038",
  25835. 0x0424,
  25836. "afii10039",
  25837. 0x0425,
  25838. "afii10040",
  25839. 0x0426,
  25840. "afii10041",
  25841. 0x0427,
  25842. "afii10042",
  25843. 0x0428,
  25844. "afii10043",
  25845. 0x0429,
  25846. "afii10044",
  25847. 0x042a,
  25848. "afii10045",
  25849. 0x042b,
  25850. "afii10046",
  25851. 0x042c,
  25852. "afii10047",
  25853. 0x042d,
  25854. "afii10048",
  25855. 0x042e,
  25856. "afii10049",
  25857. 0x042f,
  25858. "afii10050",
  25859. 0x0490,
  25860. "afii10051",
  25861. 0x0402,
  25862. "afii10052",
  25863. 0x0403,
  25864. "afii10053",
  25865. 0x0404,
  25866. "afii10054",
  25867. 0x0405,
  25868. "afii10055",
  25869. 0x0406,
  25870. "afii10056",
  25871. 0x0407,
  25872. "afii10057",
  25873. 0x0408,
  25874. "afii10058",
  25875. 0x0409,
  25876. "afii10059",
  25877. 0x040a,
  25878. "afii10060",
  25879. 0x040b,
  25880. "afii10061",
  25881. 0x040c,
  25882. "afii10062",
  25883. 0x040e,
  25884. "afii10063",
  25885. 0xf6c4,
  25886. "afii10064",
  25887. 0xf6c5,
  25888. "afii10065",
  25889. 0x0430,
  25890. "afii10066",
  25891. 0x0431,
  25892. "afii10067",
  25893. 0x0432,
  25894. "afii10068",
  25895. 0x0433,
  25896. "afii10069",
  25897. 0x0434,
  25898. "afii10070",
  25899. 0x0435,
  25900. "afii10071",
  25901. 0x0451,
  25902. "afii10072",
  25903. 0x0436,
  25904. "afii10073",
  25905. 0x0437,
  25906. "afii10074",
  25907. 0x0438,
  25908. "afii10075",
  25909. 0x0439,
  25910. "afii10076",
  25911. 0x043a,
  25912. "afii10077",
  25913. 0x043b,
  25914. "afii10078",
  25915. 0x043c,
  25916. "afii10079",
  25917. 0x043d,
  25918. "afii10080",
  25919. 0x043e,
  25920. "afii10081",
  25921. 0x043f,
  25922. "afii10082",
  25923. 0x0440,
  25924. "afii10083",
  25925. 0x0441,
  25926. "afii10084",
  25927. 0x0442,
  25928. "afii10085",
  25929. 0x0443,
  25930. "afii10086",
  25931. 0x0444,
  25932. "afii10087",
  25933. 0x0445,
  25934. "afii10088",
  25935. 0x0446,
  25936. "afii10089",
  25937. 0x0447,
  25938. "afii10090",
  25939. 0x0448,
  25940. "afii10091",
  25941. 0x0449,
  25942. "afii10092",
  25943. 0x044a,
  25944. "afii10093",
  25945. 0x044b,
  25946. "afii10094",
  25947. 0x044c,
  25948. "afii10095",
  25949. 0x044d,
  25950. "afii10096",
  25951. 0x044e,
  25952. "afii10097",
  25953. 0x044f,
  25954. "afii10098",
  25955. 0x0491,
  25956. "afii10099",
  25957. 0x0452,
  25958. "afii10100",
  25959. 0x0453,
  25960. "afii10101",
  25961. 0x0454,
  25962. "afii10102",
  25963. 0x0455,
  25964. "afii10103",
  25965. 0x0456,
  25966. "afii10104",
  25967. 0x0457,
  25968. "afii10105",
  25969. 0x0458,
  25970. "afii10106",
  25971. 0x0459,
  25972. "afii10107",
  25973. 0x045a,
  25974. "afii10108",
  25975. 0x045b,
  25976. "afii10109",
  25977. 0x045c,
  25978. "afii10110",
  25979. 0x045e,
  25980. "afii10145",
  25981. 0x040f,
  25982. "afii10146",
  25983. 0x0462,
  25984. "afii10147",
  25985. 0x0472,
  25986. "afii10148",
  25987. 0x0474,
  25988. "afii10192",
  25989. 0xf6c6,
  25990. "afii10193",
  25991. 0x045f,
  25992. "afii10194",
  25993. 0x0463,
  25994. "afii10195",
  25995. 0x0473,
  25996. "afii10196",
  25997. 0x0475,
  25998. "afii10831",
  25999. 0xf6c7,
  26000. "afii10832",
  26001. 0xf6c8,
  26002. "afii10846",
  26003. 0x04d9,
  26004. "afii299",
  26005. 0x200e,
  26006. "afii300",
  26007. 0x200f,
  26008. "afii301",
  26009. 0x200d,
  26010. "afii57381",
  26011. 0x066a,
  26012. "afii57388",
  26013. 0x060c,
  26014. "afii57392",
  26015. 0x0660,
  26016. "afii57393",
  26017. 0x0661,
  26018. "afii57394",
  26019. 0x0662,
  26020. "afii57395",
  26021. 0x0663,
  26022. "afii57396",
  26023. 0x0664,
  26024. "afii57397",
  26025. 0x0665,
  26026. "afii57398",
  26027. 0x0666,
  26028. "afii57399",
  26029. 0x0667,
  26030. "afii57400",
  26031. 0x0668,
  26032. "afii57401",
  26033. 0x0669,
  26034. "afii57403",
  26035. 0x061b,
  26036. "afii57407",
  26037. 0x061f,
  26038. "afii57409",
  26039. 0x0621,
  26040. "afii57410",
  26041. 0x0622,
  26042. "afii57411",
  26043. 0x0623,
  26044. "afii57412",
  26045. 0x0624,
  26046. "afii57413",
  26047. 0x0625,
  26048. "afii57414",
  26049. 0x0626,
  26050. "afii57415",
  26051. 0x0627,
  26052. "afii57416",
  26053. 0x0628,
  26054. "afii57417",
  26055. 0x0629,
  26056. "afii57418",
  26057. 0x062a,
  26058. "afii57419",
  26059. 0x062b,
  26060. "afii57420",
  26061. 0x062c,
  26062. "afii57421",
  26063. 0x062d,
  26064. "afii57422",
  26065. 0x062e,
  26066. "afii57423",
  26067. 0x062f,
  26068. "afii57424",
  26069. 0x0630,
  26070. "afii57425",
  26071. 0x0631,
  26072. "afii57426",
  26073. 0x0632,
  26074. "afii57427",
  26075. 0x0633,
  26076. "afii57428",
  26077. 0x0634,
  26078. "afii57429",
  26079. 0x0635,
  26080. "afii57430",
  26081. 0x0636,
  26082. "afii57431",
  26083. 0x0637,
  26084. "afii57432",
  26085. 0x0638,
  26086. "afii57433",
  26087. 0x0639,
  26088. "afii57434",
  26089. 0x063a,
  26090. "afii57440",
  26091. 0x0640,
  26092. "afii57441",
  26093. 0x0641,
  26094. "afii57442",
  26095. 0x0642,
  26096. "afii57443",
  26097. 0x0643,
  26098. "afii57444",
  26099. 0x0644,
  26100. "afii57445",
  26101. 0x0645,
  26102. "afii57446",
  26103. 0x0646,
  26104. "afii57448",
  26105. 0x0648,
  26106. "afii57449",
  26107. 0x0649,
  26108. "afii57450",
  26109. 0x064a,
  26110. "afii57451",
  26111. 0x064b,
  26112. "afii57452",
  26113. 0x064c,
  26114. "afii57453",
  26115. 0x064d,
  26116. "afii57454",
  26117. 0x064e,
  26118. "afii57455",
  26119. 0x064f,
  26120. "afii57456",
  26121. 0x0650,
  26122. "afii57457",
  26123. 0x0651,
  26124. "afii57458",
  26125. 0x0652,
  26126. "afii57470",
  26127. 0x0647,
  26128. "afii57505",
  26129. 0x06a4,
  26130. "afii57506",
  26131. 0x067e,
  26132. "afii57507",
  26133. 0x0686,
  26134. "afii57508",
  26135. 0x0698,
  26136. "afii57509",
  26137. 0x06af,
  26138. "afii57511",
  26139. 0x0679,
  26140. "afii57512",
  26141. 0x0688,
  26142. "afii57513",
  26143. 0x0691,
  26144. "afii57514",
  26145. 0x06ba,
  26146. "afii57519",
  26147. 0x06d2,
  26148. "afii57534",
  26149. 0x06d5,
  26150. "afii57636",
  26151. 0x20aa,
  26152. "afii57645",
  26153. 0x05be,
  26154. "afii57658",
  26155. 0x05c3,
  26156. "afii57664",
  26157. 0x05d0,
  26158. "afii57665",
  26159. 0x05d1,
  26160. "afii57666",
  26161. 0x05d2,
  26162. "afii57667",
  26163. 0x05d3,
  26164. "afii57668",
  26165. 0x05d4,
  26166. "afii57669",
  26167. 0x05d5,
  26168. "afii57670",
  26169. 0x05d6,
  26170. "afii57671",
  26171. 0x05d7,
  26172. "afii57672",
  26173. 0x05d8,
  26174. "afii57673",
  26175. 0x05d9,
  26176. "afii57674",
  26177. 0x05da,
  26178. "afii57675",
  26179. 0x05db,
  26180. "afii57676",
  26181. 0x05dc,
  26182. "afii57677",
  26183. 0x05dd,
  26184. "afii57678",
  26185. 0x05de,
  26186. "afii57679",
  26187. 0x05df,
  26188. "afii57680",
  26189. 0x05e0,
  26190. "afii57681",
  26191. 0x05e1,
  26192. "afii57682",
  26193. 0x05e2,
  26194. "afii57683",
  26195. 0x05e3,
  26196. "afii57684",
  26197. 0x05e4,
  26198. "afii57685",
  26199. 0x05e5,
  26200. "afii57686",
  26201. 0x05e6,
  26202. "afii57687",
  26203. 0x05e7,
  26204. "afii57688",
  26205. 0x05e8,
  26206. "afii57689",
  26207. 0x05e9,
  26208. "afii57690",
  26209. 0x05ea,
  26210. "afii57694",
  26211. 0xfb2a,
  26212. "afii57695",
  26213. 0xfb2b,
  26214. "afii57700",
  26215. 0xfb4b,
  26216. "afii57705",
  26217. 0xfb1f,
  26218. "afii57716",
  26219. 0x05f0,
  26220. "afii57717",
  26221. 0x05f1,
  26222. "afii57718",
  26223. 0x05f2,
  26224. "afii57723",
  26225. 0xfb35,
  26226. "afii57793",
  26227. 0x05b4,
  26228. "afii57794",
  26229. 0x05b5,
  26230. "afii57795",
  26231. 0x05b6,
  26232. "afii57796",
  26233. 0x05bb,
  26234. "afii57797",
  26235. 0x05b8,
  26236. "afii57798",
  26237. 0x05b7,
  26238. "afii57799",
  26239. 0x05b0,
  26240. "afii57800",
  26241. 0x05b2,
  26242. "afii57801",
  26243. 0x05b1,
  26244. "afii57802",
  26245. 0x05b3,
  26246. "afii57803",
  26247. 0x05c2,
  26248. "afii57804",
  26249. 0x05c1,
  26250. "afii57806",
  26251. 0x05b9,
  26252. "afii57807",
  26253. 0x05bc,
  26254. "afii57839",
  26255. 0x05bd,
  26256. "afii57841",
  26257. 0x05bf,
  26258. "afii57842",
  26259. 0x05c0,
  26260. "afii57929",
  26261. 0x02bc,
  26262. "afii61248",
  26263. 0x2105,
  26264. "afii61289",
  26265. 0x2113,
  26266. "afii61352",
  26267. 0x2116,
  26268. "afii61573",
  26269. 0x202c,
  26270. "afii61574",
  26271. 0x202d,
  26272. "afii61575",
  26273. 0x202e,
  26274. "afii61664",
  26275. 0x200c,
  26276. "afii63167",
  26277. 0x066d,
  26278. "afii64937",
  26279. 0x02bd,
  26280. "agrave",
  26281. 0x00e0,
  26282. "agujarati",
  26283. 0x0a85,
  26284. "agurmukhi",
  26285. 0x0a05,
  26286. "ahiragana",
  26287. 0x3042,
  26288. "ahookabove",
  26289. 0x1ea3,
  26290. "aibengali",
  26291. 0x0990,
  26292. "aibopomofo",
  26293. 0x311e,
  26294. "aideva",
  26295. 0x0910,
  26296. "aiecyrillic",
  26297. 0x04d5,
  26298. "aigujarati",
  26299. 0x0a90,
  26300. "aigurmukhi",
  26301. 0x0a10,
  26302. "aimatragurmukhi",
  26303. 0x0a48,
  26304. "ainarabic",
  26305. 0x0639,
  26306. "ainfinalarabic",
  26307. 0xfeca,
  26308. "aininitialarabic",
  26309. 0xfecb,
  26310. "ainmedialarabic",
  26311. 0xfecc,
  26312. "ainvertedbreve",
  26313. 0x0203,
  26314. "aivowelsignbengali",
  26315. 0x09c8,
  26316. "aivowelsigndeva",
  26317. 0x0948,
  26318. "aivowelsigngujarati",
  26319. 0x0ac8,
  26320. "akatakana",
  26321. 0x30a2,
  26322. "akatakanahalfwidth",
  26323. 0xff71,
  26324. "akorean",
  26325. 0x314f,
  26326. "alef",
  26327. 0x05d0,
  26328. "alefarabic",
  26329. 0x0627,
  26330. "alefdageshhebrew",
  26331. 0xfb30,
  26332. "aleffinalarabic",
  26333. 0xfe8e,
  26334. "alefhamzaabovearabic",
  26335. 0x0623,
  26336. "alefhamzaabovefinalarabic",
  26337. 0xfe84,
  26338. "alefhamzabelowarabic",
  26339. 0x0625,
  26340. "alefhamzabelowfinalarabic",
  26341. 0xfe88,
  26342. "alefhebrew",
  26343. 0x05d0,
  26344. "aleflamedhebrew",
  26345. 0xfb4f,
  26346. "alefmaddaabovearabic",
  26347. 0x0622,
  26348. "alefmaddaabovefinalarabic",
  26349. 0xfe82,
  26350. "alefmaksuraarabic",
  26351. 0x0649,
  26352. "alefmaksurafinalarabic",
  26353. 0xfef0,
  26354. "alefmaksurainitialarabic",
  26355. 0xfef3,
  26356. "alefmaksuramedialarabic",
  26357. 0xfef4,
  26358. "alefpatahhebrew",
  26359. 0xfb2e,
  26360. "alefqamatshebrew",
  26361. 0xfb2f,
  26362. "aleph",
  26363. 0x2135,
  26364. "allequal",
  26365. 0x224c,
  26366. "alpha",
  26367. 0x03b1,
  26368. "alphatonos",
  26369. 0x03ac,
  26370. "amacron",
  26371. 0x0101,
  26372. "amonospace",
  26373. 0xff41,
  26374. "ampersand",
  26375. 0x0026,
  26376. "ampersandmonospace",
  26377. 0xff06,
  26378. "ampersandsmall",
  26379. 0xf726,
  26380. "amsquare",
  26381. 0x33c2,
  26382. "anbopomofo",
  26383. 0x3122,
  26384. "angbopomofo",
  26385. 0x3124,
  26386. "angbracketleft",
  26387. 0x3008,
  26388. "angbracketright",
  26389. 0x3009,
  26390. "angkhankhuthai",
  26391. 0x0e5a,
  26392. "angle",
  26393. 0x2220,
  26394. "anglebracketleft",
  26395. 0x3008,
  26396. "anglebracketleftvertical",
  26397. 0xfe3f,
  26398. "anglebracketright",
  26399. 0x3009,
  26400. "anglebracketrightvertical",
  26401. 0xfe40,
  26402. "angleleft",
  26403. 0x2329,
  26404. "angleright",
  26405. 0x232a,
  26406. "angstrom",
  26407. 0x212b,
  26408. "anoteleia",
  26409. 0x0387,
  26410. "anudattadeva",
  26411. 0x0952,
  26412. "anusvarabengali",
  26413. 0x0982,
  26414. "anusvaradeva",
  26415. 0x0902,
  26416. "anusvaragujarati",
  26417. 0x0a82,
  26418. "aogonek",
  26419. 0x0105,
  26420. "apaatosquare",
  26421. 0x3300,
  26422. "aparen",
  26423. 0x249c,
  26424. "apostrophearmenian",
  26425. 0x055a,
  26426. "apostrophemod",
  26427. 0x02bc,
  26428. "apple",
  26429. 0xf8ff,
  26430. "approaches",
  26431. 0x2250,
  26432. "approxequal",
  26433. 0x2248,
  26434. "approxequalorimage",
  26435. 0x2252,
  26436. "approximatelyequal",
  26437. 0x2245,
  26438. "araeaekorean",
  26439. 0x318e,
  26440. "araeakorean",
  26441. 0x318d,
  26442. "arc",
  26443. 0x2312,
  26444. "arighthalfring",
  26445. 0x1e9a,
  26446. "aring",
  26447. 0x00e5,
  26448. "aringacute",
  26449. 0x01fb,
  26450. "aringbelow",
  26451. 0x1e01,
  26452. "arrowboth",
  26453. 0x2194,
  26454. "arrowdashdown",
  26455. 0x21e3,
  26456. "arrowdashleft",
  26457. 0x21e0,
  26458. "arrowdashright",
  26459. 0x21e2,
  26460. "arrowdashup",
  26461. 0x21e1,
  26462. "arrowdblboth",
  26463. 0x21d4,
  26464. "arrowdbldown",
  26465. 0x21d3,
  26466. "arrowdblleft",
  26467. 0x21d0,
  26468. "arrowdblright",
  26469. 0x21d2,
  26470. "arrowdblup",
  26471. 0x21d1,
  26472. "arrowdown",
  26473. 0x2193,
  26474. "arrowdownleft",
  26475. 0x2199,
  26476. "arrowdownright",
  26477. 0x2198,
  26478. "arrowdownwhite",
  26479. 0x21e9,
  26480. "arrowheaddownmod",
  26481. 0x02c5,
  26482. "arrowheadleftmod",
  26483. 0x02c2,
  26484. "arrowheadrightmod",
  26485. 0x02c3,
  26486. "arrowheadupmod",
  26487. 0x02c4,
  26488. "arrowhorizex",
  26489. 0xf8e7,
  26490. "arrowleft",
  26491. 0x2190,
  26492. "arrowleftdbl",
  26493. 0x21d0,
  26494. "arrowleftdblstroke",
  26495. 0x21cd,
  26496. "arrowleftoverright",
  26497. 0x21c6,
  26498. "arrowleftwhite",
  26499. 0x21e6,
  26500. "arrowright",
  26501. 0x2192,
  26502. "arrowrightdblstroke",
  26503. 0x21cf,
  26504. "arrowrightheavy",
  26505. 0x279e,
  26506. "arrowrightoverleft",
  26507. 0x21c4,
  26508. "arrowrightwhite",
  26509. 0x21e8,
  26510. "arrowtableft",
  26511. 0x21e4,
  26512. "arrowtabright",
  26513. 0x21e5,
  26514. "arrowup",
  26515. 0x2191,
  26516. "arrowupdn",
  26517. 0x2195,
  26518. "arrowupdnbse",
  26519. 0x21a8,
  26520. "arrowupdownbase",
  26521. 0x21a8,
  26522. "arrowupleft",
  26523. 0x2196,
  26524. "arrowupleftofdown",
  26525. 0x21c5,
  26526. "arrowupright",
  26527. 0x2197,
  26528. "arrowupwhite",
  26529. 0x21e7,
  26530. "arrowvertex",
  26531. 0xf8e6,
  26532. "asciicircum",
  26533. 0x005e,
  26534. "asciicircummonospace",
  26535. 0xff3e,
  26536. "asciitilde",
  26537. 0x007e,
  26538. "asciitildemonospace",
  26539. 0xff5e,
  26540. "ascript",
  26541. 0x0251,
  26542. "ascriptturned",
  26543. 0x0252,
  26544. "asmallhiragana",
  26545. 0x3041,
  26546. "asmallkatakana",
  26547. 0x30a1,
  26548. "asmallkatakanahalfwidth",
  26549. 0xff67,
  26550. "asterisk",
  26551. 0x002a,
  26552. "asteriskaltonearabic",
  26553. 0x066d,
  26554. "asteriskarabic",
  26555. 0x066d,
  26556. "asteriskmath",
  26557. 0x2217,
  26558. "asteriskmonospace",
  26559. 0xff0a,
  26560. "asterisksmall",
  26561. 0xfe61,
  26562. "asterism",
  26563. 0x2042,
  26564. "asuperior",
  26565. 0xf6e9,
  26566. "asymptoticallyequal",
  26567. 0x2243,
  26568. "at",
  26569. 0x0040,
  26570. "atilde",
  26571. 0x00e3,
  26572. "atmonospace",
  26573. 0xff20,
  26574. "atsmall",
  26575. 0xfe6b,
  26576. "aturned",
  26577. 0x0250,
  26578. "aubengali",
  26579. 0x0994,
  26580. "aubopomofo",
  26581. 0x3120,
  26582. "audeva",
  26583. 0x0914,
  26584. "augujarati",
  26585. 0x0a94,
  26586. "augurmukhi",
  26587. 0x0a14,
  26588. "aulengthmarkbengali",
  26589. 0x09d7,
  26590. "aumatragurmukhi",
  26591. 0x0a4c,
  26592. "auvowelsignbengali",
  26593. 0x09cc,
  26594. "auvowelsigndeva",
  26595. 0x094c,
  26596. "auvowelsigngujarati",
  26597. 0x0acc,
  26598. "avagrahadeva",
  26599. 0x093d,
  26600. "aybarmenian",
  26601. 0x0561,
  26602. "ayin",
  26603. 0x05e2,
  26604. "ayinaltonehebrew",
  26605. 0xfb20,
  26606. "ayinhebrew",
  26607. 0x05e2,
  26608. "b",
  26609. 0x0062,
  26610. "babengali",
  26611. 0x09ac,
  26612. "backslash",
  26613. 0x005c,
  26614. "backslashmonospace",
  26615. 0xff3c,
  26616. "badeva",
  26617. 0x092c,
  26618. "bagujarati",
  26619. 0x0aac,
  26620. "bagurmukhi",
  26621. 0x0a2c,
  26622. "bahiragana",
  26623. 0x3070,
  26624. "bahtthai",
  26625. 0x0e3f,
  26626. "bakatakana",
  26627. 0x30d0,
  26628. "bar",
  26629. 0x007c,
  26630. "barmonospace",
  26631. 0xff5c,
  26632. "bbopomofo",
  26633. 0x3105,
  26634. "bcircle",
  26635. 0x24d1,
  26636. "bdotaccent",
  26637. 0x1e03,
  26638. "bdotbelow",
  26639. 0x1e05,
  26640. "beamedsixteenthnotes",
  26641. 0x266c,
  26642. "because",
  26643. 0x2235,
  26644. "becyrillic",
  26645. 0x0431,
  26646. "beharabic",
  26647. 0x0628,
  26648. "behfinalarabic",
  26649. 0xfe90,
  26650. "behinitialarabic",
  26651. 0xfe91,
  26652. "behiragana",
  26653. 0x3079,
  26654. "behmedialarabic",
  26655. 0xfe92,
  26656. "behmeeminitialarabic",
  26657. 0xfc9f,
  26658. "behmeemisolatedarabic",
  26659. 0xfc08,
  26660. "behnoonfinalarabic",
  26661. 0xfc6d,
  26662. "bekatakana",
  26663. 0x30d9,
  26664. "benarmenian",
  26665. 0x0562,
  26666. "bet",
  26667. 0x05d1,
  26668. "beta",
  26669. 0x03b2,
  26670. "betasymbolgreek",
  26671. 0x03d0,
  26672. "betdagesh",
  26673. 0xfb31,
  26674. "betdageshhebrew",
  26675. 0xfb31,
  26676. "bethebrew",
  26677. 0x05d1,
  26678. "betrafehebrew",
  26679. 0xfb4c,
  26680. "bhabengali",
  26681. 0x09ad,
  26682. "bhadeva",
  26683. 0x092d,
  26684. "bhagujarati",
  26685. 0x0aad,
  26686. "bhagurmukhi",
  26687. 0x0a2d,
  26688. "bhook",
  26689. 0x0253,
  26690. "bihiragana",
  26691. 0x3073,
  26692. "bikatakana",
  26693. 0x30d3,
  26694. "bilabialclick",
  26695. 0x0298,
  26696. "bindigurmukhi",
  26697. 0x0a02,
  26698. "birusquare",
  26699. 0x3331,
  26700. "blackcircle",
  26701. 0x25cf,
  26702. "blackdiamond",
  26703. 0x25c6,
  26704. "blackdownpointingtriangle",
  26705. 0x25bc,
  26706. "blackleftpointingpointer",
  26707. 0x25c4,
  26708. "blackleftpointingtriangle",
  26709. 0x25c0,
  26710. "blacklenticularbracketleft",
  26711. 0x3010,
  26712. "blacklenticularbracketleftvertical",
  26713. 0xfe3b,
  26714. "blacklenticularbracketright",
  26715. 0x3011,
  26716. "blacklenticularbracketrightvertical",
  26717. 0xfe3c,
  26718. "blacklowerlefttriangle",
  26719. 0x25e3,
  26720. "blacklowerrighttriangle",
  26721. 0x25e2,
  26722. "blackrectangle",
  26723. 0x25ac,
  26724. "blackrightpointingpointer",
  26725. 0x25ba,
  26726. "blackrightpointingtriangle",
  26727. 0x25b6,
  26728. "blacksmallsquare",
  26729. 0x25aa,
  26730. "blacksmilingface",
  26731. 0x263b,
  26732. "blacksquare",
  26733. 0x25a0,
  26734. "blackstar",
  26735. 0x2605,
  26736. "blackupperlefttriangle",
  26737. 0x25e4,
  26738. "blackupperrighttriangle",
  26739. 0x25e5,
  26740. "blackuppointingsmalltriangle",
  26741. 0x25b4,
  26742. "blackuppointingtriangle",
  26743. 0x25b2,
  26744. "blank",
  26745. 0x2423,
  26746. "blinebelow",
  26747. 0x1e07,
  26748. "block",
  26749. 0x2588,
  26750. "bmonospace",
  26751. 0xff42,
  26752. "bobaimaithai",
  26753. 0x0e1a,
  26754. "bohiragana",
  26755. 0x307c,
  26756. "bokatakana",
  26757. 0x30dc,
  26758. "bparen",
  26759. 0x249d,
  26760. "bqsquare",
  26761. 0x33c3,
  26762. "braceex",
  26763. 0xf8f4,
  26764. "braceleft",
  26765. 0x007b,
  26766. "braceleftbt",
  26767. 0xf8f3,
  26768. "braceleftmid",
  26769. 0xf8f2,
  26770. "braceleftmonospace",
  26771. 0xff5b,
  26772. "braceleftsmall",
  26773. 0xfe5b,
  26774. "bracelefttp",
  26775. 0xf8f1,
  26776. "braceleftvertical",
  26777. 0xfe37,
  26778. "braceright",
  26779. 0x007d,
  26780. "bracerightbt",
  26781. 0xf8fe,
  26782. "bracerightmid",
  26783. 0xf8fd,
  26784. "bracerightmonospace",
  26785. 0xff5d,
  26786. "bracerightsmall",
  26787. 0xfe5c,
  26788. "bracerighttp",
  26789. 0xf8fc,
  26790. "bracerightvertical",
  26791. 0xfe38,
  26792. "bracketleft",
  26793. 0x005b,
  26794. "bracketleftbt",
  26795. 0xf8f0,
  26796. "bracketleftex",
  26797. 0xf8ef,
  26798. "bracketleftmonospace",
  26799. 0xff3b,
  26800. "bracketlefttp",
  26801. 0xf8ee,
  26802. "bracketright",
  26803. 0x005d,
  26804. "bracketrightbt",
  26805. 0xf8fb,
  26806. "bracketrightex",
  26807. 0xf8fa,
  26808. "bracketrightmonospace",
  26809. 0xff3d,
  26810. "bracketrighttp",
  26811. 0xf8f9,
  26812. "breve",
  26813. 0x02d8,
  26814. "brevebelowcmb",
  26815. 0x032e,
  26816. "brevecmb",
  26817. 0x0306,
  26818. "breveinvertedbelowcmb",
  26819. 0x032f,
  26820. "breveinvertedcmb",
  26821. 0x0311,
  26822. "breveinverteddoublecmb",
  26823. 0x0361,
  26824. "bridgebelowcmb",
  26825. 0x032a,
  26826. "bridgeinvertedbelowcmb",
  26827. 0x033a,
  26828. "brokenbar",
  26829. 0x00a6,
  26830. "bstroke",
  26831. 0x0180,
  26832. "bsuperior",
  26833. 0xf6ea,
  26834. "btopbar",
  26835. 0x0183,
  26836. "buhiragana",
  26837. 0x3076,
  26838. "bukatakana",
  26839. 0x30d6,
  26840. "bullet",
  26841. 0x2022,
  26842. "bulletinverse",
  26843. 0x25d8,
  26844. "bulletoperator",
  26845. 0x2219,
  26846. "bullseye",
  26847. 0x25ce,
  26848. "c",
  26849. 0x0063,
  26850. "caarmenian",
  26851. 0x056e,
  26852. "cabengali",
  26853. 0x099a,
  26854. "cacute",
  26855. 0x0107,
  26856. "cadeva",
  26857. 0x091a,
  26858. "cagujarati",
  26859. 0x0a9a,
  26860. "cagurmukhi",
  26861. 0x0a1a,
  26862. "calsquare",
  26863. 0x3388,
  26864. "candrabindubengali",
  26865. 0x0981,
  26866. "candrabinducmb",
  26867. 0x0310,
  26868. "candrabindudeva",
  26869. 0x0901,
  26870. "candrabindugujarati",
  26871. 0x0a81,
  26872. "capslock",
  26873. 0x21ea,
  26874. "careof",
  26875. 0x2105,
  26876. "caron",
  26877. 0x02c7,
  26878. "caronbelowcmb",
  26879. 0x032c,
  26880. "caroncmb",
  26881. 0x030c,
  26882. "carriagereturn",
  26883. 0x21b5,
  26884. "cbopomofo",
  26885. 0x3118,
  26886. "ccaron",
  26887. 0x010d,
  26888. "ccedilla",
  26889. 0x00e7,
  26890. "ccedillaacute",
  26891. 0x1e09,
  26892. "ccircle",
  26893. 0x24d2,
  26894. "ccircumflex",
  26895. 0x0109,
  26896. "ccurl",
  26897. 0x0255,
  26898. "cdot",
  26899. 0x010b,
  26900. "cdotaccent",
  26901. 0x010b,
  26902. "cdsquare",
  26903. 0x33c5,
  26904. "cedilla",
  26905. 0x00b8,
  26906. "cedillacmb",
  26907. 0x0327,
  26908. "cent",
  26909. 0x00a2,
  26910. "centigrade",
  26911. 0x2103,
  26912. "centinferior",
  26913. 0xf6df,
  26914. "centmonospace",
  26915. 0xffe0,
  26916. "centoldstyle",
  26917. 0xf7a2,
  26918. "centsuperior",
  26919. 0xf6e0,
  26920. "chaarmenian",
  26921. 0x0579,
  26922. "chabengali",
  26923. 0x099b,
  26924. "chadeva",
  26925. 0x091b,
  26926. "chagujarati",
  26927. 0x0a9b,
  26928. "chagurmukhi",
  26929. 0x0a1b,
  26930. "chbopomofo",
  26931. 0x3114,
  26932. "cheabkhasiancyrillic",
  26933. 0x04bd,
  26934. "checkmark",
  26935. 0x2713,
  26936. "checyrillic",
  26937. 0x0447,
  26938. "chedescenderabkhasiancyrillic",
  26939. 0x04bf,
  26940. "chedescendercyrillic",
  26941. 0x04b7,
  26942. "chedieresiscyrillic",
  26943. 0x04f5,
  26944. "cheharmenian",
  26945. 0x0573,
  26946. "chekhakassiancyrillic",
  26947. 0x04cc,
  26948. "cheverticalstrokecyrillic",
  26949. 0x04b9,
  26950. "chi",
  26951. 0x03c7,
  26952. "chieuchacirclekorean",
  26953. 0x3277,
  26954. "chieuchaparenkorean",
  26955. 0x3217,
  26956. "chieuchcirclekorean",
  26957. 0x3269,
  26958. "chieuchkorean",
  26959. 0x314a,
  26960. "chieuchparenkorean",
  26961. 0x3209,
  26962. "chochangthai",
  26963. 0x0e0a,
  26964. "chochanthai",
  26965. 0x0e08,
  26966. "chochingthai",
  26967. 0x0e09,
  26968. "chochoethai",
  26969. 0x0e0c,
  26970. "chook",
  26971. 0x0188,
  26972. "cieucacirclekorean",
  26973. 0x3276,
  26974. "cieucaparenkorean",
  26975. 0x3216,
  26976. "cieuccirclekorean",
  26977. 0x3268,
  26978. "cieuckorean",
  26979. 0x3148,
  26980. "cieucparenkorean",
  26981. 0x3208,
  26982. "cieucuparenkorean",
  26983. 0x321c,
  26984. "circle",
  26985. 0x25cb,
  26986. "circlecopyrt",
  26987. 0x00a9,
  26988. "circlemultiply",
  26989. 0x2297,
  26990. "circleot",
  26991. 0x2299,
  26992. "circleplus",
  26993. 0x2295,
  26994. "circlepostalmark",
  26995. 0x3036,
  26996. "circlewithlefthalfblack",
  26997. 0x25d0,
  26998. "circlewithrighthalfblack",
  26999. 0x25d1,
  27000. "circumflex",
  27001. 0x02c6,
  27002. "circumflexbelowcmb",
  27003. 0x032d,
  27004. "circumflexcmb",
  27005. 0x0302,
  27006. "clear",
  27007. 0x2327,
  27008. "clickalveolar",
  27009. 0x01c2,
  27010. "clickdental",
  27011. 0x01c0,
  27012. "clicklateral",
  27013. 0x01c1,
  27014. "clickretroflex",
  27015. 0x01c3,
  27016. "club",
  27017. 0x2663,
  27018. "clubsuitblack",
  27019. 0x2663,
  27020. "clubsuitwhite",
  27021. 0x2667,
  27022. "cmcubedsquare",
  27023. 0x33a4,
  27024. "cmonospace",
  27025. 0xff43,
  27026. "cmsquaredsquare",
  27027. 0x33a0,
  27028. "coarmenian",
  27029. 0x0581,
  27030. "colon",
  27031. 0x003a,
  27032. "colonmonetary",
  27033. 0x20a1,
  27034. "colonmonospace",
  27035. 0xff1a,
  27036. "colonsign",
  27037. 0x20a1,
  27038. "colonsmall",
  27039. 0xfe55,
  27040. "colontriangularhalfmod",
  27041. 0x02d1,
  27042. "colontriangularmod",
  27043. 0x02d0,
  27044. "comma",
  27045. 0x002c,
  27046. "commaabovecmb",
  27047. 0x0313,
  27048. "commaaboverightcmb",
  27049. 0x0315,
  27050. "commaaccent",
  27051. 0xf6c3,
  27052. "commaarabic",
  27053. 0x060c,
  27054. "commaarmenian",
  27055. 0x055d,
  27056. "commainferior",
  27057. 0xf6e1,
  27058. "commamonospace",
  27059. 0xff0c,
  27060. "commareversedabovecmb",
  27061. 0x0314,
  27062. "commareversedmod",
  27063. 0x02bd,
  27064. "commasmall",
  27065. 0xfe50,
  27066. "commasuperior",
  27067. 0xf6e2,
  27068. "commaturnedabovecmb",
  27069. 0x0312,
  27070. "commaturnedmod",
  27071. 0x02bb,
  27072. "compass",
  27073. 0x263c,
  27074. "congruent",
  27075. 0x2245,
  27076. "contourintegral",
  27077. 0x222e,
  27078. "control",
  27079. 0x2303,
  27080. "controlACK",
  27081. 0x0006,
  27082. "controlBEL",
  27083. 0x0007,
  27084. "controlBS",
  27085. 0x0008,
  27086. "controlCAN",
  27087. 0x0018,
  27088. "controlCR",
  27089. 0x000d,
  27090. "controlDC1",
  27091. 0x0011,
  27092. "controlDC2",
  27093. 0x0012,
  27094. "controlDC3",
  27095. 0x0013,
  27096. "controlDC4",
  27097. 0x0014,
  27098. "controlDEL",
  27099. 0x007f,
  27100. "controlDLE",
  27101. 0x0010,
  27102. "controlEM",
  27103. 0x0019,
  27104. "controlENQ",
  27105. 0x0005,
  27106. "controlEOT",
  27107. 0x0004,
  27108. "controlESC",
  27109. 0x001b,
  27110. "controlETB",
  27111. 0x0017,
  27112. "controlETX",
  27113. 0x0003,
  27114. "controlFF",
  27115. 0x000c,
  27116. "controlFS",
  27117. 0x001c,
  27118. "controlGS",
  27119. 0x001d,
  27120. "controlHT",
  27121. 0x0009,
  27122. "controlLF",
  27123. 0x000a,
  27124. "controlNAK",
  27125. 0x0015,
  27126. "controlNULL",
  27127. 0x0000,
  27128. "controlRS",
  27129. 0x001e,
  27130. "controlSI",
  27131. 0x000f,
  27132. "controlSO",
  27133. 0x000e,
  27134. "controlSOT",
  27135. 0x0002,
  27136. "controlSTX",
  27137. 0x0001,
  27138. "controlSUB",
  27139. 0x001a,
  27140. "controlSYN",
  27141. 0x0016,
  27142. "controlUS",
  27143. 0x001f,
  27144. "controlVT",
  27145. 0x000b,
  27146. "copyright",
  27147. 0x00a9,
  27148. "copyrightsans",
  27149. 0xf8e9,
  27150. "copyrightserif",
  27151. 0xf6d9,
  27152. "cornerbracketleft",
  27153. 0x300c,
  27154. "cornerbracketlefthalfwidth",
  27155. 0xff62,
  27156. "cornerbracketleftvertical",
  27157. 0xfe41,
  27158. "cornerbracketright",
  27159. 0x300d,
  27160. "cornerbracketrighthalfwidth",
  27161. 0xff63,
  27162. "cornerbracketrightvertical",
  27163. 0xfe42,
  27164. "corporationsquare",
  27165. 0x337f,
  27166. "cosquare",
  27167. 0x33c7,
  27168. "coverkgsquare",
  27169. 0x33c6,
  27170. "cparen",
  27171. 0x249e,
  27172. "cruzeiro",
  27173. 0x20a2,
  27174. "cstretched",
  27175. 0x0297,
  27176. "curlyand",
  27177. 0x22cf,
  27178. "curlyor",
  27179. 0x22ce,
  27180. "currency",
  27181. 0x00a4,
  27182. "cyrBreve",
  27183. 0xf6d1,
  27184. "cyrFlex",
  27185. 0xf6d2,
  27186. "cyrbreve",
  27187. 0xf6d4,
  27188. "cyrflex",
  27189. 0xf6d5,
  27190. "d",
  27191. 0x0064,
  27192. "daarmenian",
  27193. 0x0564,
  27194. "dabengali",
  27195. 0x09a6,
  27196. "dadarabic",
  27197. 0x0636,
  27198. "dadeva",
  27199. 0x0926,
  27200. "dadfinalarabic",
  27201. 0xfebe,
  27202. "dadinitialarabic",
  27203. 0xfebf,
  27204. "dadmedialarabic",
  27205. 0xfec0,
  27206. "dagesh",
  27207. 0x05bc,
  27208. "dageshhebrew",
  27209. 0x05bc,
  27210. "dagger",
  27211. 0x2020,
  27212. "daggerdbl",
  27213. 0x2021,
  27214. "dagujarati",
  27215. 0x0aa6,
  27216. "dagurmukhi",
  27217. 0x0a26,
  27218. "dahiragana",
  27219. 0x3060,
  27220. "dakatakana",
  27221. 0x30c0,
  27222. "dalarabic",
  27223. 0x062f,
  27224. "dalet",
  27225. 0x05d3,
  27226. "daletdagesh",
  27227. 0xfb33,
  27228. "daletdageshhebrew",
  27229. 0xfb33,
  27230. "dalethebrew",
  27231. 0x05d3,
  27232. "dalfinalarabic",
  27233. 0xfeaa,
  27234. "dammaarabic",
  27235. 0x064f,
  27236. "dammalowarabic",
  27237. 0x064f,
  27238. "dammatanaltonearabic",
  27239. 0x064c,
  27240. "dammatanarabic",
  27241. 0x064c,
  27242. "danda",
  27243. 0x0964,
  27244. "dargahebrew",
  27245. 0x05a7,
  27246. "dargalefthebrew",
  27247. 0x05a7,
  27248. "dasiapneumatacyrilliccmb",
  27249. 0x0485,
  27250. "dblGrave",
  27251. 0xf6d3,
  27252. "dblanglebracketleft",
  27253. 0x300a,
  27254. "dblanglebracketleftvertical",
  27255. 0xfe3d,
  27256. "dblanglebracketright",
  27257. 0x300b,
  27258. "dblanglebracketrightvertical",
  27259. 0xfe3e,
  27260. "dblarchinvertedbelowcmb",
  27261. 0x032b,
  27262. "dblarrowleft",
  27263. 0x21d4,
  27264. "dblarrowright",
  27265. 0x21d2,
  27266. "dbldanda",
  27267. 0x0965,
  27268. "dblgrave",
  27269. 0xf6d6,
  27270. "dblgravecmb",
  27271. 0x030f,
  27272. "dblintegral",
  27273. 0x222c,
  27274. "dbllowline",
  27275. 0x2017,
  27276. "dbllowlinecmb",
  27277. 0x0333,
  27278. "dbloverlinecmb",
  27279. 0x033f,
  27280. "dblprimemod",
  27281. 0x02ba,
  27282. "dblverticalbar",
  27283. 0x2016,
  27284. "dblverticallineabovecmb",
  27285. 0x030e,
  27286. "dbopomofo",
  27287. 0x3109,
  27288. "dbsquare",
  27289. 0x33c8,
  27290. "dcaron",
  27291. 0x010f,
  27292. "dcedilla",
  27293. 0x1e11,
  27294. "dcircle",
  27295. 0x24d3,
  27296. "dcircumflexbelow",
  27297. 0x1e13,
  27298. "dcroat",
  27299. 0x0111,
  27300. "ddabengali",
  27301. 0x09a1,
  27302. "ddadeva",
  27303. 0x0921,
  27304. "ddagujarati",
  27305. 0x0aa1,
  27306. "ddagurmukhi",
  27307. 0x0a21,
  27308. "ddalarabic",
  27309. 0x0688,
  27310. "ddalfinalarabic",
  27311. 0xfb89,
  27312. "dddhadeva",
  27313. 0x095c,
  27314. "ddhabengali",
  27315. 0x09a2,
  27316. "ddhadeva",
  27317. 0x0922,
  27318. "ddhagujarati",
  27319. 0x0aa2,
  27320. "ddhagurmukhi",
  27321. 0x0a22,
  27322. "ddotaccent",
  27323. 0x1e0b,
  27324. "ddotbelow",
  27325. 0x1e0d,
  27326. "decimalseparatorarabic",
  27327. 0x066b,
  27328. "decimalseparatorpersian",
  27329. 0x066b,
  27330. "decyrillic",
  27331. 0x0434,
  27332. "degree",
  27333. 0x00b0,
  27334. "dehihebrew",
  27335. 0x05ad,
  27336. "dehiragana",
  27337. 0x3067,
  27338. "deicoptic",
  27339. 0x03ef,
  27340. "dekatakana",
  27341. 0x30c7,
  27342. "deleteleft",
  27343. 0x232b,
  27344. "deleteright",
  27345. 0x2326,
  27346. "delta",
  27347. 0x03b4,
  27348. "deltaturned",
  27349. 0x018d,
  27350. "denominatorminusonenumeratorbengali",
  27351. 0x09f8,
  27352. "dezh",
  27353. 0x02a4,
  27354. "dhabengali",
  27355. 0x09a7,
  27356. "dhadeva",
  27357. 0x0927,
  27358. "dhagujarati",
  27359. 0x0aa7,
  27360. "dhagurmukhi",
  27361. 0x0a27,
  27362. "dhook",
  27363. 0x0257,
  27364. "dialytikatonos",
  27365. 0x0385,
  27366. "dialytikatonoscmb",
  27367. 0x0344,
  27368. "diamond",
  27369. 0x2666,
  27370. "diamondsuitwhite",
  27371. 0x2662,
  27372. "dieresis",
  27373. 0x00a8,
  27374. "dieresisacute",
  27375. 0xf6d7,
  27376. "dieresisbelowcmb",
  27377. 0x0324,
  27378. "dieresiscmb",
  27379. 0x0308,
  27380. "dieresisgrave",
  27381. 0xf6d8,
  27382. "dieresistonos",
  27383. 0x0385,
  27384. "dihiragana",
  27385. 0x3062,
  27386. "dikatakana",
  27387. 0x30c2,
  27388. "dittomark",
  27389. 0x3003,
  27390. "divide",
  27391. 0x00f7,
  27392. "divides",
  27393. 0x2223,
  27394. "divisionslash",
  27395. 0x2215,
  27396. "djecyrillic",
  27397. 0x0452,
  27398. "dkshade",
  27399. 0x2593,
  27400. "dlinebelow",
  27401. 0x1e0f,
  27402. "dlsquare",
  27403. 0x3397,
  27404. "dmacron",
  27405. 0x0111,
  27406. "dmonospace",
  27407. 0xff44,
  27408. "dnblock",
  27409. 0x2584,
  27410. "dochadathai",
  27411. 0x0e0e,
  27412. "dodekthai",
  27413. 0x0e14,
  27414. "dohiragana",
  27415. 0x3069,
  27416. "dokatakana",
  27417. 0x30c9,
  27418. "dollar",
  27419. 0x0024,
  27420. "dollarinferior",
  27421. 0xf6e3,
  27422. "dollarmonospace",
  27423. 0xff04,
  27424. "dollaroldstyle",
  27425. 0xf724,
  27426. "dollarsmall",
  27427. 0xfe69,
  27428. "dollarsuperior",
  27429. 0xf6e4,
  27430. "dong",
  27431. 0x20ab,
  27432. "dorusquare",
  27433. 0x3326,
  27434. "dotaccent",
  27435. 0x02d9,
  27436. "dotaccentcmb",
  27437. 0x0307,
  27438. "dotbelowcmb",
  27439. 0x0323,
  27440. "dotbelowcomb",
  27441. 0x0323,
  27442. "dotkatakana",
  27443. 0x30fb,
  27444. "dotlessi",
  27445. 0x0131,
  27446. "dotlessj",
  27447. 0xf6be,
  27448. "dotlessjstrokehook",
  27449. 0x0284,
  27450. "dotmath",
  27451. 0x22c5,
  27452. "dottedcircle",
  27453. 0x25cc,
  27454. "doubleyodpatah",
  27455. 0xfb1f,
  27456. "doubleyodpatahhebrew",
  27457. 0xfb1f,
  27458. "downtackbelowcmb",
  27459. 0x031e,
  27460. "downtackmod",
  27461. 0x02d5,
  27462. "dparen",
  27463. 0x249f,
  27464. "dsuperior",
  27465. 0xf6eb,
  27466. "dtail",
  27467. 0x0256,
  27468. "dtopbar",
  27469. 0x018c,
  27470. "duhiragana",
  27471. 0x3065,
  27472. "dukatakana",
  27473. 0x30c5,
  27474. "dz",
  27475. 0x01f3,
  27476. "dzaltone",
  27477. 0x02a3,
  27478. "dzcaron",
  27479. 0x01c6,
  27480. "dzcurl",
  27481. 0x02a5,
  27482. "dzeabkhasiancyrillic",
  27483. 0x04e1,
  27484. "dzecyrillic",
  27485. 0x0455,
  27486. "dzhecyrillic",
  27487. 0x045f,
  27488. "e",
  27489. 0x0065,
  27490. "eacute",
  27491. 0x00e9,
  27492. "earth",
  27493. 0x2641,
  27494. "ebengali",
  27495. 0x098f,
  27496. "ebopomofo",
  27497. 0x311c,
  27498. "ebreve",
  27499. 0x0115,
  27500. "ecandradeva",
  27501. 0x090d,
  27502. "ecandragujarati",
  27503. 0x0a8d,
  27504. "ecandravowelsigndeva",
  27505. 0x0945,
  27506. "ecandravowelsigngujarati",
  27507. 0x0ac5,
  27508. "ecaron",
  27509. 0x011b,
  27510. "ecedillabreve",
  27511. 0x1e1d,
  27512. "echarmenian",
  27513. 0x0565,
  27514. "echyiwnarmenian",
  27515. 0x0587,
  27516. "ecircle",
  27517. 0x24d4,
  27518. "ecircumflex",
  27519. 0x00ea,
  27520. "ecircumflexacute",
  27521. 0x1ebf,
  27522. "ecircumflexbelow",
  27523. 0x1e19,
  27524. "ecircumflexdotbelow",
  27525. 0x1ec7,
  27526. "ecircumflexgrave",
  27527. 0x1ec1,
  27528. "ecircumflexhookabove",
  27529. 0x1ec3,
  27530. "ecircumflextilde",
  27531. 0x1ec5,
  27532. "ecyrillic",
  27533. 0x0454,
  27534. "edblgrave",
  27535. 0x0205,
  27536. "edeva",
  27537. 0x090f,
  27538. "edieresis",
  27539. 0x00eb,
  27540. "edot",
  27541. 0x0117,
  27542. "edotaccent",
  27543. 0x0117,
  27544. "edotbelow",
  27545. 0x1eb9,
  27546. "eegurmukhi",
  27547. 0x0a0f,
  27548. "eematragurmukhi",
  27549. 0x0a47,
  27550. "efcyrillic",
  27551. 0x0444,
  27552. "egrave",
  27553. 0x00e8,
  27554. "egujarati",
  27555. 0x0a8f,
  27556. "eharmenian",
  27557. 0x0567,
  27558. "ehbopomofo",
  27559. 0x311d,
  27560. "ehiragana",
  27561. 0x3048,
  27562. "ehookabove",
  27563. 0x1ebb,
  27564. "eibopomofo",
  27565. 0x311f,
  27566. "eight",
  27567. 0x0038,
  27568. "eightarabic",
  27569. 0x0668,
  27570. "eightbengali",
  27571. 0x09ee,
  27572. "eightcircle",
  27573. 0x2467,
  27574. "eightcircleinversesansserif",
  27575. 0x2791,
  27576. "eightdeva",
  27577. 0x096e,
  27578. "eighteencircle",
  27579. 0x2471,
  27580. "eighteenparen",
  27581. 0x2485,
  27582. "eighteenperiod",
  27583. 0x2499,
  27584. "eightgujarati",
  27585. 0x0aee,
  27586. "eightgurmukhi",
  27587. 0x0a6e,
  27588. "eighthackarabic",
  27589. 0x0668,
  27590. "eighthangzhou",
  27591. 0x3028,
  27592. "eighthnotebeamed",
  27593. 0x266b,
  27594. "eightideographicparen",
  27595. 0x3227,
  27596. "eightinferior",
  27597. 0x2088,
  27598. "eightmonospace",
  27599. 0xff18,
  27600. "eightoldstyle",
  27601. 0xf738,
  27602. "eightparen",
  27603. 0x247b,
  27604. "eightperiod",
  27605. 0x248f,
  27606. "eightpersian",
  27607. 0x06f8,
  27608. "eightroman",
  27609. 0x2177,
  27610. "eightsuperior",
  27611. 0x2078,
  27612. "eightthai",
  27613. 0x0e58,
  27614. "einvertedbreve",
  27615. 0x0207,
  27616. "eiotifiedcyrillic",
  27617. 0x0465,
  27618. "ekatakana",
  27619. 0x30a8,
  27620. "ekatakanahalfwidth",
  27621. 0xff74,
  27622. "ekonkargurmukhi",
  27623. 0x0a74,
  27624. "ekorean",
  27625. 0x3154,
  27626. "elcyrillic",
  27627. 0x043b,
  27628. "element",
  27629. 0x2208,
  27630. "elevencircle",
  27631. 0x246a,
  27632. "elevenparen",
  27633. 0x247e,
  27634. "elevenperiod",
  27635. 0x2492,
  27636. "elevenroman",
  27637. 0x217a,
  27638. "ellipsis",
  27639. 0x2026,
  27640. "ellipsisvertical",
  27641. 0x22ee,
  27642. "emacron",
  27643. 0x0113,
  27644. "emacronacute",
  27645. 0x1e17,
  27646. "emacrongrave",
  27647. 0x1e15,
  27648. "emcyrillic",
  27649. 0x043c,
  27650. "emdash",
  27651. 0x2014,
  27652. "emdashvertical",
  27653. 0xfe31,
  27654. "emonospace",
  27655. 0xff45,
  27656. "emphasismarkarmenian",
  27657. 0x055b,
  27658. "emptyset",
  27659. 0x2205,
  27660. "enbopomofo",
  27661. 0x3123,
  27662. "encyrillic",
  27663. 0x043d,
  27664. "endash",
  27665. 0x2013,
  27666. "endashvertical",
  27667. 0xfe32,
  27668. "endescendercyrillic",
  27669. 0x04a3,
  27670. "eng",
  27671. 0x014b,
  27672. "engbopomofo",
  27673. 0x3125,
  27674. "enghecyrillic",
  27675. 0x04a5,
  27676. "enhookcyrillic",
  27677. 0x04c8,
  27678. "enspace",
  27679. 0x2002,
  27680. "eogonek",
  27681. 0x0119,
  27682. "eokorean",
  27683. 0x3153,
  27684. "eopen",
  27685. 0x025b,
  27686. "eopenclosed",
  27687. 0x029a,
  27688. "eopenreversed",
  27689. 0x025c,
  27690. "eopenreversedclosed",
  27691. 0x025e,
  27692. "eopenreversedhook",
  27693. 0x025d,
  27694. "eparen",
  27695. 0x24a0,
  27696. "epsilon",
  27697. 0x03b5,
  27698. "epsilontonos",
  27699. 0x03ad,
  27700. "equal",
  27701. 0x003d,
  27702. "equalmonospace",
  27703. 0xff1d,
  27704. "equalsmall",
  27705. 0xfe66,
  27706. "equalsuperior",
  27707. 0x207c,
  27708. "equivalence",
  27709. 0x2261,
  27710. "erbopomofo",
  27711. 0x3126,
  27712. "ercyrillic",
  27713. 0x0440,
  27714. "ereversed",
  27715. 0x0258,
  27716. "ereversedcyrillic",
  27717. 0x044d,
  27718. "escyrillic",
  27719. 0x0441,
  27720. "esdescendercyrillic",
  27721. 0x04ab,
  27722. "esh",
  27723. 0x0283,
  27724. "eshcurl",
  27725. 0x0286,
  27726. "eshortdeva",
  27727. 0x090e,
  27728. "eshortvowelsigndeva",
  27729. 0x0946,
  27730. "eshreversedloop",
  27731. 0x01aa,
  27732. "eshsquatreversed",
  27733. 0x0285,
  27734. "esmallhiragana",
  27735. 0x3047,
  27736. "esmallkatakana",
  27737. 0x30a7,
  27738. "esmallkatakanahalfwidth",
  27739. 0xff6a,
  27740. "estimated",
  27741. 0x212e,
  27742. "esuperior",
  27743. 0xf6ec,
  27744. "eta",
  27745. 0x03b7,
  27746. "etarmenian",
  27747. 0x0568,
  27748. "etatonos",
  27749. 0x03ae,
  27750. "eth",
  27751. 0x00f0,
  27752. "etilde",
  27753. 0x1ebd,
  27754. "etildebelow",
  27755. 0x1e1b,
  27756. "etnahtafoukhhebrew",
  27757. 0x0591,
  27758. "etnahtafoukhlefthebrew",
  27759. 0x0591,
  27760. "etnahtahebrew",
  27761. 0x0591,
  27762. "etnahtalefthebrew",
  27763. 0x0591,
  27764. "eturned",
  27765. 0x01dd,
  27766. "eukorean",
  27767. 0x3161,
  27768. "euro",
  27769. 0x20ac,
  27770. "evowelsignbengali",
  27771. 0x09c7,
  27772. "evowelsigndeva",
  27773. 0x0947,
  27774. "evowelsigngujarati",
  27775. 0x0ac7,
  27776. "exclam",
  27777. 0x0021,
  27778. "exclamarmenian",
  27779. 0x055c,
  27780. "exclamdbl",
  27781. 0x203c,
  27782. "exclamdown",
  27783. 0x00a1,
  27784. "exclamdownsmall",
  27785. 0xf7a1,
  27786. "exclammonospace",
  27787. 0xff01,
  27788. "exclamsmall",
  27789. 0xf721,
  27790. "existential",
  27791. 0x2203,
  27792. "ezh",
  27793. 0x0292,
  27794. "ezhcaron",
  27795. 0x01ef,
  27796. "ezhcurl",
  27797. 0x0293,
  27798. "ezhreversed",
  27799. 0x01b9,
  27800. "ezhtail",
  27801. 0x01ba,
  27802. "f",
  27803. 0x0066,
  27804. "fadeva",
  27805. 0x095e,
  27806. "fagurmukhi",
  27807. 0x0a5e,
  27808. "fahrenheit",
  27809. 0x2109,
  27810. "fathaarabic",
  27811. 0x064e,
  27812. "fathalowarabic",
  27813. 0x064e,
  27814. "fathatanarabic",
  27815. 0x064b,
  27816. "fbopomofo",
  27817. 0x3108,
  27818. "fcircle",
  27819. 0x24d5,
  27820. "fdotaccent",
  27821. 0x1e1f,
  27822. "feharabic",
  27823. 0x0641,
  27824. "feharmenian",
  27825. 0x0586,
  27826. "fehfinalarabic",
  27827. 0xfed2,
  27828. "fehinitialarabic",
  27829. 0xfed3,
  27830. "fehmedialarabic",
  27831. 0xfed4,
  27832. "feicoptic",
  27833. 0x03e5,
  27834. "female",
  27835. 0x2640,
  27836. "ff",
  27837. 0xfb00,
  27838. "f_f",
  27839. 0xfb00,
  27840. "ffi",
  27841. 0xfb03,
  27842. "ffl",
  27843. 0xfb04,
  27844. "fi",
  27845. 0xfb01,
  27846. "fifteencircle",
  27847. 0x246e,
  27848. "fifteenparen",
  27849. 0x2482,
  27850. "fifteenperiod",
  27851. 0x2496,
  27852. "figuredash",
  27853. 0x2012,
  27854. "filledbox",
  27855. 0x25a0,
  27856. "filledrect",
  27857. 0x25ac,
  27858. "finalkaf",
  27859. 0x05da,
  27860. "finalkafdagesh",
  27861. 0xfb3a,
  27862. "finalkafdageshhebrew",
  27863. 0xfb3a,
  27864. "finalkafhebrew",
  27865. 0x05da,
  27866. "finalmem",
  27867. 0x05dd,
  27868. "finalmemhebrew",
  27869. 0x05dd,
  27870. "finalnun",
  27871. 0x05df,
  27872. "finalnunhebrew",
  27873. 0x05df,
  27874. "finalpe",
  27875. 0x05e3,
  27876. "finalpehebrew",
  27877. 0x05e3,
  27878. "finaltsadi",
  27879. 0x05e5,
  27880. "finaltsadihebrew",
  27881. 0x05e5,
  27882. "firsttonechinese",
  27883. 0x02c9,
  27884. "fisheye",
  27885. 0x25c9,
  27886. "fitacyrillic",
  27887. 0x0473,
  27888. "five",
  27889. 0x0035,
  27890. "fivearabic",
  27891. 0x0665,
  27892. "fivebengali",
  27893. 0x09eb,
  27894. "fivecircle",
  27895. 0x2464,
  27896. "fivecircleinversesansserif",
  27897. 0x278e,
  27898. "fivedeva",
  27899. 0x096b,
  27900. "fiveeighths",
  27901. 0x215d,
  27902. "fivegujarati",
  27903. 0x0aeb,
  27904. "fivegurmukhi",
  27905. 0x0a6b,
  27906. "fivehackarabic",
  27907. 0x0665,
  27908. "fivehangzhou",
  27909. 0x3025,
  27910. "fiveideographicparen",
  27911. 0x3224,
  27912. "fiveinferior",
  27913. 0x2085,
  27914. "fivemonospace",
  27915. 0xff15,
  27916. "fiveoldstyle",
  27917. 0xf735,
  27918. "fiveparen",
  27919. 0x2478,
  27920. "fiveperiod",
  27921. 0x248c,
  27922. "fivepersian",
  27923. 0x06f5,
  27924. "fiveroman",
  27925. 0x2174,
  27926. "fivesuperior",
  27927. 0x2075,
  27928. "fivethai",
  27929. 0x0e55,
  27930. "fl",
  27931. 0xfb02,
  27932. "florin",
  27933. 0x0192,
  27934. "fmonospace",
  27935. 0xff46,
  27936. "fmsquare",
  27937. 0x3399,
  27938. "fofanthai",
  27939. 0x0e1f,
  27940. "fofathai",
  27941. 0x0e1d,
  27942. "fongmanthai",
  27943. 0x0e4f,
  27944. "forall",
  27945. 0x2200,
  27946. "four",
  27947. 0x0034,
  27948. "fourarabic",
  27949. 0x0664,
  27950. "fourbengali",
  27951. 0x09ea,
  27952. "fourcircle",
  27953. 0x2463,
  27954. "fourcircleinversesansserif",
  27955. 0x278d,
  27956. "fourdeva",
  27957. 0x096a,
  27958. "fourgujarati",
  27959. 0x0aea,
  27960. "fourgurmukhi",
  27961. 0x0a6a,
  27962. "fourhackarabic",
  27963. 0x0664,
  27964. "fourhangzhou",
  27965. 0x3024,
  27966. "fourideographicparen",
  27967. 0x3223,
  27968. "fourinferior",
  27969. 0x2084,
  27970. "fourmonospace",
  27971. 0xff14,
  27972. "fournumeratorbengali",
  27973. 0x09f7,
  27974. "fouroldstyle",
  27975. 0xf734,
  27976. "fourparen",
  27977. 0x2477,
  27978. "fourperiod",
  27979. 0x248b,
  27980. "fourpersian",
  27981. 0x06f4,
  27982. "fourroman",
  27983. 0x2173,
  27984. "foursuperior",
  27985. 0x2074,
  27986. "fourteencircle",
  27987. 0x246d,
  27988. "fourteenparen",
  27989. 0x2481,
  27990. "fourteenperiod",
  27991. 0x2495,
  27992. "fourthai",
  27993. 0x0e54,
  27994. "fourthtonechinese",
  27995. 0x02cb,
  27996. "fparen",
  27997. 0x24a1,
  27998. "fraction",
  27999. 0x2044,
  28000. "franc",
  28001. 0x20a3,
  28002. "g",
  28003. 0x0067,
  28004. "gabengali",
  28005. 0x0997,
  28006. "gacute",
  28007. 0x01f5,
  28008. "gadeva",
  28009. 0x0917,
  28010. "gafarabic",
  28011. 0x06af,
  28012. "gaffinalarabic",
  28013. 0xfb93,
  28014. "gafinitialarabic",
  28015. 0xfb94,
  28016. "gafmedialarabic",
  28017. 0xfb95,
  28018. "gagujarati",
  28019. 0x0a97,
  28020. "gagurmukhi",
  28021. 0x0a17,
  28022. "gahiragana",
  28023. 0x304c,
  28024. "gakatakana",
  28025. 0x30ac,
  28026. "gamma",
  28027. 0x03b3,
  28028. "gammalatinsmall",
  28029. 0x0263,
  28030. "gammasuperior",
  28031. 0x02e0,
  28032. "gangiacoptic",
  28033. 0x03eb,
  28034. "gbopomofo",
  28035. 0x310d,
  28036. "gbreve",
  28037. 0x011f,
  28038. "gcaron",
  28039. 0x01e7,
  28040. "gcedilla",
  28041. 0x0123,
  28042. "gcircle",
  28043. 0x24d6,
  28044. "gcircumflex",
  28045. 0x011d,
  28046. "gcommaaccent",
  28047. 0x0123,
  28048. "gdot",
  28049. 0x0121,
  28050. "gdotaccent",
  28051. 0x0121,
  28052. "gecyrillic",
  28053. 0x0433,
  28054. "gehiragana",
  28055. 0x3052,
  28056. "gekatakana",
  28057. 0x30b2,
  28058. "geometricallyequal",
  28059. 0x2251,
  28060. "gereshaccenthebrew",
  28061. 0x059c,
  28062. "gereshhebrew",
  28063. 0x05f3,
  28064. "gereshmuqdamhebrew",
  28065. 0x059d,
  28066. "germandbls",
  28067. 0x00df,
  28068. "gershayimaccenthebrew",
  28069. 0x059e,
  28070. "gershayimhebrew",
  28071. 0x05f4,
  28072. "getamark",
  28073. 0x3013,
  28074. "ghabengali",
  28075. 0x0998,
  28076. "ghadarmenian",
  28077. 0x0572,
  28078. "ghadeva",
  28079. 0x0918,
  28080. "ghagujarati",
  28081. 0x0a98,
  28082. "ghagurmukhi",
  28083. 0x0a18,
  28084. "ghainarabic",
  28085. 0x063a,
  28086. "ghainfinalarabic",
  28087. 0xfece,
  28088. "ghaininitialarabic",
  28089. 0xfecf,
  28090. "ghainmedialarabic",
  28091. 0xfed0,
  28092. "ghemiddlehookcyrillic",
  28093. 0x0495,
  28094. "ghestrokecyrillic",
  28095. 0x0493,
  28096. "gheupturncyrillic",
  28097. 0x0491,
  28098. "ghhadeva",
  28099. 0x095a,
  28100. "ghhagurmukhi",
  28101. 0x0a5a,
  28102. "ghook",
  28103. 0x0260,
  28104. "ghzsquare",
  28105. 0x3393,
  28106. "gihiragana",
  28107. 0x304e,
  28108. "gikatakana",
  28109. 0x30ae,
  28110. "gimarmenian",
  28111. 0x0563,
  28112. "gimel",
  28113. 0x05d2,
  28114. "gimeldagesh",
  28115. 0xfb32,
  28116. "gimeldageshhebrew",
  28117. 0xfb32,
  28118. "gimelhebrew",
  28119. 0x05d2,
  28120. "gjecyrillic",
  28121. 0x0453,
  28122. "glottalinvertedstroke",
  28123. 0x01be,
  28124. "glottalstop",
  28125. 0x0294,
  28126. "glottalstopinverted",
  28127. 0x0296,
  28128. "glottalstopmod",
  28129. 0x02c0,
  28130. "glottalstopreversed",
  28131. 0x0295,
  28132. "glottalstopreversedmod",
  28133. 0x02c1,
  28134. "glottalstopreversedsuperior",
  28135. 0x02e4,
  28136. "glottalstopstroke",
  28137. 0x02a1,
  28138. "glottalstopstrokereversed",
  28139. 0x02a2,
  28140. "gmacron",
  28141. 0x1e21,
  28142. "gmonospace",
  28143. 0xff47,
  28144. "gohiragana",
  28145. 0x3054,
  28146. "gokatakana",
  28147. 0x30b4,
  28148. "gparen",
  28149. 0x24a2,
  28150. "gpasquare",
  28151. 0x33ac,
  28152. "gradient",
  28153. 0x2207,
  28154. "grave",
  28155. 0x0060,
  28156. "gravebelowcmb",
  28157. 0x0316,
  28158. "gravecmb",
  28159. 0x0300,
  28160. "gravecomb",
  28161. 0x0300,
  28162. "gravedeva",
  28163. 0x0953,
  28164. "gravelowmod",
  28165. 0x02ce,
  28166. "gravemonospace",
  28167. 0xff40,
  28168. "gravetonecmb",
  28169. 0x0340,
  28170. "greater",
  28171. 0x003e,
  28172. "greaterequal",
  28173. 0x2265,
  28174. "greaterequalorless",
  28175. 0x22db,
  28176. "greatermonospace",
  28177. 0xff1e,
  28178. "greaterorequivalent",
  28179. 0x2273,
  28180. "greaterorless",
  28181. 0x2277,
  28182. "greateroverequal",
  28183. 0x2267,
  28184. "greatersmall",
  28185. 0xfe65,
  28186. "gscript",
  28187. 0x0261,
  28188. "gstroke",
  28189. 0x01e5,
  28190. "guhiragana",
  28191. 0x3050,
  28192. "guillemotleft",
  28193. 0x00ab,
  28194. "guillemotright",
  28195. 0x00bb,
  28196. "guilsinglleft",
  28197. 0x2039,
  28198. "guilsinglright",
  28199. 0x203a,
  28200. "gukatakana",
  28201. 0x30b0,
  28202. "guramusquare",
  28203. 0x3318,
  28204. "gysquare",
  28205. 0x33c9,
  28206. "h",
  28207. 0x0068,
  28208. "haabkhasiancyrillic",
  28209. 0x04a9,
  28210. "haaltonearabic",
  28211. 0x06c1,
  28212. "habengali",
  28213. 0x09b9,
  28214. "hadescendercyrillic",
  28215. 0x04b3,
  28216. "hadeva",
  28217. 0x0939,
  28218. "hagujarati",
  28219. 0x0ab9,
  28220. "hagurmukhi",
  28221. 0x0a39,
  28222. "haharabic",
  28223. 0x062d,
  28224. "hahfinalarabic",
  28225. 0xfea2,
  28226. "hahinitialarabic",
  28227. 0xfea3,
  28228. "hahiragana",
  28229. 0x306f,
  28230. "hahmedialarabic",
  28231. 0xfea4,
  28232. "haitusquare",
  28233. 0x332a,
  28234. "hakatakana",
  28235. 0x30cf,
  28236. "hakatakanahalfwidth",
  28237. 0xff8a,
  28238. "halantgurmukhi",
  28239. 0x0a4d,
  28240. "hamzaarabic",
  28241. 0x0621,
  28242. "hamzalowarabic",
  28243. 0x0621,
  28244. "hangulfiller",
  28245. 0x3164,
  28246. "hardsigncyrillic",
  28247. 0x044a,
  28248. "harpoonleftbarbup",
  28249. 0x21bc,
  28250. "harpoonrightbarbup",
  28251. 0x21c0,
  28252. "hasquare",
  28253. 0x33ca,
  28254. "hatafpatah",
  28255. 0x05b2,
  28256. "hatafpatah16",
  28257. 0x05b2,
  28258. "hatafpatah23",
  28259. 0x05b2,
  28260. "hatafpatah2f",
  28261. 0x05b2,
  28262. "hatafpatahhebrew",
  28263. 0x05b2,
  28264. "hatafpatahnarrowhebrew",
  28265. 0x05b2,
  28266. "hatafpatahquarterhebrew",
  28267. 0x05b2,
  28268. "hatafpatahwidehebrew",
  28269. 0x05b2,
  28270. "hatafqamats",
  28271. 0x05b3,
  28272. "hatafqamats1b",
  28273. 0x05b3,
  28274. "hatafqamats28",
  28275. 0x05b3,
  28276. "hatafqamats34",
  28277. 0x05b3,
  28278. "hatafqamatshebrew",
  28279. 0x05b3,
  28280. "hatafqamatsnarrowhebrew",
  28281. 0x05b3,
  28282. "hatafqamatsquarterhebrew",
  28283. 0x05b3,
  28284. "hatafqamatswidehebrew",
  28285. 0x05b3,
  28286. "hatafsegol",
  28287. 0x05b1,
  28288. "hatafsegol17",
  28289. 0x05b1,
  28290. "hatafsegol24",
  28291. 0x05b1,
  28292. "hatafsegol30",
  28293. 0x05b1,
  28294. "hatafsegolhebrew",
  28295. 0x05b1,
  28296. "hatafsegolnarrowhebrew",
  28297. 0x05b1,
  28298. "hatafsegolquarterhebrew",
  28299. 0x05b1,
  28300. "hatafsegolwidehebrew",
  28301. 0x05b1,
  28302. "hbar",
  28303. 0x0127,
  28304. "hbopomofo",
  28305. 0x310f,
  28306. "hbrevebelow",
  28307. 0x1e2b,
  28308. "hcedilla",
  28309. 0x1e29,
  28310. "hcircle",
  28311. 0x24d7,
  28312. "hcircumflex",
  28313. 0x0125,
  28314. "hdieresis",
  28315. 0x1e27,
  28316. "hdotaccent",
  28317. 0x1e23,
  28318. "hdotbelow",
  28319. 0x1e25,
  28320. "he",
  28321. 0x05d4,
  28322. "heart",
  28323. 0x2665,
  28324. "heartsuitblack",
  28325. 0x2665,
  28326. "heartsuitwhite",
  28327. 0x2661,
  28328. "hedagesh",
  28329. 0xfb34,
  28330. "hedageshhebrew",
  28331. 0xfb34,
  28332. "hehaltonearabic",
  28333. 0x06c1,
  28334. "heharabic",
  28335. 0x0647,
  28336. "hehebrew",
  28337. 0x05d4,
  28338. "hehfinalaltonearabic",
  28339. 0xfba7,
  28340. "hehfinalalttwoarabic",
  28341. 0xfeea,
  28342. "hehfinalarabic",
  28343. 0xfeea,
  28344. "hehhamzaabovefinalarabic",
  28345. 0xfba5,
  28346. "hehhamzaaboveisolatedarabic",
  28347. 0xfba4,
  28348. "hehinitialaltonearabic",
  28349. 0xfba8,
  28350. "hehinitialarabic",
  28351. 0xfeeb,
  28352. "hehiragana",
  28353. 0x3078,
  28354. "hehmedialaltonearabic",
  28355. 0xfba9,
  28356. "hehmedialarabic",
  28357. 0xfeec,
  28358. "heiseierasquare",
  28359. 0x337b,
  28360. "hekatakana",
  28361. 0x30d8,
  28362. "hekatakanahalfwidth",
  28363. 0xff8d,
  28364. "hekutaarusquare",
  28365. 0x3336,
  28366. "henghook",
  28367. 0x0267,
  28368. "herutusquare",
  28369. 0x3339,
  28370. "het",
  28371. 0x05d7,
  28372. "hethebrew",
  28373. 0x05d7,
  28374. "hhook",
  28375. 0x0266,
  28376. "hhooksuperior",
  28377. 0x02b1,
  28378. "hieuhacirclekorean",
  28379. 0x327b,
  28380. "hieuhaparenkorean",
  28381. 0x321b,
  28382. "hieuhcirclekorean",
  28383. 0x326d,
  28384. "hieuhkorean",
  28385. 0x314e,
  28386. "hieuhparenkorean",
  28387. 0x320d,
  28388. "hihiragana",
  28389. 0x3072,
  28390. "hikatakana",
  28391. 0x30d2,
  28392. "hikatakanahalfwidth",
  28393. 0xff8b,
  28394. "hiriq",
  28395. 0x05b4,
  28396. "hiriq14",
  28397. 0x05b4,
  28398. "hiriq21",
  28399. 0x05b4,
  28400. "hiriq2d",
  28401. 0x05b4,
  28402. "hiriqhebrew",
  28403. 0x05b4,
  28404. "hiriqnarrowhebrew",
  28405. 0x05b4,
  28406. "hiriqquarterhebrew",
  28407. 0x05b4,
  28408. "hiriqwidehebrew",
  28409. 0x05b4,
  28410. "hlinebelow",
  28411. 0x1e96,
  28412. "hmonospace",
  28413. 0xff48,
  28414. "hoarmenian",
  28415. 0x0570,
  28416. "hohipthai",
  28417. 0x0e2b,
  28418. "hohiragana",
  28419. 0x307b,
  28420. "hokatakana",
  28421. 0x30db,
  28422. "hokatakanahalfwidth",
  28423. 0xff8e,
  28424. "holam",
  28425. 0x05b9,
  28426. "holam19",
  28427. 0x05b9,
  28428. "holam26",
  28429. 0x05b9,
  28430. "holam32",
  28431. 0x05b9,
  28432. "holamhebrew",
  28433. 0x05b9,
  28434. "holamnarrowhebrew",
  28435. 0x05b9,
  28436. "holamquarterhebrew",
  28437. 0x05b9,
  28438. "holamwidehebrew",
  28439. 0x05b9,
  28440. "honokhukthai",
  28441. 0x0e2e,
  28442. "hookabovecomb",
  28443. 0x0309,
  28444. "hookcmb",
  28445. 0x0309,
  28446. "hookpalatalizedbelowcmb",
  28447. 0x0321,
  28448. "hookretroflexbelowcmb",
  28449. 0x0322,
  28450. "hoonsquare",
  28451. 0x3342,
  28452. "horicoptic",
  28453. 0x03e9,
  28454. "horizontalbar",
  28455. 0x2015,
  28456. "horncmb",
  28457. 0x031b,
  28458. "hotsprings",
  28459. 0x2668,
  28460. "house",
  28461. 0x2302,
  28462. "hparen",
  28463. 0x24a3,
  28464. "hsuperior",
  28465. 0x02b0,
  28466. "hturned",
  28467. 0x0265,
  28468. "huhiragana",
  28469. 0x3075,
  28470. "huiitosquare",
  28471. 0x3333,
  28472. "hukatakana",
  28473. 0x30d5,
  28474. "hukatakanahalfwidth",
  28475. 0xff8c,
  28476. "hungarumlaut",
  28477. 0x02dd,
  28478. "hungarumlautcmb",
  28479. 0x030b,
  28480. "hv",
  28481. 0x0195,
  28482. "hyphen",
  28483. 0x002d,
  28484. "hypheninferior",
  28485. 0xf6e5,
  28486. "hyphenmonospace",
  28487. 0xff0d,
  28488. "hyphensmall",
  28489. 0xfe63,
  28490. "hyphensuperior",
  28491. 0xf6e6,
  28492. "hyphentwo",
  28493. 0x2010,
  28494. "i",
  28495. 0x0069,
  28496. "iacute",
  28497. 0x00ed,
  28498. "iacyrillic",
  28499. 0x044f,
  28500. "ibengali",
  28501. 0x0987,
  28502. "ibopomofo",
  28503. 0x3127,
  28504. "ibreve",
  28505. 0x012d,
  28506. "icaron",
  28507. 0x01d0,
  28508. "icircle",
  28509. 0x24d8,
  28510. "icircumflex",
  28511. 0x00ee,
  28512. "icyrillic",
  28513. 0x0456,
  28514. "idblgrave",
  28515. 0x0209,
  28516. "ideographearthcircle",
  28517. 0x328f,
  28518. "ideographfirecircle",
  28519. 0x328b,
  28520. "ideographicallianceparen",
  28521. 0x323f,
  28522. "ideographiccallparen",
  28523. 0x323a,
  28524. "ideographiccentrecircle",
  28525. 0x32a5,
  28526. "ideographicclose",
  28527. 0x3006,
  28528. "ideographiccomma",
  28529. 0x3001,
  28530. "ideographiccommaleft",
  28531. 0xff64,
  28532. "ideographiccongratulationparen",
  28533. 0x3237,
  28534. "ideographiccorrectcircle",
  28535. 0x32a3,
  28536. "ideographicearthparen",
  28537. 0x322f,
  28538. "ideographicenterpriseparen",
  28539. 0x323d,
  28540. "ideographicexcellentcircle",
  28541. 0x329d,
  28542. "ideographicfestivalparen",
  28543. 0x3240,
  28544. "ideographicfinancialcircle",
  28545. 0x3296,
  28546. "ideographicfinancialparen",
  28547. 0x3236,
  28548. "ideographicfireparen",
  28549. 0x322b,
  28550. "ideographichaveparen",
  28551. 0x3232,
  28552. "ideographichighcircle",
  28553. 0x32a4,
  28554. "ideographiciterationmark",
  28555. 0x3005,
  28556. "ideographiclaborcircle",
  28557. 0x3298,
  28558. "ideographiclaborparen",
  28559. 0x3238,
  28560. "ideographicleftcircle",
  28561. 0x32a7,
  28562. "ideographiclowcircle",
  28563. 0x32a6,
  28564. "ideographicmedicinecircle",
  28565. 0x32a9,
  28566. "ideographicmetalparen",
  28567. 0x322e,
  28568. "ideographicmoonparen",
  28569. 0x322a,
  28570. "ideographicnameparen",
  28571. 0x3234,
  28572. "ideographicperiod",
  28573. 0x3002,
  28574. "ideographicprintcircle",
  28575. 0x329e,
  28576. "ideographicreachparen",
  28577. 0x3243,
  28578. "ideographicrepresentparen",
  28579. 0x3239,
  28580. "ideographicresourceparen",
  28581. 0x323e,
  28582. "ideographicrightcircle",
  28583. 0x32a8,
  28584. "ideographicsecretcircle",
  28585. 0x3299,
  28586. "ideographicselfparen",
  28587. 0x3242,
  28588. "ideographicsocietyparen",
  28589. 0x3233,
  28590. "ideographicspace",
  28591. 0x3000,
  28592. "ideographicspecialparen",
  28593. 0x3235,
  28594. "ideographicstockparen",
  28595. 0x3231,
  28596. "ideographicstudyparen",
  28597. 0x323b,
  28598. "ideographicsunparen",
  28599. 0x3230,
  28600. "ideographicsuperviseparen",
  28601. 0x323c,
  28602. "ideographicwaterparen",
  28603. 0x322c,
  28604. "ideographicwoodparen",
  28605. 0x322d,
  28606. "ideographiczero",
  28607. 0x3007,
  28608. "ideographmetalcircle",
  28609. 0x328e,
  28610. "ideographmooncircle",
  28611. 0x328a,
  28612. "ideographnamecircle",
  28613. 0x3294,
  28614. "ideographsuncircle",
  28615. 0x3290,
  28616. "ideographwatercircle",
  28617. 0x328c,
  28618. "ideographwoodcircle",
  28619. 0x328d,
  28620. "ideva",
  28621. 0x0907,
  28622. "idieresis",
  28623. 0x00ef,
  28624. "idieresisacute",
  28625. 0x1e2f,
  28626. "idieresiscyrillic",
  28627. 0x04e5,
  28628. "idotbelow",
  28629. 0x1ecb,
  28630. "iebrevecyrillic",
  28631. 0x04d7,
  28632. "iecyrillic",
  28633. 0x0435,
  28634. "ieungacirclekorean",
  28635. 0x3275,
  28636. "ieungaparenkorean",
  28637. 0x3215,
  28638. "ieungcirclekorean",
  28639. 0x3267,
  28640. "ieungkorean",
  28641. 0x3147,
  28642. "ieungparenkorean",
  28643. 0x3207,
  28644. "igrave",
  28645. 0x00ec,
  28646. "igujarati",
  28647. 0x0a87,
  28648. "igurmukhi",
  28649. 0x0a07,
  28650. "ihiragana",
  28651. 0x3044,
  28652. "ihookabove",
  28653. 0x1ec9,
  28654. "iibengali",
  28655. 0x0988,
  28656. "iicyrillic",
  28657. 0x0438,
  28658. "iideva",
  28659. 0x0908,
  28660. "iigujarati",
  28661. 0x0a88,
  28662. "iigurmukhi",
  28663. 0x0a08,
  28664. "iimatragurmukhi",
  28665. 0x0a40,
  28666. "iinvertedbreve",
  28667. 0x020b,
  28668. "iishortcyrillic",
  28669. 0x0439,
  28670. "iivowelsignbengali",
  28671. 0x09c0,
  28672. "iivowelsigndeva",
  28673. 0x0940,
  28674. "iivowelsigngujarati",
  28675. 0x0ac0,
  28676. "ij",
  28677. 0x0133,
  28678. "ikatakana",
  28679. 0x30a4,
  28680. "ikatakanahalfwidth",
  28681. 0xff72,
  28682. "ikorean",
  28683. 0x3163,
  28684. "ilde",
  28685. 0x02dc,
  28686. "iluyhebrew",
  28687. 0x05ac,
  28688. "imacron",
  28689. 0x012b,
  28690. "imacroncyrillic",
  28691. 0x04e3,
  28692. "imageorapproximatelyequal",
  28693. 0x2253,
  28694. "imatragurmukhi",
  28695. 0x0a3f,
  28696. "imonospace",
  28697. 0xff49,
  28698. "increment",
  28699. 0x2206,
  28700. "infinity",
  28701. 0x221e,
  28702. "iniarmenian",
  28703. 0x056b,
  28704. "integral",
  28705. 0x222b,
  28706. "integralbottom",
  28707. 0x2321,
  28708. "integralbt",
  28709. 0x2321,
  28710. "integralex",
  28711. 0xf8f5,
  28712. "integraltop",
  28713. 0x2320,
  28714. "integraltp",
  28715. 0x2320,
  28716. "intersection",
  28717. 0x2229,
  28718. "intisquare",
  28719. 0x3305,
  28720. "invbullet",
  28721. 0x25d8,
  28722. "invcircle",
  28723. 0x25d9,
  28724. "invsmileface",
  28725. 0x263b,
  28726. "iocyrillic",
  28727. 0x0451,
  28728. "iogonek",
  28729. 0x012f,
  28730. "iota",
  28731. 0x03b9,
  28732. "iotadieresis",
  28733. 0x03ca,
  28734. "iotadieresistonos",
  28735. 0x0390,
  28736. "iotalatin",
  28737. 0x0269,
  28738. "iotatonos",
  28739. 0x03af,
  28740. "iparen",
  28741. 0x24a4,
  28742. "irigurmukhi",
  28743. 0x0a72,
  28744. "ismallhiragana",
  28745. 0x3043,
  28746. "ismallkatakana",
  28747. 0x30a3,
  28748. "ismallkatakanahalfwidth",
  28749. 0xff68,
  28750. "issharbengali",
  28751. 0x09fa,
  28752. "istroke",
  28753. 0x0268,
  28754. "isuperior",
  28755. 0xf6ed,
  28756. "iterationhiragana",
  28757. 0x309d,
  28758. "iterationkatakana",
  28759. 0x30fd,
  28760. "itilde",
  28761. 0x0129,
  28762. "itildebelow",
  28763. 0x1e2d,
  28764. "iubopomofo",
  28765. 0x3129,
  28766. "iucyrillic",
  28767. 0x044e,
  28768. "ivowelsignbengali",
  28769. 0x09bf,
  28770. "ivowelsigndeva",
  28771. 0x093f,
  28772. "ivowelsigngujarati",
  28773. 0x0abf,
  28774. "izhitsacyrillic",
  28775. 0x0475,
  28776. "izhitsadblgravecyrillic",
  28777. 0x0477,
  28778. "j",
  28779. 0x006a,
  28780. "jaarmenian",
  28781. 0x0571,
  28782. "jabengali",
  28783. 0x099c,
  28784. "jadeva",
  28785. 0x091c,
  28786. "jagujarati",
  28787. 0x0a9c,
  28788. "jagurmukhi",
  28789. 0x0a1c,
  28790. "jbopomofo",
  28791. 0x3110,
  28792. "jcaron",
  28793. 0x01f0,
  28794. "jcircle",
  28795. 0x24d9,
  28796. "jcircumflex",
  28797. 0x0135,
  28798. "jcrossedtail",
  28799. 0x029d,
  28800. "jdotlessstroke",
  28801. 0x025f,
  28802. "jecyrillic",
  28803. 0x0458,
  28804. "jeemarabic",
  28805. 0x062c,
  28806. "jeemfinalarabic",
  28807. 0xfe9e,
  28808. "jeeminitialarabic",
  28809. 0xfe9f,
  28810. "jeemmedialarabic",
  28811. 0xfea0,
  28812. "jeharabic",
  28813. 0x0698,
  28814. "jehfinalarabic",
  28815. 0xfb8b,
  28816. "jhabengali",
  28817. 0x099d,
  28818. "jhadeva",
  28819. 0x091d,
  28820. "jhagujarati",
  28821. 0x0a9d,
  28822. "jhagurmukhi",
  28823. 0x0a1d,
  28824. "jheharmenian",
  28825. 0x057b,
  28826. "jis",
  28827. 0x3004,
  28828. "jmonospace",
  28829. 0xff4a,
  28830. "jparen",
  28831. 0x24a5,
  28832. "jsuperior",
  28833. 0x02b2,
  28834. "k",
  28835. 0x006b,
  28836. "kabashkircyrillic",
  28837. 0x04a1,
  28838. "kabengali",
  28839. 0x0995,
  28840. "kacute",
  28841. 0x1e31,
  28842. "kacyrillic",
  28843. 0x043a,
  28844. "kadescendercyrillic",
  28845. 0x049b,
  28846. "kadeva",
  28847. 0x0915,
  28848. "kaf",
  28849. 0x05db,
  28850. "kafarabic",
  28851. 0x0643,
  28852. "kafdagesh",
  28853. 0xfb3b,
  28854. "kafdageshhebrew",
  28855. 0xfb3b,
  28856. "kaffinalarabic",
  28857. 0xfeda,
  28858. "kafhebrew",
  28859. 0x05db,
  28860. "kafinitialarabic",
  28861. 0xfedb,
  28862. "kafmedialarabic",
  28863. 0xfedc,
  28864. "kafrafehebrew",
  28865. 0xfb4d,
  28866. "kagujarati",
  28867. 0x0a95,
  28868. "kagurmukhi",
  28869. 0x0a15,
  28870. "kahiragana",
  28871. 0x304b,
  28872. "kahookcyrillic",
  28873. 0x04c4,
  28874. "kakatakana",
  28875. 0x30ab,
  28876. "kakatakanahalfwidth",
  28877. 0xff76,
  28878. "kappa",
  28879. 0x03ba,
  28880. "kappasymbolgreek",
  28881. 0x03f0,
  28882. "kapyeounmieumkorean",
  28883. 0x3171,
  28884. "kapyeounphieuphkorean",
  28885. 0x3184,
  28886. "kapyeounpieupkorean",
  28887. 0x3178,
  28888. "kapyeounssangpieupkorean",
  28889. 0x3179,
  28890. "karoriisquare",
  28891. 0x330d,
  28892. "kashidaautoarabic",
  28893. 0x0640,
  28894. "kashidaautonosidebearingarabic",
  28895. 0x0640,
  28896. "kasmallkatakana",
  28897. 0x30f5,
  28898. "kasquare",
  28899. 0x3384,
  28900. "kasraarabic",
  28901. 0x0650,
  28902. "kasratanarabic",
  28903. 0x064d,
  28904. "kastrokecyrillic",
  28905. 0x049f,
  28906. "katahiraprolongmarkhalfwidth",
  28907. 0xff70,
  28908. "kaverticalstrokecyrillic",
  28909. 0x049d,
  28910. "kbopomofo",
  28911. 0x310e,
  28912. "kcalsquare",
  28913. 0x3389,
  28914. "kcaron",
  28915. 0x01e9,
  28916. "kcedilla",
  28917. 0x0137,
  28918. "kcircle",
  28919. 0x24da,
  28920. "kcommaaccent",
  28921. 0x0137,
  28922. "kdotbelow",
  28923. 0x1e33,
  28924. "keharmenian",
  28925. 0x0584,
  28926. "kehiragana",
  28927. 0x3051,
  28928. "kekatakana",
  28929. 0x30b1,
  28930. "kekatakanahalfwidth",
  28931. 0xff79,
  28932. "kenarmenian",
  28933. 0x056f,
  28934. "kesmallkatakana",
  28935. 0x30f6,
  28936. "kgreenlandic",
  28937. 0x0138,
  28938. "khabengali",
  28939. 0x0996,
  28940. "khacyrillic",
  28941. 0x0445,
  28942. "khadeva",
  28943. 0x0916,
  28944. "khagujarati",
  28945. 0x0a96,
  28946. "khagurmukhi",
  28947. 0x0a16,
  28948. "khaharabic",
  28949. 0x062e,
  28950. "khahfinalarabic",
  28951. 0xfea6,
  28952. "khahinitialarabic",
  28953. 0xfea7,
  28954. "khahmedialarabic",
  28955. 0xfea8,
  28956. "kheicoptic",
  28957. 0x03e7,
  28958. "khhadeva",
  28959. 0x0959,
  28960. "khhagurmukhi",
  28961. 0x0a59,
  28962. "khieukhacirclekorean",
  28963. 0x3278,
  28964. "khieukhaparenkorean",
  28965. 0x3218,
  28966. "khieukhcirclekorean",
  28967. 0x326a,
  28968. "khieukhkorean",
  28969. 0x314b,
  28970. "khieukhparenkorean",
  28971. 0x320a,
  28972. "khokhaithai",
  28973. 0x0e02,
  28974. "khokhonthai",
  28975. 0x0e05,
  28976. "khokhuatthai",
  28977. 0x0e03,
  28978. "khokhwaithai",
  28979. 0x0e04,
  28980. "khomutthai",
  28981. 0x0e5b,
  28982. "khook",
  28983. 0x0199,
  28984. "khorakhangthai",
  28985. 0x0e06,
  28986. "khzsquare",
  28987. 0x3391,
  28988. "kihiragana",
  28989. 0x304d,
  28990. "kikatakana",
  28991. 0x30ad,
  28992. "kikatakanahalfwidth",
  28993. 0xff77,
  28994. "kiroguramusquare",
  28995. 0x3315,
  28996. "kiromeetorusquare",
  28997. 0x3316,
  28998. "kirosquare",
  28999. 0x3314,
  29000. "kiyeokacirclekorean",
  29001. 0x326e,
  29002. "kiyeokaparenkorean",
  29003. 0x320e,
  29004. "kiyeokcirclekorean",
  29005. 0x3260,
  29006. "kiyeokkorean",
  29007. 0x3131,
  29008. "kiyeokparenkorean",
  29009. 0x3200,
  29010. "kiyeoksioskorean",
  29011. 0x3133,
  29012. "kjecyrillic",
  29013. 0x045c,
  29014. "klinebelow",
  29015. 0x1e35,
  29016. "klsquare",
  29017. 0x3398,
  29018. "kmcubedsquare",
  29019. 0x33a6,
  29020. "kmonospace",
  29021. 0xff4b,
  29022. "kmsquaredsquare",
  29023. 0x33a2,
  29024. "kohiragana",
  29025. 0x3053,
  29026. "kohmsquare",
  29027. 0x33c0,
  29028. "kokaithai",
  29029. 0x0e01,
  29030. "kokatakana",
  29031. 0x30b3,
  29032. "kokatakanahalfwidth",
  29033. 0xff7a,
  29034. "kooposquare",
  29035. 0x331e,
  29036. "koppacyrillic",
  29037. 0x0481,
  29038. "koreanstandardsymbol",
  29039. 0x327f,
  29040. "koroniscmb",
  29041. 0x0343,
  29042. "kparen",
  29043. 0x24a6,
  29044. "kpasquare",
  29045. 0x33aa,
  29046. "ksicyrillic",
  29047. 0x046f,
  29048. "ktsquare",
  29049. 0x33cf,
  29050. "kturned",
  29051. 0x029e,
  29052. "kuhiragana",
  29053. 0x304f,
  29054. "kukatakana",
  29055. 0x30af,
  29056. "kukatakanahalfwidth",
  29057. 0xff78,
  29058. "kvsquare",
  29059. 0x33b8,
  29060. "kwsquare",
  29061. 0x33be,
  29062. "l",
  29063. 0x006c,
  29064. "labengali",
  29065. 0x09b2,
  29066. "lacute",
  29067. 0x013a,
  29068. "ladeva",
  29069. 0x0932,
  29070. "lagujarati",
  29071. 0x0ab2,
  29072. "lagurmukhi",
  29073. 0x0a32,
  29074. "lakkhangyaothai",
  29075. 0x0e45,
  29076. "lamaleffinalarabic",
  29077. 0xfefc,
  29078. "lamalefhamzaabovefinalarabic",
  29079. 0xfef8,
  29080. "lamalefhamzaaboveisolatedarabic",
  29081. 0xfef7,
  29082. "lamalefhamzabelowfinalarabic",
  29083. 0xfefa,
  29084. "lamalefhamzabelowisolatedarabic",
  29085. 0xfef9,
  29086. "lamalefisolatedarabic",
  29087. 0xfefb,
  29088. "lamalefmaddaabovefinalarabic",
  29089. 0xfef6,
  29090. "lamalefmaddaaboveisolatedarabic",
  29091. 0xfef5,
  29092. "lamarabic",
  29093. 0x0644,
  29094. "lambda",
  29095. 0x03bb,
  29096. "lambdastroke",
  29097. 0x019b,
  29098. "lamed",
  29099. 0x05dc,
  29100. "lameddagesh",
  29101. 0xfb3c,
  29102. "lameddageshhebrew",
  29103. 0xfb3c,
  29104. "lamedhebrew",
  29105. 0x05dc,
  29106. "lamfinalarabic",
  29107. 0xfede,
  29108. "lamhahinitialarabic",
  29109. 0xfcca,
  29110. "laminitialarabic",
  29111. 0xfedf,
  29112. "lamjeeminitialarabic",
  29113. 0xfcc9,
  29114. "lamkhahinitialarabic",
  29115. 0xfccb,
  29116. "lamlamhehisolatedarabic",
  29117. 0xfdf2,
  29118. "lammedialarabic",
  29119. 0xfee0,
  29120. "lammeemhahinitialarabic",
  29121. 0xfd88,
  29122. "lammeeminitialarabic",
  29123. 0xfccc,
  29124. "largecircle",
  29125. 0x25ef,
  29126. "lbar",
  29127. 0x019a,
  29128. "lbelt",
  29129. 0x026c,
  29130. "lbopomofo",
  29131. 0x310c,
  29132. "lcaron",
  29133. 0x013e,
  29134. "lcedilla",
  29135. 0x013c,
  29136. "lcircle",
  29137. 0x24db,
  29138. "lcircumflexbelow",
  29139. 0x1e3d,
  29140. "lcommaaccent",
  29141. 0x013c,
  29142. "ldot",
  29143. 0x0140,
  29144. "ldotaccent",
  29145. 0x0140,
  29146. "ldotbelow",
  29147. 0x1e37,
  29148. "ldotbelowmacron",
  29149. 0x1e39,
  29150. "leftangleabovecmb",
  29151. 0x031a,
  29152. "lefttackbelowcmb",
  29153. 0x0318,
  29154. "less",
  29155. 0x003c,
  29156. "lessequal",
  29157. 0x2264,
  29158. "lessequalorgreater",
  29159. 0x22da,
  29160. "lessmonospace",
  29161. 0xff1c,
  29162. "lessorequivalent",
  29163. 0x2272,
  29164. "lessorgreater",
  29165. 0x2276,
  29166. "lessoverequal",
  29167. 0x2266,
  29168. "lesssmall",
  29169. 0xfe64,
  29170. "lezh",
  29171. 0x026e,
  29172. "lfblock",
  29173. 0x258c,
  29174. "lhookretroflex",
  29175. 0x026d,
  29176. "lira",
  29177. 0x20a4,
  29178. "liwnarmenian",
  29179. 0x056c,
  29180. "lj",
  29181. 0x01c9,
  29182. "ljecyrillic",
  29183. 0x0459,
  29184. "ll",
  29185. 0xf6c0,
  29186. "lladeva",
  29187. 0x0933,
  29188. "llagujarati",
  29189. 0x0ab3,
  29190. "llinebelow",
  29191. 0x1e3b,
  29192. "llladeva",
  29193. 0x0934,
  29194. "llvocalicbengali",
  29195. 0x09e1,
  29196. "llvocalicdeva",
  29197. 0x0961,
  29198. "llvocalicvowelsignbengali",
  29199. 0x09e3,
  29200. "llvocalicvowelsigndeva",
  29201. 0x0963,
  29202. "lmiddletilde",
  29203. 0x026b,
  29204. "lmonospace",
  29205. 0xff4c,
  29206. "lmsquare",
  29207. 0x33d0,
  29208. "lochulathai",
  29209. 0x0e2c,
  29210. "logicaland",
  29211. 0x2227,
  29212. "logicalnot",
  29213. 0x00ac,
  29214. "logicalnotreversed",
  29215. 0x2310,
  29216. "logicalor",
  29217. 0x2228,
  29218. "lolingthai",
  29219. 0x0e25,
  29220. "longs",
  29221. 0x017f,
  29222. "lowlinecenterline",
  29223. 0xfe4e,
  29224. "lowlinecmb",
  29225. 0x0332,
  29226. "lowlinedashed",
  29227. 0xfe4d,
  29228. "lozenge",
  29229. 0x25ca,
  29230. "lparen",
  29231. 0x24a7,
  29232. "lslash",
  29233. 0x0142,
  29234. "lsquare",
  29235. 0x2113,
  29236. "lsuperior",
  29237. 0xf6ee,
  29238. "ltshade",
  29239. 0x2591,
  29240. "luthai",
  29241. 0x0e26,
  29242. "lvocalicbengali",
  29243. 0x098c,
  29244. "lvocalicdeva",
  29245. 0x090c,
  29246. "lvocalicvowelsignbengali",
  29247. 0x09e2,
  29248. "lvocalicvowelsigndeva",
  29249. 0x0962,
  29250. "lxsquare",
  29251. 0x33d3,
  29252. "m",
  29253. 0x006d,
  29254. "mabengali",
  29255. 0x09ae,
  29256. "macron",
  29257. 0x00af,
  29258. "macronbelowcmb",
  29259. 0x0331,
  29260. "macroncmb",
  29261. 0x0304,
  29262. "macronlowmod",
  29263. 0x02cd,
  29264. "macronmonospace",
  29265. 0xffe3,
  29266. "macute",
  29267. 0x1e3f,
  29268. "madeva",
  29269. 0x092e,
  29270. "magujarati",
  29271. 0x0aae,
  29272. "magurmukhi",
  29273. 0x0a2e,
  29274. "mahapakhhebrew",
  29275. 0x05a4,
  29276. "mahapakhlefthebrew",
  29277. 0x05a4,
  29278. "mahiragana",
  29279. 0x307e,
  29280. "maichattawalowleftthai",
  29281. 0xf895,
  29282. "maichattawalowrightthai",
  29283. 0xf894,
  29284. "maichattawathai",
  29285. 0x0e4b,
  29286. "maichattawaupperleftthai",
  29287. 0xf893,
  29288. "maieklowleftthai",
  29289. 0xf88c,
  29290. "maieklowrightthai",
  29291. 0xf88b,
  29292. "maiekthai",
  29293. 0x0e48,
  29294. "maiekupperleftthai",
  29295. 0xf88a,
  29296. "maihanakatleftthai",
  29297. 0xf884,
  29298. "maihanakatthai",
  29299. 0x0e31,
  29300. "maitaikhuleftthai",
  29301. 0xf889,
  29302. "maitaikhuthai",
  29303. 0x0e47,
  29304. "maitholowleftthai",
  29305. 0xf88f,
  29306. "maitholowrightthai",
  29307. 0xf88e,
  29308. "maithothai",
  29309. 0x0e49,
  29310. "maithoupperleftthai",
  29311. 0xf88d,
  29312. "maitrilowleftthai",
  29313. 0xf892,
  29314. "maitrilowrightthai",
  29315. 0xf891,
  29316. "maitrithai",
  29317. 0x0e4a,
  29318. "maitriupperleftthai",
  29319. 0xf890,
  29320. "maiyamokthai",
  29321. 0x0e46,
  29322. "makatakana",
  29323. 0x30de,
  29324. "makatakanahalfwidth",
  29325. 0xff8f,
  29326. "male",
  29327. 0x2642,
  29328. "mansyonsquare",
  29329. 0x3347,
  29330. "maqafhebrew",
  29331. 0x05be,
  29332. "mars",
  29333. 0x2642,
  29334. "masoracirclehebrew",
  29335. 0x05af,
  29336. "masquare",
  29337. 0x3383,
  29338. "mbopomofo",
  29339. 0x3107,
  29340. "mbsquare",
  29341. 0x33d4,
  29342. "mcircle",
  29343. 0x24dc,
  29344. "mcubedsquare",
  29345. 0x33a5,
  29346. "mdotaccent",
  29347. 0x1e41,
  29348. "mdotbelow",
  29349. 0x1e43,
  29350. "meemarabic",
  29351. 0x0645,
  29352. "meemfinalarabic",
  29353. 0xfee2,
  29354. "meeminitialarabic",
  29355. 0xfee3,
  29356. "meemmedialarabic",
  29357. 0xfee4,
  29358. "meemmeeminitialarabic",
  29359. 0xfcd1,
  29360. "meemmeemisolatedarabic",
  29361. 0xfc48,
  29362. "meetorusquare",
  29363. 0x334d,
  29364. "mehiragana",
  29365. 0x3081,
  29366. "meizierasquare",
  29367. 0x337e,
  29368. "mekatakana",
  29369. 0x30e1,
  29370. "mekatakanahalfwidth",
  29371. 0xff92,
  29372. "mem",
  29373. 0x05de,
  29374. "memdagesh",
  29375. 0xfb3e,
  29376. "memdageshhebrew",
  29377. 0xfb3e,
  29378. "memhebrew",
  29379. 0x05de,
  29380. "menarmenian",
  29381. 0x0574,
  29382. "merkhahebrew",
  29383. 0x05a5,
  29384. "merkhakefulahebrew",
  29385. 0x05a6,
  29386. "merkhakefulalefthebrew",
  29387. 0x05a6,
  29388. "merkhalefthebrew",
  29389. 0x05a5,
  29390. "mhook",
  29391. 0x0271,
  29392. "mhzsquare",
  29393. 0x3392,
  29394. "middledotkatakanahalfwidth",
  29395. 0xff65,
  29396. "middot",
  29397. 0x00b7,
  29398. "mieumacirclekorean",
  29399. 0x3272,
  29400. "mieumaparenkorean",
  29401. 0x3212,
  29402. "mieumcirclekorean",
  29403. 0x3264,
  29404. "mieumkorean",
  29405. 0x3141,
  29406. "mieumpansioskorean",
  29407. 0x3170,
  29408. "mieumparenkorean",
  29409. 0x3204,
  29410. "mieumpieupkorean",
  29411. 0x316e,
  29412. "mieumsioskorean",
  29413. 0x316f,
  29414. "mihiragana",
  29415. 0x307f,
  29416. "mikatakana",
  29417. 0x30df,
  29418. "mikatakanahalfwidth",
  29419. 0xff90,
  29420. "minus",
  29421. 0x2212,
  29422. "minusbelowcmb",
  29423. 0x0320,
  29424. "minuscircle",
  29425. 0x2296,
  29426. "minusmod",
  29427. 0x02d7,
  29428. "minusplus",
  29429. 0x2213,
  29430. "minute",
  29431. 0x2032,
  29432. "miribaarusquare",
  29433. 0x334a,
  29434. "mirisquare",
  29435. 0x3349,
  29436. "mlonglegturned",
  29437. 0x0270,
  29438. "mlsquare",
  29439. 0x3396,
  29440. "mmcubedsquare",
  29441. 0x33a3,
  29442. "mmonospace",
  29443. 0xff4d,
  29444. "mmsquaredsquare",
  29445. 0x339f,
  29446. "mohiragana",
  29447. 0x3082,
  29448. "mohmsquare",
  29449. 0x33c1,
  29450. "mokatakana",
  29451. 0x30e2,
  29452. "mokatakanahalfwidth",
  29453. 0xff93,
  29454. "molsquare",
  29455. 0x33d6,
  29456. "momathai",
  29457. 0x0e21,
  29458. "moverssquare",
  29459. 0x33a7,
  29460. "moverssquaredsquare",
  29461. 0x33a8,
  29462. "mparen",
  29463. 0x24a8,
  29464. "mpasquare",
  29465. 0x33ab,
  29466. "mssquare",
  29467. 0x33b3,
  29468. "msuperior",
  29469. 0xf6ef,
  29470. "mturned",
  29471. 0x026f,
  29472. "mu",
  29473. 0x00b5,
  29474. "mu1",
  29475. 0x00b5,
  29476. "muasquare",
  29477. 0x3382,
  29478. "muchgreater",
  29479. 0x226b,
  29480. "muchless",
  29481. 0x226a,
  29482. "mufsquare",
  29483. 0x338c,
  29484. "mugreek",
  29485. 0x03bc,
  29486. "mugsquare",
  29487. 0x338d,
  29488. "muhiragana",
  29489. 0x3080,
  29490. "mukatakana",
  29491. 0x30e0,
  29492. "mukatakanahalfwidth",
  29493. 0xff91,
  29494. "mulsquare",
  29495. 0x3395,
  29496. "multiply",
  29497. 0x00d7,
  29498. "mumsquare",
  29499. 0x339b,
  29500. "munahhebrew",
  29501. 0x05a3,
  29502. "munahlefthebrew",
  29503. 0x05a3,
  29504. "musicalnote",
  29505. 0x266a,
  29506. "musicalnotedbl",
  29507. 0x266b,
  29508. "musicflatsign",
  29509. 0x266d,
  29510. "musicsharpsign",
  29511. 0x266f,
  29512. "mussquare",
  29513. 0x33b2,
  29514. "muvsquare",
  29515. 0x33b6,
  29516. "muwsquare",
  29517. 0x33bc,
  29518. "mvmegasquare",
  29519. 0x33b9,
  29520. "mvsquare",
  29521. 0x33b7,
  29522. "mwmegasquare",
  29523. 0x33bf,
  29524. "mwsquare",
  29525. 0x33bd,
  29526. "n",
  29527. 0x006e,
  29528. "nabengali",
  29529. 0x09a8,
  29530. "nabla",
  29531. 0x2207,
  29532. "nacute",
  29533. 0x0144,
  29534. "nadeva",
  29535. 0x0928,
  29536. "nagujarati",
  29537. 0x0aa8,
  29538. "nagurmukhi",
  29539. 0x0a28,
  29540. "nahiragana",
  29541. 0x306a,
  29542. "nakatakana",
  29543. 0x30ca,
  29544. "nakatakanahalfwidth",
  29545. 0xff85,
  29546. "napostrophe",
  29547. 0x0149,
  29548. "nasquare",
  29549. 0x3381,
  29550. "nbopomofo",
  29551. 0x310b,
  29552. "nbspace",
  29553. 0x00a0,
  29554. "ncaron",
  29555. 0x0148,
  29556. "ncedilla",
  29557. 0x0146,
  29558. "ncircle",
  29559. 0x24dd,
  29560. "ncircumflexbelow",
  29561. 0x1e4b,
  29562. "ncommaaccent",
  29563. 0x0146,
  29564. "ndotaccent",
  29565. 0x1e45,
  29566. "ndotbelow",
  29567. 0x1e47,
  29568. "nehiragana",
  29569. 0x306d,
  29570. "nekatakana",
  29571. 0x30cd,
  29572. "nekatakanahalfwidth",
  29573. 0xff88,
  29574. "newsheqelsign",
  29575. 0x20aa,
  29576. "nfsquare",
  29577. 0x338b,
  29578. "ngabengali",
  29579. 0x0999,
  29580. "ngadeva",
  29581. 0x0919,
  29582. "ngagujarati",
  29583. 0x0a99,
  29584. "ngagurmukhi",
  29585. 0x0a19,
  29586. "ngonguthai",
  29587. 0x0e07,
  29588. "nhiragana",
  29589. 0x3093,
  29590. "nhookleft",
  29591. 0x0272,
  29592. "nhookretroflex",
  29593. 0x0273,
  29594. "nieunacirclekorean",
  29595. 0x326f,
  29596. "nieunaparenkorean",
  29597. 0x320f,
  29598. "nieuncieuckorean",
  29599. 0x3135,
  29600. "nieuncirclekorean",
  29601. 0x3261,
  29602. "nieunhieuhkorean",
  29603. 0x3136,
  29604. "nieunkorean",
  29605. 0x3134,
  29606. "nieunpansioskorean",
  29607. 0x3168,
  29608. "nieunparenkorean",
  29609. 0x3201,
  29610. "nieunsioskorean",
  29611. 0x3167,
  29612. "nieuntikeutkorean",
  29613. 0x3166,
  29614. "nihiragana",
  29615. 0x306b,
  29616. "nikatakana",
  29617. 0x30cb,
  29618. "nikatakanahalfwidth",
  29619. 0xff86,
  29620. "nikhahitleftthai",
  29621. 0xf899,
  29622. "nikhahitthai",
  29623. 0x0e4d,
  29624. "nine",
  29625. 0x0039,
  29626. "ninearabic",
  29627. 0x0669,
  29628. "ninebengali",
  29629. 0x09ef,
  29630. "ninecircle",
  29631. 0x2468,
  29632. "ninecircleinversesansserif",
  29633. 0x2792,
  29634. "ninedeva",
  29635. 0x096f,
  29636. "ninegujarati",
  29637. 0x0aef,
  29638. "ninegurmukhi",
  29639. 0x0a6f,
  29640. "ninehackarabic",
  29641. 0x0669,
  29642. "ninehangzhou",
  29643. 0x3029,
  29644. "nineideographicparen",
  29645. 0x3228,
  29646. "nineinferior",
  29647. 0x2089,
  29648. "ninemonospace",
  29649. 0xff19,
  29650. "nineoldstyle",
  29651. 0xf739,
  29652. "nineparen",
  29653. 0x247c,
  29654. "nineperiod",
  29655. 0x2490,
  29656. "ninepersian",
  29657. 0x06f9,
  29658. "nineroman",
  29659. 0x2178,
  29660. "ninesuperior",
  29661. 0x2079,
  29662. "nineteencircle",
  29663. 0x2472,
  29664. "nineteenparen",
  29665. 0x2486,
  29666. "nineteenperiod",
  29667. 0x249a,
  29668. "ninethai",
  29669. 0x0e59,
  29670. "nj",
  29671. 0x01cc,
  29672. "njecyrillic",
  29673. 0x045a,
  29674. "nkatakana",
  29675. 0x30f3,
  29676. "nkatakanahalfwidth",
  29677. 0xff9d,
  29678. "nlegrightlong",
  29679. 0x019e,
  29680. "nlinebelow",
  29681. 0x1e49,
  29682. "nmonospace",
  29683. 0xff4e,
  29684. "nmsquare",
  29685. 0x339a,
  29686. "nnabengali",
  29687. 0x09a3,
  29688. "nnadeva",
  29689. 0x0923,
  29690. "nnagujarati",
  29691. 0x0aa3,
  29692. "nnagurmukhi",
  29693. 0x0a23,
  29694. "nnnadeva",
  29695. 0x0929,
  29696. "nohiragana",
  29697. 0x306e,
  29698. "nokatakana",
  29699. 0x30ce,
  29700. "nokatakanahalfwidth",
  29701. 0xff89,
  29702. "nonbreakingspace",
  29703. 0x00a0,
  29704. "nonenthai",
  29705. 0x0e13,
  29706. "nonuthai",
  29707. 0x0e19,
  29708. "noonarabic",
  29709. 0x0646,
  29710. "noonfinalarabic",
  29711. 0xfee6,
  29712. "noonghunnaarabic",
  29713. 0x06ba,
  29714. "noonghunnafinalarabic",
  29715. 0xfb9f,
  29716. "nooninitialarabic",
  29717. 0xfee7,
  29718. "noonjeeminitialarabic",
  29719. 0xfcd2,
  29720. "noonjeemisolatedarabic",
  29721. 0xfc4b,
  29722. "noonmedialarabic",
  29723. 0xfee8,
  29724. "noonmeeminitialarabic",
  29725. 0xfcd5,
  29726. "noonmeemisolatedarabic",
  29727. 0xfc4e,
  29728. "noonnoonfinalarabic",
  29729. 0xfc8d,
  29730. "notcontains",
  29731. 0x220c,
  29732. "notelement",
  29733. 0x2209,
  29734. "notelementof",
  29735. 0x2209,
  29736. "notequal",
  29737. 0x2260,
  29738. "notgreater",
  29739. 0x226f,
  29740. "notgreaternorequal",
  29741. 0x2271,
  29742. "notgreaternorless",
  29743. 0x2279,
  29744. "notidentical",
  29745. 0x2262,
  29746. "notless",
  29747. 0x226e,
  29748. "notlessnorequal",
  29749. 0x2270,
  29750. "notparallel",
  29751. 0x2226,
  29752. "notprecedes",
  29753. 0x2280,
  29754. "notsubset",
  29755. 0x2284,
  29756. "notsucceeds",
  29757. 0x2281,
  29758. "notsuperset",
  29759. 0x2285,
  29760. "nowarmenian",
  29761. 0x0576,
  29762. "nparen",
  29763. 0x24a9,
  29764. "nssquare",
  29765. 0x33b1,
  29766. "nsuperior",
  29767. 0x207f,
  29768. "ntilde",
  29769. 0x00f1,
  29770. "nu",
  29771. 0x03bd,
  29772. "nuhiragana",
  29773. 0x306c,
  29774. "nukatakana",
  29775. 0x30cc,
  29776. "nukatakanahalfwidth",
  29777. 0xff87,
  29778. "nuktabengali",
  29779. 0x09bc,
  29780. "nuktadeva",
  29781. 0x093c,
  29782. "nuktagujarati",
  29783. 0x0abc,
  29784. "nuktagurmukhi",
  29785. 0x0a3c,
  29786. "numbersign",
  29787. 0x0023,
  29788. "numbersignmonospace",
  29789. 0xff03,
  29790. "numbersignsmall",
  29791. 0xfe5f,
  29792. "numeralsigngreek",
  29793. 0x0374,
  29794. "numeralsignlowergreek",
  29795. 0x0375,
  29796. "numero",
  29797. 0x2116,
  29798. "nun",
  29799. 0x05e0,
  29800. "nundagesh",
  29801. 0xfb40,
  29802. "nundageshhebrew",
  29803. 0xfb40,
  29804. "nunhebrew",
  29805. 0x05e0,
  29806. "nvsquare",
  29807. 0x33b5,
  29808. "nwsquare",
  29809. 0x33bb,
  29810. "nyabengali",
  29811. 0x099e,
  29812. "nyadeva",
  29813. 0x091e,
  29814. "nyagujarati",
  29815. 0x0a9e,
  29816. "nyagurmukhi",
  29817. 0x0a1e,
  29818. "o",
  29819. 0x006f,
  29820. "oacute",
  29821. 0x00f3,
  29822. "oangthai",
  29823. 0x0e2d,
  29824. "obarred",
  29825. 0x0275,
  29826. "obarredcyrillic",
  29827. 0x04e9,
  29828. "obarreddieresiscyrillic",
  29829. 0x04eb,
  29830. "obengali",
  29831. 0x0993,
  29832. "obopomofo",
  29833. 0x311b,
  29834. "obreve",
  29835. 0x014f,
  29836. "ocandradeva",
  29837. 0x0911,
  29838. "ocandragujarati",
  29839. 0x0a91,
  29840. "ocandravowelsigndeva",
  29841. 0x0949,
  29842. "ocandravowelsigngujarati",
  29843. 0x0ac9,
  29844. "ocaron",
  29845. 0x01d2,
  29846. "ocircle",
  29847. 0x24de,
  29848. "ocircumflex",
  29849. 0x00f4,
  29850. "ocircumflexacute",
  29851. 0x1ed1,
  29852. "ocircumflexdotbelow",
  29853. 0x1ed9,
  29854. "ocircumflexgrave",
  29855. 0x1ed3,
  29856. "ocircumflexhookabove",
  29857. 0x1ed5,
  29858. "ocircumflextilde",
  29859. 0x1ed7,
  29860. "ocyrillic",
  29861. 0x043e,
  29862. "odblacute",
  29863. 0x0151,
  29864. "odblgrave",
  29865. 0x020d,
  29866. "odeva",
  29867. 0x0913,
  29868. "odieresis",
  29869. 0x00f6,
  29870. "odieresiscyrillic",
  29871. 0x04e7,
  29872. "odotbelow",
  29873. 0x1ecd,
  29874. "oe",
  29875. 0x0153,
  29876. "oekorean",
  29877. 0x315a,
  29878. "ogonek",
  29879. 0x02db,
  29880. "ogonekcmb",
  29881. 0x0328,
  29882. "ograve",
  29883. 0x00f2,
  29884. "ogujarati",
  29885. 0x0a93,
  29886. "oharmenian",
  29887. 0x0585,
  29888. "ohiragana",
  29889. 0x304a,
  29890. "ohookabove",
  29891. 0x1ecf,
  29892. "ohorn",
  29893. 0x01a1,
  29894. "ohornacute",
  29895. 0x1edb,
  29896. "ohorndotbelow",
  29897. 0x1ee3,
  29898. "ohorngrave",
  29899. 0x1edd,
  29900. "ohornhookabove",
  29901. 0x1edf,
  29902. "ohorntilde",
  29903. 0x1ee1,
  29904. "ohungarumlaut",
  29905. 0x0151,
  29906. "oi",
  29907. 0x01a3,
  29908. "oinvertedbreve",
  29909. 0x020f,
  29910. "okatakana",
  29911. 0x30aa,
  29912. "okatakanahalfwidth",
  29913. 0xff75,
  29914. "okorean",
  29915. 0x3157,
  29916. "olehebrew",
  29917. 0x05ab,
  29918. "omacron",
  29919. 0x014d,
  29920. "omacronacute",
  29921. 0x1e53,
  29922. "omacrongrave",
  29923. 0x1e51,
  29924. "omdeva",
  29925. 0x0950,
  29926. "omega",
  29927. 0x03c9,
  29928. "omega1",
  29929. 0x03d6,
  29930. "omegacyrillic",
  29931. 0x0461,
  29932. "omegalatinclosed",
  29933. 0x0277,
  29934. "omegaroundcyrillic",
  29935. 0x047b,
  29936. "omegatitlocyrillic",
  29937. 0x047d,
  29938. "omegatonos",
  29939. 0x03ce,
  29940. "omgujarati",
  29941. 0x0ad0,
  29942. "omicron",
  29943. 0x03bf,
  29944. "omicrontonos",
  29945. 0x03cc,
  29946. "omonospace",
  29947. 0xff4f,
  29948. "one",
  29949. 0x0031,
  29950. "onearabic",
  29951. 0x0661,
  29952. "onebengali",
  29953. 0x09e7,
  29954. "onecircle",
  29955. 0x2460,
  29956. "onecircleinversesansserif",
  29957. 0x278a,
  29958. "onedeva",
  29959. 0x0967,
  29960. "onedotenleader",
  29961. 0x2024,
  29962. "oneeighth",
  29963. 0x215b,
  29964. "onefitted",
  29965. 0xf6dc,
  29966. "onegujarati",
  29967. 0x0ae7,
  29968. "onegurmukhi",
  29969. 0x0a67,
  29970. "onehackarabic",
  29971. 0x0661,
  29972. "onehalf",
  29973. 0x00bd,
  29974. "onehangzhou",
  29975. 0x3021,
  29976. "oneideographicparen",
  29977. 0x3220,
  29978. "oneinferior",
  29979. 0x2081,
  29980. "onemonospace",
  29981. 0xff11,
  29982. "onenumeratorbengali",
  29983. 0x09f4,
  29984. "oneoldstyle",
  29985. 0xf731,
  29986. "oneparen",
  29987. 0x2474,
  29988. "oneperiod",
  29989. 0x2488,
  29990. "onepersian",
  29991. 0x06f1,
  29992. "onequarter",
  29993. 0x00bc,
  29994. "oneroman",
  29995. 0x2170,
  29996. "onesuperior",
  29997. 0x00b9,
  29998. "onethai",
  29999. 0x0e51,
  30000. "onethird",
  30001. 0x2153,
  30002. "oogonek",
  30003. 0x01eb,
  30004. "oogonekmacron",
  30005. 0x01ed,
  30006. "oogurmukhi",
  30007. 0x0a13,
  30008. "oomatragurmukhi",
  30009. 0x0a4b,
  30010. "oopen",
  30011. 0x0254,
  30012. "oparen",
  30013. 0x24aa,
  30014. "openbullet",
  30015. 0x25e6,
  30016. "option",
  30017. 0x2325,
  30018. "ordfeminine",
  30019. 0x00aa,
  30020. "ordmasculine",
  30021. 0x00ba,
  30022. "orthogonal",
  30023. 0x221f,
  30024. "oshortdeva",
  30025. 0x0912,
  30026. "oshortvowelsigndeva",
  30027. 0x094a,
  30028. "oslash",
  30029. 0x00f8,
  30030. "oslashacute",
  30031. 0x01ff,
  30032. "osmallhiragana",
  30033. 0x3049,
  30034. "osmallkatakana",
  30035. 0x30a9,
  30036. "osmallkatakanahalfwidth",
  30037. 0xff6b,
  30038. "ostrokeacute",
  30039. 0x01ff,
  30040. "osuperior",
  30041. 0xf6f0,
  30042. "otcyrillic",
  30043. 0x047f,
  30044. "otilde",
  30045. 0x00f5,
  30046. "otildeacute",
  30047. 0x1e4d,
  30048. "otildedieresis",
  30049. 0x1e4f,
  30050. "oubopomofo",
  30051. 0x3121,
  30052. "overline",
  30053. 0x203e,
  30054. "overlinecenterline",
  30055. 0xfe4a,
  30056. "overlinecmb",
  30057. 0x0305,
  30058. "overlinedashed",
  30059. 0xfe49,
  30060. "overlinedblwavy",
  30061. 0xfe4c,
  30062. "overlinewavy",
  30063. 0xfe4b,
  30064. "overscore",
  30065. 0x00af,
  30066. "ovowelsignbengali",
  30067. 0x09cb,
  30068. "ovowelsigndeva",
  30069. 0x094b,
  30070. "ovowelsigngujarati",
  30071. 0x0acb,
  30072. "p",
  30073. 0x0070,
  30074. "paampssquare",
  30075. 0x3380,
  30076. "paasentosquare",
  30077. 0x332b,
  30078. "pabengali",
  30079. 0x09aa,
  30080. "pacute",
  30081. 0x1e55,
  30082. "padeva",
  30083. 0x092a,
  30084. "pagedown",
  30085. 0x21df,
  30086. "pageup",
  30087. 0x21de,
  30088. "pagujarati",
  30089. 0x0aaa,
  30090. "pagurmukhi",
  30091. 0x0a2a,
  30092. "pahiragana",
  30093. 0x3071,
  30094. "paiyannoithai",
  30095. 0x0e2f,
  30096. "pakatakana",
  30097. 0x30d1,
  30098. "palatalizationcyrilliccmb",
  30099. 0x0484,
  30100. "palochkacyrillic",
  30101. 0x04c0,
  30102. "pansioskorean",
  30103. 0x317f,
  30104. "paragraph",
  30105. 0x00b6,
  30106. "parallel",
  30107. 0x2225,
  30108. "parenleft",
  30109. 0x0028,
  30110. "parenleftaltonearabic",
  30111. 0xfd3e,
  30112. "parenleftbt",
  30113. 0xf8ed,
  30114. "parenleftex",
  30115. 0xf8ec,
  30116. "parenleftinferior",
  30117. 0x208d,
  30118. "parenleftmonospace",
  30119. 0xff08,
  30120. "parenleftsmall",
  30121. 0xfe59,
  30122. "parenleftsuperior",
  30123. 0x207d,
  30124. "parenlefttp",
  30125. 0xf8eb,
  30126. "parenleftvertical",
  30127. 0xfe35,
  30128. "parenright",
  30129. 0x0029,
  30130. "parenrightaltonearabic",
  30131. 0xfd3f,
  30132. "parenrightbt",
  30133. 0xf8f8,
  30134. "parenrightex",
  30135. 0xf8f7,
  30136. "parenrightinferior",
  30137. 0x208e,
  30138. "parenrightmonospace",
  30139. 0xff09,
  30140. "parenrightsmall",
  30141. 0xfe5a,
  30142. "parenrightsuperior",
  30143. 0x207e,
  30144. "parenrighttp",
  30145. 0xf8f6,
  30146. "parenrightvertical",
  30147. 0xfe36,
  30148. "partialdiff",
  30149. 0x2202,
  30150. "paseqhebrew",
  30151. 0x05c0,
  30152. "pashtahebrew",
  30153. 0x0599,
  30154. "pasquare",
  30155. 0x33a9,
  30156. "patah",
  30157. 0x05b7,
  30158. "patah11",
  30159. 0x05b7,
  30160. "patah1d",
  30161. 0x05b7,
  30162. "patah2a",
  30163. 0x05b7,
  30164. "patahhebrew",
  30165. 0x05b7,
  30166. "patahnarrowhebrew",
  30167. 0x05b7,
  30168. "patahquarterhebrew",
  30169. 0x05b7,
  30170. "patahwidehebrew",
  30171. 0x05b7,
  30172. "pazerhebrew",
  30173. 0x05a1,
  30174. "pbopomofo",
  30175. 0x3106,
  30176. "pcircle",
  30177. 0x24df,
  30178. "pdotaccent",
  30179. 0x1e57,
  30180. "pe",
  30181. 0x05e4,
  30182. "pecyrillic",
  30183. 0x043f,
  30184. "pedagesh",
  30185. 0xfb44,
  30186. "pedageshhebrew",
  30187. 0xfb44,
  30188. "peezisquare",
  30189. 0x333b,
  30190. "pefinaldageshhebrew",
  30191. 0xfb43,
  30192. "peharabic",
  30193. 0x067e,
  30194. "peharmenian",
  30195. 0x057a,
  30196. "pehebrew",
  30197. 0x05e4,
  30198. "pehfinalarabic",
  30199. 0xfb57,
  30200. "pehinitialarabic",
  30201. 0xfb58,
  30202. "pehiragana",
  30203. 0x307a,
  30204. "pehmedialarabic",
  30205. 0xfb59,
  30206. "pekatakana",
  30207. 0x30da,
  30208. "pemiddlehookcyrillic",
  30209. 0x04a7,
  30210. "perafehebrew",
  30211. 0xfb4e,
  30212. "percent",
  30213. 0x0025,
  30214. "percentarabic",
  30215. 0x066a,
  30216. "percentmonospace",
  30217. 0xff05,
  30218. "percentsmall",
  30219. 0xfe6a,
  30220. "period",
  30221. 0x002e,
  30222. "periodarmenian",
  30223. 0x0589,
  30224. "periodcentered",
  30225. 0x00b7,
  30226. "periodhalfwidth",
  30227. 0xff61,
  30228. "periodinferior",
  30229. 0xf6e7,
  30230. "periodmonospace",
  30231. 0xff0e,
  30232. "periodsmall",
  30233. 0xfe52,
  30234. "periodsuperior",
  30235. 0xf6e8,
  30236. "perispomenigreekcmb",
  30237. 0x0342,
  30238. "perpendicular",
  30239. 0x22a5,
  30240. "perthousand",
  30241. 0x2030,
  30242. "peseta",
  30243. 0x20a7,
  30244. "pfsquare",
  30245. 0x338a,
  30246. "phabengali",
  30247. 0x09ab,
  30248. "phadeva",
  30249. 0x092b,
  30250. "phagujarati",
  30251. 0x0aab,
  30252. "phagurmukhi",
  30253. 0x0a2b,
  30254. "phi",
  30255. 0x03c6,
  30256. "phi1",
  30257. 0x03d5,
  30258. "phieuphacirclekorean",
  30259. 0x327a,
  30260. "phieuphaparenkorean",
  30261. 0x321a,
  30262. "phieuphcirclekorean",
  30263. 0x326c,
  30264. "phieuphkorean",
  30265. 0x314d,
  30266. "phieuphparenkorean",
  30267. 0x320c,
  30268. "philatin",
  30269. 0x0278,
  30270. "phinthuthai",
  30271. 0x0e3a,
  30272. "phisymbolgreek",
  30273. 0x03d5,
  30274. "phook",
  30275. 0x01a5,
  30276. "phophanthai",
  30277. 0x0e1e,
  30278. "phophungthai",
  30279. 0x0e1c,
  30280. "phosamphaothai",
  30281. 0x0e20,
  30282. "pi",
  30283. 0x03c0,
  30284. "pieupacirclekorean",
  30285. 0x3273,
  30286. "pieupaparenkorean",
  30287. 0x3213,
  30288. "pieupcieuckorean",
  30289. 0x3176,
  30290. "pieupcirclekorean",
  30291. 0x3265,
  30292. "pieupkiyeokkorean",
  30293. 0x3172,
  30294. "pieupkorean",
  30295. 0x3142,
  30296. "pieupparenkorean",
  30297. 0x3205,
  30298. "pieupsioskiyeokkorean",
  30299. 0x3174,
  30300. "pieupsioskorean",
  30301. 0x3144,
  30302. "pieupsiostikeutkorean",
  30303. 0x3175,
  30304. "pieupthieuthkorean",
  30305. 0x3177,
  30306. "pieuptikeutkorean",
  30307. 0x3173,
  30308. "pihiragana",
  30309. 0x3074,
  30310. "pikatakana",
  30311. 0x30d4,
  30312. "pisymbolgreek",
  30313. 0x03d6,
  30314. "piwrarmenian",
  30315. 0x0583,
  30316. "plus",
  30317. 0x002b,
  30318. "plusbelowcmb",
  30319. 0x031f,
  30320. "pluscircle",
  30321. 0x2295,
  30322. "plusminus",
  30323. 0x00b1,
  30324. "plusmod",
  30325. 0x02d6,
  30326. "plusmonospace",
  30327. 0xff0b,
  30328. "plussmall",
  30329. 0xfe62,
  30330. "plussuperior",
  30331. 0x207a,
  30332. "pmonospace",
  30333. 0xff50,
  30334. "pmsquare",
  30335. 0x33d8,
  30336. "pohiragana",
  30337. 0x307d,
  30338. "pointingindexdownwhite",
  30339. 0x261f,
  30340. "pointingindexleftwhite",
  30341. 0x261c,
  30342. "pointingindexrightwhite",
  30343. 0x261e,
  30344. "pointingindexupwhite",
  30345. 0x261d,
  30346. "pokatakana",
  30347. 0x30dd,
  30348. "poplathai",
  30349. 0x0e1b,
  30350. "postalmark",
  30351. 0x3012,
  30352. "postalmarkface",
  30353. 0x3020,
  30354. "pparen",
  30355. 0x24ab,
  30356. "precedes",
  30357. 0x227a,
  30358. "prescription",
  30359. 0x211e,
  30360. "primemod",
  30361. 0x02b9,
  30362. "primereversed",
  30363. 0x2035,
  30364. "product",
  30365. 0x220f,
  30366. "projective",
  30367. 0x2305,
  30368. "prolongedkana",
  30369. 0x30fc,
  30370. "propellor",
  30371. 0x2318,
  30372. "propersubset",
  30373. 0x2282,
  30374. "propersuperset",
  30375. 0x2283,
  30376. "proportion",
  30377. 0x2237,
  30378. "proportional",
  30379. 0x221d,
  30380. "psi",
  30381. 0x03c8,
  30382. "psicyrillic",
  30383. 0x0471,
  30384. "psilipneumatacyrilliccmb",
  30385. 0x0486,
  30386. "pssquare",
  30387. 0x33b0,
  30388. "puhiragana",
  30389. 0x3077,
  30390. "pukatakana",
  30391. 0x30d7,
  30392. "pvsquare",
  30393. 0x33b4,
  30394. "pwsquare",
  30395. 0x33ba,
  30396. "q",
  30397. 0x0071,
  30398. "qadeva",
  30399. 0x0958,
  30400. "qadmahebrew",
  30401. 0x05a8,
  30402. "qafarabic",
  30403. 0x0642,
  30404. "qaffinalarabic",
  30405. 0xfed6,
  30406. "qafinitialarabic",
  30407. 0xfed7,
  30408. "qafmedialarabic",
  30409. 0xfed8,
  30410. "qamats",
  30411. 0x05b8,
  30412. "qamats10",
  30413. 0x05b8,
  30414. "qamats1a",
  30415. 0x05b8,
  30416. "qamats1c",
  30417. 0x05b8,
  30418. "qamats27",
  30419. 0x05b8,
  30420. "qamats29",
  30421. 0x05b8,
  30422. "qamats33",
  30423. 0x05b8,
  30424. "qamatsde",
  30425. 0x05b8,
  30426. "qamatshebrew",
  30427. 0x05b8,
  30428. "qamatsnarrowhebrew",
  30429. 0x05b8,
  30430. "qamatsqatanhebrew",
  30431. 0x05b8,
  30432. "qamatsqatannarrowhebrew",
  30433. 0x05b8,
  30434. "qamatsqatanquarterhebrew",
  30435. 0x05b8,
  30436. "qamatsqatanwidehebrew",
  30437. 0x05b8,
  30438. "qamatsquarterhebrew",
  30439. 0x05b8,
  30440. "qamatswidehebrew",
  30441. 0x05b8,
  30442. "qarneyparahebrew",
  30443. 0x059f,
  30444. "qbopomofo",
  30445. 0x3111,
  30446. "qcircle",
  30447. 0x24e0,
  30448. "qhook",
  30449. 0x02a0,
  30450. "qmonospace",
  30451. 0xff51,
  30452. "qof",
  30453. 0x05e7,
  30454. "qofdagesh",
  30455. 0xfb47,
  30456. "qofdageshhebrew",
  30457. 0xfb47,
  30458. "qofhebrew",
  30459. 0x05e7,
  30460. "qparen",
  30461. 0x24ac,
  30462. "quarternote",
  30463. 0x2669,
  30464. "qubuts",
  30465. 0x05bb,
  30466. "qubuts18",
  30467. 0x05bb,
  30468. "qubuts25",
  30469. 0x05bb,
  30470. "qubuts31",
  30471. 0x05bb,
  30472. "qubutshebrew",
  30473. 0x05bb,
  30474. "qubutsnarrowhebrew",
  30475. 0x05bb,
  30476. "qubutsquarterhebrew",
  30477. 0x05bb,
  30478. "qubutswidehebrew",
  30479. 0x05bb,
  30480. "question",
  30481. 0x003f,
  30482. "questionarabic",
  30483. 0x061f,
  30484. "questionarmenian",
  30485. 0x055e,
  30486. "questiondown",
  30487. 0x00bf,
  30488. "questiondownsmall",
  30489. 0xf7bf,
  30490. "questiongreek",
  30491. 0x037e,
  30492. "questionmonospace",
  30493. 0xff1f,
  30494. "questionsmall",
  30495. 0xf73f,
  30496. "quotedbl",
  30497. 0x0022,
  30498. "quotedblbase",
  30499. 0x201e,
  30500. "quotedblleft",
  30501. 0x201c,
  30502. "quotedblmonospace",
  30503. 0xff02,
  30504. "quotedblprime",
  30505. 0x301e,
  30506. "quotedblprimereversed",
  30507. 0x301d,
  30508. "quotedblright",
  30509. 0x201d,
  30510. "quoteleft",
  30511. 0x2018,
  30512. "quoteleftreversed",
  30513. 0x201b,
  30514. "quotereversed",
  30515. 0x201b,
  30516. "quoteright",
  30517. 0x2019,
  30518. "quoterightn",
  30519. 0x0149,
  30520. "quotesinglbase",
  30521. 0x201a,
  30522. "quotesingle",
  30523. 0x0027,
  30524. "quotesinglemonospace",
  30525. 0xff07,
  30526. "r",
  30527. 0x0072,
  30528. "raarmenian",
  30529. 0x057c,
  30530. "rabengali",
  30531. 0x09b0,
  30532. "racute",
  30533. 0x0155,
  30534. "radeva",
  30535. 0x0930,
  30536. "radical",
  30537. 0x221a,
  30538. "radicalex",
  30539. 0xf8e5,
  30540. "radoverssquare",
  30541. 0x33ae,
  30542. "radoverssquaredsquare",
  30543. 0x33af,
  30544. "radsquare",
  30545. 0x33ad,
  30546. "rafe",
  30547. 0x05bf,
  30548. "rafehebrew",
  30549. 0x05bf,
  30550. "ragujarati",
  30551. 0x0ab0,
  30552. "ragurmukhi",
  30553. 0x0a30,
  30554. "rahiragana",
  30555. 0x3089,
  30556. "rakatakana",
  30557. 0x30e9,
  30558. "rakatakanahalfwidth",
  30559. 0xff97,
  30560. "ralowerdiagonalbengali",
  30561. 0x09f1,
  30562. "ramiddlediagonalbengali",
  30563. 0x09f0,
  30564. "ramshorn",
  30565. 0x0264,
  30566. "ratio",
  30567. 0x2236,
  30568. "rbopomofo",
  30569. 0x3116,
  30570. "rcaron",
  30571. 0x0159,
  30572. "rcedilla",
  30573. 0x0157,
  30574. "rcircle",
  30575. 0x24e1,
  30576. "rcommaaccent",
  30577. 0x0157,
  30578. "rdblgrave",
  30579. 0x0211,
  30580. "rdotaccent",
  30581. 0x1e59,
  30582. "rdotbelow",
  30583. 0x1e5b,
  30584. "rdotbelowmacron",
  30585. 0x1e5d,
  30586. "referencemark",
  30587. 0x203b,
  30588. "reflexsubset",
  30589. 0x2286,
  30590. "reflexsuperset",
  30591. 0x2287,
  30592. "registered",
  30593. 0x00ae,
  30594. "registersans",
  30595. 0xf8e8,
  30596. "registerserif",
  30597. 0xf6da,
  30598. "reharabic",
  30599. 0x0631,
  30600. "reharmenian",
  30601. 0x0580,
  30602. "rehfinalarabic",
  30603. 0xfeae,
  30604. "rehiragana",
  30605. 0x308c,
  30606. "rekatakana",
  30607. 0x30ec,
  30608. "rekatakanahalfwidth",
  30609. 0xff9a,
  30610. "resh",
  30611. 0x05e8,
  30612. "reshdageshhebrew",
  30613. 0xfb48,
  30614. "reshhebrew",
  30615. 0x05e8,
  30616. "reversedtilde",
  30617. 0x223d,
  30618. "reviahebrew",
  30619. 0x0597,
  30620. "reviamugrashhebrew",
  30621. 0x0597,
  30622. "revlogicalnot",
  30623. 0x2310,
  30624. "rfishhook",
  30625. 0x027e,
  30626. "rfishhookreversed",
  30627. 0x027f,
  30628. "rhabengali",
  30629. 0x09dd,
  30630. "rhadeva",
  30631. 0x095d,
  30632. "rho",
  30633. 0x03c1,
  30634. "rhook",
  30635. 0x027d,
  30636. "rhookturned",
  30637. 0x027b,
  30638. "rhookturnedsuperior",
  30639. 0x02b5,
  30640. "rhosymbolgreek",
  30641. 0x03f1,
  30642. "rhotichookmod",
  30643. 0x02de,
  30644. "rieulacirclekorean",
  30645. 0x3271,
  30646. "rieulaparenkorean",
  30647. 0x3211,
  30648. "rieulcirclekorean",
  30649. 0x3263,
  30650. "rieulhieuhkorean",
  30651. 0x3140,
  30652. "rieulkiyeokkorean",
  30653. 0x313a,
  30654. "rieulkiyeoksioskorean",
  30655. 0x3169,
  30656. "rieulkorean",
  30657. 0x3139,
  30658. "rieulmieumkorean",
  30659. 0x313b,
  30660. "rieulpansioskorean",
  30661. 0x316c,
  30662. "rieulparenkorean",
  30663. 0x3203,
  30664. "rieulphieuphkorean",
  30665. 0x313f,
  30666. "rieulpieupkorean",
  30667. 0x313c,
  30668. "rieulpieupsioskorean",
  30669. 0x316b,
  30670. "rieulsioskorean",
  30671. 0x313d,
  30672. "rieulthieuthkorean",
  30673. 0x313e,
  30674. "rieultikeutkorean",
  30675. 0x316a,
  30676. "rieulyeorinhieuhkorean",
  30677. 0x316d,
  30678. "rightangle",
  30679. 0x221f,
  30680. "righttackbelowcmb",
  30681. 0x0319,
  30682. "righttriangle",
  30683. 0x22bf,
  30684. "rihiragana",
  30685. 0x308a,
  30686. "rikatakana",
  30687. 0x30ea,
  30688. "rikatakanahalfwidth",
  30689. 0xff98,
  30690. "ring",
  30691. 0x02da,
  30692. "ringbelowcmb",
  30693. 0x0325,
  30694. "ringcmb",
  30695. 0x030a,
  30696. "ringhalfleft",
  30697. 0x02bf,
  30698. "ringhalfleftarmenian",
  30699. 0x0559,
  30700. "ringhalfleftbelowcmb",
  30701. 0x031c,
  30702. "ringhalfleftcentered",
  30703. 0x02d3,
  30704. "ringhalfright",
  30705. 0x02be,
  30706. "ringhalfrightbelowcmb",
  30707. 0x0339,
  30708. "ringhalfrightcentered",
  30709. 0x02d2,
  30710. "rinvertedbreve",
  30711. 0x0213,
  30712. "rittorusquare",
  30713. 0x3351,
  30714. "rlinebelow",
  30715. 0x1e5f,
  30716. "rlongleg",
  30717. 0x027c,
  30718. "rlonglegturned",
  30719. 0x027a,
  30720. "rmonospace",
  30721. 0xff52,
  30722. "rohiragana",
  30723. 0x308d,
  30724. "rokatakana",
  30725. 0x30ed,
  30726. "rokatakanahalfwidth",
  30727. 0xff9b,
  30728. "roruathai",
  30729. 0x0e23,
  30730. "rparen",
  30731. 0x24ad,
  30732. "rrabengali",
  30733. 0x09dc,
  30734. "rradeva",
  30735. 0x0931,
  30736. "rragurmukhi",
  30737. 0x0a5c,
  30738. "rreharabic",
  30739. 0x0691,
  30740. "rrehfinalarabic",
  30741. 0xfb8d,
  30742. "rrvocalicbengali",
  30743. 0x09e0,
  30744. "rrvocalicdeva",
  30745. 0x0960,
  30746. "rrvocalicgujarati",
  30747. 0x0ae0,
  30748. "rrvocalicvowelsignbengali",
  30749. 0x09c4,
  30750. "rrvocalicvowelsigndeva",
  30751. 0x0944,
  30752. "rrvocalicvowelsigngujarati",
  30753. 0x0ac4,
  30754. "rsuperior",
  30755. 0xf6f1,
  30756. "rtblock",
  30757. 0x2590,
  30758. "rturned",
  30759. 0x0279,
  30760. "rturnedsuperior",
  30761. 0x02b4,
  30762. "ruhiragana",
  30763. 0x308b,
  30764. "rukatakana",
  30765. 0x30eb,
  30766. "rukatakanahalfwidth",
  30767. 0xff99,
  30768. "rupeemarkbengali",
  30769. 0x09f2,
  30770. "rupeesignbengali",
  30771. 0x09f3,
  30772. "rupiah",
  30773. 0xf6dd,
  30774. "ruthai",
  30775. 0x0e24,
  30776. "rvocalicbengali",
  30777. 0x098b,
  30778. "rvocalicdeva",
  30779. 0x090b,
  30780. "rvocalicgujarati",
  30781. 0x0a8b,
  30782. "rvocalicvowelsignbengali",
  30783. 0x09c3,
  30784. "rvocalicvowelsigndeva",
  30785. 0x0943,
  30786. "rvocalicvowelsigngujarati",
  30787. 0x0ac3,
  30788. "s",
  30789. 0x0073,
  30790. "sabengali",
  30791. 0x09b8,
  30792. "sacute",
  30793. 0x015b,
  30794. "sacutedotaccent",
  30795. 0x1e65,
  30796. "sadarabic",
  30797. 0x0635,
  30798. "sadeva",
  30799. 0x0938,
  30800. "sadfinalarabic",
  30801. 0xfeba,
  30802. "sadinitialarabic",
  30803. 0xfebb,
  30804. "sadmedialarabic",
  30805. 0xfebc,
  30806. "sagujarati",
  30807. 0x0ab8,
  30808. "sagurmukhi",
  30809. 0x0a38,
  30810. "sahiragana",
  30811. 0x3055,
  30812. "sakatakana",
  30813. 0x30b5,
  30814. "sakatakanahalfwidth",
  30815. 0xff7b,
  30816. "sallallahoualayhewasallamarabic",
  30817. 0xfdfa,
  30818. "samekh",
  30819. 0x05e1,
  30820. "samekhdagesh",
  30821. 0xfb41,
  30822. "samekhdageshhebrew",
  30823. 0xfb41,
  30824. "samekhhebrew",
  30825. 0x05e1,
  30826. "saraaathai",
  30827. 0x0e32,
  30828. "saraaethai",
  30829. 0x0e41,
  30830. "saraaimaimalaithai",
  30831. 0x0e44,
  30832. "saraaimaimuanthai",
  30833. 0x0e43,
  30834. "saraamthai",
  30835. 0x0e33,
  30836. "saraathai",
  30837. 0x0e30,
  30838. "saraethai",
  30839. 0x0e40,
  30840. "saraiileftthai",
  30841. 0xf886,
  30842. "saraiithai",
  30843. 0x0e35,
  30844. "saraileftthai",
  30845. 0xf885,
  30846. "saraithai",
  30847. 0x0e34,
  30848. "saraothai",
  30849. 0x0e42,
  30850. "saraueeleftthai",
  30851. 0xf888,
  30852. "saraueethai",
  30853. 0x0e37,
  30854. "saraueleftthai",
  30855. 0xf887,
  30856. "sarauethai",
  30857. 0x0e36,
  30858. "sarauthai",
  30859. 0x0e38,
  30860. "sarauuthai",
  30861. 0x0e39,
  30862. "sbopomofo",
  30863. 0x3119,
  30864. "scaron",
  30865. 0x0161,
  30866. "scarondotaccent",
  30867. 0x1e67,
  30868. "scedilla",
  30869. 0x015f,
  30870. "schwa",
  30871. 0x0259,
  30872. "schwacyrillic",
  30873. 0x04d9,
  30874. "schwadieresiscyrillic",
  30875. 0x04db,
  30876. "schwahook",
  30877. 0x025a,
  30878. "scircle",
  30879. 0x24e2,
  30880. "scircumflex",
  30881. 0x015d,
  30882. "scommaaccent",
  30883. 0x0219,
  30884. "sdotaccent",
  30885. 0x1e61,
  30886. "sdotbelow",
  30887. 0x1e63,
  30888. "sdotbelowdotaccent",
  30889. 0x1e69,
  30890. "seagullbelowcmb",
  30891. 0x033c,
  30892. "second",
  30893. 0x2033,
  30894. "secondtonechinese",
  30895. 0x02ca,
  30896. "section",
  30897. 0x00a7,
  30898. "seenarabic",
  30899. 0x0633,
  30900. "seenfinalarabic",
  30901. 0xfeb2,
  30902. "seeninitialarabic",
  30903. 0xfeb3,
  30904. "seenmedialarabic",
  30905. 0xfeb4,
  30906. "segol",
  30907. 0x05b6,
  30908. "segol13",
  30909. 0x05b6,
  30910. "segol1f",
  30911. 0x05b6,
  30912. "segol2c",
  30913. 0x05b6,
  30914. "segolhebrew",
  30915. 0x05b6,
  30916. "segolnarrowhebrew",
  30917. 0x05b6,
  30918. "segolquarterhebrew",
  30919. 0x05b6,
  30920. "segoltahebrew",
  30921. 0x0592,
  30922. "segolwidehebrew",
  30923. 0x05b6,
  30924. "seharmenian",
  30925. 0x057d,
  30926. "sehiragana",
  30927. 0x305b,
  30928. "sekatakana",
  30929. 0x30bb,
  30930. "sekatakanahalfwidth",
  30931. 0xff7e,
  30932. "semicolon",
  30933. 0x003b,
  30934. "semicolonarabic",
  30935. 0x061b,
  30936. "semicolonmonospace",
  30937. 0xff1b,
  30938. "semicolonsmall",
  30939. 0xfe54,
  30940. "semivoicedmarkkana",
  30941. 0x309c,
  30942. "semivoicedmarkkanahalfwidth",
  30943. 0xff9f,
  30944. "sentisquare",
  30945. 0x3322,
  30946. "sentosquare",
  30947. 0x3323,
  30948. "seven",
  30949. 0x0037,
  30950. "sevenarabic",
  30951. 0x0667,
  30952. "sevenbengali",
  30953. 0x09ed,
  30954. "sevencircle",
  30955. 0x2466,
  30956. "sevencircleinversesansserif",
  30957. 0x2790,
  30958. "sevendeva",
  30959. 0x096d,
  30960. "seveneighths",
  30961. 0x215e,
  30962. "sevengujarati",
  30963. 0x0aed,
  30964. "sevengurmukhi",
  30965. 0x0a6d,
  30966. "sevenhackarabic",
  30967. 0x0667,
  30968. "sevenhangzhou",
  30969. 0x3027,
  30970. "sevenideographicparen",
  30971. 0x3226,
  30972. "seveninferior",
  30973. 0x2087,
  30974. "sevenmonospace",
  30975. 0xff17,
  30976. "sevenoldstyle",
  30977. 0xf737,
  30978. "sevenparen",
  30979. 0x247a,
  30980. "sevenperiod",
  30981. 0x248e,
  30982. "sevenpersian",
  30983. 0x06f7,
  30984. "sevenroman",
  30985. 0x2176,
  30986. "sevensuperior",
  30987. 0x2077,
  30988. "seventeencircle",
  30989. 0x2470,
  30990. "seventeenparen",
  30991. 0x2484,
  30992. "seventeenperiod",
  30993. 0x2498,
  30994. "seventhai",
  30995. 0x0e57,
  30996. "sfthyphen",
  30997. 0x00ad,
  30998. "shaarmenian",
  30999. 0x0577,
  31000. "shabengali",
  31001. 0x09b6,
  31002. "shacyrillic",
  31003. 0x0448,
  31004. "shaddaarabic",
  31005. 0x0651,
  31006. "shaddadammaarabic",
  31007. 0xfc61,
  31008. "shaddadammatanarabic",
  31009. 0xfc5e,
  31010. "shaddafathaarabic",
  31011. 0xfc60,
  31012. "shaddakasraarabic",
  31013. 0xfc62,
  31014. "shaddakasratanarabic",
  31015. 0xfc5f,
  31016. "shade",
  31017. 0x2592,
  31018. "shadedark",
  31019. 0x2593,
  31020. "shadelight",
  31021. 0x2591,
  31022. "shademedium",
  31023. 0x2592,
  31024. "shadeva",
  31025. 0x0936,
  31026. "shagujarati",
  31027. 0x0ab6,
  31028. "shagurmukhi",
  31029. 0x0a36,
  31030. "shalshelethebrew",
  31031. 0x0593,
  31032. "shbopomofo",
  31033. 0x3115,
  31034. "shchacyrillic",
  31035. 0x0449,
  31036. "sheenarabic",
  31037. 0x0634,
  31038. "sheenfinalarabic",
  31039. 0xfeb6,
  31040. "sheeninitialarabic",
  31041. 0xfeb7,
  31042. "sheenmedialarabic",
  31043. 0xfeb8,
  31044. "sheicoptic",
  31045. 0x03e3,
  31046. "sheqel",
  31047. 0x20aa,
  31048. "sheqelhebrew",
  31049. 0x20aa,
  31050. "sheva",
  31051. 0x05b0,
  31052. "sheva115",
  31053. 0x05b0,
  31054. "sheva15",
  31055. 0x05b0,
  31056. "sheva22",
  31057. 0x05b0,
  31058. "sheva2e",
  31059. 0x05b0,
  31060. "shevahebrew",
  31061. 0x05b0,
  31062. "shevanarrowhebrew",
  31063. 0x05b0,
  31064. "shevaquarterhebrew",
  31065. 0x05b0,
  31066. "shevawidehebrew",
  31067. 0x05b0,
  31068. "shhacyrillic",
  31069. 0x04bb,
  31070. "shimacoptic",
  31071. 0x03ed,
  31072. "shin",
  31073. 0x05e9,
  31074. "shindagesh",
  31075. 0xfb49,
  31076. "shindageshhebrew",
  31077. 0xfb49,
  31078. "shindageshshindot",
  31079. 0xfb2c,
  31080. "shindageshshindothebrew",
  31081. 0xfb2c,
  31082. "shindageshsindot",
  31083. 0xfb2d,
  31084. "shindageshsindothebrew",
  31085. 0xfb2d,
  31086. "shindothebrew",
  31087. 0x05c1,
  31088. "shinhebrew",
  31089. 0x05e9,
  31090. "shinshindot",
  31091. 0xfb2a,
  31092. "shinshindothebrew",
  31093. 0xfb2a,
  31094. "shinsindot",
  31095. 0xfb2b,
  31096. "shinsindothebrew",
  31097. 0xfb2b,
  31098. "shook",
  31099. 0x0282,
  31100. "sigma",
  31101. 0x03c3,
  31102. "sigma1",
  31103. 0x03c2,
  31104. "sigmafinal",
  31105. 0x03c2,
  31106. "sigmalunatesymbolgreek",
  31107. 0x03f2,
  31108. "sihiragana",
  31109. 0x3057,
  31110. "sikatakana",
  31111. 0x30b7,
  31112. "sikatakanahalfwidth",
  31113. 0xff7c,
  31114. "siluqhebrew",
  31115. 0x05bd,
  31116. "siluqlefthebrew",
  31117. 0x05bd,
  31118. "similar",
  31119. 0x223c,
  31120. "sindothebrew",
  31121. 0x05c2,
  31122. "siosacirclekorean",
  31123. 0x3274,
  31124. "siosaparenkorean",
  31125. 0x3214,
  31126. "sioscieuckorean",
  31127. 0x317e,
  31128. "sioscirclekorean",
  31129. 0x3266,
  31130. "sioskiyeokkorean",
  31131. 0x317a,
  31132. "sioskorean",
  31133. 0x3145,
  31134. "siosnieunkorean",
  31135. 0x317b,
  31136. "siosparenkorean",
  31137. 0x3206,
  31138. "siospieupkorean",
  31139. 0x317d,
  31140. "siostikeutkorean",
  31141. 0x317c,
  31142. "six",
  31143. 0x0036,
  31144. "sixarabic",
  31145. 0x0666,
  31146. "sixbengali",
  31147. 0x09ec,
  31148. "sixcircle",
  31149. 0x2465,
  31150. "sixcircleinversesansserif",
  31151. 0x278f,
  31152. "sixdeva",
  31153. 0x096c,
  31154. "sixgujarati",
  31155. 0x0aec,
  31156. "sixgurmukhi",
  31157. 0x0a6c,
  31158. "sixhackarabic",
  31159. 0x0666,
  31160. "sixhangzhou",
  31161. 0x3026,
  31162. "sixideographicparen",
  31163. 0x3225,
  31164. "sixinferior",
  31165. 0x2086,
  31166. "sixmonospace",
  31167. 0xff16,
  31168. "sixoldstyle",
  31169. 0xf736,
  31170. "sixparen",
  31171. 0x2479,
  31172. "sixperiod",
  31173. 0x248d,
  31174. "sixpersian",
  31175. 0x06f6,
  31176. "sixroman",
  31177. 0x2175,
  31178. "sixsuperior",
  31179. 0x2076,
  31180. "sixteencircle",
  31181. 0x246f,
  31182. "sixteencurrencydenominatorbengali",
  31183. 0x09f9,
  31184. "sixteenparen",
  31185. 0x2483,
  31186. "sixteenperiod",
  31187. 0x2497,
  31188. "sixthai",
  31189. 0x0e56,
  31190. "slash",
  31191. 0x002f,
  31192. "slashmonospace",
  31193. 0xff0f,
  31194. "slong",
  31195. 0x017f,
  31196. "slongdotaccent",
  31197. 0x1e9b,
  31198. "smileface",
  31199. 0x263a,
  31200. "smonospace",
  31201. 0xff53,
  31202. "sofpasuqhebrew",
  31203. 0x05c3,
  31204. "softhyphen",
  31205. 0x00ad,
  31206. "softsigncyrillic",
  31207. 0x044c,
  31208. "sohiragana",
  31209. 0x305d,
  31210. "sokatakana",
  31211. 0x30bd,
  31212. "sokatakanahalfwidth",
  31213. 0xff7f,
  31214. "soliduslongoverlaycmb",
  31215. 0x0338,
  31216. "solidusshortoverlaycmb",
  31217. 0x0337,
  31218. "sorusithai",
  31219. 0x0e29,
  31220. "sosalathai",
  31221. 0x0e28,
  31222. "sosothai",
  31223. 0x0e0b,
  31224. "sosuathai",
  31225. 0x0e2a,
  31226. "space",
  31227. 0x0020,
  31228. "spacehackarabic",
  31229. 0x0020,
  31230. "spade",
  31231. 0x2660,
  31232. "spadesuitblack",
  31233. 0x2660,
  31234. "spadesuitwhite",
  31235. 0x2664,
  31236. "sparen",
  31237. 0x24ae,
  31238. "squarebelowcmb",
  31239. 0x033b,
  31240. "squarecc",
  31241. 0x33c4,
  31242. "squarecm",
  31243. 0x339d,
  31244. "squarediagonalcrosshatchfill",
  31245. 0x25a9,
  31246. "squarehorizontalfill",
  31247. 0x25a4,
  31248. "squarekg",
  31249. 0x338f,
  31250. "squarekm",
  31251. 0x339e,
  31252. "squarekmcapital",
  31253. 0x33ce,
  31254. "squareln",
  31255. 0x33d1,
  31256. "squarelog",
  31257. 0x33d2,
  31258. "squaremg",
  31259. 0x338e,
  31260. "squaremil",
  31261. 0x33d5,
  31262. "squaremm",
  31263. 0x339c,
  31264. "squaremsquared",
  31265. 0x33a1,
  31266. "squareorthogonalcrosshatchfill",
  31267. 0x25a6,
  31268. "squareupperlefttolowerrightfill",
  31269. 0x25a7,
  31270. "squareupperrighttolowerleftfill",
  31271. 0x25a8,
  31272. "squareverticalfill",
  31273. 0x25a5,
  31274. "squarewhitewithsmallblack",
  31275. 0x25a3,
  31276. "srsquare",
  31277. 0x33db,
  31278. "ssabengali",
  31279. 0x09b7,
  31280. "ssadeva",
  31281. 0x0937,
  31282. "ssagujarati",
  31283. 0x0ab7,
  31284. "ssangcieuckorean",
  31285. 0x3149,
  31286. "ssanghieuhkorean",
  31287. 0x3185,
  31288. "ssangieungkorean",
  31289. 0x3180,
  31290. "ssangkiyeokkorean",
  31291. 0x3132,
  31292. "ssangnieunkorean",
  31293. 0x3165,
  31294. "ssangpieupkorean",
  31295. 0x3143,
  31296. "ssangsioskorean",
  31297. 0x3146,
  31298. "ssangtikeutkorean",
  31299. 0x3138,
  31300. "ssuperior",
  31301. 0xf6f2,
  31302. "sterling",
  31303. 0x00a3,
  31304. "sterlingmonospace",
  31305. 0xffe1,
  31306. "strokelongoverlaycmb",
  31307. 0x0336,
  31308. "strokeshortoverlaycmb",
  31309. 0x0335,
  31310. "subset",
  31311. 0x2282,
  31312. "subsetnotequal",
  31313. 0x228a,
  31314. "subsetorequal",
  31315. 0x2286,
  31316. "succeeds",
  31317. 0x227b,
  31318. "suchthat",
  31319. 0x220b,
  31320. "suhiragana",
  31321. 0x3059,
  31322. "sukatakana",
  31323. 0x30b9,
  31324. "sukatakanahalfwidth",
  31325. 0xff7d,
  31326. "sukunarabic",
  31327. 0x0652,
  31328. "summation",
  31329. 0x2211,
  31330. "sun",
  31331. 0x263c,
  31332. "superset",
  31333. 0x2283,
  31334. "supersetnotequal",
  31335. 0x228b,
  31336. "supersetorequal",
  31337. 0x2287,
  31338. "svsquare",
  31339. 0x33dc,
  31340. "syouwaerasquare",
  31341. 0x337c,
  31342. "t",
  31343. 0x0074,
  31344. "tabengali",
  31345. 0x09a4,
  31346. "tackdown",
  31347. 0x22a4,
  31348. "tackleft",
  31349. 0x22a3,
  31350. "tadeva",
  31351. 0x0924,
  31352. "tagujarati",
  31353. 0x0aa4,
  31354. "tagurmukhi",
  31355. 0x0a24,
  31356. "taharabic",
  31357. 0x0637,
  31358. "tahfinalarabic",
  31359. 0xfec2,
  31360. "tahinitialarabic",
  31361. 0xfec3,
  31362. "tahiragana",
  31363. 0x305f,
  31364. "tahmedialarabic",
  31365. 0xfec4,
  31366. "taisyouerasquare",
  31367. 0x337d,
  31368. "takatakana",
  31369. 0x30bf,
  31370. "takatakanahalfwidth",
  31371. 0xff80,
  31372. "tatweelarabic",
  31373. 0x0640,
  31374. "tau",
  31375. 0x03c4,
  31376. "tav",
  31377. 0x05ea,
  31378. "tavdages",
  31379. 0xfb4a,
  31380. "tavdagesh",
  31381. 0xfb4a,
  31382. "tavdageshhebrew",
  31383. 0xfb4a,
  31384. "tavhebrew",
  31385. 0x05ea,
  31386. "tbar",
  31387. 0x0167,
  31388. "tbopomofo",
  31389. 0x310a,
  31390. "tcaron",
  31391. 0x0165,
  31392. "tccurl",
  31393. 0x02a8,
  31394. "tcedilla",
  31395. 0x0163,
  31396. "tcheharabic",
  31397. 0x0686,
  31398. "tchehfinalarabic",
  31399. 0xfb7b,
  31400. "tchehinitialarabic",
  31401. 0xfb7c,
  31402. "tchehmedialarabic",
  31403. 0xfb7d,
  31404. "tcircle",
  31405. 0x24e3,
  31406. "tcircumflexbelow",
  31407. 0x1e71,
  31408. "tcommaaccent",
  31409. 0x0163,
  31410. "tdieresis",
  31411. 0x1e97,
  31412. "tdotaccent",
  31413. 0x1e6b,
  31414. "tdotbelow",
  31415. 0x1e6d,
  31416. "tecyrillic",
  31417. 0x0442,
  31418. "tedescendercyrillic",
  31419. 0x04ad,
  31420. "teharabic",
  31421. 0x062a,
  31422. "tehfinalarabic",
  31423. 0xfe96,
  31424. "tehhahinitialarabic",
  31425. 0xfca2,
  31426. "tehhahisolatedarabic",
  31427. 0xfc0c,
  31428. "tehinitialarabic",
  31429. 0xfe97,
  31430. "tehiragana",
  31431. 0x3066,
  31432. "tehjeeminitialarabic",
  31433. 0xfca1,
  31434. "tehjeemisolatedarabic",
  31435. 0xfc0b,
  31436. "tehmarbutaarabic",
  31437. 0x0629,
  31438. "tehmarbutafinalarabic",
  31439. 0xfe94,
  31440. "tehmedialarabic",
  31441. 0xfe98,
  31442. "tehmeeminitialarabic",
  31443. 0xfca4,
  31444. "tehmeemisolatedarabic",
  31445. 0xfc0e,
  31446. "tehnoonfinalarabic",
  31447. 0xfc73,
  31448. "tekatakana",
  31449. 0x30c6,
  31450. "tekatakanahalfwidth",
  31451. 0xff83,
  31452. "telephone",
  31453. 0x2121,
  31454. "telephoneblack",
  31455. 0x260e,
  31456. "telishagedolahebrew",
  31457. 0x05a0,
  31458. "telishaqetanahebrew",
  31459. 0x05a9,
  31460. "tencircle",
  31461. 0x2469,
  31462. "tenideographicparen",
  31463. 0x3229,
  31464. "tenparen",
  31465. 0x247d,
  31466. "tenperiod",
  31467. 0x2491,
  31468. "tenroman",
  31469. 0x2179,
  31470. "tesh",
  31471. 0x02a7,
  31472. "tet",
  31473. 0x05d8,
  31474. "tetdagesh",
  31475. 0xfb38,
  31476. "tetdageshhebrew",
  31477. 0xfb38,
  31478. "tethebrew",
  31479. 0x05d8,
  31480. "tetsecyrillic",
  31481. 0x04b5,
  31482. "tevirhebrew",
  31483. 0x059b,
  31484. "tevirlefthebrew",
  31485. 0x059b,
  31486. "thabengali",
  31487. 0x09a5,
  31488. "thadeva",
  31489. 0x0925,
  31490. "thagujarati",
  31491. 0x0aa5,
  31492. "thagurmukhi",
  31493. 0x0a25,
  31494. "thalarabic",
  31495. 0x0630,
  31496. "thalfinalarabic",
  31497. 0xfeac,
  31498. "thanthakhatlowleftthai",
  31499. 0xf898,
  31500. "thanthakhatlowrightthai",
  31501. 0xf897,
  31502. "thanthakhatthai",
  31503. 0x0e4c,
  31504. "thanthakhatupperleftthai",
  31505. 0xf896,
  31506. "theharabic",
  31507. 0x062b,
  31508. "thehfinalarabic",
  31509. 0xfe9a,
  31510. "thehinitialarabic",
  31511. 0xfe9b,
  31512. "thehmedialarabic",
  31513. 0xfe9c,
  31514. "thereexists",
  31515. 0x2203,
  31516. "therefore",
  31517. 0x2234,
  31518. "theta",
  31519. 0x03b8,
  31520. "theta1",
  31521. 0x03d1,
  31522. "thetasymbolgreek",
  31523. 0x03d1,
  31524. "thieuthacirclekorean",
  31525. 0x3279,
  31526. "thieuthaparenkorean",
  31527. 0x3219,
  31528. "thieuthcirclekorean",
  31529. 0x326b,
  31530. "thieuthkorean",
  31531. 0x314c,
  31532. "thieuthparenkorean",
  31533. 0x320b,
  31534. "thirteencircle",
  31535. 0x246c,
  31536. "thirteenparen",
  31537. 0x2480,
  31538. "thirteenperiod",
  31539. 0x2494,
  31540. "thonangmonthothai",
  31541. 0x0e11,
  31542. "thook",
  31543. 0x01ad,
  31544. "thophuthaothai",
  31545. 0x0e12,
  31546. "thorn",
  31547. 0x00fe,
  31548. "thothahanthai",
  31549. 0x0e17,
  31550. "thothanthai",
  31551. 0x0e10,
  31552. "thothongthai",
  31553. 0x0e18,
  31554. "thothungthai",
  31555. 0x0e16,
  31556. "thousandcyrillic",
  31557. 0x0482,
  31558. "thousandsseparatorarabic",
  31559. 0x066c,
  31560. "thousandsseparatorpersian",
  31561. 0x066c,
  31562. "three",
  31563. 0x0033,
  31564. "threearabic",
  31565. 0x0663,
  31566. "threebengali",
  31567. 0x09e9,
  31568. "threecircle",
  31569. 0x2462,
  31570. "threecircleinversesansserif",
  31571. 0x278c,
  31572. "threedeva",
  31573. 0x0969,
  31574. "threeeighths",
  31575. 0x215c,
  31576. "threegujarati",
  31577. 0x0ae9,
  31578. "threegurmukhi",
  31579. 0x0a69,
  31580. "threehackarabic",
  31581. 0x0663,
  31582. "threehangzhou",
  31583. 0x3023,
  31584. "threeideographicparen",
  31585. 0x3222,
  31586. "threeinferior",
  31587. 0x2083,
  31588. "threemonospace",
  31589. 0xff13,
  31590. "threenumeratorbengali",
  31591. 0x09f6,
  31592. "threeoldstyle",
  31593. 0xf733,
  31594. "threeparen",
  31595. 0x2476,
  31596. "threeperiod",
  31597. 0x248a,
  31598. "threepersian",
  31599. 0x06f3,
  31600. "threequarters",
  31601. 0x00be,
  31602. "threequartersemdash",
  31603. 0xf6de,
  31604. "threeroman",
  31605. 0x2172,
  31606. "threesuperior",
  31607. 0x00b3,
  31608. "threethai",
  31609. 0x0e53,
  31610. "thzsquare",
  31611. 0x3394,
  31612. "tihiragana",
  31613. 0x3061,
  31614. "tikatakana",
  31615. 0x30c1,
  31616. "tikatakanahalfwidth",
  31617. 0xff81,
  31618. "tikeutacirclekorean",
  31619. 0x3270,
  31620. "tikeutaparenkorean",
  31621. 0x3210,
  31622. "tikeutcirclekorean",
  31623. 0x3262,
  31624. "tikeutkorean",
  31625. 0x3137,
  31626. "tikeutparenkorean",
  31627. 0x3202,
  31628. "tilde",
  31629. 0x02dc,
  31630. "tildebelowcmb",
  31631. 0x0330,
  31632. "tildecmb",
  31633. 0x0303,
  31634. "tildecomb",
  31635. 0x0303,
  31636. "tildedoublecmb",
  31637. 0x0360,
  31638. "tildeoperator",
  31639. 0x223c,
  31640. "tildeoverlaycmb",
  31641. 0x0334,
  31642. "tildeverticalcmb",
  31643. 0x033e,
  31644. "timescircle",
  31645. 0x2297,
  31646. "tipehahebrew",
  31647. 0x0596,
  31648. "tipehalefthebrew",
  31649. 0x0596,
  31650. "tippigurmukhi",
  31651. 0x0a70,
  31652. "titlocyrilliccmb",
  31653. 0x0483,
  31654. "tiwnarmenian",
  31655. 0x057f,
  31656. "tlinebelow",
  31657. 0x1e6f,
  31658. "tmonospace",
  31659. 0xff54,
  31660. "toarmenian",
  31661. 0x0569,
  31662. "tohiragana",
  31663. 0x3068,
  31664. "tokatakana",
  31665. 0x30c8,
  31666. "tokatakanahalfwidth",
  31667. 0xff84,
  31668. "tonebarextrahighmod",
  31669. 0x02e5,
  31670. "tonebarextralowmod",
  31671. 0x02e9,
  31672. "tonebarhighmod",
  31673. 0x02e6,
  31674. "tonebarlowmod",
  31675. 0x02e8,
  31676. "tonebarmidmod",
  31677. 0x02e7,
  31678. "tonefive",
  31679. 0x01bd,
  31680. "tonesix",
  31681. 0x0185,
  31682. "tonetwo",
  31683. 0x01a8,
  31684. "tonos",
  31685. 0x0384,
  31686. "tonsquare",
  31687. 0x3327,
  31688. "topatakthai",
  31689. 0x0e0f,
  31690. "tortoiseshellbracketleft",
  31691. 0x3014,
  31692. "tortoiseshellbracketleftsmall",
  31693. 0xfe5d,
  31694. "tortoiseshellbracketleftvertical",
  31695. 0xfe39,
  31696. "tortoiseshellbracketright",
  31697. 0x3015,
  31698. "tortoiseshellbracketrightsmall",
  31699. 0xfe5e,
  31700. "tortoiseshellbracketrightvertical",
  31701. 0xfe3a,
  31702. "totaothai",
  31703. 0x0e15,
  31704. "tpalatalhook",
  31705. 0x01ab,
  31706. "tparen",
  31707. 0x24af,
  31708. "trademark",
  31709. 0x2122,
  31710. "trademarksans",
  31711. 0xf8ea,
  31712. "trademarkserif",
  31713. 0xf6db,
  31714. "tretroflexhook",
  31715. 0x0288,
  31716. "triagdn",
  31717. 0x25bc,
  31718. "triaglf",
  31719. 0x25c4,
  31720. "triagrt",
  31721. 0x25ba,
  31722. "triagup",
  31723. 0x25b2,
  31724. "ts",
  31725. 0x02a6,
  31726. "tsadi",
  31727. 0x05e6,
  31728. "tsadidagesh",
  31729. 0xfb46,
  31730. "tsadidageshhebrew",
  31731. 0xfb46,
  31732. "tsadihebrew",
  31733. 0x05e6,
  31734. "tsecyrillic",
  31735. 0x0446,
  31736. "tsere",
  31737. 0x05b5,
  31738. "tsere12",
  31739. 0x05b5,
  31740. "tsere1e",
  31741. 0x05b5,
  31742. "tsere2b",
  31743. 0x05b5,
  31744. "tserehebrew",
  31745. 0x05b5,
  31746. "tserenarrowhebrew",
  31747. 0x05b5,
  31748. "tserequarterhebrew",
  31749. 0x05b5,
  31750. "tserewidehebrew",
  31751. 0x05b5,
  31752. "tshecyrillic",
  31753. 0x045b,
  31754. "tsuperior",
  31755. 0xf6f3,
  31756. "ttabengali",
  31757. 0x099f,
  31758. "ttadeva",
  31759. 0x091f,
  31760. "ttagujarati",
  31761. 0x0a9f,
  31762. "ttagurmukhi",
  31763. 0x0a1f,
  31764. "tteharabic",
  31765. 0x0679,
  31766. "ttehfinalarabic",
  31767. 0xfb67,
  31768. "ttehinitialarabic",
  31769. 0xfb68,
  31770. "ttehmedialarabic",
  31771. 0xfb69,
  31772. "tthabengali",
  31773. 0x09a0,
  31774. "tthadeva",
  31775. 0x0920,
  31776. "tthagujarati",
  31777. 0x0aa0,
  31778. "tthagurmukhi",
  31779. 0x0a20,
  31780. "tturned",
  31781. 0x0287,
  31782. "tuhiragana",
  31783. 0x3064,
  31784. "tukatakana",
  31785. 0x30c4,
  31786. "tukatakanahalfwidth",
  31787. 0xff82,
  31788. "tusmallhiragana",
  31789. 0x3063,
  31790. "tusmallkatakana",
  31791. 0x30c3,
  31792. "tusmallkatakanahalfwidth",
  31793. 0xff6f,
  31794. "twelvecircle",
  31795. 0x246b,
  31796. "twelveparen",
  31797. 0x247f,
  31798. "twelveperiod",
  31799. 0x2493,
  31800. "twelveroman",
  31801. 0x217b,
  31802. "twentycircle",
  31803. 0x2473,
  31804. "twentyhangzhou",
  31805. 0x5344,
  31806. "twentyparen",
  31807. 0x2487,
  31808. "twentyperiod",
  31809. 0x249b,
  31810. "two",
  31811. 0x0032,
  31812. "twoarabic",
  31813. 0x0662,
  31814. "twobengali",
  31815. 0x09e8,
  31816. "twocircle",
  31817. 0x2461,
  31818. "twocircleinversesansserif",
  31819. 0x278b,
  31820. "twodeva",
  31821. 0x0968,
  31822. "twodotenleader",
  31823. 0x2025,
  31824. "twodotleader",
  31825. 0x2025,
  31826. "twodotleadervertical",
  31827. 0xfe30,
  31828. "twogujarati",
  31829. 0x0ae8,
  31830. "twogurmukhi",
  31831. 0x0a68,
  31832. "twohackarabic",
  31833. 0x0662,
  31834. "twohangzhou",
  31835. 0x3022,
  31836. "twoideographicparen",
  31837. 0x3221,
  31838. "twoinferior",
  31839. 0x2082,
  31840. "twomonospace",
  31841. 0xff12,
  31842. "twonumeratorbengali",
  31843. 0x09f5,
  31844. "twooldstyle",
  31845. 0xf732,
  31846. "twoparen",
  31847. 0x2475,
  31848. "twoperiod",
  31849. 0x2489,
  31850. "twopersian",
  31851. 0x06f2,
  31852. "tworoman",
  31853. 0x2171,
  31854. "twostroke",
  31855. 0x01bb,
  31856. "twosuperior",
  31857. 0x00b2,
  31858. "twothai",
  31859. 0x0e52,
  31860. "twothirds",
  31861. 0x2154,
  31862. "u",
  31863. 0x0075,
  31864. "uacute",
  31865. 0x00fa,
  31866. "ubar",
  31867. 0x0289,
  31868. "ubengali",
  31869. 0x0989,
  31870. "ubopomofo",
  31871. 0x3128,
  31872. "ubreve",
  31873. 0x016d,
  31874. "ucaron",
  31875. 0x01d4,
  31876. "ucircle",
  31877. 0x24e4,
  31878. "ucircumflex",
  31879. 0x00fb,
  31880. "ucircumflexbelow",
  31881. 0x1e77,
  31882. "ucyrillic",
  31883. 0x0443,
  31884. "udattadeva",
  31885. 0x0951,
  31886. "udblacute",
  31887. 0x0171,
  31888. "udblgrave",
  31889. 0x0215,
  31890. "udeva",
  31891. 0x0909,
  31892. "udieresis",
  31893. 0x00fc,
  31894. "udieresisacute",
  31895. 0x01d8,
  31896. "udieresisbelow",
  31897. 0x1e73,
  31898. "udieresiscaron",
  31899. 0x01da,
  31900. "udieresiscyrillic",
  31901. 0x04f1,
  31902. "udieresisgrave",
  31903. 0x01dc,
  31904. "udieresismacron",
  31905. 0x01d6,
  31906. "udotbelow",
  31907. 0x1ee5,
  31908. "ugrave",
  31909. 0x00f9,
  31910. "ugujarati",
  31911. 0x0a89,
  31912. "ugurmukhi",
  31913. 0x0a09,
  31914. "uhiragana",
  31915. 0x3046,
  31916. "uhookabove",
  31917. 0x1ee7,
  31918. "uhorn",
  31919. 0x01b0,
  31920. "uhornacute",
  31921. 0x1ee9,
  31922. "uhorndotbelow",
  31923. 0x1ef1,
  31924. "uhorngrave",
  31925. 0x1eeb,
  31926. "uhornhookabove",
  31927. 0x1eed,
  31928. "uhorntilde",
  31929. 0x1eef,
  31930. "uhungarumlaut",
  31931. 0x0171,
  31932. "uhungarumlautcyrillic",
  31933. 0x04f3,
  31934. "uinvertedbreve",
  31935. 0x0217,
  31936. "ukatakana",
  31937. 0x30a6,
  31938. "ukatakanahalfwidth",
  31939. 0xff73,
  31940. "ukcyrillic",
  31941. 0x0479,
  31942. "ukorean",
  31943. 0x315c,
  31944. "umacron",
  31945. 0x016b,
  31946. "umacroncyrillic",
  31947. 0x04ef,
  31948. "umacrondieresis",
  31949. 0x1e7b,
  31950. "umatragurmukhi",
  31951. 0x0a41,
  31952. "umonospace",
  31953. 0xff55,
  31954. "underscore",
  31955. 0x005f,
  31956. "underscoredbl",
  31957. 0x2017,
  31958. "underscoremonospace",
  31959. 0xff3f,
  31960. "underscorevertical",
  31961. 0xfe33,
  31962. "underscorewavy",
  31963. 0xfe4f,
  31964. "union",
  31965. 0x222a,
  31966. "universal",
  31967. 0x2200,
  31968. "uogonek",
  31969. 0x0173,
  31970. "uparen",
  31971. 0x24b0,
  31972. "upblock",
  31973. 0x2580,
  31974. "upperdothebrew",
  31975. 0x05c4,
  31976. "upsilon",
  31977. 0x03c5,
  31978. "upsilondieresis",
  31979. 0x03cb,
  31980. "upsilondieresistonos",
  31981. 0x03b0,
  31982. "upsilonlatin",
  31983. 0x028a,
  31984. "upsilontonos",
  31985. 0x03cd,
  31986. "uptackbelowcmb",
  31987. 0x031d,
  31988. "uptackmod",
  31989. 0x02d4,
  31990. "uragurmukhi",
  31991. 0x0a73,
  31992. "uring",
  31993. 0x016f,
  31994. "ushortcyrillic",
  31995. 0x045e,
  31996. "usmallhiragana",
  31997. 0x3045,
  31998. "usmallkatakana",
  31999. 0x30a5,
  32000. "usmallkatakanahalfwidth",
  32001. 0xff69,
  32002. "ustraightcyrillic",
  32003. 0x04af,
  32004. "ustraightstrokecyrillic",
  32005. 0x04b1,
  32006. "utilde",
  32007. 0x0169,
  32008. "utildeacute",
  32009. 0x1e79,
  32010. "utildebelow",
  32011. 0x1e75,
  32012. "uubengali",
  32013. 0x098a,
  32014. "uudeva",
  32015. 0x090a,
  32016. "uugujarati",
  32017. 0x0a8a,
  32018. "uugurmukhi",
  32019. 0x0a0a,
  32020. "uumatragurmukhi",
  32021. 0x0a42,
  32022. "uuvowelsignbengali",
  32023. 0x09c2,
  32024. "uuvowelsigndeva",
  32025. 0x0942,
  32026. "uuvowelsigngujarati",
  32027. 0x0ac2,
  32028. "uvowelsignbengali",
  32029. 0x09c1,
  32030. "uvowelsigndeva",
  32031. 0x0941,
  32032. "uvowelsigngujarati",
  32033. 0x0ac1,
  32034. "v",
  32035. 0x0076,
  32036. "vadeva",
  32037. 0x0935,
  32038. "vagujarati",
  32039. 0x0ab5,
  32040. "vagurmukhi",
  32041. 0x0a35,
  32042. "vakatakana",
  32043. 0x30f7,
  32044. "vav",
  32045. 0x05d5,
  32046. "vavdagesh",
  32047. 0xfb35,
  32048. "vavdagesh65",
  32049. 0xfb35,
  32050. "vavdageshhebrew",
  32051. 0xfb35,
  32052. "vavhebrew",
  32053. 0x05d5,
  32054. "vavholam",
  32055. 0xfb4b,
  32056. "vavholamhebrew",
  32057. 0xfb4b,
  32058. "vavvavhebrew",
  32059. 0x05f0,
  32060. "vavyodhebrew",
  32061. 0x05f1,
  32062. "vcircle",
  32063. 0x24e5,
  32064. "vdotbelow",
  32065. 0x1e7f,
  32066. "vecyrillic",
  32067. 0x0432,
  32068. "veharabic",
  32069. 0x06a4,
  32070. "vehfinalarabic",
  32071. 0xfb6b,
  32072. "vehinitialarabic",
  32073. 0xfb6c,
  32074. "vehmedialarabic",
  32075. 0xfb6d,
  32076. "vekatakana",
  32077. 0x30f9,
  32078. "venus",
  32079. 0x2640,
  32080. "verticalbar",
  32081. 0x007c,
  32082. "verticallineabovecmb",
  32083. 0x030d,
  32084. "verticallinebelowcmb",
  32085. 0x0329,
  32086. "verticallinelowmod",
  32087. 0x02cc,
  32088. "verticallinemod",
  32089. 0x02c8,
  32090. "vewarmenian",
  32091. 0x057e,
  32092. "vhook",
  32093. 0x028b,
  32094. "vikatakana",
  32095. 0x30f8,
  32096. "viramabengali",
  32097. 0x09cd,
  32098. "viramadeva",
  32099. 0x094d,
  32100. "viramagujarati",
  32101. 0x0acd,
  32102. "visargabengali",
  32103. 0x0983,
  32104. "visargadeva",
  32105. 0x0903,
  32106. "visargagujarati",
  32107. 0x0a83,
  32108. "vmonospace",
  32109. 0xff56,
  32110. "voarmenian",
  32111. 0x0578,
  32112. "voicediterationhiragana",
  32113. 0x309e,
  32114. "voicediterationkatakana",
  32115. 0x30fe,
  32116. "voicedmarkkana",
  32117. 0x309b,
  32118. "voicedmarkkanahalfwidth",
  32119. 0xff9e,
  32120. "vokatakana",
  32121. 0x30fa,
  32122. "vparen",
  32123. 0x24b1,
  32124. "vtilde",
  32125. 0x1e7d,
  32126. "vturned",
  32127. 0x028c,
  32128. "vuhiragana",
  32129. 0x3094,
  32130. "vukatakana",
  32131. 0x30f4,
  32132. "w",
  32133. 0x0077,
  32134. "wacute",
  32135. 0x1e83,
  32136. "waekorean",
  32137. 0x3159,
  32138. "wahiragana",
  32139. 0x308f,
  32140. "wakatakana",
  32141. 0x30ef,
  32142. "wakatakanahalfwidth",
  32143. 0xff9c,
  32144. "wakorean",
  32145. 0x3158,
  32146. "wasmallhiragana",
  32147. 0x308e,
  32148. "wasmallkatakana",
  32149. 0x30ee,
  32150. "wattosquare",
  32151. 0x3357,
  32152. "wavedash",
  32153. 0x301c,
  32154. "wavyunderscorevertical",
  32155. 0xfe34,
  32156. "wawarabic",
  32157. 0x0648,
  32158. "wawfinalarabic",
  32159. 0xfeee,
  32160. "wawhamzaabovearabic",
  32161. 0x0624,
  32162. "wawhamzaabovefinalarabic",
  32163. 0xfe86,
  32164. "wbsquare",
  32165. 0x33dd,
  32166. "wcircle",
  32167. 0x24e6,
  32168. "wcircumflex",
  32169. 0x0175,
  32170. "wdieresis",
  32171. 0x1e85,
  32172. "wdotaccent",
  32173. 0x1e87,
  32174. "wdotbelow",
  32175. 0x1e89,
  32176. "wehiragana",
  32177. 0x3091,
  32178. "weierstrass",
  32179. 0x2118,
  32180. "wekatakana",
  32181. 0x30f1,
  32182. "wekorean",
  32183. 0x315e,
  32184. "weokorean",
  32185. 0x315d,
  32186. "wgrave",
  32187. 0x1e81,
  32188. "whitebullet",
  32189. 0x25e6,
  32190. "whitecircle",
  32191. 0x25cb,
  32192. "whitecircleinverse",
  32193. 0x25d9,
  32194. "whitecornerbracketleft",
  32195. 0x300e,
  32196. "whitecornerbracketleftvertical",
  32197. 0xfe43,
  32198. "whitecornerbracketright",
  32199. 0x300f,
  32200. "whitecornerbracketrightvertical",
  32201. 0xfe44,
  32202. "whitediamond",
  32203. 0x25c7,
  32204. "whitediamondcontainingblacksmalldiamond",
  32205. 0x25c8,
  32206. "whitedownpointingsmalltriangle",
  32207. 0x25bf,
  32208. "whitedownpointingtriangle",
  32209. 0x25bd,
  32210. "whiteleftpointingsmalltriangle",
  32211. 0x25c3,
  32212. "whiteleftpointingtriangle",
  32213. 0x25c1,
  32214. "whitelenticularbracketleft",
  32215. 0x3016,
  32216. "whitelenticularbracketright",
  32217. 0x3017,
  32218. "whiterightpointingsmalltriangle",
  32219. 0x25b9,
  32220. "whiterightpointingtriangle",
  32221. 0x25b7,
  32222. "whitesmallsquare",
  32223. 0x25ab,
  32224. "whitesmilingface",
  32225. 0x263a,
  32226. "whitesquare",
  32227. 0x25a1,
  32228. "whitestar",
  32229. 0x2606,
  32230. "whitetelephone",
  32231. 0x260f,
  32232. "whitetortoiseshellbracketleft",
  32233. 0x3018,
  32234. "whitetortoiseshellbracketright",
  32235. 0x3019,
  32236. "whiteuppointingsmalltriangle",
  32237. 0x25b5,
  32238. "whiteuppointingtriangle",
  32239. 0x25b3,
  32240. "wihiragana",
  32241. 0x3090,
  32242. "wikatakana",
  32243. 0x30f0,
  32244. "wikorean",
  32245. 0x315f,
  32246. "wmonospace",
  32247. 0xff57,
  32248. "wohiragana",
  32249. 0x3092,
  32250. "wokatakana",
  32251. 0x30f2,
  32252. "wokatakanahalfwidth",
  32253. 0xff66,
  32254. "won",
  32255. 0x20a9,
  32256. "wonmonospace",
  32257. 0xffe6,
  32258. "wowaenthai",
  32259. 0x0e27,
  32260. "wparen",
  32261. 0x24b2,
  32262. "wring",
  32263. 0x1e98,
  32264. "wsuperior",
  32265. 0x02b7,
  32266. "wturned",
  32267. 0x028d,
  32268. "wynn",
  32269. 0x01bf,
  32270. "x",
  32271. 0x0078,
  32272. "xabovecmb",
  32273. 0x033d,
  32274. "xbopomofo",
  32275. 0x3112,
  32276. "xcircle",
  32277. 0x24e7,
  32278. "xdieresis",
  32279. 0x1e8d,
  32280. "xdotaccent",
  32281. 0x1e8b,
  32282. "xeharmenian",
  32283. 0x056d,
  32284. "xi",
  32285. 0x03be,
  32286. "xmonospace",
  32287. 0xff58,
  32288. "xparen",
  32289. 0x24b3,
  32290. "xsuperior",
  32291. 0x02e3,
  32292. "y",
  32293. 0x0079,
  32294. "yaadosquare",
  32295. 0x334e,
  32296. "yabengali",
  32297. 0x09af,
  32298. "yacute",
  32299. 0x00fd,
  32300. "yadeva",
  32301. 0x092f,
  32302. "yaekorean",
  32303. 0x3152,
  32304. "yagujarati",
  32305. 0x0aaf,
  32306. "yagurmukhi",
  32307. 0x0a2f,
  32308. "yahiragana",
  32309. 0x3084,
  32310. "yakatakana",
  32311. 0x30e4,
  32312. "yakatakanahalfwidth",
  32313. 0xff94,
  32314. "yakorean",
  32315. 0x3151,
  32316. "yamakkanthai",
  32317. 0x0e4e,
  32318. "yasmallhiragana",
  32319. 0x3083,
  32320. "yasmallkatakana",
  32321. 0x30e3,
  32322. "yasmallkatakanahalfwidth",
  32323. 0xff6c,
  32324. "yatcyrillic",
  32325. 0x0463,
  32326. "ycircle",
  32327. 0x24e8,
  32328. "ycircumflex",
  32329. 0x0177,
  32330. "ydieresis",
  32331. 0x00ff,
  32332. "ydotaccent",
  32333. 0x1e8f,
  32334. "ydotbelow",
  32335. 0x1ef5,
  32336. "yeharabic",
  32337. 0x064a,
  32338. "yehbarreearabic",
  32339. 0x06d2,
  32340. "yehbarreefinalarabic",
  32341. 0xfbaf,
  32342. "yehfinalarabic",
  32343. 0xfef2,
  32344. "yehhamzaabovearabic",
  32345. 0x0626,
  32346. "yehhamzaabovefinalarabic",
  32347. 0xfe8a,
  32348. "yehhamzaaboveinitialarabic",
  32349. 0xfe8b,
  32350. "yehhamzaabovemedialarabic",
  32351. 0xfe8c,
  32352. "yehinitialarabic",
  32353. 0xfef3,
  32354. "yehmedialarabic",
  32355. 0xfef4,
  32356. "yehmeeminitialarabic",
  32357. 0xfcdd,
  32358. "yehmeemisolatedarabic",
  32359. 0xfc58,
  32360. "yehnoonfinalarabic",
  32361. 0xfc94,
  32362. "yehthreedotsbelowarabic",
  32363. 0x06d1,
  32364. "yekorean",
  32365. 0x3156,
  32366. "yen",
  32367. 0x00a5,
  32368. "yenmonospace",
  32369. 0xffe5,
  32370. "yeokorean",
  32371. 0x3155,
  32372. "yeorinhieuhkorean",
  32373. 0x3186,
  32374. "yerahbenyomohebrew",
  32375. 0x05aa,
  32376. "yerahbenyomolefthebrew",
  32377. 0x05aa,
  32378. "yericyrillic",
  32379. 0x044b,
  32380. "yerudieresiscyrillic",
  32381. 0x04f9,
  32382. "yesieungkorean",
  32383. 0x3181,
  32384. "yesieungpansioskorean",
  32385. 0x3183,
  32386. "yesieungsioskorean",
  32387. 0x3182,
  32388. "yetivhebrew",
  32389. 0x059a,
  32390. "ygrave",
  32391. 0x1ef3,
  32392. "yhook",
  32393. 0x01b4,
  32394. "yhookabove",
  32395. 0x1ef7,
  32396. "yiarmenian",
  32397. 0x0575,
  32398. "yicyrillic",
  32399. 0x0457,
  32400. "yikorean",
  32401. 0x3162,
  32402. "yinyang",
  32403. 0x262f,
  32404. "yiwnarmenian",
  32405. 0x0582,
  32406. "ymonospace",
  32407. 0xff59,
  32408. "yod",
  32409. 0x05d9,
  32410. "yoddagesh",
  32411. 0xfb39,
  32412. "yoddageshhebrew",
  32413. 0xfb39,
  32414. "yodhebrew",
  32415. 0x05d9,
  32416. "yodyodhebrew",
  32417. 0x05f2,
  32418. "yodyodpatahhebrew",
  32419. 0xfb1f,
  32420. "yohiragana",
  32421. 0x3088,
  32422. "yoikorean",
  32423. 0x3189,
  32424. "yokatakana",
  32425. 0x30e8,
  32426. "yokatakanahalfwidth",
  32427. 0xff96,
  32428. "yokorean",
  32429. 0x315b,
  32430. "yosmallhiragana",
  32431. 0x3087,
  32432. "yosmallkatakana",
  32433. 0x30e7,
  32434. "yosmallkatakanahalfwidth",
  32435. 0xff6e,
  32436. "yotgreek",
  32437. 0x03f3,
  32438. "yoyaekorean",
  32439. 0x3188,
  32440. "yoyakorean",
  32441. 0x3187,
  32442. "yoyakthai",
  32443. 0x0e22,
  32444. "yoyingthai",
  32445. 0x0e0d,
  32446. "yparen",
  32447. 0x24b4,
  32448. "ypogegrammeni",
  32449. 0x037a,
  32450. "ypogegrammenigreekcmb",
  32451. 0x0345,
  32452. "yr",
  32453. 0x01a6,
  32454. "yring",
  32455. 0x1e99,
  32456. "ysuperior",
  32457. 0x02b8,
  32458. "ytilde",
  32459. 0x1ef9,
  32460. "yturned",
  32461. 0x028e,
  32462. "yuhiragana",
  32463. 0x3086,
  32464. "yuikorean",
  32465. 0x318c,
  32466. "yukatakana",
  32467. 0x30e6,
  32468. "yukatakanahalfwidth",
  32469. 0xff95,
  32470. "yukorean",
  32471. 0x3160,
  32472. "yusbigcyrillic",
  32473. 0x046b,
  32474. "yusbigiotifiedcyrillic",
  32475. 0x046d,
  32476. "yuslittlecyrillic",
  32477. 0x0467,
  32478. "yuslittleiotifiedcyrillic",
  32479. 0x0469,
  32480. "yusmallhiragana",
  32481. 0x3085,
  32482. "yusmallkatakana",
  32483. 0x30e5,
  32484. "yusmallkatakanahalfwidth",
  32485. 0xff6d,
  32486. "yuyekorean",
  32487. 0x318b,
  32488. "yuyeokorean",
  32489. 0x318a,
  32490. "yyabengali",
  32491. 0x09df,
  32492. "yyadeva",
  32493. 0x095f,
  32494. "z",
  32495. 0x007a,
  32496. "zaarmenian",
  32497. 0x0566,
  32498. "zacute",
  32499. 0x017a,
  32500. "zadeva",
  32501. 0x095b,
  32502. "zagurmukhi",
  32503. 0x0a5b,
  32504. "zaharabic",
  32505. 0x0638,
  32506. "zahfinalarabic",
  32507. 0xfec6,
  32508. "zahinitialarabic",
  32509. 0xfec7,
  32510. "zahiragana",
  32511. 0x3056,
  32512. "zahmedialarabic",
  32513. 0xfec8,
  32514. "zainarabic",
  32515. 0x0632,
  32516. "zainfinalarabic",
  32517. 0xfeb0,
  32518. "zakatakana",
  32519. 0x30b6,
  32520. "zaqefgadolhebrew",
  32521. 0x0595,
  32522. "zaqefqatanhebrew",
  32523. 0x0594,
  32524. "zarqahebrew",
  32525. 0x0598,
  32526. "zayin",
  32527. 0x05d6,
  32528. "zayindagesh",
  32529. 0xfb36,
  32530. "zayindageshhebrew",
  32531. 0xfb36,
  32532. "zayinhebrew",
  32533. 0x05d6,
  32534. "zbopomofo",
  32535. 0x3117,
  32536. "zcaron",
  32537. 0x017e,
  32538. "zcircle",
  32539. 0x24e9,
  32540. "zcircumflex",
  32541. 0x1e91,
  32542. "zcurl",
  32543. 0x0291,
  32544. "zdot",
  32545. 0x017c,
  32546. "zdotaccent",
  32547. 0x017c,
  32548. "zdotbelow",
  32549. 0x1e93,
  32550. "zecyrillic",
  32551. 0x0437,
  32552. "zedescendercyrillic",
  32553. 0x0499,
  32554. "zedieresiscyrillic",
  32555. 0x04df,
  32556. "zehiragana",
  32557. 0x305c,
  32558. "zekatakana",
  32559. 0x30bc,
  32560. "zero",
  32561. 0x0030,
  32562. "zeroarabic",
  32563. 0x0660,
  32564. "zerobengali",
  32565. 0x09e6,
  32566. "zerodeva",
  32567. 0x0966,
  32568. "zerogujarati",
  32569. 0x0ae6,
  32570. "zerogurmukhi",
  32571. 0x0a66,
  32572. "zerohackarabic",
  32573. 0x0660,
  32574. "zeroinferior",
  32575. 0x2080,
  32576. "zeromonospace",
  32577. 0xff10,
  32578. "zerooldstyle",
  32579. 0xf730,
  32580. "zeropersian",
  32581. 0x06f0,
  32582. "zerosuperior",
  32583. 0x2070,
  32584. "zerothai",
  32585. 0x0e50,
  32586. "zerowidthjoiner",
  32587. 0xfeff,
  32588. "zerowidthnonjoiner",
  32589. 0x200c,
  32590. "zerowidthspace",
  32591. 0x200b,
  32592. "zeta",
  32593. 0x03b6,
  32594. "zhbopomofo",
  32595. 0x3113,
  32596. "zhearmenian",
  32597. 0x056a,
  32598. "zhebrevecyrillic",
  32599. 0x04c2,
  32600. "zhecyrillic",
  32601. 0x0436,
  32602. "zhedescendercyrillic",
  32603. 0x0497,
  32604. "zhedieresiscyrillic",
  32605. 0x04dd,
  32606. "zihiragana",
  32607. 0x3058,
  32608. "zikatakana",
  32609. 0x30b8,
  32610. "zinorhebrew",
  32611. 0x05ae,
  32612. "zlinebelow",
  32613. 0x1e95,
  32614. "zmonospace",
  32615. 0xff5a,
  32616. "zohiragana",
  32617. 0x305e,
  32618. "zokatakana",
  32619. 0x30be,
  32620. "zparen",
  32621. 0x24b5,
  32622. "zretroflexhook",
  32623. 0x0290,
  32624. "zstroke",
  32625. 0x01b6,
  32626. "zuhiragana",
  32627. 0x305a,
  32628. "zukatakana",
  32629. 0x30ba,
  32630. ".notdef",
  32631. 0x0000,
  32632. "angbracketleftbig",
  32633. 0x2329,
  32634. "angbracketleftBig",
  32635. 0x2329,
  32636. "angbracketleftbigg",
  32637. 0x2329,
  32638. "angbracketleftBigg",
  32639. 0x2329,
  32640. "angbracketrightBig",
  32641. 0x232a,
  32642. "angbracketrightbig",
  32643. 0x232a,
  32644. "angbracketrightBigg",
  32645. 0x232a,
  32646. "angbracketrightbigg",
  32647. 0x232a,
  32648. "arrowhookleft",
  32649. 0x21aa,
  32650. "arrowhookright",
  32651. 0x21a9,
  32652. "arrowlefttophalf",
  32653. 0x21bc,
  32654. "arrowleftbothalf",
  32655. 0x21bd,
  32656. "arrownortheast",
  32657. 0x2197,
  32658. "arrownorthwest",
  32659. 0x2196,
  32660. "arrowrighttophalf",
  32661. 0x21c0,
  32662. "arrowrightbothalf",
  32663. 0x21c1,
  32664. "arrowsoutheast",
  32665. 0x2198,
  32666. "arrowsouthwest",
  32667. 0x2199,
  32668. "backslashbig",
  32669. 0x2216,
  32670. "backslashBig",
  32671. 0x2216,
  32672. "backslashBigg",
  32673. 0x2216,
  32674. "backslashbigg",
  32675. 0x2216,
  32676. "bardbl",
  32677. 0x2016,
  32678. "bracehtipdownleft",
  32679. 0xfe37,
  32680. "bracehtipdownright",
  32681. 0xfe37,
  32682. "bracehtipupleft",
  32683. 0xfe38,
  32684. "bracehtipupright",
  32685. 0xfe38,
  32686. "braceleftBig",
  32687. 0x007b,
  32688. "braceleftbig",
  32689. 0x007b,
  32690. "braceleftbigg",
  32691. 0x007b,
  32692. "braceleftBigg",
  32693. 0x007b,
  32694. "bracerightBig",
  32695. 0x007d,
  32696. "bracerightbig",
  32697. 0x007d,
  32698. "bracerightbigg",
  32699. 0x007d,
  32700. "bracerightBigg",
  32701. 0x007d,
  32702. "bracketleftbig",
  32703. 0x005b,
  32704. "bracketleftBig",
  32705. 0x005b,
  32706. "bracketleftbigg",
  32707. 0x005b,
  32708. "bracketleftBigg",
  32709. 0x005b,
  32710. "bracketrightBig",
  32711. 0x005d,
  32712. "bracketrightbig",
  32713. 0x005d,
  32714. "bracketrightbigg",
  32715. 0x005d,
  32716. "bracketrightBigg",
  32717. 0x005d,
  32718. "ceilingleftbig",
  32719. 0x2308,
  32720. "ceilingleftBig",
  32721. 0x2308,
  32722. "ceilingleftBigg",
  32723. 0x2308,
  32724. "ceilingleftbigg",
  32725. 0x2308,
  32726. "ceilingrightbig",
  32727. 0x2309,
  32728. "ceilingrightBig",
  32729. 0x2309,
  32730. "ceilingrightbigg",
  32731. 0x2309,
  32732. "ceilingrightBigg",
  32733. 0x2309,
  32734. "circledotdisplay",
  32735. 0x2299,
  32736. "circledottext",
  32737. 0x2299,
  32738. "circlemultiplydisplay",
  32739. 0x2297,
  32740. "circlemultiplytext",
  32741. 0x2297,
  32742. "circleplusdisplay",
  32743. 0x2295,
  32744. "circleplustext",
  32745. 0x2295,
  32746. "contintegraldisplay",
  32747. 0x222e,
  32748. "contintegraltext",
  32749. 0x222e,
  32750. "coproductdisplay",
  32751. 0x2210,
  32752. "coproducttext",
  32753. 0x2210,
  32754. "floorleftBig",
  32755. 0x230a,
  32756. "floorleftbig",
  32757. 0x230a,
  32758. "floorleftbigg",
  32759. 0x230a,
  32760. "floorleftBigg",
  32761. 0x230a,
  32762. "floorrightbig",
  32763. 0x230b,
  32764. "floorrightBig",
  32765. 0x230b,
  32766. "floorrightBigg",
  32767. 0x230b,
  32768. "floorrightbigg",
  32769. 0x230b,
  32770. "hatwide",
  32771. 0x0302,
  32772. "hatwider",
  32773. 0x0302,
  32774. "hatwidest",
  32775. 0x0302,
  32776. "intercal",
  32777. 0x1d40,
  32778. "integraldisplay",
  32779. 0x222b,
  32780. "integraltext",
  32781. 0x222b,
  32782. "intersectiondisplay",
  32783. 0x22c2,
  32784. "intersectiontext",
  32785. 0x22c2,
  32786. "logicalanddisplay",
  32787. 0x2227,
  32788. "logicalandtext",
  32789. 0x2227,
  32790. "logicalordisplay",
  32791. 0x2228,
  32792. "logicalortext",
  32793. 0x2228,
  32794. "parenleftBig",
  32795. 0x0028,
  32796. "parenleftbig",
  32797. 0x0028,
  32798. "parenleftBigg",
  32799. 0x0028,
  32800. "parenleftbigg",
  32801. 0x0028,
  32802. "parenrightBig",
  32803. 0x0029,
  32804. "parenrightbig",
  32805. 0x0029,
  32806. "parenrightBigg",
  32807. 0x0029,
  32808. "parenrightbigg",
  32809. 0x0029,
  32810. "prime",
  32811. 0x2032,
  32812. "productdisplay",
  32813. 0x220f,
  32814. "producttext",
  32815. 0x220f,
  32816. "radicalbig",
  32817. 0x221a,
  32818. "radicalBig",
  32819. 0x221a,
  32820. "radicalBigg",
  32821. 0x221a,
  32822. "radicalbigg",
  32823. 0x221a,
  32824. "radicalbt",
  32825. 0x221a,
  32826. "radicaltp",
  32827. 0x221a,
  32828. "radicalvertex",
  32829. 0x221a,
  32830. "slashbig",
  32831. 0x002f,
  32832. "slashBig",
  32833. 0x002f,
  32834. "slashBigg",
  32835. 0x002f,
  32836. "slashbigg",
  32837. 0x002f,
  32838. "summationdisplay",
  32839. 0x2211,
  32840. "summationtext",
  32841. 0x2211,
  32842. "tildewide",
  32843. 0x02dc,
  32844. "tildewider",
  32845. 0x02dc,
  32846. "tildewidest",
  32847. 0x02dc,
  32848. "uniondisplay",
  32849. 0x22c3,
  32850. "unionmultidisplay",
  32851. 0x228e,
  32852. "unionmultitext",
  32853. 0x228e,
  32854. "unionsqdisplay",
  32855. 0x2294,
  32856. "unionsqtext",
  32857. 0x2294,
  32858. "uniontext",
  32859. 0x22c3,
  32860. "vextenddouble",
  32861. 0x2225,
  32862. "vextendsingle",
  32863. 0x2223
  32864. ];
  32865. });
  32866. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  32867. return [
  32868. "space",
  32869. 0x0020,
  32870. "a1",
  32871. 0x2701,
  32872. "a2",
  32873. 0x2702,
  32874. "a202",
  32875. 0x2703,
  32876. "a3",
  32877. 0x2704,
  32878. "a4",
  32879. 0x260e,
  32880. "a5",
  32881. 0x2706,
  32882. "a119",
  32883. 0x2707,
  32884. "a118",
  32885. 0x2708,
  32886. "a117",
  32887. 0x2709,
  32888. "a11",
  32889. 0x261b,
  32890. "a12",
  32891. 0x261e,
  32892. "a13",
  32893. 0x270c,
  32894. "a14",
  32895. 0x270d,
  32896. "a15",
  32897. 0x270e,
  32898. "a16",
  32899. 0x270f,
  32900. "a105",
  32901. 0x2710,
  32902. "a17",
  32903. 0x2711,
  32904. "a18",
  32905. 0x2712,
  32906. "a19",
  32907. 0x2713,
  32908. "a20",
  32909. 0x2714,
  32910. "a21",
  32911. 0x2715,
  32912. "a22",
  32913. 0x2716,
  32914. "a23",
  32915. 0x2717,
  32916. "a24",
  32917. 0x2718,
  32918. "a25",
  32919. 0x2719,
  32920. "a26",
  32921. 0x271a,
  32922. "a27",
  32923. 0x271b,
  32924. "a28",
  32925. 0x271c,
  32926. "a6",
  32927. 0x271d,
  32928. "a7",
  32929. 0x271e,
  32930. "a8",
  32931. 0x271f,
  32932. "a9",
  32933. 0x2720,
  32934. "a10",
  32935. 0x2721,
  32936. "a29",
  32937. 0x2722,
  32938. "a30",
  32939. 0x2723,
  32940. "a31",
  32941. 0x2724,
  32942. "a32",
  32943. 0x2725,
  32944. "a33",
  32945. 0x2726,
  32946. "a34",
  32947. 0x2727,
  32948. "a35",
  32949. 0x2605,
  32950. "a36",
  32951. 0x2729,
  32952. "a37",
  32953. 0x272a,
  32954. "a38",
  32955. 0x272b,
  32956. "a39",
  32957. 0x272c,
  32958. "a40",
  32959. 0x272d,
  32960. "a41",
  32961. 0x272e,
  32962. "a42",
  32963. 0x272f,
  32964. "a43",
  32965. 0x2730,
  32966. "a44",
  32967. 0x2731,
  32968. "a45",
  32969. 0x2732,
  32970. "a46",
  32971. 0x2733,
  32972. "a47",
  32973. 0x2734,
  32974. "a48",
  32975. 0x2735,
  32976. "a49",
  32977. 0x2736,
  32978. "a50",
  32979. 0x2737,
  32980. "a51",
  32981. 0x2738,
  32982. "a52",
  32983. 0x2739,
  32984. "a53",
  32985. 0x273a,
  32986. "a54",
  32987. 0x273b,
  32988. "a55",
  32989. 0x273c,
  32990. "a56",
  32991. 0x273d,
  32992. "a57",
  32993. 0x273e,
  32994. "a58",
  32995. 0x273f,
  32996. "a59",
  32997. 0x2740,
  32998. "a60",
  32999. 0x2741,
  33000. "a61",
  33001. 0x2742,
  33002. "a62",
  33003. 0x2743,
  33004. "a63",
  33005. 0x2744,
  33006. "a64",
  33007. 0x2745,
  33008. "a65",
  33009. 0x2746,
  33010. "a66",
  33011. 0x2747,
  33012. "a67",
  33013. 0x2748,
  33014. "a68",
  33015. 0x2749,
  33016. "a69",
  33017. 0x274a,
  33018. "a70",
  33019. 0x274b,
  33020. "a71",
  33021. 0x25cf,
  33022. "a72",
  33023. 0x274d,
  33024. "a73",
  33025. 0x25a0,
  33026. "a74",
  33027. 0x274f,
  33028. "a203",
  33029. 0x2750,
  33030. "a75",
  33031. 0x2751,
  33032. "a204",
  33033. 0x2752,
  33034. "a76",
  33035. 0x25b2,
  33036. "a77",
  33037. 0x25bc,
  33038. "a78",
  33039. 0x25c6,
  33040. "a79",
  33041. 0x2756,
  33042. "a81",
  33043. 0x25d7,
  33044. "a82",
  33045. 0x2758,
  33046. "a83",
  33047. 0x2759,
  33048. "a84",
  33049. 0x275a,
  33050. "a97",
  33051. 0x275b,
  33052. "a98",
  33053. 0x275c,
  33054. "a99",
  33055. 0x275d,
  33056. "a100",
  33057. 0x275e,
  33058. "a101",
  33059. 0x2761,
  33060. "a102",
  33061. 0x2762,
  33062. "a103",
  33063. 0x2763,
  33064. "a104",
  33065. 0x2764,
  33066. "a106",
  33067. 0x2765,
  33068. "a107",
  33069. 0x2766,
  33070. "a108",
  33071. 0x2767,
  33072. "a112",
  33073. 0x2663,
  33074. "a111",
  33075. 0x2666,
  33076. "a110",
  33077. 0x2665,
  33078. "a109",
  33079. 0x2660,
  33080. "a120",
  33081. 0x2460,
  33082. "a121",
  33083. 0x2461,
  33084. "a122",
  33085. 0x2462,
  33086. "a123",
  33087. 0x2463,
  33088. "a124",
  33089. 0x2464,
  33090. "a125",
  33091. 0x2465,
  33092. "a126",
  33093. 0x2466,
  33094. "a127",
  33095. 0x2467,
  33096. "a128",
  33097. 0x2468,
  33098. "a129",
  33099. 0x2469,
  33100. "a130",
  33101. 0x2776,
  33102. "a131",
  33103. 0x2777,
  33104. "a132",
  33105. 0x2778,
  33106. "a133",
  33107. 0x2779,
  33108. "a134",
  33109. 0x277a,
  33110. "a135",
  33111. 0x277b,
  33112. "a136",
  33113. 0x277c,
  33114. "a137",
  33115. 0x277d,
  33116. "a138",
  33117. 0x277e,
  33118. "a139",
  33119. 0x277f,
  33120. "a140",
  33121. 0x2780,
  33122. "a141",
  33123. 0x2781,
  33124. "a142",
  33125. 0x2782,
  33126. "a143",
  33127. 0x2783,
  33128. "a144",
  33129. 0x2784,
  33130. "a145",
  33131. 0x2785,
  33132. "a146",
  33133. 0x2786,
  33134. "a147",
  33135. 0x2787,
  33136. "a148",
  33137. 0x2788,
  33138. "a149",
  33139. 0x2789,
  33140. "a150",
  33141. 0x278a,
  33142. "a151",
  33143. 0x278b,
  33144. "a152",
  33145. 0x278c,
  33146. "a153",
  33147. 0x278d,
  33148. "a154",
  33149. 0x278e,
  33150. "a155",
  33151. 0x278f,
  33152. "a156",
  33153. 0x2790,
  33154. "a157",
  33155. 0x2791,
  33156. "a158",
  33157. 0x2792,
  33158. "a159",
  33159. 0x2793,
  33160. "a160",
  33161. 0x2794,
  33162. "a161",
  33163. 0x2192,
  33164. "a163",
  33165. 0x2194,
  33166. "a164",
  33167. 0x2195,
  33168. "a196",
  33169. 0x2798,
  33170. "a165",
  33171. 0x2799,
  33172. "a192",
  33173. 0x279a,
  33174. "a166",
  33175. 0x279b,
  33176. "a167",
  33177. 0x279c,
  33178. "a168",
  33179. 0x279d,
  33180. "a169",
  33181. 0x279e,
  33182. "a170",
  33183. 0x279f,
  33184. "a171",
  33185. 0x27a0,
  33186. "a172",
  33187. 0x27a1,
  33188. "a173",
  33189. 0x27a2,
  33190. "a162",
  33191. 0x27a3,
  33192. "a174",
  33193. 0x27a4,
  33194. "a175",
  33195. 0x27a5,
  33196. "a176",
  33197. 0x27a6,
  33198. "a177",
  33199. 0x27a7,
  33200. "a178",
  33201. 0x27a8,
  33202. "a179",
  33203. 0x27a9,
  33204. "a193",
  33205. 0x27aa,
  33206. "a180",
  33207. 0x27ab,
  33208. "a199",
  33209. 0x27ac,
  33210. "a181",
  33211. 0x27ad,
  33212. "a200",
  33213. 0x27ae,
  33214. "a182",
  33215. 0x27af,
  33216. "a201",
  33217. 0x27b1,
  33218. "a183",
  33219. 0x27b2,
  33220. "a184",
  33221. 0x27b3,
  33222. "a197",
  33223. 0x27b4,
  33224. "a185",
  33225. 0x27b5,
  33226. "a194",
  33227. 0x27b6,
  33228. "a198",
  33229. 0x27b7,
  33230. "a186",
  33231. 0x27b8,
  33232. "a195",
  33233. 0x27b9,
  33234. "a187",
  33235. 0x27ba,
  33236. "a188",
  33237. 0x27bb,
  33238. "a189",
  33239. 0x27bc,
  33240. "a190",
  33241. 0x27bd,
  33242. "a191",
  33243. 0x27be,
  33244. "a89",
  33245. 0x2768,
  33246. "a90",
  33247. 0x2769,
  33248. "a93",
  33249. 0x276a,
  33250. "a94",
  33251. 0x276b,
  33252. "a91",
  33253. 0x276c,
  33254. "a92",
  33255. 0x276d,
  33256. "a205",
  33257. 0x276e,
  33258. "a85",
  33259. 0x276f,
  33260. "a206",
  33261. 0x2770,
  33262. "a86",
  33263. 0x2771,
  33264. "a87",
  33265. 0x2772,
  33266. "a88",
  33267. 0x2773,
  33268. "a95",
  33269. 0x2774,
  33270. "a96",
  33271. 0x2775,
  33272. ".notdef",
  33273. 0x0000
  33274. ];
  33275. });
  33276. /***/ }),
  33277. /* 40 */
  33278. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  33279. __w_pdfjs_require__.r(__webpack_exports__);
  33280. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  33281. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  33282. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  33283. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  33284. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  33285. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  33286. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  33287. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  33288. /* harmony export */ });
  33289. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(6);
  33290. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  33291. t[63721] = 0x00a9;
  33292. t[63193] = 0x00a9;
  33293. t[63720] = 0x00ae;
  33294. t[63194] = 0x00ae;
  33295. t[63722] = 0x2122;
  33296. t[63195] = 0x2122;
  33297. t[63729] = 0x23a7;
  33298. t[63730] = 0x23a8;
  33299. t[63731] = 0x23a9;
  33300. t[63740] = 0x23ab;
  33301. t[63741] = 0x23ac;
  33302. t[63742] = 0x23ad;
  33303. t[63726] = 0x23a1;
  33304. t[63727] = 0x23a2;
  33305. t[63728] = 0x23a3;
  33306. t[63737] = 0x23a4;
  33307. t[63738] = 0x23a5;
  33308. t[63739] = 0x23a6;
  33309. t[63723] = 0x239b;
  33310. t[63724] = 0x239c;
  33311. t[63725] = 0x239d;
  33312. t[63734] = 0x239e;
  33313. t[63735] = 0x239f;
  33314. t[63736] = 0x23a0;
  33315. });
  33316. function mapSpecialUnicodeValues(code) {
  33317. if (code >= 0xfff0 && code <= 0xffff) {
  33318. return 0;
  33319. } else if (code >= 0xf600 && code <= 0xf8ff) {
  33320. return getSpecialPUASymbols()[code] || code;
  33321. } else if (code === 0x00ad) {
  33322. return 0x002d;
  33323. }
  33324. return code;
  33325. }
  33326. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33327. let unicode = glyphsUnicodeMap[name];
  33328. if (unicode !== undefined) {
  33329. return unicode;
  33330. }
  33331. if (!name) {
  33332. return -1;
  33333. }
  33334. if (name[0] === "u") {
  33335. const nameLen = name.length;
  33336. let hexStr;
  33337. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  33338. hexStr = name.substring(3);
  33339. } else if (nameLen >= 5 && nameLen <= 7) {
  33340. hexStr = name.substring(1);
  33341. } else {
  33342. return -1;
  33343. }
  33344. if (hexStr === hexStr.toUpperCase()) {
  33345. unicode = parseInt(hexStr, 16);
  33346. if (unicode >= 0) {
  33347. return unicode;
  33348. }
  33349. }
  33350. }
  33351. return -1;
  33352. }
  33353. const UnicodeRanges = [
  33354. {
  33355. begin: 0x0000,
  33356. end: 0x007f
  33357. },
  33358. {
  33359. begin: 0x0080,
  33360. end: 0x00ff
  33361. },
  33362. {
  33363. begin: 0x0100,
  33364. end: 0x017f
  33365. },
  33366. {
  33367. begin: 0x0180,
  33368. end: 0x024f
  33369. },
  33370. {
  33371. begin: 0x0250,
  33372. end: 0x02af
  33373. },
  33374. {
  33375. begin: 0x02b0,
  33376. end: 0x02ff
  33377. },
  33378. {
  33379. begin: 0x0300,
  33380. end: 0x036f
  33381. },
  33382. {
  33383. begin: 0x0370,
  33384. end: 0x03ff
  33385. },
  33386. {
  33387. begin: 0x2c80,
  33388. end: 0x2cff
  33389. },
  33390. {
  33391. begin: 0x0400,
  33392. end: 0x04ff
  33393. },
  33394. {
  33395. begin: 0x0530,
  33396. end: 0x058f
  33397. },
  33398. {
  33399. begin: 0x0590,
  33400. end: 0x05ff
  33401. },
  33402. {
  33403. begin: 0xa500,
  33404. end: 0xa63f
  33405. },
  33406. {
  33407. begin: 0x0600,
  33408. end: 0x06ff
  33409. },
  33410. {
  33411. begin: 0x07c0,
  33412. end: 0x07ff
  33413. },
  33414. {
  33415. begin: 0x0900,
  33416. end: 0x097f
  33417. },
  33418. {
  33419. begin: 0x0980,
  33420. end: 0x09ff
  33421. },
  33422. {
  33423. begin: 0x0a00,
  33424. end: 0x0a7f
  33425. },
  33426. {
  33427. begin: 0x0a80,
  33428. end: 0x0aff
  33429. },
  33430. {
  33431. begin: 0x0b00,
  33432. end: 0x0b7f
  33433. },
  33434. {
  33435. begin: 0x0b80,
  33436. end: 0x0bff
  33437. },
  33438. {
  33439. begin: 0x0c00,
  33440. end: 0x0c7f
  33441. },
  33442. {
  33443. begin: 0x0c80,
  33444. end: 0x0cff
  33445. },
  33446. {
  33447. begin: 0x0d00,
  33448. end: 0x0d7f
  33449. },
  33450. {
  33451. begin: 0x0e00,
  33452. end: 0x0e7f
  33453. },
  33454. {
  33455. begin: 0x0e80,
  33456. end: 0x0eff
  33457. },
  33458. {
  33459. begin: 0x10a0,
  33460. end: 0x10ff
  33461. },
  33462. {
  33463. begin: 0x1b00,
  33464. end: 0x1b7f
  33465. },
  33466. {
  33467. begin: 0x1100,
  33468. end: 0x11ff
  33469. },
  33470. {
  33471. begin: 0x1e00,
  33472. end: 0x1eff
  33473. },
  33474. {
  33475. begin: 0x1f00,
  33476. end: 0x1fff
  33477. },
  33478. {
  33479. begin: 0x2000,
  33480. end: 0x206f
  33481. },
  33482. {
  33483. begin: 0x2070,
  33484. end: 0x209f
  33485. },
  33486. {
  33487. begin: 0x20a0,
  33488. end: 0x20cf
  33489. },
  33490. {
  33491. begin: 0x20d0,
  33492. end: 0x20ff
  33493. },
  33494. {
  33495. begin: 0x2100,
  33496. end: 0x214f
  33497. },
  33498. {
  33499. begin: 0x2150,
  33500. end: 0x218f
  33501. },
  33502. {
  33503. begin: 0x2190,
  33504. end: 0x21ff
  33505. },
  33506. {
  33507. begin: 0x2200,
  33508. end: 0x22ff
  33509. },
  33510. {
  33511. begin: 0x2300,
  33512. end: 0x23ff
  33513. },
  33514. {
  33515. begin: 0x2400,
  33516. end: 0x243f
  33517. },
  33518. {
  33519. begin: 0x2440,
  33520. end: 0x245f
  33521. },
  33522. {
  33523. begin: 0x2460,
  33524. end: 0x24ff
  33525. },
  33526. {
  33527. begin: 0x2500,
  33528. end: 0x257f
  33529. },
  33530. {
  33531. begin: 0x2580,
  33532. end: 0x259f
  33533. },
  33534. {
  33535. begin: 0x25a0,
  33536. end: 0x25ff
  33537. },
  33538. {
  33539. begin: 0x2600,
  33540. end: 0x26ff
  33541. },
  33542. {
  33543. begin: 0x2700,
  33544. end: 0x27bf
  33545. },
  33546. {
  33547. begin: 0x3000,
  33548. end: 0x303f
  33549. },
  33550. {
  33551. begin: 0x3040,
  33552. end: 0x309f
  33553. },
  33554. {
  33555. begin: 0x30a0,
  33556. end: 0x30ff
  33557. },
  33558. {
  33559. begin: 0x3100,
  33560. end: 0x312f
  33561. },
  33562. {
  33563. begin: 0x3130,
  33564. end: 0x318f
  33565. },
  33566. {
  33567. begin: 0xa840,
  33568. end: 0xa87f
  33569. },
  33570. {
  33571. begin: 0x3200,
  33572. end: 0x32ff
  33573. },
  33574. {
  33575. begin: 0x3300,
  33576. end: 0x33ff
  33577. },
  33578. {
  33579. begin: 0xac00,
  33580. end: 0xd7af
  33581. },
  33582. {
  33583. begin: 0xd800,
  33584. end: 0xdfff
  33585. },
  33586. {
  33587. begin: 0x10900,
  33588. end: 0x1091f
  33589. },
  33590. {
  33591. begin: 0x4e00,
  33592. end: 0x9fff
  33593. },
  33594. {
  33595. begin: 0xe000,
  33596. end: 0xf8ff
  33597. },
  33598. {
  33599. begin: 0x31c0,
  33600. end: 0x31ef
  33601. },
  33602. {
  33603. begin: 0xfb00,
  33604. end: 0xfb4f
  33605. },
  33606. {
  33607. begin: 0xfb50,
  33608. end: 0xfdff
  33609. },
  33610. {
  33611. begin: 0xfe20,
  33612. end: 0xfe2f
  33613. },
  33614. {
  33615. begin: 0xfe10,
  33616. end: 0xfe1f
  33617. },
  33618. {
  33619. begin: 0xfe50,
  33620. end: 0xfe6f
  33621. },
  33622. {
  33623. begin: 0xfe70,
  33624. end: 0xfeff
  33625. },
  33626. {
  33627. begin: 0xff00,
  33628. end: 0xffef
  33629. },
  33630. {
  33631. begin: 0xfff0,
  33632. end: 0xffff
  33633. },
  33634. {
  33635. begin: 0x0f00,
  33636. end: 0x0fff
  33637. },
  33638. {
  33639. begin: 0x0700,
  33640. end: 0x074f
  33641. },
  33642. {
  33643. begin: 0x0780,
  33644. end: 0x07bf
  33645. },
  33646. {
  33647. begin: 0x0d80,
  33648. end: 0x0dff
  33649. },
  33650. {
  33651. begin: 0x1000,
  33652. end: 0x109f
  33653. },
  33654. {
  33655. begin: 0x1200,
  33656. end: 0x137f
  33657. },
  33658. {
  33659. begin: 0x13a0,
  33660. end: 0x13ff
  33661. },
  33662. {
  33663. begin: 0x1400,
  33664. end: 0x167f
  33665. },
  33666. {
  33667. begin: 0x1680,
  33668. end: 0x169f
  33669. },
  33670. {
  33671. begin: 0x16a0,
  33672. end: 0x16ff
  33673. },
  33674. {
  33675. begin: 0x1780,
  33676. end: 0x17ff
  33677. },
  33678. {
  33679. begin: 0x1800,
  33680. end: 0x18af
  33681. },
  33682. {
  33683. begin: 0x2800,
  33684. end: 0x28ff
  33685. },
  33686. {
  33687. begin: 0xa000,
  33688. end: 0xa48f
  33689. },
  33690. {
  33691. begin: 0x1700,
  33692. end: 0x171f
  33693. },
  33694. {
  33695. begin: 0x10300,
  33696. end: 0x1032f
  33697. },
  33698. {
  33699. begin: 0x10330,
  33700. end: 0x1034f
  33701. },
  33702. {
  33703. begin: 0x10400,
  33704. end: 0x1044f
  33705. },
  33706. {
  33707. begin: 0x1d000,
  33708. end: 0x1d0ff
  33709. },
  33710. {
  33711. begin: 0x1d400,
  33712. end: 0x1d7ff
  33713. },
  33714. {
  33715. begin: 0xff000,
  33716. end: 0xffffd
  33717. },
  33718. {
  33719. begin: 0xfe00,
  33720. end: 0xfe0f
  33721. },
  33722. {
  33723. begin: 0xe0000,
  33724. end: 0xe007f
  33725. },
  33726. {
  33727. begin: 0x1900,
  33728. end: 0x194f
  33729. },
  33730. {
  33731. begin: 0x1950,
  33732. end: 0x197f
  33733. },
  33734. {
  33735. begin: 0x1980,
  33736. end: 0x19df
  33737. },
  33738. {
  33739. begin: 0x1a00,
  33740. end: 0x1a1f
  33741. },
  33742. {
  33743. begin: 0x2c00,
  33744. end: 0x2c5f
  33745. },
  33746. {
  33747. begin: 0x2d30,
  33748. end: 0x2d7f
  33749. },
  33750. {
  33751. begin: 0x4dc0,
  33752. end: 0x4dff
  33753. },
  33754. {
  33755. begin: 0xa800,
  33756. end: 0xa82f
  33757. },
  33758. {
  33759. begin: 0x10000,
  33760. end: 0x1007f
  33761. },
  33762. {
  33763. begin: 0x10140,
  33764. end: 0x1018f
  33765. },
  33766. {
  33767. begin: 0x10380,
  33768. end: 0x1039f
  33769. },
  33770. {
  33771. begin: 0x103a0,
  33772. end: 0x103df
  33773. },
  33774. {
  33775. begin: 0x10450,
  33776. end: 0x1047f
  33777. },
  33778. {
  33779. begin: 0x10480,
  33780. end: 0x104af
  33781. },
  33782. {
  33783. begin: 0x10800,
  33784. end: 0x1083f
  33785. },
  33786. {
  33787. begin: 0x10a00,
  33788. end: 0x10a5f
  33789. },
  33790. {
  33791. begin: 0x1d300,
  33792. end: 0x1d35f
  33793. },
  33794. {
  33795. begin: 0x12000,
  33796. end: 0x123ff
  33797. },
  33798. {
  33799. begin: 0x1d360,
  33800. end: 0x1d37f
  33801. },
  33802. {
  33803. begin: 0x1b80,
  33804. end: 0x1bbf
  33805. },
  33806. {
  33807. begin: 0x1c00,
  33808. end: 0x1c4f
  33809. },
  33810. {
  33811. begin: 0x1c50,
  33812. end: 0x1c7f
  33813. },
  33814. {
  33815. begin: 0xa880,
  33816. end: 0xa8df
  33817. },
  33818. {
  33819. begin: 0xa900,
  33820. end: 0xa92f
  33821. },
  33822. {
  33823. begin: 0xa930,
  33824. end: 0xa95f
  33825. },
  33826. {
  33827. begin: 0xaa00,
  33828. end: 0xaa5f
  33829. },
  33830. {
  33831. begin: 0x10190,
  33832. end: 0x101cf
  33833. },
  33834. {
  33835. begin: 0x101d0,
  33836. end: 0x101ff
  33837. },
  33838. {
  33839. begin: 0x102a0,
  33840. end: 0x102df
  33841. },
  33842. {
  33843. begin: 0x1f030,
  33844. end: 0x1f09f
  33845. }
  33846. ];
  33847. function getUnicodeRangeFor(value) {
  33848. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33849. const range = UnicodeRanges[i];
  33850. if (value >= range.begin && value < range.end) {
  33851. return i;
  33852. }
  33853. }
  33854. return -1;
  33855. }
  33856. function isRTLRangeFor(value) {
  33857. let range = UnicodeRanges[13];
  33858. if (value >= range.begin && value < range.end) {
  33859. return true;
  33860. }
  33861. range = UnicodeRanges[11];
  33862. if (value >= range.begin && value < range.end) {
  33863. return true;
  33864. }
  33865. return false;
  33866. }
  33867. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  33868. return [
  33869. "\u00A8",
  33870. "\u0020\u0308",
  33871. "\u00AF",
  33872. "\u0020\u0304",
  33873. "\u00B4",
  33874. "\u0020\u0301",
  33875. "\u00B5",
  33876. "\u03BC",
  33877. "\u00B8",
  33878. "\u0020\u0327",
  33879. "\u0132",
  33880. "\u0049\u004A",
  33881. "\u0133",
  33882. "\u0069\u006A",
  33883. "\u013F",
  33884. "\u004C\u00B7",
  33885. "\u0140",
  33886. "\u006C\u00B7",
  33887. "\u0149",
  33888. "\u02BC\u006E",
  33889. "\u017F",
  33890. "\u0073",
  33891. "\u01C4",
  33892. "\u0044\u017D",
  33893. "\u01C5",
  33894. "\u0044\u017E",
  33895. "\u01C6",
  33896. "\u0064\u017E",
  33897. "\u01C7",
  33898. "\u004C\u004A",
  33899. "\u01C8",
  33900. "\u004C\u006A",
  33901. "\u01C9",
  33902. "\u006C\u006A",
  33903. "\u01CA",
  33904. "\u004E\u004A",
  33905. "\u01CB",
  33906. "\u004E\u006A",
  33907. "\u01CC",
  33908. "\u006E\u006A",
  33909. "\u01F1",
  33910. "\u0044\u005A",
  33911. "\u01F2",
  33912. "\u0044\u007A",
  33913. "\u01F3",
  33914. "\u0064\u007A",
  33915. "\u02D8",
  33916. "\u0020\u0306",
  33917. "\u02D9",
  33918. "\u0020\u0307",
  33919. "\u02DA",
  33920. "\u0020\u030A",
  33921. "\u02DB",
  33922. "\u0020\u0328",
  33923. "\u02DC",
  33924. "\u0020\u0303",
  33925. "\u02DD",
  33926. "\u0020\u030B",
  33927. "\u037A",
  33928. "\u0020\u0345",
  33929. "\u0384",
  33930. "\u0020\u0301",
  33931. "\u03D0",
  33932. "\u03B2",
  33933. "\u03D1",
  33934. "\u03B8",
  33935. "\u03D2",
  33936. "\u03A5",
  33937. "\u03D5",
  33938. "\u03C6",
  33939. "\u03D6",
  33940. "\u03C0",
  33941. "\u03F0",
  33942. "\u03BA",
  33943. "\u03F1",
  33944. "\u03C1",
  33945. "\u03F2",
  33946. "\u03C2",
  33947. "\u03F4",
  33948. "\u0398",
  33949. "\u03F5",
  33950. "\u03B5",
  33951. "\u03F9",
  33952. "\u03A3",
  33953. "\u0587",
  33954. "\u0565\u0582",
  33955. "\u0675",
  33956. "\u0627\u0674",
  33957. "\u0676",
  33958. "\u0648\u0674",
  33959. "\u0677",
  33960. "\u06C7\u0674",
  33961. "\u0678",
  33962. "\u064A\u0674",
  33963. "\u0E33",
  33964. "\u0E4D\u0E32",
  33965. "\u0EB3",
  33966. "\u0ECD\u0EB2",
  33967. "\u0EDC",
  33968. "\u0EAB\u0E99",
  33969. "\u0EDD",
  33970. "\u0EAB\u0EA1",
  33971. "\u0F77",
  33972. "\u0FB2\u0F81",
  33973. "\u0F79",
  33974. "\u0FB3\u0F81",
  33975. "\u1E9A",
  33976. "\u0061\u02BE",
  33977. "\u1FBD",
  33978. "\u0020\u0313",
  33979. "\u1FBF",
  33980. "\u0020\u0313",
  33981. "\u1FC0",
  33982. "\u0020\u0342",
  33983. "\u1FFE",
  33984. "\u0020\u0314",
  33985. "\u2002",
  33986. "\u0020",
  33987. "\u2003",
  33988. "\u0020",
  33989. "\u2004",
  33990. "\u0020",
  33991. "\u2005",
  33992. "\u0020",
  33993. "\u2006",
  33994. "\u0020",
  33995. "\u2008",
  33996. "\u0020",
  33997. "\u2009",
  33998. "\u0020",
  33999. "\u200A",
  34000. "\u0020",
  34001. "\u2017",
  34002. "\u0020\u0333",
  34003. "\u2024",
  34004. "\u002E",
  34005. "\u2025",
  34006. "\u002E\u002E",
  34007. "\u2026",
  34008. "\u002E\u002E\u002E",
  34009. "\u2033",
  34010. "\u2032\u2032",
  34011. "\u2034",
  34012. "\u2032\u2032\u2032",
  34013. "\u2036",
  34014. "\u2035\u2035",
  34015. "\u2037",
  34016. "\u2035\u2035\u2035",
  34017. "\u203C",
  34018. "\u0021\u0021",
  34019. "\u203E",
  34020. "\u0020\u0305",
  34021. "\u2047",
  34022. "\u003F\u003F",
  34023. "\u2048",
  34024. "\u003F\u0021",
  34025. "\u2049",
  34026. "\u0021\u003F",
  34027. "\u2057",
  34028. "\u2032\u2032\u2032\u2032",
  34029. "\u205F",
  34030. "\u0020",
  34031. "\u20A8",
  34032. "\u0052\u0073",
  34033. "\u2100",
  34034. "\u0061\u002F\u0063",
  34035. "\u2101",
  34036. "\u0061\u002F\u0073",
  34037. "\u2103",
  34038. "\u00B0\u0043",
  34039. "\u2105",
  34040. "\u0063\u002F\u006F",
  34041. "\u2106",
  34042. "\u0063\u002F\u0075",
  34043. "\u2107",
  34044. "\u0190",
  34045. "\u2109",
  34046. "\u00B0\u0046",
  34047. "\u2116",
  34048. "\u004E\u006F",
  34049. "\u2121",
  34050. "\u0054\u0045\u004C",
  34051. "\u2135",
  34052. "\u05D0",
  34053. "\u2136",
  34054. "\u05D1",
  34055. "\u2137",
  34056. "\u05D2",
  34057. "\u2138",
  34058. "\u05D3",
  34059. "\u213B",
  34060. "\u0046\u0041\u0058",
  34061. "\u2160",
  34062. "\u0049",
  34063. "\u2161",
  34064. "\u0049\u0049",
  34065. "\u2162",
  34066. "\u0049\u0049\u0049",
  34067. "\u2163",
  34068. "\u0049\u0056",
  34069. "\u2164",
  34070. "\u0056",
  34071. "\u2165",
  34072. "\u0056\u0049",
  34073. "\u2166",
  34074. "\u0056\u0049\u0049",
  34075. "\u2167",
  34076. "\u0056\u0049\u0049\u0049",
  34077. "\u2168",
  34078. "\u0049\u0058",
  34079. "\u2169",
  34080. "\u0058",
  34081. "\u216A",
  34082. "\u0058\u0049",
  34083. "\u216B",
  34084. "\u0058\u0049\u0049",
  34085. "\u216C",
  34086. "\u004C",
  34087. "\u216D",
  34088. "\u0043",
  34089. "\u216E",
  34090. "\u0044",
  34091. "\u216F",
  34092. "\u004D",
  34093. "\u2170",
  34094. "\u0069",
  34095. "\u2171",
  34096. "\u0069\u0069",
  34097. "\u2172",
  34098. "\u0069\u0069\u0069",
  34099. "\u2173",
  34100. "\u0069\u0076",
  34101. "\u2174",
  34102. "\u0076",
  34103. "\u2175",
  34104. "\u0076\u0069",
  34105. "\u2176",
  34106. "\u0076\u0069\u0069",
  34107. "\u2177",
  34108. "\u0076\u0069\u0069\u0069",
  34109. "\u2178",
  34110. "\u0069\u0078",
  34111. "\u2179",
  34112. "\u0078",
  34113. "\u217A",
  34114. "\u0078\u0069",
  34115. "\u217B",
  34116. "\u0078\u0069\u0069",
  34117. "\u217C",
  34118. "\u006C",
  34119. "\u217D",
  34120. "\u0063",
  34121. "\u217E",
  34122. "\u0064",
  34123. "\u217F",
  34124. "\u006D",
  34125. "\u222C",
  34126. "\u222B\u222B",
  34127. "\u222D",
  34128. "\u222B\u222B\u222B",
  34129. "\u222F",
  34130. "\u222E\u222E",
  34131. "\u2230",
  34132. "\u222E\u222E\u222E",
  34133. "\u2474",
  34134. "\u0028\u0031\u0029",
  34135. "\u2475",
  34136. "\u0028\u0032\u0029",
  34137. "\u2476",
  34138. "\u0028\u0033\u0029",
  34139. "\u2477",
  34140. "\u0028\u0034\u0029",
  34141. "\u2478",
  34142. "\u0028\u0035\u0029",
  34143. "\u2479",
  34144. "\u0028\u0036\u0029",
  34145. "\u247A",
  34146. "\u0028\u0037\u0029",
  34147. "\u247B",
  34148. "\u0028\u0038\u0029",
  34149. "\u247C",
  34150. "\u0028\u0039\u0029",
  34151. "\u247D",
  34152. "\u0028\u0031\u0030\u0029",
  34153. "\u247E",
  34154. "\u0028\u0031\u0031\u0029",
  34155. "\u247F",
  34156. "\u0028\u0031\u0032\u0029",
  34157. "\u2480",
  34158. "\u0028\u0031\u0033\u0029",
  34159. "\u2481",
  34160. "\u0028\u0031\u0034\u0029",
  34161. "\u2482",
  34162. "\u0028\u0031\u0035\u0029",
  34163. "\u2483",
  34164. "\u0028\u0031\u0036\u0029",
  34165. "\u2484",
  34166. "\u0028\u0031\u0037\u0029",
  34167. "\u2485",
  34168. "\u0028\u0031\u0038\u0029",
  34169. "\u2486",
  34170. "\u0028\u0031\u0039\u0029",
  34171. "\u2487",
  34172. "\u0028\u0032\u0030\u0029",
  34173. "\u2488",
  34174. "\u0031\u002E",
  34175. "\u2489",
  34176. "\u0032\u002E",
  34177. "\u248A",
  34178. "\u0033\u002E",
  34179. "\u248B",
  34180. "\u0034\u002E",
  34181. "\u248C",
  34182. "\u0035\u002E",
  34183. "\u248D",
  34184. "\u0036\u002E",
  34185. "\u248E",
  34186. "\u0037\u002E",
  34187. "\u248F",
  34188. "\u0038\u002E",
  34189. "\u2490",
  34190. "\u0039\u002E",
  34191. "\u2491",
  34192. "\u0031\u0030\u002E",
  34193. "\u2492",
  34194. "\u0031\u0031\u002E",
  34195. "\u2493",
  34196. "\u0031\u0032\u002E",
  34197. "\u2494",
  34198. "\u0031\u0033\u002E",
  34199. "\u2495",
  34200. "\u0031\u0034\u002E",
  34201. "\u2496",
  34202. "\u0031\u0035\u002E",
  34203. "\u2497",
  34204. "\u0031\u0036\u002E",
  34205. "\u2498",
  34206. "\u0031\u0037\u002E",
  34207. "\u2499",
  34208. "\u0031\u0038\u002E",
  34209. "\u249A",
  34210. "\u0031\u0039\u002E",
  34211. "\u249B",
  34212. "\u0032\u0030\u002E",
  34213. "\u249C",
  34214. "\u0028\u0061\u0029",
  34215. "\u249D",
  34216. "\u0028\u0062\u0029",
  34217. "\u249E",
  34218. "\u0028\u0063\u0029",
  34219. "\u249F",
  34220. "\u0028\u0064\u0029",
  34221. "\u24A0",
  34222. "\u0028\u0065\u0029",
  34223. "\u24A1",
  34224. "\u0028\u0066\u0029",
  34225. "\u24A2",
  34226. "\u0028\u0067\u0029",
  34227. "\u24A3",
  34228. "\u0028\u0068\u0029",
  34229. "\u24A4",
  34230. "\u0028\u0069\u0029",
  34231. "\u24A5",
  34232. "\u0028\u006A\u0029",
  34233. "\u24A6",
  34234. "\u0028\u006B\u0029",
  34235. "\u24A7",
  34236. "\u0028\u006C\u0029",
  34237. "\u24A8",
  34238. "\u0028\u006D\u0029",
  34239. "\u24A9",
  34240. "\u0028\u006E\u0029",
  34241. "\u24AA",
  34242. "\u0028\u006F\u0029",
  34243. "\u24AB",
  34244. "\u0028\u0070\u0029",
  34245. "\u24AC",
  34246. "\u0028\u0071\u0029",
  34247. "\u24AD",
  34248. "\u0028\u0072\u0029",
  34249. "\u24AE",
  34250. "\u0028\u0073\u0029",
  34251. "\u24AF",
  34252. "\u0028\u0074\u0029",
  34253. "\u24B0",
  34254. "\u0028\u0075\u0029",
  34255. "\u24B1",
  34256. "\u0028\u0076\u0029",
  34257. "\u24B2",
  34258. "\u0028\u0077\u0029",
  34259. "\u24B3",
  34260. "\u0028\u0078\u0029",
  34261. "\u24B4",
  34262. "\u0028\u0079\u0029",
  34263. "\u24B5",
  34264. "\u0028\u007A\u0029",
  34265. "\u2A0C",
  34266. "\u222B\u222B\u222B\u222B",
  34267. "\u2A74",
  34268. "\u003A\u003A\u003D",
  34269. "\u2A75",
  34270. "\u003D\u003D",
  34271. "\u2A76",
  34272. "\u003D\u003D\u003D",
  34273. "\u2E9F",
  34274. "\u6BCD",
  34275. "\u2EF3",
  34276. "\u9F9F",
  34277. "\u2F00",
  34278. "\u4E00",
  34279. "\u2F01",
  34280. "\u4E28",
  34281. "\u2F02",
  34282. "\u4E36",
  34283. "\u2F03",
  34284. "\u4E3F",
  34285. "\u2F04",
  34286. "\u4E59",
  34287. "\u2F05",
  34288. "\u4E85",
  34289. "\u2F06",
  34290. "\u4E8C",
  34291. "\u2F07",
  34292. "\u4EA0",
  34293. "\u2F08",
  34294. "\u4EBA",
  34295. "\u2F09",
  34296. "\u513F",
  34297. "\u2F0A",
  34298. "\u5165",
  34299. "\u2F0B",
  34300. "\u516B",
  34301. "\u2F0C",
  34302. "\u5182",
  34303. "\u2F0D",
  34304. "\u5196",
  34305. "\u2F0E",
  34306. "\u51AB",
  34307. "\u2F0F",
  34308. "\u51E0",
  34309. "\u2F10",
  34310. "\u51F5",
  34311. "\u2F11",
  34312. "\u5200",
  34313. "\u2F12",
  34314. "\u529B",
  34315. "\u2F13",
  34316. "\u52F9",
  34317. "\u2F14",
  34318. "\u5315",
  34319. "\u2F15",
  34320. "\u531A",
  34321. "\u2F16",
  34322. "\u5338",
  34323. "\u2F17",
  34324. "\u5341",
  34325. "\u2F18",
  34326. "\u535C",
  34327. "\u2F19",
  34328. "\u5369",
  34329. "\u2F1A",
  34330. "\u5382",
  34331. "\u2F1B",
  34332. "\u53B6",
  34333. "\u2F1C",
  34334. "\u53C8",
  34335. "\u2F1D",
  34336. "\u53E3",
  34337. "\u2F1E",
  34338. "\u56D7",
  34339. "\u2F1F",
  34340. "\u571F",
  34341. "\u2F20",
  34342. "\u58EB",
  34343. "\u2F21",
  34344. "\u5902",
  34345. "\u2F22",
  34346. "\u590A",
  34347. "\u2F23",
  34348. "\u5915",
  34349. "\u2F24",
  34350. "\u5927",
  34351. "\u2F25",
  34352. "\u5973",
  34353. "\u2F26",
  34354. "\u5B50",
  34355. "\u2F27",
  34356. "\u5B80",
  34357. "\u2F28",
  34358. "\u5BF8",
  34359. "\u2F29",
  34360. "\u5C0F",
  34361. "\u2F2A",
  34362. "\u5C22",
  34363. "\u2F2B",
  34364. "\u5C38",
  34365. "\u2F2C",
  34366. "\u5C6E",
  34367. "\u2F2D",
  34368. "\u5C71",
  34369. "\u2F2E",
  34370. "\u5DDB",
  34371. "\u2F2F",
  34372. "\u5DE5",
  34373. "\u2F30",
  34374. "\u5DF1",
  34375. "\u2F31",
  34376. "\u5DFE",
  34377. "\u2F32",
  34378. "\u5E72",
  34379. "\u2F33",
  34380. "\u5E7A",
  34381. "\u2F34",
  34382. "\u5E7F",
  34383. "\u2F35",
  34384. "\u5EF4",
  34385. "\u2F36",
  34386. "\u5EFE",
  34387. "\u2F37",
  34388. "\u5F0B",
  34389. "\u2F38",
  34390. "\u5F13",
  34391. "\u2F39",
  34392. "\u5F50",
  34393. "\u2F3A",
  34394. "\u5F61",
  34395. "\u2F3B",
  34396. "\u5F73",
  34397. "\u2F3C",
  34398. "\u5FC3",
  34399. "\u2F3D",
  34400. "\u6208",
  34401. "\u2F3E",
  34402. "\u6236",
  34403. "\u2F3F",
  34404. "\u624B",
  34405. "\u2F40",
  34406. "\u652F",
  34407. "\u2F41",
  34408. "\u6534",
  34409. "\u2F42",
  34410. "\u6587",
  34411. "\u2F43",
  34412. "\u6597",
  34413. "\u2F44",
  34414. "\u65A4",
  34415. "\u2F45",
  34416. "\u65B9",
  34417. "\u2F46",
  34418. "\u65E0",
  34419. "\u2F47",
  34420. "\u65E5",
  34421. "\u2F48",
  34422. "\u66F0",
  34423. "\u2F49",
  34424. "\u6708",
  34425. "\u2F4A",
  34426. "\u6728",
  34427. "\u2F4B",
  34428. "\u6B20",
  34429. "\u2F4C",
  34430. "\u6B62",
  34431. "\u2F4D",
  34432. "\u6B79",
  34433. "\u2F4E",
  34434. "\u6BB3",
  34435. "\u2F4F",
  34436. "\u6BCB",
  34437. "\u2F50",
  34438. "\u6BD4",
  34439. "\u2F51",
  34440. "\u6BDB",
  34441. "\u2F52",
  34442. "\u6C0F",
  34443. "\u2F53",
  34444. "\u6C14",
  34445. "\u2F54",
  34446. "\u6C34",
  34447. "\u2F55",
  34448. "\u706B",
  34449. "\u2F56",
  34450. "\u722A",
  34451. "\u2F57",
  34452. "\u7236",
  34453. "\u2F58",
  34454. "\u723B",
  34455. "\u2F59",
  34456. "\u723F",
  34457. "\u2F5A",
  34458. "\u7247",
  34459. "\u2F5B",
  34460. "\u7259",
  34461. "\u2F5C",
  34462. "\u725B",
  34463. "\u2F5D",
  34464. "\u72AC",
  34465. "\u2F5E",
  34466. "\u7384",
  34467. "\u2F5F",
  34468. "\u7389",
  34469. "\u2F60",
  34470. "\u74DC",
  34471. "\u2F61",
  34472. "\u74E6",
  34473. "\u2F62",
  34474. "\u7518",
  34475. "\u2F63",
  34476. "\u751F",
  34477. "\u2F64",
  34478. "\u7528",
  34479. "\u2F65",
  34480. "\u7530",
  34481. "\u2F66",
  34482. "\u758B",
  34483. "\u2F67",
  34484. "\u7592",
  34485. "\u2F68",
  34486. "\u7676",
  34487. "\u2F69",
  34488. "\u767D",
  34489. "\u2F6A",
  34490. "\u76AE",
  34491. "\u2F6B",
  34492. "\u76BF",
  34493. "\u2F6C",
  34494. "\u76EE",
  34495. "\u2F6D",
  34496. "\u77DB",
  34497. "\u2F6E",
  34498. "\u77E2",
  34499. "\u2F6F",
  34500. "\u77F3",
  34501. "\u2F70",
  34502. "\u793A",
  34503. "\u2F71",
  34504. "\u79B8",
  34505. "\u2F72",
  34506. "\u79BE",
  34507. "\u2F73",
  34508. "\u7A74",
  34509. "\u2F74",
  34510. "\u7ACB",
  34511. "\u2F75",
  34512. "\u7AF9",
  34513. "\u2F76",
  34514. "\u7C73",
  34515. "\u2F77",
  34516. "\u7CF8",
  34517. "\u2F78",
  34518. "\u7F36",
  34519. "\u2F79",
  34520. "\u7F51",
  34521. "\u2F7A",
  34522. "\u7F8A",
  34523. "\u2F7B",
  34524. "\u7FBD",
  34525. "\u2F7C",
  34526. "\u8001",
  34527. "\u2F7D",
  34528. "\u800C",
  34529. "\u2F7E",
  34530. "\u8012",
  34531. "\u2F7F",
  34532. "\u8033",
  34533. "\u2F80",
  34534. "\u807F",
  34535. "\u2F81",
  34536. "\u8089",
  34537. "\u2F82",
  34538. "\u81E3",
  34539. "\u2F83",
  34540. "\u81EA",
  34541. "\u2F84",
  34542. "\u81F3",
  34543. "\u2F85",
  34544. "\u81FC",
  34545. "\u2F86",
  34546. "\u820C",
  34547. "\u2F87",
  34548. "\u821B",
  34549. "\u2F88",
  34550. "\u821F",
  34551. "\u2F89",
  34552. "\u826E",
  34553. "\u2F8A",
  34554. "\u8272",
  34555. "\u2F8B",
  34556. "\u8278",
  34557. "\u2F8C",
  34558. "\u864D",
  34559. "\u2F8D",
  34560. "\u866B",
  34561. "\u2F8E",
  34562. "\u8840",
  34563. "\u2F8F",
  34564. "\u884C",
  34565. "\u2F90",
  34566. "\u8863",
  34567. "\u2F91",
  34568. "\u897E",
  34569. "\u2F92",
  34570. "\u898B",
  34571. "\u2F93",
  34572. "\u89D2",
  34573. "\u2F94",
  34574. "\u8A00",
  34575. "\u2F95",
  34576. "\u8C37",
  34577. "\u2F96",
  34578. "\u8C46",
  34579. "\u2F97",
  34580. "\u8C55",
  34581. "\u2F98",
  34582. "\u8C78",
  34583. "\u2F99",
  34584. "\u8C9D",
  34585. "\u2F9A",
  34586. "\u8D64",
  34587. "\u2F9B",
  34588. "\u8D70",
  34589. "\u2F9C",
  34590. "\u8DB3",
  34591. "\u2F9D",
  34592. "\u8EAB",
  34593. "\u2F9E",
  34594. "\u8ECA",
  34595. "\u2F9F",
  34596. "\u8F9B",
  34597. "\u2FA0",
  34598. "\u8FB0",
  34599. "\u2FA1",
  34600. "\u8FB5",
  34601. "\u2FA2",
  34602. "\u9091",
  34603. "\u2FA3",
  34604. "\u9149",
  34605. "\u2FA4",
  34606. "\u91C6",
  34607. "\u2FA5",
  34608. "\u91CC",
  34609. "\u2FA6",
  34610. "\u91D1",
  34611. "\u2FA7",
  34612. "\u9577",
  34613. "\u2FA8",
  34614. "\u9580",
  34615. "\u2FA9",
  34616. "\u961C",
  34617. "\u2FAA",
  34618. "\u96B6",
  34619. "\u2FAB",
  34620. "\u96B9",
  34621. "\u2FAC",
  34622. "\u96E8",
  34623. "\u2FAD",
  34624. "\u9751",
  34625. "\u2FAE",
  34626. "\u975E",
  34627. "\u2FAF",
  34628. "\u9762",
  34629. "\u2FB0",
  34630. "\u9769",
  34631. "\u2FB1",
  34632. "\u97CB",
  34633. "\u2FB2",
  34634. "\u97ED",
  34635. "\u2FB3",
  34636. "\u97F3",
  34637. "\u2FB4",
  34638. "\u9801",
  34639. "\u2FB5",
  34640. "\u98A8",
  34641. "\u2FB6",
  34642. "\u98DB",
  34643. "\u2FB7",
  34644. "\u98DF",
  34645. "\u2FB8",
  34646. "\u9996",
  34647. "\u2FB9",
  34648. "\u9999",
  34649. "\u2FBA",
  34650. "\u99AC",
  34651. "\u2FBB",
  34652. "\u9AA8",
  34653. "\u2FBC",
  34654. "\u9AD8",
  34655. "\u2FBD",
  34656. "\u9ADF",
  34657. "\u2FBE",
  34658. "\u9B25",
  34659. "\u2FBF",
  34660. "\u9B2F",
  34661. "\u2FC0",
  34662. "\u9B32",
  34663. "\u2FC1",
  34664. "\u9B3C",
  34665. "\u2FC2",
  34666. "\u9B5A",
  34667. "\u2FC3",
  34668. "\u9CE5",
  34669. "\u2FC4",
  34670. "\u9E75",
  34671. "\u2FC5",
  34672. "\u9E7F",
  34673. "\u2FC6",
  34674. "\u9EA5",
  34675. "\u2FC7",
  34676. "\u9EBB",
  34677. "\u2FC8",
  34678. "\u9EC3",
  34679. "\u2FC9",
  34680. "\u9ECD",
  34681. "\u2FCA",
  34682. "\u9ED1",
  34683. "\u2FCB",
  34684. "\u9EF9",
  34685. "\u2FCC",
  34686. "\u9EFD",
  34687. "\u2FCD",
  34688. "\u9F0E",
  34689. "\u2FCE",
  34690. "\u9F13",
  34691. "\u2FCF",
  34692. "\u9F20",
  34693. "\u2FD0",
  34694. "\u9F3B",
  34695. "\u2FD1",
  34696. "\u9F4A",
  34697. "\u2FD2",
  34698. "\u9F52",
  34699. "\u2FD3",
  34700. "\u9F8D",
  34701. "\u2FD4",
  34702. "\u9F9C",
  34703. "\u2FD5",
  34704. "\u9FA0",
  34705. "\u3036",
  34706. "\u3012",
  34707. "\u3038",
  34708. "\u5341",
  34709. "\u3039",
  34710. "\u5344",
  34711. "\u303A",
  34712. "\u5345",
  34713. "\u309B",
  34714. "\u0020\u3099",
  34715. "\u309C",
  34716. "\u0020\u309A",
  34717. "\u3131",
  34718. "\u1100",
  34719. "\u3132",
  34720. "\u1101",
  34721. "\u3133",
  34722. "\u11AA",
  34723. "\u3134",
  34724. "\u1102",
  34725. "\u3135",
  34726. "\u11AC",
  34727. "\u3136",
  34728. "\u11AD",
  34729. "\u3137",
  34730. "\u1103",
  34731. "\u3138",
  34732. "\u1104",
  34733. "\u3139",
  34734. "\u1105",
  34735. "\u313A",
  34736. "\u11B0",
  34737. "\u313B",
  34738. "\u11B1",
  34739. "\u313C",
  34740. "\u11B2",
  34741. "\u313D",
  34742. "\u11B3",
  34743. "\u313E",
  34744. "\u11B4",
  34745. "\u313F",
  34746. "\u11B5",
  34747. "\u3140",
  34748. "\u111A",
  34749. "\u3141",
  34750. "\u1106",
  34751. "\u3142",
  34752. "\u1107",
  34753. "\u3143",
  34754. "\u1108",
  34755. "\u3144",
  34756. "\u1121",
  34757. "\u3145",
  34758. "\u1109",
  34759. "\u3146",
  34760. "\u110A",
  34761. "\u3147",
  34762. "\u110B",
  34763. "\u3148",
  34764. "\u110C",
  34765. "\u3149",
  34766. "\u110D",
  34767. "\u314A",
  34768. "\u110E",
  34769. "\u314B",
  34770. "\u110F",
  34771. "\u314C",
  34772. "\u1110",
  34773. "\u314D",
  34774. "\u1111",
  34775. "\u314E",
  34776. "\u1112",
  34777. "\u314F",
  34778. "\u1161",
  34779. "\u3150",
  34780. "\u1162",
  34781. "\u3151",
  34782. "\u1163",
  34783. "\u3152",
  34784. "\u1164",
  34785. "\u3153",
  34786. "\u1165",
  34787. "\u3154",
  34788. "\u1166",
  34789. "\u3155",
  34790. "\u1167",
  34791. "\u3156",
  34792. "\u1168",
  34793. "\u3157",
  34794. "\u1169",
  34795. "\u3158",
  34796. "\u116A",
  34797. "\u3159",
  34798. "\u116B",
  34799. "\u315A",
  34800. "\u116C",
  34801. "\u315B",
  34802. "\u116D",
  34803. "\u315C",
  34804. "\u116E",
  34805. "\u315D",
  34806. "\u116F",
  34807. "\u315E",
  34808. "\u1170",
  34809. "\u315F",
  34810. "\u1171",
  34811. "\u3160",
  34812. "\u1172",
  34813. "\u3161",
  34814. "\u1173",
  34815. "\u3162",
  34816. "\u1174",
  34817. "\u3163",
  34818. "\u1175",
  34819. "\u3164",
  34820. "\u1160",
  34821. "\u3165",
  34822. "\u1114",
  34823. "\u3166",
  34824. "\u1115",
  34825. "\u3167",
  34826. "\u11C7",
  34827. "\u3168",
  34828. "\u11C8",
  34829. "\u3169",
  34830. "\u11CC",
  34831. "\u316A",
  34832. "\u11CE",
  34833. "\u316B",
  34834. "\u11D3",
  34835. "\u316C",
  34836. "\u11D7",
  34837. "\u316D",
  34838. "\u11D9",
  34839. "\u316E",
  34840. "\u111C",
  34841. "\u316F",
  34842. "\u11DD",
  34843. "\u3170",
  34844. "\u11DF",
  34845. "\u3171",
  34846. "\u111D",
  34847. "\u3172",
  34848. "\u111E",
  34849. "\u3173",
  34850. "\u1120",
  34851. "\u3174",
  34852. "\u1122",
  34853. "\u3175",
  34854. "\u1123",
  34855. "\u3176",
  34856. "\u1127",
  34857. "\u3177",
  34858. "\u1129",
  34859. "\u3178",
  34860. "\u112B",
  34861. "\u3179",
  34862. "\u112C",
  34863. "\u317A",
  34864. "\u112D",
  34865. "\u317B",
  34866. "\u112E",
  34867. "\u317C",
  34868. "\u112F",
  34869. "\u317D",
  34870. "\u1132",
  34871. "\u317E",
  34872. "\u1136",
  34873. "\u317F",
  34874. "\u1140",
  34875. "\u3180",
  34876. "\u1147",
  34877. "\u3181",
  34878. "\u114C",
  34879. "\u3182",
  34880. "\u11F1",
  34881. "\u3183",
  34882. "\u11F2",
  34883. "\u3184",
  34884. "\u1157",
  34885. "\u3185",
  34886. "\u1158",
  34887. "\u3186",
  34888. "\u1159",
  34889. "\u3187",
  34890. "\u1184",
  34891. "\u3188",
  34892. "\u1185",
  34893. "\u3189",
  34894. "\u1188",
  34895. "\u318A",
  34896. "\u1191",
  34897. "\u318B",
  34898. "\u1192",
  34899. "\u318C",
  34900. "\u1194",
  34901. "\u318D",
  34902. "\u119E",
  34903. "\u318E",
  34904. "\u11A1",
  34905. "\u3200",
  34906. "\u0028\u1100\u0029",
  34907. "\u3201",
  34908. "\u0028\u1102\u0029",
  34909. "\u3202",
  34910. "\u0028\u1103\u0029",
  34911. "\u3203",
  34912. "\u0028\u1105\u0029",
  34913. "\u3204",
  34914. "\u0028\u1106\u0029",
  34915. "\u3205",
  34916. "\u0028\u1107\u0029",
  34917. "\u3206",
  34918. "\u0028\u1109\u0029",
  34919. "\u3207",
  34920. "\u0028\u110B\u0029",
  34921. "\u3208",
  34922. "\u0028\u110C\u0029",
  34923. "\u3209",
  34924. "\u0028\u110E\u0029",
  34925. "\u320A",
  34926. "\u0028\u110F\u0029",
  34927. "\u320B",
  34928. "\u0028\u1110\u0029",
  34929. "\u320C",
  34930. "\u0028\u1111\u0029",
  34931. "\u320D",
  34932. "\u0028\u1112\u0029",
  34933. "\u320E",
  34934. "\u0028\u1100\u1161\u0029",
  34935. "\u320F",
  34936. "\u0028\u1102\u1161\u0029",
  34937. "\u3210",
  34938. "\u0028\u1103\u1161\u0029",
  34939. "\u3211",
  34940. "\u0028\u1105\u1161\u0029",
  34941. "\u3212",
  34942. "\u0028\u1106\u1161\u0029",
  34943. "\u3213",
  34944. "\u0028\u1107\u1161\u0029",
  34945. "\u3214",
  34946. "\u0028\u1109\u1161\u0029",
  34947. "\u3215",
  34948. "\u0028\u110B\u1161\u0029",
  34949. "\u3216",
  34950. "\u0028\u110C\u1161\u0029",
  34951. "\u3217",
  34952. "\u0028\u110E\u1161\u0029",
  34953. "\u3218",
  34954. "\u0028\u110F\u1161\u0029",
  34955. "\u3219",
  34956. "\u0028\u1110\u1161\u0029",
  34957. "\u321A",
  34958. "\u0028\u1111\u1161\u0029",
  34959. "\u321B",
  34960. "\u0028\u1112\u1161\u0029",
  34961. "\u321C",
  34962. "\u0028\u110C\u116E\u0029",
  34963. "\u321D",
  34964. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  34965. "\u321E",
  34966. "\u0028\u110B\u1169\u1112\u116E\u0029",
  34967. "\u3220",
  34968. "\u0028\u4E00\u0029",
  34969. "\u3221",
  34970. "\u0028\u4E8C\u0029",
  34971. "\u3222",
  34972. "\u0028\u4E09\u0029",
  34973. "\u3223",
  34974. "\u0028\u56DB\u0029",
  34975. "\u3224",
  34976. "\u0028\u4E94\u0029",
  34977. "\u3225",
  34978. "\u0028\u516D\u0029",
  34979. "\u3226",
  34980. "\u0028\u4E03\u0029",
  34981. "\u3227",
  34982. "\u0028\u516B\u0029",
  34983. "\u3228",
  34984. "\u0028\u4E5D\u0029",
  34985. "\u3229",
  34986. "\u0028\u5341\u0029",
  34987. "\u322A",
  34988. "\u0028\u6708\u0029",
  34989. "\u322B",
  34990. "\u0028\u706B\u0029",
  34991. "\u322C",
  34992. "\u0028\u6C34\u0029",
  34993. "\u322D",
  34994. "\u0028\u6728\u0029",
  34995. "\u322E",
  34996. "\u0028\u91D1\u0029",
  34997. "\u322F",
  34998. "\u0028\u571F\u0029",
  34999. "\u3230",
  35000. "\u0028\u65E5\u0029",
  35001. "\u3231",
  35002. "\u0028\u682A\u0029",
  35003. "\u3232",
  35004. "\u0028\u6709\u0029",
  35005. "\u3233",
  35006. "\u0028\u793E\u0029",
  35007. "\u3234",
  35008. "\u0028\u540D\u0029",
  35009. "\u3235",
  35010. "\u0028\u7279\u0029",
  35011. "\u3236",
  35012. "\u0028\u8CA1\u0029",
  35013. "\u3237",
  35014. "\u0028\u795D\u0029",
  35015. "\u3238",
  35016. "\u0028\u52B4\u0029",
  35017. "\u3239",
  35018. "\u0028\u4EE3\u0029",
  35019. "\u323A",
  35020. "\u0028\u547C\u0029",
  35021. "\u323B",
  35022. "\u0028\u5B66\u0029",
  35023. "\u323C",
  35024. "\u0028\u76E3\u0029",
  35025. "\u323D",
  35026. "\u0028\u4F01\u0029",
  35027. "\u323E",
  35028. "\u0028\u8CC7\u0029",
  35029. "\u323F",
  35030. "\u0028\u5354\u0029",
  35031. "\u3240",
  35032. "\u0028\u796D\u0029",
  35033. "\u3241",
  35034. "\u0028\u4F11\u0029",
  35035. "\u3242",
  35036. "\u0028\u81EA\u0029",
  35037. "\u3243",
  35038. "\u0028\u81F3\u0029",
  35039. "\u32C0",
  35040. "\u0031\u6708",
  35041. "\u32C1",
  35042. "\u0032\u6708",
  35043. "\u32C2",
  35044. "\u0033\u6708",
  35045. "\u32C3",
  35046. "\u0034\u6708",
  35047. "\u32C4",
  35048. "\u0035\u6708",
  35049. "\u32C5",
  35050. "\u0036\u6708",
  35051. "\u32C6",
  35052. "\u0037\u6708",
  35053. "\u32C7",
  35054. "\u0038\u6708",
  35055. "\u32C8",
  35056. "\u0039\u6708",
  35057. "\u32C9",
  35058. "\u0031\u0030\u6708",
  35059. "\u32CA",
  35060. "\u0031\u0031\u6708",
  35061. "\u32CB",
  35062. "\u0031\u0032\u6708",
  35063. "\u3358",
  35064. "\u0030\u70B9",
  35065. "\u3359",
  35066. "\u0031\u70B9",
  35067. "\u335A",
  35068. "\u0032\u70B9",
  35069. "\u335B",
  35070. "\u0033\u70B9",
  35071. "\u335C",
  35072. "\u0034\u70B9",
  35073. "\u335D",
  35074. "\u0035\u70B9",
  35075. "\u335E",
  35076. "\u0036\u70B9",
  35077. "\u335F",
  35078. "\u0037\u70B9",
  35079. "\u3360",
  35080. "\u0038\u70B9",
  35081. "\u3361",
  35082. "\u0039\u70B9",
  35083. "\u3362",
  35084. "\u0031\u0030\u70B9",
  35085. "\u3363",
  35086. "\u0031\u0031\u70B9",
  35087. "\u3364",
  35088. "\u0031\u0032\u70B9",
  35089. "\u3365",
  35090. "\u0031\u0033\u70B9",
  35091. "\u3366",
  35092. "\u0031\u0034\u70B9",
  35093. "\u3367",
  35094. "\u0031\u0035\u70B9",
  35095. "\u3368",
  35096. "\u0031\u0036\u70B9",
  35097. "\u3369",
  35098. "\u0031\u0037\u70B9",
  35099. "\u336A",
  35100. "\u0031\u0038\u70B9",
  35101. "\u336B",
  35102. "\u0031\u0039\u70B9",
  35103. "\u336C",
  35104. "\u0032\u0030\u70B9",
  35105. "\u336D",
  35106. "\u0032\u0031\u70B9",
  35107. "\u336E",
  35108. "\u0032\u0032\u70B9",
  35109. "\u336F",
  35110. "\u0032\u0033\u70B9",
  35111. "\u3370",
  35112. "\u0032\u0034\u70B9",
  35113. "\u33E0",
  35114. "\u0031\u65E5",
  35115. "\u33E1",
  35116. "\u0032\u65E5",
  35117. "\u33E2",
  35118. "\u0033\u65E5",
  35119. "\u33E3",
  35120. "\u0034\u65E5",
  35121. "\u33E4",
  35122. "\u0035\u65E5",
  35123. "\u33E5",
  35124. "\u0036\u65E5",
  35125. "\u33E6",
  35126. "\u0037\u65E5",
  35127. "\u33E7",
  35128. "\u0038\u65E5",
  35129. "\u33E8",
  35130. "\u0039\u65E5",
  35131. "\u33E9",
  35132. "\u0031\u0030\u65E5",
  35133. "\u33EA",
  35134. "\u0031\u0031\u65E5",
  35135. "\u33EB",
  35136. "\u0031\u0032\u65E5",
  35137. "\u33EC",
  35138. "\u0031\u0033\u65E5",
  35139. "\u33ED",
  35140. "\u0031\u0034\u65E5",
  35141. "\u33EE",
  35142. "\u0031\u0035\u65E5",
  35143. "\u33EF",
  35144. "\u0031\u0036\u65E5",
  35145. "\u33F0",
  35146. "\u0031\u0037\u65E5",
  35147. "\u33F1",
  35148. "\u0031\u0038\u65E5",
  35149. "\u33F2",
  35150. "\u0031\u0039\u65E5",
  35151. "\u33F3",
  35152. "\u0032\u0030\u65E5",
  35153. "\u33F4",
  35154. "\u0032\u0031\u65E5",
  35155. "\u33F5",
  35156. "\u0032\u0032\u65E5",
  35157. "\u33F6",
  35158. "\u0032\u0033\u65E5",
  35159. "\u33F7",
  35160. "\u0032\u0034\u65E5",
  35161. "\u33F8",
  35162. "\u0032\u0035\u65E5",
  35163. "\u33F9",
  35164. "\u0032\u0036\u65E5",
  35165. "\u33FA",
  35166. "\u0032\u0037\u65E5",
  35167. "\u33FB",
  35168. "\u0032\u0038\u65E5",
  35169. "\u33FC",
  35170. "\u0032\u0039\u65E5",
  35171. "\u33FD",
  35172. "\u0033\u0030\u65E5",
  35173. "\u33FE",
  35174. "\u0033\u0031\u65E5",
  35175. "\uFB00",
  35176. "\u0066\u0066",
  35177. "\uFB01",
  35178. "\u0066\u0069",
  35179. "\uFB02",
  35180. "\u0066\u006C",
  35181. "\uFB03",
  35182. "\u0066\u0066\u0069",
  35183. "\uFB04",
  35184. "\u0066\u0066\u006C",
  35185. "\uFB05",
  35186. "\u017F\u0074",
  35187. "\uFB06",
  35188. "\u0073\u0074",
  35189. "\uFB13",
  35190. "\u0574\u0576",
  35191. "\uFB14",
  35192. "\u0574\u0565",
  35193. "\uFB15",
  35194. "\u0574\u056B",
  35195. "\uFB16",
  35196. "\u057E\u0576",
  35197. "\uFB17",
  35198. "\u0574\u056D",
  35199. "\uFB4F",
  35200. "\u05D0\u05DC",
  35201. "\uFB50",
  35202. "\u0671",
  35203. "\uFB51",
  35204. "\u0671",
  35205. "\uFB52",
  35206. "\u067B",
  35207. "\uFB53",
  35208. "\u067B",
  35209. "\uFB54",
  35210. "\u067B",
  35211. "\uFB55",
  35212. "\u067B",
  35213. "\uFB56",
  35214. "\u067E",
  35215. "\uFB57",
  35216. "\u067E",
  35217. "\uFB58",
  35218. "\u067E",
  35219. "\uFB59",
  35220. "\u067E",
  35221. "\uFB5A",
  35222. "\u0680",
  35223. "\uFB5B",
  35224. "\u0680",
  35225. "\uFB5C",
  35226. "\u0680",
  35227. "\uFB5D",
  35228. "\u0680",
  35229. "\uFB5E",
  35230. "\u067A",
  35231. "\uFB5F",
  35232. "\u067A",
  35233. "\uFB60",
  35234. "\u067A",
  35235. "\uFB61",
  35236. "\u067A",
  35237. "\uFB62",
  35238. "\u067F",
  35239. "\uFB63",
  35240. "\u067F",
  35241. "\uFB64",
  35242. "\u067F",
  35243. "\uFB65",
  35244. "\u067F",
  35245. "\uFB66",
  35246. "\u0679",
  35247. "\uFB67",
  35248. "\u0679",
  35249. "\uFB68",
  35250. "\u0679",
  35251. "\uFB69",
  35252. "\u0679",
  35253. "\uFB6A",
  35254. "\u06A4",
  35255. "\uFB6B",
  35256. "\u06A4",
  35257. "\uFB6C",
  35258. "\u06A4",
  35259. "\uFB6D",
  35260. "\u06A4",
  35261. "\uFB6E",
  35262. "\u06A6",
  35263. "\uFB6F",
  35264. "\u06A6",
  35265. "\uFB70",
  35266. "\u06A6",
  35267. "\uFB71",
  35268. "\u06A6",
  35269. "\uFB72",
  35270. "\u0684",
  35271. "\uFB73",
  35272. "\u0684",
  35273. "\uFB74",
  35274. "\u0684",
  35275. "\uFB75",
  35276. "\u0684",
  35277. "\uFB76",
  35278. "\u0683",
  35279. "\uFB77",
  35280. "\u0683",
  35281. "\uFB78",
  35282. "\u0683",
  35283. "\uFB79",
  35284. "\u0683",
  35285. "\uFB7A",
  35286. "\u0686",
  35287. "\uFB7B",
  35288. "\u0686",
  35289. "\uFB7C",
  35290. "\u0686",
  35291. "\uFB7D",
  35292. "\u0686",
  35293. "\uFB7E",
  35294. "\u0687",
  35295. "\uFB7F",
  35296. "\u0687",
  35297. "\uFB80",
  35298. "\u0687",
  35299. "\uFB81",
  35300. "\u0687",
  35301. "\uFB82",
  35302. "\u068D",
  35303. "\uFB83",
  35304. "\u068D",
  35305. "\uFB84",
  35306. "\u068C",
  35307. "\uFB85",
  35308. "\u068C",
  35309. "\uFB86",
  35310. "\u068E",
  35311. "\uFB87",
  35312. "\u068E",
  35313. "\uFB88",
  35314. "\u0688",
  35315. "\uFB89",
  35316. "\u0688",
  35317. "\uFB8A",
  35318. "\u0698",
  35319. "\uFB8B",
  35320. "\u0698",
  35321. "\uFB8C",
  35322. "\u0691",
  35323. "\uFB8D",
  35324. "\u0691",
  35325. "\uFB8E",
  35326. "\u06A9",
  35327. "\uFB8F",
  35328. "\u06A9",
  35329. "\uFB90",
  35330. "\u06A9",
  35331. "\uFB91",
  35332. "\u06A9",
  35333. "\uFB92",
  35334. "\u06AF",
  35335. "\uFB93",
  35336. "\u06AF",
  35337. "\uFB94",
  35338. "\u06AF",
  35339. "\uFB95",
  35340. "\u06AF",
  35341. "\uFB96",
  35342. "\u06B3",
  35343. "\uFB97",
  35344. "\u06B3",
  35345. "\uFB98",
  35346. "\u06B3",
  35347. "\uFB99",
  35348. "\u06B3",
  35349. "\uFB9A",
  35350. "\u06B1",
  35351. "\uFB9B",
  35352. "\u06B1",
  35353. "\uFB9C",
  35354. "\u06B1",
  35355. "\uFB9D",
  35356. "\u06B1",
  35357. "\uFB9E",
  35358. "\u06BA",
  35359. "\uFB9F",
  35360. "\u06BA",
  35361. "\uFBA0",
  35362. "\u06BB",
  35363. "\uFBA1",
  35364. "\u06BB",
  35365. "\uFBA2",
  35366. "\u06BB",
  35367. "\uFBA3",
  35368. "\u06BB",
  35369. "\uFBA4",
  35370. "\u06C0",
  35371. "\uFBA5",
  35372. "\u06C0",
  35373. "\uFBA6",
  35374. "\u06C1",
  35375. "\uFBA7",
  35376. "\u06C1",
  35377. "\uFBA8",
  35378. "\u06C1",
  35379. "\uFBA9",
  35380. "\u06C1",
  35381. "\uFBAA",
  35382. "\u06BE",
  35383. "\uFBAB",
  35384. "\u06BE",
  35385. "\uFBAC",
  35386. "\u06BE",
  35387. "\uFBAD",
  35388. "\u06BE",
  35389. "\uFBAE",
  35390. "\u06D2",
  35391. "\uFBAF",
  35392. "\u06D2",
  35393. "\uFBB0",
  35394. "\u06D3",
  35395. "\uFBB1",
  35396. "\u06D3",
  35397. "\uFBD3",
  35398. "\u06AD",
  35399. "\uFBD4",
  35400. "\u06AD",
  35401. "\uFBD5",
  35402. "\u06AD",
  35403. "\uFBD6",
  35404. "\u06AD",
  35405. "\uFBD7",
  35406. "\u06C7",
  35407. "\uFBD8",
  35408. "\u06C7",
  35409. "\uFBD9",
  35410. "\u06C6",
  35411. "\uFBDA",
  35412. "\u06C6",
  35413. "\uFBDB",
  35414. "\u06C8",
  35415. "\uFBDC",
  35416. "\u06C8",
  35417. "\uFBDD",
  35418. "\u0677",
  35419. "\uFBDE",
  35420. "\u06CB",
  35421. "\uFBDF",
  35422. "\u06CB",
  35423. "\uFBE0",
  35424. "\u06C5",
  35425. "\uFBE1",
  35426. "\u06C5",
  35427. "\uFBE2",
  35428. "\u06C9",
  35429. "\uFBE3",
  35430. "\u06C9",
  35431. "\uFBE4",
  35432. "\u06D0",
  35433. "\uFBE5",
  35434. "\u06D0",
  35435. "\uFBE6",
  35436. "\u06D0",
  35437. "\uFBE7",
  35438. "\u06D0",
  35439. "\uFBE8",
  35440. "\u0649",
  35441. "\uFBE9",
  35442. "\u0649",
  35443. "\uFBEA",
  35444. "\u0626\u0627",
  35445. "\uFBEB",
  35446. "\u0626\u0627",
  35447. "\uFBEC",
  35448. "\u0626\u06D5",
  35449. "\uFBED",
  35450. "\u0626\u06D5",
  35451. "\uFBEE",
  35452. "\u0626\u0648",
  35453. "\uFBEF",
  35454. "\u0626\u0648",
  35455. "\uFBF0",
  35456. "\u0626\u06C7",
  35457. "\uFBF1",
  35458. "\u0626\u06C7",
  35459. "\uFBF2",
  35460. "\u0626\u06C6",
  35461. "\uFBF3",
  35462. "\u0626\u06C6",
  35463. "\uFBF4",
  35464. "\u0626\u06C8",
  35465. "\uFBF5",
  35466. "\u0626\u06C8",
  35467. "\uFBF6",
  35468. "\u0626\u06D0",
  35469. "\uFBF7",
  35470. "\u0626\u06D0",
  35471. "\uFBF8",
  35472. "\u0626\u06D0",
  35473. "\uFBF9",
  35474. "\u0626\u0649",
  35475. "\uFBFA",
  35476. "\u0626\u0649",
  35477. "\uFBFB",
  35478. "\u0626\u0649",
  35479. "\uFBFC",
  35480. "\u06CC",
  35481. "\uFBFD",
  35482. "\u06CC",
  35483. "\uFBFE",
  35484. "\u06CC",
  35485. "\uFBFF",
  35486. "\u06CC",
  35487. "\uFC00",
  35488. "\u0626\u062C",
  35489. "\uFC01",
  35490. "\u0626\u062D",
  35491. "\uFC02",
  35492. "\u0626\u0645",
  35493. "\uFC03",
  35494. "\u0626\u0649",
  35495. "\uFC04",
  35496. "\u0626\u064A",
  35497. "\uFC05",
  35498. "\u0628\u062C",
  35499. "\uFC06",
  35500. "\u0628\u062D",
  35501. "\uFC07",
  35502. "\u0628\u062E",
  35503. "\uFC08",
  35504. "\u0628\u0645",
  35505. "\uFC09",
  35506. "\u0628\u0649",
  35507. "\uFC0A",
  35508. "\u0628\u064A",
  35509. "\uFC0B",
  35510. "\u062A\u062C",
  35511. "\uFC0C",
  35512. "\u062A\u062D",
  35513. "\uFC0D",
  35514. "\u062A\u062E",
  35515. "\uFC0E",
  35516. "\u062A\u0645",
  35517. "\uFC0F",
  35518. "\u062A\u0649",
  35519. "\uFC10",
  35520. "\u062A\u064A",
  35521. "\uFC11",
  35522. "\u062B\u062C",
  35523. "\uFC12",
  35524. "\u062B\u0645",
  35525. "\uFC13",
  35526. "\u062B\u0649",
  35527. "\uFC14",
  35528. "\u062B\u064A",
  35529. "\uFC15",
  35530. "\u062C\u062D",
  35531. "\uFC16",
  35532. "\u062C\u0645",
  35533. "\uFC17",
  35534. "\u062D\u062C",
  35535. "\uFC18",
  35536. "\u062D\u0645",
  35537. "\uFC19",
  35538. "\u062E\u062C",
  35539. "\uFC1A",
  35540. "\u062E\u062D",
  35541. "\uFC1B",
  35542. "\u062E\u0645",
  35543. "\uFC1C",
  35544. "\u0633\u062C",
  35545. "\uFC1D",
  35546. "\u0633\u062D",
  35547. "\uFC1E",
  35548. "\u0633\u062E",
  35549. "\uFC1F",
  35550. "\u0633\u0645",
  35551. "\uFC20",
  35552. "\u0635\u062D",
  35553. "\uFC21",
  35554. "\u0635\u0645",
  35555. "\uFC22",
  35556. "\u0636\u062C",
  35557. "\uFC23",
  35558. "\u0636\u062D",
  35559. "\uFC24",
  35560. "\u0636\u062E",
  35561. "\uFC25",
  35562. "\u0636\u0645",
  35563. "\uFC26",
  35564. "\u0637\u062D",
  35565. "\uFC27",
  35566. "\u0637\u0645",
  35567. "\uFC28",
  35568. "\u0638\u0645",
  35569. "\uFC29",
  35570. "\u0639\u062C",
  35571. "\uFC2A",
  35572. "\u0639\u0645",
  35573. "\uFC2B",
  35574. "\u063A\u062C",
  35575. "\uFC2C",
  35576. "\u063A\u0645",
  35577. "\uFC2D",
  35578. "\u0641\u062C",
  35579. "\uFC2E",
  35580. "\u0641\u062D",
  35581. "\uFC2F",
  35582. "\u0641\u062E",
  35583. "\uFC30",
  35584. "\u0641\u0645",
  35585. "\uFC31",
  35586. "\u0641\u0649",
  35587. "\uFC32",
  35588. "\u0641\u064A",
  35589. "\uFC33",
  35590. "\u0642\u062D",
  35591. "\uFC34",
  35592. "\u0642\u0645",
  35593. "\uFC35",
  35594. "\u0642\u0649",
  35595. "\uFC36",
  35596. "\u0642\u064A",
  35597. "\uFC37",
  35598. "\u0643\u0627",
  35599. "\uFC38",
  35600. "\u0643\u062C",
  35601. "\uFC39",
  35602. "\u0643\u062D",
  35603. "\uFC3A",
  35604. "\u0643\u062E",
  35605. "\uFC3B",
  35606. "\u0643\u0644",
  35607. "\uFC3C",
  35608. "\u0643\u0645",
  35609. "\uFC3D",
  35610. "\u0643\u0649",
  35611. "\uFC3E",
  35612. "\u0643\u064A",
  35613. "\uFC3F",
  35614. "\u0644\u062C",
  35615. "\uFC40",
  35616. "\u0644\u062D",
  35617. "\uFC41",
  35618. "\u0644\u062E",
  35619. "\uFC42",
  35620. "\u0644\u0645",
  35621. "\uFC43",
  35622. "\u0644\u0649",
  35623. "\uFC44",
  35624. "\u0644\u064A",
  35625. "\uFC45",
  35626. "\u0645\u062C",
  35627. "\uFC46",
  35628. "\u0645\u062D",
  35629. "\uFC47",
  35630. "\u0645\u062E",
  35631. "\uFC48",
  35632. "\u0645\u0645",
  35633. "\uFC49",
  35634. "\u0645\u0649",
  35635. "\uFC4A",
  35636. "\u0645\u064A",
  35637. "\uFC4B",
  35638. "\u0646\u062C",
  35639. "\uFC4C",
  35640. "\u0646\u062D",
  35641. "\uFC4D",
  35642. "\u0646\u062E",
  35643. "\uFC4E",
  35644. "\u0646\u0645",
  35645. "\uFC4F",
  35646. "\u0646\u0649",
  35647. "\uFC50",
  35648. "\u0646\u064A",
  35649. "\uFC51",
  35650. "\u0647\u062C",
  35651. "\uFC52",
  35652. "\u0647\u0645",
  35653. "\uFC53",
  35654. "\u0647\u0649",
  35655. "\uFC54",
  35656. "\u0647\u064A",
  35657. "\uFC55",
  35658. "\u064A\u062C",
  35659. "\uFC56",
  35660. "\u064A\u062D",
  35661. "\uFC57",
  35662. "\u064A\u062E",
  35663. "\uFC58",
  35664. "\u064A\u0645",
  35665. "\uFC59",
  35666. "\u064A\u0649",
  35667. "\uFC5A",
  35668. "\u064A\u064A",
  35669. "\uFC5B",
  35670. "\u0630\u0670",
  35671. "\uFC5C",
  35672. "\u0631\u0670",
  35673. "\uFC5D",
  35674. "\u0649\u0670",
  35675. "\uFC5E",
  35676. "\u0020\u064C\u0651",
  35677. "\uFC5F",
  35678. "\u0020\u064D\u0651",
  35679. "\uFC60",
  35680. "\u0020\u064E\u0651",
  35681. "\uFC61",
  35682. "\u0020\u064F\u0651",
  35683. "\uFC62",
  35684. "\u0020\u0650\u0651",
  35685. "\uFC63",
  35686. "\u0020\u0651\u0670",
  35687. "\uFC64",
  35688. "\u0626\u0631",
  35689. "\uFC65",
  35690. "\u0626\u0632",
  35691. "\uFC66",
  35692. "\u0626\u0645",
  35693. "\uFC67",
  35694. "\u0626\u0646",
  35695. "\uFC68",
  35696. "\u0626\u0649",
  35697. "\uFC69",
  35698. "\u0626\u064A",
  35699. "\uFC6A",
  35700. "\u0628\u0631",
  35701. "\uFC6B",
  35702. "\u0628\u0632",
  35703. "\uFC6C",
  35704. "\u0628\u0645",
  35705. "\uFC6D",
  35706. "\u0628\u0646",
  35707. "\uFC6E",
  35708. "\u0628\u0649",
  35709. "\uFC6F",
  35710. "\u0628\u064A",
  35711. "\uFC70",
  35712. "\u062A\u0631",
  35713. "\uFC71",
  35714. "\u062A\u0632",
  35715. "\uFC72",
  35716. "\u062A\u0645",
  35717. "\uFC73",
  35718. "\u062A\u0646",
  35719. "\uFC74",
  35720. "\u062A\u0649",
  35721. "\uFC75",
  35722. "\u062A\u064A",
  35723. "\uFC76",
  35724. "\u062B\u0631",
  35725. "\uFC77",
  35726. "\u062B\u0632",
  35727. "\uFC78",
  35728. "\u062B\u0645",
  35729. "\uFC79",
  35730. "\u062B\u0646",
  35731. "\uFC7A",
  35732. "\u062B\u0649",
  35733. "\uFC7B",
  35734. "\u062B\u064A",
  35735. "\uFC7C",
  35736. "\u0641\u0649",
  35737. "\uFC7D",
  35738. "\u0641\u064A",
  35739. "\uFC7E",
  35740. "\u0642\u0649",
  35741. "\uFC7F",
  35742. "\u0642\u064A",
  35743. "\uFC80",
  35744. "\u0643\u0627",
  35745. "\uFC81",
  35746. "\u0643\u0644",
  35747. "\uFC82",
  35748. "\u0643\u0645",
  35749. "\uFC83",
  35750. "\u0643\u0649",
  35751. "\uFC84",
  35752. "\u0643\u064A",
  35753. "\uFC85",
  35754. "\u0644\u0645",
  35755. "\uFC86",
  35756. "\u0644\u0649",
  35757. "\uFC87",
  35758. "\u0644\u064A",
  35759. "\uFC88",
  35760. "\u0645\u0627",
  35761. "\uFC89",
  35762. "\u0645\u0645",
  35763. "\uFC8A",
  35764. "\u0646\u0631",
  35765. "\uFC8B",
  35766. "\u0646\u0632",
  35767. "\uFC8C",
  35768. "\u0646\u0645",
  35769. "\uFC8D",
  35770. "\u0646\u0646",
  35771. "\uFC8E",
  35772. "\u0646\u0649",
  35773. "\uFC8F",
  35774. "\u0646\u064A",
  35775. "\uFC90",
  35776. "\u0649\u0670",
  35777. "\uFC91",
  35778. "\u064A\u0631",
  35779. "\uFC92",
  35780. "\u064A\u0632",
  35781. "\uFC93",
  35782. "\u064A\u0645",
  35783. "\uFC94",
  35784. "\u064A\u0646",
  35785. "\uFC95",
  35786. "\u064A\u0649",
  35787. "\uFC96",
  35788. "\u064A\u064A",
  35789. "\uFC97",
  35790. "\u0626\u062C",
  35791. "\uFC98",
  35792. "\u0626\u062D",
  35793. "\uFC99",
  35794. "\u0626\u062E",
  35795. "\uFC9A",
  35796. "\u0626\u0645",
  35797. "\uFC9B",
  35798. "\u0626\u0647",
  35799. "\uFC9C",
  35800. "\u0628\u062C",
  35801. "\uFC9D",
  35802. "\u0628\u062D",
  35803. "\uFC9E",
  35804. "\u0628\u062E",
  35805. "\uFC9F",
  35806. "\u0628\u0645",
  35807. "\uFCA0",
  35808. "\u0628\u0647",
  35809. "\uFCA1",
  35810. "\u062A\u062C",
  35811. "\uFCA2",
  35812. "\u062A\u062D",
  35813. "\uFCA3",
  35814. "\u062A\u062E",
  35815. "\uFCA4",
  35816. "\u062A\u0645",
  35817. "\uFCA5",
  35818. "\u062A\u0647",
  35819. "\uFCA6",
  35820. "\u062B\u0645",
  35821. "\uFCA7",
  35822. "\u062C\u062D",
  35823. "\uFCA8",
  35824. "\u062C\u0645",
  35825. "\uFCA9",
  35826. "\u062D\u062C",
  35827. "\uFCAA",
  35828. "\u062D\u0645",
  35829. "\uFCAB",
  35830. "\u062E\u062C",
  35831. "\uFCAC",
  35832. "\u062E\u0645",
  35833. "\uFCAD",
  35834. "\u0633\u062C",
  35835. "\uFCAE",
  35836. "\u0633\u062D",
  35837. "\uFCAF",
  35838. "\u0633\u062E",
  35839. "\uFCB0",
  35840. "\u0633\u0645",
  35841. "\uFCB1",
  35842. "\u0635\u062D",
  35843. "\uFCB2",
  35844. "\u0635\u062E",
  35845. "\uFCB3",
  35846. "\u0635\u0645",
  35847. "\uFCB4",
  35848. "\u0636\u062C",
  35849. "\uFCB5",
  35850. "\u0636\u062D",
  35851. "\uFCB6",
  35852. "\u0636\u062E",
  35853. "\uFCB7",
  35854. "\u0636\u0645",
  35855. "\uFCB8",
  35856. "\u0637\u062D",
  35857. "\uFCB9",
  35858. "\u0638\u0645",
  35859. "\uFCBA",
  35860. "\u0639\u062C",
  35861. "\uFCBB",
  35862. "\u0639\u0645",
  35863. "\uFCBC",
  35864. "\u063A\u062C",
  35865. "\uFCBD",
  35866. "\u063A\u0645",
  35867. "\uFCBE",
  35868. "\u0641\u062C",
  35869. "\uFCBF",
  35870. "\u0641\u062D",
  35871. "\uFCC0",
  35872. "\u0641\u062E",
  35873. "\uFCC1",
  35874. "\u0641\u0645",
  35875. "\uFCC2",
  35876. "\u0642\u062D",
  35877. "\uFCC3",
  35878. "\u0642\u0645",
  35879. "\uFCC4",
  35880. "\u0643\u062C",
  35881. "\uFCC5",
  35882. "\u0643\u062D",
  35883. "\uFCC6",
  35884. "\u0643\u062E",
  35885. "\uFCC7",
  35886. "\u0643\u0644",
  35887. "\uFCC8",
  35888. "\u0643\u0645",
  35889. "\uFCC9",
  35890. "\u0644\u062C",
  35891. "\uFCCA",
  35892. "\u0644\u062D",
  35893. "\uFCCB",
  35894. "\u0644\u062E",
  35895. "\uFCCC",
  35896. "\u0644\u0645",
  35897. "\uFCCD",
  35898. "\u0644\u0647",
  35899. "\uFCCE",
  35900. "\u0645\u062C",
  35901. "\uFCCF",
  35902. "\u0645\u062D",
  35903. "\uFCD0",
  35904. "\u0645\u062E",
  35905. "\uFCD1",
  35906. "\u0645\u0645",
  35907. "\uFCD2",
  35908. "\u0646\u062C",
  35909. "\uFCD3",
  35910. "\u0646\u062D",
  35911. "\uFCD4",
  35912. "\u0646\u062E",
  35913. "\uFCD5",
  35914. "\u0646\u0645",
  35915. "\uFCD6",
  35916. "\u0646\u0647",
  35917. "\uFCD7",
  35918. "\u0647\u062C",
  35919. "\uFCD8",
  35920. "\u0647\u0645",
  35921. "\uFCD9",
  35922. "\u0647\u0670",
  35923. "\uFCDA",
  35924. "\u064A\u062C",
  35925. "\uFCDB",
  35926. "\u064A\u062D",
  35927. "\uFCDC",
  35928. "\u064A\u062E",
  35929. "\uFCDD",
  35930. "\u064A\u0645",
  35931. "\uFCDE",
  35932. "\u064A\u0647",
  35933. "\uFCDF",
  35934. "\u0626\u0645",
  35935. "\uFCE0",
  35936. "\u0626\u0647",
  35937. "\uFCE1",
  35938. "\u0628\u0645",
  35939. "\uFCE2",
  35940. "\u0628\u0647",
  35941. "\uFCE3",
  35942. "\u062A\u0645",
  35943. "\uFCE4",
  35944. "\u062A\u0647",
  35945. "\uFCE5",
  35946. "\u062B\u0645",
  35947. "\uFCE6",
  35948. "\u062B\u0647",
  35949. "\uFCE7",
  35950. "\u0633\u0645",
  35951. "\uFCE8",
  35952. "\u0633\u0647",
  35953. "\uFCE9",
  35954. "\u0634\u0645",
  35955. "\uFCEA",
  35956. "\u0634\u0647",
  35957. "\uFCEB",
  35958. "\u0643\u0644",
  35959. "\uFCEC",
  35960. "\u0643\u0645",
  35961. "\uFCED",
  35962. "\u0644\u0645",
  35963. "\uFCEE",
  35964. "\u0646\u0645",
  35965. "\uFCEF",
  35966. "\u0646\u0647",
  35967. "\uFCF0",
  35968. "\u064A\u0645",
  35969. "\uFCF1",
  35970. "\u064A\u0647",
  35971. "\uFCF2",
  35972. "\u0640\u064E\u0651",
  35973. "\uFCF3",
  35974. "\u0640\u064F\u0651",
  35975. "\uFCF4",
  35976. "\u0640\u0650\u0651",
  35977. "\uFCF5",
  35978. "\u0637\u0649",
  35979. "\uFCF6",
  35980. "\u0637\u064A",
  35981. "\uFCF7",
  35982. "\u0639\u0649",
  35983. "\uFCF8",
  35984. "\u0639\u064A",
  35985. "\uFCF9",
  35986. "\u063A\u0649",
  35987. "\uFCFA",
  35988. "\u063A\u064A",
  35989. "\uFCFB",
  35990. "\u0633\u0649",
  35991. "\uFCFC",
  35992. "\u0633\u064A",
  35993. "\uFCFD",
  35994. "\u0634\u0649",
  35995. "\uFCFE",
  35996. "\u0634\u064A",
  35997. "\uFCFF",
  35998. "\u062D\u0649",
  35999. "\uFD00",
  36000. "\u062D\u064A",
  36001. "\uFD01",
  36002. "\u062C\u0649",
  36003. "\uFD02",
  36004. "\u062C\u064A",
  36005. "\uFD03",
  36006. "\u062E\u0649",
  36007. "\uFD04",
  36008. "\u062E\u064A",
  36009. "\uFD05",
  36010. "\u0635\u0649",
  36011. "\uFD06",
  36012. "\u0635\u064A",
  36013. "\uFD07",
  36014. "\u0636\u0649",
  36015. "\uFD08",
  36016. "\u0636\u064A",
  36017. "\uFD09",
  36018. "\u0634\u062C",
  36019. "\uFD0A",
  36020. "\u0634\u062D",
  36021. "\uFD0B",
  36022. "\u0634\u062E",
  36023. "\uFD0C",
  36024. "\u0634\u0645",
  36025. "\uFD0D",
  36026. "\u0634\u0631",
  36027. "\uFD0E",
  36028. "\u0633\u0631",
  36029. "\uFD0F",
  36030. "\u0635\u0631",
  36031. "\uFD10",
  36032. "\u0636\u0631",
  36033. "\uFD11",
  36034. "\u0637\u0649",
  36035. "\uFD12",
  36036. "\u0637\u064A",
  36037. "\uFD13",
  36038. "\u0639\u0649",
  36039. "\uFD14",
  36040. "\u0639\u064A",
  36041. "\uFD15",
  36042. "\u063A\u0649",
  36043. "\uFD16",
  36044. "\u063A\u064A",
  36045. "\uFD17",
  36046. "\u0633\u0649",
  36047. "\uFD18",
  36048. "\u0633\u064A",
  36049. "\uFD19",
  36050. "\u0634\u0649",
  36051. "\uFD1A",
  36052. "\u0634\u064A",
  36053. "\uFD1B",
  36054. "\u062D\u0649",
  36055. "\uFD1C",
  36056. "\u062D\u064A",
  36057. "\uFD1D",
  36058. "\u062C\u0649",
  36059. "\uFD1E",
  36060. "\u062C\u064A",
  36061. "\uFD1F",
  36062. "\u062E\u0649",
  36063. "\uFD20",
  36064. "\u062E\u064A",
  36065. "\uFD21",
  36066. "\u0635\u0649",
  36067. "\uFD22",
  36068. "\u0635\u064A",
  36069. "\uFD23",
  36070. "\u0636\u0649",
  36071. "\uFD24",
  36072. "\u0636\u064A",
  36073. "\uFD25",
  36074. "\u0634\u062C",
  36075. "\uFD26",
  36076. "\u0634\u062D",
  36077. "\uFD27",
  36078. "\u0634\u062E",
  36079. "\uFD28",
  36080. "\u0634\u0645",
  36081. "\uFD29",
  36082. "\u0634\u0631",
  36083. "\uFD2A",
  36084. "\u0633\u0631",
  36085. "\uFD2B",
  36086. "\u0635\u0631",
  36087. "\uFD2C",
  36088. "\u0636\u0631",
  36089. "\uFD2D",
  36090. "\u0634\u062C",
  36091. "\uFD2E",
  36092. "\u0634\u062D",
  36093. "\uFD2F",
  36094. "\u0634\u062E",
  36095. "\uFD30",
  36096. "\u0634\u0645",
  36097. "\uFD31",
  36098. "\u0633\u0647",
  36099. "\uFD32",
  36100. "\u0634\u0647",
  36101. "\uFD33",
  36102. "\u0637\u0645",
  36103. "\uFD34",
  36104. "\u0633\u062C",
  36105. "\uFD35",
  36106. "\u0633\u062D",
  36107. "\uFD36",
  36108. "\u0633\u062E",
  36109. "\uFD37",
  36110. "\u0634\u062C",
  36111. "\uFD38",
  36112. "\u0634\u062D",
  36113. "\uFD39",
  36114. "\u0634\u062E",
  36115. "\uFD3A",
  36116. "\u0637\u0645",
  36117. "\uFD3B",
  36118. "\u0638\u0645",
  36119. "\uFD3C",
  36120. "\u0627\u064B",
  36121. "\uFD3D",
  36122. "\u0627\u064B",
  36123. "\uFD50",
  36124. "\u062A\u062C\u0645",
  36125. "\uFD51",
  36126. "\u062A\u062D\u062C",
  36127. "\uFD52",
  36128. "\u062A\u062D\u062C",
  36129. "\uFD53",
  36130. "\u062A\u062D\u0645",
  36131. "\uFD54",
  36132. "\u062A\u062E\u0645",
  36133. "\uFD55",
  36134. "\u062A\u0645\u062C",
  36135. "\uFD56",
  36136. "\u062A\u0645\u062D",
  36137. "\uFD57",
  36138. "\u062A\u0645\u062E",
  36139. "\uFD58",
  36140. "\u062C\u0645\u062D",
  36141. "\uFD59",
  36142. "\u062C\u0645\u062D",
  36143. "\uFD5A",
  36144. "\u062D\u0645\u064A",
  36145. "\uFD5B",
  36146. "\u062D\u0645\u0649",
  36147. "\uFD5C",
  36148. "\u0633\u062D\u062C",
  36149. "\uFD5D",
  36150. "\u0633\u062C\u062D",
  36151. "\uFD5E",
  36152. "\u0633\u062C\u0649",
  36153. "\uFD5F",
  36154. "\u0633\u0645\u062D",
  36155. "\uFD60",
  36156. "\u0633\u0645\u062D",
  36157. "\uFD61",
  36158. "\u0633\u0645\u062C",
  36159. "\uFD62",
  36160. "\u0633\u0645\u0645",
  36161. "\uFD63",
  36162. "\u0633\u0645\u0645",
  36163. "\uFD64",
  36164. "\u0635\u062D\u062D",
  36165. "\uFD65",
  36166. "\u0635\u062D\u062D",
  36167. "\uFD66",
  36168. "\u0635\u0645\u0645",
  36169. "\uFD67",
  36170. "\u0634\u062D\u0645",
  36171. "\uFD68",
  36172. "\u0634\u062D\u0645",
  36173. "\uFD69",
  36174. "\u0634\u062C\u064A",
  36175. "\uFD6A",
  36176. "\u0634\u0645\u062E",
  36177. "\uFD6B",
  36178. "\u0634\u0645\u062E",
  36179. "\uFD6C",
  36180. "\u0634\u0645\u0645",
  36181. "\uFD6D",
  36182. "\u0634\u0645\u0645",
  36183. "\uFD6E",
  36184. "\u0636\u062D\u0649",
  36185. "\uFD6F",
  36186. "\u0636\u062E\u0645",
  36187. "\uFD70",
  36188. "\u0636\u062E\u0645",
  36189. "\uFD71",
  36190. "\u0637\u0645\u062D",
  36191. "\uFD72",
  36192. "\u0637\u0645\u062D",
  36193. "\uFD73",
  36194. "\u0637\u0645\u0645",
  36195. "\uFD74",
  36196. "\u0637\u0645\u064A",
  36197. "\uFD75",
  36198. "\u0639\u062C\u0645",
  36199. "\uFD76",
  36200. "\u0639\u0645\u0645",
  36201. "\uFD77",
  36202. "\u0639\u0645\u0645",
  36203. "\uFD78",
  36204. "\u0639\u0645\u0649",
  36205. "\uFD79",
  36206. "\u063A\u0645\u0645",
  36207. "\uFD7A",
  36208. "\u063A\u0645\u064A",
  36209. "\uFD7B",
  36210. "\u063A\u0645\u0649",
  36211. "\uFD7C",
  36212. "\u0641\u062E\u0645",
  36213. "\uFD7D",
  36214. "\u0641\u062E\u0645",
  36215. "\uFD7E",
  36216. "\u0642\u0645\u062D",
  36217. "\uFD7F",
  36218. "\u0642\u0645\u0645",
  36219. "\uFD80",
  36220. "\u0644\u062D\u0645",
  36221. "\uFD81",
  36222. "\u0644\u062D\u064A",
  36223. "\uFD82",
  36224. "\u0644\u062D\u0649",
  36225. "\uFD83",
  36226. "\u0644\u062C\u062C",
  36227. "\uFD84",
  36228. "\u0644\u062C\u062C",
  36229. "\uFD85",
  36230. "\u0644\u062E\u0645",
  36231. "\uFD86",
  36232. "\u0644\u062E\u0645",
  36233. "\uFD87",
  36234. "\u0644\u0645\u062D",
  36235. "\uFD88",
  36236. "\u0644\u0645\u062D",
  36237. "\uFD89",
  36238. "\u0645\u062D\u062C",
  36239. "\uFD8A",
  36240. "\u0645\u062D\u0645",
  36241. "\uFD8B",
  36242. "\u0645\u062D\u064A",
  36243. "\uFD8C",
  36244. "\u0645\u062C\u062D",
  36245. "\uFD8D",
  36246. "\u0645\u062C\u0645",
  36247. "\uFD8E",
  36248. "\u0645\u062E\u062C",
  36249. "\uFD8F",
  36250. "\u0645\u062E\u0645",
  36251. "\uFD92",
  36252. "\u0645\u062C\u062E",
  36253. "\uFD93",
  36254. "\u0647\u0645\u062C",
  36255. "\uFD94",
  36256. "\u0647\u0645\u0645",
  36257. "\uFD95",
  36258. "\u0646\u062D\u0645",
  36259. "\uFD96",
  36260. "\u0646\u062D\u0649",
  36261. "\uFD97",
  36262. "\u0646\u062C\u0645",
  36263. "\uFD98",
  36264. "\u0646\u062C\u0645",
  36265. "\uFD99",
  36266. "\u0646\u062C\u0649",
  36267. "\uFD9A",
  36268. "\u0646\u0645\u064A",
  36269. "\uFD9B",
  36270. "\u0646\u0645\u0649",
  36271. "\uFD9C",
  36272. "\u064A\u0645\u0645",
  36273. "\uFD9D",
  36274. "\u064A\u0645\u0645",
  36275. "\uFD9E",
  36276. "\u0628\u062E\u064A",
  36277. "\uFD9F",
  36278. "\u062A\u062C\u064A",
  36279. "\uFDA0",
  36280. "\u062A\u062C\u0649",
  36281. "\uFDA1",
  36282. "\u062A\u062E\u064A",
  36283. "\uFDA2",
  36284. "\u062A\u062E\u0649",
  36285. "\uFDA3",
  36286. "\u062A\u0645\u064A",
  36287. "\uFDA4",
  36288. "\u062A\u0645\u0649",
  36289. "\uFDA5",
  36290. "\u062C\u0645\u064A",
  36291. "\uFDA6",
  36292. "\u062C\u062D\u0649",
  36293. "\uFDA7",
  36294. "\u062C\u0645\u0649",
  36295. "\uFDA8",
  36296. "\u0633\u062E\u0649",
  36297. "\uFDA9",
  36298. "\u0635\u062D\u064A",
  36299. "\uFDAA",
  36300. "\u0634\u062D\u064A",
  36301. "\uFDAB",
  36302. "\u0636\u062D\u064A",
  36303. "\uFDAC",
  36304. "\u0644\u062C\u064A",
  36305. "\uFDAD",
  36306. "\u0644\u0645\u064A",
  36307. "\uFDAE",
  36308. "\u064A\u062D\u064A",
  36309. "\uFDAF",
  36310. "\u064A\u062C\u064A",
  36311. "\uFDB0",
  36312. "\u064A\u0645\u064A",
  36313. "\uFDB1",
  36314. "\u0645\u0645\u064A",
  36315. "\uFDB2",
  36316. "\u0642\u0645\u064A",
  36317. "\uFDB3",
  36318. "\u0646\u062D\u064A",
  36319. "\uFDB4",
  36320. "\u0642\u0645\u062D",
  36321. "\uFDB5",
  36322. "\u0644\u062D\u0645",
  36323. "\uFDB6",
  36324. "\u0639\u0645\u064A",
  36325. "\uFDB7",
  36326. "\u0643\u0645\u064A",
  36327. "\uFDB8",
  36328. "\u0646\u062C\u062D",
  36329. "\uFDB9",
  36330. "\u0645\u062E\u064A",
  36331. "\uFDBA",
  36332. "\u0644\u062C\u0645",
  36333. "\uFDBB",
  36334. "\u0643\u0645\u0645",
  36335. "\uFDBC",
  36336. "\u0644\u062C\u0645",
  36337. "\uFDBD",
  36338. "\u0646\u062C\u062D",
  36339. "\uFDBE",
  36340. "\u062C\u062D\u064A",
  36341. "\uFDBF",
  36342. "\u062D\u062C\u064A",
  36343. "\uFDC0",
  36344. "\u0645\u062C\u064A",
  36345. "\uFDC1",
  36346. "\u0641\u0645\u064A",
  36347. "\uFDC2",
  36348. "\u0628\u062D\u064A",
  36349. "\uFDC3",
  36350. "\u0643\u0645\u0645",
  36351. "\uFDC4",
  36352. "\u0639\u062C\u0645",
  36353. "\uFDC5",
  36354. "\u0635\u0645\u0645",
  36355. "\uFDC6",
  36356. "\u0633\u062E\u064A",
  36357. "\uFDC7",
  36358. "\u0646\u062C\u064A",
  36359. "\uFE49",
  36360. "\u203E",
  36361. "\uFE4A",
  36362. "\u203E",
  36363. "\uFE4B",
  36364. "\u203E",
  36365. "\uFE4C",
  36366. "\u203E",
  36367. "\uFE4D",
  36368. "\u005F",
  36369. "\uFE4E",
  36370. "\u005F",
  36371. "\uFE4F",
  36372. "\u005F",
  36373. "\uFE80",
  36374. "\u0621",
  36375. "\uFE81",
  36376. "\u0622",
  36377. "\uFE82",
  36378. "\u0622",
  36379. "\uFE83",
  36380. "\u0623",
  36381. "\uFE84",
  36382. "\u0623",
  36383. "\uFE85",
  36384. "\u0624",
  36385. "\uFE86",
  36386. "\u0624",
  36387. "\uFE87",
  36388. "\u0625",
  36389. "\uFE88",
  36390. "\u0625",
  36391. "\uFE89",
  36392. "\u0626",
  36393. "\uFE8A",
  36394. "\u0626",
  36395. "\uFE8B",
  36396. "\u0626",
  36397. "\uFE8C",
  36398. "\u0626",
  36399. "\uFE8D",
  36400. "\u0627",
  36401. "\uFE8E",
  36402. "\u0627",
  36403. "\uFE8F",
  36404. "\u0628",
  36405. "\uFE90",
  36406. "\u0628",
  36407. "\uFE91",
  36408. "\u0628",
  36409. "\uFE92",
  36410. "\u0628",
  36411. "\uFE93",
  36412. "\u0629",
  36413. "\uFE94",
  36414. "\u0629",
  36415. "\uFE95",
  36416. "\u062A",
  36417. "\uFE96",
  36418. "\u062A",
  36419. "\uFE97",
  36420. "\u062A",
  36421. "\uFE98",
  36422. "\u062A",
  36423. "\uFE99",
  36424. "\u062B",
  36425. "\uFE9A",
  36426. "\u062B",
  36427. "\uFE9B",
  36428. "\u062B",
  36429. "\uFE9C",
  36430. "\u062B",
  36431. "\uFE9D",
  36432. "\u062C",
  36433. "\uFE9E",
  36434. "\u062C",
  36435. "\uFE9F",
  36436. "\u062C",
  36437. "\uFEA0",
  36438. "\u062C",
  36439. "\uFEA1",
  36440. "\u062D",
  36441. "\uFEA2",
  36442. "\u062D",
  36443. "\uFEA3",
  36444. "\u062D",
  36445. "\uFEA4",
  36446. "\u062D",
  36447. "\uFEA5",
  36448. "\u062E",
  36449. "\uFEA6",
  36450. "\u062E",
  36451. "\uFEA7",
  36452. "\u062E",
  36453. "\uFEA8",
  36454. "\u062E",
  36455. "\uFEA9",
  36456. "\u062F",
  36457. "\uFEAA",
  36458. "\u062F",
  36459. "\uFEAB",
  36460. "\u0630",
  36461. "\uFEAC",
  36462. "\u0630",
  36463. "\uFEAD",
  36464. "\u0631",
  36465. "\uFEAE",
  36466. "\u0631",
  36467. "\uFEAF",
  36468. "\u0632",
  36469. "\uFEB0",
  36470. "\u0632",
  36471. "\uFEB1",
  36472. "\u0633",
  36473. "\uFEB2",
  36474. "\u0633",
  36475. "\uFEB3",
  36476. "\u0633",
  36477. "\uFEB4",
  36478. "\u0633",
  36479. "\uFEB5",
  36480. "\u0634",
  36481. "\uFEB6",
  36482. "\u0634",
  36483. "\uFEB7",
  36484. "\u0634",
  36485. "\uFEB8",
  36486. "\u0634",
  36487. "\uFEB9",
  36488. "\u0635",
  36489. "\uFEBA",
  36490. "\u0635",
  36491. "\uFEBB",
  36492. "\u0635",
  36493. "\uFEBC",
  36494. "\u0635",
  36495. "\uFEBD",
  36496. "\u0636",
  36497. "\uFEBE",
  36498. "\u0636",
  36499. "\uFEBF",
  36500. "\u0636",
  36501. "\uFEC0",
  36502. "\u0636",
  36503. "\uFEC1",
  36504. "\u0637",
  36505. "\uFEC2",
  36506. "\u0637",
  36507. "\uFEC3",
  36508. "\u0637",
  36509. "\uFEC4",
  36510. "\u0637",
  36511. "\uFEC5",
  36512. "\u0638",
  36513. "\uFEC6",
  36514. "\u0638",
  36515. "\uFEC7",
  36516. "\u0638",
  36517. "\uFEC8",
  36518. "\u0638",
  36519. "\uFEC9",
  36520. "\u0639",
  36521. "\uFECA",
  36522. "\u0639",
  36523. "\uFECB",
  36524. "\u0639",
  36525. "\uFECC",
  36526. "\u0639",
  36527. "\uFECD",
  36528. "\u063A",
  36529. "\uFECE",
  36530. "\u063A",
  36531. "\uFECF",
  36532. "\u063A",
  36533. "\uFED0",
  36534. "\u063A",
  36535. "\uFED1",
  36536. "\u0641",
  36537. "\uFED2",
  36538. "\u0641",
  36539. "\uFED3",
  36540. "\u0641",
  36541. "\uFED4",
  36542. "\u0641",
  36543. "\uFED5",
  36544. "\u0642",
  36545. "\uFED6",
  36546. "\u0642",
  36547. "\uFED7",
  36548. "\u0642",
  36549. "\uFED8",
  36550. "\u0642",
  36551. "\uFED9",
  36552. "\u0643",
  36553. "\uFEDA",
  36554. "\u0643",
  36555. "\uFEDB",
  36556. "\u0643",
  36557. "\uFEDC",
  36558. "\u0643",
  36559. "\uFEDD",
  36560. "\u0644",
  36561. "\uFEDE",
  36562. "\u0644",
  36563. "\uFEDF",
  36564. "\u0644",
  36565. "\uFEE0",
  36566. "\u0644",
  36567. "\uFEE1",
  36568. "\u0645",
  36569. "\uFEE2",
  36570. "\u0645",
  36571. "\uFEE3",
  36572. "\u0645",
  36573. "\uFEE4",
  36574. "\u0645",
  36575. "\uFEE5",
  36576. "\u0646",
  36577. "\uFEE6",
  36578. "\u0646",
  36579. "\uFEE7",
  36580. "\u0646",
  36581. "\uFEE8",
  36582. "\u0646",
  36583. "\uFEE9",
  36584. "\u0647",
  36585. "\uFEEA",
  36586. "\u0647",
  36587. "\uFEEB",
  36588. "\u0647",
  36589. "\uFEEC",
  36590. "\u0647",
  36591. "\uFEED",
  36592. "\u0648",
  36593. "\uFEEE",
  36594. "\u0648",
  36595. "\uFEEF",
  36596. "\u0649",
  36597. "\uFEF0",
  36598. "\u0649",
  36599. "\uFEF1",
  36600. "\u064A",
  36601. "\uFEF2",
  36602. "\u064A",
  36603. "\uFEF3",
  36604. "\u064A",
  36605. "\uFEF4",
  36606. "\u064A",
  36607. "\uFEF5",
  36608. "\u0644\u0622",
  36609. "\uFEF6",
  36610. "\u0644\u0622",
  36611. "\uFEF7",
  36612. "\u0644\u0623",
  36613. "\uFEF8",
  36614. "\u0644\u0623",
  36615. "\uFEF9",
  36616. "\u0644\u0625",
  36617. "\uFEFA",
  36618. "\u0644\u0625",
  36619. "\uFEFB",
  36620. "\u0644\u0627",
  36621. "\uFEFC",
  36622. "\u0644\u0627"
  36623. ];
  36624. });
  36625. function reverseIfRtl(chars) {
  36626. const charsLength = chars.length;
  36627. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  36628. return chars;
  36629. }
  36630. const buf = [];
  36631. for (let ii = charsLength - 1; ii >= 0; ii--) {
  36632. buf.push(chars[ii]);
  36633. }
  36634. return buf.join("");
  36635. }
  36636. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  36637. const CategoryCache = new Map();
  36638. function getCharUnicodeCategory(char) {
  36639. const cachedCategory = CategoryCache.get(char);
  36640. if (cachedCategory) {
  36641. return cachedCategory;
  36642. }
  36643. const groups = char.match(SpecialCharRegExp);
  36644. const category = {
  36645. isWhitespace: !!(groups && groups[1]),
  36646. isZeroWidthDiacritic: !!(groups && groups[2]),
  36647. isInvisibleFormatMark: !!(groups && groups[3])
  36648. };
  36649. CategoryCache.set(char, category);
  36650. return category;
  36651. }
  36652. function clearUnicodeCaches() {
  36653. CategoryCache.clear();
  36654. }
  36655. /***/ }),
  36656. /* 41 */
  36657. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36658. Object.defineProperty(exports, "__esModule", ({
  36659. value: true
  36660. }));
  36661. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  36662. exports.getStandardFontName = getStandardFontName;
  36663. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  36664. var _core_utils = __w_pdfjs_require__(6);
  36665. var _fonts_utils = __w_pdfjs_require__(38);
  36666. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36667. t["Times-Roman"] = "Times-Roman";
  36668. t.Helvetica = "Helvetica";
  36669. t.Courier = "Courier";
  36670. t.Symbol = "Symbol";
  36671. t["Times-Bold"] = "Times-Bold";
  36672. t["Helvetica-Bold"] = "Helvetica-Bold";
  36673. t["Courier-Bold"] = "Courier-Bold";
  36674. t.ZapfDingbats = "ZapfDingbats";
  36675. t["Times-Italic"] = "Times-Italic";
  36676. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  36677. t["Courier-Oblique"] = "Courier-Oblique";
  36678. t["Times-BoldItalic"] = "Times-BoldItalic";
  36679. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  36680. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  36681. t.ArialNarrow = "Helvetica";
  36682. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  36683. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  36684. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  36685. t.ArialBlack = "Helvetica";
  36686. t["ArialBlack-Bold"] = "Helvetica-Bold";
  36687. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  36688. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  36689. t["Arial-Black"] = "Helvetica";
  36690. t["Arial-Black-Bold"] = "Helvetica-Bold";
  36691. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  36692. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  36693. t.Arial = "Helvetica";
  36694. t["Arial-Bold"] = "Helvetica-Bold";
  36695. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  36696. t["Arial-Italic"] = "Helvetica-Oblique";
  36697. t.ArialMT = "Helvetica";
  36698. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  36699. t["Arial-BoldMT"] = "Helvetica-Bold";
  36700. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  36701. t.ArialUnicodeMS = "Helvetica";
  36702. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  36703. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  36704. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  36705. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  36706. t["Courier-Italic"] = "Courier-Oblique";
  36707. t.CourierNew = "Courier";
  36708. t["CourierNew-Bold"] = "Courier-Bold";
  36709. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  36710. t["CourierNew-Italic"] = "Courier-Oblique";
  36711. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  36712. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  36713. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  36714. t.CourierNewPSMT = "Courier";
  36715. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  36716. t["Helvetica-Italic"] = "Helvetica-Oblique";
  36717. t["Symbol-Bold"] = "Symbol";
  36718. t["Symbol-BoldItalic"] = "Symbol";
  36719. t["Symbol-Italic"] = "Symbol";
  36720. t.TimesNewRoman = "Times-Roman";
  36721. t["TimesNewRoman-Bold"] = "Times-Bold";
  36722. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  36723. t["TimesNewRoman-Italic"] = "Times-Italic";
  36724. t.TimesNewRomanPS = "Times-Roman";
  36725. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  36726. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  36727. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  36728. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  36729. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  36730. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  36731. t.TimesNewRomanPSMT = "Times-Roman";
  36732. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  36733. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  36734. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  36735. });
  36736. exports.getStdFontMap = getStdFontMap;
  36737. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36738. t.Courier = "FoxitFixed.pfb";
  36739. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  36740. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  36741. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  36742. t.Helvetica = "FoxitSans.pfb";
  36743. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  36744. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  36745. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  36746. t["Times-Roman"] = "FoxitSerif.pfb";
  36747. t["Times-Bold"] = "FoxitSerifBold.pfb";
  36748. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  36749. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  36750. t.Symbol = "FoxitSymbol.pfb";
  36751. t.ZapfDingbats = "FoxitDingbats.pfb";
  36752. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  36753. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  36754. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  36755. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  36756. });
  36757. exports.getFontNameToFileMap = getFontNameToFileMap;
  36758. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36759. t.Calibri = "Helvetica";
  36760. t["Calibri-Bold"] = "Helvetica-Bold";
  36761. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  36762. t["Calibri-Italic"] = "Helvetica-Oblique";
  36763. t.CenturyGothic = "Helvetica";
  36764. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  36765. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  36766. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  36767. t.ComicSansMS = "Comic Sans MS";
  36768. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  36769. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  36770. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  36771. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  36772. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  36773. t["ItcSymbol-Book"] = "Helvetica";
  36774. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  36775. t["ItcSymbol-Medium"] = "Helvetica";
  36776. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  36777. t.LucidaConsole = "Courier";
  36778. t["LucidaConsole-Bold"] = "Courier-Bold";
  36779. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  36780. t["LucidaConsole-Italic"] = "Courier-Oblique";
  36781. t["LucidaSans-Demi"] = "Helvetica-Bold";
  36782. t["MS-Gothic"] = "MS Gothic";
  36783. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  36784. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  36785. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  36786. t["MS-Mincho"] = "MS Mincho";
  36787. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  36788. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  36789. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  36790. t["MS-PGothic"] = "MS PGothic";
  36791. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  36792. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  36793. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  36794. t["MS-PMincho"] = "MS PMincho";
  36795. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  36796. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  36797. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  36798. t.NuptialScript = "Times-Italic";
  36799. t.SegoeUISymbol = "Helvetica";
  36800. t.Wingdings = "ZapfDingbats";
  36801. t["Wingdings-Regular"] = "ZapfDingbats";
  36802. });
  36803. exports.getNonStdFontMap = getNonStdFontMap;
  36804. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36805. t["Adobe Jenson"] = true;
  36806. t["Adobe Text"] = true;
  36807. t.Albertus = true;
  36808. t.Aldus = true;
  36809. t.Alexandria = true;
  36810. t.Algerian = true;
  36811. t["American Typewriter"] = true;
  36812. t.Antiqua = true;
  36813. t.Apex = true;
  36814. t.Arno = true;
  36815. t.Aster = true;
  36816. t.Aurora = true;
  36817. t.Baskerville = true;
  36818. t.Bell = true;
  36819. t.Bembo = true;
  36820. t["Bembo Schoolbook"] = true;
  36821. t.Benguiat = true;
  36822. t["Berkeley Old Style"] = true;
  36823. t["Bernhard Modern"] = true;
  36824. t["Berthold City"] = true;
  36825. t.Bodoni = true;
  36826. t["Bauer Bodoni"] = true;
  36827. t["Book Antiqua"] = true;
  36828. t.Bookman = true;
  36829. t["Bordeaux Roman"] = true;
  36830. t["Californian FB"] = true;
  36831. t.Calisto = true;
  36832. t.Calvert = true;
  36833. t.Capitals = true;
  36834. t.Cambria = true;
  36835. t.Cartier = true;
  36836. t.Caslon = true;
  36837. t.Catull = true;
  36838. t.Centaur = true;
  36839. t["Century Old Style"] = true;
  36840. t["Century Schoolbook"] = true;
  36841. t.Chaparral = true;
  36842. t["Charis SIL"] = true;
  36843. t.Cheltenham = true;
  36844. t["Cholla Slab"] = true;
  36845. t.Clarendon = true;
  36846. t.Clearface = true;
  36847. t.Cochin = true;
  36848. t.Colonna = true;
  36849. t["Computer Modern"] = true;
  36850. t["Concrete Roman"] = true;
  36851. t.Constantia = true;
  36852. t["Cooper Black"] = true;
  36853. t.Corona = true;
  36854. t.Ecotype = true;
  36855. t.Egyptienne = true;
  36856. t.Elephant = true;
  36857. t.Excelsior = true;
  36858. t.Fairfield = true;
  36859. t["FF Scala"] = true;
  36860. t.Folkard = true;
  36861. t.Footlight = true;
  36862. t.FreeSerif = true;
  36863. t["Friz Quadrata"] = true;
  36864. t.Garamond = true;
  36865. t.Gentium = true;
  36866. t.Georgia = true;
  36867. t.Gloucester = true;
  36868. t["Goudy Old Style"] = true;
  36869. t["Goudy Schoolbook"] = true;
  36870. t["Goudy Pro Font"] = true;
  36871. t.Granjon = true;
  36872. t["Guardian Egyptian"] = true;
  36873. t.Heather = true;
  36874. t.Hercules = true;
  36875. t["High Tower Text"] = true;
  36876. t.Hiroshige = true;
  36877. t["Hoefler Text"] = true;
  36878. t["Humana Serif"] = true;
  36879. t.Imprint = true;
  36880. t["Ionic No. 5"] = true;
  36881. t.Janson = true;
  36882. t.Joanna = true;
  36883. t.Korinna = true;
  36884. t.Lexicon = true;
  36885. t.LiberationSerif = true;
  36886. t["Liberation Serif"] = true;
  36887. t["Linux Libertine"] = true;
  36888. t.Literaturnaya = true;
  36889. t.Lucida = true;
  36890. t["Lucida Bright"] = true;
  36891. t.Melior = true;
  36892. t.Memphis = true;
  36893. t.Miller = true;
  36894. t.Minion = true;
  36895. t.Modern = true;
  36896. t["Mona Lisa"] = true;
  36897. t["Mrs Eaves"] = true;
  36898. t["MS Serif"] = true;
  36899. t["Museo Slab"] = true;
  36900. t["New York"] = true;
  36901. t["Nimbus Roman"] = true;
  36902. t["NPS Rawlinson Roadway"] = true;
  36903. t.NuptialScript = true;
  36904. t.Palatino = true;
  36905. t.Perpetua = true;
  36906. t.Plantin = true;
  36907. t["Plantin Schoolbook"] = true;
  36908. t.Playbill = true;
  36909. t["Poor Richard"] = true;
  36910. t["Rawlinson Roadway"] = true;
  36911. t.Renault = true;
  36912. t.Requiem = true;
  36913. t.Rockwell = true;
  36914. t.Roman = true;
  36915. t["Rotis Serif"] = true;
  36916. t.Sabon = true;
  36917. t.Scala = true;
  36918. t.Seagull = true;
  36919. t.Sistina = true;
  36920. t.Souvenir = true;
  36921. t.STIX = true;
  36922. t["Stone Informal"] = true;
  36923. t["Stone Serif"] = true;
  36924. t.Sylfaen = true;
  36925. t.Times = true;
  36926. t.Trajan = true;
  36927. t["Trinité"] = true;
  36928. t["Trump Mediaeval"] = true;
  36929. t.Utopia = true;
  36930. t["Vale Type"] = true;
  36931. t["Bitstream Vera"] = true;
  36932. t["Vera Serif"] = true;
  36933. t.Versailles = true;
  36934. t.Wanted = true;
  36935. t.Weiss = true;
  36936. t["Wide Latin"] = true;
  36937. t.Windsor = true;
  36938. t.XITS = true;
  36939. });
  36940. exports.getSerifFonts = getSerifFonts;
  36941. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36942. t.Dingbats = true;
  36943. t.Symbol = true;
  36944. t.ZapfDingbats = true;
  36945. });
  36946. exports.getSymbolsFonts = getSymbolsFonts;
  36947. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36948. t[2] = 10;
  36949. t[3] = 32;
  36950. t[4] = 33;
  36951. t[5] = 34;
  36952. t[6] = 35;
  36953. t[7] = 36;
  36954. t[8] = 37;
  36955. t[9] = 38;
  36956. t[10] = 39;
  36957. t[11] = 40;
  36958. t[12] = 41;
  36959. t[13] = 42;
  36960. t[14] = 43;
  36961. t[15] = 44;
  36962. t[16] = 45;
  36963. t[17] = 46;
  36964. t[18] = 47;
  36965. t[19] = 48;
  36966. t[20] = 49;
  36967. t[21] = 50;
  36968. t[22] = 51;
  36969. t[23] = 52;
  36970. t[24] = 53;
  36971. t[25] = 54;
  36972. t[26] = 55;
  36973. t[27] = 56;
  36974. t[28] = 57;
  36975. t[29] = 58;
  36976. t[30] = 894;
  36977. t[31] = 60;
  36978. t[32] = 61;
  36979. t[33] = 62;
  36980. t[34] = 63;
  36981. t[35] = 64;
  36982. t[36] = 65;
  36983. t[37] = 66;
  36984. t[38] = 67;
  36985. t[39] = 68;
  36986. t[40] = 69;
  36987. t[41] = 70;
  36988. t[42] = 71;
  36989. t[43] = 72;
  36990. t[44] = 73;
  36991. t[45] = 74;
  36992. t[46] = 75;
  36993. t[47] = 76;
  36994. t[48] = 77;
  36995. t[49] = 78;
  36996. t[50] = 79;
  36997. t[51] = 80;
  36998. t[52] = 81;
  36999. t[53] = 82;
  37000. t[54] = 83;
  37001. t[55] = 84;
  37002. t[56] = 85;
  37003. t[57] = 86;
  37004. t[58] = 87;
  37005. t[59] = 88;
  37006. t[60] = 89;
  37007. t[61] = 90;
  37008. t[62] = 91;
  37009. t[63] = 92;
  37010. t[64] = 93;
  37011. t[65] = 94;
  37012. t[66] = 95;
  37013. t[67] = 96;
  37014. t[68] = 97;
  37015. t[69] = 98;
  37016. t[70] = 99;
  37017. t[71] = 100;
  37018. t[72] = 101;
  37019. t[73] = 102;
  37020. t[74] = 103;
  37021. t[75] = 104;
  37022. t[76] = 105;
  37023. t[77] = 106;
  37024. t[78] = 107;
  37025. t[79] = 108;
  37026. t[80] = 109;
  37027. t[81] = 110;
  37028. t[82] = 111;
  37029. t[83] = 112;
  37030. t[84] = 113;
  37031. t[85] = 114;
  37032. t[86] = 115;
  37033. t[87] = 116;
  37034. t[88] = 117;
  37035. t[89] = 118;
  37036. t[90] = 119;
  37037. t[91] = 120;
  37038. t[92] = 121;
  37039. t[93] = 122;
  37040. t[94] = 123;
  37041. t[95] = 124;
  37042. t[96] = 125;
  37043. t[97] = 126;
  37044. t[98] = 196;
  37045. t[99] = 197;
  37046. t[100] = 199;
  37047. t[101] = 201;
  37048. t[102] = 209;
  37049. t[103] = 214;
  37050. t[104] = 220;
  37051. t[105] = 225;
  37052. t[106] = 224;
  37053. t[107] = 226;
  37054. t[108] = 228;
  37055. t[109] = 227;
  37056. t[110] = 229;
  37057. t[111] = 231;
  37058. t[112] = 233;
  37059. t[113] = 232;
  37060. t[114] = 234;
  37061. t[115] = 235;
  37062. t[116] = 237;
  37063. t[117] = 236;
  37064. t[118] = 238;
  37065. t[119] = 239;
  37066. t[120] = 241;
  37067. t[121] = 243;
  37068. t[122] = 242;
  37069. t[123] = 244;
  37070. t[124] = 246;
  37071. t[125] = 245;
  37072. t[126] = 250;
  37073. t[127] = 249;
  37074. t[128] = 251;
  37075. t[129] = 252;
  37076. t[130] = 8224;
  37077. t[131] = 176;
  37078. t[132] = 162;
  37079. t[133] = 163;
  37080. t[134] = 167;
  37081. t[135] = 8226;
  37082. t[136] = 182;
  37083. t[137] = 223;
  37084. t[138] = 174;
  37085. t[139] = 169;
  37086. t[140] = 8482;
  37087. t[141] = 180;
  37088. t[142] = 168;
  37089. t[143] = 8800;
  37090. t[144] = 198;
  37091. t[145] = 216;
  37092. t[146] = 8734;
  37093. t[147] = 177;
  37094. t[148] = 8804;
  37095. t[149] = 8805;
  37096. t[150] = 165;
  37097. t[151] = 181;
  37098. t[152] = 8706;
  37099. t[153] = 8721;
  37100. t[154] = 8719;
  37101. t[156] = 8747;
  37102. t[157] = 170;
  37103. t[158] = 186;
  37104. t[159] = 8486;
  37105. t[160] = 230;
  37106. t[161] = 248;
  37107. t[162] = 191;
  37108. t[163] = 161;
  37109. t[164] = 172;
  37110. t[165] = 8730;
  37111. t[166] = 402;
  37112. t[167] = 8776;
  37113. t[168] = 8710;
  37114. t[169] = 171;
  37115. t[170] = 187;
  37116. t[171] = 8230;
  37117. t[200] = 193;
  37118. t[203] = 205;
  37119. t[210] = 218;
  37120. t[223] = 711;
  37121. t[224] = 321;
  37122. t[225] = 322;
  37123. t[226] = 352;
  37124. t[227] = 353;
  37125. t[228] = 381;
  37126. t[229] = 382;
  37127. t[233] = 221;
  37128. t[234] = 253;
  37129. t[252] = 263;
  37130. t[253] = 268;
  37131. t[254] = 269;
  37132. t[258] = 258;
  37133. t[260] = 260;
  37134. t[261] = 261;
  37135. t[265] = 280;
  37136. t[266] = 281;
  37137. t[267] = 282;
  37138. t[268] = 283;
  37139. t[269] = 313;
  37140. t[275] = 323;
  37141. t[276] = 324;
  37142. t[278] = 328;
  37143. t[283] = 344;
  37144. t[284] = 345;
  37145. t[285] = 346;
  37146. t[286] = 347;
  37147. t[292] = 367;
  37148. t[295] = 377;
  37149. t[296] = 378;
  37150. t[298] = 380;
  37151. t[305] = 963;
  37152. t[306] = 964;
  37153. t[307] = 966;
  37154. t[308] = 8215;
  37155. t[309] = 8252;
  37156. t[310] = 8319;
  37157. t[311] = 8359;
  37158. t[312] = 8592;
  37159. t[313] = 8593;
  37160. t[337] = 9552;
  37161. t[493] = 1039;
  37162. t[494] = 1040;
  37163. t[672] = 1488;
  37164. t[673] = 1489;
  37165. t[674] = 1490;
  37166. t[675] = 1491;
  37167. t[676] = 1492;
  37168. t[677] = 1493;
  37169. t[678] = 1494;
  37170. t[679] = 1495;
  37171. t[680] = 1496;
  37172. t[681] = 1497;
  37173. t[682] = 1498;
  37174. t[683] = 1499;
  37175. t[684] = 1500;
  37176. t[685] = 1501;
  37177. t[686] = 1502;
  37178. t[687] = 1503;
  37179. t[688] = 1504;
  37180. t[689] = 1505;
  37181. t[690] = 1506;
  37182. t[691] = 1507;
  37183. t[692] = 1508;
  37184. t[693] = 1509;
  37185. t[694] = 1510;
  37186. t[695] = 1511;
  37187. t[696] = 1512;
  37188. t[697] = 1513;
  37189. t[698] = 1514;
  37190. t[705] = 1524;
  37191. t[706] = 8362;
  37192. t[710] = 64288;
  37193. t[711] = 64298;
  37194. t[759] = 1617;
  37195. t[761] = 1776;
  37196. t[763] = 1778;
  37197. t[775] = 1652;
  37198. t[777] = 1764;
  37199. t[778] = 1780;
  37200. t[779] = 1781;
  37201. t[780] = 1782;
  37202. t[782] = 771;
  37203. t[783] = 64726;
  37204. t[786] = 8363;
  37205. t[788] = 8532;
  37206. t[790] = 768;
  37207. t[791] = 769;
  37208. t[792] = 768;
  37209. t[795] = 803;
  37210. t[797] = 64336;
  37211. t[798] = 64337;
  37212. t[799] = 64342;
  37213. t[800] = 64343;
  37214. t[801] = 64344;
  37215. t[802] = 64345;
  37216. t[803] = 64362;
  37217. t[804] = 64363;
  37218. t[805] = 64364;
  37219. t[2424] = 7821;
  37220. t[2425] = 7822;
  37221. t[2426] = 7823;
  37222. t[2427] = 7824;
  37223. t[2428] = 7825;
  37224. t[2429] = 7826;
  37225. t[2430] = 7827;
  37226. t[2433] = 7682;
  37227. t[2678] = 8045;
  37228. t[2679] = 8046;
  37229. t[2830] = 1552;
  37230. t[2838] = 686;
  37231. t[2840] = 751;
  37232. t[2842] = 753;
  37233. t[2843] = 754;
  37234. t[2844] = 755;
  37235. t[2846] = 757;
  37236. t[2856] = 767;
  37237. t[2857] = 848;
  37238. t[2858] = 849;
  37239. t[2862] = 853;
  37240. t[2863] = 854;
  37241. t[2864] = 855;
  37242. t[2865] = 861;
  37243. t[2866] = 862;
  37244. t[2906] = 7460;
  37245. t[2908] = 7462;
  37246. t[2909] = 7463;
  37247. t[2910] = 7464;
  37248. t[2912] = 7466;
  37249. t[2913] = 7467;
  37250. t[2914] = 7468;
  37251. t[2916] = 7470;
  37252. t[2917] = 7471;
  37253. t[2918] = 7472;
  37254. t[2920] = 7474;
  37255. t[2921] = 7475;
  37256. t[2922] = 7476;
  37257. t[2924] = 7478;
  37258. t[2925] = 7479;
  37259. t[2926] = 7480;
  37260. t[2928] = 7482;
  37261. t[2929] = 7483;
  37262. t[2930] = 7484;
  37263. t[2932] = 7486;
  37264. t[2933] = 7487;
  37265. t[2934] = 7488;
  37266. t[2936] = 7490;
  37267. t[2937] = 7491;
  37268. t[2938] = 7492;
  37269. t[2940] = 7494;
  37270. t[2941] = 7495;
  37271. t[2942] = 7496;
  37272. t[2944] = 7498;
  37273. t[2946] = 7500;
  37274. t[2948] = 7502;
  37275. t[2950] = 7504;
  37276. t[2951] = 7505;
  37277. t[2952] = 7506;
  37278. t[2954] = 7508;
  37279. t[2955] = 7509;
  37280. t[2956] = 7510;
  37281. t[2958] = 7512;
  37282. t[2959] = 7513;
  37283. t[2960] = 7514;
  37284. t[2962] = 7516;
  37285. t[2963] = 7517;
  37286. t[2964] = 7518;
  37287. t[2966] = 7520;
  37288. t[2967] = 7521;
  37289. t[2968] = 7522;
  37290. t[2970] = 7524;
  37291. t[2971] = 7525;
  37292. t[2972] = 7526;
  37293. t[2974] = 7528;
  37294. t[2975] = 7529;
  37295. t[2976] = 7530;
  37296. t[2978] = 1537;
  37297. t[2979] = 1538;
  37298. t[2980] = 1539;
  37299. t[2982] = 1549;
  37300. t[2983] = 1551;
  37301. t[2984] = 1552;
  37302. t[2986] = 1554;
  37303. t[2987] = 1555;
  37304. t[2988] = 1556;
  37305. t[2990] = 1623;
  37306. t[2991] = 1624;
  37307. t[2995] = 1775;
  37308. t[2999] = 1791;
  37309. t[3002] = 64290;
  37310. t[3003] = 64291;
  37311. t[3004] = 64292;
  37312. t[3006] = 64294;
  37313. t[3007] = 64295;
  37314. t[3008] = 64296;
  37315. t[3011] = 1900;
  37316. t[3014] = 8223;
  37317. t[3015] = 8244;
  37318. t[3017] = 7532;
  37319. t[3018] = 7533;
  37320. t[3019] = 7534;
  37321. t[3075] = 7590;
  37322. t[3076] = 7591;
  37323. t[3079] = 7594;
  37324. t[3080] = 7595;
  37325. t[3083] = 7598;
  37326. t[3084] = 7599;
  37327. t[3087] = 7602;
  37328. t[3088] = 7603;
  37329. t[3091] = 7606;
  37330. t[3092] = 7607;
  37331. t[3095] = 7610;
  37332. t[3096] = 7611;
  37333. t[3099] = 7614;
  37334. t[3100] = 7615;
  37335. t[3103] = 7618;
  37336. t[3104] = 7619;
  37337. t[3107] = 8337;
  37338. t[3108] = 8338;
  37339. t[3116] = 1884;
  37340. t[3119] = 1885;
  37341. t[3120] = 1885;
  37342. t[3123] = 1886;
  37343. t[3124] = 1886;
  37344. t[3127] = 1887;
  37345. t[3128] = 1887;
  37346. t[3131] = 1888;
  37347. t[3132] = 1888;
  37348. t[3135] = 1889;
  37349. t[3136] = 1889;
  37350. t[3139] = 1890;
  37351. t[3140] = 1890;
  37352. t[3143] = 1891;
  37353. t[3144] = 1891;
  37354. t[3147] = 1892;
  37355. t[3148] = 1892;
  37356. t[3153] = 580;
  37357. t[3154] = 581;
  37358. t[3157] = 584;
  37359. t[3158] = 585;
  37360. t[3161] = 588;
  37361. t[3162] = 589;
  37362. t[3165] = 891;
  37363. t[3166] = 892;
  37364. t[3169] = 1274;
  37365. t[3170] = 1275;
  37366. t[3173] = 1278;
  37367. t[3174] = 1279;
  37368. t[3181] = 7622;
  37369. t[3182] = 7623;
  37370. t[3282] = 11799;
  37371. t[3316] = 578;
  37372. t[3379] = 42785;
  37373. t[3393] = 1159;
  37374. t[3416] = 8377;
  37375. });
  37376. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  37377. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  37378. t[227] = 322;
  37379. t[264] = 261;
  37380. t[291] = 346;
  37381. });
  37382. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  37383. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  37384. t[1] = 32;
  37385. t[4] = 65;
  37386. t[6] = 193;
  37387. t[17] = 66;
  37388. t[18] = 67;
  37389. t[21] = 268;
  37390. t[24] = 68;
  37391. t[28] = 69;
  37392. t[30] = 201;
  37393. t[32] = 282;
  37394. t[38] = 70;
  37395. t[39] = 71;
  37396. t[44] = 72;
  37397. t[47] = 73;
  37398. t[49] = 205;
  37399. t[58] = 74;
  37400. t[60] = 75;
  37401. t[62] = 76;
  37402. t[68] = 77;
  37403. t[69] = 78;
  37404. t[75] = 79;
  37405. t[87] = 80;
  37406. t[89] = 81;
  37407. t[90] = 82;
  37408. t[92] = 344;
  37409. t[94] = 83;
  37410. t[97] = 352;
  37411. t[100] = 84;
  37412. t[104] = 85;
  37413. t[115] = 86;
  37414. t[116] = 87;
  37415. t[121] = 88;
  37416. t[122] = 89;
  37417. t[124] = 221;
  37418. t[127] = 90;
  37419. t[129] = 381;
  37420. t[258] = 97;
  37421. t[260] = 225;
  37422. t[268] = 261;
  37423. t[271] = 98;
  37424. t[272] = 99;
  37425. t[273] = 263;
  37426. t[275] = 269;
  37427. t[282] = 100;
  37428. t[286] = 101;
  37429. t[288] = 233;
  37430. t[290] = 283;
  37431. t[295] = 281;
  37432. t[296] = 102;
  37433. t[336] = 103;
  37434. t[346] = 104;
  37435. t[349] = 105;
  37436. t[351] = 237;
  37437. t[361] = 106;
  37438. t[364] = 107;
  37439. t[367] = 108;
  37440. t[371] = 322;
  37441. t[373] = 109;
  37442. t[374] = 110;
  37443. t[381] = 111;
  37444. t[383] = 243;
  37445. t[393] = 112;
  37446. t[395] = 113;
  37447. t[396] = 114;
  37448. t[398] = 345;
  37449. t[400] = 115;
  37450. t[401] = 347;
  37451. t[403] = 353;
  37452. t[410] = 116;
  37453. t[437] = 117;
  37454. t[448] = 118;
  37455. t[449] = 119;
  37456. t[454] = 120;
  37457. t[455] = 121;
  37458. t[457] = 253;
  37459. t[460] = 122;
  37460. t[462] = 382;
  37461. t[463] = 380;
  37462. t[853] = 44;
  37463. t[855] = 58;
  37464. t[856] = 46;
  37465. t[876] = 47;
  37466. t[878] = 45;
  37467. t[882] = 45;
  37468. t[894] = 40;
  37469. t[895] = 41;
  37470. t[896] = 91;
  37471. t[897] = 93;
  37472. t[923] = 64;
  37473. t[1004] = 48;
  37474. t[1005] = 49;
  37475. t[1006] = 50;
  37476. t[1007] = 51;
  37477. t[1008] = 52;
  37478. t[1009] = 53;
  37479. t[1010] = 54;
  37480. t[1011] = 55;
  37481. t[1012] = 56;
  37482. t[1013] = 57;
  37483. t[1081] = 37;
  37484. t[1085] = 43;
  37485. t[1086] = 45;
  37486. });
  37487. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  37488. function getStandardFontName(name) {
  37489. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  37490. const stdFontMap = getStdFontMap();
  37491. return stdFontMap[fontName];
  37492. }
  37493. /***/ }),
  37494. /* 42 */
  37495. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37496. Object.defineProperty(exports, "__esModule", ({
  37497. value: true
  37498. }));
  37499. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  37500. var _util = __w_pdfjs_require__(2);
  37501. class ToUnicodeMap {
  37502. constructor(cmap = []) {
  37503. this._map = cmap;
  37504. }
  37505. get length() {
  37506. return this._map.length;
  37507. }
  37508. forEach(callback) {
  37509. for (const charCode in this._map) {
  37510. callback(charCode, this._map[charCode].charCodeAt(0));
  37511. }
  37512. }
  37513. has(i) {
  37514. return this._map[i] !== undefined;
  37515. }
  37516. get(i) {
  37517. return this._map[i];
  37518. }
  37519. charCodeOf(value) {
  37520. const map = this._map;
  37521. if (map.length <= 0x10000) {
  37522. return map.indexOf(value);
  37523. }
  37524. for (const charCode in map) {
  37525. if (map[charCode] === value) {
  37526. return charCode | 0;
  37527. }
  37528. }
  37529. return -1;
  37530. }
  37531. amend(map) {
  37532. for (const charCode in map) {
  37533. this._map[charCode] = map[charCode];
  37534. }
  37535. }
  37536. }
  37537. exports.ToUnicodeMap = ToUnicodeMap;
  37538. class IdentityToUnicodeMap {
  37539. constructor(firstChar, lastChar) {
  37540. this.firstChar = firstChar;
  37541. this.lastChar = lastChar;
  37542. }
  37543. get length() {
  37544. return this.lastChar + 1 - this.firstChar;
  37545. }
  37546. forEach(callback) {
  37547. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  37548. callback(i, i);
  37549. }
  37550. }
  37551. has(i) {
  37552. return this.firstChar <= i && i <= this.lastChar;
  37553. }
  37554. get(i) {
  37555. if (this.firstChar <= i && i <= this.lastChar) {
  37556. return String.fromCharCode(i);
  37557. }
  37558. return undefined;
  37559. }
  37560. charCodeOf(v) {
  37561. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  37562. }
  37563. amend(map) {
  37564. (0, _util.unreachable)("Should not call amend()");
  37565. }
  37566. }
  37567. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  37568. /***/ }),
  37569. /* 43 */
  37570. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37571. Object.defineProperty(exports, "__esModule", ({
  37572. value: true
  37573. }));
  37574. exports.CFFFont = void 0;
  37575. var _cff_parser = __w_pdfjs_require__(35);
  37576. var _fonts_utils = __w_pdfjs_require__(38);
  37577. var _util = __w_pdfjs_require__(2);
  37578. class CFFFont {
  37579. constructor(file, properties) {
  37580. this.properties = properties;
  37581. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37582. this.cff = parser.parse();
  37583. this.cff.duplicateFirstGlyph();
  37584. const compiler = new _cff_parser.CFFCompiler(this.cff);
  37585. this.seacs = this.cff.seacs;
  37586. try {
  37587. this.data = compiler.compile();
  37588. } catch (e) {
  37589. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  37590. this.data = file;
  37591. }
  37592. this._createBuiltInEncoding();
  37593. }
  37594. get numGlyphs() {
  37595. return this.cff.charStrings.count;
  37596. }
  37597. getCharset() {
  37598. return this.cff.charset.charset;
  37599. }
  37600. getGlyphMapping() {
  37601. const cff = this.cff;
  37602. const properties = this.properties;
  37603. const charsets = cff.charset.charset;
  37604. let charCodeToGlyphId;
  37605. let glyphId;
  37606. if (properties.composite) {
  37607. charCodeToGlyphId = Object.create(null);
  37608. let charCode;
  37609. if (cff.isCIDFont) {
  37610. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  37611. const cid = charsets[glyphId];
  37612. charCode = properties.cMap.charCodeOf(cid);
  37613. charCodeToGlyphId[charCode] = glyphId;
  37614. }
  37615. } else {
  37616. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  37617. charCode = properties.cMap.charCodeOf(glyphId);
  37618. charCodeToGlyphId[charCode] = glyphId;
  37619. }
  37620. }
  37621. return charCodeToGlyphId;
  37622. }
  37623. let encoding = cff.encoding ? cff.encoding.encoding : null;
  37624. if (properties.isInternalFont) {
  37625. encoding = properties.defaultEncoding;
  37626. }
  37627. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  37628. return charCodeToGlyphId;
  37629. }
  37630. hasGlyphId(id) {
  37631. return this.cff.hasGlyphId(id);
  37632. }
  37633. _createBuiltInEncoding() {
  37634. const {
  37635. charset,
  37636. encoding
  37637. } = this.cff;
  37638. if (!charset || !encoding) {
  37639. return;
  37640. }
  37641. const charsets = charset.charset,
  37642. encodings = encoding.encoding;
  37643. const map = [];
  37644. for (const charCode in encodings) {
  37645. const glyphId = encodings[charCode];
  37646. if (glyphId >= 0) {
  37647. const glyphName = charsets[glyphId];
  37648. if (glyphName) {
  37649. map[charCode] = glyphName;
  37650. }
  37651. }
  37652. }
  37653. if (map.length > 0) {
  37654. this.properties.builtInEncoding = map;
  37655. }
  37656. }
  37657. }
  37658. exports.CFFFont = CFFFont;
  37659. /***/ }),
  37660. /* 44 */
  37661. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37662. Object.defineProperty(exports, "__esModule", ({
  37663. value: true
  37664. }));
  37665. exports.FontRendererFactory = void 0;
  37666. var _util = __w_pdfjs_require__(2);
  37667. var _cff_parser = __w_pdfjs_require__(35);
  37668. var _glyphlist = __w_pdfjs_require__(39);
  37669. var _encodings = __w_pdfjs_require__(37);
  37670. var _stream = __w_pdfjs_require__(10);
  37671. function getUint32(data, offset) {
  37672. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  37673. }
  37674. function getUint16(data, offset) {
  37675. return data[offset] << 8 | data[offset + 1];
  37676. }
  37677. function getInt16(data, offset) {
  37678. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  37679. }
  37680. function getInt8(data, offset) {
  37681. return data[offset] << 24 >> 24;
  37682. }
  37683. function getFloat214(data, offset) {
  37684. return getInt16(data, offset) / 16384;
  37685. }
  37686. function getSubroutineBias(subrs) {
  37687. const numSubrs = subrs.length;
  37688. let bias = 32768;
  37689. if (numSubrs < 1240) {
  37690. bias = 107;
  37691. } else if (numSubrs < 33900) {
  37692. bias = 1131;
  37693. }
  37694. return bias;
  37695. }
  37696. function parseCmap(data, start, end) {
  37697. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  37698. const format = getUint16(data, start + offset);
  37699. let ranges, p, i;
  37700. if (format === 4) {
  37701. getUint16(data, start + offset + 2);
  37702. const segCount = getUint16(data, start + offset + 6) >> 1;
  37703. p = start + offset + 14;
  37704. ranges = [];
  37705. for (i = 0; i < segCount; i++, p += 2) {
  37706. ranges[i] = {
  37707. end: getUint16(data, p)
  37708. };
  37709. }
  37710. p += 2;
  37711. for (i = 0; i < segCount; i++, p += 2) {
  37712. ranges[i].start = getUint16(data, p);
  37713. }
  37714. for (i = 0; i < segCount; i++, p += 2) {
  37715. ranges[i].idDelta = getUint16(data, p);
  37716. }
  37717. for (i = 0; i < segCount; i++, p += 2) {
  37718. let idOffset = getUint16(data, p);
  37719. if (idOffset === 0) {
  37720. continue;
  37721. }
  37722. ranges[i].ids = [];
  37723. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  37724. ranges[i].ids[j] = getUint16(data, p + idOffset);
  37725. idOffset += 2;
  37726. }
  37727. }
  37728. return ranges;
  37729. } else if (format === 12) {
  37730. const groups = getUint32(data, start + offset + 12);
  37731. p = start + offset + 16;
  37732. ranges = [];
  37733. for (i = 0; i < groups; i++) {
  37734. start = getUint32(data, p);
  37735. ranges.push({
  37736. start,
  37737. end: getUint32(data, p + 4),
  37738. idDelta: getUint32(data, p + 8) - start
  37739. });
  37740. p += 12;
  37741. }
  37742. return ranges;
  37743. }
  37744. throw new _util.FormatError(`unsupported cmap: ${format}`);
  37745. }
  37746. function parseCff(data, start, end, seacAnalysisEnabled) {
  37747. const properties = {};
  37748. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  37749. const cff = parser.parse();
  37750. return {
  37751. glyphs: cff.charStrings.objects,
  37752. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  37753. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  37754. isCFFCIDFont: cff.isCIDFont,
  37755. fdSelect: cff.fdSelect,
  37756. fdArray: cff.fdArray
  37757. };
  37758. }
  37759. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  37760. let itemSize, itemDecode;
  37761. if (isGlyphLocationsLong) {
  37762. itemSize = 4;
  37763. itemDecode = getUint32;
  37764. } else {
  37765. itemSize = 2;
  37766. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  37767. }
  37768. const glyphs = [];
  37769. let startOffset = itemDecode(loca, 0);
  37770. for (let j = itemSize; j < loca.length; j += itemSize) {
  37771. const endOffset = itemDecode(loca, j);
  37772. glyphs.push(glyf.subarray(startOffset, endOffset));
  37773. startOffset = endOffset;
  37774. }
  37775. return glyphs;
  37776. }
  37777. function lookupCmap(ranges, unicode) {
  37778. const code = unicode.codePointAt(0);
  37779. let gid = 0,
  37780. l = 0,
  37781. r = ranges.length - 1;
  37782. while (l < r) {
  37783. const c = l + r + 1 >> 1;
  37784. if (code < ranges[c].start) {
  37785. r = c - 1;
  37786. } else {
  37787. l = c;
  37788. }
  37789. }
  37790. if (ranges[l].start <= code && code <= ranges[l].end) {
  37791. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  37792. }
  37793. return {
  37794. charCode: code,
  37795. glyphId: gid
  37796. };
  37797. }
  37798. function compileGlyf(code, cmds, font) {
  37799. function moveTo(x, y) {
  37800. cmds.push({
  37801. cmd: "moveTo",
  37802. args: [x, y]
  37803. });
  37804. }
  37805. function lineTo(x, y) {
  37806. cmds.push({
  37807. cmd: "lineTo",
  37808. args: [x, y]
  37809. });
  37810. }
  37811. function quadraticCurveTo(xa, ya, x, y) {
  37812. cmds.push({
  37813. cmd: "quadraticCurveTo",
  37814. args: [xa, ya, x, y]
  37815. });
  37816. }
  37817. let i = 0;
  37818. const numberOfContours = getInt16(code, i);
  37819. let flags;
  37820. let x = 0,
  37821. y = 0;
  37822. i += 10;
  37823. if (numberOfContours < 0) {
  37824. do {
  37825. flags = getUint16(code, i);
  37826. const glyphIndex = getUint16(code, i + 2);
  37827. i += 4;
  37828. let arg1, arg2;
  37829. if (flags & 0x01) {
  37830. if (flags & 0x02) {
  37831. arg1 = getInt16(code, i);
  37832. arg2 = getInt16(code, i + 2);
  37833. } else {
  37834. arg1 = getUint16(code, i);
  37835. arg2 = getUint16(code, i + 2);
  37836. }
  37837. i += 4;
  37838. } else {
  37839. if (flags & 0x02) {
  37840. arg1 = getInt8(code, i++);
  37841. arg2 = getInt8(code, i++);
  37842. } else {
  37843. arg1 = code[i++];
  37844. arg2 = code[i++];
  37845. }
  37846. }
  37847. if (flags & 0x02) {
  37848. x = arg1;
  37849. y = arg2;
  37850. } else {
  37851. x = 0;
  37852. y = 0;
  37853. }
  37854. let scaleX = 1,
  37855. scaleY = 1,
  37856. scale01 = 0,
  37857. scale10 = 0;
  37858. if (flags & 0x08) {
  37859. scaleX = scaleY = getFloat214(code, i);
  37860. i += 2;
  37861. } else if (flags & 0x40) {
  37862. scaleX = getFloat214(code, i);
  37863. scaleY = getFloat214(code, i + 2);
  37864. i += 4;
  37865. } else if (flags & 0x80) {
  37866. scaleX = getFloat214(code, i);
  37867. scale01 = getFloat214(code, i + 2);
  37868. scale10 = getFloat214(code, i + 4);
  37869. scaleY = getFloat214(code, i + 6);
  37870. i += 8;
  37871. }
  37872. const subglyph = font.glyphs[glyphIndex];
  37873. if (subglyph) {
  37874. cmds.push({
  37875. cmd: "save"
  37876. }, {
  37877. cmd: "transform",
  37878. args: [scaleX, scale01, scale10, scaleY, x, y]
  37879. });
  37880. if (!(flags & 0x02)) {}
  37881. compileGlyf(subglyph, cmds, font);
  37882. cmds.push({
  37883. cmd: "restore"
  37884. });
  37885. }
  37886. } while (flags & 0x20);
  37887. } else {
  37888. const endPtsOfContours = [];
  37889. let j, jj;
  37890. for (j = 0; j < numberOfContours; j++) {
  37891. endPtsOfContours.push(getUint16(code, i));
  37892. i += 2;
  37893. }
  37894. const instructionLength = getUint16(code, i);
  37895. i += 2 + instructionLength;
  37896. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  37897. const points = [];
  37898. while (points.length < numberOfPoints) {
  37899. flags = code[i++];
  37900. let repeat = 1;
  37901. if (flags & 0x08) {
  37902. repeat += code[i++];
  37903. }
  37904. while (repeat-- > 0) {
  37905. points.push({
  37906. flags
  37907. });
  37908. }
  37909. }
  37910. for (j = 0; j < numberOfPoints; j++) {
  37911. switch (points[j].flags & 0x12) {
  37912. case 0x00:
  37913. x += getInt16(code, i);
  37914. i += 2;
  37915. break;
  37916. case 0x02:
  37917. x -= code[i++];
  37918. break;
  37919. case 0x12:
  37920. x += code[i++];
  37921. break;
  37922. }
  37923. points[j].x = x;
  37924. }
  37925. for (j = 0; j < numberOfPoints; j++) {
  37926. switch (points[j].flags & 0x24) {
  37927. case 0x00:
  37928. y += getInt16(code, i);
  37929. i += 2;
  37930. break;
  37931. case 0x04:
  37932. y -= code[i++];
  37933. break;
  37934. case 0x24:
  37935. y += code[i++];
  37936. break;
  37937. }
  37938. points[j].y = y;
  37939. }
  37940. let startPoint = 0;
  37941. for (i = 0; i < numberOfContours; i++) {
  37942. const endPoint = endPtsOfContours[i];
  37943. const contour = points.slice(startPoint, endPoint + 1);
  37944. if (contour[0].flags & 1) {
  37945. contour.push(contour[0]);
  37946. } else if (contour.at(-1).flags & 1) {
  37947. contour.unshift(contour.at(-1));
  37948. } else {
  37949. const p = {
  37950. flags: 1,
  37951. x: (contour[0].x + contour.at(-1).x) / 2,
  37952. y: (contour[0].y + contour.at(-1).y) / 2
  37953. };
  37954. contour.unshift(p);
  37955. contour.push(p);
  37956. }
  37957. moveTo(contour[0].x, contour[0].y);
  37958. for (j = 1, jj = contour.length; j < jj; j++) {
  37959. if (contour[j].flags & 1) {
  37960. lineTo(contour[j].x, contour[j].y);
  37961. } else if (contour[j + 1].flags & 1) {
  37962. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  37963. j++;
  37964. } else {
  37965. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  37966. }
  37967. }
  37968. startPoint = endPoint + 1;
  37969. }
  37970. }
  37971. }
  37972. function compileCharString(charStringCode, cmds, font, glyphId) {
  37973. function moveTo(x, y) {
  37974. cmds.push({
  37975. cmd: "moveTo",
  37976. args: [x, y]
  37977. });
  37978. }
  37979. function lineTo(x, y) {
  37980. cmds.push({
  37981. cmd: "lineTo",
  37982. args: [x, y]
  37983. });
  37984. }
  37985. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  37986. cmds.push({
  37987. cmd: "bezierCurveTo",
  37988. args: [x1, y1, x2, y2, x, y]
  37989. });
  37990. }
  37991. const stack = [];
  37992. let x = 0,
  37993. y = 0;
  37994. let stems = 0;
  37995. function parse(code) {
  37996. let i = 0;
  37997. while (i < code.length) {
  37998. let stackClean = false;
  37999. let v = code[i++];
  38000. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38001. switch (v) {
  38002. case 1:
  38003. stems += stack.length >> 1;
  38004. stackClean = true;
  38005. break;
  38006. case 3:
  38007. stems += stack.length >> 1;
  38008. stackClean = true;
  38009. break;
  38010. case 4:
  38011. y += stack.pop();
  38012. moveTo(x, y);
  38013. stackClean = true;
  38014. break;
  38015. case 5:
  38016. while (stack.length > 0) {
  38017. x += stack.shift();
  38018. y += stack.shift();
  38019. lineTo(x, y);
  38020. }
  38021. break;
  38022. case 6:
  38023. while (stack.length > 0) {
  38024. x += stack.shift();
  38025. lineTo(x, y);
  38026. if (stack.length === 0) {
  38027. break;
  38028. }
  38029. y += stack.shift();
  38030. lineTo(x, y);
  38031. }
  38032. break;
  38033. case 7:
  38034. while (stack.length > 0) {
  38035. y += stack.shift();
  38036. lineTo(x, y);
  38037. if (stack.length === 0) {
  38038. break;
  38039. }
  38040. x += stack.shift();
  38041. lineTo(x, y);
  38042. }
  38043. break;
  38044. case 8:
  38045. while (stack.length > 0) {
  38046. xa = x + stack.shift();
  38047. ya = y + stack.shift();
  38048. xb = xa + stack.shift();
  38049. yb = ya + stack.shift();
  38050. x = xb + stack.shift();
  38051. y = yb + stack.shift();
  38052. bezierCurveTo(xa, ya, xb, yb, x, y);
  38053. }
  38054. break;
  38055. case 10:
  38056. n = stack.pop();
  38057. subrCode = null;
  38058. if (font.isCFFCIDFont) {
  38059. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  38060. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  38061. const fontDict = font.fdArray[fdIndex];
  38062. let subrs;
  38063. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  38064. subrs = fontDict.privateDict.subrsIndex.objects;
  38065. }
  38066. if (subrs) {
  38067. n += getSubroutineBias(subrs);
  38068. subrCode = subrs[n];
  38069. }
  38070. } else {
  38071. (0, _util.warn)("Invalid fd index for glyph index.");
  38072. }
  38073. } else {
  38074. subrCode = font.subrs[n + font.subrsBias];
  38075. }
  38076. if (subrCode) {
  38077. parse(subrCode);
  38078. }
  38079. break;
  38080. case 11:
  38081. return;
  38082. case 12:
  38083. v = code[i++];
  38084. switch (v) {
  38085. case 34:
  38086. xa = x + stack.shift();
  38087. xb = xa + stack.shift();
  38088. y1 = y + stack.shift();
  38089. x = xb + stack.shift();
  38090. bezierCurveTo(xa, y, xb, y1, x, y1);
  38091. xa = x + stack.shift();
  38092. xb = xa + stack.shift();
  38093. x = xb + stack.shift();
  38094. bezierCurveTo(xa, y1, xb, y, x, y);
  38095. break;
  38096. case 35:
  38097. xa = x + stack.shift();
  38098. ya = y + stack.shift();
  38099. xb = xa + stack.shift();
  38100. yb = ya + stack.shift();
  38101. x = xb + stack.shift();
  38102. y = yb + stack.shift();
  38103. bezierCurveTo(xa, ya, xb, yb, x, y);
  38104. xa = x + stack.shift();
  38105. ya = y + stack.shift();
  38106. xb = xa + stack.shift();
  38107. yb = ya + stack.shift();
  38108. x = xb + stack.shift();
  38109. y = yb + stack.shift();
  38110. bezierCurveTo(xa, ya, xb, yb, x, y);
  38111. stack.pop();
  38112. break;
  38113. case 36:
  38114. xa = x + stack.shift();
  38115. y1 = y + stack.shift();
  38116. xb = xa + stack.shift();
  38117. y2 = y1 + stack.shift();
  38118. x = xb + stack.shift();
  38119. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38120. xa = x + stack.shift();
  38121. xb = xa + stack.shift();
  38122. y3 = y2 + stack.shift();
  38123. x = xb + stack.shift();
  38124. bezierCurveTo(xa, y2, xb, y3, x, y);
  38125. break;
  38126. case 37:
  38127. const x0 = x,
  38128. y0 = y;
  38129. xa = x + stack.shift();
  38130. ya = y + stack.shift();
  38131. xb = xa + stack.shift();
  38132. yb = ya + stack.shift();
  38133. x = xb + stack.shift();
  38134. y = yb + stack.shift();
  38135. bezierCurveTo(xa, ya, xb, yb, x, y);
  38136. xa = x + stack.shift();
  38137. ya = y + stack.shift();
  38138. xb = xa + stack.shift();
  38139. yb = ya + stack.shift();
  38140. x = xb;
  38141. y = yb;
  38142. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38143. x += stack.shift();
  38144. } else {
  38145. y += stack.shift();
  38146. }
  38147. bezierCurveTo(xa, ya, xb, yb, x, y);
  38148. break;
  38149. default:
  38150. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  38151. }
  38152. break;
  38153. case 14:
  38154. if (stack.length >= 4) {
  38155. const achar = stack.pop();
  38156. const bchar = stack.pop();
  38157. y = stack.pop();
  38158. x = stack.pop();
  38159. cmds.push({
  38160. cmd: "save"
  38161. }, {
  38162. cmd: "translate",
  38163. args: [x, y]
  38164. });
  38165. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  38166. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38167. cmds.push({
  38168. cmd: "restore"
  38169. });
  38170. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  38171. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  38172. }
  38173. return;
  38174. case 18:
  38175. stems += stack.length >> 1;
  38176. stackClean = true;
  38177. break;
  38178. case 19:
  38179. stems += stack.length >> 1;
  38180. i += stems + 7 >> 3;
  38181. stackClean = true;
  38182. break;
  38183. case 20:
  38184. stems += stack.length >> 1;
  38185. i += stems + 7 >> 3;
  38186. stackClean = true;
  38187. break;
  38188. case 21:
  38189. y += stack.pop();
  38190. x += stack.pop();
  38191. moveTo(x, y);
  38192. stackClean = true;
  38193. break;
  38194. case 22:
  38195. x += stack.pop();
  38196. moveTo(x, y);
  38197. stackClean = true;
  38198. break;
  38199. case 23:
  38200. stems += stack.length >> 1;
  38201. stackClean = true;
  38202. break;
  38203. case 24:
  38204. while (stack.length > 2) {
  38205. xa = x + stack.shift();
  38206. ya = y + stack.shift();
  38207. xb = xa + stack.shift();
  38208. yb = ya + stack.shift();
  38209. x = xb + stack.shift();
  38210. y = yb + stack.shift();
  38211. bezierCurveTo(xa, ya, xb, yb, x, y);
  38212. }
  38213. x += stack.shift();
  38214. y += stack.shift();
  38215. lineTo(x, y);
  38216. break;
  38217. case 25:
  38218. while (stack.length > 6) {
  38219. x += stack.shift();
  38220. y += stack.shift();
  38221. lineTo(x, y);
  38222. }
  38223. xa = x + stack.shift();
  38224. ya = y + stack.shift();
  38225. xb = xa + stack.shift();
  38226. yb = ya + stack.shift();
  38227. x = xb + stack.shift();
  38228. y = yb + stack.shift();
  38229. bezierCurveTo(xa, ya, xb, yb, x, y);
  38230. break;
  38231. case 26:
  38232. if (stack.length % 2) {
  38233. x += stack.shift();
  38234. }
  38235. while (stack.length > 0) {
  38236. xa = x;
  38237. ya = y + stack.shift();
  38238. xb = xa + stack.shift();
  38239. yb = ya + stack.shift();
  38240. x = xb;
  38241. y = yb + stack.shift();
  38242. bezierCurveTo(xa, ya, xb, yb, x, y);
  38243. }
  38244. break;
  38245. case 27:
  38246. if (stack.length % 2) {
  38247. y += stack.shift();
  38248. }
  38249. while (stack.length > 0) {
  38250. xa = x + stack.shift();
  38251. ya = y;
  38252. xb = xa + stack.shift();
  38253. yb = ya + stack.shift();
  38254. x = xb + stack.shift();
  38255. y = yb;
  38256. bezierCurveTo(xa, ya, xb, yb, x, y);
  38257. }
  38258. break;
  38259. case 28:
  38260. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38261. i += 2;
  38262. break;
  38263. case 29:
  38264. n = stack.pop() + font.gsubrsBias;
  38265. subrCode = font.gsubrs[n];
  38266. if (subrCode) {
  38267. parse(subrCode);
  38268. }
  38269. break;
  38270. case 30:
  38271. while (stack.length > 0) {
  38272. xa = x;
  38273. ya = y + stack.shift();
  38274. xb = xa + stack.shift();
  38275. yb = ya + stack.shift();
  38276. x = xb + stack.shift();
  38277. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38278. bezierCurveTo(xa, ya, xb, yb, x, y);
  38279. if (stack.length === 0) {
  38280. break;
  38281. }
  38282. xa = x + stack.shift();
  38283. ya = y;
  38284. xb = xa + stack.shift();
  38285. yb = ya + stack.shift();
  38286. y = yb + stack.shift();
  38287. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38288. bezierCurveTo(xa, ya, xb, yb, x, y);
  38289. }
  38290. break;
  38291. case 31:
  38292. while (stack.length > 0) {
  38293. xa = x + stack.shift();
  38294. ya = y;
  38295. xb = xa + stack.shift();
  38296. yb = ya + stack.shift();
  38297. y = yb + stack.shift();
  38298. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38299. bezierCurveTo(xa, ya, xb, yb, x, y);
  38300. if (stack.length === 0) {
  38301. break;
  38302. }
  38303. xa = x;
  38304. ya = y + stack.shift();
  38305. xb = xa + stack.shift();
  38306. yb = ya + stack.shift();
  38307. x = xb + stack.shift();
  38308. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38309. bezierCurveTo(xa, ya, xb, yb, x, y);
  38310. }
  38311. break;
  38312. default:
  38313. if (v < 32) {
  38314. throw new _util.FormatError(`unknown operator: ${v}`);
  38315. }
  38316. if (v < 247) {
  38317. stack.push(v - 139);
  38318. } else if (v < 251) {
  38319. stack.push((v - 247) * 256 + code[i++] + 108);
  38320. } else if (v < 255) {
  38321. stack.push(-(v - 251) * 256 - code[i++] - 108);
  38322. } else {
  38323. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  38324. i += 4;
  38325. }
  38326. break;
  38327. }
  38328. if (stackClean) {
  38329. stack.length = 0;
  38330. }
  38331. }
  38332. }
  38333. parse(charStringCode);
  38334. }
  38335. const NOOP = [];
  38336. class CompiledFont {
  38337. constructor(fontMatrix) {
  38338. if (this.constructor === CompiledFont) {
  38339. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  38340. }
  38341. this.fontMatrix = fontMatrix;
  38342. this.compiledGlyphs = Object.create(null);
  38343. this.compiledCharCodeToGlyphId = Object.create(null);
  38344. }
  38345. getPathJs(unicode) {
  38346. const {
  38347. charCode,
  38348. glyphId
  38349. } = lookupCmap(this.cmap, unicode);
  38350. let fn = this.compiledGlyphs[glyphId];
  38351. if (!fn) {
  38352. try {
  38353. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  38354. this.compiledGlyphs[glyphId] = fn;
  38355. } catch (ex) {
  38356. this.compiledGlyphs[glyphId] = NOOP;
  38357. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38358. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38359. }
  38360. throw ex;
  38361. }
  38362. }
  38363. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  38364. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  38365. }
  38366. return fn;
  38367. }
  38368. compileGlyph(code, glyphId) {
  38369. if (!code || code.length === 0 || code[0] === 14) {
  38370. return NOOP;
  38371. }
  38372. let fontMatrix = this.fontMatrix;
  38373. if (this.isCFFCIDFont) {
  38374. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  38375. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  38376. const fontDict = this.fdArray[fdIndex];
  38377. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  38378. } else {
  38379. (0, _util.warn)("Invalid fd index for glyph index.");
  38380. }
  38381. }
  38382. const cmds = [{
  38383. cmd: "save"
  38384. }, {
  38385. cmd: "transform",
  38386. args: fontMatrix.slice()
  38387. }, {
  38388. cmd: "scale",
  38389. args: ["size", "-size"]
  38390. }];
  38391. this.compileGlyphImpl(code, cmds, glyphId);
  38392. cmds.push({
  38393. cmd: "restore"
  38394. });
  38395. return cmds;
  38396. }
  38397. compileGlyphImpl() {
  38398. (0, _util.unreachable)("Children classes should implement this.");
  38399. }
  38400. hasBuiltPath(unicode) {
  38401. const {
  38402. charCode,
  38403. glyphId
  38404. } = lookupCmap(this.cmap, unicode);
  38405. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  38406. }
  38407. }
  38408. class TrueTypeCompiled extends CompiledFont {
  38409. constructor(glyphs, cmap, fontMatrix) {
  38410. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  38411. this.glyphs = glyphs;
  38412. this.cmap = cmap;
  38413. }
  38414. compileGlyphImpl(code, cmds) {
  38415. compileGlyf(code, cmds, this);
  38416. }
  38417. }
  38418. class Type2Compiled extends CompiledFont {
  38419. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  38420. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  38421. this.glyphs = cffInfo.glyphs;
  38422. this.gsubrs = cffInfo.gsubrs || [];
  38423. this.subrs = cffInfo.subrs || [];
  38424. this.cmap = cmap;
  38425. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  38426. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  38427. this.subrsBias = getSubroutineBias(this.subrs);
  38428. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  38429. this.fdSelect = cffInfo.fdSelect;
  38430. this.fdArray = cffInfo.fdArray;
  38431. }
  38432. compileGlyphImpl(code, cmds, glyphId) {
  38433. compileCharString(code, cmds, this, glyphId);
  38434. }
  38435. }
  38436. class FontRendererFactory {
  38437. static create(font, seacAnalysisEnabled) {
  38438. const data = new Uint8Array(font.data);
  38439. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  38440. const numTables = getUint16(data, 4);
  38441. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  38442. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  38443. const offset = getUint32(data, p + 8);
  38444. const length = getUint32(data, p + 12);
  38445. switch (tag) {
  38446. case "cmap":
  38447. cmap = parseCmap(data, offset, offset + length);
  38448. break;
  38449. case "glyf":
  38450. glyf = data.subarray(offset, offset + length);
  38451. break;
  38452. case "loca":
  38453. loca = data.subarray(offset, offset + length);
  38454. break;
  38455. case "head":
  38456. unitsPerEm = getUint16(data, offset + 18);
  38457. indexToLocFormat = getUint16(data, offset + 50);
  38458. break;
  38459. case "CFF ":
  38460. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  38461. break;
  38462. }
  38463. }
  38464. if (glyf) {
  38465. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  38466. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  38467. }
  38468. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  38469. }
  38470. }
  38471. exports.FontRendererFactory = FontRendererFactory;
  38472. /***/ }),
  38473. /* 45 */
  38474. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38475. Object.defineProperty(exports, "__esModule", ({
  38476. value: true
  38477. }));
  38478. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  38479. var _core_utils = __w_pdfjs_require__(6);
  38480. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  38481. t.Courier = 600;
  38482. t["Courier-Bold"] = 600;
  38483. t["Courier-BoldOblique"] = 600;
  38484. t["Courier-Oblique"] = 600;
  38485. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  38486. t.space = 278;
  38487. t.exclam = 278;
  38488. t.quotedbl = 355;
  38489. t.numbersign = 556;
  38490. t.dollar = 556;
  38491. t.percent = 889;
  38492. t.ampersand = 667;
  38493. t.quoteright = 222;
  38494. t.parenleft = 333;
  38495. t.parenright = 333;
  38496. t.asterisk = 389;
  38497. t.plus = 584;
  38498. t.comma = 278;
  38499. t.hyphen = 333;
  38500. t.period = 278;
  38501. t.slash = 278;
  38502. t.zero = 556;
  38503. t.one = 556;
  38504. t.two = 556;
  38505. t.three = 556;
  38506. t.four = 556;
  38507. t.five = 556;
  38508. t.six = 556;
  38509. t.seven = 556;
  38510. t.eight = 556;
  38511. t.nine = 556;
  38512. t.colon = 278;
  38513. t.semicolon = 278;
  38514. t.less = 584;
  38515. t.equal = 584;
  38516. t.greater = 584;
  38517. t.question = 556;
  38518. t.at = 1015;
  38519. t.A = 667;
  38520. t.B = 667;
  38521. t.C = 722;
  38522. t.D = 722;
  38523. t.E = 667;
  38524. t.F = 611;
  38525. t.G = 778;
  38526. t.H = 722;
  38527. t.I = 278;
  38528. t.J = 500;
  38529. t.K = 667;
  38530. t.L = 556;
  38531. t.M = 833;
  38532. t.N = 722;
  38533. t.O = 778;
  38534. t.P = 667;
  38535. t.Q = 778;
  38536. t.R = 722;
  38537. t.S = 667;
  38538. t.T = 611;
  38539. t.U = 722;
  38540. t.V = 667;
  38541. t.W = 944;
  38542. t.X = 667;
  38543. t.Y = 667;
  38544. t.Z = 611;
  38545. t.bracketleft = 278;
  38546. t.backslash = 278;
  38547. t.bracketright = 278;
  38548. t.asciicircum = 469;
  38549. t.underscore = 556;
  38550. t.quoteleft = 222;
  38551. t.a = 556;
  38552. t.b = 556;
  38553. t.c = 500;
  38554. t.d = 556;
  38555. t.e = 556;
  38556. t.f = 278;
  38557. t.g = 556;
  38558. t.h = 556;
  38559. t.i = 222;
  38560. t.j = 222;
  38561. t.k = 500;
  38562. t.l = 222;
  38563. t.m = 833;
  38564. t.n = 556;
  38565. t.o = 556;
  38566. t.p = 556;
  38567. t.q = 556;
  38568. t.r = 333;
  38569. t.s = 500;
  38570. t.t = 278;
  38571. t.u = 556;
  38572. t.v = 500;
  38573. t.w = 722;
  38574. t.x = 500;
  38575. t.y = 500;
  38576. t.z = 500;
  38577. t.braceleft = 334;
  38578. t.bar = 260;
  38579. t.braceright = 334;
  38580. t.asciitilde = 584;
  38581. t.exclamdown = 333;
  38582. t.cent = 556;
  38583. t.sterling = 556;
  38584. t.fraction = 167;
  38585. t.yen = 556;
  38586. t.florin = 556;
  38587. t.section = 556;
  38588. t.currency = 556;
  38589. t.quotesingle = 191;
  38590. t.quotedblleft = 333;
  38591. t.guillemotleft = 556;
  38592. t.guilsinglleft = 333;
  38593. t.guilsinglright = 333;
  38594. t.fi = 500;
  38595. t.fl = 500;
  38596. t.endash = 556;
  38597. t.dagger = 556;
  38598. t.daggerdbl = 556;
  38599. t.periodcentered = 278;
  38600. t.paragraph = 537;
  38601. t.bullet = 350;
  38602. t.quotesinglbase = 222;
  38603. t.quotedblbase = 333;
  38604. t.quotedblright = 333;
  38605. t.guillemotright = 556;
  38606. t.ellipsis = 1000;
  38607. t.perthousand = 1000;
  38608. t.questiondown = 611;
  38609. t.grave = 333;
  38610. t.acute = 333;
  38611. t.circumflex = 333;
  38612. t.tilde = 333;
  38613. t.macron = 333;
  38614. t.breve = 333;
  38615. t.dotaccent = 333;
  38616. t.dieresis = 333;
  38617. t.ring = 333;
  38618. t.cedilla = 333;
  38619. t.hungarumlaut = 333;
  38620. t.ogonek = 333;
  38621. t.caron = 333;
  38622. t.emdash = 1000;
  38623. t.AE = 1000;
  38624. t.ordfeminine = 370;
  38625. t.Lslash = 556;
  38626. t.Oslash = 778;
  38627. t.OE = 1000;
  38628. t.ordmasculine = 365;
  38629. t.ae = 889;
  38630. t.dotlessi = 278;
  38631. t.lslash = 222;
  38632. t.oslash = 611;
  38633. t.oe = 944;
  38634. t.germandbls = 611;
  38635. t.Idieresis = 278;
  38636. t.eacute = 556;
  38637. t.abreve = 556;
  38638. t.uhungarumlaut = 556;
  38639. t.ecaron = 556;
  38640. t.Ydieresis = 667;
  38641. t.divide = 584;
  38642. t.Yacute = 667;
  38643. t.Acircumflex = 667;
  38644. t.aacute = 556;
  38645. t.Ucircumflex = 722;
  38646. t.yacute = 500;
  38647. t.scommaaccent = 500;
  38648. t.ecircumflex = 556;
  38649. t.Uring = 722;
  38650. t.Udieresis = 722;
  38651. t.aogonek = 556;
  38652. t.Uacute = 722;
  38653. t.uogonek = 556;
  38654. t.Edieresis = 667;
  38655. t.Dcroat = 722;
  38656. t.commaaccent = 250;
  38657. t.copyright = 737;
  38658. t.Emacron = 667;
  38659. t.ccaron = 500;
  38660. t.aring = 556;
  38661. t.Ncommaaccent = 722;
  38662. t.lacute = 222;
  38663. t.agrave = 556;
  38664. t.Tcommaaccent = 611;
  38665. t.Cacute = 722;
  38666. t.atilde = 556;
  38667. t.Edotaccent = 667;
  38668. t.scaron = 500;
  38669. t.scedilla = 500;
  38670. t.iacute = 278;
  38671. t.lozenge = 471;
  38672. t.Rcaron = 722;
  38673. t.Gcommaaccent = 778;
  38674. t.ucircumflex = 556;
  38675. t.acircumflex = 556;
  38676. t.Amacron = 667;
  38677. t.rcaron = 333;
  38678. t.ccedilla = 500;
  38679. t.Zdotaccent = 611;
  38680. t.Thorn = 667;
  38681. t.Omacron = 778;
  38682. t.Racute = 722;
  38683. t.Sacute = 667;
  38684. t.dcaron = 643;
  38685. t.Umacron = 722;
  38686. t.uring = 556;
  38687. t.threesuperior = 333;
  38688. t.Ograve = 778;
  38689. t.Agrave = 667;
  38690. t.Abreve = 667;
  38691. t.multiply = 584;
  38692. t.uacute = 556;
  38693. t.Tcaron = 611;
  38694. t.partialdiff = 476;
  38695. t.ydieresis = 500;
  38696. t.Nacute = 722;
  38697. t.icircumflex = 278;
  38698. t.Ecircumflex = 667;
  38699. t.adieresis = 556;
  38700. t.edieresis = 556;
  38701. t.cacute = 500;
  38702. t.nacute = 556;
  38703. t.umacron = 556;
  38704. t.Ncaron = 722;
  38705. t.Iacute = 278;
  38706. t.plusminus = 584;
  38707. t.brokenbar = 260;
  38708. t.registered = 737;
  38709. t.Gbreve = 778;
  38710. t.Idotaccent = 278;
  38711. t.summation = 600;
  38712. t.Egrave = 667;
  38713. t.racute = 333;
  38714. t.omacron = 556;
  38715. t.Zacute = 611;
  38716. t.Zcaron = 611;
  38717. t.greaterequal = 549;
  38718. t.Eth = 722;
  38719. t.Ccedilla = 722;
  38720. t.lcommaaccent = 222;
  38721. t.tcaron = 317;
  38722. t.eogonek = 556;
  38723. t.Uogonek = 722;
  38724. t.Aacute = 667;
  38725. t.Adieresis = 667;
  38726. t.egrave = 556;
  38727. t.zacute = 500;
  38728. t.iogonek = 222;
  38729. t.Oacute = 778;
  38730. t.oacute = 556;
  38731. t.amacron = 556;
  38732. t.sacute = 500;
  38733. t.idieresis = 278;
  38734. t.Ocircumflex = 778;
  38735. t.Ugrave = 722;
  38736. t.Delta = 612;
  38737. t.thorn = 556;
  38738. t.twosuperior = 333;
  38739. t.Odieresis = 778;
  38740. t.mu = 556;
  38741. t.igrave = 278;
  38742. t.ohungarumlaut = 556;
  38743. t.Eogonek = 667;
  38744. t.dcroat = 556;
  38745. t.threequarters = 834;
  38746. t.Scedilla = 667;
  38747. t.lcaron = 299;
  38748. t.Kcommaaccent = 667;
  38749. t.Lacute = 556;
  38750. t.trademark = 1000;
  38751. t.edotaccent = 556;
  38752. t.Igrave = 278;
  38753. t.Imacron = 278;
  38754. t.Lcaron = 556;
  38755. t.onehalf = 834;
  38756. t.lessequal = 549;
  38757. t.ocircumflex = 556;
  38758. t.ntilde = 556;
  38759. t.Uhungarumlaut = 722;
  38760. t.Eacute = 667;
  38761. t.emacron = 556;
  38762. t.gbreve = 556;
  38763. t.onequarter = 834;
  38764. t.Scaron = 667;
  38765. t.Scommaaccent = 667;
  38766. t.Ohungarumlaut = 778;
  38767. t.degree = 400;
  38768. t.ograve = 556;
  38769. t.Ccaron = 722;
  38770. t.ugrave = 556;
  38771. t.radical = 453;
  38772. t.Dcaron = 722;
  38773. t.rcommaaccent = 333;
  38774. t.Ntilde = 722;
  38775. t.otilde = 556;
  38776. t.Rcommaaccent = 722;
  38777. t.Lcommaaccent = 556;
  38778. t.Atilde = 667;
  38779. t.Aogonek = 667;
  38780. t.Aring = 667;
  38781. t.Otilde = 778;
  38782. t.zdotaccent = 500;
  38783. t.Ecaron = 667;
  38784. t.Iogonek = 278;
  38785. t.kcommaaccent = 500;
  38786. t.minus = 584;
  38787. t.Icircumflex = 278;
  38788. t.ncaron = 556;
  38789. t.tcommaaccent = 278;
  38790. t.logicalnot = 584;
  38791. t.odieresis = 556;
  38792. t.udieresis = 556;
  38793. t.notequal = 549;
  38794. t.gcommaaccent = 556;
  38795. t.eth = 556;
  38796. t.zcaron = 500;
  38797. t.ncommaaccent = 556;
  38798. t.onesuperior = 333;
  38799. t.imacron = 278;
  38800. t.Euro = 556;
  38801. });
  38802. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38803. t.space = 278;
  38804. t.exclam = 333;
  38805. t.quotedbl = 474;
  38806. t.numbersign = 556;
  38807. t.dollar = 556;
  38808. t.percent = 889;
  38809. t.ampersand = 722;
  38810. t.quoteright = 278;
  38811. t.parenleft = 333;
  38812. t.parenright = 333;
  38813. t.asterisk = 389;
  38814. t.plus = 584;
  38815. t.comma = 278;
  38816. t.hyphen = 333;
  38817. t.period = 278;
  38818. t.slash = 278;
  38819. t.zero = 556;
  38820. t.one = 556;
  38821. t.two = 556;
  38822. t.three = 556;
  38823. t.four = 556;
  38824. t.five = 556;
  38825. t.six = 556;
  38826. t.seven = 556;
  38827. t.eight = 556;
  38828. t.nine = 556;
  38829. t.colon = 333;
  38830. t.semicolon = 333;
  38831. t.less = 584;
  38832. t.equal = 584;
  38833. t.greater = 584;
  38834. t.question = 611;
  38835. t.at = 975;
  38836. t.A = 722;
  38837. t.B = 722;
  38838. t.C = 722;
  38839. t.D = 722;
  38840. t.E = 667;
  38841. t.F = 611;
  38842. t.G = 778;
  38843. t.H = 722;
  38844. t.I = 278;
  38845. t.J = 556;
  38846. t.K = 722;
  38847. t.L = 611;
  38848. t.M = 833;
  38849. t.N = 722;
  38850. t.O = 778;
  38851. t.P = 667;
  38852. t.Q = 778;
  38853. t.R = 722;
  38854. t.S = 667;
  38855. t.T = 611;
  38856. t.U = 722;
  38857. t.V = 667;
  38858. t.W = 944;
  38859. t.X = 667;
  38860. t.Y = 667;
  38861. t.Z = 611;
  38862. t.bracketleft = 333;
  38863. t.backslash = 278;
  38864. t.bracketright = 333;
  38865. t.asciicircum = 584;
  38866. t.underscore = 556;
  38867. t.quoteleft = 278;
  38868. t.a = 556;
  38869. t.b = 611;
  38870. t.c = 556;
  38871. t.d = 611;
  38872. t.e = 556;
  38873. t.f = 333;
  38874. t.g = 611;
  38875. t.h = 611;
  38876. t.i = 278;
  38877. t.j = 278;
  38878. t.k = 556;
  38879. t.l = 278;
  38880. t.m = 889;
  38881. t.n = 611;
  38882. t.o = 611;
  38883. t.p = 611;
  38884. t.q = 611;
  38885. t.r = 389;
  38886. t.s = 556;
  38887. t.t = 333;
  38888. t.u = 611;
  38889. t.v = 556;
  38890. t.w = 778;
  38891. t.x = 556;
  38892. t.y = 556;
  38893. t.z = 500;
  38894. t.braceleft = 389;
  38895. t.bar = 280;
  38896. t.braceright = 389;
  38897. t.asciitilde = 584;
  38898. t.exclamdown = 333;
  38899. t.cent = 556;
  38900. t.sterling = 556;
  38901. t.fraction = 167;
  38902. t.yen = 556;
  38903. t.florin = 556;
  38904. t.section = 556;
  38905. t.currency = 556;
  38906. t.quotesingle = 238;
  38907. t.quotedblleft = 500;
  38908. t.guillemotleft = 556;
  38909. t.guilsinglleft = 333;
  38910. t.guilsinglright = 333;
  38911. t.fi = 611;
  38912. t.fl = 611;
  38913. t.endash = 556;
  38914. t.dagger = 556;
  38915. t.daggerdbl = 556;
  38916. t.periodcentered = 278;
  38917. t.paragraph = 556;
  38918. t.bullet = 350;
  38919. t.quotesinglbase = 278;
  38920. t.quotedblbase = 500;
  38921. t.quotedblright = 500;
  38922. t.guillemotright = 556;
  38923. t.ellipsis = 1000;
  38924. t.perthousand = 1000;
  38925. t.questiondown = 611;
  38926. t.grave = 333;
  38927. t.acute = 333;
  38928. t.circumflex = 333;
  38929. t.tilde = 333;
  38930. t.macron = 333;
  38931. t.breve = 333;
  38932. t.dotaccent = 333;
  38933. t.dieresis = 333;
  38934. t.ring = 333;
  38935. t.cedilla = 333;
  38936. t.hungarumlaut = 333;
  38937. t.ogonek = 333;
  38938. t.caron = 333;
  38939. t.emdash = 1000;
  38940. t.AE = 1000;
  38941. t.ordfeminine = 370;
  38942. t.Lslash = 611;
  38943. t.Oslash = 778;
  38944. t.OE = 1000;
  38945. t.ordmasculine = 365;
  38946. t.ae = 889;
  38947. t.dotlessi = 278;
  38948. t.lslash = 278;
  38949. t.oslash = 611;
  38950. t.oe = 944;
  38951. t.germandbls = 611;
  38952. t.Idieresis = 278;
  38953. t.eacute = 556;
  38954. t.abreve = 556;
  38955. t.uhungarumlaut = 611;
  38956. t.ecaron = 556;
  38957. t.Ydieresis = 667;
  38958. t.divide = 584;
  38959. t.Yacute = 667;
  38960. t.Acircumflex = 722;
  38961. t.aacute = 556;
  38962. t.Ucircumflex = 722;
  38963. t.yacute = 556;
  38964. t.scommaaccent = 556;
  38965. t.ecircumflex = 556;
  38966. t.Uring = 722;
  38967. t.Udieresis = 722;
  38968. t.aogonek = 556;
  38969. t.Uacute = 722;
  38970. t.uogonek = 611;
  38971. t.Edieresis = 667;
  38972. t.Dcroat = 722;
  38973. t.commaaccent = 250;
  38974. t.copyright = 737;
  38975. t.Emacron = 667;
  38976. t.ccaron = 556;
  38977. t.aring = 556;
  38978. t.Ncommaaccent = 722;
  38979. t.lacute = 278;
  38980. t.agrave = 556;
  38981. t.Tcommaaccent = 611;
  38982. t.Cacute = 722;
  38983. t.atilde = 556;
  38984. t.Edotaccent = 667;
  38985. t.scaron = 556;
  38986. t.scedilla = 556;
  38987. t.iacute = 278;
  38988. t.lozenge = 494;
  38989. t.Rcaron = 722;
  38990. t.Gcommaaccent = 778;
  38991. t.ucircumflex = 611;
  38992. t.acircumflex = 556;
  38993. t.Amacron = 722;
  38994. t.rcaron = 389;
  38995. t.ccedilla = 556;
  38996. t.Zdotaccent = 611;
  38997. t.Thorn = 667;
  38998. t.Omacron = 778;
  38999. t.Racute = 722;
  39000. t.Sacute = 667;
  39001. t.dcaron = 743;
  39002. t.Umacron = 722;
  39003. t.uring = 611;
  39004. t.threesuperior = 333;
  39005. t.Ograve = 778;
  39006. t.Agrave = 722;
  39007. t.Abreve = 722;
  39008. t.multiply = 584;
  39009. t.uacute = 611;
  39010. t.Tcaron = 611;
  39011. t.partialdiff = 494;
  39012. t.ydieresis = 556;
  39013. t.Nacute = 722;
  39014. t.icircumflex = 278;
  39015. t.Ecircumflex = 667;
  39016. t.adieresis = 556;
  39017. t.edieresis = 556;
  39018. t.cacute = 556;
  39019. t.nacute = 611;
  39020. t.umacron = 611;
  39021. t.Ncaron = 722;
  39022. t.Iacute = 278;
  39023. t.plusminus = 584;
  39024. t.brokenbar = 280;
  39025. t.registered = 737;
  39026. t.Gbreve = 778;
  39027. t.Idotaccent = 278;
  39028. t.summation = 600;
  39029. t.Egrave = 667;
  39030. t.racute = 389;
  39031. t.omacron = 611;
  39032. t.Zacute = 611;
  39033. t.Zcaron = 611;
  39034. t.greaterequal = 549;
  39035. t.Eth = 722;
  39036. t.Ccedilla = 722;
  39037. t.lcommaaccent = 278;
  39038. t.tcaron = 389;
  39039. t.eogonek = 556;
  39040. t.Uogonek = 722;
  39041. t.Aacute = 722;
  39042. t.Adieresis = 722;
  39043. t.egrave = 556;
  39044. t.zacute = 500;
  39045. t.iogonek = 278;
  39046. t.Oacute = 778;
  39047. t.oacute = 611;
  39048. t.amacron = 556;
  39049. t.sacute = 556;
  39050. t.idieresis = 278;
  39051. t.Ocircumflex = 778;
  39052. t.Ugrave = 722;
  39053. t.Delta = 612;
  39054. t.thorn = 611;
  39055. t.twosuperior = 333;
  39056. t.Odieresis = 778;
  39057. t.mu = 611;
  39058. t.igrave = 278;
  39059. t.ohungarumlaut = 611;
  39060. t.Eogonek = 667;
  39061. t.dcroat = 611;
  39062. t.threequarters = 834;
  39063. t.Scedilla = 667;
  39064. t.lcaron = 400;
  39065. t.Kcommaaccent = 722;
  39066. t.Lacute = 611;
  39067. t.trademark = 1000;
  39068. t.edotaccent = 556;
  39069. t.Igrave = 278;
  39070. t.Imacron = 278;
  39071. t.Lcaron = 611;
  39072. t.onehalf = 834;
  39073. t.lessequal = 549;
  39074. t.ocircumflex = 611;
  39075. t.ntilde = 611;
  39076. t.Uhungarumlaut = 722;
  39077. t.Eacute = 667;
  39078. t.emacron = 556;
  39079. t.gbreve = 611;
  39080. t.onequarter = 834;
  39081. t.Scaron = 667;
  39082. t.Scommaaccent = 667;
  39083. t.Ohungarumlaut = 778;
  39084. t.degree = 400;
  39085. t.ograve = 611;
  39086. t.Ccaron = 722;
  39087. t.ugrave = 611;
  39088. t.radical = 549;
  39089. t.Dcaron = 722;
  39090. t.rcommaaccent = 389;
  39091. t.Ntilde = 722;
  39092. t.otilde = 611;
  39093. t.Rcommaaccent = 722;
  39094. t.Lcommaaccent = 611;
  39095. t.Atilde = 722;
  39096. t.Aogonek = 722;
  39097. t.Aring = 722;
  39098. t.Otilde = 778;
  39099. t.zdotaccent = 500;
  39100. t.Ecaron = 667;
  39101. t.Iogonek = 278;
  39102. t.kcommaaccent = 556;
  39103. t.minus = 584;
  39104. t.Icircumflex = 278;
  39105. t.ncaron = 611;
  39106. t.tcommaaccent = 333;
  39107. t.logicalnot = 584;
  39108. t.odieresis = 611;
  39109. t.udieresis = 611;
  39110. t.notequal = 549;
  39111. t.gcommaaccent = 611;
  39112. t.eth = 611;
  39113. t.zcaron = 500;
  39114. t.ncommaaccent = 611;
  39115. t.onesuperior = 333;
  39116. t.imacron = 278;
  39117. t.Euro = 556;
  39118. });
  39119. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39120. t.space = 278;
  39121. t.exclam = 333;
  39122. t.quotedbl = 474;
  39123. t.numbersign = 556;
  39124. t.dollar = 556;
  39125. t.percent = 889;
  39126. t.ampersand = 722;
  39127. t.quoteright = 278;
  39128. t.parenleft = 333;
  39129. t.parenright = 333;
  39130. t.asterisk = 389;
  39131. t.plus = 584;
  39132. t.comma = 278;
  39133. t.hyphen = 333;
  39134. t.period = 278;
  39135. t.slash = 278;
  39136. t.zero = 556;
  39137. t.one = 556;
  39138. t.two = 556;
  39139. t.three = 556;
  39140. t.four = 556;
  39141. t.five = 556;
  39142. t.six = 556;
  39143. t.seven = 556;
  39144. t.eight = 556;
  39145. t.nine = 556;
  39146. t.colon = 333;
  39147. t.semicolon = 333;
  39148. t.less = 584;
  39149. t.equal = 584;
  39150. t.greater = 584;
  39151. t.question = 611;
  39152. t.at = 975;
  39153. t.A = 722;
  39154. t.B = 722;
  39155. t.C = 722;
  39156. t.D = 722;
  39157. t.E = 667;
  39158. t.F = 611;
  39159. t.G = 778;
  39160. t.H = 722;
  39161. t.I = 278;
  39162. t.J = 556;
  39163. t.K = 722;
  39164. t.L = 611;
  39165. t.M = 833;
  39166. t.N = 722;
  39167. t.O = 778;
  39168. t.P = 667;
  39169. t.Q = 778;
  39170. t.R = 722;
  39171. t.S = 667;
  39172. t.T = 611;
  39173. t.U = 722;
  39174. t.V = 667;
  39175. t.W = 944;
  39176. t.X = 667;
  39177. t.Y = 667;
  39178. t.Z = 611;
  39179. t.bracketleft = 333;
  39180. t.backslash = 278;
  39181. t.bracketright = 333;
  39182. t.asciicircum = 584;
  39183. t.underscore = 556;
  39184. t.quoteleft = 278;
  39185. t.a = 556;
  39186. t.b = 611;
  39187. t.c = 556;
  39188. t.d = 611;
  39189. t.e = 556;
  39190. t.f = 333;
  39191. t.g = 611;
  39192. t.h = 611;
  39193. t.i = 278;
  39194. t.j = 278;
  39195. t.k = 556;
  39196. t.l = 278;
  39197. t.m = 889;
  39198. t.n = 611;
  39199. t.o = 611;
  39200. t.p = 611;
  39201. t.q = 611;
  39202. t.r = 389;
  39203. t.s = 556;
  39204. t.t = 333;
  39205. t.u = 611;
  39206. t.v = 556;
  39207. t.w = 778;
  39208. t.x = 556;
  39209. t.y = 556;
  39210. t.z = 500;
  39211. t.braceleft = 389;
  39212. t.bar = 280;
  39213. t.braceright = 389;
  39214. t.asciitilde = 584;
  39215. t.exclamdown = 333;
  39216. t.cent = 556;
  39217. t.sterling = 556;
  39218. t.fraction = 167;
  39219. t.yen = 556;
  39220. t.florin = 556;
  39221. t.section = 556;
  39222. t.currency = 556;
  39223. t.quotesingle = 238;
  39224. t.quotedblleft = 500;
  39225. t.guillemotleft = 556;
  39226. t.guilsinglleft = 333;
  39227. t.guilsinglright = 333;
  39228. t.fi = 611;
  39229. t.fl = 611;
  39230. t.endash = 556;
  39231. t.dagger = 556;
  39232. t.daggerdbl = 556;
  39233. t.periodcentered = 278;
  39234. t.paragraph = 556;
  39235. t.bullet = 350;
  39236. t.quotesinglbase = 278;
  39237. t.quotedblbase = 500;
  39238. t.quotedblright = 500;
  39239. t.guillemotright = 556;
  39240. t.ellipsis = 1000;
  39241. t.perthousand = 1000;
  39242. t.questiondown = 611;
  39243. t.grave = 333;
  39244. t.acute = 333;
  39245. t.circumflex = 333;
  39246. t.tilde = 333;
  39247. t.macron = 333;
  39248. t.breve = 333;
  39249. t.dotaccent = 333;
  39250. t.dieresis = 333;
  39251. t.ring = 333;
  39252. t.cedilla = 333;
  39253. t.hungarumlaut = 333;
  39254. t.ogonek = 333;
  39255. t.caron = 333;
  39256. t.emdash = 1000;
  39257. t.AE = 1000;
  39258. t.ordfeminine = 370;
  39259. t.Lslash = 611;
  39260. t.Oslash = 778;
  39261. t.OE = 1000;
  39262. t.ordmasculine = 365;
  39263. t.ae = 889;
  39264. t.dotlessi = 278;
  39265. t.lslash = 278;
  39266. t.oslash = 611;
  39267. t.oe = 944;
  39268. t.germandbls = 611;
  39269. t.Idieresis = 278;
  39270. t.eacute = 556;
  39271. t.abreve = 556;
  39272. t.uhungarumlaut = 611;
  39273. t.ecaron = 556;
  39274. t.Ydieresis = 667;
  39275. t.divide = 584;
  39276. t.Yacute = 667;
  39277. t.Acircumflex = 722;
  39278. t.aacute = 556;
  39279. t.Ucircumflex = 722;
  39280. t.yacute = 556;
  39281. t.scommaaccent = 556;
  39282. t.ecircumflex = 556;
  39283. t.Uring = 722;
  39284. t.Udieresis = 722;
  39285. t.aogonek = 556;
  39286. t.Uacute = 722;
  39287. t.uogonek = 611;
  39288. t.Edieresis = 667;
  39289. t.Dcroat = 722;
  39290. t.commaaccent = 250;
  39291. t.copyright = 737;
  39292. t.Emacron = 667;
  39293. t.ccaron = 556;
  39294. t.aring = 556;
  39295. t.Ncommaaccent = 722;
  39296. t.lacute = 278;
  39297. t.agrave = 556;
  39298. t.Tcommaaccent = 611;
  39299. t.Cacute = 722;
  39300. t.atilde = 556;
  39301. t.Edotaccent = 667;
  39302. t.scaron = 556;
  39303. t.scedilla = 556;
  39304. t.iacute = 278;
  39305. t.lozenge = 494;
  39306. t.Rcaron = 722;
  39307. t.Gcommaaccent = 778;
  39308. t.ucircumflex = 611;
  39309. t.acircumflex = 556;
  39310. t.Amacron = 722;
  39311. t.rcaron = 389;
  39312. t.ccedilla = 556;
  39313. t.Zdotaccent = 611;
  39314. t.Thorn = 667;
  39315. t.Omacron = 778;
  39316. t.Racute = 722;
  39317. t.Sacute = 667;
  39318. t.dcaron = 743;
  39319. t.Umacron = 722;
  39320. t.uring = 611;
  39321. t.threesuperior = 333;
  39322. t.Ograve = 778;
  39323. t.Agrave = 722;
  39324. t.Abreve = 722;
  39325. t.multiply = 584;
  39326. t.uacute = 611;
  39327. t.Tcaron = 611;
  39328. t.partialdiff = 494;
  39329. t.ydieresis = 556;
  39330. t.Nacute = 722;
  39331. t.icircumflex = 278;
  39332. t.Ecircumflex = 667;
  39333. t.adieresis = 556;
  39334. t.edieresis = 556;
  39335. t.cacute = 556;
  39336. t.nacute = 611;
  39337. t.umacron = 611;
  39338. t.Ncaron = 722;
  39339. t.Iacute = 278;
  39340. t.plusminus = 584;
  39341. t.brokenbar = 280;
  39342. t.registered = 737;
  39343. t.Gbreve = 778;
  39344. t.Idotaccent = 278;
  39345. t.summation = 600;
  39346. t.Egrave = 667;
  39347. t.racute = 389;
  39348. t.omacron = 611;
  39349. t.Zacute = 611;
  39350. t.Zcaron = 611;
  39351. t.greaterequal = 549;
  39352. t.Eth = 722;
  39353. t.Ccedilla = 722;
  39354. t.lcommaaccent = 278;
  39355. t.tcaron = 389;
  39356. t.eogonek = 556;
  39357. t.Uogonek = 722;
  39358. t.Aacute = 722;
  39359. t.Adieresis = 722;
  39360. t.egrave = 556;
  39361. t.zacute = 500;
  39362. t.iogonek = 278;
  39363. t.Oacute = 778;
  39364. t.oacute = 611;
  39365. t.amacron = 556;
  39366. t.sacute = 556;
  39367. t.idieresis = 278;
  39368. t.Ocircumflex = 778;
  39369. t.Ugrave = 722;
  39370. t.Delta = 612;
  39371. t.thorn = 611;
  39372. t.twosuperior = 333;
  39373. t.Odieresis = 778;
  39374. t.mu = 611;
  39375. t.igrave = 278;
  39376. t.ohungarumlaut = 611;
  39377. t.Eogonek = 667;
  39378. t.dcroat = 611;
  39379. t.threequarters = 834;
  39380. t.Scedilla = 667;
  39381. t.lcaron = 400;
  39382. t.Kcommaaccent = 722;
  39383. t.Lacute = 611;
  39384. t.trademark = 1000;
  39385. t.edotaccent = 556;
  39386. t.Igrave = 278;
  39387. t.Imacron = 278;
  39388. t.Lcaron = 611;
  39389. t.onehalf = 834;
  39390. t.lessequal = 549;
  39391. t.ocircumflex = 611;
  39392. t.ntilde = 611;
  39393. t.Uhungarumlaut = 722;
  39394. t.Eacute = 667;
  39395. t.emacron = 556;
  39396. t.gbreve = 611;
  39397. t.onequarter = 834;
  39398. t.Scaron = 667;
  39399. t.Scommaaccent = 667;
  39400. t.Ohungarumlaut = 778;
  39401. t.degree = 400;
  39402. t.ograve = 611;
  39403. t.Ccaron = 722;
  39404. t.ugrave = 611;
  39405. t.radical = 549;
  39406. t.Dcaron = 722;
  39407. t.rcommaaccent = 389;
  39408. t.Ntilde = 722;
  39409. t.otilde = 611;
  39410. t.Rcommaaccent = 722;
  39411. t.Lcommaaccent = 611;
  39412. t.Atilde = 722;
  39413. t.Aogonek = 722;
  39414. t.Aring = 722;
  39415. t.Otilde = 778;
  39416. t.zdotaccent = 500;
  39417. t.Ecaron = 667;
  39418. t.Iogonek = 278;
  39419. t.kcommaaccent = 556;
  39420. t.minus = 584;
  39421. t.Icircumflex = 278;
  39422. t.ncaron = 611;
  39423. t.tcommaaccent = 333;
  39424. t.logicalnot = 584;
  39425. t.odieresis = 611;
  39426. t.udieresis = 611;
  39427. t.notequal = 549;
  39428. t.gcommaaccent = 611;
  39429. t.eth = 611;
  39430. t.zcaron = 500;
  39431. t.ncommaaccent = 611;
  39432. t.onesuperior = 333;
  39433. t.imacron = 278;
  39434. t.Euro = 556;
  39435. });
  39436. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39437. t.space = 278;
  39438. t.exclam = 278;
  39439. t.quotedbl = 355;
  39440. t.numbersign = 556;
  39441. t.dollar = 556;
  39442. t.percent = 889;
  39443. t.ampersand = 667;
  39444. t.quoteright = 222;
  39445. t.parenleft = 333;
  39446. t.parenright = 333;
  39447. t.asterisk = 389;
  39448. t.plus = 584;
  39449. t.comma = 278;
  39450. t.hyphen = 333;
  39451. t.period = 278;
  39452. t.slash = 278;
  39453. t.zero = 556;
  39454. t.one = 556;
  39455. t.two = 556;
  39456. t.three = 556;
  39457. t.four = 556;
  39458. t.five = 556;
  39459. t.six = 556;
  39460. t.seven = 556;
  39461. t.eight = 556;
  39462. t.nine = 556;
  39463. t.colon = 278;
  39464. t.semicolon = 278;
  39465. t.less = 584;
  39466. t.equal = 584;
  39467. t.greater = 584;
  39468. t.question = 556;
  39469. t.at = 1015;
  39470. t.A = 667;
  39471. t.B = 667;
  39472. t.C = 722;
  39473. t.D = 722;
  39474. t.E = 667;
  39475. t.F = 611;
  39476. t.G = 778;
  39477. t.H = 722;
  39478. t.I = 278;
  39479. t.J = 500;
  39480. t.K = 667;
  39481. t.L = 556;
  39482. t.M = 833;
  39483. t.N = 722;
  39484. t.O = 778;
  39485. t.P = 667;
  39486. t.Q = 778;
  39487. t.R = 722;
  39488. t.S = 667;
  39489. t.T = 611;
  39490. t.U = 722;
  39491. t.V = 667;
  39492. t.W = 944;
  39493. t.X = 667;
  39494. t.Y = 667;
  39495. t.Z = 611;
  39496. t.bracketleft = 278;
  39497. t.backslash = 278;
  39498. t.bracketright = 278;
  39499. t.asciicircum = 469;
  39500. t.underscore = 556;
  39501. t.quoteleft = 222;
  39502. t.a = 556;
  39503. t.b = 556;
  39504. t.c = 500;
  39505. t.d = 556;
  39506. t.e = 556;
  39507. t.f = 278;
  39508. t.g = 556;
  39509. t.h = 556;
  39510. t.i = 222;
  39511. t.j = 222;
  39512. t.k = 500;
  39513. t.l = 222;
  39514. t.m = 833;
  39515. t.n = 556;
  39516. t.o = 556;
  39517. t.p = 556;
  39518. t.q = 556;
  39519. t.r = 333;
  39520. t.s = 500;
  39521. t.t = 278;
  39522. t.u = 556;
  39523. t.v = 500;
  39524. t.w = 722;
  39525. t.x = 500;
  39526. t.y = 500;
  39527. t.z = 500;
  39528. t.braceleft = 334;
  39529. t.bar = 260;
  39530. t.braceright = 334;
  39531. t.asciitilde = 584;
  39532. t.exclamdown = 333;
  39533. t.cent = 556;
  39534. t.sterling = 556;
  39535. t.fraction = 167;
  39536. t.yen = 556;
  39537. t.florin = 556;
  39538. t.section = 556;
  39539. t.currency = 556;
  39540. t.quotesingle = 191;
  39541. t.quotedblleft = 333;
  39542. t.guillemotleft = 556;
  39543. t.guilsinglleft = 333;
  39544. t.guilsinglright = 333;
  39545. t.fi = 500;
  39546. t.fl = 500;
  39547. t.endash = 556;
  39548. t.dagger = 556;
  39549. t.daggerdbl = 556;
  39550. t.periodcentered = 278;
  39551. t.paragraph = 537;
  39552. t.bullet = 350;
  39553. t.quotesinglbase = 222;
  39554. t.quotedblbase = 333;
  39555. t.quotedblright = 333;
  39556. t.guillemotright = 556;
  39557. t.ellipsis = 1000;
  39558. t.perthousand = 1000;
  39559. t.questiondown = 611;
  39560. t.grave = 333;
  39561. t.acute = 333;
  39562. t.circumflex = 333;
  39563. t.tilde = 333;
  39564. t.macron = 333;
  39565. t.breve = 333;
  39566. t.dotaccent = 333;
  39567. t.dieresis = 333;
  39568. t.ring = 333;
  39569. t.cedilla = 333;
  39570. t.hungarumlaut = 333;
  39571. t.ogonek = 333;
  39572. t.caron = 333;
  39573. t.emdash = 1000;
  39574. t.AE = 1000;
  39575. t.ordfeminine = 370;
  39576. t.Lslash = 556;
  39577. t.Oslash = 778;
  39578. t.OE = 1000;
  39579. t.ordmasculine = 365;
  39580. t.ae = 889;
  39581. t.dotlessi = 278;
  39582. t.lslash = 222;
  39583. t.oslash = 611;
  39584. t.oe = 944;
  39585. t.germandbls = 611;
  39586. t.Idieresis = 278;
  39587. t.eacute = 556;
  39588. t.abreve = 556;
  39589. t.uhungarumlaut = 556;
  39590. t.ecaron = 556;
  39591. t.Ydieresis = 667;
  39592. t.divide = 584;
  39593. t.Yacute = 667;
  39594. t.Acircumflex = 667;
  39595. t.aacute = 556;
  39596. t.Ucircumflex = 722;
  39597. t.yacute = 500;
  39598. t.scommaaccent = 500;
  39599. t.ecircumflex = 556;
  39600. t.Uring = 722;
  39601. t.Udieresis = 722;
  39602. t.aogonek = 556;
  39603. t.Uacute = 722;
  39604. t.uogonek = 556;
  39605. t.Edieresis = 667;
  39606. t.Dcroat = 722;
  39607. t.commaaccent = 250;
  39608. t.copyright = 737;
  39609. t.Emacron = 667;
  39610. t.ccaron = 500;
  39611. t.aring = 556;
  39612. t.Ncommaaccent = 722;
  39613. t.lacute = 222;
  39614. t.agrave = 556;
  39615. t.Tcommaaccent = 611;
  39616. t.Cacute = 722;
  39617. t.atilde = 556;
  39618. t.Edotaccent = 667;
  39619. t.scaron = 500;
  39620. t.scedilla = 500;
  39621. t.iacute = 278;
  39622. t.lozenge = 471;
  39623. t.Rcaron = 722;
  39624. t.Gcommaaccent = 778;
  39625. t.ucircumflex = 556;
  39626. t.acircumflex = 556;
  39627. t.Amacron = 667;
  39628. t.rcaron = 333;
  39629. t.ccedilla = 500;
  39630. t.Zdotaccent = 611;
  39631. t.Thorn = 667;
  39632. t.Omacron = 778;
  39633. t.Racute = 722;
  39634. t.Sacute = 667;
  39635. t.dcaron = 643;
  39636. t.Umacron = 722;
  39637. t.uring = 556;
  39638. t.threesuperior = 333;
  39639. t.Ograve = 778;
  39640. t.Agrave = 667;
  39641. t.Abreve = 667;
  39642. t.multiply = 584;
  39643. t.uacute = 556;
  39644. t.Tcaron = 611;
  39645. t.partialdiff = 476;
  39646. t.ydieresis = 500;
  39647. t.Nacute = 722;
  39648. t.icircumflex = 278;
  39649. t.Ecircumflex = 667;
  39650. t.adieresis = 556;
  39651. t.edieresis = 556;
  39652. t.cacute = 500;
  39653. t.nacute = 556;
  39654. t.umacron = 556;
  39655. t.Ncaron = 722;
  39656. t.Iacute = 278;
  39657. t.plusminus = 584;
  39658. t.brokenbar = 260;
  39659. t.registered = 737;
  39660. t.Gbreve = 778;
  39661. t.Idotaccent = 278;
  39662. t.summation = 600;
  39663. t.Egrave = 667;
  39664. t.racute = 333;
  39665. t.omacron = 556;
  39666. t.Zacute = 611;
  39667. t.Zcaron = 611;
  39668. t.greaterequal = 549;
  39669. t.Eth = 722;
  39670. t.Ccedilla = 722;
  39671. t.lcommaaccent = 222;
  39672. t.tcaron = 317;
  39673. t.eogonek = 556;
  39674. t.Uogonek = 722;
  39675. t.Aacute = 667;
  39676. t.Adieresis = 667;
  39677. t.egrave = 556;
  39678. t.zacute = 500;
  39679. t.iogonek = 222;
  39680. t.Oacute = 778;
  39681. t.oacute = 556;
  39682. t.amacron = 556;
  39683. t.sacute = 500;
  39684. t.idieresis = 278;
  39685. t.Ocircumflex = 778;
  39686. t.Ugrave = 722;
  39687. t.Delta = 612;
  39688. t.thorn = 556;
  39689. t.twosuperior = 333;
  39690. t.Odieresis = 778;
  39691. t.mu = 556;
  39692. t.igrave = 278;
  39693. t.ohungarumlaut = 556;
  39694. t.Eogonek = 667;
  39695. t.dcroat = 556;
  39696. t.threequarters = 834;
  39697. t.Scedilla = 667;
  39698. t.lcaron = 299;
  39699. t.Kcommaaccent = 667;
  39700. t.Lacute = 556;
  39701. t.trademark = 1000;
  39702. t.edotaccent = 556;
  39703. t.Igrave = 278;
  39704. t.Imacron = 278;
  39705. t.Lcaron = 556;
  39706. t.onehalf = 834;
  39707. t.lessequal = 549;
  39708. t.ocircumflex = 556;
  39709. t.ntilde = 556;
  39710. t.Uhungarumlaut = 722;
  39711. t.Eacute = 667;
  39712. t.emacron = 556;
  39713. t.gbreve = 556;
  39714. t.onequarter = 834;
  39715. t.Scaron = 667;
  39716. t.Scommaaccent = 667;
  39717. t.Ohungarumlaut = 778;
  39718. t.degree = 400;
  39719. t.ograve = 556;
  39720. t.Ccaron = 722;
  39721. t.ugrave = 556;
  39722. t.radical = 453;
  39723. t.Dcaron = 722;
  39724. t.rcommaaccent = 333;
  39725. t.Ntilde = 722;
  39726. t.otilde = 556;
  39727. t.Rcommaaccent = 722;
  39728. t.Lcommaaccent = 556;
  39729. t.Atilde = 667;
  39730. t.Aogonek = 667;
  39731. t.Aring = 667;
  39732. t.Otilde = 778;
  39733. t.zdotaccent = 500;
  39734. t.Ecaron = 667;
  39735. t.Iogonek = 278;
  39736. t.kcommaaccent = 500;
  39737. t.minus = 584;
  39738. t.Icircumflex = 278;
  39739. t.ncaron = 556;
  39740. t.tcommaaccent = 278;
  39741. t.logicalnot = 584;
  39742. t.odieresis = 556;
  39743. t.udieresis = 556;
  39744. t.notequal = 549;
  39745. t.gcommaaccent = 556;
  39746. t.eth = 556;
  39747. t.zcaron = 500;
  39748. t.ncommaaccent = 556;
  39749. t.onesuperior = 333;
  39750. t.imacron = 278;
  39751. t.Euro = 556;
  39752. });
  39753. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  39754. t.space = 250;
  39755. t.exclam = 333;
  39756. t.universal = 713;
  39757. t.numbersign = 500;
  39758. t.existential = 549;
  39759. t.percent = 833;
  39760. t.ampersand = 778;
  39761. t.suchthat = 439;
  39762. t.parenleft = 333;
  39763. t.parenright = 333;
  39764. t.asteriskmath = 500;
  39765. t.plus = 549;
  39766. t.comma = 250;
  39767. t.minus = 549;
  39768. t.period = 250;
  39769. t.slash = 278;
  39770. t.zero = 500;
  39771. t.one = 500;
  39772. t.two = 500;
  39773. t.three = 500;
  39774. t.four = 500;
  39775. t.five = 500;
  39776. t.six = 500;
  39777. t.seven = 500;
  39778. t.eight = 500;
  39779. t.nine = 500;
  39780. t.colon = 278;
  39781. t.semicolon = 278;
  39782. t.less = 549;
  39783. t.equal = 549;
  39784. t.greater = 549;
  39785. t.question = 444;
  39786. t.congruent = 549;
  39787. t.Alpha = 722;
  39788. t.Beta = 667;
  39789. t.Chi = 722;
  39790. t.Delta = 612;
  39791. t.Epsilon = 611;
  39792. t.Phi = 763;
  39793. t.Gamma = 603;
  39794. t.Eta = 722;
  39795. t.Iota = 333;
  39796. t.theta1 = 631;
  39797. t.Kappa = 722;
  39798. t.Lambda = 686;
  39799. t.Mu = 889;
  39800. t.Nu = 722;
  39801. t.Omicron = 722;
  39802. t.Pi = 768;
  39803. t.Theta = 741;
  39804. t.Rho = 556;
  39805. t.Sigma = 592;
  39806. t.Tau = 611;
  39807. t.Upsilon = 690;
  39808. t.sigma1 = 439;
  39809. t.Omega = 768;
  39810. t.Xi = 645;
  39811. t.Psi = 795;
  39812. t.Zeta = 611;
  39813. t.bracketleft = 333;
  39814. t.therefore = 863;
  39815. t.bracketright = 333;
  39816. t.perpendicular = 658;
  39817. t.underscore = 500;
  39818. t.radicalex = 500;
  39819. t.alpha = 631;
  39820. t.beta = 549;
  39821. t.chi = 549;
  39822. t.delta = 494;
  39823. t.epsilon = 439;
  39824. t.phi = 521;
  39825. t.gamma = 411;
  39826. t.eta = 603;
  39827. t.iota = 329;
  39828. t.phi1 = 603;
  39829. t.kappa = 549;
  39830. t.lambda = 549;
  39831. t.mu = 576;
  39832. t.nu = 521;
  39833. t.omicron = 549;
  39834. t.pi = 549;
  39835. t.theta = 521;
  39836. t.rho = 549;
  39837. t.sigma = 603;
  39838. t.tau = 439;
  39839. t.upsilon = 576;
  39840. t.omega1 = 713;
  39841. t.omega = 686;
  39842. t.xi = 493;
  39843. t.psi = 686;
  39844. t.zeta = 494;
  39845. t.braceleft = 480;
  39846. t.bar = 200;
  39847. t.braceright = 480;
  39848. t.similar = 549;
  39849. t.Euro = 750;
  39850. t.Upsilon1 = 620;
  39851. t.minute = 247;
  39852. t.lessequal = 549;
  39853. t.fraction = 167;
  39854. t.infinity = 713;
  39855. t.florin = 500;
  39856. t.club = 753;
  39857. t.diamond = 753;
  39858. t.heart = 753;
  39859. t.spade = 753;
  39860. t.arrowboth = 1042;
  39861. t.arrowleft = 987;
  39862. t.arrowup = 603;
  39863. t.arrowright = 987;
  39864. t.arrowdown = 603;
  39865. t.degree = 400;
  39866. t.plusminus = 549;
  39867. t.second = 411;
  39868. t.greaterequal = 549;
  39869. t.multiply = 549;
  39870. t.proportional = 713;
  39871. t.partialdiff = 494;
  39872. t.bullet = 460;
  39873. t.divide = 549;
  39874. t.notequal = 549;
  39875. t.equivalence = 549;
  39876. t.approxequal = 549;
  39877. t.ellipsis = 1000;
  39878. t.arrowvertex = 603;
  39879. t.arrowhorizex = 1000;
  39880. t.carriagereturn = 658;
  39881. t.aleph = 823;
  39882. t.Ifraktur = 686;
  39883. t.Rfraktur = 795;
  39884. t.weierstrass = 987;
  39885. t.circlemultiply = 768;
  39886. t.circleplus = 768;
  39887. t.emptyset = 823;
  39888. t.intersection = 768;
  39889. t.union = 768;
  39890. t.propersuperset = 713;
  39891. t.reflexsuperset = 713;
  39892. t.notsubset = 713;
  39893. t.propersubset = 713;
  39894. t.reflexsubset = 713;
  39895. t.element = 713;
  39896. t.notelement = 713;
  39897. t.angle = 768;
  39898. t.gradient = 713;
  39899. t.registerserif = 790;
  39900. t.copyrightserif = 790;
  39901. t.trademarkserif = 890;
  39902. t.product = 823;
  39903. t.radical = 549;
  39904. t.dotmath = 250;
  39905. t.logicalnot = 713;
  39906. t.logicaland = 603;
  39907. t.logicalor = 603;
  39908. t.arrowdblboth = 1042;
  39909. t.arrowdblleft = 987;
  39910. t.arrowdblup = 603;
  39911. t.arrowdblright = 987;
  39912. t.arrowdbldown = 603;
  39913. t.lozenge = 494;
  39914. t.angleleft = 329;
  39915. t.registersans = 790;
  39916. t.copyrightsans = 790;
  39917. t.trademarksans = 786;
  39918. t.summation = 713;
  39919. t.parenlefttp = 384;
  39920. t.parenleftex = 384;
  39921. t.parenleftbt = 384;
  39922. t.bracketlefttp = 384;
  39923. t.bracketleftex = 384;
  39924. t.bracketleftbt = 384;
  39925. t.bracelefttp = 494;
  39926. t.braceleftmid = 494;
  39927. t.braceleftbt = 494;
  39928. t.braceex = 494;
  39929. t.angleright = 329;
  39930. t.integral = 274;
  39931. t.integraltp = 686;
  39932. t.integralex = 686;
  39933. t.integralbt = 686;
  39934. t.parenrighttp = 384;
  39935. t.parenrightex = 384;
  39936. t.parenrightbt = 384;
  39937. t.bracketrighttp = 384;
  39938. t.bracketrightex = 384;
  39939. t.bracketrightbt = 384;
  39940. t.bracerighttp = 494;
  39941. t.bracerightmid = 494;
  39942. t.bracerightbt = 494;
  39943. t.apple = 790;
  39944. });
  39945. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39946. t.space = 250;
  39947. t.exclam = 333;
  39948. t.quotedbl = 408;
  39949. t.numbersign = 500;
  39950. t.dollar = 500;
  39951. t.percent = 833;
  39952. t.ampersand = 778;
  39953. t.quoteright = 333;
  39954. t.parenleft = 333;
  39955. t.parenright = 333;
  39956. t.asterisk = 500;
  39957. t.plus = 564;
  39958. t.comma = 250;
  39959. t.hyphen = 333;
  39960. t.period = 250;
  39961. t.slash = 278;
  39962. t.zero = 500;
  39963. t.one = 500;
  39964. t.two = 500;
  39965. t.three = 500;
  39966. t.four = 500;
  39967. t.five = 500;
  39968. t.six = 500;
  39969. t.seven = 500;
  39970. t.eight = 500;
  39971. t.nine = 500;
  39972. t.colon = 278;
  39973. t.semicolon = 278;
  39974. t.less = 564;
  39975. t.equal = 564;
  39976. t.greater = 564;
  39977. t.question = 444;
  39978. t.at = 921;
  39979. t.A = 722;
  39980. t.B = 667;
  39981. t.C = 667;
  39982. t.D = 722;
  39983. t.E = 611;
  39984. t.F = 556;
  39985. t.G = 722;
  39986. t.H = 722;
  39987. t.I = 333;
  39988. t.J = 389;
  39989. t.K = 722;
  39990. t.L = 611;
  39991. t.M = 889;
  39992. t.N = 722;
  39993. t.O = 722;
  39994. t.P = 556;
  39995. t.Q = 722;
  39996. t.R = 667;
  39997. t.S = 556;
  39998. t.T = 611;
  39999. t.U = 722;
  40000. t.V = 722;
  40001. t.W = 944;
  40002. t.X = 722;
  40003. t.Y = 722;
  40004. t.Z = 611;
  40005. t.bracketleft = 333;
  40006. t.backslash = 278;
  40007. t.bracketright = 333;
  40008. t.asciicircum = 469;
  40009. t.underscore = 500;
  40010. t.quoteleft = 333;
  40011. t.a = 444;
  40012. t.b = 500;
  40013. t.c = 444;
  40014. t.d = 500;
  40015. t.e = 444;
  40016. t.f = 333;
  40017. t.g = 500;
  40018. t.h = 500;
  40019. t.i = 278;
  40020. t.j = 278;
  40021. t.k = 500;
  40022. t.l = 278;
  40023. t.m = 778;
  40024. t.n = 500;
  40025. t.o = 500;
  40026. t.p = 500;
  40027. t.q = 500;
  40028. t.r = 333;
  40029. t.s = 389;
  40030. t.t = 278;
  40031. t.u = 500;
  40032. t.v = 500;
  40033. t.w = 722;
  40034. t.x = 500;
  40035. t.y = 500;
  40036. t.z = 444;
  40037. t.braceleft = 480;
  40038. t.bar = 200;
  40039. t.braceright = 480;
  40040. t.asciitilde = 541;
  40041. t.exclamdown = 333;
  40042. t.cent = 500;
  40043. t.sterling = 500;
  40044. t.fraction = 167;
  40045. t.yen = 500;
  40046. t.florin = 500;
  40047. t.section = 500;
  40048. t.currency = 500;
  40049. t.quotesingle = 180;
  40050. t.quotedblleft = 444;
  40051. t.guillemotleft = 500;
  40052. t.guilsinglleft = 333;
  40053. t.guilsinglright = 333;
  40054. t.fi = 556;
  40055. t.fl = 556;
  40056. t.endash = 500;
  40057. t.dagger = 500;
  40058. t.daggerdbl = 500;
  40059. t.periodcentered = 250;
  40060. t.paragraph = 453;
  40061. t.bullet = 350;
  40062. t.quotesinglbase = 333;
  40063. t.quotedblbase = 444;
  40064. t.quotedblright = 444;
  40065. t.guillemotright = 500;
  40066. t.ellipsis = 1000;
  40067. t.perthousand = 1000;
  40068. t.questiondown = 444;
  40069. t.grave = 333;
  40070. t.acute = 333;
  40071. t.circumflex = 333;
  40072. t.tilde = 333;
  40073. t.macron = 333;
  40074. t.breve = 333;
  40075. t.dotaccent = 333;
  40076. t.dieresis = 333;
  40077. t.ring = 333;
  40078. t.cedilla = 333;
  40079. t.hungarumlaut = 333;
  40080. t.ogonek = 333;
  40081. t.caron = 333;
  40082. t.emdash = 1000;
  40083. t.AE = 889;
  40084. t.ordfeminine = 276;
  40085. t.Lslash = 611;
  40086. t.Oslash = 722;
  40087. t.OE = 889;
  40088. t.ordmasculine = 310;
  40089. t.ae = 667;
  40090. t.dotlessi = 278;
  40091. t.lslash = 278;
  40092. t.oslash = 500;
  40093. t.oe = 722;
  40094. t.germandbls = 500;
  40095. t.Idieresis = 333;
  40096. t.eacute = 444;
  40097. t.abreve = 444;
  40098. t.uhungarumlaut = 500;
  40099. t.ecaron = 444;
  40100. t.Ydieresis = 722;
  40101. t.divide = 564;
  40102. t.Yacute = 722;
  40103. t.Acircumflex = 722;
  40104. t.aacute = 444;
  40105. t.Ucircumflex = 722;
  40106. t.yacute = 500;
  40107. t.scommaaccent = 389;
  40108. t.ecircumflex = 444;
  40109. t.Uring = 722;
  40110. t.Udieresis = 722;
  40111. t.aogonek = 444;
  40112. t.Uacute = 722;
  40113. t.uogonek = 500;
  40114. t.Edieresis = 611;
  40115. t.Dcroat = 722;
  40116. t.commaaccent = 250;
  40117. t.copyright = 760;
  40118. t.Emacron = 611;
  40119. t.ccaron = 444;
  40120. t.aring = 444;
  40121. t.Ncommaaccent = 722;
  40122. t.lacute = 278;
  40123. t.agrave = 444;
  40124. t.Tcommaaccent = 611;
  40125. t.Cacute = 667;
  40126. t.atilde = 444;
  40127. t.Edotaccent = 611;
  40128. t.scaron = 389;
  40129. t.scedilla = 389;
  40130. t.iacute = 278;
  40131. t.lozenge = 471;
  40132. t.Rcaron = 667;
  40133. t.Gcommaaccent = 722;
  40134. t.ucircumflex = 500;
  40135. t.acircumflex = 444;
  40136. t.Amacron = 722;
  40137. t.rcaron = 333;
  40138. t.ccedilla = 444;
  40139. t.Zdotaccent = 611;
  40140. t.Thorn = 556;
  40141. t.Omacron = 722;
  40142. t.Racute = 667;
  40143. t.Sacute = 556;
  40144. t.dcaron = 588;
  40145. t.Umacron = 722;
  40146. t.uring = 500;
  40147. t.threesuperior = 300;
  40148. t.Ograve = 722;
  40149. t.Agrave = 722;
  40150. t.Abreve = 722;
  40151. t.multiply = 564;
  40152. t.uacute = 500;
  40153. t.Tcaron = 611;
  40154. t.partialdiff = 476;
  40155. t.ydieresis = 500;
  40156. t.Nacute = 722;
  40157. t.icircumflex = 278;
  40158. t.Ecircumflex = 611;
  40159. t.adieresis = 444;
  40160. t.edieresis = 444;
  40161. t.cacute = 444;
  40162. t.nacute = 500;
  40163. t.umacron = 500;
  40164. t.Ncaron = 722;
  40165. t.Iacute = 333;
  40166. t.plusminus = 564;
  40167. t.brokenbar = 200;
  40168. t.registered = 760;
  40169. t.Gbreve = 722;
  40170. t.Idotaccent = 333;
  40171. t.summation = 600;
  40172. t.Egrave = 611;
  40173. t.racute = 333;
  40174. t.omacron = 500;
  40175. t.Zacute = 611;
  40176. t.Zcaron = 611;
  40177. t.greaterequal = 549;
  40178. t.Eth = 722;
  40179. t.Ccedilla = 667;
  40180. t.lcommaaccent = 278;
  40181. t.tcaron = 326;
  40182. t.eogonek = 444;
  40183. t.Uogonek = 722;
  40184. t.Aacute = 722;
  40185. t.Adieresis = 722;
  40186. t.egrave = 444;
  40187. t.zacute = 444;
  40188. t.iogonek = 278;
  40189. t.Oacute = 722;
  40190. t.oacute = 500;
  40191. t.amacron = 444;
  40192. t.sacute = 389;
  40193. t.idieresis = 278;
  40194. t.Ocircumflex = 722;
  40195. t.Ugrave = 722;
  40196. t.Delta = 612;
  40197. t.thorn = 500;
  40198. t.twosuperior = 300;
  40199. t.Odieresis = 722;
  40200. t.mu = 500;
  40201. t.igrave = 278;
  40202. t.ohungarumlaut = 500;
  40203. t.Eogonek = 611;
  40204. t.dcroat = 500;
  40205. t.threequarters = 750;
  40206. t.Scedilla = 556;
  40207. t.lcaron = 344;
  40208. t.Kcommaaccent = 722;
  40209. t.Lacute = 611;
  40210. t.trademark = 980;
  40211. t.edotaccent = 444;
  40212. t.Igrave = 333;
  40213. t.Imacron = 333;
  40214. t.Lcaron = 611;
  40215. t.onehalf = 750;
  40216. t.lessequal = 549;
  40217. t.ocircumflex = 500;
  40218. t.ntilde = 500;
  40219. t.Uhungarumlaut = 722;
  40220. t.Eacute = 611;
  40221. t.emacron = 444;
  40222. t.gbreve = 500;
  40223. t.onequarter = 750;
  40224. t.Scaron = 556;
  40225. t.Scommaaccent = 556;
  40226. t.Ohungarumlaut = 722;
  40227. t.degree = 400;
  40228. t.ograve = 500;
  40229. t.Ccaron = 667;
  40230. t.ugrave = 500;
  40231. t.radical = 453;
  40232. t.Dcaron = 722;
  40233. t.rcommaaccent = 333;
  40234. t.Ntilde = 722;
  40235. t.otilde = 500;
  40236. t.Rcommaaccent = 667;
  40237. t.Lcommaaccent = 611;
  40238. t.Atilde = 722;
  40239. t.Aogonek = 722;
  40240. t.Aring = 722;
  40241. t.Otilde = 722;
  40242. t.zdotaccent = 444;
  40243. t.Ecaron = 611;
  40244. t.Iogonek = 333;
  40245. t.kcommaaccent = 500;
  40246. t.minus = 564;
  40247. t.Icircumflex = 333;
  40248. t.ncaron = 500;
  40249. t.tcommaaccent = 278;
  40250. t.logicalnot = 564;
  40251. t.odieresis = 500;
  40252. t.udieresis = 500;
  40253. t.notequal = 549;
  40254. t.gcommaaccent = 500;
  40255. t.eth = 500;
  40256. t.zcaron = 444;
  40257. t.ncommaaccent = 500;
  40258. t.onesuperior = 300;
  40259. t.imacron = 278;
  40260. t.Euro = 500;
  40261. });
  40262. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40263. t.space = 250;
  40264. t.exclam = 333;
  40265. t.quotedbl = 555;
  40266. t.numbersign = 500;
  40267. t.dollar = 500;
  40268. t.percent = 1000;
  40269. t.ampersand = 833;
  40270. t.quoteright = 333;
  40271. t.parenleft = 333;
  40272. t.parenright = 333;
  40273. t.asterisk = 500;
  40274. t.plus = 570;
  40275. t.comma = 250;
  40276. t.hyphen = 333;
  40277. t.period = 250;
  40278. t.slash = 278;
  40279. t.zero = 500;
  40280. t.one = 500;
  40281. t.two = 500;
  40282. t.three = 500;
  40283. t.four = 500;
  40284. t.five = 500;
  40285. t.six = 500;
  40286. t.seven = 500;
  40287. t.eight = 500;
  40288. t.nine = 500;
  40289. t.colon = 333;
  40290. t.semicolon = 333;
  40291. t.less = 570;
  40292. t.equal = 570;
  40293. t.greater = 570;
  40294. t.question = 500;
  40295. t.at = 930;
  40296. t.A = 722;
  40297. t.B = 667;
  40298. t.C = 722;
  40299. t.D = 722;
  40300. t.E = 667;
  40301. t.F = 611;
  40302. t.G = 778;
  40303. t.H = 778;
  40304. t.I = 389;
  40305. t.J = 500;
  40306. t.K = 778;
  40307. t.L = 667;
  40308. t.M = 944;
  40309. t.N = 722;
  40310. t.O = 778;
  40311. t.P = 611;
  40312. t.Q = 778;
  40313. t.R = 722;
  40314. t.S = 556;
  40315. t.T = 667;
  40316. t.U = 722;
  40317. t.V = 722;
  40318. t.W = 1000;
  40319. t.X = 722;
  40320. t.Y = 722;
  40321. t.Z = 667;
  40322. t.bracketleft = 333;
  40323. t.backslash = 278;
  40324. t.bracketright = 333;
  40325. t.asciicircum = 581;
  40326. t.underscore = 500;
  40327. t.quoteleft = 333;
  40328. t.a = 500;
  40329. t.b = 556;
  40330. t.c = 444;
  40331. t.d = 556;
  40332. t.e = 444;
  40333. t.f = 333;
  40334. t.g = 500;
  40335. t.h = 556;
  40336. t.i = 278;
  40337. t.j = 333;
  40338. t.k = 556;
  40339. t.l = 278;
  40340. t.m = 833;
  40341. t.n = 556;
  40342. t.o = 500;
  40343. t.p = 556;
  40344. t.q = 556;
  40345. t.r = 444;
  40346. t.s = 389;
  40347. t.t = 333;
  40348. t.u = 556;
  40349. t.v = 500;
  40350. t.w = 722;
  40351. t.x = 500;
  40352. t.y = 500;
  40353. t.z = 444;
  40354. t.braceleft = 394;
  40355. t.bar = 220;
  40356. t.braceright = 394;
  40357. t.asciitilde = 520;
  40358. t.exclamdown = 333;
  40359. t.cent = 500;
  40360. t.sterling = 500;
  40361. t.fraction = 167;
  40362. t.yen = 500;
  40363. t.florin = 500;
  40364. t.section = 500;
  40365. t.currency = 500;
  40366. t.quotesingle = 278;
  40367. t.quotedblleft = 500;
  40368. t.guillemotleft = 500;
  40369. t.guilsinglleft = 333;
  40370. t.guilsinglright = 333;
  40371. t.fi = 556;
  40372. t.fl = 556;
  40373. t.endash = 500;
  40374. t.dagger = 500;
  40375. t.daggerdbl = 500;
  40376. t.periodcentered = 250;
  40377. t.paragraph = 540;
  40378. t.bullet = 350;
  40379. t.quotesinglbase = 333;
  40380. t.quotedblbase = 500;
  40381. t.quotedblright = 500;
  40382. t.guillemotright = 500;
  40383. t.ellipsis = 1000;
  40384. t.perthousand = 1000;
  40385. t.questiondown = 500;
  40386. t.grave = 333;
  40387. t.acute = 333;
  40388. t.circumflex = 333;
  40389. t.tilde = 333;
  40390. t.macron = 333;
  40391. t.breve = 333;
  40392. t.dotaccent = 333;
  40393. t.dieresis = 333;
  40394. t.ring = 333;
  40395. t.cedilla = 333;
  40396. t.hungarumlaut = 333;
  40397. t.ogonek = 333;
  40398. t.caron = 333;
  40399. t.emdash = 1000;
  40400. t.AE = 1000;
  40401. t.ordfeminine = 300;
  40402. t.Lslash = 667;
  40403. t.Oslash = 778;
  40404. t.OE = 1000;
  40405. t.ordmasculine = 330;
  40406. t.ae = 722;
  40407. t.dotlessi = 278;
  40408. t.lslash = 278;
  40409. t.oslash = 500;
  40410. t.oe = 722;
  40411. t.germandbls = 556;
  40412. t.Idieresis = 389;
  40413. t.eacute = 444;
  40414. t.abreve = 500;
  40415. t.uhungarumlaut = 556;
  40416. t.ecaron = 444;
  40417. t.Ydieresis = 722;
  40418. t.divide = 570;
  40419. t.Yacute = 722;
  40420. t.Acircumflex = 722;
  40421. t.aacute = 500;
  40422. t.Ucircumflex = 722;
  40423. t.yacute = 500;
  40424. t.scommaaccent = 389;
  40425. t.ecircumflex = 444;
  40426. t.Uring = 722;
  40427. t.Udieresis = 722;
  40428. t.aogonek = 500;
  40429. t.Uacute = 722;
  40430. t.uogonek = 556;
  40431. t.Edieresis = 667;
  40432. t.Dcroat = 722;
  40433. t.commaaccent = 250;
  40434. t.copyright = 747;
  40435. t.Emacron = 667;
  40436. t.ccaron = 444;
  40437. t.aring = 500;
  40438. t.Ncommaaccent = 722;
  40439. t.lacute = 278;
  40440. t.agrave = 500;
  40441. t.Tcommaaccent = 667;
  40442. t.Cacute = 722;
  40443. t.atilde = 500;
  40444. t.Edotaccent = 667;
  40445. t.scaron = 389;
  40446. t.scedilla = 389;
  40447. t.iacute = 278;
  40448. t.lozenge = 494;
  40449. t.Rcaron = 722;
  40450. t.Gcommaaccent = 778;
  40451. t.ucircumflex = 556;
  40452. t.acircumflex = 500;
  40453. t.Amacron = 722;
  40454. t.rcaron = 444;
  40455. t.ccedilla = 444;
  40456. t.Zdotaccent = 667;
  40457. t.Thorn = 611;
  40458. t.Omacron = 778;
  40459. t.Racute = 722;
  40460. t.Sacute = 556;
  40461. t.dcaron = 672;
  40462. t.Umacron = 722;
  40463. t.uring = 556;
  40464. t.threesuperior = 300;
  40465. t.Ograve = 778;
  40466. t.Agrave = 722;
  40467. t.Abreve = 722;
  40468. t.multiply = 570;
  40469. t.uacute = 556;
  40470. t.Tcaron = 667;
  40471. t.partialdiff = 494;
  40472. t.ydieresis = 500;
  40473. t.Nacute = 722;
  40474. t.icircumflex = 278;
  40475. t.Ecircumflex = 667;
  40476. t.adieresis = 500;
  40477. t.edieresis = 444;
  40478. t.cacute = 444;
  40479. t.nacute = 556;
  40480. t.umacron = 556;
  40481. t.Ncaron = 722;
  40482. t.Iacute = 389;
  40483. t.plusminus = 570;
  40484. t.brokenbar = 220;
  40485. t.registered = 747;
  40486. t.Gbreve = 778;
  40487. t.Idotaccent = 389;
  40488. t.summation = 600;
  40489. t.Egrave = 667;
  40490. t.racute = 444;
  40491. t.omacron = 500;
  40492. t.Zacute = 667;
  40493. t.Zcaron = 667;
  40494. t.greaterequal = 549;
  40495. t.Eth = 722;
  40496. t.Ccedilla = 722;
  40497. t.lcommaaccent = 278;
  40498. t.tcaron = 416;
  40499. t.eogonek = 444;
  40500. t.Uogonek = 722;
  40501. t.Aacute = 722;
  40502. t.Adieresis = 722;
  40503. t.egrave = 444;
  40504. t.zacute = 444;
  40505. t.iogonek = 278;
  40506. t.Oacute = 778;
  40507. t.oacute = 500;
  40508. t.amacron = 500;
  40509. t.sacute = 389;
  40510. t.idieresis = 278;
  40511. t.Ocircumflex = 778;
  40512. t.Ugrave = 722;
  40513. t.Delta = 612;
  40514. t.thorn = 556;
  40515. t.twosuperior = 300;
  40516. t.Odieresis = 778;
  40517. t.mu = 556;
  40518. t.igrave = 278;
  40519. t.ohungarumlaut = 500;
  40520. t.Eogonek = 667;
  40521. t.dcroat = 556;
  40522. t.threequarters = 750;
  40523. t.Scedilla = 556;
  40524. t.lcaron = 394;
  40525. t.Kcommaaccent = 778;
  40526. t.Lacute = 667;
  40527. t.trademark = 1000;
  40528. t.edotaccent = 444;
  40529. t.Igrave = 389;
  40530. t.Imacron = 389;
  40531. t.Lcaron = 667;
  40532. t.onehalf = 750;
  40533. t.lessequal = 549;
  40534. t.ocircumflex = 500;
  40535. t.ntilde = 556;
  40536. t.Uhungarumlaut = 722;
  40537. t.Eacute = 667;
  40538. t.emacron = 444;
  40539. t.gbreve = 500;
  40540. t.onequarter = 750;
  40541. t.Scaron = 556;
  40542. t.Scommaaccent = 556;
  40543. t.Ohungarumlaut = 778;
  40544. t.degree = 400;
  40545. t.ograve = 500;
  40546. t.Ccaron = 722;
  40547. t.ugrave = 556;
  40548. t.radical = 549;
  40549. t.Dcaron = 722;
  40550. t.rcommaaccent = 444;
  40551. t.Ntilde = 722;
  40552. t.otilde = 500;
  40553. t.Rcommaaccent = 722;
  40554. t.Lcommaaccent = 667;
  40555. t.Atilde = 722;
  40556. t.Aogonek = 722;
  40557. t.Aring = 722;
  40558. t.Otilde = 778;
  40559. t.zdotaccent = 444;
  40560. t.Ecaron = 667;
  40561. t.Iogonek = 389;
  40562. t.kcommaaccent = 556;
  40563. t.minus = 570;
  40564. t.Icircumflex = 389;
  40565. t.ncaron = 556;
  40566. t.tcommaaccent = 333;
  40567. t.logicalnot = 570;
  40568. t.odieresis = 500;
  40569. t.udieresis = 556;
  40570. t.notequal = 549;
  40571. t.gcommaaccent = 500;
  40572. t.eth = 500;
  40573. t.zcaron = 444;
  40574. t.ncommaaccent = 556;
  40575. t.onesuperior = 300;
  40576. t.imacron = 278;
  40577. t.Euro = 500;
  40578. });
  40579. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40580. t.space = 250;
  40581. t.exclam = 389;
  40582. t.quotedbl = 555;
  40583. t.numbersign = 500;
  40584. t.dollar = 500;
  40585. t.percent = 833;
  40586. t.ampersand = 778;
  40587. t.quoteright = 333;
  40588. t.parenleft = 333;
  40589. t.parenright = 333;
  40590. t.asterisk = 500;
  40591. t.plus = 570;
  40592. t.comma = 250;
  40593. t.hyphen = 333;
  40594. t.period = 250;
  40595. t.slash = 278;
  40596. t.zero = 500;
  40597. t.one = 500;
  40598. t.two = 500;
  40599. t.three = 500;
  40600. t.four = 500;
  40601. t.five = 500;
  40602. t.six = 500;
  40603. t.seven = 500;
  40604. t.eight = 500;
  40605. t.nine = 500;
  40606. t.colon = 333;
  40607. t.semicolon = 333;
  40608. t.less = 570;
  40609. t.equal = 570;
  40610. t.greater = 570;
  40611. t.question = 500;
  40612. t.at = 832;
  40613. t.A = 667;
  40614. t.B = 667;
  40615. t.C = 667;
  40616. t.D = 722;
  40617. t.E = 667;
  40618. t.F = 667;
  40619. t.G = 722;
  40620. t.H = 778;
  40621. t.I = 389;
  40622. t.J = 500;
  40623. t.K = 667;
  40624. t.L = 611;
  40625. t.M = 889;
  40626. t.N = 722;
  40627. t.O = 722;
  40628. t.P = 611;
  40629. t.Q = 722;
  40630. t.R = 667;
  40631. t.S = 556;
  40632. t.T = 611;
  40633. t.U = 722;
  40634. t.V = 667;
  40635. t.W = 889;
  40636. t.X = 667;
  40637. t.Y = 611;
  40638. t.Z = 611;
  40639. t.bracketleft = 333;
  40640. t.backslash = 278;
  40641. t.bracketright = 333;
  40642. t.asciicircum = 570;
  40643. t.underscore = 500;
  40644. t.quoteleft = 333;
  40645. t.a = 500;
  40646. t.b = 500;
  40647. t.c = 444;
  40648. t.d = 500;
  40649. t.e = 444;
  40650. t.f = 333;
  40651. t.g = 500;
  40652. t.h = 556;
  40653. t.i = 278;
  40654. t.j = 278;
  40655. t.k = 500;
  40656. t.l = 278;
  40657. t.m = 778;
  40658. t.n = 556;
  40659. t.o = 500;
  40660. t.p = 500;
  40661. t.q = 500;
  40662. t.r = 389;
  40663. t.s = 389;
  40664. t.t = 278;
  40665. t.u = 556;
  40666. t.v = 444;
  40667. t.w = 667;
  40668. t.x = 500;
  40669. t.y = 444;
  40670. t.z = 389;
  40671. t.braceleft = 348;
  40672. t.bar = 220;
  40673. t.braceright = 348;
  40674. t.asciitilde = 570;
  40675. t.exclamdown = 389;
  40676. t.cent = 500;
  40677. t.sterling = 500;
  40678. t.fraction = 167;
  40679. t.yen = 500;
  40680. t.florin = 500;
  40681. t.section = 500;
  40682. t.currency = 500;
  40683. t.quotesingle = 278;
  40684. t.quotedblleft = 500;
  40685. t.guillemotleft = 500;
  40686. t.guilsinglleft = 333;
  40687. t.guilsinglright = 333;
  40688. t.fi = 556;
  40689. t.fl = 556;
  40690. t.endash = 500;
  40691. t.dagger = 500;
  40692. t.daggerdbl = 500;
  40693. t.periodcentered = 250;
  40694. t.paragraph = 500;
  40695. t.bullet = 350;
  40696. t.quotesinglbase = 333;
  40697. t.quotedblbase = 500;
  40698. t.quotedblright = 500;
  40699. t.guillemotright = 500;
  40700. t.ellipsis = 1000;
  40701. t.perthousand = 1000;
  40702. t.questiondown = 500;
  40703. t.grave = 333;
  40704. t.acute = 333;
  40705. t.circumflex = 333;
  40706. t.tilde = 333;
  40707. t.macron = 333;
  40708. t.breve = 333;
  40709. t.dotaccent = 333;
  40710. t.dieresis = 333;
  40711. t.ring = 333;
  40712. t.cedilla = 333;
  40713. t.hungarumlaut = 333;
  40714. t.ogonek = 333;
  40715. t.caron = 333;
  40716. t.emdash = 1000;
  40717. t.AE = 944;
  40718. t.ordfeminine = 266;
  40719. t.Lslash = 611;
  40720. t.Oslash = 722;
  40721. t.OE = 944;
  40722. t.ordmasculine = 300;
  40723. t.ae = 722;
  40724. t.dotlessi = 278;
  40725. t.lslash = 278;
  40726. t.oslash = 500;
  40727. t.oe = 722;
  40728. t.germandbls = 500;
  40729. t.Idieresis = 389;
  40730. t.eacute = 444;
  40731. t.abreve = 500;
  40732. t.uhungarumlaut = 556;
  40733. t.ecaron = 444;
  40734. t.Ydieresis = 611;
  40735. t.divide = 570;
  40736. t.Yacute = 611;
  40737. t.Acircumflex = 667;
  40738. t.aacute = 500;
  40739. t.Ucircumflex = 722;
  40740. t.yacute = 444;
  40741. t.scommaaccent = 389;
  40742. t.ecircumflex = 444;
  40743. t.Uring = 722;
  40744. t.Udieresis = 722;
  40745. t.aogonek = 500;
  40746. t.Uacute = 722;
  40747. t.uogonek = 556;
  40748. t.Edieresis = 667;
  40749. t.Dcroat = 722;
  40750. t.commaaccent = 250;
  40751. t.copyright = 747;
  40752. t.Emacron = 667;
  40753. t.ccaron = 444;
  40754. t.aring = 500;
  40755. t.Ncommaaccent = 722;
  40756. t.lacute = 278;
  40757. t.agrave = 500;
  40758. t.Tcommaaccent = 611;
  40759. t.Cacute = 667;
  40760. t.atilde = 500;
  40761. t.Edotaccent = 667;
  40762. t.scaron = 389;
  40763. t.scedilla = 389;
  40764. t.iacute = 278;
  40765. t.lozenge = 494;
  40766. t.Rcaron = 667;
  40767. t.Gcommaaccent = 722;
  40768. t.ucircumflex = 556;
  40769. t.acircumflex = 500;
  40770. t.Amacron = 667;
  40771. t.rcaron = 389;
  40772. t.ccedilla = 444;
  40773. t.Zdotaccent = 611;
  40774. t.Thorn = 611;
  40775. t.Omacron = 722;
  40776. t.Racute = 667;
  40777. t.Sacute = 556;
  40778. t.dcaron = 608;
  40779. t.Umacron = 722;
  40780. t.uring = 556;
  40781. t.threesuperior = 300;
  40782. t.Ograve = 722;
  40783. t.Agrave = 667;
  40784. t.Abreve = 667;
  40785. t.multiply = 570;
  40786. t.uacute = 556;
  40787. t.Tcaron = 611;
  40788. t.partialdiff = 494;
  40789. t.ydieresis = 444;
  40790. t.Nacute = 722;
  40791. t.icircumflex = 278;
  40792. t.Ecircumflex = 667;
  40793. t.adieresis = 500;
  40794. t.edieresis = 444;
  40795. t.cacute = 444;
  40796. t.nacute = 556;
  40797. t.umacron = 556;
  40798. t.Ncaron = 722;
  40799. t.Iacute = 389;
  40800. t.plusminus = 570;
  40801. t.brokenbar = 220;
  40802. t.registered = 747;
  40803. t.Gbreve = 722;
  40804. t.Idotaccent = 389;
  40805. t.summation = 600;
  40806. t.Egrave = 667;
  40807. t.racute = 389;
  40808. t.omacron = 500;
  40809. t.Zacute = 611;
  40810. t.Zcaron = 611;
  40811. t.greaterequal = 549;
  40812. t.Eth = 722;
  40813. t.Ccedilla = 667;
  40814. t.lcommaaccent = 278;
  40815. t.tcaron = 366;
  40816. t.eogonek = 444;
  40817. t.Uogonek = 722;
  40818. t.Aacute = 667;
  40819. t.Adieresis = 667;
  40820. t.egrave = 444;
  40821. t.zacute = 389;
  40822. t.iogonek = 278;
  40823. t.Oacute = 722;
  40824. t.oacute = 500;
  40825. t.amacron = 500;
  40826. t.sacute = 389;
  40827. t.idieresis = 278;
  40828. t.Ocircumflex = 722;
  40829. t.Ugrave = 722;
  40830. t.Delta = 612;
  40831. t.thorn = 500;
  40832. t.twosuperior = 300;
  40833. t.Odieresis = 722;
  40834. t.mu = 576;
  40835. t.igrave = 278;
  40836. t.ohungarumlaut = 500;
  40837. t.Eogonek = 667;
  40838. t.dcroat = 500;
  40839. t.threequarters = 750;
  40840. t.Scedilla = 556;
  40841. t.lcaron = 382;
  40842. t.Kcommaaccent = 667;
  40843. t.Lacute = 611;
  40844. t.trademark = 1000;
  40845. t.edotaccent = 444;
  40846. t.Igrave = 389;
  40847. t.Imacron = 389;
  40848. t.Lcaron = 611;
  40849. t.onehalf = 750;
  40850. t.lessequal = 549;
  40851. t.ocircumflex = 500;
  40852. t.ntilde = 556;
  40853. t.Uhungarumlaut = 722;
  40854. t.Eacute = 667;
  40855. t.emacron = 444;
  40856. t.gbreve = 500;
  40857. t.onequarter = 750;
  40858. t.Scaron = 556;
  40859. t.Scommaaccent = 556;
  40860. t.Ohungarumlaut = 722;
  40861. t.degree = 400;
  40862. t.ograve = 500;
  40863. t.Ccaron = 667;
  40864. t.ugrave = 556;
  40865. t.radical = 549;
  40866. t.Dcaron = 722;
  40867. t.rcommaaccent = 389;
  40868. t.Ntilde = 722;
  40869. t.otilde = 500;
  40870. t.Rcommaaccent = 667;
  40871. t.Lcommaaccent = 611;
  40872. t.Atilde = 667;
  40873. t.Aogonek = 667;
  40874. t.Aring = 667;
  40875. t.Otilde = 722;
  40876. t.zdotaccent = 389;
  40877. t.Ecaron = 667;
  40878. t.Iogonek = 389;
  40879. t.kcommaaccent = 500;
  40880. t.minus = 606;
  40881. t.Icircumflex = 389;
  40882. t.ncaron = 556;
  40883. t.tcommaaccent = 278;
  40884. t.logicalnot = 606;
  40885. t.odieresis = 500;
  40886. t.udieresis = 556;
  40887. t.notequal = 549;
  40888. t.gcommaaccent = 500;
  40889. t.eth = 500;
  40890. t.zcaron = 389;
  40891. t.ncommaaccent = 556;
  40892. t.onesuperior = 300;
  40893. t.imacron = 278;
  40894. t.Euro = 500;
  40895. });
  40896. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40897. t.space = 250;
  40898. t.exclam = 333;
  40899. t.quotedbl = 420;
  40900. t.numbersign = 500;
  40901. t.dollar = 500;
  40902. t.percent = 833;
  40903. t.ampersand = 778;
  40904. t.quoteright = 333;
  40905. t.parenleft = 333;
  40906. t.parenright = 333;
  40907. t.asterisk = 500;
  40908. t.plus = 675;
  40909. t.comma = 250;
  40910. t.hyphen = 333;
  40911. t.period = 250;
  40912. t.slash = 278;
  40913. t.zero = 500;
  40914. t.one = 500;
  40915. t.two = 500;
  40916. t.three = 500;
  40917. t.four = 500;
  40918. t.five = 500;
  40919. t.six = 500;
  40920. t.seven = 500;
  40921. t.eight = 500;
  40922. t.nine = 500;
  40923. t.colon = 333;
  40924. t.semicolon = 333;
  40925. t.less = 675;
  40926. t.equal = 675;
  40927. t.greater = 675;
  40928. t.question = 500;
  40929. t.at = 920;
  40930. t.A = 611;
  40931. t.B = 611;
  40932. t.C = 667;
  40933. t.D = 722;
  40934. t.E = 611;
  40935. t.F = 611;
  40936. t.G = 722;
  40937. t.H = 722;
  40938. t.I = 333;
  40939. t.J = 444;
  40940. t.K = 667;
  40941. t.L = 556;
  40942. t.M = 833;
  40943. t.N = 667;
  40944. t.O = 722;
  40945. t.P = 611;
  40946. t.Q = 722;
  40947. t.R = 611;
  40948. t.S = 500;
  40949. t.T = 556;
  40950. t.U = 722;
  40951. t.V = 611;
  40952. t.W = 833;
  40953. t.X = 611;
  40954. t.Y = 556;
  40955. t.Z = 556;
  40956. t.bracketleft = 389;
  40957. t.backslash = 278;
  40958. t.bracketright = 389;
  40959. t.asciicircum = 422;
  40960. t.underscore = 500;
  40961. t.quoteleft = 333;
  40962. t.a = 500;
  40963. t.b = 500;
  40964. t.c = 444;
  40965. t.d = 500;
  40966. t.e = 444;
  40967. t.f = 278;
  40968. t.g = 500;
  40969. t.h = 500;
  40970. t.i = 278;
  40971. t.j = 278;
  40972. t.k = 444;
  40973. t.l = 278;
  40974. t.m = 722;
  40975. t.n = 500;
  40976. t.o = 500;
  40977. t.p = 500;
  40978. t.q = 500;
  40979. t.r = 389;
  40980. t.s = 389;
  40981. t.t = 278;
  40982. t.u = 500;
  40983. t.v = 444;
  40984. t.w = 667;
  40985. t.x = 444;
  40986. t.y = 444;
  40987. t.z = 389;
  40988. t.braceleft = 400;
  40989. t.bar = 275;
  40990. t.braceright = 400;
  40991. t.asciitilde = 541;
  40992. t.exclamdown = 389;
  40993. t.cent = 500;
  40994. t.sterling = 500;
  40995. t.fraction = 167;
  40996. t.yen = 500;
  40997. t.florin = 500;
  40998. t.section = 500;
  40999. t.currency = 500;
  41000. t.quotesingle = 214;
  41001. t.quotedblleft = 556;
  41002. t.guillemotleft = 500;
  41003. t.guilsinglleft = 333;
  41004. t.guilsinglright = 333;
  41005. t.fi = 500;
  41006. t.fl = 500;
  41007. t.endash = 500;
  41008. t.dagger = 500;
  41009. t.daggerdbl = 500;
  41010. t.periodcentered = 250;
  41011. t.paragraph = 523;
  41012. t.bullet = 350;
  41013. t.quotesinglbase = 333;
  41014. t.quotedblbase = 556;
  41015. t.quotedblright = 556;
  41016. t.guillemotright = 500;
  41017. t.ellipsis = 889;
  41018. t.perthousand = 1000;
  41019. t.questiondown = 500;
  41020. t.grave = 333;
  41021. t.acute = 333;
  41022. t.circumflex = 333;
  41023. t.tilde = 333;
  41024. t.macron = 333;
  41025. t.breve = 333;
  41026. t.dotaccent = 333;
  41027. t.dieresis = 333;
  41028. t.ring = 333;
  41029. t.cedilla = 333;
  41030. t.hungarumlaut = 333;
  41031. t.ogonek = 333;
  41032. t.caron = 333;
  41033. t.emdash = 889;
  41034. t.AE = 889;
  41035. t.ordfeminine = 276;
  41036. t.Lslash = 556;
  41037. t.Oslash = 722;
  41038. t.OE = 944;
  41039. t.ordmasculine = 310;
  41040. t.ae = 667;
  41041. t.dotlessi = 278;
  41042. t.lslash = 278;
  41043. t.oslash = 500;
  41044. t.oe = 667;
  41045. t.germandbls = 500;
  41046. t.Idieresis = 333;
  41047. t.eacute = 444;
  41048. t.abreve = 500;
  41049. t.uhungarumlaut = 500;
  41050. t.ecaron = 444;
  41051. t.Ydieresis = 556;
  41052. t.divide = 675;
  41053. t.Yacute = 556;
  41054. t.Acircumflex = 611;
  41055. t.aacute = 500;
  41056. t.Ucircumflex = 722;
  41057. t.yacute = 444;
  41058. t.scommaaccent = 389;
  41059. t.ecircumflex = 444;
  41060. t.Uring = 722;
  41061. t.Udieresis = 722;
  41062. t.aogonek = 500;
  41063. t.Uacute = 722;
  41064. t.uogonek = 500;
  41065. t.Edieresis = 611;
  41066. t.Dcroat = 722;
  41067. t.commaaccent = 250;
  41068. t.copyright = 760;
  41069. t.Emacron = 611;
  41070. t.ccaron = 444;
  41071. t.aring = 500;
  41072. t.Ncommaaccent = 667;
  41073. t.lacute = 278;
  41074. t.agrave = 500;
  41075. t.Tcommaaccent = 556;
  41076. t.Cacute = 667;
  41077. t.atilde = 500;
  41078. t.Edotaccent = 611;
  41079. t.scaron = 389;
  41080. t.scedilla = 389;
  41081. t.iacute = 278;
  41082. t.lozenge = 471;
  41083. t.Rcaron = 611;
  41084. t.Gcommaaccent = 722;
  41085. t.ucircumflex = 500;
  41086. t.acircumflex = 500;
  41087. t.Amacron = 611;
  41088. t.rcaron = 389;
  41089. t.ccedilla = 444;
  41090. t.Zdotaccent = 556;
  41091. t.Thorn = 611;
  41092. t.Omacron = 722;
  41093. t.Racute = 611;
  41094. t.Sacute = 500;
  41095. t.dcaron = 544;
  41096. t.Umacron = 722;
  41097. t.uring = 500;
  41098. t.threesuperior = 300;
  41099. t.Ograve = 722;
  41100. t.Agrave = 611;
  41101. t.Abreve = 611;
  41102. t.multiply = 675;
  41103. t.uacute = 500;
  41104. t.Tcaron = 556;
  41105. t.partialdiff = 476;
  41106. t.ydieresis = 444;
  41107. t.Nacute = 667;
  41108. t.icircumflex = 278;
  41109. t.Ecircumflex = 611;
  41110. t.adieresis = 500;
  41111. t.edieresis = 444;
  41112. t.cacute = 444;
  41113. t.nacute = 500;
  41114. t.umacron = 500;
  41115. t.Ncaron = 667;
  41116. t.Iacute = 333;
  41117. t.plusminus = 675;
  41118. t.brokenbar = 275;
  41119. t.registered = 760;
  41120. t.Gbreve = 722;
  41121. t.Idotaccent = 333;
  41122. t.summation = 600;
  41123. t.Egrave = 611;
  41124. t.racute = 389;
  41125. t.omacron = 500;
  41126. t.Zacute = 556;
  41127. t.Zcaron = 556;
  41128. t.greaterequal = 549;
  41129. t.Eth = 722;
  41130. t.Ccedilla = 667;
  41131. t.lcommaaccent = 278;
  41132. t.tcaron = 300;
  41133. t.eogonek = 444;
  41134. t.Uogonek = 722;
  41135. t.Aacute = 611;
  41136. t.Adieresis = 611;
  41137. t.egrave = 444;
  41138. t.zacute = 389;
  41139. t.iogonek = 278;
  41140. t.Oacute = 722;
  41141. t.oacute = 500;
  41142. t.amacron = 500;
  41143. t.sacute = 389;
  41144. t.idieresis = 278;
  41145. t.Ocircumflex = 722;
  41146. t.Ugrave = 722;
  41147. t.Delta = 612;
  41148. t.thorn = 500;
  41149. t.twosuperior = 300;
  41150. t.Odieresis = 722;
  41151. t.mu = 500;
  41152. t.igrave = 278;
  41153. t.ohungarumlaut = 500;
  41154. t.Eogonek = 611;
  41155. t.dcroat = 500;
  41156. t.threequarters = 750;
  41157. t.Scedilla = 500;
  41158. t.lcaron = 300;
  41159. t.Kcommaaccent = 667;
  41160. t.Lacute = 556;
  41161. t.trademark = 980;
  41162. t.edotaccent = 444;
  41163. t.Igrave = 333;
  41164. t.Imacron = 333;
  41165. t.Lcaron = 611;
  41166. t.onehalf = 750;
  41167. t.lessequal = 549;
  41168. t.ocircumflex = 500;
  41169. t.ntilde = 500;
  41170. t.Uhungarumlaut = 722;
  41171. t.Eacute = 611;
  41172. t.emacron = 444;
  41173. t.gbreve = 500;
  41174. t.onequarter = 750;
  41175. t.Scaron = 500;
  41176. t.Scommaaccent = 500;
  41177. t.Ohungarumlaut = 722;
  41178. t.degree = 400;
  41179. t.ograve = 500;
  41180. t.Ccaron = 667;
  41181. t.ugrave = 500;
  41182. t.radical = 453;
  41183. t.Dcaron = 722;
  41184. t.rcommaaccent = 389;
  41185. t.Ntilde = 667;
  41186. t.otilde = 500;
  41187. t.Rcommaaccent = 611;
  41188. t.Lcommaaccent = 556;
  41189. t.Atilde = 611;
  41190. t.Aogonek = 611;
  41191. t.Aring = 611;
  41192. t.Otilde = 722;
  41193. t.zdotaccent = 389;
  41194. t.Ecaron = 611;
  41195. t.Iogonek = 333;
  41196. t.kcommaaccent = 444;
  41197. t.minus = 675;
  41198. t.Icircumflex = 333;
  41199. t.ncaron = 500;
  41200. t.tcommaaccent = 278;
  41201. t.logicalnot = 675;
  41202. t.odieresis = 500;
  41203. t.udieresis = 500;
  41204. t.notequal = 549;
  41205. t.gcommaaccent = 500;
  41206. t.eth = 500;
  41207. t.zcaron = 389;
  41208. t.ncommaaccent = 500;
  41209. t.onesuperior = 300;
  41210. t.imacron = 278;
  41211. t.Euro = 500;
  41212. });
  41213. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  41214. t.space = 278;
  41215. t.a1 = 974;
  41216. t.a2 = 961;
  41217. t.a202 = 974;
  41218. t.a3 = 980;
  41219. t.a4 = 719;
  41220. t.a5 = 789;
  41221. t.a119 = 790;
  41222. t.a118 = 791;
  41223. t.a117 = 690;
  41224. t.a11 = 960;
  41225. t.a12 = 939;
  41226. t.a13 = 549;
  41227. t.a14 = 855;
  41228. t.a15 = 911;
  41229. t.a16 = 933;
  41230. t.a105 = 911;
  41231. t.a17 = 945;
  41232. t.a18 = 974;
  41233. t.a19 = 755;
  41234. t.a20 = 846;
  41235. t.a21 = 762;
  41236. t.a22 = 761;
  41237. t.a23 = 571;
  41238. t.a24 = 677;
  41239. t.a25 = 763;
  41240. t.a26 = 760;
  41241. t.a27 = 759;
  41242. t.a28 = 754;
  41243. t.a6 = 494;
  41244. t.a7 = 552;
  41245. t.a8 = 537;
  41246. t.a9 = 577;
  41247. t.a10 = 692;
  41248. t.a29 = 786;
  41249. t.a30 = 788;
  41250. t.a31 = 788;
  41251. t.a32 = 790;
  41252. t.a33 = 793;
  41253. t.a34 = 794;
  41254. t.a35 = 816;
  41255. t.a36 = 823;
  41256. t.a37 = 789;
  41257. t.a38 = 841;
  41258. t.a39 = 823;
  41259. t.a40 = 833;
  41260. t.a41 = 816;
  41261. t.a42 = 831;
  41262. t.a43 = 923;
  41263. t.a44 = 744;
  41264. t.a45 = 723;
  41265. t.a46 = 749;
  41266. t.a47 = 790;
  41267. t.a48 = 792;
  41268. t.a49 = 695;
  41269. t.a50 = 776;
  41270. t.a51 = 768;
  41271. t.a52 = 792;
  41272. t.a53 = 759;
  41273. t.a54 = 707;
  41274. t.a55 = 708;
  41275. t.a56 = 682;
  41276. t.a57 = 701;
  41277. t.a58 = 826;
  41278. t.a59 = 815;
  41279. t.a60 = 789;
  41280. t.a61 = 789;
  41281. t.a62 = 707;
  41282. t.a63 = 687;
  41283. t.a64 = 696;
  41284. t.a65 = 689;
  41285. t.a66 = 786;
  41286. t.a67 = 787;
  41287. t.a68 = 713;
  41288. t.a69 = 791;
  41289. t.a70 = 785;
  41290. t.a71 = 791;
  41291. t.a72 = 873;
  41292. t.a73 = 761;
  41293. t.a74 = 762;
  41294. t.a203 = 762;
  41295. t.a75 = 759;
  41296. t.a204 = 759;
  41297. t.a76 = 892;
  41298. t.a77 = 892;
  41299. t.a78 = 788;
  41300. t.a79 = 784;
  41301. t.a81 = 438;
  41302. t.a82 = 138;
  41303. t.a83 = 277;
  41304. t.a84 = 415;
  41305. t.a97 = 392;
  41306. t.a98 = 392;
  41307. t.a99 = 668;
  41308. t.a100 = 668;
  41309. t.a89 = 390;
  41310. t.a90 = 390;
  41311. t.a93 = 317;
  41312. t.a94 = 317;
  41313. t.a91 = 276;
  41314. t.a92 = 276;
  41315. t.a205 = 509;
  41316. t.a85 = 509;
  41317. t.a206 = 410;
  41318. t.a86 = 410;
  41319. t.a87 = 234;
  41320. t.a88 = 234;
  41321. t.a95 = 334;
  41322. t.a96 = 334;
  41323. t.a101 = 732;
  41324. t.a102 = 544;
  41325. t.a103 = 544;
  41326. t.a104 = 910;
  41327. t.a106 = 667;
  41328. t.a107 = 760;
  41329. t.a108 = 760;
  41330. t.a112 = 776;
  41331. t.a111 = 595;
  41332. t.a110 = 694;
  41333. t.a109 = 626;
  41334. t.a120 = 788;
  41335. t.a121 = 788;
  41336. t.a122 = 788;
  41337. t.a123 = 788;
  41338. t.a124 = 788;
  41339. t.a125 = 788;
  41340. t.a126 = 788;
  41341. t.a127 = 788;
  41342. t.a128 = 788;
  41343. t.a129 = 788;
  41344. t.a130 = 788;
  41345. t.a131 = 788;
  41346. t.a132 = 788;
  41347. t.a133 = 788;
  41348. t.a134 = 788;
  41349. t.a135 = 788;
  41350. t.a136 = 788;
  41351. t.a137 = 788;
  41352. t.a138 = 788;
  41353. t.a139 = 788;
  41354. t.a140 = 788;
  41355. t.a141 = 788;
  41356. t.a142 = 788;
  41357. t.a143 = 788;
  41358. t.a144 = 788;
  41359. t.a145 = 788;
  41360. t.a146 = 788;
  41361. t.a147 = 788;
  41362. t.a148 = 788;
  41363. t.a149 = 788;
  41364. t.a150 = 788;
  41365. t.a151 = 788;
  41366. t.a152 = 788;
  41367. t.a153 = 788;
  41368. t.a154 = 788;
  41369. t.a155 = 788;
  41370. t.a156 = 788;
  41371. t.a157 = 788;
  41372. t.a158 = 788;
  41373. t.a159 = 788;
  41374. t.a160 = 894;
  41375. t.a161 = 838;
  41376. t.a163 = 1016;
  41377. t.a164 = 458;
  41378. t.a196 = 748;
  41379. t.a165 = 924;
  41380. t.a192 = 748;
  41381. t.a166 = 918;
  41382. t.a167 = 927;
  41383. t.a168 = 928;
  41384. t.a169 = 928;
  41385. t.a170 = 834;
  41386. t.a171 = 873;
  41387. t.a172 = 828;
  41388. t.a173 = 924;
  41389. t.a162 = 924;
  41390. t.a174 = 917;
  41391. t.a175 = 930;
  41392. t.a176 = 931;
  41393. t.a177 = 463;
  41394. t.a178 = 883;
  41395. t.a179 = 836;
  41396. t.a193 = 836;
  41397. t.a180 = 867;
  41398. t.a199 = 867;
  41399. t.a181 = 696;
  41400. t.a200 = 696;
  41401. t.a182 = 874;
  41402. t.a201 = 874;
  41403. t.a183 = 760;
  41404. t.a184 = 946;
  41405. t.a197 = 771;
  41406. t.a185 = 865;
  41407. t.a194 = 771;
  41408. t.a198 = 888;
  41409. t.a186 = 967;
  41410. t.a195 = 888;
  41411. t.a187 = 831;
  41412. t.a188 = 873;
  41413. t.a189 = 927;
  41414. t.a190 = 970;
  41415. t.a191 = 918;
  41416. });
  41417. });
  41418. exports.getMetrics = getMetrics;
  41419. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41420. t.Courier = {
  41421. ascent: 629,
  41422. descent: -157,
  41423. capHeight: 562,
  41424. xHeight: -426
  41425. };
  41426. t["Courier-Bold"] = {
  41427. ascent: 629,
  41428. descent: -157,
  41429. capHeight: 562,
  41430. xHeight: 439
  41431. };
  41432. t["Courier-Oblique"] = {
  41433. ascent: 629,
  41434. descent: -157,
  41435. capHeight: 562,
  41436. xHeight: 426
  41437. };
  41438. t["Courier-BoldOblique"] = {
  41439. ascent: 629,
  41440. descent: -157,
  41441. capHeight: 562,
  41442. xHeight: 426
  41443. };
  41444. t.Helvetica = {
  41445. ascent: 718,
  41446. descent: -207,
  41447. capHeight: 718,
  41448. xHeight: 523
  41449. };
  41450. t["Helvetica-Bold"] = {
  41451. ascent: 718,
  41452. descent: -207,
  41453. capHeight: 718,
  41454. xHeight: 532
  41455. };
  41456. t["Helvetica-Oblique"] = {
  41457. ascent: 718,
  41458. descent: -207,
  41459. capHeight: 718,
  41460. xHeight: 523
  41461. };
  41462. t["Helvetica-BoldOblique"] = {
  41463. ascent: 718,
  41464. descent: -207,
  41465. capHeight: 718,
  41466. xHeight: 532
  41467. };
  41468. t["Times-Roman"] = {
  41469. ascent: 683,
  41470. descent: -217,
  41471. capHeight: 662,
  41472. xHeight: 450
  41473. };
  41474. t["Times-Bold"] = {
  41475. ascent: 683,
  41476. descent: -217,
  41477. capHeight: 676,
  41478. xHeight: 461
  41479. };
  41480. t["Times-Italic"] = {
  41481. ascent: 683,
  41482. descent: -217,
  41483. capHeight: 653,
  41484. xHeight: 441
  41485. };
  41486. t["Times-BoldItalic"] = {
  41487. ascent: 683,
  41488. descent: -217,
  41489. capHeight: 669,
  41490. xHeight: 462
  41491. };
  41492. t.Symbol = {
  41493. ascent: Math.NaN,
  41494. descent: Math.NaN,
  41495. capHeight: Math.NaN,
  41496. xHeight: Math.NaN
  41497. };
  41498. t.ZapfDingbats = {
  41499. ascent: Math.NaN,
  41500. descent: Math.NaN,
  41501. capHeight: Math.NaN,
  41502. xHeight: Math.NaN
  41503. };
  41504. });
  41505. exports.getFontBasicMetrics = getFontBasicMetrics;
  41506. /***/ }),
  41507. /* 46 */
  41508. /***/ ((__unused_webpack_module, exports) => {
  41509. Object.defineProperty(exports, "__esModule", ({
  41510. value: true
  41511. }));
  41512. exports.GlyfTable = void 0;
  41513. const ON_CURVE_POINT = 1 << 0;
  41514. const X_SHORT_VECTOR = 1 << 1;
  41515. const Y_SHORT_VECTOR = 1 << 2;
  41516. const REPEAT_FLAG = 1 << 3;
  41517. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  41518. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  41519. const OVERLAP_SIMPLE = 1 << 6;
  41520. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  41521. const ARGS_ARE_XY_VALUES = 1 << 1;
  41522. const WE_HAVE_A_SCALE = 1 << 3;
  41523. const MORE_COMPONENTS = 1 << 5;
  41524. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  41525. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  41526. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  41527. class GlyfTable {
  41528. constructor({
  41529. glyfTable,
  41530. isGlyphLocationsLong,
  41531. locaTable,
  41532. numGlyphs
  41533. }) {
  41534. this.glyphs = [];
  41535. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  41536. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  41537. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  41538. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  41539. let pos = 0;
  41540. for (let i = 0; i < numGlyphs; i++) {
  41541. pos += offsetSize;
  41542. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  41543. if (next === prev) {
  41544. this.glyphs.push(new Glyph({}));
  41545. continue;
  41546. }
  41547. const glyph = Glyph.parse(prev, glyf);
  41548. this.glyphs.push(glyph);
  41549. prev = next;
  41550. }
  41551. }
  41552. getSize() {
  41553. return this.glyphs.reduce((a, g) => {
  41554. const size = g.getSize();
  41555. return a + (size + 3 & ~3);
  41556. }, 0);
  41557. }
  41558. write() {
  41559. const totalSize = this.getSize();
  41560. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  41561. const isLocationLong = totalSize > 0x1fffe;
  41562. const offsetSize = isLocationLong ? 4 : 2;
  41563. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  41564. if (isLocationLong) {
  41565. locaTable.setUint32(0, 0);
  41566. } else {
  41567. locaTable.setUint16(0, 0);
  41568. }
  41569. let pos = 0;
  41570. let locaIndex = 0;
  41571. for (const glyph of this.glyphs) {
  41572. pos += glyph.write(pos, glyfTable);
  41573. pos = pos + 3 & ~3;
  41574. locaIndex += offsetSize;
  41575. if (isLocationLong) {
  41576. locaTable.setUint32(locaIndex, pos);
  41577. } else {
  41578. locaTable.setUint16(locaIndex, pos >> 1);
  41579. }
  41580. }
  41581. return {
  41582. isLocationLong,
  41583. loca: new Uint8Array(locaTable.buffer),
  41584. glyf: new Uint8Array(glyfTable.buffer)
  41585. };
  41586. }
  41587. scale(factors) {
  41588. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  41589. this.glyphs[i].scale(factors[i]);
  41590. }
  41591. }
  41592. }
  41593. exports.GlyfTable = GlyfTable;
  41594. class Glyph {
  41595. constructor({
  41596. header = null,
  41597. simple = null,
  41598. composites = null
  41599. }) {
  41600. this.header = header;
  41601. this.simple = simple;
  41602. this.composites = composites;
  41603. }
  41604. static parse(pos, glyf) {
  41605. const [read, header] = GlyphHeader.parse(pos, glyf);
  41606. pos += read;
  41607. if (header.numberOfContours < 0) {
  41608. const composites = [];
  41609. while (true) {
  41610. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  41611. pos += n;
  41612. composites.push(composite);
  41613. if (!(composite.flags & MORE_COMPONENTS)) {
  41614. break;
  41615. }
  41616. }
  41617. return new Glyph({
  41618. header,
  41619. composites
  41620. });
  41621. }
  41622. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  41623. return new Glyph({
  41624. header,
  41625. simple
  41626. });
  41627. }
  41628. getSize() {
  41629. if (!this.header) {
  41630. return 0;
  41631. }
  41632. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  41633. return this.header.getSize() + size;
  41634. }
  41635. write(pos, buf) {
  41636. if (!this.header) {
  41637. return 0;
  41638. }
  41639. const spos = pos;
  41640. pos += this.header.write(pos, buf);
  41641. if (this.simple) {
  41642. pos += this.simple.write(pos, buf);
  41643. } else {
  41644. for (const composite of this.composites) {
  41645. pos += composite.write(pos, buf);
  41646. }
  41647. }
  41648. return pos - spos;
  41649. }
  41650. scale(factor) {
  41651. if (!this.header) {
  41652. return;
  41653. }
  41654. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  41655. this.header.scale(xMiddle, factor);
  41656. if (this.simple) {
  41657. this.simple.scale(xMiddle, factor);
  41658. } else {
  41659. for (const composite of this.composites) {
  41660. composite.scale(xMiddle, factor);
  41661. }
  41662. }
  41663. }
  41664. }
  41665. class GlyphHeader {
  41666. constructor({
  41667. numberOfContours,
  41668. xMin,
  41669. yMin,
  41670. xMax,
  41671. yMax
  41672. }) {
  41673. this.numberOfContours = numberOfContours;
  41674. this.xMin = xMin;
  41675. this.yMin = yMin;
  41676. this.xMax = xMax;
  41677. this.yMax = yMax;
  41678. }
  41679. static parse(pos, glyf) {
  41680. return [10, new GlyphHeader({
  41681. numberOfContours: glyf.getInt16(pos),
  41682. xMin: glyf.getInt16(pos + 2),
  41683. yMin: glyf.getInt16(pos + 4),
  41684. xMax: glyf.getInt16(pos + 6),
  41685. yMax: glyf.getInt16(pos + 8)
  41686. })];
  41687. }
  41688. getSize() {
  41689. return 10;
  41690. }
  41691. write(pos, buf) {
  41692. buf.setInt16(pos, this.numberOfContours);
  41693. buf.setInt16(pos + 2, this.xMin);
  41694. buf.setInt16(pos + 4, this.yMin);
  41695. buf.setInt16(pos + 6, this.xMax);
  41696. buf.setInt16(pos + 8, this.yMax);
  41697. return 10;
  41698. }
  41699. scale(x, factor) {
  41700. this.xMin = Math.round(x + (this.xMin - x) * factor);
  41701. this.xMax = Math.round(x + (this.xMax - x) * factor);
  41702. }
  41703. }
  41704. class Contour {
  41705. constructor({
  41706. flags,
  41707. xCoordinates,
  41708. yCoordinates
  41709. }) {
  41710. this.xCoordinates = xCoordinates;
  41711. this.yCoordinates = yCoordinates;
  41712. this.flags = flags;
  41713. }
  41714. }
  41715. class SimpleGlyph {
  41716. constructor({
  41717. contours,
  41718. instructions
  41719. }) {
  41720. this.contours = contours;
  41721. this.instructions = instructions;
  41722. }
  41723. static parse(pos, glyf, numberOfContours) {
  41724. const endPtsOfContours = [];
  41725. for (let i = 0; i < numberOfContours; i++) {
  41726. const endPt = glyf.getUint16(pos);
  41727. pos += 2;
  41728. endPtsOfContours.push(endPt);
  41729. }
  41730. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  41731. const instructionLength = glyf.getUint16(pos);
  41732. pos += 2;
  41733. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41734. pos += instructionLength;
  41735. const flags = [];
  41736. for (let i = 0; i < numberOfPt; pos++, i++) {
  41737. let flag = glyf.getUint8(pos);
  41738. flags.push(flag);
  41739. if (flag & REPEAT_FLAG) {
  41740. const count = glyf.getUint8(++pos);
  41741. flag ^= REPEAT_FLAG;
  41742. for (let m = 0; m < count; m++) {
  41743. flags.push(flag);
  41744. }
  41745. i += count;
  41746. }
  41747. }
  41748. const allXCoordinates = [];
  41749. let xCoordinates = [];
  41750. let yCoordinates = [];
  41751. let pointFlags = [];
  41752. const contours = [];
  41753. let endPtsOfContoursIndex = 0;
  41754. let lastCoordinate = 0;
  41755. for (let i = 0; i < numberOfPt; i++) {
  41756. const flag = flags[i];
  41757. if (flag & X_SHORT_VECTOR) {
  41758. const x = glyf.getUint8(pos++);
  41759. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  41760. xCoordinates.push(lastCoordinate);
  41761. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  41762. xCoordinates.push(lastCoordinate);
  41763. } else {
  41764. lastCoordinate += glyf.getInt16(pos);
  41765. pos += 2;
  41766. xCoordinates.push(lastCoordinate);
  41767. }
  41768. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41769. endPtsOfContoursIndex++;
  41770. allXCoordinates.push(xCoordinates);
  41771. xCoordinates = [];
  41772. }
  41773. }
  41774. lastCoordinate = 0;
  41775. endPtsOfContoursIndex = 0;
  41776. for (let i = 0; i < numberOfPt; i++) {
  41777. const flag = flags[i];
  41778. if (flag & Y_SHORT_VECTOR) {
  41779. const y = glyf.getUint8(pos++);
  41780. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  41781. yCoordinates.push(lastCoordinate);
  41782. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  41783. yCoordinates.push(lastCoordinate);
  41784. } else {
  41785. lastCoordinate += glyf.getInt16(pos);
  41786. pos += 2;
  41787. yCoordinates.push(lastCoordinate);
  41788. }
  41789. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  41790. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41791. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  41792. endPtsOfContoursIndex++;
  41793. contours.push(new Contour({
  41794. flags: pointFlags,
  41795. xCoordinates,
  41796. yCoordinates
  41797. }));
  41798. yCoordinates = [];
  41799. pointFlags = [];
  41800. }
  41801. }
  41802. return new SimpleGlyph({
  41803. contours,
  41804. instructions
  41805. });
  41806. }
  41807. getSize() {
  41808. let size = this.contours.length * 2 + 2 + this.instructions.length;
  41809. let lastX = 0;
  41810. let lastY = 0;
  41811. for (const contour of this.contours) {
  41812. size += contour.flags.length;
  41813. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41814. const x = contour.xCoordinates[i];
  41815. const y = contour.yCoordinates[i];
  41816. let abs = Math.abs(x - lastX);
  41817. if (abs > 255) {
  41818. size += 2;
  41819. } else if (abs > 0) {
  41820. size += 1;
  41821. }
  41822. lastX = x;
  41823. abs = Math.abs(y - lastY);
  41824. if (abs > 255) {
  41825. size += 2;
  41826. } else if (abs > 0) {
  41827. size += 1;
  41828. }
  41829. lastY = y;
  41830. }
  41831. }
  41832. return size;
  41833. }
  41834. write(pos, buf) {
  41835. const spos = pos;
  41836. const xCoordinates = [];
  41837. const yCoordinates = [];
  41838. const flags = [];
  41839. let lastX = 0;
  41840. let lastY = 0;
  41841. for (const contour of this.contours) {
  41842. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41843. let flag = contour.flags[i];
  41844. const x = contour.xCoordinates[i];
  41845. let delta = x - lastX;
  41846. if (delta === 0) {
  41847. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  41848. xCoordinates.push(0);
  41849. } else {
  41850. const abs = Math.abs(delta);
  41851. if (abs <= 255) {
  41852. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  41853. xCoordinates.push(abs);
  41854. } else {
  41855. xCoordinates.push(delta);
  41856. }
  41857. }
  41858. lastX = x;
  41859. const y = contour.yCoordinates[i];
  41860. delta = y - lastY;
  41861. if (delta === 0) {
  41862. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  41863. yCoordinates.push(0);
  41864. } else {
  41865. const abs = Math.abs(delta);
  41866. if (abs <= 255) {
  41867. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  41868. yCoordinates.push(abs);
  41869. } else {
  41870. yCoordinates.push(delta);
  41871. }
  41872. }
  41873. lastY = y;
  41874. flags.push(flag);
  41875. }
  41876. buf.setUint16(pos, xCoordinates.length - 1);
  41877. pos += 2;
  41878. }
  41879. buf.setUint16(pos, this.instructions.length);
  41880. pos += 2;
  41881. if (this.instructions.length) {
  41882. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  41883. pos += this.instructions.length;
  41884. }
  41885. for (const flag of flags) {
  41886. buf.setUint8(pos++, flag);
  41887. }
  41888. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  41889. const x = xCoordinates[i];
  41890. const flag = flags[i];
  41891. if (flag & X_SHORT_VECTOR) {
  41892. buf.setUint8(pos++, x);
  41893. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  41894. buf.setInt16(pos, x);
  41895. pos += 2;
  41896. }
  41897. }
  41898. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  41899. const y = yCoordinates[i];
  41900. const flag = flags[i];
  41901. if (flag & Y_SHORT_VECTOR) {
  41902. buf.setUint8(pos++, y);
  41903. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  41904. buf.setInt16(pos, y);
  41905. pos += 2;
  41906. }
  41907. }
  41908. return pos - spos;
  41909. }
  41910. scale(x, factor) {
  41911. for (const contour of this.contours) {
  41912. if (contour.xCoordinates.length === 0) {
  41913. continue;
  41914. }
  41915. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41916. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  41917. }
  41918. }
  41919. }
  41920. }
  41921. class CompositeGlyph {
  41922. constructor({
  41923. flags,
  41924. glyphIndex,
  41925. argument1,
  41926. argument2,
  41927. transf,
  41928. instructions
  41929. }) {
  41930. this.flags = flags;
  41931. this.glyphIndex = glyphIndex;
  41932. this.argument1 = argument1;
  41933. this.argument2 = argument2;
  41934. this.transf = transf;
  41935. this.instructions = instructions;
  41936. }
  41937. static parse(pos, glyf) {
  41938. const spos = pos;
  41939. const transf = [];
  41940. let flags = glyf.getUint16(pos);
  41941. const glyphIndex = glyf.getUint16(pos + 2);
  41942. pos += 4;
  41943. let argument1, argument2;
  41944. if (flags & ARG_1_AND_2_ARE_WORDS) {
  41945. if (flags & ARGS_ARE_XY_VALUES) {
  41946. argument1 = glyf.getInt16(pos);
  41947. argument2 = glyf.getInt16(pos + 2);
  41948. } else {
  41949. argument1 = glyf.getUint16(pos);
  41950. argument2 = glyf.getUint16(pos + 2);
  41951. }
  41952. pos += 4;
  41953. flags ^= ARG_1_AND_2_ARE_WORDS;
  41954. } else {
  41955. if (flags & ARGS_ARE_XY_VALUES) {
  41956. argument1 = glyf.getInt8(pos);
  41957. argument2 = glyf.getInt8(pos + 1);
  41958. } else {
  41959. argument1 = glyf.getUint8(pos);
  41960. argument2 = glyf.getUint8(pos + 1);
  41961. }
  41962. pos += 2;
  41963. }
  41964. if (flags & WE_HAVE_A_SCALE) {
  41965. transf.push(glyf.getUint16(pos));
  41966. pos += 2;
  41967. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  41968. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  41969. pos += 4;
  41970. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  41971. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  41972. pos += 8;
  41973. }
  41974. let instructions = null;
  41975. if (flags & WE_HAVE_INSTRUCTIONS) {
  41976. const instructionLength = glyf.getUint16(pos);
  41977. pos += 2;
  41978. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41979. pos += instructionLength;
  41980. }
  41981. return [pos - spos, new CompositeGlyph({
  41982. flags,
  41983. glyphIndex,
  41984. argument1,
  41985. argument2,
  41986. transf,
  41987. instructions
  41988. })];
  41989. }
  41990. getSize() {
  41991. let size = 2 + 2 + this.transf.length * 2;
  41992. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  41993. size += 2 + this.instructions.length;
  41994. }
  41995. size += 2;
  41996. if (this.flags & 2) {
  41997. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  41998. size += 2;
  41999. }
  42000. } else {
  42001. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42002. size += 2;
  42003. }
  42004. }
  42005. return size;
  42006. }
  42007. write(pos, buf) {
  42008. const spos = pos;
  42009. if (this.flags & ARGS_ARE_XY_VALUES) {
  42010. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  42011. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42012. }
  42013. } else {
  42014. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  42015. this.flags |= ARG_1_AND_2_ARE_WORDS;
  42016. }
  42017. }
  42018. buf.setUint16(pos, this.flags);
  42019. buf.setUint16(pos + 2, this.glyphIndex);
  42020. pos += 4;
  42021. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  42022. if (this.flags & ARGS_ARE_XY_VALUES) {
  42023. buf.setInt16(pos, this.argument1);
  42024. buf.setInt16(pos + 2, this.argument2);
  42025. } else {
  42026. buf.setUint16(pos, this.argument1);
  42027. buf.setUint16(pos + 2, this.argument2);
  42028. }
  42029. pos += 4;
  42030. } else {
  42031. buf.setUint8(pos, this.argument1);
  42032. buf.setUint8(pos + 1, this.argument2);
  42033. pos += 2;
  42034. }
  42035. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  42036. buf.setUint16(pos, this.instructions.length);
  42037. pos += 2;
  42038. if (this.instructions.length) {
  42039. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  42040. pos += this.instructions.length;
  42041. }
  42042. }
  42043. return pos - spos;
  42044. }
  42045. scale(x, factor) {}
  42046. }
  42047. /***/ }),
  42048. /* 47 */
  42049. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42050. Object.defineProperty(exports, "__esModule", ({
  42051. value: true
  42052. }));
  42053. exports.OpenTypeFileBuilder = void 0;
  42054. var _core_utils = __w_pdfjs_require__(6);
  42055. var _util = __w_pdfjs_require__(2);
  42056. function writeInt16(dest, offset, num) {
  42057. dest[offset] = num >> 8 & 0xff;
  42058. dest[offset + 1] = num & 0xff;
  42059. }
  42060. function writeInt32(dest, offset, num) {
  42061. dest[offset] = num >> 24 & 0xff;
  42062. dest[offset + 1] = num >> 16 & 0xff;
  42063. dest[offset + 2] = num >> 8 & 0xff;
  42064. dest[offset + 3] = num & 0xff;
  42065. }
  42066. function writeData(dest, offset, data) {
  42067. if (data instanceof Uint8Array) {
  42068. dest.set(data, offset);
  42069. } else if (typeof data === "string") {
  42070. for (let i = 0, ii = data.length; i < ii; i++) {
  42071. dest[offset++] = data.charCodeAt(i) & 0xff;
  42072. }
  42073. } else {
  42074. for (let i = 0, ii = data.length; i < ii; i++) {
  42075. dest[offset++] = data[i] & 0xff;
  42076. }
  42077. }
  42078. }
  42079. const OTF_HEADER_SIZE = 12;
  42080. const OTF_TABLE_ENTRY_SIZE = 16;
  42081. class OpenTypeFileBuilder {
  42082. constructor(sfnt) {
  42083. this.sfnt = sfnt;
  42084. this.tables = Object.create(null);
  42085. }
  42086. static getSearchParams(entriesCount, entrySize) {
  42087. let maxPower2 = 1,
  42088. log2 = 0;
  42089. while ((maxPower2 ^ entriesCount) > maxPower2) {
  42090. maxPower2 <<= 1;
  42091. log2++;
  42092. }
  42093. const searchRange = maxPower2 * entrySize;
  42094. return {
  42095. range: searchRange,
  42096. entry: log2,
  42097. rangeShift: entrySize * entriesCount - searchRange
  42098. };
  42099. }
  42100. toArray() {
  42101. let sfnt = this.sfnt;
  42102. const tables = this.tables;
  42103. const tablesNames = Object.keys(tables);
  42104. tablesNames.sort();
  42105. const numTables = tablesNames.length;
  42106. let i, j, jj, table, tableName;
  42107. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  42108. const tableOffsets = [offset];
  42109. for (i = 0; i < numTables; i++) {
  42110. table = tables[tablesNames[i]];
  42111. const paddedLength = (table.length + 3 & ~3) >>> 0;
  42112. offset += paddedLength;
  42113. tableOffsets.push(offset);
  42114. }
  42115. const file = new Uint8Array(offset);
  42116. for (i = 0; i < numTables; i++) {
  42117. table = tables[tablesNames[i]];
  42118. writeData(file, tableOffsets[i], table);
  42119. }
  42120. if (sfnt === "true") {
  42121. sfnt = (0, _util.string32)(0x00010000);
  42122. }
  42123. file[0] = sfnt.charCodeAt(0) & 0xff;
  42124. file[1] = sfnt.charCodeAt(1) & 0xff;
  42125. file[2] = sfnt.charCodeAt(2) & 0xff;
  42126. file[3] = sfnt.charCodeAt(3) & 0xff;
  42127. writeInt16(file, 4, numTables);
  42128. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  42129. writeInt16(file, 6, searchParams.range);
  42130. writeInt16(file, 8, searchParams.entry);
  42131. writeInt16(file, 10, searchParams.rangeShift);
  42132. offset = OTF_HEADER_SIZE;
  42133. for (i = 0; i < numTables; i++) {
  42134. tableName = tablesNames[i];
  42135. file[offset] = tableName.charCodeAt(0) & 0xff;
  42136. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  42137. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  42138. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  42139. let checksum = 0;
  42140. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  42141. const quad = (0, _core_utils.readUint32)(file, j);
  42142. checksum = checksum + quad >>> 0;
  42143. }
  42144. writeInt32(file, offset + 4, checksum);
  42145. writeInt32(file, offset + 8, tableOffsets[i]);
  42146. writeInt32(file, offset + 12, tables[tableName].length);
  42147. offset += OTF_TABLE_ENTRY_SIZE;
  42148. }
  42149. return file;
  42150. }
  42151. addTable(tag, data) {
  42152. if (tag in this.tables) {
  42153. throw new Error("Table " + tag + " already exists");
  42154. }
  42155. this.tables[tag] = data;
  42156. }
  42157. }
  42158. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  42159. /***/ }),
  42160. /* 48 */
  42161. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42162. Object.defineProperty(exports, "__esModule", ({
  42163. value: true
  42164. }));
  42165. exports.Type1Font = void 0;
  42166. var _cff_parser = __w_pdfjs_require__(35);
  42167. var _fonts_utils = __w_pdfjs_require__(38);
  42168. var _core_utils = __w_pdfjs_require__(6);
  42169. var _stream = __w_pdfjs_require__(10);
  42170. var _type1_parser = __w_pdfjs_require__(49);
  42171. var _util = __w_pdfjs_require__(2);
  42172. function findBlock(streamBytes, signature, startIndex) {
  42173. const streamBytesLength = streamBytes.length;
  42174. const signatureLength = signature.length;
  42175. const scanLength = streamBytesLength - signatureLength;
  42176. let i = startIndex,
  42177. found = false;
  42178. while (i < scanLength) {
  42179. let j = 0;
  42180. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42181. j++;
  42182. }
  42183. if (j >= signatureLength) {
  42184. i += j;
  42185. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  42186. i++;
  42187. }
  42188. found = true;
  42189. break;
  42190. }
  42191. i++;
  42192. }
  42193. return {
  42194. found,
  42195. length: i
  42196. };
  42197. }
  42198. function getHeaderBlock(stream, suggestedLength) {
  42199. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  42200. const streamStartPos = stream.pos;
  42201. let headerBytes, headerBytesLength, block;
  42202. try {
  42203. headerBytes = stream.getBytes(suggestedLength);
  42204. headerBytesLength = headerBytes.length;
  42205. } catch (ex) {}
  42206. if (headerBytesLength === suggestedLength) {
  42207. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42208. if (block.found && block.length === suggestedLength) {
  42209. return {
  42210. stream: new _stream.Stream(headerBytes),
  42211. length: suggestedLength
  42212. };
  42213. }
  42214. }
  42215. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  42216. stream.pos = streamStartPos;
  42217. const SCAN_BLOCK_LENGTH = 2048;
  42218. let actualLength;
  42219. while (true) {
  42220. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42221. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42222. if (block.length === 0) {
  42223. break;
  42224. }
  42225. stream.pos += block.length;
  42226. if (block.found) {
  42227. actualLength = stream.pos - streamStartPos;
  42228. break;
  42229. }
  42230. }
  42231. stream.pos = streamStartPos;
  42232. if (actualLength) {
  42233. return {
  42234. stream: new _stream.Stream(stream.getBytes(actualLength)),
  42235. length: actualLength
  42236. };
  42237. }
  42238. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  42239. return {
  42240. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  42241. length: suggestedLength
  42242. };
  42243. }
  42244. function getEexecBlock(stream, suggestedLength) {
  42245. const eexecBytes = stream.getBytes();
  42246. return {
  42247. stream: new _stream.Stream(eexecBytes),
  42248. length: eexecBytes.length
  42249. };
  42250. }
  42251. class Type1Font {
  42252. constructor(name, file, properties) {
  42253. const PFB_HEADER_SIZE = 6;
  42254. let headerBlockLength = properties.length1;
  42255. let eexecBlockLength = properties.length2;
  42256. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42257. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42258. if (pfbHeaderPresent) {
  42259. file.skip(PFB_HEADER_SIZE);
  42260. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42261. }
  42262. const headerBlock = getHeaderBlock(file, headerBlockLength);
  42263. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42264. headerBlockParser.extractFontHeader(properties);
  42265. if (pfbHeaderPresent) {
  42266. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42267. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42268. }
  42269. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  42270. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  42271. const data = eexecBlockParser.extractFontProgram(properties);
  42272. for (const key in data.properties) {
  42273. properties[key] = data.properties[key];
  42274. }
  42275. const charstrings = data.charstrings;
  42276. const type2Charstrings = this.getType2Charstrings(charstrings);
  42277. const subrs = this.getType2Subrs(data.subrs);
  42278. this.charstrings = charstrings;
  42279. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42280. this.seacs = this.getSeacs(data.charstrings);
  42281. }
  42282. get numGlyphs() {
  42283. return this.charstrings.length + 1;
  42284. }
  42285. getCharset() {
  42286. const charset = [".notdef"];
  42287. for (const {
  42288. glyphName
  42289. } of this.charstrings) {
  42290. charset.push(glyphName);
  42291. }
  42292. return charset;
  42293. }
  42294. getGlyphMapping(properties) {
  42295. const charstrings = this.charstrings;
  42296. if (properties.composite) {
  42297. const charCodeToGlyphId = Object.create(null);
  42298. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  42299. const charCode = properties.cMap.charCodeOf(glyphId);
  42300. charCodeToGlyphId[charCode] = glyphId + 1;
  42301. }
  42302. return charCodeToGlyphId;
  42303. }
  42304. const glyphNames = [".notdef"];
  42305. let builtInEncoding, glyphId;
  42306. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42307. glyphNames.push(charstrings[glyphId].glyphName);
  42308. }
  42309. const encoding = properties.builtInEncoding;
  42310. if (encoding) {
  42311. builtInEncoding = Object.create(null);
  42312. for (const charCode in encoding) {
  42313. glyphId = glyphNames.indexOf(encoding[charCode]);
  42314. if (glyphId >= 0) {
  42315. builtInEncoding[charCode] = glyphId;
  42316. }
  42317. }
  42318. }
  42319. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  42320. }
  42321. hasGlyphId(id) {
  42322. if (id < 0 || id >= this.numGlyphs) {
  42323. return false;
  42324. }
  42325. if (id === 0) {
  42326. return true;
  42327. }
  42328. const glyph = this.charstrings[id - 1];
  42329. return glyph.charstring.length > 0;
  42330. }
  42331. getSeacs(charstrings) {
  42332. const seacMap = [];
  42333. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  42334. const charstring = charstrings[i];
  42335. if (charstring.seac) {
  42336. seacMap[i + 1] = charstring.seac;
  42337. }
  42338. }
  42339. return seacMap;
  42340. }
  42341. getType2Charstrings(type1Charstrings) {
  42342. const type2Charstrings = [];
  42343. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  42344. type2Charstrings.push(type1Charstrings[i].charstring);
  42345. }
  42346. return type2Charstrings;
  42347. }
  42348. getType2Subrs(type1Subrs) {
  42349. let bias = 0;
  42350. const count = type1Subrs.length;
  42351. if (count < 1133) {
  42352. bias = 107;
  42353. } else if (count < 33769) {
  42354. bias = 1131;
  42355. } else {
  42356. bias = 32768;
  42357. }
  42358. const type2Subrs = [];
  42359. let i;
  42360. for (i = 0; i < bias; i++) {
  42361. type2Subrs.push([0x0b]);
  42362. }
  42363. for (i = 0; i < count; i++) {
  42364. type2Subrs.push(type1Subrs[i]);
  42365. }
  42366. return type2Subrs;
  42367. }
  42368. wrap(name, glyphs, charstrings, subrs, properties) {
  42369. const cff = new _cff_parser.CFF();
  42370. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  42371. cff.names = [name];
  42372. const topDict = new _cff_parser.CFFTopDict();
  42373. topDict.setByName("version", 391);
  42374. topDict.setByName("Notice", 392);
  42375. topDict.setByName("FullName", 393);
  42376. topDict.setByName("FamilyName", 394);
  42377. topDict.setByName("Weight", 395);
  42378. topDict.setByName("Encoding", null);
  42379. topDict.setByName("FontMatrix", properties.fontMatrix);
  42380. topDict.setByName("FontBBox", properties.bbox);
  42381. topDict.setByName("charset", null);
  42382. topDict.setByName("CharStrings", null);
  42383. topDict.setByName("Private", null);
  42384. cff.topDict = topDict;
  42385. const strings = new _cff_parser.CFFStrings();
  42386. strings.add("Version 0.11");
  42387. strings.add("See original notice");
  42388. strings.add(name);
  42389. strings.add(name);
  42390. strings.add("Medium");
  42391. cff.strings = strings;
  42392. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  42393. const count = glyphs.length;
  42394. const charsetArray = [".notdef"];
  42395. let i, ii;
  42396. for (i = 0; i < count; i++) {
  42397. const glyphName = charstrings[i].glyphName;
  42398. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  42399. if (index === -1) {
  42400. strings.add(glyphName);
  42401. }
  42402. charsetArray.push(glyphName);
  42403. }
  42404. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  42405. const charStringsIndex = new _cff_parser.CFFIndex();
  42406. charStringsIndex.add([0x8b, 0x0e]);
  42407. for (i = 0; i < count; i++) {
  42408. charStringsIndex.add(glyphs[i]);
  42409. }
  42410. cff.charStrings = charStringsIndex;
  42411. const privateDict = new _cff_parser.CFFPrivateDict();
  42412. privateDict.setByName("Subrs", null);
  42413. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  42414. for (i = 0, ii = fields.length; i < ii; i++) {
  42415. const field = fields[i];
  42416. if (!(field in properties.privateData)) {
  42417. continue;
  42418. }
  42419. const value = properties.privateData[field];
  42420. if (Array.isArray(value)) {
  42421. for (let j = value.length - 1; j > 0; j--) {
  42422. value[j] -= value[j - 1];
  42423. }
  42424. }
  42425. privateDict.setByName(field, value);
  42426. }
  42427. cff.topDict.privateDict = privateDict;
  42428. const subrIndex = new _cff_parser.CFFIndex();
  42429. for (i = 0, ii = subrs.length; i < ii; i++) {
  42430. subrIndex.add(subrs[i]);
  42431. }
  42432. privateDict.subrsIndex = subrIndex;
  42433. const compiler = new _cff_parser.CFFCompiler(cff);
  42434. return compiler.compile();
  42435. }
  42436. }
  42437. exports.Type1Font = Type1Font;
  42438. /***/ }),
  42439. /* 49 */
  42440. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42441. Object.defineProperty(exports, "__esModule", ({
  42442. value: true
  42443. }));
  42444. exports.Type1Parser = void 0;
  42445. var _encodings = __w_pdfjs_require__(37);
  42446. var _core_utils = __w_pdfjs_require__(6);
  42447. var _stream = __w_pdfjs_require__(10);
  42448. var _util = __w_pdfjs_require__(2);
  42449. const HINTING_ENABLED = false;
  42450. const COMMAND_MAP = {
  42451. hstem: [1],
  42452. vstem: [3],
  42453. vmoveto: [4],
  42454. rlineto: [5],
  42455. hlineto: [6],
  42456. vlineto: [7],
  42457. rrcurveto: [8],
  42458. callsubr: [10],
  42459. flex: [12, 35],
  42460. drop: [12, 18],
  42461. endchar: [14],
  42462. rmoveto: [21],
  42463. hmoveto: [22],
  42464. vhcurveto: [30],
  42465. hvcurveto: [31]
  42466. };
  42467. class Type1CharString {
  42468. constructor() {
  42469. this.width = 0;
  42470. this.lsb = 0;
  42471. this.flexing = false;
  42472. this.output = [];
  42473. this.stack = [];
  42474. }
  42475. convert(encoded, subrs, seacAnalysisEnabled) {
  42476. const count = encoded.length;
  42477. let error = false;
  42478. let wx, sbx, subrNumber;
  42479. for (let i = 0; i < count; i++) {
  42480. let value = encoded[i];
  42481. if (value < 32) {
  42482. if (value === 12) {
  42483. value = (value << 8) + encoded[++i];
  42484. }
  42485. switch (value) {
  42486. case 1:
  42487. if (!HINTING_ENABLED) {
  42488. this.stack = [];
  42489. break;
  42490. }
  42491. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42492. break;
  42493. case 3:
  42494. if (!HINTING_ENABLED) {
  42495. this.stack = [];
  42496. break;
  42497. }
  42498. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42499. break;
  42500. case 4:
  42501. if (this.flexing) {
  42502. if (this.stack.length < 1) {
  42503. error = true;
  42504. break;
  42505. }
  42506. const dy = this.stack.pop();
  42507. this.stack.push(0, dy);
  42508. break;
  42509. }
  42510. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  42511. break;
  42512. case 5:
  42513. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  42514. break;
  42515. case 6:
  42516. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  42517. break;
  42518. case 7:
  42519. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  42520. break;
  42521. case 8:
  42522. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  42523. break;
  42524. case 9:
  42525. this.stack = [];
  42526. break;
  42527. case 10:
  42528. if (this.stack.length < 1) {
  42529. error = true;
  42530. break;
  42531. }
  42532. subrNumber = this.stack.pop();
  42533. if (!subrs[subrNumber]) {
  42534. error = true;
  42535. break;
  42536. }
  42537. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  42538. break;
  42539. case 11:
  42540. return error;
  42541. case 13:
  42542. if (this.stack.length < 2) {
  42543. error = true;
  42544. break;
  42545. }
  42546. wx = this.stack.pop();
  42547. sbx = this.stack.pop();
  42548. this.lsb = sbx;
  42549. this.width = wx;
  42550. this.stack.push(wx, sbx);
  42551. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  42552. break;
  42553. case 14:
  42554. this.output.push(COMMAND_MAP.endchar[0]);
  42555. break;
  42556. case 21:
  42557. if (this.flexing) {
  42558. break;
  42559. }
  42560. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  42561. break;
  42562. case 22:
  42563. if (this.flexing) {
  42564. this.stack.push(0);
  42565. break;
  42566. }
  42567. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  42568. break;
  42569. case 30:
  42570. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  42571. break;
  42572. case 31:
  42573. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  42574. break;
  42575. case (12 << 8) + 0:
  42576. this.stack = [];
  42577. break;
  42578. case (12 << 8) + 1:
  42579. if (!HINTING_ENABLED) {
  42580. this.stack = [];
  42581. break;
  42582. }
  42583. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42584. break;
  42585. case (12 << 8) + 2:
  42586. if (!HINTING_ENABLED) {
  42587. this.stack = [];
  42588. break;
  42589. }
  42590. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42591. break;
  42592. case (12 << 8) + 6:
  42593. if (seacAnalysisEnabled) {
  42594. const asb = this.stack.at(-5);
  42595. this.seac = this.stack.splice(-4, 4);
  42596. this.seac[0] += this.lsb - asb;
  42597. error = this.executeCommand(0, COMMAND_MAP.endchar);
  42598. } else {
  42599. error = this.executeCommand(4, COMMAND_MAP.endchar);
  42600. }
  42601. break;
  42602. case (12 << 8) + 7:
  42603. if (this.stack.length < 4) {
  42604. error = true;
  42605. break;
  42606. }
  42607. this.stack.pop();
  42608. wx = this.stack.pop();
  42609. const sby = this.stack.pop();
  42610. sbx = this.stack.pop();
  42611. this.lsb = sbx;
  42612. this.width = wx;
  42613. this.stack.push(wx, sbx, sby);
  42614. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  42615. break;
  42616. case (12 << 8) + 12:
  42617. if (this.stack.length < 2) {
  42618. error = true;
  42619. break;
  42620. }
  42621. const num2 = this.stack.pop();
  42622. const num1 = this.stack.pop();
  42623. this.stack.push(num1 / num2);
  42624. break;
  42625. case (12 << 8) + 16:
  42626. if (this.stack.length < 2) {
  42627. error = true;
  42628. break;
  42629. }
  42630. subrNumber = this.stack.pop();
  42631. const numArgs = this.stack.pop();
  42632. if (subrNumber === 0 && numArgs === 3) {
  42633. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  42634. 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]);
  42635. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  42636. this.flexing = false;
  42637. this.stack.push(flexArgs[15], flexArgs[16]);
  42638. } else if (subrNumber === 1 && numArgs === 0) {
  42639. this.flexing = true;
  42640. }
  42641. break;
  42642. case (12 << 8) + 17:
  42643. break;
  42644. case (12 << 8) + 33:
  42645. this.stack = [];
  42646. break;
  42647. default:
  42648. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  42649. break;
  42650. }
  42651. if (error) {
  42652. break;
  42653. }
  42654. continue;
  42655. } else if (value <= 246) {
  42656. value -= 139;
  42657. } else if (value <= 250) {
  42658. value = (value - 247) * 256 + encoded[++i] + 108;
  42659. } else if (value <= 254) {
  42660. value = -((value - 251) * 256) - encoded[++i] - 108;
  42661. } else {
  42662. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  42663. }
  42664. this.stack.push(value);
  42665. }
  42666. return error;
  42667. }
  42668. executeCommand(howManyArgs, command, keepStack) {
  42669. const stackLength = this.stack.length;
  42670. if (howManyArgs > stackLength) {
  42671. return true;
  42672. }
  42673. const start = stackLength - howManyArgs;
  42674. for (let i = start; i < stackLength; i++) {
  42675. let value = this.stack[i];
  42676. if (Number.isInteger(value)) {
  42677. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  42678. } else {
  42679. value = 65536 * value | 0;
  42680. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  42681. }
  42682. }
  42683. this.output.push(...command);
  42684. if (keepStack) {
  42685. this.stack.splice(start, howManyArgs);
  42686. } else {
  42687. this.stack.length = 0;
  42688. }
  42689. return false;
  42690. }
  42691. }
  42692. const EEXEC_ENCRYPT_KEY = 55665;
  42693. const CHAR_STRS_ENCRYPT_KEY = 4330;
  42694. function isHexDigit(code) {
  42695. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  42696. }
  42697. function decrypt(data, key, discardNumber) {
  42698. if (discardNumber >= data.length) {
  42699. return new Uint8Array(0);
  42700. }
  42701. const c1 = 52845,
  42702. c2 = 22719;
  42703. let r = key | 0,
  42704. i,
  42705. j;
  42706. for (i = 0; i < discardNumber; i++) {
  42707. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  42708. }
  42709. const count = data.length - discardNumber;
  42710. const decrypted = new Uint8Array(count);
  42711. for (i = discardNumber, j = 0; j < count; i++, j++) {
  42712. const value = data[i];
  42713. decrypted[j] = value ^ r >> 8;
  42714. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42715. }
  42716. return decrypted;
  42717. }
  42718. function decryptAscii(data, key, discardNumber) {
  42719. const c1 = 52845,
  42720. c2 = 22719;
  42721. let r = key | 0;
  42722. const count = data.length,
  42723. maybeLength = count >>> 1;
  42724. const decrypted = new Uint8Array(maybeLength);
  42725. let i, j;
  42726. for (i = 0, j = 0; i < count; i++) {
  42727. const digit1 = data[i];
  42728. if (!isHexDigit(digit1)) {
  42729. continue;
  42730. }
  42731. i++;
  42732. let digit2;
  42733. while (i < count && !isHexDigit(digit2 = data[i])) {
  42734. i++;
  42735. }
  42736. if (i < count) {
  42737. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  42738. decrypted[j++] = value ^ r >> 8;
  42739. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42740. }
  42741. }
  42742. return decrypted.slice(discardNumber, j);
  42743. }
  42744. function isSpecial(c) {
  42745. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  42746. }
  42747. class Type1Parser {
  42748. constructor(stream, encrypted, seacAnalysisEnabled) {
  42749. if (encrypted) {
  42750. const data = stream.getBytes();
  42751. 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]));
  42752. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  42753. }
  42754. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  42755. this.stream = stream;
  42756. this.nextChar();
  42757. }
  42758. readNumberArray() {
  42759. this.getToken();
  42760. const array = [];
  42761. while (true) {
  42762. const token = this.getToken();
  42763. if (token === null || token === "]" || token === "}") {
  42764. break;
  42765. }
  42766. array.push(parseFloat(token || 0));
  42767. }
  42768. return array;
  42769. }
  42770. readNumber() {
  42771. const token = this.getToken();
  42772. return parseFloat(token || 0);
  42773. }
  42774. readInt() {
  42775. const token = this.getToken();
  42776. return parseInt(token || 0, 10) | 0;
  42777. }
  42778. readBoolean() {
  42779. const token = this.getToken();
  42780. return token === "true" ? 1 : 0;
  42781. }
  42782. nextChar() {
  42783. return this.currentChar = this.stream.getByte();
  42784. }
  42785. prevChar() {
  42786. this.stream.skip(-2);
  42787. return this.currentChar = this.stream.getByte();
  42788. }
  42789. getToken() {
  42790. let comment = false;
  42791. let ch = this.currentChar;
  42792. while (true) {
  42793. if (ch === -1) {
  42794. return null;
  42795. }
  42796. if (comment) {
  42797. if (ch === 0x0a || ch === 0x0d) {
  42798. comment = false;
  42799. }
  42800. } else if (ch === 0x25) {
  42801. comment = true;
  42802. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  42803. break;
  42804. }
  42805. ch = this.nextChar();
  42806. }
  42807. if (isSpecial(ch)) {
  42808. this.nextChar();
  42809. return String.fromCharCode(ch);
  42810. }
  42811. let token = "";
  42812. do {
  42813. token += String.fromCharCode(ch);
  42814. ch = this.nextChar();
  42815. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  42816. return token;
  42817. }
  42818. readCharStrings(bytes, lenIV) {
  42819. if (lenIV === -1) {
  42820. return bytes;
  42821. }
  42822. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  42823. }
  42824. extractFontProgram(properties) {
  42825. const stream = this.stream;
  42826. const subrs = [],
  42827. charstrings = [];
  42828. const privateData = Object.create(null);
  42829. privateData.lenIV = 4;
  42830. const program = {
  42831. subrs: [],
  42832. charstrings: [],
  42833. properties: {
  42834. privateData
  42835. }
  42836. };
  42837. let token, length, data, lenIV;
  42838. while ((token = this.getToken()) !== null) {
  42839. if (token !== "/") {
  42840. continue;
  42841. }
  42842. token = this.getToken();
  42843. switch (token) {
  42844. case "CharStrings":
  42845. this.getToken();
  42846. this.getToken();
  42847. this.getToken();
  42848. this.getToken();
  42849. while (true) {
  42850. token = this.getToken();
  42851. if (token === null || token === "end") {
  42852. break;
  42853. }
  42854. if (token !== "/") {
  42855. continue;
  42856. }
  42857. const glyph = this.getToken();
  42858. length = this.readInt();
  42859. this.getToken();
  42860. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42861. lenIV = program.properties.privateData.lenIV;
  42862. const encoded = this.readCharStrings(data, lenIV);
  42863. this.nextChar();
  42864. token = this.getToken();
  42865. if (token === "noaccess") {
  42866. this.getToken();
  42867. } else if (token === "/") {
  42868. this.prevChar();
  42869. }
  42870. charstrings.push({
  42871. glyph,
  42872. encoded
  42873. });
  42874. }
  42875. break;
  42876. case "Subrs":
  42877. this.readInt();
  42878. this.getToken();
  42879. while (this.getToken() === "dup") {
  42880. const index = this.readInt();
  42881. length = this.readInt();
  42882. this.getToken();
  42883. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42884. lenIV = program.properties.privateData.lenIV;
  42885. const encoded = this.readCharStrings(data, lenIV);
  42886. this.nextChar();
  42887. token = this.getToken();
  42888. if (token === "noaccess") {
  42889. this.getToken();
  42890. }
  42891. subrs[index] = encoded;
  42892. }
  42893. break;
  42894. case "BlueValues":
  42895. case "OtherBlues":
  42896. case "FamilyBlues":
  42897. case "FamilyOtherBlues":
  42898. const blueArray = this.readNumberArray();
  42899. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  42900. program.properties.privateData[token] = blueArray;
  42901. }
  42902. break;
  42903. case "StemSnapH":
  42904. case "StemSnapV":
  42905. program.properties.privateData[token] = this.readNumberArray();
  42906. break;
  42907. case "StdHW":
  42908. case "StdVW":
  42909. program.properties.privateData[token] = this.readNumberArray()[0];
  42910. break;
  42911. case "BlueShift":
  42912. case "lenIV":
  42913. case "BlueFuzz":
  42914. case "BlueScale":
  42915. case "LanguageGroup":
  42916. case "ExpansionFactor":
  42917. program.properties.privateData[token] = this.readNumber();
  42918. break;
  42919. case "ForceBold":
  42920. program.properties.privateData[token] = this.readBoolean();
  42921. break;
  42922. }
  42923. }
  42924. for (const {
  42925. encoded,
  42926. glyph
  42927. } of charstrings) {
  42928. const charString = new Type1CharString();
  42929. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  42930. let output = charString.output;
  42931. if (error) {
  42932. output = [14];
  42933. }
  42934. const charStringObject = {
  42935. glyphName: glyph,
  42936. charstring: output,
  42937. width: charString.width,
  42938. lsb: charString.lsb,
  42939. seac: charString.seac
  42940. };
  42941. if (glyph === ".notdef") {
  42942. program.charstrings.unshift(charStringObject);
  42943. } else {
  42944. program.charstrings.push(charStringObject);
  42945. }
  42946. if (properties.builtInEncoding) {
  42947. const index = properties.builtInEncoding.indexOf(glyph);
  42948. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  42949. properties.widths[index] = charString.width;
  42950. }
  42951. }
  42952. }
  42953. return program;
  42954. }
  42955. extractFontHeader(properties) {
  42956. let token;
  42957. while ((token = this.getToken()) !== null) {
  42958. if (token !== "/") {
  42959. continue;
  42960. }
  42961. token = this.getToken();
  42962. switch (token) {
  42963. case "FontMatrix":
  42964. const matrix = this.readNumberArray();
  42965. properties.fontMatrix = matrix;
  42966. break;
  42967. case "Encoding":
  42968. const encodingArg = this.getToken();
  42969. let encoding;
  42970. if (!/^\d+$/.test(encodingArg)) {
  42971. encoding = (0, _encodings.getEncoding)(encodingArg);
  42972. } else {
  42973. encoding = [];
  42974. const size = parseInt(encodingArg, 10) | 0;
  42975. this.getToken();
  42976. for (let j = 0; j < size; j++) {
  42977. token = this.getToken();
  42978. while (token !== "dup" && token !== "def") {
  42979. token = this.getToken();
  42980. if (token === null) {
  42981. return;
  42982. }
  42983. }
  42984. if (token === "def") {
  42985. break;
  42986. }
  42987. const index = this.readInt();
  42988. this.getToken();
  42989. const glyph = this.getToken();
  42990. encoding[index] = glyph;
  42991. this.getToken();
  42992. }
  42993. }
  42994. properties.builtInEncoding = encoding;
  42995. break;
  42996. case "FontBBox":
  42997. const fontBBox = this.readNumberArray();
  42998. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  42999. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  43000. properties.ascentScaled = true;
  43001. break;
  43002. }
  43003. }
  43004. }
  43005. }
  43006. exports.Type1Parser = Type1Parser;
  43007. /***/ }),
  43008. /* 50 */
  43009. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43010. Object.defineProperty(exports, "__esModule", ({
  43011. value: true
  43012. }));
  43013. exports.Pattern = void 0;
  43014. exports.getTilingPatternIR = getTilingPatternIR;
  43015. var _util = __w_pdfjs_require__(2);
  43016. var _base_stream = __w_pdfjs_require__(7);
  43017. var _colorspace = __w_pdfjs_require__(14);
  43018. var _core_utils = __w_pdfjs_require__(6);
  43019. const ShadingType = {
  43020. FUNCTION_BASED: 1,
  43021. AXIAL: 2,
  43022. RADIAL: 3,
  43023. FREE_FORM_MESH: 4,
  43024. LATTICE_FORM_MESH: 5,
  43025. COONS_PATCH_MESH: 6,
  43026. TENSOR_PATCH_MESH: 7
  43027. };
  43028. class Pattern {
  43029. constructor() {
  43030. (0, _util.unreachable)("Cannot initialize Pattern.");
  43031. }
  43032. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  43033. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  43034. const type = dict.get("ShadingType");
  43035. try {
  43036. switch (type) {
  43037. case ShadingType.AXIAL:
  43038. case ShadingType.RADIAL:
  43039. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43040. case ShadingType.FREE_FORM_MESH:
  43041. case ShadingType.LATTICE_FORM_MESH:
  43042. case ShadingType.COONS_PATCH_MESH:
  43043. case ShadingType.TENSOR_PATCH_MESH:
  43044. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  43045. default:
  43046. throw new _util.FormatError("Unsupported ShadingType: " + type);
  43047. }
  43048. } catch (ex) {
  43049. if (ex instanceof _core_utils.MissingDataException) {
  43050. throw ex;
  43051. }
  43052. handler.send("UnsupportedFeature", {
  43053. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  43054. });
  43055. (0, _util.warn)(ex);
  43056. return new DummyShading();
  43057. }
  43058. }
  43059. }
  43060. exports.Pattern = Pattern;
  43061. class BaseShading {
  43062. static get SMALL_NUMBER() {
  43063. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  43064. }
  43065. constructor() {
  43066. if (this.constructor === BaseShading) {
  43067. (0, _util.unreachable)("Cannot initialize BaseShading.");
  43068. }
  43069. }
  43070. getIR() {
  43071. (0, _util.unreachable)("Abstract method `getIR` called.");
  43072. }
  43073. }
  43074. class RadialAxialShading extends BaseShading {
  43075. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43076. super();
  43077. this.coordsArr = dict.getArray("Coords");
  43078. this.shadingType = dict.get("ShadingType");
  43079. const cs = _colorspace.ColorSpace.parse({
  43080. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43081. xref,
  43082. resources,
  43083. pdfFunctionFactory,
  43084. localColorSpaceCache
  43085. });
  43086. const bbox = dict.getArray("BBox");
  43087. if (Array.isArray(bbox) && bbox.length === 4) {
  43088. this.bbox = _util.Util.normalizeRect(bbox);
  43089. } else {
  43090. this.bbox = null;
  43091. }
  43092. let t0 = 0.0,
  43093. t1 = 1.0;
  43094. if (dict.has("Domain")) {
  43095. const domainArr = dict.getArray("Domain");
  43096. t0 = domainArr[0];
  43097. t1 = domainArr[1];
  43098. }
  43099. let extendStart = false,
  43100. extendEnd = false;
  43101. if (dict.has("Extend")) {
  43102. const extendArr = dict.getArray("Extend");
  43103. extendStart = extendArr[0];
  43104. extendEnd = extendArr[1];
  43105. }
  43106. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  43107. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  43108. const distance = Math.hypot(x1 - x2, y1 - y2);
  43109. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  43110. (0, _util.warn)("Unsupported radial gradient.");
  43111. }
  43112. }
  43113. this.extendStart = extendStart;
  43114. this.extendEnd = extendEnd;
  43115. const fnObj = dict.getRaw("Function");
  43116. const fn = pdfFunctionFactory.createFromArray(fnObj);
  43117. const NUMBER_OF_SAMPLES = 10;
  43118. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  43119. const colorStops = this.colorStops = [];
  43120. if (t0 >= t1 || step <= 0) {
  43121. (0, _util.info)("Bad shading domain.");
  43122. return;
  43123. }
  43124. const color = new Float32Array(cs.numComps),
  43125. ratio = new Float32Array(1);
  43126. let rgbColor;
  43127. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  43128. ratio[0] = t0 + i * step;
  43129. fn(ratio, 0, color, 0);
  43130. rgbColor = cs.getRgb(color, 0);
  43131. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43132. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  43133. }
  43134. let background = "transparent";
  43135. if (dict.has("Background")) {
  43136. rgbColor = cs.getRgb(dict.get("Background"), 0);
  43137. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  43138. }
  43139. if (!extendStart) {
  43140. colorStops.unshift([0, background]);
  43141. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  43142. }
  43143. if (!extendEnd) {
  43144. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  43145. colorStops.push([1, background]);
  43146. }
  43147. this.colorStops = colorStops;
  43148. }
  43149. getIR() {
  43150. const coordsArr = this.coordsArr;
  43151. const shadingType = this.shadingType;
  43152. let type, p0, p1, r0, r1;
  43153. if (shadingType === ShadingType.AXIAL) {
  43154. p0 = [coordsArr[0], coordsArr[1]];
  43155. p1 = [coordsArr[2], coordsArr[3]];
  43156. r0 = null;
  43157. r1 = null;
  43158. type = "axial";
  43159. } else if (shadingType === ShadingType.RADIAL) {
  43160. p0 = [coordsArr[0], coordsArr[1]];
  43161. p1 = [coordsArr[3], coordsArr[4]];
  43162. r0 = coordsArr[2];
  43163. r1 = coordsArr[5];
  43164. type = "radial";
  43165. } else {
  43166. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  43167. }
  43168. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  43169. }
  43170. }
  43171. class MeshStreamReader {
  43172. constructor(stream, context) {
  43173. this.stream = stream;
  43174. this.context = context;
  43175. this.buffer = 0;
  43176. this.bufferLength = 0;
  43177. const numComps = context.numComps;
  43178. this.tmpCompsBuf = new Float32Array(numComps);
  43179. const csNumComps = context.colorSpace.numComps;
  43180. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  43181. }
  43182. get hasData() {
  43183. if (this.stream.end) {
  43184. return this.stream.pos < this.stream.end;
  43185. }
  43186. if (this.bufferLength > 0) {
  43187. return true;
  43188. }
  43189. const nextByte = this.stream.getByte();
  43190. if (nextByte < 0) {
  43191. return false;
  43192. }
  43193. this.buffer = nextByte;
  43194. this.bufferLength = 8;
  43195. return true;
  43196. }
  43197. readBits(n) {
  43198. let buffer = this.buffer;
  43199. let bufferLength = this.bufferLength;
  43200. if (n === 32) {
  43201. if (bufferLength === 0) {
  43202. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  43203. }
  43204. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  43205. const nextByte = this.stream.getByte();
  43206. this.buffer = nextByte & (1 << bufferLength) - 1;
  43207. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  43208. }
  43209. if (n === 8 && bufferLength === 0) {
  43210. return this.stream.getByte();
  43211. }
  43212. while (bufferLength < n) {
  43213. buffer = buffer << 8 | this.stream.getByte();
  43214. bufferLength += 8;
  43215. }
  43216. bufferLength -= n;
  43217. this.bufferLength = bufferLength;
  43218. this.buffer = buffer & (1 << bufferLength) - 1;
  43219. return buffer >> bufferLength;
  43220. }
  43221. align() {
  43222. this.buffer = 0;
  43223. this.bufferLength = 0;
  43224. }
  43225. readFlag() {
  43226. return this.readBits(this.context.bitsPerFlag);
  43227. }
  43228. readCoordinate() {
  43229. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  43230. const xi = this.readBits(bitsPerCoordinate);
  43231. const yi = this.readBits(bitsPerCoordinate);
  43232. const decode = this.context.decode;
  43233. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  43234. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  43235. }
  43236. readComponents() {
  43237. const numComps = this.context.numComps;
  43238. const bitsPerComponent = this.context.bitsPerComponent;
  43239. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  43240. const decode = this.context.decode;
  43241. const components = this.tmpCompsBuf;
  43242. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  43243. const ci = this.readBits(bitsPerComponent);
  43244. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  43245. }
  43246. const color = this.tmpCsCompsBuf;
  43247. if (this.context.colorFn) {
  43248. this.context.colorFn(components, 0, color, 0);
  43249. }
  43250. return this.context.colorSpace.getRgb(color, 0);
  43251. }
  43252. }
  43253. const getB = function getBClosure() {
  43254. function buildB(count) {
  43255. const lut = [];
  43256. for (let i = 0; i <= count; i++) {
  43257. const t = i / count,
  43258. t_ = 1 - t;
  43259. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  43260. }
  43261. return lut;
  43262. }
  43263. const cache = [];
  43264. return function (count) {
  43265. if (!cache[count]) {
  43266. cache[count] = buildB(count);
  43267. }
  43268. return cache[count];
  43269. };
  43270. }();
  43271. class MeshShading extends BaseShading {
  43272. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43273. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  43274. }
  43275. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  43276. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  43277. }
  43278. static get TRIANGLE_DENSITY() {
  43279. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  43280. }
  43281. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  43282. super();
  43283. if (!(stream instanceof _base_stream.BaseStream)) {
  43284. throw new _util.FormatError("Mesh data is not a stream");
  43285. }
  43286. const dict = stream.dict;
  43287. this.shadingType = dict.get("ShadingType");
  43288. const bbox = dict.getArray("BBox");
  43289. if (Array.isArray(bbox) && bbox.length === 4) {
  43290. this.bbox = _util.Util.normalizeRect(bbox);
  43291. } else {
  43292. this.bbox = null;
  43293. }
  43294. const cs = _colorspace.ColorSpace.parse({
  43295. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  43296. xref,
  43297. resources,
  43298. pdfFunctionFactory,
  43299. localColorSpaceCache
  43300. });
  43301. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  43302. const fnObj = dict.getRaw("Function");
  43303. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  43304. this.coords = [];
  43305. this.colors = [];
  43306. this.figures = [];
  43307. const decodeContext = {
  43308. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  43309. bitsPerComponent: dict.get("BitsPerComponent"),
  43310. bitsPerFlag: dict.get("BitsPerFlag"),
  43311. decode: dict.getArray("Decode"),
  43312. colorFn: fn,
  43313. colorSpace: cs,
  43314. numComps: fn ? 1 : cs.numComps
  43315. };
  43316. const reader = new MeshStreamReader(stream, decodeContext);
  43317. let patchMesh = false;
  43318. switch (this.shadingType) {
  43319. case ShadingType.FREE_FORM_MESH:
  43320. this._decodeType4Shading(reader);
  43321. break;
  43322. case ShadingType.LATTICE_FORM_MESH:
  43323. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  43324. if (verticesPerRow < 2) {
  43325. throw new _util.FormatError("Invalid VerticesPerRow");
  43326. }
  43327. this._decodeType5Shading(reader, verticesPerRow);
  43328. break;
  43329. case ShadingType.COONS_PATCH_MESH:
  43330. this._decodeType6Shading(reader);
  43331. patchMesh = true;
  43332. break;
  43333. case ShadingType.TENSOR_PATCH_MESH:
  43334. this._decodeType7Shading(reader);
  43335. patchMesh = true;
  43336. break;
  43337. default:
  43338. (0, _util.unreachable)("Unsupported mesh type.");
  43339. break;
  43340. }
  43341. if (patchMesh) {
  43342. this._updateBounds();
  43343. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  43344. this._buildFigureFromPatch(i);
  43345. }
  43346. }
  43347. this._updateBounds();
  43348. this._packData();
  43349. }
  43350. _decodeType4Shading(reader) {
  43351. const coords = this.coords;
  43352. const colors = this.colors;
  43353. const operators = [];
  43354. const ps = [];
  43355. let verticesLeft = 0;
  43356. while (reader.hasData) {
  43357. const f = reader.readFlag();
  43358. const coord = reader.readCoordinate();
  43359. const color = reader.readComponents();
  43360. if (verticesLeft === 0) {
  43361. if (!(0 <= f && f <= 2)) {
  43362. throw new _util.FormatError("Unknown type4 flag");
  43363. }
  43364. switch (f) {
  43365. case 0:
  43366. verticesLeft = 3;
  43367. break;
  43368. case 1:
  43369. ps.push(ps.at(-2), ps.at(-1));
  43370. verticesLeft = 1;
  43371. break;
  43372. case 2:
  43373. ps.push(ps.at(-3), ps.at(-1));
  43374. verticesLeft = 1;
  43375. break;
  43376. }
  43377. operators.push(f);
  43378. }
  43379. ps.push(coords.length);
  43380. coords.push(coord);
  43381. colors.push(color);
  43382. verticesLeft--;
  43383. reader.align();
  43384. }
  43385. this.figures.push({
  43386. type: "triangles",
  43387. coords: new Int32Array(ps),
  43388. colors: new Int32Array(ps)
  43389. });
  43390. }
  43391. _decodeType5Shading(reader, verticesPerRow) {
  43392. const coords = this.coords;
  43393. const colors = this.colors;
  43394. const ps = [];
  43395. while (reader.hasData) {
  43396. const coord = reader.readCoordinate();
  43397. const color = reader.readComponents();
  43398. ps.push(coords.length);
  43399. coords.push(coord);
  43400. colors.push(color);
  43401. }
  43402. this.figures.push({
  43403. type: "lattice",
  43404. coords: new Int32Array(ps),
  43405. colors: new Int32Array(ps),
  43406. verticesPerRow
  43407. });
  43408. }
  43409. _decodeType6Shading(reader) {
  43410. const coords = this.coords;
  43411. const colors = this.colors;
  43412. const ps = new Int32Array(16);
  43413. const cs = new Int32Array(4);
  43414. while (reader.hasData) {
  43415. const f = reader.readFlag();
  43416. if (!(0 <= f && f <= 3)) {
  43417. throw new _util.FormatError("Unknown type6 flag");
  43418. }
  43419. const pi = coords.length;
  43420. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  43421. coords.push(reader.readCoordinate());
  43422. }
  43423. const ci = colors.length;
  43424. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43425. colors.push(reader.readComponents());
  43426. }
  43427. let tmp1, tmp2, tmp3, tmp4;
  43428. switch (f) {
  43429. case 0:
  43430. ps[12] = pi + 3;
  43431. ps[13] = pi + 4;
  43432. ps[14] = pi + 5;
  43433. ps[15] = pi + 6;
  43434. ps[8] = pi + 2;
  43435. ps[11] = pi + 7;
  43436. ps[4] = pi + 1;
  43437. ps[7] = pi + 8;
  43438. ps[0] = pi;
  43439. ps[1] = pi + 11;
  43440. ps[2] = pi + 10;
  43441. ps[3] = pi + 9;
  43442. cs[2] = ci + 1;
  43443. cs[3] = ci + 2;
  43444. cs[0] = ci;
  43445. cs[1] = ci + 3;
  43446. break;
  43447. case 1:
  43448. tmp1 = ps[12];
  43449. tmp2 = ps[13];
  43450. tmp3 = ps[14];
  43451. tmp4 = ps[15];
  43452. ps[12] = tmp4;
  43453. ps[13] = pi + 0;
  43454. ps[14] = pi + 1;
  43455. ps[15] = pi + 2;
  43456. ps[8] = tmp3;
  43457. ps[11] = pi + 3;
  43458. ps[4] = tmp2;
  43459. ps[7] = pi + 4;
  43460. ps[0] = tmp1;
  43461. ps[1] = pi + 7;
  43462. ps[2] = pi + 6;
  43463. ps[3] = pi + 5;
  43464. tmp1 = cs[2];
  43465. tmp2 = cs[3];
  43466. cs[2] = tmp2;
  43467. cs[3] = ci;
  43468. cs[0] = tmp1;
  43469. cs[1] = ci + 1;
  43470. break;
  43471. case 2:
  43472. tmp1 = ps[15];
  43473. tmp2 = ps[11];
  43474. ps[12] = ps[3];
  43475. ps[13] = pi + 0;
  43476. ps[14] = pi + 1;
  43477. ps[15] = pi + 2;
  43478. ps[8] = ps[7];
  43479. ps[11] = pi + 3;
  43480. ps[4] = tmp2;
  43481. ps[7] = pi + 4;
  43482. ps[0] = tmp1;
  43483. ps[1] = pi + 7;
  43484. ps[2] = pi + 6;
  43485. ps[3] = pi + 5;
  43486. tmp1 = cs[3];
  43487. cs[2] = cs[1];
  43488. cs[3] = ci;
  43489. cs[0] = tmp1;
  43490. cs[1] = ci + 1;
  43491. break;
  43492. case 3:
  43493. ps[12] = ps[0];
  43494. ps[13] = pi + 0;
  43495. ps[14] = pi + 1;
  43496. ps[15] = pi + 2;
  43497. ps[8] = ps[1];
  43498. ps[11] = pi + 3;
  43499. ps[4] = ps[2];
  43500. ps[7] = pi + 4;
  43501. ps[0] = ps[3];
  43502. ps[1] = pi + 7;
  43503. ps[2] = pi + 6;
  43504. ps[3] = pi + 5;
  43505. cs[2] = cs[0];
  43506. cs[3] = ci;
  43507. cs[0] = cs[1];
  43508. cs[1] = ci + 1;
  43509. break;
  43510. }
  43511. ps[5] = coords.length;
  43512. 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]);
  43513. ps[6] = coords.length;
  43514. 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]);
  43515. ps[9] = coords.length;
  43516. 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]);
  43517. ps[10] = coords.length;
  43518. 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]);
  43519. this.figures.push({
  43520. type: "patch",
  43521. coords: new Int32Array(ps),
  43522. colors: new Int32Array(cs)
  43523. });
  43524. }
  43525. }
  43526. _decodeType7Shading(reader) {
  43527. const coords = this.coords;
  43528. const colors = this.colors;
  43529. const ps = new Int32Array(16);
  43530. const cs = new Int32Array(4);
  43531. while (reader.hasData) {
  43532. const f = reader.readFlag();
  43533. if (!(0 <= f && f <= 3)) {
  43534. throw new _util.FormatError("Unknown type7 flag");
  43535. }
  43536. const pi = coords.length;
  43537. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  43538. coords.push(reader.readCoordinate());
  43539. }
  43540. const ci = colors.length;
  43541. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43542. colors.push(reader.readComponents());
  43543. }
  43544. let tmp1, tmp2, tmp3, tmp4;
  43545. switch (f) {
  43546. case 0:
  43547. ps[12] = pi + 3;
  43548. ps[13] = pi + 4;
  43549. ps[14] = pi + 5;
  43550. ps[15] = pi + 6;
  43551. ps[8] = pi + 2;
  43552. ps[9] = pi + 13;
  43553. ps[10] = pi + 14;
  43554. ps[11] = pi + 7;
  43555. ps[4] = pi + 1;
  43556. ps[5] = pi + 12;
  43557. ps[6] = pi + 15;
  43558. ps[7] = pi + 8;
  43559. ps[0] = pi;
  43560. ps[1] = pi + 11;
  43561. ps[2] = pi + 10;
  43562. ps[3] = pi + 9;
  43563. cs[2] = ci + 1;
  43564. cs[3] = ci + 2;
  43565. cs[0] = ci;
  43566. cs[1] = ci + 3;
  43567. break;
  43568. case 1:
  43569. tmp1 = ps[12];
  43570. tmp2 = ps[13];
  43571. tmp3 = ps[14];
  43572. tmp4 = ps[15];
  43573. ps[12] = tmp4;
  43574. ps[13] = pi + 0;
  43575. ps[14] = pi + 1;
  43576. ps[15] = pi + 2;
  43577. ps[8] = tmp3;
  43578. ps[9] = pi + 9;
  43579. ps[10] = pi + 10;
  43580. ps[11] = pi + 3;
  43581. ps[4] = tmp2;
  43582. ps[5] = pi + 8;
  43583. ps[6] = pi + 11;
  43584. ps[7] = pi + 4;
  43585. ps[0] = tmp1;
  43586. ps[1] = pi + 7;
  43587. ps[2] = pi + 6;
  43588. ps[3] = pi + 5;
  43589. tmp1 = cs[2];
  43590. tmp2 = cs[3];
  43591. cs[2] = tmp2;
  43592. cs[3] = ci;
  43593. cs[0] = tmp1;
  43594. cs[1] = ci + 1;
  43595. break;
  43596. case 2:
  43597. tmp1 = ps[15];
  43598. tmp2 = ps[11];
  43599. ps[12] = ps[3];
  43600. ps[13] = pi + 0;
  43601. ps[14] = pi + 1;
  43602. ps[15] = pi + 2;
  43603. ps[8] = ps[7];
  43604. ps[9] = pi + 9;
  43605. ps[10] = pi + 10;
  43606. ps[11] = pi + 3;
  43607. ps[4] = tmp2;
  43608. ps[5] = pi + 8;
  43609. ps[6] = pi + 11;
  43610. ps[7] = pi + 4;
  43611. ps[0] = tmp1;
  43612. ps[1] = pi + 7;
  43613. ps[2] = pi + 6;
  43614. ps[3] = pi + 5;
  43615. tmp1 = cs[3];
  43616. cs[2] = cs[1];
  43617. cs[3] = ci;
  43618. cs[0] = tmp1;
  43619. cs[1] = ci + 1;
  43620. break;
  43621. case 3:
  43622. ps[12] = ps[0];
  43623. ps[13] = pi + 0;
  43624. ps[14] = pi + 1;
  43625. ps[15] = pi + 2;
  43626. ps[8] = ps[1];
  43627. ps[9] = pi + 9;
  43628. ps[10] = pi + 10;
  43629. ps[11] = pi + 3;
  43630. ps[4] = ps[2];
  43631. ps[5] = pi + 8;
  43632. ps[6] = pi + 11;
  43633. ps[7] = pi + 4;
  43634. ps[0] = ps[3];
  43635. ps[1] = pi + 7;
  43636. ps[2] = pi + 6;
  43637. ps[3] = pi + 5;
  43638. cs[2] = cs[0];
  43639. cs[3] = ci;
  43640. cs[0] = cs[1];
  43641. cs[1] = ci + 1;
  43642. break;
  43643. }
  43644. this.figures.push({
  43645. type: "patch",
  43646. coords: new Int32Array(ps),
  43647. colors: new Int32Array(cs)
  43648. });
  43649. }
  43650. }
  43651. _buildFigureFromPatch(index) {
  43652. const figure = this.figures[index];
  43653. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  43654. const coords = this.coords,
  43655. colors = this.colors;
  43656. const pi = figure.coords;
  43657. const ci = figure.colors;
  43658. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43659. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43660. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43661. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43662. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  43663. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  43664. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  43665. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  43666. const verticesPerRow = splitXBy + 1;
  43667. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  43668. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  43669. let k = 0;
  43670. const cl = new Uint8Array(3),
  43671. cr = new Uint8Array(3);
  43672. const c0 = colors[ci[0]],
  43673. c1 = colors[ci[1]],
  43674. c2 = colors[ci[2]],
  43675. c3 = colors[ci[3]];
  43676. const bRow = getB(splitYBy),
  43677. bCol = getB(splitXBy);
  43678. for (let row = 0; row <= splitYBy; row++) {
  43679. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  43680. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  43681. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  43682. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  43683. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  43684. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  43685. for (let col = 0; col <= splitXBy; col++, k++) {
  43686. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  43687. continue;
  43688. }
  43689. let x = 0,
  43690. y = 0;
  43691. let q = 0;
  43692. for (let i = 0; i <= 3; i++) {
  43693. for (let j = 0; j <= 3; j++, q++) {
  43694. const m = bRow[row][i] * bCol[col][j];
  43695. x += coords[pi[q]][0] * m;
  43696. y += coords[pi[q]][1] * m;
  43697. }
  43698. }
  43699. figureCoords[k] = coords.length;
  43700. coords.push([x, y]);
  43701. figureColors[k] = colors.length;
  43702. const newColor = new Uint8Array(3);
  43703. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  43704. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  43705. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  43706. colors.push(newColor);
  43707. }
  43708. }
  43709. figureCoords[0] = pi[0];
  43710. figureColors[0] = ci[0];
  43711. figureCoords[splitXBy] = pi[3];
  43712. figureColors[splitXBy] = ci[1];
  43713. figureCoords[verticesPerRow * splitYBy] = pi[12];
  43714. figureColors[verticesPerRow * splitYBy] = ci[2];
  43715. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  43716. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  43717. this.figures[index] = {
  43718. type: "lattice",
  43719. coords: figureCoords,
  43720. colors: figureColors,
  43721. verticesPerRow
  43722. };
  43723. }
  43724. _updateBounds() {
  43725. let minX = this.coords[0][0],
  43726. minY = this.coords[0][1],
  43727. maxX = minX,
  43728. maxY = minY;
  43729. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  43730. const x = this.coords[i][0],
  43731. y = this.coords[i][1];
  43732. minX = minX > x ? x : minX;
  43733. minY = minY > y ? y : minY;
  43734. maxX = maxX < x ? x : maxX;
  43735. maxY = maxY < y ? y : maxY;
  43736. }
  43737. this.bounds = [minX, minY, maxX, maxY];
  43738. }
  43739. _packData() {
  43740. let i, ii, j, jj;
  43741. const coords = this.coords;
  43742. const coordsPacked = new Float32Array(coords.length * 2);
  43743. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  43744. const xy = coords[i];
  43745. coordsPacked[j++] = xy[0];
  43746. coordsPacked[j++] = xy[1];
  43747. }
  43748. this.coords = coordsPacked;
  43749. const colors = this.colors;
  43750. const colorsPacked = new Uint8Array(colors.length * 3);
  43751. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  43752. const c = colors[i];
  43753. colorsPacked[j++] = c[0];
  43754. colorsPacked[j++] = c[1];
  43755. colorsPacked[j++] = c[2];
  43756. }
  43757. this.colors = colorsPacked;
  43758. const figures = this.figures;
  43759. for (i = 0, ii = figures.length; i < ii; i++) {
  43760. const figure = figures[i],
  43761. ps = figure.coords,
  43762. cs = figure.colors;
  43763. for (j = 0, jj = ps.length; j < jj; j++) {
  43764. ps[j] *= 2;
  43765. cs[j] *= 3;
  43766. }
  43767. }
  43768. }
  43769. getIR() {
  43770. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  43771. }
  43772. }
  43773. class DummyShading extends BaseShading {
  43774. getIR() {
  43775. return ["Dummy"];
  43776. }
  43777. }
  43778. function getTilingPatternIR(operatorList, dict, color) {
  43779. const matrix = dict.getArray("Matrix");
  43780. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  43781. const xstep = dict.get("XStep");
  43782. const ystep = dict.get("YStep");
  43783. const paintType = dict.get("PaintType");
  43784. const tilingType = dict.get("TilingType");
  43785. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  43786. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  43787. }
  43788. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  43789. }
  43790. /***/ }),
  43791. /* 51 */
  43792. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43793. Object.defineProperty(exports, "__esModule", ({
  43794. value: true
  43795. }));
  43796. exports.getXfaFontDict = getXfaFontDict;
  43797. exports.getXfaFontName = getXfaFontName;
  43798. var _calibri_factors = __w_pdfjs_require__(52);
  43799. var _primitives = __w_pdfjs_require__(5);
  43800. var _helvetica_factors = __w_pdfjs_require__(53);
  43801. var _liberationsans_widths = __w_pdfjs_require__(54);
  43802. var _myriadpro_factors = __w_pdfjs_require__(55);
  43803. var _segoeui_factors = __w_pdfjs_require__(56);
  43804. var _core_utils = __w_pdfjs_require__(6);
  43805. var _fonts_utils = __w_pdfjs_require__(38);
  43806. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  43807. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  43808. name: "LiberationSans-Regular",
  43809. factors: _myriadpro_factors.MyriadProRegularFactors,
  43810. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43811. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  43812. metrics: _myriadpro_factors.MyriadProRegularMetrics
  43813. };
  43814. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  43815. name: "LiberationSans-Bold",
  43816. factors: _myriadpro_factors.MyriadProBoldFactors,
  43817. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43818. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  43819. metrics: _myriadpro_factors.MyriadProBoldMetrics
  43820. };
  43821. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  43822. name: "LiberationSans-Italic",
  43823. factors: _myriadpro_factors.MyriadProItalicFactors,
  43824. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43825. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  43826. metrics: _myriadpro_factors.MyriadProItalicMetrics
  43827. };
  43828. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  43829. name: "LiberationSans-BoldItalic",
  43830. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  43831. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43832. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  43833. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  43834. };
  43835. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  43836. name: "LiberationSans-Regular",
  43837. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43838. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  43839. };
  43840. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  43841. name: "LiberationSans-Bold",
  43842. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43843. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  43844. };
  43845. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  43846. name: "LiberationSans-Italic",
  43847. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43848. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  43849. };
  43850. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  43851. name: "LiberationSans-BoldItalic",
  43852. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43853. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  43854. };
  43855. t["Calibri-Regular"] = {
  43856. name: "LiberationSans-Regular",
  43857. factors: _calibri_factors.CalibriRegularFactors,
  43858. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43859. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  43860. metrics: _calibri_factors.CalibriRegularMetrics
  43861. };
  43862. t["Calibri-Bold"] = {
  43863. name: "LiberationSans-Bold",
  43864. factors: _calibri_factors.CalibriBoldFactors,
  43865. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43866. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  43867. metrics: _calibri_factors.CalibriBoldMetrics
  43868. };
  43869. t["Calibri-Italic"] = {
  43870. name: "LiberationSans-Italic",
  43871. factors: _calibri_factors.CalibriItalicFactors,
  43872. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43873. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  43874. metrics: _calibri_factors.CalibriItalicMetrics
  43875. };
  43876. t["Calibri-BoldItalic"] = {
  43877. name: "LiberationSans-BoldItalic",
  43878. factors: _calibri_factors.CalibriBoldItalicFactors,
  43879. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43880. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  43881. metrics: _calibri_factors.CalibriBoldItalicMetrics
  43882. };
  43883. t["Segoeui-Regular"] = {
  43884. name: "LiberationSans-Regular",
  43885. factors: _segoeui_factors.SegoeuiRegularFactors,
  43886. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43887. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  43888. metrics: _segoeui_factors.SegoeuiRegularMetrics
  43889. };
  43890. t["Segoeui-Bold"] = {
  43891. name: "LiberationSans-Bold",
  43892. factors: _segoeui_factors.SegoeuiBoldFactors,
  43893. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43894. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  43895. metrics: _segoeui_factors.SegoeuiBoldMetrics
  43896. };
  43897. t["Segoeui-Italic"] = {
  43898. name: "LiberationSans-Italic",
  43899. factors: _segoeui_factors.SegoeuiItalicFactors,
  43900. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43901. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  43902. metrics: _segoeui_factors.SegoeuiItalicMetrics
  43903. };
  43904. t["Segoeui-BoldItalic"] = {
  43905. name: "LiberationSans-BoldItalic",
  43906. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  43907. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43908. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  43909. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  43910. };
  43911. t["Helvetica-Regular"] = t.Helvetica = {
  43912. name: "LiberationSans-Regular",
  43913. factors: _helvetica_factors.HelveticaRegularFactors,
  43914. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  43915. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  43916. metrics: _helvetica_factors.HelveticaRegularMetrics
  43917. };
  43918. t["Helvetica-Bold"] = {
  43919. name: "LiberationSans-Bold",
  43920. factors: _helvetica_factors.HelveticaBoldFactors,
  43921. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  43922. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  43923. metrics: _helvetica_factors.HelveticaBoldMetrics
  43924. };
  43925. t["Helvetica-Italic"] = {
  43926. name: "LiberationSans-Italic",
  43927. factors: _helvetica_factors.HelveticaItalicFactors,
  43928. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  43929. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  43930. metrics: _helvetica_factors.HelveticaItalicMetrics
  43931. };
  43932. t["Helvetica-BoldItalic"] = {
  43933. name: "LiberationSans-BoldItalic",
  43934. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  43935. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  43936. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  43937. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  43938. };
  43939. });
  43940. function getXfaFontName(name) {
  43941. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  43942. const fontMap = getXFAFontMap();
  43943. return fontMap[fontName];
  43944. }
  43945. function getXfaFontWidths(name) {
  43946. const info = getXfaFontName(name);
  43947. if (!info) {
  43948. return null;
  43949. }
  43950. const {
  43951. baseWidths,
  43952. baseMapping,
  43953. factors
  43954. } = info;
  43955. let rescaledBaseWidths;
  43956. if (!factors) {
  43957. rescaledBaseWidths = baseWidths;
  43958. } else {
  43959. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  43960. }
  43961. let currentCode = -2;
  43962. let currentArray;
  43963. const newWidths = [];
  43964. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  43965. if (unicode === -1) {
  43966. continue;
  43967. }
  43968. if (unicode === currentCode + 1) {
  43969. currentArray.push(rescaledBaseWidths[glyphIndex]);
  43970. currentCode += 1;
  43971. } else {
  43972. currentCode = unicode;
  43973. currentArray = [rescaledBaseWidths[glyphIndex]];
  43974. newWidths.push(unicode, currentArray);
  43975. }
  43976. }
  43977. return newWidths;
  43978. }
  43979. function getXfaFontDict(name) {
  43980. const widths = getXfaFontWidths(name);
  43981. const dict = new _primitives.Dict(null);
  43982. dict.set("BaseFont", _primitives.Name.get(name));
  43983. dict.set("Type", _primitives.Name.get("Font"));
  43984. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  43985. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  43986. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  43987. dict.set("W", widths);
  43988. dict.set("FirstChar", widths[0]);
  43989. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  43990. const descriptor = new _primitives.Dict(null);
  43991. dict.set("FontDescriptor", descriptor);
  43992. const systemInfo = new _primitives.Dict(null);
  43993. systemInfo.set("Ordering", "Identity");
  43994. systemInfo.set("Registry", "Adobe");
  43995. systemInfo.set("Supplement", 0);
  43996. dict.set("CIDSystemInfo", systemInfo);
  43997. return dict;
  43998. }
  43999. /***/ }),
  44000. /* 52 */
  44001. /***/ ((__unused_webpack_module, exports) => {
  44002. Object.defineProperty(exports, "__esModule", ({
  44003. value: true
  44004. }));
  44005. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  44006. 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];
  44007. exports.CalibriBoldFactors = CalibriBoldFactors;
  44008. const CalibriBoldMetrics = {
  44009. lineHeight: 1.2207,
  44010. lineGap: 0.2207
  44011. };
  44012. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  44013. 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];
  44014. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  44015. const CalibriBoldItalicMetrics = {
  44016. lineHeight: 1.2207,
  44017. lineGap: 0.2207
  44018. };
  44019. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  44020. 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];
  44021. exports.CalibriItalicFactors = CalibriItalicFactors;
  44022. const CalibriItalicMetrics = {
  44023. lineHeight: 1.2207,
  44024. lineGap: 0.2207
  44025. };
  44026. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  44027. 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];
  44028. exports.CalibriRegularFactors = CalibriRegularFactors;
  44029. const CalibriRegularMetrics = {
  44030. lineHeight: 1.2207,
  44031. lineGap: 0.2207
  44032. };
  44033. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  44034. /***/ }),
  44035. /* 53 */
  44036. /***/ ((__unused_webpack_module, exports) => {
  44037. Object.defineProperty(exports, "__esModule", ({
  44038. value: true
  44039. }));
  44040. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  44041. 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];
  44042. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  44043. const HelveticaBoldMetrics = {
  44044. lineHeight: 1.2,
  44045. lineGap: 0.2
  44046. };
  44047. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  44048. 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];
  44049. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  44050. const HelveticaBoldItalicMetrics = {
  44051. lineHeight: 1.35,
  44052. lineGap: 0.2
  44053. };
  44054. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  44055. 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];
  44056. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  44057. const HelveticaItalicMetrics = {
  44058. lineHeight: 1.35,
  44059. lineGap: 0.2
  44060. };
  44061. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  44062. 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];
  44063. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  44064. const HelveticaRegularMetrics = {
  44065. lineHeight: 1.2,
  44066. lineGap: 0.2
  44067. };
  44068. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  44069. /***/ }),
  44070. /* 54 */
  44071. /***/ ((__unused_webpack_module, exports) => {
  44072. Object.defineProperty(exports, "__esModule", ({
  44073. value: true
  44074. }));
  44075. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  44076. 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];
  44077. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  44078. 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];
  44079. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  44080. 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];
  44081. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  44082. 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];
  44083. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  44084. 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];
  44085. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  44086. 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];
  44087. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  44088. 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];
  44089. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  44090. 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];
  44091. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  44092. /***/ }),
  44093. /* 55 */
  44094. /***/ ((__unused_webpack_module, exports) => {
  44095. Object.defineProperty(exports, "__esModule", ({
  44096. value: true
  44097. }));
  44098. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  44099. 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];
  44100. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  44101. const MyriadProBoldMetrics = {
  44102. lineHeight: 1.2,
  44103. lineGap: 0.2
  44104. };
  44105. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  44106. 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];
  44107. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  44108. const MyriadProBoldItalicMetrics = {
  44109. lineHeight: 1.2,
  44110. lineGap: 0.2
  44111. };
  44112. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  44113. 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];
  44114. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  44115. const MyriadProItalicMetrics = {
  44116. lineHeight: 1.2,
  44117. lineGap: 0.2
  44118. };
  44119. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  44120. 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];
  44121. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  44122. const MyriadProRegularMetrics = {
  44123. lineHeight: 1.2,
  44124. lineGap: 0.2
  44125. };
  44126. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  44127. /***/ }),
  44128. /* 56 */
  44129. /***/ ((__unused_webpack_module, exports) => {
  44130. Object.defineProperty(exports, "__esModule", ({
  44131. value: true
  44132. }));
  44133. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  44134. 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];
  44135. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  44136. const SegoeuiBoldMetrics = {
  44137. lineHeight: 1.33008,
  44138. lineGap: 0
  44139. };
  44140. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  44141. 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];
  44142. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  44143. const SegoeuiBoldItalicMetrics = {
  44144. lineHeight: 1.33008,
  44145. lineGap: 0
  44146. };
  44147. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  44148. 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];
  44149. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  44150. const SegoeuiItalicMetrics = {
  44151. lineHeight: 1.33008,
  44152. lineGap: 0
  44153. };
  44154. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  44155. 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];
  44156. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  44157. const SegoeuiRegularMetrics = {
  44158. lineHeight: 1.33008,
  44159. lineGap: 0
  44160. };
  44161. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  44162. /***/ }),
  44163. /* 57 */
  44164. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44165. Object.defineProperty(exports, "__esModule", ({
  44166. value: true
  44167. }));
  44168. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  44169. exports.isPDFFunction = isPDFFunction;
  44170. var _primitives = __w_pdfjs_require__(5);
  44171. var _util = __w_pdfjs_require__(2);
  44172. var _ps_parser = __w_pdfjs_require__(58);
  44173. var _base_stream = __w_pdfjs_require__(7);
  44174. var _image_utils = __w_pdfjs_require__(59);
  44175. class PDFFunctionFactory {
  44176. constructor({
  44177. xref,
  44178. isEvalSupported = true
  44179. }) {
  44180. this.xref = xref;
  44181. this.isEvalSupported = isEvalSupported !== false;
  44182. }
  44183. create(fn) {
  44184. const cachedFunction = this.getCached(fn);
  44185. if (cachedFunction) {
  44186. return cachedFunction;
  44187. }
  44188. const parsedFunction = PDFFunction.parse({
  44189. xref: this.xref,
  44190. isEvalSupported: this.isEvalSupported,
  44191. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  44192. });
  44193. this._cache(fn, parsedFunction);
  44194. return parsedFunction;
  44195. }
  44196. createFromArray(fnObj) {
  44197. const cachedFunction = this.getCached(fnObj);
  44198. if (cachedFunction) {
  44199. return cachedFunction;
  44200. }
  44201. const parsedFunction = PDFFunction.parseArray({
  44202. xref: this.xref,
  44203. isEvalSupported: this.isEvalSupported,
  44204. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  44205. });
  44206. this._cache(fnObj, parsedFunction);
  44207. return parsedFunction;
  44208. }
  44209. getCached(cacheKey) {
  44210. let fnRef;
  44211. if (cacheKey instanceof _primitives.Ref) {
  44212. fnRef = cacheKey;
  44213. } else if (cacheKey instanceof _primitives.Dict) {
  44214. fnRef = cacheKey.objId;
  44215. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44216. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44217. }
  44218. if (fnRef) {
  44219. const localFunction = this._localFunctionCache.getByRef(fnRef);
  44220. if (localFunction) {
  44221. return localFunction;
  44222. }
  44223. }
  44224. return null;
  44225. }
  44226. _cache(cacheKey, parsedFunction) {
  44227. if (!parsedFunction) {
  44228. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  44229. }
  44230. let fnRef;
  44231. if (cacheKey instanceof _primitives.Ref) {
  44232. fnRef = cacheKey;
  44233. } else if (cacheKey instanceof _primitives.Dict) {
  44234. fnRef = cacheKey.objId;
  44235. } else if (cacheKey instanceof _base_stream.BaseStream) {
  44236. fnRef = cacheKey.dict && cacheKey.dict.objId;
  44237. }
  44238. if (fnRef) {
  44239. this._localFunctionCache.set(null, fnRef, parsedFunction);
  44240. }
  44241. }
  44242. get _localFunctionCache() {
  44243. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  44244. }
  44245. }
  44246. exports.PDFFunctionFactory = PDFFunctionFactory;
  44247. function toNumberArray(arr) {
  44248. if (!Array.isArray(arr)) {
  44249. return null;
  44250. }
  44251. const length = arr.length;
  44252. for (let i = 0; i < length; i++) {
  44253. if (typeof arr[i] !== "number") {
  44254. const result = new Array(length);
  44255. for (let j = 0; j < length; j++) {
  44256. result[j] = +arr[j];
  44257. }
  44258. return result;
  44259. }
  44260. }
  44261. return arr;
  44262. }
  44263. class PDFFunction {
  44264. static getSampleArray(size, outputSize, bps, stream) {
  44265. let i, ii;
  44266. let length = 1;
  44267. for (i = 0, ii = size.length; i < ii; i++) {
  44268. length *= size[i];
  44269. }
  44270. length *= outputSize;
  44271. const array = new Array(length);
  44272. let codeSize = 0;
  44273. let codeBuf = 0;
  44274. const sampleMul = 1.0 / (2.0 ** bps - 1);
  44275. const strBytes = stream.getBytes((length * bps + 7) / 8);
  44276. let strIdx = 0;
  44277. for (i = 0; i < length; i++) {
  44278. while (codeSize < bps) {
  44279. codeBuf <<= 8;
  44280. codeBuf |= strBytes[strIdx++];
  44281. codeSize += 8;
  44282. }
  44283. codeSize -= bps;
  44284. array[i] = (codeBuf >> codeSize) * sampleMul;
  44285. codeBuf &= (1 << codeSize) - 1;
  44286. }
  44287. return array;
  44288. }
  44289. static parse({
  44290. xref,
  44291. isEvalSupported,
  44292. fn
  44293. }) {
  44294. const dict = fn.dict || fn;
  44295. const typeNum = dict.get("FunctionType");
  44296. switch (typeNum) {
  44297. case 0:
  44298. return this.constructSampled({
  44299. xref,
  44300. isEvalSupported,
  44301. fn,
  44302. dict
  44303. });
  44304. case 1:
  44305. break;
  44306. case 2:
  44307. return this.constructInterpolated({
  44308. xref,
  44309. isEvalSupported,
  44310. dict
  44311. });
  44312. case 3:
  44313. return this.constructStiched({
  44314. xref,
  44315. isEvalSupported,
  44316. dict
  44317. });
  44318. case 4:
  44319. return this.constructPostScript({
  44320. xref,
  44321. isEvalSupported,
  44322. fn,
  44323. dict
  44324. });
  44325. }
  44326. throw new _util.FormatError("Unknown type of function");
  44327. }
  44328. static parseArray({
  44329. xref,
  44330. isEvalSupported,
  44331. fnObj
  44332. }) {
  44333. if (!Array.isArray(fnObj)) {
  44334. return this.parse({
  44335. xref,
  44336. isEvalSupported,
  44337. fn: fnObj
  44338. });
  44339. }
  44340. const fnArray = [];
  44341. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  44342. fnArray.push(this.parse({
  44343. xref,
  44344. isEvalSupported,
  44345. fn: xref.fetchIfRef(fnObj[j])
  44346. }));
  44347. }
  44348. return function (src, srcOffset, dest, destOffset) {
  44349. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  44350. fnArray[i](src, srcOffset, dest, destOffset + i);
  44351. }
  44352. };
  44353. }
  44354. static constructSampled({
  44355. xref,
  44356. isEvalSupported,
  44357. fn,
  44358. dict
  44359. }) {
  44360. function toMultiArray(arr) {
  44361. const inputLength = arr.length;
  44362. const out = [];
  44363. let index = 0;
  44364. for (let i = 0; i < inputLength; i += 2) {
  44365. out[index++] = [arr[i], arr[i + 1]];
  44366. }
  44367. return out;
  44368. }
  44369. function interpolate(x, xmin, xmax, ymin, ymax) {
  44370. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  44371. }
  44372. let domain = toNumberArray(dict.getArray("Domain"));
  44373. let range = toNumberArray(dict.getArray("Range"));
  44374. if (!domain || !range) {
  44375. throw new _util.FormatError("No domain or range");
  44376. }
  44377. const inputSize = domain.length / 2;
  44378. const outputSize = range.length / 2;
  44379. domain = toMultiArray(domain);
  44380. range = toMultiArray(range);
  44381. const size = toNumberArray(dict.getArray("Size"));
  44382. const bps = dict.get("BitsPerSample");
  44383. const order = dict.get("Order") || 1;
  44384. if (order !== 1) {
  44385. (0, _util.info)("No support for cubic spline interpolation: " + order);
  44386. }
  44387. let encode = toNumberArray(dict.getArray("Encode"));
  44388. if (!encode) {
  44389. encode = [];
  44390. for (let i = 0; i < inputSize; ++i) {
  44391. encode.push([0, size[i] - 1]);
  44392. }
  44393. } else {
  44394. encode = toMultiArray(encode);
  44395. }
  44396. let decode = toNumberArray(dict.getArray("Decode"));
  44397. if (!decode) {
  44398. decode = range;
  44399. } else {
  44400. decode = toMultiArray(decode);
  44401. }
  44402. const samples = this.getSampleArray(size, outputSize, bps, fn);
  44403. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  44404. const cubeVertices = 1 << inputSize;
  44405. const cubeN = new Float64Array(cubeVertices);
  44406. const cubeVertex = new Uint32Array(cubeVertices);
  44407. let i, j;
  44408. for (j = 0; j < cubeVertices; j++) {
  44409. cubeN[j] = 1;
  44410. }
  44411. let k = outputSize,
  44412. pos = 1;
  44413. for (i = 0; i < inputSize; ++i) {
  44414. const domain_2i = domain[i][0];
  44415. const domain_2i_1 = domain[i][1];
  44416. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  44417. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  44418. const size_i = size[i];
  44419. e = Math.min(Math.max(e, 0), size_i - 1);
  44420. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  44421. const n0 = e0 + 1 - e;
  44422. const n1 = e - e0;
  44423. const offset0 = e0 * k;
  44424. const offset1 = offset0 + k;
  44425. for (j = 0; j < cubeVertices; j++) {
  44426. if (j & pos) {
  44427. cubeN[j] *= n1;
  44428. cubeVertex[j] += offset1;
  44429. } else {
  44430. cubeN[j] *= n0;
  44431. cubeVertex[j] += offset0;
  44432. }
  44433. }
  44434. k *= size_i;
  44435. pos <<= 1;
  44436. }
  44437. for (j = 0; j < outputSize; ++j) {
  44438. let rj = 0;
  44439. for (i = 0; i < cubeVertices; i++) {
  44440. rj += samples[cubeVertex[i] + j] * cubeN[i];
  44441. }
  44442. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  44443. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  44444. }
  44445. };
  44446. }
  44447. static constructInterpolated({
  44448. xref,
  44449. isEvalSupported,
  44450. dict
  44451. }) {
  44452. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  44453. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  44454. const n = dict.get("N");
  44455. const diff = [];
  44456. for (let i = 0, ii = c0.length; i < ii; ++i) {
  44457. diff.push(c1[i] - c0[i]);
  44458. }
  44459. const length = diff.length;
  44460. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  44461. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  44462. for (let j = 0; j < length; ++j) {
  44463. dest[destOffset + j] = c0[j] + x * diff[j];
  44464. }
  44465. };
  44466. }
  44467. static constructStiched({
  44468. xref,
  44469. isEvalSupported,
  44470. dict
  44471. }) {
  44472. const domain = toNumberArray(dict.getArray("Domain"));
  44473. if (!domain) {
  44474. throw new _util.FormatError("No domain");
  44475. }
  44476. const inputSize = domain.length / 2;
  44477. if (inputSize !== 1) {
  44478. throw new _util.FormatError("Bad domain for stiched function");
  44479. }
  44480. const fnRefs = dict.get("Functions");
  44481. const fns = [];
  44482. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  44483. fns.push(this.parse({
  44484. xref,
  44485. isEvalSupported,
  44486. fn: xref.fetchIfRef(fnRefs[i])
  44487. }));
  44488. }
  44489. const bounds = toNumberArray(dict.getArray("Bounds"));
  44490. const encode = toNumberArray(dict.getArray("Encode"));
  44491. const tmpBuf = new Float32Array(1);
  44492. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  44493. const clip = function constructStichedFromIRClip(v, min, max) {
  44494. if (v > max) {
  44495. v = max;
  44496. } else if (v < min) {
  44497. v = min;
  44498. }
  44499. return v;
  44500. };
  44501. const v = clip(src[srcOffset], domain[0], domain[1]);
  44502. const length = bounds.length;
  44503. let i;
  44504. for (i = 0; i < length; ++i) {
  44505. if (v < bounds[i]) {
  44506. break;
  44507. }
  44508. }
  44509. let dmin = domain[0];
  44510. if (i > 0) {
  44511. dmin = bounds[i - 1];
  44512. }
  44513. let dmax = domain[1];
  44514. if (i < bounds.length) {
  44515. dmax = bounds[i];
  44516. }
  44517. const rmin = encode[2 * i];
  44518. const rmax = encode[2 * i + 1];
  44519. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  44520. fns[i](tmpBuf, 0, dest, destOffset);
  44521. };
  44522. }
  44523. static constructPostScript({
  44524. xref,
  44525. isEvalSupported,
  44526. fn,
  44527. dict
  44528. }) {
  44529. const domain = toNumberArray(dict.getArray("Domain"));
  44530. const range = toNumberArray(dict.getArray("Range"));
  44531. if (!domain) {
  44532. throw new _util.FormatError("No domain.");
  44533. }
  44534. if (!range) {
  44535. throw new _util.FormatError("No range.");
  44536. }
  44537. const lexer = new _ps_parser.PostScriptLexer(fn);
  44538. const parser = new _ps_parser.PostScriptParser(lexer);
  44539. const code = parser.parse();
  44540. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  44541. const compiled = new PostScriptCompiler().compile(code, domain, range);
  44542. if (compiled) {
  44543. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  44544. }
  44545. }
  44546. (0, _util.info)("Unable to compile PS function");
  44547. const numOutputs = range.length >> 1;
  44548. const numInputs = domain.length >> 1;
  44549. const evaluator = new PostScriptEvaluator(code);
  44550. const cache = Object.create(null);
  44551. const MAX_CACHE_SIZE = 2048 * 4;
  44552. let cache_available = MAX_CACHE_SIZE;
  44553. const tmpBuf = new Float32Array(numInputs);
  44554. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  44555. let i, value;
  44556. let key = "";
  44557. const input = tmpBuf;
  44558. for (i = 0; i < numInputs; i++) {
  44559. value = src[srcOffset + i];
  44560. input[i] = value;
  44561. key += value + "_";
  44562. }
  44563. const cachedValue = cache[key];
  44564. if (cachedValue !== undefined) {
  44565. dest.set(cachedValue, destOffset);
  44566. return;
  44567. }
  44568. const output = new Float32Array(numOutputs);
  44569. const stack = evaluator.execute(input);
  44570. const stackIndex = stack.length - numOutputs;
  44571. for (i = 0; i < numOutputs; i++) {
  44572. value = stack[stackIndex + i];
  44573. let bound = range[i * 2];
  44574. if (value < bound) {
  44575. value = bound;
  44576. } else {
  44577. bound = range[i * 2 + 1];
  44578. if (value > bound) {
  44579. value = bound;
  44580. }
  44581. }
  44582. output[i] = value;
  44583. }
  44584. if (cache_available > 0) {
  44585. cache_available--;
  44586. cache[key] = output;
  44587. }
  44588. dest.set(output, destOffset);
  44589. };
  44590. }
  44591. }
  44592. function isPDFFunction(v) {
  44593. let fnDict;
  44594. if (typeof v !== "object") {
  44595. return false;
  44596. } else if (v instanceof _primitives.Dict) {
  44597. fnDict = v;
  44598. } else if (v instanceof _base_stream.BaseStream) {
  44599. fnDict = v.dict;
  44600. } else {
  44601. return false;
  44602. }
  44603. return fnDict.has("FunctionType");
  44604. }
  44605. class PostScriptStack {
  44606. static get MAX_STACK_SIZE() {
  44607. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  44608. }
  44609. constructor(initialStack) {
  44610. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  44611. }
  44612. push(value) {
  44613. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  44614. throw new Error("PostScript function stack overflow.");
  44615. }
  44616. this.stack.push(value);
  44617. }
  44618. pop() {
  44619. if (this.stack.length <= 0) {
  44620. throw new Error("PostScript function stack underflow.");
  44621. }
  44622. return this.stack.pop();
  44623. }
  44624. copy(n) {
  44625. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  44626. throw new Error("PostScript function stack overflow.");
  44627. }
  44628. const stack = this.stack;
  44629. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  44630. stack.push(stack[i]);
  44631. }
  44632. }
  44633. index(n) {
  44634. this.push(this.stack[this.stack.length - n - 1]);
  44635. }
  44636. roll(n, p) {
  44637. const stack = this.stack;
  44638. const l = stack.length - n;
  44639. const r = stack.length - 1;
  44640. const c = l + (p - Math.floor(p / n) * n);
  44641. for (let i = l, j = r; i < j; i++, j--) {
  44642. const t = stack[i];
  44643. stack[i] = stack[j];
  44644. stack[j] = t;
  44645. }
  44646. for (let i = l, j = c - 1; i < j; i++, j--) {
  44647. const t = stack[i];
  44648. stack[i] = stack[j];
  44649. stack[j] = t;
  44650. }
  44651. for (let i = c, j = r; i < j; i++, j--) {
  44652. const t = stack[i];
  44653. stack[i] = stack[j];
  44654. stack[j] = t;
  44655. }
  44656. }
  44657. }
  44658. class PostScriptEvaluator {
  44659. constructor(operators) {
  44660. this.operators = operators;
  44661. }
  44662. execute(initialStack) {
  44663. const stack = new PostScriptStack(initialStack);
  44664. let counter = 0;
  44665. const operators = this.operators;
  44666. const length = operators.length;
  44667. let operator, a, b;
  44668. while (counter < length) {
  44669. operator = operators[counter++];
  44670. if (typeof operator === "number") {
  44671. stack.push(operator);
  44672. continue;
  44673. }
  44674. switch (operator) {
  44675. case "jz":
  44676. b = stack.pop();
  44677. a = stack.pop();
  44678. if (!a) {
  44679. counter = b;
  44680. }
  44681. break;
  44682. case "j":
  44683. a = stack.pop();
  44684. counter = a;
  44685. break;
  44686. case "abs":
  44687. a = stack.pop();
  44688. stack.push(Math.abs(a));
  44689. break;
  44690. case "add":
  44691. b = stack.pop();
  44692. a = stack.pop();
  44693. stack.push(a + b);
  44694. break;
  44695. case "and":
  44696. b = stack.pop();
  44697. a = stack.pop();
  44698. if (typeof a === "boolean" && typeof b === "boolean") {
  44699. stack.push(a && b);
  44700. } else {
  44701. stack.push(a & b);
  44702. }
  44703. break;
  44704. case "atan":
  44705. a = stack.pop();
  44706. stack.push(Math.atan(a));
  44707. break;
  44708. case "bitshift":
  44709. b = stack.pop();
  44710. a = stack.pop();
  44711. if (a > 0) {
  44712. stack.push(a << b);
  44713. } else {
  44714. stack.push(a >> b);
  44715. }
  44716. break;
  44717. case "ceiling":
  44718. a = stack.pop();
  44719. stack.push(Math.ceil(a));
  44720. break;
  44721. case "copy":
  44722. a = stack.pop();
  44723. stack.copy(a);
  44724. break;
  44725. case "cos":
  44726. a = stack.pop();
  44727. stack.push(Math.cos(a));
  44728. break;
  44729. case "cvi":
  44730. a = stack.pop() | 0;
  44731. stack.push(a);
  44732. break;
  44733. case "cvr":
  44734. break;
  44735. case "div":
  44736. b = stack.pop();
  44737. a = stack.pop();
  44738. stack.push(a / b);
  44739. break;
  44740. case "dup":
  44741. stack.copy(1);
  44742. break;
  44743. case "eq":
  44744. b = stack.pop();
  44745. a = stack.pop();
  44746. stack.push(a === b);
  44747. break;
  44748. case "exch":
  44749. stack.roll(2, 1);
  44750. break;
  44751. case "exp":
  44752. b = stack.pop();
  44753. a = stack.pop();
  44754. stack.push(a ** b);
  44755. break;
  44756. case "false":
  44757. stack.push(false);
  44758. break;
  44759. case "floor":
  44760. a = stack.pop();
  44761. stack.push(Math.floor(a));
  44762. break;
  44763. case "ge":
  44764. b = stack.pop();
  44765. a = stack.pop();
  44766. stack.push(a >= b);
  44767. break;
  44768. case "gt":
  44769. b = stack.pop();
  44770. a = stack.pop();
  44771. stack.push(a > b);
  44772. break;
  44773. case "idiv":
  44774. b = stack.pop();
  44775. a = stack.pop();
  44776. stack.push(a / b | 0);
  44777. break;
  44778. case "index":
  44779. a = stack.pop();
  44780. stack.index(a);
  44781. break;
  44782. case "le":
  44783. b = stack.pop();
  44784. a = stack.pop();
  44785. stack.push(a <= b);
  44786. break;
  44787. case "ln":
  44788. a = stack.pop();
  44789. stack.push(Math.log(a));
  44790. break;
  44791. case "log":
  44792. a = stack.pop();
  44793. stack.push(Math.log(a) / Math.LN10);
  44794. break;
  44795. case "lt":
  44796. b = stack.pop();
  44797. a = stack.pop();
  44798. stack.push(a < b);
  44799. break;
  44800. case "mod":
  44801. b = stack.pop();
  44802. a = stack.pop();
  44803. stack.push(a % b);
  44804. break;
  44805. case "mul":
  44806. b = stack.pop();
  44807. a = stack.pop();
  44808. stack.push(a * b);
  44809. break;
  44810. case "ne":
  44811. b = stack.pop();
  44812. a = stack.pop();
  44813. stack.push(a !== b);
  44814. break;
  44815. case "neg":
  44816. a = stack.pop();
  44817. stack.push(-a);
  44818. break;
  44819. case "not":
  44820. a = stack.pop();
  44821. if (typeof a === "boolean") {
  44822. stack.push(!a);
  44823. } else {
  44824. stack.push(~a);
  44825. }
  44826. break;
  44827. case "or":
  44828. b = stack.pop();
  44829. a = stack.pop();
  44830. if (typeof a === "boolean" && typeof b === "boolean") {
  44831. stack.push(a || b);
  44832. } else {
  44833. stack.push(a | b);
  44834. }
  44835. break;
  44836. case "pop":
  44837. stack.pop();
  44838. break;
  44839. case "roll":
  44840. b = stack.pop();
  44841. a = stack.pop();
  44842. stack.roll(a, b);
  44843. break;
  44844. case "round":
  44845. a = stack.pop();
  44846. stack.push(Math.round(a));
  44847. break;
  44848. case "sin":
  44849. a = stack.pop();
  44850. stack.push(Math.sin(a));
  44851. break;
  44852. case "sqrt":
  44853. a = stack.pop();
  44854. stack.push(Math.sqrt(a));
  44855. break;
  44856. case "sub":
  44857. b = stack.pop();
  44858. a = stack.pop();
  44859. stack.push(a - b);
  44860. break;
  44861. case "true":
  44862. stack.push(true);
  44863. break;
  44864. case "truncate":
  44865. a = stack.pop();
  44866. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  44867. stack.push(a);
  44868. break;
  44869. case "xor":
  44870. b = stack.pop();
  44871. a = stack.pop();
  44872. if (typeof a === "boolean" && typeof b === "boolean") {
  44873. stack.push(a !== b);
  44874. } else {
  44875. stack.push(a ^ b);
  44876. }
  44877. break;
  44878. default:
  44879. throw new _util.FormatError(`Unknown operator ${operator}`);
  44880. }
  44881. }
  44882. return stack.stack;
  44883. }
  44884. }
  44885. exports.PostScriptEvaluator = PostScriptEvaluator;
  44886. class AstNode {
  44887. constructor(type) {
  44888. this.type = type;
  44889. }
  44890. visit(visitor) {
  44891. (0, _util.unreachable)("abstract method");
  44892. }
  44893. }
  44894. class AstArgument extends AstNode {
  44895. constructor(index, min, max) {
  44896. super("args");
  44897. this.index = index;
  44898. this.min = min;
  44899. this.max = max;
  44900. }
  44901. visit(visitor) {
  44902. visitor.visitArgument(this);
  44903. }
  44904. }
  44905. class AstLiteral extends AstNode {
  44906. constructor(number) {
  44907. super("literal");
  44908. this.number = number;
  44909. this.min = number;
  44910. this.max = number;
  44911. }
  44912. visit(visitor) {
  44913. visitor.visitLiteral(this);
  44914. }
  44915. }
  44916. class AstBinaryOperation extends AstNode {
  44917. constructor(op, arg1, arg2, min, max) {
  44918. super("binary");
  44919. this.op = op;
  44920. this.arg1 = arg1;
  44921. this.arg2 = arg2;
  44922. this.min = min;
  44923. this.max = max;
  44924. }
  44925. visit(visitor) {
  44926. visitor.visitBinaryOperation(this);
  44927. }
  44928. }
  44929. class AstMin extends AstNode {
  44930. constructor(arg, max) {
  44931. super("max");
  44932. this.arg = arg;
  44933. this.min = arg.min;
  44934. this.max = max;
  44935. }
  44936. visit(visitor) {
  44937. visitor.visitMin(this);
  44938. }
  44939. }
  44940. class AstVariable extends AstNode {
  44941. constructor(index, min, max) {
  44942. super("var");
  44943. this.index = index;
  44944. this.min = min;
  44945. this.max = max;
  44946. }
  44947. visit(visitor) {
  44948. visitor.visitVariable(this);
  44949. }
  44950. }
  44951. class AstVariableDefinition extends AstNode {
  44952. constructor(variable, arg) {
  44953. super("definition");
  44954. this.variable = variable;
  44955. this.arg = arg;
  44956. }
  44957. visit(visitor) {
  44958. visitor.visitVariableDefinition(this);
  44959. }
  44960. }
  44961. class ExpressionBuilderVisitor {
  44962. constructor() {
  44963. this.parts = [];
  44964. }
  44965. visitArgument(arg) {
  44966. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  44967. }
  44968. visitVariable(variable) {
  44969. this.parts.push("v", variable.index);
  44970. }
  44971. visitLiteral(literal) {
  44972. this.parts.push(literal.number);
  44973. }
  44974. visitBinaryOperation(operation) {
  44975. this.parts.push("(");
  44976. operation.arg1.visit(this);
  44977. this.parts.push(" ", operation.op, " ");
  44978. operation.arg2.visit(this);
  44979. this.parts.push(")");
  44980. }
  44981. visitVariableDefinition(definition) {
  44982. this.parts.push("var ");
  44983. definition.variable.visit(this);
  44984. this.parts.push(" = ");
  44985. definition.arg.visit(this);
  44986. this.parts.push(";");
  44987. }
  44988. visitMin(max) {
  44989. this.parts.push("Math.min(");
  44990. max.arg.visit(this);
  44991. this.parts.push(", ", max.max, ")");
  44992. }
  44993. toString() {
  44994. return this.parts.join("");
  44995. }
  44996. }
  44997. function buildAddOperation(num1, num2) {
  44998. if (num2.type === "literal" && num2.number === 0) {
  44999. return num1;
  45000. }
  45001. if (num1.type === "literal" && num1.number === 0) {
  45002. return num2;
  45003. }
  45004. if (num2.type === "literal" && num1.type === "literal") {
  45005. return new AstLiteral(num1.number + num2.number);
  45006. }
  45007. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  45008. }
  45009. function buildMulOperation(num1, num2) {
  45010. if (num2.type === "literal") {
  45011. if (num2.number === 0) {
  45012. return new AstLiteral(0);
  45013. } else if (num2.number === 1) {
  45014. return num1;
  45015. } else if (num1.type === "literal") {
  45016. return new AstLiteral(num1.number * num2.number);
  45017. }
  45018. }
  45019. if (num1.type === "literal") {
  45020. if (num1.number === 0) {
  45021. return new AstLiteral(0);
  45022. } else if (num1.number === 1) {
  45023. return num2;
  45024. }
  45025. }
  45026. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45027. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  45028. return new AstBinaryOperation("*", num1, num2, min, max);
  45029. }
  45030. function buildSubOperation(num1, num2) {
  45031. if (num2.type === "literal") {
  45032. if (num2.number === 0) {
  45033. return num1;
  45034. } else if (num1.type === "literal") {
  45035. return new AstLiteral(num1.number - num2.number);
  45036. }
  45037. }
  45038. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  45039. return num2.arg2;
  45040. }
  45041. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  45042. }
  45043. function buildMinOperation(num1, max) {
  45044. if (num1.min >= max) {
  45045. return new AstLiteral(max);
  45046. } else if (num1.max <= max) {
  45047. return num1;
  45048. }
  45049. return new AstMin(num1, max);
  45050. }
  45051. class PostScriptCompiler {
  45052. compile(code, domain, range) {
  45053. const stack = [];
  45054. const instructions = [];
  45055. const inputSize = domain.length >> 1,
  45056. outputSize = range.length >> 1;
  45057. let lastRegister = 0;
  45058. let n, j;
  45059. let num1, num2, ast1, ast2, tmpVar, item;
  45060. for (let i = 0; i < inputSize; i++) {
  45061. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  45062. }
  45063. for (let i = 0, ii = code.length; i < ii; i++) {
  45064. item = code[i];
  45065. if (typeof item === "number") {
  45066. stack.push(new AstLiteral(item));
  45067. continue;
  45068. }
  45069. switch (item) {
  45070. case "add":
  45071. if (stack.length < 2) {
  45072. return null;
  45073. }
  45074. num2 = stack.pop();
  45075. num1 = stack.pop();
  45076. stack.push(buildAddOperation(num1, num2));
  45077. break;
  45078. case "cvr":
  45079. if (stack.length < 1) {
  45080. return null;
  45081. }
  45082. break;
  45083. case "mul":
  45084. if (stack.length < 2) {
  45085. return null;
  45086. }
  45087. num2 = stack.pop();
  45088. num1 = stack.pop();
  45089. stack.push(buildMulOperation(num1, num2));
  45090. break;
  45091. case "sub":
  45092. if (stack.length < 2) {
  45093. return null;
  45094. }
  45095. num2 = stack.pop();
  45096. num1 = stack.pop();
  45097. stack.push(buildSubOperation(num1, num2));
  45098. break;
  45099. case "exch":
  45100. if (stack.length < 2) {
  45101. return null;
  45102. }
  45103. ast1 = stack.pop();
  45104. ast2 = stack.pop();
  45105. stack.push(ast1, ast2);
  45106. break;
  45107. case "pop":
  45108. if (stack.length < 1) {
  45109. return null;
  45110. }
  45111. stack.pop();
  45112. break;
  45113. case "index":
  45114. if (stack.length < 1) {
  45115. return null;
  45116. }
  45117. num1 = stack.pop();
  45118. if (num1.type !== "literal") {
  45119. return null;
  45120. }
  45121. n = num1.number;
  45122. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  45123. return null;
  45124. }
  45125. ast1 = stack[stack.length - n - 1];
  45126. if (ast1.type === "literal" || ast1.type === "var") {
  45127. stack.push(ast1);
  45128. break;
  45129. }
  45130. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45131. stack[stack.length - n - 1] = tmpVar;
  45132. stack.push(tmpVar);
  45133. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45134. break;
  45135. case "dup":
  45136. if (stack.length < 1) {
  45137. return null;
  45138. }
  45139. 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]) {
  45140. num1 = stack.pop();
  45141. stack.push(buildMinOperation(num1, code[i + 1]));
  45142. i += 6;
  45143. break;
  45144. }
  45145. ast1 = stack.at(-1);
  45146. if (ast1.type === "literal" || ast1.type === "var") {
  45147. stack.push(ast1);
  45148. break;
  45149. }
  45150. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  45151. stack[stack.length - 1] = tmpVar;
  45152. stack.push(tmpVar);
  45153. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  45154. break;
  45155. case "roll":
  45156. if (stack.length < 2) {
  45157. return null;
  45158. }
  45159. num2 = stack.pop();
  45160. num1 = stack.pop();
  45161. if (num2.type !== "literal" || num1.type !== "literal") {
  45162. return null;
  45163. }
  45164. j = num2.number;
  45165. n = num1.number;
  45166. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  45167. return null;
  45168. }
  45169. j = (j % n + n) % n;
  45170. if (j === 0) {
  45171. break;
  45172. }
  45173. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  45174. break;
  45175. default:
  45176. return null;
  45177. }
  45178. }
  45179. if (stack.length !== outputSize) {
  45180. return null;
  45181. }
  45182. const result = [];
  45183. for (const instruction of instructions) {
  45184. const statementBuilder = new ExpressionBuilderVisitor();
  45185. instruction.visit(statementBuilder);
  45186. result.push(statementBuilder.toString());
  45187. }
  45188. for (let i = 0, ii = stack.length; i < ii; i++) {
  45189. const expr = stack[i],
  45190. statementBuilder = new ExpressionBuilderVisitor();
  45191. expr.visit(statementBuilder);
  45192. const min = range[i * 2],
  45193. max = range[i * 2 + 1];
  45194. const out = [statementBuilder.toString()];
  45195. if (min > expr.min) {
  45196. out.unshift("Math.max(", min, ", ");
  45197. out.push(")");
  45198. }
  45199. if (max < expr.max) {
  45200. out.unshift("Math.min(", max, ", ");
  45201. out.push(")");
  45202. }
  45203. out.unshift("dest[destOffset + ", i, "] = ");
  45204. out.push(";");
  45205. result.push(out.join(""));
  45206. }
  45207. return result.join("\n");
  45208. }
  45209. }
  45210. exports.PostScriptCompiler = PostScriptCompiler;
  45211. /***/ }),
  45212. /* 58 */
  45213. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45214. Object.defineProperty(exports, "__esModule", ({
  45215. value: true
  45216. }));
  45217. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  45218. var _util = __w_pdfjs_require__(2);
  45219. var _primitives = __w_pdfjs_require__(5);
  45220. var _core_utils = __w_pdfjs_require__(6);
  45221. class PostScriptParser {
  45222. constructor(lexer) {
  45223. this.lexer = lexer;
  45224. this.operators = [];
  45225. this.token = null;
  45226. this.prev = null;
  45227. }
  45228. nextToken() {
  45229. this.prev = this.token;
  45230. this.token = this.lexer.getToken();
  45231. }
  45232. accept(type) {
  45233. if (this.token.type === type) {
  45234. this.nextToken();
  45235. return true;
  45236. }
  45237. return false;
  45238. }
  45239. expect(type) {
  45240. if (this.accept(type)) {
  45241. return true;
  45242. }
  45243. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  45244. }
  45245. parse() {
  45246. this.nextToken();
  45247. this.expect(PostScriptTokenTypes.LBRACE);
  45248. this.parseBlock();
  45249. this.expect(PostScriptTokenTypes.RBRACE);
  45250. return this.operators;
  45251. }
  45252. parseBlock() {
  45253. while (true) {
  45254. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  45255. this.operators.push(this.prev.value);
  45256. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  45257. this.operators.push(this.prev.value);
  45258. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45259. this.parseCondition();
  45260. } else {
  45261. return;
  45262. }
  45263. }
  45264. }
  45265. parseCondition() {
  45266. const conditionLocation = this.operators.length;
  45267. this.operators.push(null, null);
  45268. this.parseBlock();
  45269. this.expect(PostScriptTokenTypes.RBRACE);
  45270. if (this.accept(PostScriptTokenTypes.IF)) {
  45271. this.operators[conditionLocation] = this.operators.length;
  45272. this.operators[conditionLocation + 1] = "jz";
  45273. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  45274. const jumpLocation = this.operators.length;
  45275. this.operators.push(null, null);
  45276. const endOfTrue = this.operators.length;
  45277. this.parseBlock();
  45278. this.expect(PostScriptTokenTypes.RBRACE);
  45279. this.expect(PostScriptTokenTypes.IFELSE);
  45280. this.operators[jumpLocation] = this.operators.length;
  45281. this.operators[jumpLocation + 1] = "j";
  45282. this.operators[conditionLocation] = endOfTrue;
  45283. this.operators[conditionLocation + 1] = "jz";
  45284. } else {
  45285. throw new _util.FormatError("PS Function: error parsing conditional.");
  45286. }
  45287. }
  45288. }
  45289. exports.PostScriptParser = PostScriptParser;
  45290. const PostScriptTokenTypes = {
  45291. LBRACE: 0,
  45292. RBRACE: 1,
  45293. NUMBER: 2,
  45294. OPERATOR: 3,
  45295. IF: 4,
  45296. IFELSE: 5
  45297. };
  45298. class PostScriptToken {
  45299. static get opCache() {
  45300. return (0, _util.shadow)(this, "opCache", Object.create(null));
  45301. }
  45302. constructor(type, value) {
  45303. this.type = type;
  45304. this.value = value;
  45305. }
  45306. static getOperator(op) {
  45307. const opValue = PostScriptToken.opCache[op];
  45308. if (opValue) {
  45309. return opValue;
  45310. }
  45311. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  45312. }
  45313. static get LBRACE() {
  45314. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  45315. }
  45316. static get RBRACE() {
  45317. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  45318. }
  45319. static get IF() {
  45320. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  45321. }
  45322. static get IFELSE() {
  45323. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  45324. }
  45325. }
  45326. class PostScriptLexer {
  45327. constructor(stream) {
  45328. this.stream = stream;
  45329. this.nextChar();
  45330. this.strBuf = [];
  45331. }
  45332. nextChar() {
  45333. return this.currentChar = this.stream.getByte();
  45334. }
  45335. getToken() {
  45336. let comment = false;
  45337. let ch = this.currentChar;
  45338. while (true) {
  45339. if (ch < 0) {
  45340. return _primitives.EOF;
  45341. }
  45342. if (comment) {
  45343. if (ch === 0x0a || ch === 0x0d) {
  45344. comment = false;
  45345. }
  45346. } else if (ch === 0x25) {
  45347. comment = true;
  45348. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  45349. break;
  45350. }
  45351. ch = this.nextChar();
  45352. }
  45353. switch (ch | 0) {
  45354. case 0x30:
  45355. case 0x31:
  45356. case 0x32:
  45357. case 0x33:
  45358. case 0x34:
  45359. case 0x35:
  45360. case 0x36:
  45361. case 0x37:
  45362. case 0x38:
  45363. case 0x39:
  45364. case 0x2b:
  45365. case 0x2d:
  45366. case 0x2e:
  45367. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  45368. case 0x7b:
  45369. this.nextChar();
  45370. return PostScriptToken.LBRACE;
  45371. case 0x7d:
  45372. this.nextChar();
  45373. return PostScriptToken.RBRACE;
  45374. }
  45375. const strBuf = this.strBuf;
  45376. strBuf.length = 0;
  45377. strBuf[0] = String.fromCharCode(ch);
  45378. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  45379. strBuf.push(String.fromCharCode(ch));
  45380. }
  45381. const str = strBuf.join("");
  45382. switch (str.toLowerCase()) {
  45383. case "if":
  45384. return PostScriptToken.IF;
  45385. case "ifelse":
  45386. return PostScriptToken.IFELSE;
  45387. default:
  45388. return PostScriptToken.getOperator(str);
  45389. }
  45390. }
  45391. getNumber() {
  45392. let ch = this.currentChar;
  45393. const strBuf = this.strBuf;
  45394. strBuf.length = 0;
  45395. strBuf[0] = String.fromCharCode(ch);
  45396. while ((ch = this.nextChar()) >= 0) {
  45397. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  45398. strBuf.push(String.fromCharCode(ch));
  45399. } else {
  45400. break;
  45401. }
  45402. }
  45403. const value = parseFloat(strBuf.join(""));
  45404. if (isNaN(value)) {
  45405. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  45406. }
  45407. return value;
  45408. }
  45409. }
  45410. exports.PostScriptLexer = PostScriptLexer;
  45411. /***/ }),
  45412. /* 59 */
  45413. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45414. Object.defineProperty(exports, "__esModule", ({
  45415. value: true
  45416. }));
  45417. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  45418. var _util = __w_pdfjs_require__(2);
  45419. var _primitives = __w_pdfjs_require__(5);
  45420. class BaseLocalCache {
  45421. constructor(options) {
  45422. if (this.constructor === BaseLocalCache) {
  45423. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  45424. }
  45425. this._onlyRefs = (options && options.onlyRefs) === true;
  45426. if (!this._onlyRefs) {
  45427. this._nameRefMap = new Map();
  45428. this._imageMap = new Map();
  45429. }
  45430. this._imageCache = new _primitives.RefSetCache();
  45431. }
  45432. getByName(name) {
  45433. if (this._onlyRefs) {
  45434. (0, _util.unreachable)("Should not call `getByName` method.");
  45435. }
  45436. const ref = this._nameRefMap.get(name);
  45437. if (ref) {
  45438. return this.getByRef(ref);
  45439. }
  45440. return this._imageMap.get(name) || null;
  45441. }
  45442. getByRef(ref) {
  45443. return this._imageCache.get(ref) || null;
  45444. }
  45445. set(name, ref, data) {
  45446. (0, _util.unreachable)("Abstract method `set` called.");
  45447. }
  45448. }
  45449. class LocalImageCache extends BaseLocalCache {
  45450. set(name, ref = null, data) {
  45451. if (typeof name !== "string") {
  45452. throw new Error('LocalImageCache.set - expected "name" argument.');
  45453. }
  45454. if (ref) {
  45455. if (this._imageCache.has(ref)) {
  45456. return;
  45457. }
  45458. this._nameRefMap.set(name, ref);
  45459. this._imageCache.put(ref, data);
  45460. return;
  45461. }
  45462. if (this._imageMap.has(name)) {
  45463. return;
  45464. }
  45465. this._imageMap.set(name, data);
  45466. }
  45467. }
  45468. exports.LocalImageCache = LocalImageCache;
  45469. class LocalColorSpaceCache extends BaseLocalCache {
  45470. set(name = null, ref = null, data) {
  45471. if (typeof name !== "string" && !ref) {
  45472. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  45473. }
  45474. if (ref) {
  45475. if (this._imageCache.has(ref)) {
  45476. return;
  45477. }
  45478. if (name !== null) {
  45479. this._nameRefMap.set(name, ref);
  45480. }
  45481. this._imageCache.put(ref, data);
  45482. return;
  45483. }
  45484. if (this._imageMap.has(name)) {
  45485. return;
  45486. }
  45487. this._imageMap.set(name, data);
  45488. }
  45489. }
  45490. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  45491. class LocalFunctionCache extends BaseLocalCache {
  45492. constructor(options) {
  45493. super({
  45494. onlyRefs: true
  45495. });
  45496. }
  45497. set(name = null, ref, data) {
  45498. if (!ref) {
  45499. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  45500. }
  45501. if (this._imageCache.has(ref)) {
  45502. return;
  45503. }
  45504. this._imageCache.put(ref, data);
  45505. }
  45506. }
  45507. exports.LocalFunctionCache = LocalFunctionCache;
  45508. class LocalGStateCache extends BaseLocalCache {
  45509. set(name, ref = null, data) {
  45510. if (typeof name !== "string") {
  45511. throw new Error('LocalGStateCache.set - expected "name" argument.');
  45512. }
  45513. if (ref) {
  45514. if (this._imageCache.has(ref)) {
  45515. return;
  45516. }
  45517. this._nameRefMap.set(name, ref);
  45518. this._imageCache.put(ref, data);
  45519. return;
  45520. }
  45521. if (this._imageMap.has(name)) {
  45522. return;
  45523. }
  45524. this._imageMap.set(name, data);
  45525. }
  45526. }
  45527. exports.LocalGStateCache = LocalGStateCache;
  45528. class LocalTilingPatternCache extends BaseLocalCache {
  45529. constructor(options) {
  45530. super({
  45531. onlyRefs: true
  45532. });
  45533. }
  45534. set(name = null, ref, data) {
  45535. if (!ref) {
  45536. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  45537. }
  45538. if (this._imageCache.has(ref)) {
  45539. return;
  45540. }
  45541. this._imageCache.put(ref, data);
  45542. }
  45543. }
  45544. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  45545. class GlobalImageCache {
  45546. static get NUM_PAGES_THRESHOLD() {
  45547. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  45548. }
  45549. static get MIN_IMAGES_TO_CACHE() {
  45550. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  45551. }
  45552. static get MAX_BYTE_SIZE() {
  45553. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  45554. }
  45555. constructor() {
  45556. this._refCache = new _primitives.RefSetCache();
  45557. this._imageCache = new _primitives.RefSetCache();
  45558. }
  45559. get _byteSize() {
  45560. let byteSize = 0;
  45561. for (const imageData of this._imageCache) {
  45562. byteSize += imageData.byteSize;
  45563. }
  45564. return byteSize;
  45565. }
  45566. get _cacheLimitReached() {
  45567. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  45568. return false;
  45569. }
  45570. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  45571. return false;
  45572. }
  45573. return true;
  45574. }
  45575. shouldCache(ref, pageIndex) {
  45576. const pageIndexSet = this._refCache.get(ref);
  45577. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  45578. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45579. return false;
  45580. }
  45581. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  45582. return false;
  45583. }
  45584. return true;
  45585. }
  45586. addPageIndex(ref, pageIndex) {
  45587. let pageIndexSet = this._refCache.get(ref);
  45588. if (!pageIndexSet) {
  45589. pageIndexSet = new Set();
  45590. this._refCache.put(ref, pageIndexSet);
  45591. }
  45592. pageIndexSet.add(pageIndex);
  45593. }
  45594. addByteSize(ref, byteSize) {
  45595. const imageData = this._imageCache.get(ref);
  45596. if (!imageData) {
  45597. return;
  45598. }
  45599. if (imageData.byteSize) {
  45600. return;
  45601. }
  45602. imageData.byteSize = byteSize;
  45603. }
  45604. getData(ref, pageIndex) {
  45605. const pageIndexSet = this._refCache.get(ref);
  45606. if (!pageIndexSet) {
  45607. return null;
  45608. }
  45609. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  45610. return null;
  45611. }
  45612. const imageData = this._imageCache.get(ref);
  45613. if (!imageData) {
  45614. return null;
  45615. }
  45616. pageIndexSet.add(pageIndex);
  45617. return imageData;
  45618. }
  45619. setData(ref, data) {
  45620. if (!this._refCache.has(ref)) {
  45621. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  45622. }
  45623. if (this._imageCache.has(ref)) {
  45624. return;
  45625. }
  45626. if (this._cacheLimitReached) {
  45627. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  45628. return;
  45629. }
  45630. this._imageCache.put(ref, data);
  45631. }
  45632. clear(onlyData = false) {
  45633. if (!onlyData) {
  45634. this._refCache.clear();
  45635. }
  45636. this._imageCache.clear();
  45637. }
  45638. }
  45639. exports.GlobalImageCache = GlobalImageCache;
  45640. /***/ }),
  45641. /* 60 */
  45642. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45643. Object.defineProperty(exports, "__esModule", ({
  45644. value: true
  45645. }));
  45646. exports.bidi = bidi;
  45647. var _util = __w_pdfjs_require__(2);
  45648. 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"];
  45649. 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"];
  45650. function isOdd(i) {
  45651. return (i & 1) !== 0;
  45652. }
  45653. function isEven(i) {
  45654. return (i & 1) === 0;
  45655. }
  45656. function findUnequal(arr, start, value) {
  45657. let j, jj;
  45658. for (j = start, jj = arr.length; j < jj; ++j) {
  45659. if (arr[j] !== value) {
  45660. return j;
  45661. }
  45662. }
  45663. return j;
  45664. }
  45665. function setValues(arr, start, end, value) {
  45666. for (let j = start; j < end; ++j) {
  45667. arr[j] = value;
  45668. }
  45669. }
  45670. function reverseValues(arr, start, end) {
  45671. for (let i = start, j = end - 1; i < j; ++i, --j) {
  45672. const temp = arr[i];
  45673. arr[i] = arr[j];
  45674. arr[j] = temp;
  45675. }
  45676. }
  45677. function createBidiText(str, isLTR, vertical = false) {
  45678. let dir = "ltr";
  45679. if (vertical) {
  45680. dir = "ttb";
  45681. } else if (!isLTR) {
  45682. dir = "rtl";
  45683. }
  45684. return {
  45685. str,
  45686. dir
  45687. };
  45688. }
  45689. const chars = [];
  45690. const types = [];
  45691. function bidi(str, startLevel = -1, vertical = false) {
  45692. let isLTR = true;
  45693. const strLength = str.length;
  45694. if (strLength === 0 || vertical) {
  45695. return createBidiText(str, isLTR, vertical);
  45696. }
  45697. chars.length = strLength;
  45698. types.length = strLength;
  45699. let numBidi = 0;
  45700. let i, ii;
  45701. for (i = 0; i < strLength; ++i) {
  45702. chars[i] = str.charAt(i);
  45703. const charCode = str.charCodeAt(i);
  45704. let charType = "L";
  45705. if (charCode <= 0x00ff) {
  45706. charType = baseTypes[charCode];
  45707. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  45708. charType = "R";
  45709. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  45710. charType = arabicTypes[charCode & 0xff];
  45711. if (!charType) {
  45712. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  45713. }
  45714. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  45715. charType = "AL";
  45716. }
  45717. if (charType === "R" || charType === "AL" || charType === "AN") {
  45718. numBidi++;
  45719. }
  45720. types[i] = charType;
  45721. }
  45722. if (numBidi === 0) {
  45723. isLTR = true;
  45724. return createBidiText(str, isLTR);
  45725. }
  45726. if (startLevel === -1) {
  45727. if (numBidi / strLength < 0.3 && strLength > 4) {
  45728. isLTR = true;
  45729. startLevel = 0;
  45730. } else {
  45731. isLTR = false;
  45732. startLevel = 1;
  45733. }
  45734. }
  45735. const levels = [];
  45736. for (i = 0; i < strLength; ++i) {
  45737. levels[i] = startLevel;
  45738. }
  45739. const e = isOdd(startLevel) ? "R" : "L";
  45740. const sor = e;
  45741. const eor = sor;
  45742. let lastType = sor;
  45743. for (i = 0; i < strLength; ++i) {
  45744. if (types[i] === "NSM") {
  45745. types[i] = lastType;
  45746. } else {
  45747. lastType = types[i];
  45748. }
  45749. }
  45750. lastType = sor;
  45751. let t;
  45752. for (i = 0; i < strLength; ++i) {
  45753. t = types[i];
  45754. if (t === "EN") {
  45755. types[i] = lastType === "AL" ? "AN" : "EN";
  45756. } else if (t === "R" || t === "L" || t === "AL") {
  45757. lastType = t;
  45758. }
  45759. }
  45760. for (i = 0; i < strLength; ++i) {
  45761. t = types[i];
  45762. if (t === "AL") {
  45763. types[i] = "R";
  45764. }
  45765. }
  45766. for (i = 1; i < strLength - 1; ++i) {
  45767. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  45768. types[i] = "EN";
  45769. }
  45770. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  45771. types[i] = types[i - 1];
  45772. }
  45773. }
  45774. for (i = 0; i < strLength; ++i) {
  45775. if (types[i] === "EN") {
  45776. for (let j = i - 1; j >= 0; --j) {
  45777. if (types[j] !== "ET") {
  45778. break;
  45779. }
  45780. types[j] = "EN";
  45781. }
  45782. for (let j = i + 1; j < strLength; ++j) {
  45783. if (types[j] !== "ET") {
  45784. break;
  45785. }
  45786. types[j] = "EN";
  45787. }
  45788. }
  45789. }
  45790. for (i = 0; i < strLength; ++i) {
  45791. t = types[i];
  45792. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  45793. types[i] = "ON";
  45794. }
  45795. }
  45796. lastType = sor;
  45797. for (i = 0; i < strLength; ++i) {
  45798. t = types[i];
  45799. if (t === "EN") {
  45800. types[i] = lastType === "L" ? "L" : "EN";
  45801. } else if (t === "R" || t === "L") {
  45802. lastType = t;
  45803. }
  45804. }
  45805. for (i = 0; i < strLength; ++i) {
  45806. if (types[i] === "ON") {
  45807. const end = findUnequal(types, i + 1, "ON");
  45808. let before = sor;
  45809. if (i > 0) {
  45810. before = types[i - 1];
  45811. }
  45812. let after = eor;
  45813. if (end + 1 < strLength) {
  45814. after = types[end + 1];
  45815. }
  45816. if (before !== "L") {
  45817. before = "R";
  45818. }
  45819. if (after !== "L") {
  45820. after = "R";
  45821. }
  45822. if (before === after) {
  45823. setValues(types, i, end, before);
  45824. }
  45825. i = end - 1;
  45826. }
  45827. }
  45828. for (i = 0; i < strLength; ++i) {
  45829. if (types[i] === "ON") {
  45830. types[i] = e;
  45831. }
  45832. }
  45833. for (i = 0; i < strLength; ++i) {
  45834. t = types[i];
  45835. if (isEven(levels[i])) {
  45836. if (t === "R") {
  45837. levels[i] += 1;
  45838. } else if (t === "AN" || t === "EN") {
  45839. levels[i] += 2;
  45840. }
  45841. } else {
  45842. if (t === "L" || t === "AN" || t === "EN") {
  45843. levels[i] += 1;
  45844. }
  45845. }
  45846. }
  45847. let highestLevel = -1;
  45848. let lowestOddLevel = 99;
  45849. let level;
  45850. for (i = 0, ii = levels.length; i < ii; ++i) {
  45851. level = levels[i];
  45852. if (highestLevel < level) {
  45853. highestLevel = level;
  45854. }
  45855. if (lowestOddLevel > level && isOdd(level)) {
  45856. lowestOddLevel = level;
  45857. }
  45858. }
  45859. for (level = highestLevel; level >= lowestOddLevel; --level) {
  45860. let start = -1;
  45861. for (i = 0, ii = levels.length; i < ii; ++i) {
  45862. if (levels[i] < level) {
  45863. if (start >= 0) {
  45864. reverseValues(chars, start, i);
  45865. start = -1;
  45866. }
  45867. } else if (start < 0) {
  45868. start = i;
  45869. }
  45870. }
  45871. if (start >= 0) {
  45872. reverseValues(chars, start, levels.length);
  45873. }
  45874. }
  45875. for (i = 0, ii = chars.length; i < ii; ++i) {
  45876. const ch = chars[i];
  45877. if (ch === "<" || ch === ">") {
  45878. chars[i] = "";
  45879. }
  45880. }
  45881. return createBidiText(chars.join(""), isLTR);
  45882. }
  45883. /***/ }),
  45884. /* 61 */
  45885. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45886. Object.defineProperty(exports, "__esModule", ({
  45887. value: true
  45888. }));
  45889. exports.MurmurHash3_64 = void 0;
  45890. var _util = __w_pdfjs_require__(2);
  45891. const SEED = 0xc3d2e1f0;
  45892. const MASK_HIGH = 0xffff0000;
  45893. const MASK_LOW = 0xffff;
  45894. class MurmurHash3_64 {
  45895. constructor(seed) {
  45896. this.h1 = seed ? seed & 0xffffffff : SEED;
  45897. this.h2 = seed ? seed & 0xffffffff : SEED;
  45898. }
  45899. update(input) {
  45900. let data, length;
  45901. if (typeof input === "string") {
  45902. data = new Uint8Array(input.length * 2);
  45903. length = 0;
  45904. for (let i = 0, ii = input.length; i < ii; i++) {
  45905. const code = input.charCodeAt(i);
  45906. if (code <= 0xff) {
  45907. data[length++] = code;
  45908. } else {
  45909. data[length++] = code >>> 8;
  45910. data[length++] = code & 0xff;
  45911. }
  45912. }
  45913. } else if ((0, _util.isArrayBuffer)(input)) {
  45914. data = input.slice();
  45915. length = data.byteLength;
  45916. } else {
  45917. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  45918. }
  45919. const blockCounts = length >> 2;
  45920. const tailLength = length - blockCounts * 4;
  45921. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  45922. let k1 = 0,
  45923. k2 = 0;
  45924. let h1 = this.h1,
  45925. h2 = this.h2;
  45926. const C1 = 0xcc9e2d51,
  45927. C2 = 0x1b873593;
  45928. const C1_LOW = C1 & MASK_LOW,
  45929. C2_LOW = C2 & MASK_LOW;
  45930. for (let i = 0; i < blockCounts; i++) {
  45931. if (i & 1) {
  45932. k1 = dataUint32[i];
  45933. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45934. k1 = k1 << 15 | k1 >>> 17;
  45935. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45936. h1 ^= k1;
  45937. h1 = h1 << 13 | h1 >>> 19;
  45938. h1 = h1 * 5 + 0xe6546b64;
  45939. } else {
  45940. k2 = dataUint32[i];
  45941. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  45942. k2 = k2 << 15 | k2 >>> 17;
  45943. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  45944. h2 ^= k2;
  45945. h2 = h2 << 13 | h2 >>> 19;
  45946. h2 = h2 * 5 + 0xe6546b64;
  45947. }
  45948. }
  45949. k1 = 0;
  45950. switch (tailLength) {
  45951. case 3:
  45952. k1 ^= data[blockCounts * 4 + 2] << 16;
  45953. case 2:
  45954. k1 ^= data[blockCounts * 4 + 1] << 8;
  45955. case 1:
  45956. k1 ^= data[blockCounts * 4];
  45957. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45958. k1 = k1 << 15 | k1 >>> 17;
  45959. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45960. if (blockCounts & 1) {
  45961. h1 ^= k1;
  45962. } else {
  45963. h2 ^= k1;
  45964. }
  45965. }
  45966. this.h1 = h1;
  45967. this.h2 = h2;
  45968. }
  45969. hexdigest() {
  45970. let h1 = this.h1,
  45971. h2 = this.h2;
  45972. h1 ^= h2 >>> 1;
  45973. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  45974. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  45975. h1 ^= h2 >>> 1;
  45976. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  45977. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  45978. h1 ^= h2 >>> 1;
  45979. const hex1 = (h1 >>> 0).toString(16),
  45980. hex2 = (h2 >>> 0).toString(16);
  45981. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  45982. }
  45983. }
  45984. exports.MurmurHash3_64 = MurmurHash3_64;
  45985. /***/ }),
  45986. /* 62 */
  45987. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45988. Object.defineProperty(exports, "__esModule", ({
  45989. value: true
  45990. }));
  45991. exports.OperatorList = void 0;
  45992. var _util = __w_pdfjs_require__(2);
  45993. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  45994. let state = parentState;
  45995. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  45996. const item = pattern[i];
  45997. state = state[item] || (state[item] = []);
  45998. }
  45999. state[pattern.at(-1)] = {
  46000. checkFn,
  46001. iterateFn,
  46002. processFn
  46003. };
  46004. }
  46005. const InitialState = [];
  46006. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  46007. const fnArray = context.fnArray;
  46008. const iFirstSave = context.iCurr - 3;
  46009. const pos = (i - iFirstSave) % 4;
  46010. switch (pos) {
  46011. case 0:
  46012. return fnArray[i] === _util.OPS.save;
  46013. case 1:
  46014. return fnArray[i] === _util.OPS.transform;
  46015. case 2:
  46016. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  46017. case 3:
  46018. return fnArray[i] === _util.OPS.restore;
  46019. }
  46020. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  46021. }, function foundInlineImageGroup(context, i) {
  46022. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  46023. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  46024. const MAX_WIDTH = 1000;
  46025. const IMAGE_PADDING = 1;
  46026. const fnArray = context.fnArray,
  46027. argsArray = context.argsArray;
  46028. const curr = context.iCurr;
  46029. const iFirstSave = curr - 3;
  46030. const iFirstTransform = curr - 2;
  46031. const iFirstPIIXO = curr - 1;
  46032. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  46033. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  46034. return i - (i - iFirstSave) % 4;
  46035. }
  46036. let maxX = 0;
  46037. const map = [];
  46038. let maxLineHeight = 0;
  46039. let currentX = IMAGE_PADDING,
  46040. currentY = IMAGE_PADDING;
  46041. for (let q = 0; q < count; q++) {
  46042. const transform = argsArray[iFirstTransform + (q << 2)];
  46043. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  46044. if (currentX + img.width > MAX_WIDTH) {
  46045. maxX = Math.max(maxX, currentX);
  46046. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  46047. currentX = 0;
  46048. maxLineHeight = 0;
  46049. }
  46050. map.push({
  46051. transform,
  46052. x: currentX,
  46053. y: currentY,
  46054. w: img.width,
  46055. h: img.height
  46056. });
  46057. currentX += img.width + 2 * IMAGE_PADDING;
  46058. maxLineHeight = Math.max(maxLineHeight, img.height);
  46059. }
  46060. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  46061. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  46062. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  46063. const imgRowSize = imgWidth << 2;
  46064. for (let q = 0; q < count; q++) {
  46065. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  46066. const rowSize = map[q].w << 2;
  46067. let dataOffset = 0;
  46068. let offset = map[q].x + map[q].y * imgWidth << 2;
  46069. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  46070. for (let k = 0, kk = map[q].h; k < kk; k++) {
  46071. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  46072. dataOffset += rowSize;
  46073. offset += imgRowSize;
  46074. }
  46075. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  46076. while (offset >= 0) {
  46077. data[offset - 4] = data[offset];
  46078. data[offset - 3] = data[offset + 1];
  46079. data[offset - 2] = data[offset + 2];
  46080. data[offset - 1] = data[offset + 3];
  46081. data[offset + rowSize] = data[offset + rowSize - 4];
  46082. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  46083. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  46084. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  46085. offset -= imgRowSize;
  46086. }
  46087. }
  46088. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  46089. argsArray.splice(iFirstSave, count * 4, [{
  46090. width: imgWidth,
  46091. height: imgHeight,
  46092. kind: _util.ImageKind.RGBA_32BPP,
  46093. data: imgData
  46094. }, map]);
  46095. return iFirstSave + 1;
  46096. });
  46097. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  46098. const fnArray = context.fnArray;
  46099. const iFirstSave = context.iCurr - 3;
  46100. const pos = (i - iFirstSave) % 4;
  46101. switch (pos) {
  46102. case 0:
  46103. return fnArray[i] === _util.OPS.save;
  46104. case 1:
  46105. return fnArray[i] === _util.OPS.transform;
  46106. case 2:
  46107. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  46108. case 3:
  46109. return fnArray[i] === _util.OPS.restore;
  46110. }
  46111. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  46112. }, function foundImageMaskGroup(context, i) {
  46113. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  46114. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  46115. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  46116. const fnArray = context.fnArray,
  46117. argsArray = context.argsArray;
  46118. const curr = context.iCurr;
  46119. const iFirstSave = curr - 3;
  46120. const iFirstTransform = curr - 2;
  46121. const iFirstPIMXO = curr - 1;
  46122. let count = Math.floor((i - iFirstSave) / 4);
  46123. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  46124. return i - (i - iFirstSave) % 4;
  46125. }
  46126. let isSameImage = false;
  46127. let iTransform, transformArgs;
  46128. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  46129. const firstTransformArg0 = argsArray[iFirstTransform][0],
  46130. firstTransformArg1 = argsArray[iFirstTransform][1],
  46131. firstTransformArg2 = argsArray[iFirstTransform][2],
  46132. firstTransformArg3 = argsArray[iFirstTransform][3];
  46133. if (firstTransformArg1 === firstTransformArg2) {
  46134. isSameImage = true;
  46135. iTransform = iFirstTransform + 4;
  46136. let iPIMXO = iFirstPIMXO + 4;
  46137. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  46138. transformArgs = argsArray[iTransform];
  46139. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  46140. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  46141. isSameImage = false;
  46142. } else {
  46143. count = q;
  46144. }
  46145. break;
  46146. }
  46147. }
  46148. }
  46149. if (isSameImage) {
  46150. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  46151. const positions = new Float32Array(count * 2);
  46152. iTransform = iFirstTransform;
  46153. for (let q = 0; q < count; q++, iTransform += 4) {
  46154. transformArgs = argsArray[iTransform];
  46155. positions[q << 1] = transformArgs[4];
  46156. positions[(q << 1) + 1] = transformArgs[5];
  46157. }
  46158. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  46159. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  46160. } else {
  46161. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  46162. const images = [];
  46163. for (let q = 0; q < count; q++) {
  46164. transformArgs = argsArray[iFirstTransform + (q << 2)];
  46165. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  46166. images.push({
  46167. data: maskParams.data,
  46168. width: maskParams.width,
  46169. height: maskParams.height,
  46170. interpolate: maskParams.interpolate,
  46171. count: maskParams.count,
  46172. transform: transformArgs
  46173. });
  46174. }
  46175. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  46176. argsArray.splice(iFirstSave, count * 4, [images]);
  46177. }
  46178. return iFirstSave + 1;
  46179. });
  46180. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  46181. const argsArray = context.argsArray;
  46182. const iFirstTransform = context.iCurr - 2;
  46183. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  46184. }, function iterateImageGroup(context, i) {
  46185. const fnArray = context.fnArray,
  46186. argsArray = context.argsArray;
  46187. const iFirstSave = context.iCurr - 3;
  46188. const pos = (i - iFirstSave) % 4;
  46189. switch (pos) {
  46190. case 0:
  46191. return fnArray[i] === _util.OPS.save;
  46192. case 1:
  46193. if (fnArray[i] !== _util.OPS.transform) {
  46194. return false;
  46195. }
  46196. const iFirstTransform = context.iCurr - 2;
  46197. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46198. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46199. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  46200. return false;
  46201. }
  46202. return true;
  46203. case 2:
  46204. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  46205. return false;
  46206. }
  46207. const iFirstPIXO = context.iCurr - 1;
  46208. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46209. if (argsArray[i][0] !== firstPIXOArg0) {
  46210. return false;
  46211. }
  46212. return true;
  46213. case 3:
  46214. return fnArray[i] === _util.OPS.restore;
  46215. }
  46216. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  46217. }, function (context, i) {
  46218. const MIN_IMAGES_IN_BLOCK = 3;
  46219. const MAX_IMAGES_IN_BLOCK = 1000;
  46220. const fnArray = context.fnArray,
  46221. argsArray = context.argsArray;
  46222. const curr = context.iCurr;
  46223. const iFirstSave = curr - 3;
  46224. const iFirstTransform = curr - 2;
  46225. const iFirstPIXO = curr - 1;
  46226. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46227. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46228. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46229. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  46230. if (count < MIN_IMAGES_IN_BLOCK) {
  46231. return i - (i - iFirstSave) % 4;
  46232. }
  46233. const positions = new Float32Array(count * 2);
  46234. let iTransform = iFirstTransform;
  46235. for (let q = 0; q < count; q++, iTransform += 4) {
  46236. const transformArgs = argsArray[iTransform];
  46237. positions[q << 1] = transformArgs[4];
  46238. positions[(q << 1) + 1] = transformArgs[5];
  46239. }
  46240. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  46241. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  46242. argsArray.splice(iFirstSave, count * 4, args);
  46243. return iFirstSave + 1;
  46244. });
  46245. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  46246. const fnArray = context.fnArray,
  46247. argsArray = context.argsArray;
  46248. const iFirstSave = context.iCurr - 4;
  46249. const pos = (i - iFirstSave) % 5;
  46250. switch (pos) {
  46251. case 0:
  46252. return fnArray[i] === _util.OPS.beginText;
  46253. case 1:
  46254. return fnArray[i] === _util.OPS.setFont;
  46255. case 2:
  46256. return fnArray[i] === _util.OPS.setTextMatrix;
  46257. case 3:
  46258. if (fnArray[i] !== _util.OPS.showText) {
  46259. return false;
  46260. }
  46261. const iFirstSetFont = context.iCurr - 3;
  46262. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46263. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46264. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  46265. return false;
  46266. }
  46267. return true;
  46268. case 4:
  46269. return fnArray[i] === _util.OPS.endText;
  46270. }
  46271. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  46272. }, function (context, i) {
  46273. const MIN_CHARS_IN_BLOCK = 3;
  46274. const MAX_CHARS_IN_BLOCK = 1000;
  46275. const fnArray = context.fnArray,
  46276. argsArray = context.argsArray;
  46277. const curr = context.iCurr;
  46278. const iFirstBeginText = curr - 4;
  46279. const iFirstSetFont = curr - 3;
  46280. const iFirstSetTextMatrix = curr - 2;
  46281. const iFirstShowText = curr - 1;
  46282. const iFirstEndText = curr;
  46283. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46284. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46285. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  46286. if (count < MIN_CHARS_IN_BLOCK) {
  46287. return i - (i - iFirstBeginText) % 5;
  46288. }
  46289. let iFirst = iFirstBeginText;
  46290. 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) {
  46291. count++;
  46292. iFirst -= 5;
  46293. }
  46294. let iEndText = iFirst + 4;
  46295. for (let q = 1; q < count; q++) {
  46296. fnArray.splice(iEndText, 3);
  46297. argsArray.splice(iEndText, 3);
  46298. iEndText += 2;
  46299. }
  46300. return iEndText + 1;
  46301. });
  46302. class NullOptimizer {
  46303. constructor(queue) {
  46304. this.queue = queue;
  46305. }
  46306. _optimize() {}
  46307. push(fn, args) {
  46308. this.queue.fnArray.push(fn);
  46309. this.queue.argsArray.push(args);
  46310. this._optimize();
  46311. }
  46312. flush() {}
  46313. reset() {}
  46314. }
  46315. class QueueOptimizer extends NullOptimizer {
  46316. constructor(queue) {
  46317. super(queue);
  46318. this.state = null;
  46319. this.context = {
  46320. iCurr: 0,
  46321. fnArray: queue.fnArray,
  46322. argsArray: queue.argsArray
  46323. };
  46324. this.match = null;
  46325. this.lastProcessed = 0;
  46326. }
  46327. _optimize() {
  46328. const fnArray = this.queue.fnArray;
  46329. let i = this.lastProcessed,
  46330. ii = fnArray.length;
  46331. let state = this.state;
  46332. let match = this.match;
  46333. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  46334. this.lastProcessed = ii;
  46335. return;
  46336. }
  46337. const context = this.context;
  46338. while (i < ii) {
  46339. if (match) {
  46340. const iterate = (0, match.iterateFn)(context, i);
  46341. if (iterate) {
  46342. i++;
  46343. continue;
  46344. }
  46345. i = (0, match.processFn)(context, i + 1);
  46346. ii = fnArray.length;
  46347. match = null;
  46348. state = null;
  46349. if (i >= ii) {
  46350. break;
  46351. }
  46352. }
  46353. state = (state || InitialState)[fnArray[i]];
  46354. if (!state || Array.isArray(state)) {
  46355. i++;
  46356. continue;
  46357. }
  46358. context.iCurr = i;
  46359. i++;
  46360. if (state.checkFn && !(0, state.checkFn)(context)) {
  46361. state = null;
  46362. continue;
  46363. }
  46364. match = state;
  46365. state = null;
  46366. }
  46367. this.state = state;
  46368. this.match = match;
  46369. this.lastProcessed = i;
  46370. }
  46371. flush() {
  46372. while (this.match) {
  46373. const length = this.queue.fnArray.length;
  46374. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  46375. this.match = null;
  46376. this.state = null;
  46377. this._optimize();
  46378. }
  46379. }
  46380. reset() {
  46381. this.state = null;
  46382. this.match = null;
  46383. this.lastProcessed = 0;
  46384. }
  46385. }
  46386. class OperatorList {
  46387. static get CHUNK_SIZE() {
  46388. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  46389. }
  46390. static get CHUNK_SIZE_ABOUT() {
  46391. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  46392. }
  46393. constructor(intent = 0, streamSink) {
  46394. this._streamSink = streamSink;
  46395. this.fnArray = [];
  46396. this.argsArray = [];
  46397. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  46398. this.optimizer = new QueueOptimizer(this);
  46399. } else {
  46400. this.optimizer = new NullOptimizer(this);
  46401. }
  46402. this.dependencies = new Set();
  46403. this._totalLength = 0;
  46404. this.weight = 0;
  46405. this._resolved = streamSink ? null : Promise.resolve();
  46406. }
  46407. get length() {
  46408. return this.argsArray.length;
  46409. }
  46410. get ready() {
  46411. return this._resolved || this._streamSink.ready;
  46412. }
  46413. get totalLength() {
  46414. return this._totalLength + this.length;
  46415. }
  46416. addOp(fn, args) {
  46417. this.optimizer.push(fn, args);
  46418. this.weight++;
  46419. if (this._streamSink) {
  46420. if (this.weight >= OperatorList.CHUNK_SIZE) {
  46421. this.flush();
  46422. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  46423. this.flush();
  46424. }
  46425. }
  46426. }
  46427. addImageOps(fn, args, optionalContent) {
  46428. if (optionalContent !== undefined) {
  46429. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  46430. }
  46431. this.addOp(fn, args);
  46432. if (optionalContent !== undefined) {
  46433. this.addOp(_util.OPS.endMarkedContent, []);
  46434. }
  46435. }
  46436. addDependency(dependency) {
  46437. if (this.dependencies.has(dependency)) {
  46438. return;
  46439. }
  46440. this.dependencies.add(dependency);
  46441. this.addOp(_util.OPS.dependency, [dependency]);
  46442. }
  46443. addDependencies(dependencies) {
  46444. for (const dependency of dependencies) {
  46445. this.addDependency(dependency);
  46446. }
  46447. }
  46448. addOpList(opList) {
  46449. if (!(opList instanceof OperatorList)) {
  46450. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  46451. return;
  46452. }
  46453. for (const dependency of opList.dependencies) {
  46454. this.dependencies.add(dependency);
  46455. }
  46456. for (let i = 0, ii = opList.length; i < ii; i++) {
  46457. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  46458. }
  46459. }
  46460. getIR() {
  46461. return {
  46462. fnArray: this.fnArray,
  46463. argsArray: this.argsArray,
  46464. length: this.length
  46465. };
  46466. }
  46467. get _transfers() {
  46468. const transfers = [];
  46469. const {
  46470. fnArray,
  46471. argsArray,
  46472. length
  46473. } = this;
  46474. for (let i = 0; i < length; i++) {
  46475. switch (fnArray[i]) {
  46476. case _util.OPS.paintInlineImageXObject:
  46477. case _util.OPS.paintInlineImageXObjectGroup:
  46478. case _util.OPS.paintImageMaskXObject:
  46479. const arg = argsArray[i][0];
  46480. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  46481. transfers.push(arg.data.buffer);
  46482. }
  46483. break;
  46484. }
  46485. }
  46486. return transfers;
  46487. }
  46488. flush(lastChunk = false, separateAnnots = null) {
  46489. this.optimizer.flush();
  46490. const length = this.length;
  46491. this._totalLength += length;
  46492. this._streamSink.enqueue({
  46493. fnArray: this.fnArray,
  46494. argsArray: this.argsArray,
  46495. lastChunk,
  46496. separateAnnots,
  46497. length
  46498. }, 1, this._transfers);
  46499. this.dependencies.clear();
  46500. this.fnArray.length = 0;
  46501. this.argsArray.length = 0;
  46502. this.weight = 0;
  46503. this.optimizer.reset();
  46504. }
  46505. }
  46506. exports.OperatorList = OperatorList;
  46507. /***/ }),
  46508. /* 63 */
  46509. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46510. Object.defineProperty(exports, "__esModule", ({
  46511. value: true
  46512. }));
  46513. exports.PDFImage = void 0;
  46514. var _util = __w_pdfjs_require__(2);
  46515. var _image_utils = __w_pdfjs_require__(64);
  46516. var _base_stream = __w_pdfjs_require__(7);
  46517. var _colorspace = __w_pdfjs_require__(14);
  46518. var _decode_stream = __w_pdfjs_require__(19);
  46519. var _jpeg_stream = __w_pdfjs_require__(27);
  46520. var _jpx = __w_pdfjs_require__(30);
  46521. var _primitives = __w_pdfjs_require__(5);
  46522. function decodeAndClamp(value, addend, coefficient, max) {
  46523. value = addend + value * coefficient;
  46524. if (value < 0) {
  46525. value = 0;
  46526. } else if (value > max) {
  46527. value = max;
  46528. }
  46529. return value;
  46530. }
  46531. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  46532. const length = w2 * h2;
  46533. let dest;
  46534. if (bpc <= 8) {
  46535. dest = new Uint8Array(length);
  46536. } else if (bpc <= 16) {
  46537. dest = new Uint16Array(length);
  46538. } else {
  46539. dest = new Uint32Array(length);
  46540. }
  46541. const xRatio = w1 / w2;
  46542. const yRatio = h1 / h2;
  46543. let i,
  46544. j,
  46545. py,
  46546. newIndex = 0,
  46547. oldIndex;
  46548. const xScaled = new Uint16Array(w2);
  46549. const w1Scanline = w1;
  46550. for (i = 0; i < w2; i++) {
  46551. xScaled[i] = Math.floor(i * xRatio);
  46552. }
  46553. for (i = 0; i < h2; i++) {
  46554. py = Math.floor(i * yRatio) * w1Scanline;
  46555. for (j = 0; j < w2; j++) {
  46556. oldIndex = py + xScaled[j];
  46557. dest[newIndex++] = src[oldIndex];
  46558. }
  46559. }
  46560. return dest;
  46561. }
  46562. class PDFImage {
  46563. constructor({
  46564. xref,
  46565. res,
  46566. image,
  46567. isInline = false,
  46568. smask = null,
  46569. mask = null,
  46570. isMask = false,
  46571. pdfFunctionFactory,
  46572. localColorSpaceCache
  46573. }) {
  46574. this.image = image;
  46575. const dict = image.dict;
  46576. const filter = dict.get("F", "Filter");
  46577. let filterName;
  46578. if (filter instanceof _primitives.Name) {
  46579. filterName = filter.name;
  46580. } else if (Array.isArray(filter)) {
  46581. const filterZero = xref.fetchIfRef(filter[0]);
  46582. if (filterZero instanceof _primitives.Name) {
  46583. filterName = filterZero.name;
  46584. }
  46585. }
  46586. switch (filterName) {
  46587. case "JPXDecode":
  46588. const jpxImage = new _jpx.JpxImage();
  46589. jpxImage.parseImageProperties(image.stream);
  46590. image.stream.reset();
  46591. image.width = jpxImage.width;
  46592. image.height = jpxImage.height;
  46593. image.bitsPerComponent = jpxImage.bitsPerComponent;
  46594. image.numComps = jpxImage.componentsCount;
  46595. break;
  46596. case "JBIG2Decode":
  46597. image.bitsPerComponent = 1;
  46598. image.numComps = 1;
  46599. break;
  46600. }
  46601. let width = dict.get("W", "Width");
  46602. let height = dict.get("H", "Height");
  46603. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  46604. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  46605. width = image.width;
  46606. height = image.height;
  46607. }
  46608. if (width < 1 || height < 1) {
  46609. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  46610. }
  46611. this.width = width;
  46612. this.height = height;
  46613. this.interpolate = dict.get("I", "Interpolate");
  46614. this.imageMask = dict.get("IM", "ImageMask") || false;
  46615. this.matte = dict.get("Matte") || false;
  46616. let bitsPerComponent = image.bitsPerComponent;
  46617. if (!bitsPerComponent) {
  46618. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  46619. if (!bitsPerComponent) {
  46620. if (this.imageMask) {
  46621. bitsPerComponent = 1;
  46622. } else {
  46623. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  46624. }
  46625. }
  46626. }
  46627. this.bpc = bitsPerComponent;
  46628. if (!this.imageMask) {
  46629. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  46630. if (!colorSpace) {
  46631. (0, _util.info)("JPX images (which do not require color spaces)");
  46632. switch (image.numComps) {
  46633. case 1:
  46634. colorSpace = _primitives.Name.get("DeviceGray");
  46635. break;
  46636. case 3:
  46637. colorSpace = _primitives.Name.get("DeviceRGB");
  46638. break;
  46639. case 4:
  46640. colorSpace = _primitives.Name.get("DeviceCMYK");
  46641. break;
  46642. default:
  46643. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  46644. }
  46645. }
  46646. this.colorSpace = _colorspace.ColorSpace.parse({
  46647. cs: colorSpace,
  46648. xref,
  46649. resources: isInline ? res : null,
  46650. pdfFunctionFactory,
  46651. localColorSpaceCache
  46652. });
  46653. this.numComps = this.colorSpace.numComps;
  46654. }
  46655. this.decode = dict.getArray("D", "Decode");
  46656. this.needsDecode = false;
  46657. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  46658. this.needsDecode = true;
  46659. const max = (1 << bitsPerComponent) - 1;
  46660. this.decodeCoefficients = [];
  46661. this.decodeAddends = [];
  46662. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  46663. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  46664. const dmin = this.decode[i];
  46665. const dmax = this.decode[i + 1];
  46666. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  46667. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  46668. }
  46669. }
  46670. if (smask) {
  46671. this.smask = new PDFImage({
  46672. xref,
  46673. res,
  46674. image: smask,
  46675. isInline,
  46676. pdfFunctionFactory,
  46677. localColorSpaceCache
  46678. });
  46679. } else if (mask) {
  46680. if (mask instanceof _base_stream.BaseStream) {
  46681. const maskDict = mask.dict,
  46682. imageMask = maskDict.get("IM", "ImageMask");
  46683. if (!imageMask) {
  46684. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  46685. } else {
  46686. this.mask = new PDFImage({
  46687. xref,
  46688. res,
  46689. image: mask,
  46690. isInline,
  46691. isMask: true,
  46692. pdfFunctionFactory,
  46693. localColorSpaceCache
  46694. });
  46695. }
  46696. } else {
  46697. this.mask = mask;
  46698. }
  46699. }
  46700. }
  46701. static async buildImage({
  46702. xref,
  46703. res,
  46704. image,
  46705. isInline = false,
  46706. pdfFunctionFactory,
  46707. localColorSpaceCache
  46708. }) {
  46709. const imageData = image;
  46710. let smaskData = null;
  46711. let maskData = null;
  46712. const smask = image.dict.get("SMask");
  46713. const mask = image.dict.get("Mask");
  46714. if (smask) {
  46715. if (smask instanceof _base_stream.BaseStream) {
  46716. smaskData = smask;
  46717. } else {
  46718. (0, _util.warn)("Unsupported /SMask format.");
  46719. }
  46720. } else if (mask) {
  46721. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  46722. maskData = mask;
  46723. } else {
  46724. (0, _util.warn)("Unsupported /Mask format.");
  46725. }
  46726. }
  46727. return new PDFImage({
  46728. xref,
  46729. res,
  46730. image: imageData,
  46731. isInline,
  46732. smask: smaskData,
  46733. mask: maskData,
  46734. pdfFunctionFactory,
  46735. localColorSpaceCache
  46736. });
  46737. }
  46738. static createRawMask({
  46739. imgArray,
  46740. width,
  46741. height,
  46742. imageIsFromDecodeStream,
  46743. inverseDecode,
  46744. interpolate
  46745. }) {
  46746. const computedLength = (width + 7 >> 3) * height;
  46747. const actualLength = imgArray.byteLength;
  46748. const haveFullData = computedLength === actualLength;
  46749. let data, i;
  46750. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  46751. data = imgArray;
  46752. } else if (!inverseDecode) {
  46753. data = new Uint8Array(imgArray);
  46754. } else {
  46755. data = new Uint8Array(computedLength);
  46756. data.set(imgArray);
  46757. data.fill(0xff, actualLength);
  46758. }
  46759. if (inverseDecode) {
  46760. for (i = 0; i < actualLength; i++) {
  46761. data[i] ^= 0xff;
  46762. }
  46763. }
  46764. return {
  46765. data,
  46766. width,
  46767. height,
  46768. interpolate
  46769. };
  46770. }
  46771. static createMask({
  46772. imgArray,
  46773. width,
  46774. height,
  46775. imageIsFromDecodeStream,
  46776. inverseDecode,
  46777. interpolate
  46778. }) {
  46779. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  46780. if (isSingleOpaquePixel) {
  46781. return {
  46782. isSingleOpaquePixel
  46783. };
  46784. }
  46785. if (_util.FeatureTest.isOffscreenCanvasSupported) {
  46786. const canvas = new OffscreenCanvas(width, height);
  46787. const ctx = canvas.getContext("2d");
  46788. const imgData = ctx.createImageData(width, height);
  46789. (0, _image_utils.applyMaskImageData)({
  46790. src: imgArray,
  46791. dest: imgData.data,
  46792. width,
  46793. height,
  46794. inverseDecode
  46795. });
  46796. ctx.putImageData(imgData, 0, 0);
  46797. const bitmap = canvas.transferToImageBitmap();
  46798. return {
  46799. data: null,
  46800. width,
  46801. height,
  46802. interpolate,
  46803. bitmap
  46804. };
  46805. }
  46806. return this.createRawMask({
  46807. imgArray,
  46808. width,
  46809. height,
  46810. inverseDecode,
  46811. imageIsFromDecodeStream,
  46812. interpolate
  46813. });
  46814. }
  46815. get drawWidth() {
  46816. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  46817. }
  46818. get drawHeight() {
  46819. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  46820. }
  46821. decodeBuffer(buffer) {
  46822. const bpc = this.bpc;
  46823. const numComps = this.numComps;
  46824. const decodeAddends = this.decodeAddends;
  46825. const decodeCoefficients = this.decodeCoefficients;
  46826. const max = (1 << bpc) - 1;
  46827. let i, ii;
  46828. if (bpc === 1) {
  46829. for (i = 0, ii = buffer.length; i < ii; i++) {
  46830. buffer[i] = +!buffer[i];
  46831. }
  46832. return;
  46833. }
  46834. let index = 0;
  46835. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  46836. for (let j = 0; j < numComps; j++) {
  46837. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  46838. index++;
  46839. }
  46840. }
  46841. }
  46842. getComponents(buffer) {
  46843. const bpc = this.bpc;
  46844. if (bpc === 8) {
  46845. return buffer;
  46846. }
  46847. const width = this.width;
  46848. const height = this.height;
  46849. const numComps = this.numComps;
  46850. const length = width * height * numComps;
  46851. let bufferPos = 0;
  46852. let output;
  46853. if (bpc <= 8) {
  46854. output = new Uint8Array(length);
  46855. } else if (bpc <= 16) {
  46856. output = new Uint16Array(length);
  46857. } else {
  46858. output = new Uint32Array(length);
  46859. }
  46860. const rowComps = width * numComps;
  46861. const max = (1 << bpc) - 1;
  46862. let i = 0,
  46863. ii,
  46864. buf;
  46865. if (bpc === 1) {
  46866. let mask, loop1End, loop2End;
  46867. for (let j = 0; j < height; j++) {
  46868. loop1End = i + (rowComps & ~7);
  46869. loop2End = i + rowComps;
  46870. while (i < loop1End) {
  46871. buf = buffer[bufferPos++];
  46872. output[i] = buf >> 7 & 1;
  46873. output[i + 1] = buf >> 6 & 1;
  46874. output[i + 2] = buf >> 5 & 1;
  46875. output[i + 3] = buf >> 4 & 1;
  46876. output[i + 4] = buf >> 3 & 1;
  46877. output[i + 5] = buf >> 2 & 1;
  46878. output[i + 6] = buf >> 1 & 1;
  46879. output[i + 7] = buf & 1;
  46880. i += 8;
  46881. }
  46882. if (i < loop2End) {
  46883. buf = buffer[bufferPos++];
  46884. mask = 128;
  46885. while (i < loop2End) {
  46886. output[i++] = +!!(buf & mask);
  46887. mask >>= 1;
  46888. }
  46889. }
  46890. }
  46891. } else {
  46892. let bits = 0;
  46893. buf = 0;
  46894. for (i = 0, ii = length; i < ii; ++i) {
  46895. if (i % rowComps === 0) {
  46896. buf = 0;
  46897. bits = 0;
  46898. }
  46899. while (bits < bpc) {
  46900. buf = buf << 8 | buffer[bufferPos++];
  46901. bits += 8;
  46902. }
  46903. const remainingBits = bits - bpc;
  46904. let value = buf >> remainingBits;
  46905. if (value < 0) {
  46906. value = 0;
  46907. } else if (value > max) {
  46908. value = max;
  46909. }
  46910. output[i] = value;
  46911. buf &= (1 << remainingBits) - 1;
  46912. bits = remainingBits;
  46913. }
  46914. }
  46915. return output;
  46916. }
  46917. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  46918. const smask = this.smask;
  46919. const mask = this.mask;
  46920. let alphaBuf, sw, sh, i, ii, j;
  46921. if (smask) {
  46922. sw = smask.width;
  46923. sh = smask.height;
  46924. alphaBuf = new Uint8ClampedArray(sw * sh);
  46925. smask.fillGrayBuffer(alphaBuf);
  46926. if (sw !== width || sh !== height) {
  46927. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  46928. }
  46929. } else if (mask) {
  46930. if (mask instanceof PDFImage) {
  46931. sw = mask.width;
  46932. sh = mask.height;
  46933. alphaBuf = new Uint8ClampedArray(sw * sh);
  46934. mask.numComps = 1;
  46935. mask.fillGrayBuffer(alphaBuf);
  46936. for (i = 0, ii = sw * sh; i < ii; ++i) {
  46937. alphaBuf[i] = 255 - alphaBuf[i];
  46938. }
  46939. if (sw !== width || sh !== height) {
  46940. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  46941. }
  46942. } else if (Array.isArray(mask)) {
  46943. alphaBuf = new Uint8ClampedArray(width * height);
  46944. const numComps = this.numComps;
  46945. for (i = 0, ii = width * height; i < ii; ++i) {
  46946. let opacity = 0;
  46947. const imageOffset = i * numComps;
  46948. for (j = 0; j < numComps; ++j) {
  46949. const color = image[imageOffset + j];
  46950. const maskOffset = j * 2;
  46951. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  46952. opacity = 255;
  46953. break;
  46954. }
  46955. }
  46956. alphaBuf[i] = opacity;
  46957. }
  46958. } else {
  46959. throw new _util.FormatError("Unknown mask format.");
  46960. }
  46961. }
  46962. if (alphaBuf) {
  46963. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46964. rgbaBuf[j] = alphaBuf[i];
  46965. }
  46966. } else {
  46967. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46968. rgbaBuf[j] = 255;
  46969. }
  46970. }
  46971. }
  46972. undoPreblend(buffer, width, height) {
  46973. const matte = this.smask && this.smask.matte;
  46974. if (!matte) {
  46975. return;
  46976. }
  46977. const matteRgb = this.colorSpace.getRgb(matte, 0);
  46978. const matteR = matteRgb[0];
  46979. const matteG = matteRgb[1];
  46980. const matteB = matteRgb[2];
  46981. const length = width * height * 4;
  46982. for (let i = 0; i < length; i += 4) {
  46983. const alpha = buffer[i + 3];
  46984. if (alpha === 0) {
  46985. buffer[i] = 255;
  46986. buffer[i + 1] = 255;
  46987. buffer[i + 2] = 255;
  46988. continue;
  46989. }
  46990. const k = 255 / alpha;
  46991. buffer[i] = (buffer[i] - matteR) * k + matteR;
  46992. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  46993. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  46994. }
  46995. }
  46996. createImageData(forceRGBA = false) {
  46997. const drawWidth = this.drawWidth;
  46998. const drawHeight = this.drawHeight;
  46999. const imgData = {
  47000. width: drawWidth,
  47001. height: drawHeight,
  47002. interpolate: this.interpolate,
  47003. kind: 0,
  47004. data: null
  47005. };
  47006. const numComps = this.numComps;
  47007. const originalWidth = this.width;
  47008. const originalHeight = this.height;
  47009. const bpc = this.bpc;
  47010. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  47011. if (!forceRGBA) {
  47012. let kind;
  47013. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  47014. kind = _util.ImageKind.GRAYSCALE_1BPP;
  47015. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  47016. kind = _util.ImageKind.RGB_24BPP;
  47017. }
  47018. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  47019. imgData.kind = kind;
  47020. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  47021. if (this.needsDecode) {
  47022. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  47023. const buffer = imgData.data;
  47024. for (let i = 0, ii = buffer.length; i < ii; i++) {
  47025. buffer[i] ^= 0xff;
  47026. }
  47027. }
  47028. return imgData;
  47029. }
  47030. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  47031. let imageLength = originalHeight * rowBytes;
  47032. switch (this.colorSpace.name) {
  47033. case "DeviceGray":
  47034. imageLength *= 3;
  47035. case "DeviceRGB":
  47036. case "DeviceCMYK":
  47037. imgData.kind = _util.ImageKind.RGB_24BPP;
  47038. imgData.data = this.getImageBytes(imageLength, {
  47039. drawWidth,
  47040. drawHeight,
  47041. forceRGB: true
  47042. });
  47043. return imgData;
  47044. }
  47045. }
  47046. }
  47047. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  47048. internal: true
  47049. });
  47050. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  47051. const comps = this.getComponents(imgArray);
  47052. let alpha01, maybeUndoPreblend;
  47053. if (!forceRGBA && !this.smask && !this.mask) {
  47054. imgData.kind = _util.ImageKind.RGB_24BPP;
  47055. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  47056. alpha01 = 0;
  47057. maybeUndoPreblend = false;
  47058. } else {
  47059. imgData.kind = _util.ImageKind.RGBA_32BPP;
  47060. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  47061. alpha01 = 1;
  47062. maybeUndoPreblend = true;
  47063. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  47064. }
  47065. if (this.needsDecode) {
  47066. this.decodeBuffer(comps);
  47067. }
  47068. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  47069. if (maybeUndoPreblend) {
  47070. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  47071. }
  47072. return imgData;
  47073. }
  47074. fillGrayBuffer(buffer) {
  47075. const numComps = this.numComps;
  47076. if (numComps !== 1) {
  47077. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  47078. }
  47079. const width = this.width;
  47080. const height = this.height;
  47081. const bpc = this.bpc;
  47082. const rowBytes = width * numComps * bpc + 7 >> 3;
  47083. const imgArray = this.getImageBytes(height * rowBytes, {
  47084. internal: true
  47085. });
  47086. const comps = this.getComponents(imgArray);
  47087. let i, length;
  47088. if (bpc === 1) {
  47089. length = width * height;
  47090. if (this.needsDecode) {
  47091. for (i = 0; i < length; ++i) {
  47092. buffer[i] = comps[i] - 1 & 255;
  47093. }
  47094. } else {
  47095. for (i = 0; i < length; ++i) {
  47096. buffer[i] = -comps[i] & 255;
  47097. }
  47098. }
  47099. return;
  47100. }
  47101. if (this.needsDecode) {
  47102. this.decodeBuffer(comps);
  47103. }
  47104. length = width * height;
  47105. const scale = 255 / ((1 << bpc) - 1);
  47106. for (i = 0; i < length; ++i) {
  47107. buffer[i] = scale * comps[i];
  47108. }
  47109. }
  47110. getImageBytes(length, {
  47111. drawWidth,
  47112. drawHeight,
  47113. forceRGB = false,
  47114. internal = false
  47115. }) {
  47116. this.image.reset();
  47117. this.image.drawWidth = drawWidth || this.width;
  47118. this.image.drawHeight = drawHeight || this.height;
  47119. this.image.forceRGB = !!forceRGB;
  47120. const imageBytes = this.image.getBytes(length);
  47121. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  47122. return imageBytes;
  47123. }
  47124. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  47125. return new Uint8Array(imageBytes);
  47126. }
  47127. }
  47128. exports.PDFImage = PDFImage;
  47129. /***/ }),
  47130. /* 64 */
  47131. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47132. Object.defineProperty(exports, "__esModule", ({
  47133. value: true
  47134. }));
  47135. exports.applyMaskImageData = applyMaskImageData;
  47136. var _util = __w_pdfjs_require__(2);
  47137. function applyMaskImageData({
  47138. src,
  47139. srcPos = 0,
  47140. dest,
  47141. destPos = 0,
  47142. width,
  47143. height,
  47144. inverseDecode = false
  47145. }) {
  47146. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  47147. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  47148. const widthInSource = width >> 3;
  47149. const widthRemainder = width & 7;
  47150. const srcLength = src.length;
  47151. dest = new Uint32Array(dest.buffer);
  47152. for (let i = 0; i < height; i++) {
  47153. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  47154. const elem = srcPos < srcLength ? src[srcPos] : 255;
  47155. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  47156. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  47157. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  47158. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  47159. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  47160. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  47161. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  47162. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  47163. }
  47164. if (widthRemainder === 0) {
  47165. continue;
  47166. }
  47167. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  47168. for (let j = 0; j < widthRemainder; j++) {
  47169. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  47170. }
  47171. }
  47172. return {
  47173. srcPos,
  47174. destPos
  47175. };
  47176. }
  47177. /***/ }),
  47178. /* 65 */
  47179. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47180. Object.defineProperty(exports, "__esModule", ({
  47181. value: true
  47182. }));
  47183. exports.incrementalUpdate = incrementalUpdate;
  47184. exports.writeDict = writeDict;
  47185. exports.writeObject = writeObject;
  47186. var _util = __w_pdfjs_require__(2);
  47187. var _primitives = __w_pdfjs_require__(5);
  47188. var _core_utils = __w_pdfjs_require__(6);
  47189. var _xml_parser = __w_pdfjs_require__(66);
  47190. var _base_stream = __w_pdfjs_require__(7);
  47191. var _crypto = __w_pdfjs_require__(67);
  47192. function writeObject(ref, obj, buffer, transform) {
  47193. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  47194. if (obj instanceof _primitives.Dict) {
  47195. writeDict(obj, buffer, transform);
  47196. } else if (obj instanceof _base_stream.BaseStream) {
  47197. writeStream(obj, buffer, transform);
  47198. }
  47199. buffer.push("\nendobj\n");
  47200. }
  47201. function writeDict(dict, buffer, transform) {
  47202. buffer.push("<<");
  47203. for (const key of dict.getKeys()) {
  47204. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47205. writeValue(dict.getRaw(key), buffer, transform);
  47206. }
  47207. buffer.push(">>");
  47208. }
  47209. function writeStream(stream, buffer, transform) {
  47210. writeDict(stream.dict, buffer, transform);
  47211. buffer.push(" stream\n");
  47212. let string = stream.getString();
  47213. if (transform !== null) {
  47214. string = transform.encryptString(string);
  47215. }
  47216. buffer.push(string, "\nendstream\n");
  47217. }
  47218. function writeArray(array, buffer, transform) {
  47219. buffer.push("[");
  47220. let first = true;
  47221. for (const val of array) {
  47222. if (!first) {
  47223. buffer.push(" ");
  47224. } else {
  47225. first = false;
  47226. }
  47227. writeValue(val, buffer, transform);
  47228. }
  47229. buffer.push("]");
  47230. }
  47231. function writeValue(value, buffer, transform) {
  47232. if (value instanceof _primitives.Name) {
  47233. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47234. } else if (value instanceof _primitives.Ref) {
  47235. buffer.push(`${value.num} ${value.gen} R`);
  47236. } else if (Array.isArray(value)) {
  47237. writeArray(value, buffer, transform);
  47238. } else if (typeof value === "string") {
  47239. if (transform !== null) {
  47240. value = transform.encryptString(value);
  47241. }
  47242. buffer.push(`(${(0, _util.escapeString)(value)})`);
  47243. } else if (typeof value === "number") {
  47244. buffer.push((0, _core_utils.numberToString)(value));
  47245. } else if (typeof value === "boolean") {
  47246. buffer.push(value.toString());
  47247. } else if (value instanceof _primitives.Dict) {
  47248. writeDict(value, buffer, transform);
  47249. } else if (value instanceof _base_stream.BaseStream) {
  47250. writeStream(value, buffer, transform);
  47251. } else if (value === null) {
  47252. buffer.push("null");
  47253. } else {
  47254. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  47255. }
  47256. }
  47257. function writeInt(number, size, offset, buffer) {
  47258. for (let i = size + offset - 1; i > offset - 1; i--) {
  47259. buffer[i] = number & 0xff;
  47260. number >>= 8;
  47261. }
  47262. return offset + size;
  47263. }
  47264. function writeString(string, offset, buffer) {
  47265. for (let i = 0, len = string.length; i < len; i++) {
  47266. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47267. }
  47268. }
  47269. function computeMD5(filesize, xrefInfo) {
  47270. const time = Math.floor(Date.now() / 1000);
  47271. const filename = xrefInfo.filename || "";
  47272. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47273. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47274. for (const value of Object.values(xrefInfo.info)) {
  47275. md5Buffer.push(value);
  47276. md5BufferLen += value.length;
  47277. }
  47278. const array = new Uint8Array(md5BufferLen);
  47279. let offset = 0;
  47280. for (const str of md5Buffer) {
  47281. writeString(str, offset, array);
  47282. offset += str.length;
  47283. }
  47284. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47285. }
  47286. function writeXFADataForAcroform(str, newRefs) {
  47287. const xml = new _xml_parser.SimpleXMLParser({
  47288. hasAttributes: true
  47289. }).parseFromString(str);
  47290. for (const {
  47291. xfa
  47292. } of newRefs) {
  47293. if (!xfa) {
  47294. continue;
  47295. }
  47296. const {
  47297. path,
  47298. value
  47299. } = xfa;
  47300. if (!path) {
  47301. continue;
  47302. }
  47303. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  47304. if (node) {
  47305. if (Array.isArray(value)) {
  47306. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  47307. } else {
  47308. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  47309. }
  47310. } else {
  47311. (0, _util.warn)(`Node not found for path: ${path}`);
  47312. }
  47313. }
  47314. const buffer = [];
  47315. xml.documentElement.dump(buffer);
  47316. return buffer.join("");
  47317. }
  47318. function updateXFA({
  47319. xfaData,
  47320. xfaDatasetsRef,
  47321. hasXfaDatasetsEntry,
  47322. acroFormRef,
  47323. acroForm,
  47324. newRefs,
  47325. xref,
  47326. xrefInfo
  47327. }) {
  47328. if (xref === null) {
  47329. return;
  47330. }
  47331. if (!hasXfaDatasetsEntry) {
  47332. if (!acroFormRef) {
  47333. (0, _util.warn)("XFA - Cannot save it");
  47334. return;
  47335. }
  47336. const oldXfa = acroForm.get("XFA");
  47337. const newXfa = oldXfa.slice();
  47338. newXfa.splice(2, 0, "datasets");
  47339. newXfa.splice(3, 0, xfaDatasetsRef);
  47340. acroForm.set("XFA", newXfa);
  47341. const encrypt = xref.encrypt;
  47342. let transform = null;
  47343. if (encrypt) {
  47344. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  47345. }
  47346. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  47347. writeDict(acroForm, buffer, transform);
  47348. buffer.push("\n");
  47349. acroForm.set("XFA", oldXfa);
  47350. newRefs.push({
  47351. ref: acroFormRef,
  47352. data: buffer.join("")
  47353. });
  47354. }
  47355. if (xfaData === null) {
  47356. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  47357. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  47358. }
  47359. const encrypt = xref.encrypt;
  47360. if (encrypt) {
  47361. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  47362. xfaData = transform.encryptString(xfaData);
  47363. }
  47364. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  47365. newRefs.push({
  47366. ref: xfaDatasetsRef,
  47367. data
  47368. });
  47369. }
  47370. function incrementalUpdate({
  47371. originalData,
  47372. xrefInfo,
  47373. newRefs,
  47374. xref = null,
  47375. hasXfa = false,
  47376. xfaDatasetsRef = null,
  47377. hasXfaDatasetsEntry = false,
  47378. acroFormRef = null,
  47379. acroForm = null,
  47380. xfaData = null
  47381. }) {
  47382. if (hasXfa) {
  47383. updateXFA({
  47384. xfaData,
  47385. xfaDatasetsRef,
  47386. hasXfaDatasetsEntry,
  47387. acroFormRef,
  47388. acroForm,
  47389. newRefs,
  47390. xref,
  47391. xrefInfo
  47392. });
  47393. }
  47394. const newXref = new _primitives.Dict(null);
  47395. const refForXrefTable = xrefInfo.newRef;
  47396. let buffer, baseOffset;
  47397. const lastByte = originalData.at(-1);
  47398. if (lastByte === 0x0a || lastByte === 0x0d) {
  47399. buffer = [];
  47400. baseOffset = originalData.length;
  47401. } else {
  47402. buffer = ["\n"];
  47403. baseOffset = originalData.length + 1;
  47404. }
  47405. newXref.set("Size", refForXrefTable.num + 1);
  47406. newXref.set("Prev", xrefInfo.startXRef);
  47407. newXref.set("Type", _primitives.Name.get("XRef"));
  47408. if (xrefInfo.rootRef !== null) {
  47409. newXref.set("Root", xrefInfo.rootRef);
  47410. }
  47411. if (xrefInfo.infoRef !== null) {
  47412. newXref.set("Info", xrefInfo.infoRef);
  47413. }
  47414. if (xrefInfo.encryptRef !== null) {
  47415. newXref.set("Encrypt", xrefInfo.encryptRef);
  47416. }
  47417. newRefs.push({
  47418. ref: refForXrefTable,
  47419. data: ""
  47420. });
  47421. newRefs = newRefs.sort((a, b) => {
  47422. return a.ref.num - b.ref.num;
  47423. });
  47424. const xrefTableData = [[0, 1, 0xffff]];
  47425. const indexes = [0, 1];
  47426. let maxOffset = 0;
  47427. for (const {
  47428. ref,
  47429. data
  47430. } of newRefs) {
  47431. maxOffset = Math.max(maxOffset, baseOffset);
  47432. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  47433. baseOffset += data.length;
  47434. indexes.push(ref.num, 1);
  47435. buffer.push(data);
  47436. }
  47437. newXref.set("Index", indexes);
  47438. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  47439. const md5 = computeMD5(baseOffset, xrefInfo);
  47440. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  47441. }
  47442. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  47443. const sizes = [1, offsetSize, 2];
  47444. const structSize = sizes[0] + sizes[1] + sizes[2];
  47445. const tableLength = structSize * xrefTableData.length;
  47446. newXref.set("W", sizes);
  47447. newXref.set("Length", tableLength);
  47448. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  47449. writeDict(newXref, buffer, null);
  47450. buffer.push(" stream\n");
  47451. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  47452. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  47453. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  47454. array.set(originalData);
  47455. let offset = originalData.length;
  47456. for (const str of buffer) {
  47457. writeString(str, offset, array);
  47458. offset += str.length;
  47459. }
  47460. for (const [type, objOffset, gen] of xrefTableData) {
  47461. offset = writeInt(type, sizes[0], offset, array);
  47462. offset = writeInt(objOffset, sizes[1], offset, array);
  47463. offset = writeInt(gen, sizes[2], offset, array);
  47464. }
  47465. writeString(footer, offset, array);
  47466. return array;
  47467. }
  47468. /***/ }),
  47469. /* 66 */
  47470. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47471. Object.defineProperty(exports, "__esModule", ({
  47472. value: true
  47473. }));
  47474. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47475. var _core_utils = __w_pdfjs_require__(6);
  47476. const XMLParserErrorCode = {
  47477. NoError: 0,
  47478. EndOfDocument: -1,
  47479. UnterminatedCdat: -2,
  47480. UnterminatedXmlDeclaration: -3,
  47481. UnterminatedDoctypeDeclaration: -4,
  47482. UnterminatedComment: -5,
  47483. MalformedElement: -6,
  47484. OutOfMemory: -7,
  47485. UnterminatedAttributeValue: -8,
  47486. UnterminatedElement: -9,
  47487. ElementNeverBegun: -10
  47488. };
  47489. exports.XMLParserErrorCode = XMLParserErrorCode;
  47490. function isWhitespace(s, index) {
  47491. const ch = s[index];
  47492. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47493. }
  47494. function isWhitespaceString(s) {
  47495. for (let i = 0, ii = s.length; i < ii; i++) {
  47496. if (!isWhitespace(s, i)) {
  47497. return false;
  47498. }
  47499. }
  47500. return true;
  47501. }
  47502. class XMLParserBase {
  47503. _resolveEntities(s) {
  47504. return s.replace(/&([^;]+);/g, (all, entity) => {
  47505. if (entity.substring(0, 2) === "#x") {
  47506. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47507. } else if (entity.substring(0, 1) === "#") {
  47508. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47509. }
  47510. switch (entity) {
  47511. case "lt":
  47512. return "<";
  47513. case "gt":
  47514. return ">";
  47515. case "amp":
  47516. return "&";
  47517. case "quot":
  47518. return '"';
  47519. case "apos":
  47520. return "'";
  47521. }
  47522. return this.onResolveEntity(entity);
  47523. });
  47524. }
  47525. _parseContent(s, start) {
  47526. const attributes = [];
  47527. let pos = start;
  47528. function skipWs() {
  47529. while (pos < s.length && isWhitespace(s, pos)) {
  47530. ++pos;
  47531. }
  47532. }
  47533. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47534. ++pos;
  47535. }
  47536. const name = s.substring(start, pos);
  47537. skipWs();
  47538. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47539. skipWs();
  47540. let attrName = "",
  47541. attrValue = "";
  47542. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47543. attrName += s[pos];
  47544. ++pos;
  47545. }
  47546. skipWs();
  47547. if (s[pos] !== "=") {
  47548. return null;
  47549. }
  47550. ++pos;
  47551. skipWs();
  47552. const attrEndChar = s[pos];
  47553. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47554. return null;
  47555. }
  47556. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47557. if (attrEndIndex < 0) {
  47558. return null;
  47559. }
  47560. attrValue = s.substring(pos, attrEndIndex);
  47561. attributes.push({
  47562. name: attrName,
  47563. value: this._resolveEntities(attrValue)
  47564. });
  47565. pos = attrEndIndex + 1;
  47566. skipWs();
  47567. }
  47568. return {
  47569. name,
  47570. attributes,
  47571. parsed: pos - start
  47572. };
  47573. }
  47574. _parseProcessingInstruction(s, start) {
  47575. let pos = start;
  47576. function skipWs() {
  47577. while (pos < s.length && isWhitespace(s, pos)) {
  47578. ++pos;
  47579. }
  47580. }
  47581. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  47582. ++pos;
  47583. }
  47584. const name = s.substring(start, pos);
  47585. skipWs();
  47586. const attrStart = pos;
  47587. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  47588. ++pos;
  47589. }
  47590. const value = s.substring(attrStart, pos);
  47591. return {
  47592. name,
  47593. value,
  47594. parsed: pos - start
  47595. };
  47596. }
  47597. parseXml(s) {
  47598. let i = 0;
  47599. while (i < s.length) {
  47600. const ch = s[i];
  47601. let j = i;
  47602. if (ch === "<") {
  47603. ++j;
  47604. const ch2 = s[j];
  47605. let q;
  47606. switch (ch2) {
  47607. case "/":
  47608. ++j;
  47609. q = s.indexOf(">", j);
  47610. if (q < 0) {
  47611. this.onError(XMLParserErrorCode.UnterminatedElement);
  47612. return;
  47613. }
  47614. this.onEndElement(s.substring(j, q));
  47615. j = q + 1;
  47616. break;
  47617. case "?":
  47618. ++j;
  47619. const pi = this._parseProcessingInstruction(s, j);
  47620. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  47621. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  47622. return;
  47623. }
  47624. this.onPi(pi.name, pi.value);
  47625. j += pi.parsed + 2;
  47626. break;
  47627. case "!":
  47628. if (s.substring(j + 1, j + 3) === "--") {
  47629. q = s.indexOf("-->", j + 3);
  47630. if (q < 0) {
  47631. this.onError(XMLParserErrorCode.UnterminatedComment);
  47632. return;
  47633. }
  47634. this.onComment(s.substring(j + 3, q));
  47635. j = q + 3;
  47636. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  47637. q = s.indexOf("]]>", j + 8);
  47638. if (q < 0) {
  47639. this.onError(XMLParserErrorCode.UnterminatedCdat);
  47640. return;
  47641. }
  47642. this.onCdata(s.substring(j + 8, q));
  47643. j = q + 3;
  47644. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  47645. const q2 = s.indexOf("[", j + 8);
  47646. let complexDoctype = false;
  47647. q = s.indexOf(">", j + 8);
  47648. if (q < 0) {
  47649. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47650. return;
  47651. }
  47652. if (q2 > 0 && q > q2) {
  47653. q = s.indexOf("]>", j + 8);
  47654. if (q < 0) {
  47655. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47656. return;
  47657. }
  47658. complexDoctype = true;
  47659. }
  47660. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  47661. this.onDoctype(doctypeContent);
  47662. j = q + (complexDoctype ? 2 : 1);
  47663. } else {
  47664. this.onError(XMLParserErrorCode.MalformedElement);
  47665. return;
  47666. }
  47667. break;
  47668. default:
  47669. const content = this._parseContent(s, j);
  47670. if (content === null) {
  47671. this.onError(XMLParserErrorCode.MalformedElement);
  47672. return;
  47673. }
  47674. let isClosed = false;
  47675. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  47676. isClosed = true;
  47677. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  47678. this.onError(XMLParserErrorCode.UnterminatedElement);
  47679. return;
  47680. }
  47681. this.onBeginElement(content.name, content.attributes, isClosed);
  47682. j += content.parsed + (isClosed ? 2 : 1);
  47683. break;
  47684. }
  47685. } else {
  47686. while (j < s.length && s[j] !== "<") {
  47687. j++;
  47688. }
  47689. const text = s.substring(i, j);
  47690. this.onText(this._resolveEntities(text));
  47691. }
  47692. i = j;
  47693. }
  47694. }
  47695. onResolveEntity(name) {
  47696. return `&${name};`;
  47697. }
  47698. onPi(name, value) {}
  47699. onComment(text) {}
  47700. onCdata(text) {}
  47701. onDoctype(doctypeContent) {}
  47702. onText(text) {}
  47703. onBeginElement(name, attributes, isEmpty) {}
  47704. onEndElement(name) {}
  47705. onError(code) {}
  47706. }
  47707. exports.XMLParserBase = XMLParserBase;
  47708. class SimpleDOMNode {
  47709. constructor(nodeName, nodeValue) {
  47710. this.nodeName = nodeName;
  47711. this.nodeValue = nodeValue;
  47712. Object.defineProperty(this, "parentNode", {
  47713. value: null,
  47714. writable: true
  47715. });
  47716. }
  47717. get firstChild() {
  47718. return this.childNodes && this.childNodes[0];
  47719. }
  47720. get nextSibling() {
  47721. const childNodes = this.parentNode.childNodes;
  47722. if (!childNodes) {
  47723. return undefined;
  47724. }
  47725. const index = childNodes.indexOf(this);
  47726. if (index === -1) {
  47727. return undefined;
  47728. }
  47729. return childNodes[index + 1];
  47730. }
  47731. get textContent() {
  47732. if (!this.childNodes) {
  47733. return this.nodeValue || "";
  47734. }
  47735. return this.childNodes.map(function (child) {
  47736. return child.textContent;
  47737. }).join("");
  47738. }
  47739. get children() {
  47740. return this.childNodes || [];
  47741. }
  47742. hasChildNodes() {
  47743. return this.childNodes && this.childNodes.length > 0;
  47744. }
  47745. searchNode(paths, pos) {
  47746. if (pos >= paths.length) {
  47747. return this;
  47748. }
  47749. const component = paths[pos];
  47750. const stack = [];
  47751. let node = this;
  47752. while (true) {
  47753. if (component.name === node.nodeName) {
  47754. if (component.pos === 0) {
  47755. const res = node.searchNode(paths, pos + 1);
  47756. if (res !== null) {
  47757. return res;
  47758. }
  47759. } else if (stack.length === 0) {
  47760. return null;
  47761. } else {
  47762. const [parent] = stack.pop();
  47763. let siblingPos = 0;
  47764. for (const child of parent.childNodes) {
  47765. if (component.name === child.nodeName) {
  47766. if (siblingPos === component.pos) {
  47767. return child.searchNode(paths, pos + 1);
  47768. }
  47769. siblingPos++;
  47770. }
  47771. }
  47772. return node.searchNode(paths, pos + 1);
  47773. }
  47774. }
  47775. if (node.childNodes && node.childNodes.length !== 0) {
  47776. stack.push([node, 0]);
  47777. node = node.childNodes[0];
  47778. } else if (stack.length === 0) {
  47779. return null;
  47780. } else {
  47781. while (stack.length !== 0) {
  47782. const [parent, currentPos] = stack.pop();
  47783. const newPos = currentPos + 1;
  47784. if (newPos < parent.childNodes.length) {
  47785. stack.push([parent, newPos]);
  47786. node = parent.childNodes[newPos];
  47787. break;
  47788. }
  47789. }
  47790. if (stack.length === 0) {
  47791. return null;
  47792. }
  47793. }
  47794. }
  47795. }
  47796. dump(buffer) {
  47797. if (this.nodeName === "#text") {
  47798. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  47799. return;
  47800. }
  47801. buffer.push(`<${this.nodeName}`);
  47802. if (this.attributes) {
  47803. for (const attribute of this.attributes) {
  47804. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  47805. }
  47806. }
  47807. if (this.hasChildNodes()) {
  47808. buffer.push(">");
  47809. for (const child of this.childNodes) {
  47810. child.dump(buffer);
  47811. }
  47812. buffer.push(`</${this.nodeName}>`);
  47813. } else if (this.nodeValue) {
  47814. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  47815. } else {
  47816. buffer.push("/>");
  47817. }
  47818. }
  47819. }
  47820. exports.SimpleDOMNode = SimpleDOMNode;
  47821. class SimpleXMLParser extends XMLParserBase {
  47822. constructor({
  47823. hasAttributes = false,
  47824. lowerCaseName = false
  47825. }) {
  47826. super();
  47827. this._currentFragment = null;
  47828. this._stack = null;
  47829. this._errorCode = XMLParserErrorCode.NoError;
  47830. this._hasAttributes = hasAttributes;
  47831. this._lowerCaseName = lowerCaseName;
  47832. }
  47833. parseFromString(data) {
  47834. this._currentFragment = [];
  47835. this._stack = [];
  47836. this._errorCode = XMLParserErrorCode.NoError;
  47837. this.parseXml(data);
  47838. if (this._errorCode !== XMLParserErrorCode.NoError) {
  47839. return undefined;
  47840. }
  47841. const [documentElement] = this._currentFragment;
  47842. if (!documentElement) {
  47843. return undefined;
  47844. }
  47845. return {
  47846. documentElement
  47847. };
  47848. }
  47849. onText(text) {
  47850. if (isWhitespaceString(text)) {
  47851. return;
  47852. }
  47853. const node = new SimpleDOMNode("#text", text);
  47854. this._currentFragment.push(node);
  47855. }
  47856. onCdata(text) {
  47857. const node = new SimpleDOMNode("#text", text);
  47858. this._currentFragment.push(node);
  47859. }
  47860. onBeginElement(name, attributes, isEmpty) {
  47861. if (this._lowerCaseName) {
  47862. name = name.toLowerCase();
  47863. }
  47864. const node = new SimpleDOMNode(name);
  47865. node.childNodes = [];
  47866. if (this._hasAttributes) {
  47867. node.attributes = attributes;
  47868. }
  47869. this._currentFragment.push(node);
  47870. if (isEmpty) {
  47871. return;
  47872. }
  47873. this._stack.push(this._currentFragment);
  47874. this._currentFragment = node.childNodes;
  47875. }
  47876. onEndElement(name) {
  47877. this._currentFragment = this._stack.pop() || [];
  47878. const lastElement = this._currentFragment.at(-1);
  47879. if (!lastElement) {
  47880. return null;
  47881. }
  47882. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  47883. lastElement.childNodes[i].parentNode = lastElement;
  47884. }
  47885. return lastElement;
  47886. }
  47887. onError(code) {
  47888. this._errorCode = code;
  47889. }
  47890. }
  47891. exports.SimpleXMLParser = SimpleXMLParser;
  47892. /***/ }),
  47893. /* 67 */
  47894. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47895. Object.defineProperty(exports, "__esModule", ({
  47896. value: true
  47897. }));
  47898. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  47899. exports.calculateSHA384 = calculateSHA384;
  47900. exports.calculateSHA512 = void 0;
  47901. var _util = __w_pdfjs_require__(2);
  47902. var _primitives = __w_pdfjs_require__(5);
  47903. var _decrypt_stream = __w_pdfjs_require__(68);
  47904. class ARCFourCipher {
  47905. constructor(key) {
  47906. this.a = 0;
  47907. this.b = 0;
  47908. const s = new Uint8Array(256);
  47909. const keyLength = key.length;
  47910. for (let i = 0; i < 256; ++i) {
  47911. s[i] = i;
  47912. }
  47913. for (let i = 0, j = 0; i < 256; ++i) {
  47914. const tmp = s[i];
  47915. j = j + tmp + key[i % keyLength] & 0xff;
  47916. s[i] = s[j];
  47917. s[j] = tmp;
  47918. }
  47919. this.s = s;
  47920. }
  47921. encryptBlock(data) {
  47922. let a = this.a,
  47923. b = this.b;
  47924. const s = this.s;
  47925. const n = data.length;
  47926. const output = new Uint8Array(n);
  47927. for (let i = 0; i < n; ++i) {
  47928. a = a + 1 & 0xff;
  47929. const tmp = s[a];
  47930. b = b + tmp & 0xff;
  47931. const tmp2 = s[b];
  47932. s[a] = tmp2;
  47933. s[b] = tmp;
  47934. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  47935. }
  47936. this.a = a;
  47937. this.b = b;
  47938. return output;
  47939. }
  47940. decryptBlock(data) {
  47941. return this.encryptBlock(data);
  47942. }
  47943. encrypt(data) {
  47944. return this.encryptBlock(data);
  47945. }
  47946. }
  47947. exports.ARCFourCipher = ARCFourCipher;
  47948. const calculateMD5 = function calculateMD5Closure() {
  47949. 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]);
  47950. 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]);
  47951. function hash(data, offset, length) {
  47952. let h0 = 1732584193,
  47953. h1 = -271733879,
  47954. h2 = -1732584194,
  47955. h3 = 271733878;
  47956. const paddedLength = length + 72 & ~63;
  47957. const padded = new Uint8Array(paddedLength);
  47958. let i, j;
  47959. for (i = 0; i < length; ++i) {
  47960. padded[i] = data[offset++];
  47961. }
  47962. padded[i++] = 0x80;
  47963. const n = paddedLength - 8;
  47964. while (i < n) {
  47965. padded[i++] = 0;
  47966. }
  47967. padded[i++] = length << 3 & 0xff;
  47968. padded[i++] = length >> 5 & 0xff;
  47969. padded[i++] = length >> 13 & 0xff;
  47970. padded[i++] = length >> 21 & 0xff;
  47971. padded[i++] = length >>> 29 & 0xff;
  47972. padded[i++] = 0;
  47973. padded[i++] = 0;
  47974. padded[i++] = 0;
  47975. const w = new Int32Array(16);
  47976. for (i = 0; i < paddedLength;) {
  47977. for (j = 0; j < 16; ++j, i += 4) {
  47978. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  47979. }
  47980. let a = h0,
  47981. b = h1,
  47982. c = h2,
  47983. d = h3,
  47984. f,
  47985. g;
  47986. for (j = 0; j < 64; ++j) {
  47987. if (j < 16) {
  47988. f = b & c | ~b & d;
  47989. g = j;
  47990. } else if (j < 32) {
  47991. f = d & b | ~d & c;
  47992. g = 5 * j + 1 & 15;
  47993. } else if (j < 48) {
  47994. f = b ^ c ^ d;
  47995. g = 3 * j + 5 & 15;
  47996. } else {
  47997. f = c ^ (b | ~d);
  47998. g = 7 * j & 15;
  47999. }
  48000. const tmp = d,
  48001. rotateArg = a + f + k[j] + w[g] | 0,
  48002. rotate = r[j];
  48003. d = c;
  48004. c = b;
  48005. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  48006. a = tmp;
  48007. }
  48008. h0 = h0 + a | 0;
  48009. h1 = h1 + b | 0;
  48010. h2 = h2 + c | 0;
  48011. h3 = h3 + d | 0;
  48012. }
  48013. 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]);
  48014. }
  48015. return hash;
  48016. }();
  48017. exports.calculateMD5 = calculateMD5;
  48018. class Word64 {
  48019. constructor(highInteger, lowInteger) {
  48020. this.high = highInteger | 0;
  48021. this.low = lowInteger | 0;
  48022. }
  48023. and(word) {
  48024. this.high &= word.high;
  48025. this.low &= word.low;
  48026. }
  48027. xor(word) {
  48028. this.high ^= word.high;
  48029. this.low ^= word.low;
  48030. }
  48031. or(word) {
  48032. this.high |= word.high;
  48033. this.low |= word.low;
  48034. }
  48035. shiftRight(places) {
  48036. if (places >= 32) {
  48037. this.low = this.high >>> places - 32 | 0;
  48038. this.high = 0;
  48039. } else {
  48040. this.low = this.low >>> places | this.high << 32 - places;
  48041. this.high = this.high >>> places | 0;
  48042. }
  48043. }
  48044. shiftLeft(places) {
  48045. if (places >= 32) {
  48046. this.high = this.low << places - 32;
  48047. this.low = 0;
  48048. } else {
  48049. this.high = this.high << places | this.low >>> 32 - places;
  48050. this.low <<= places;
  48051. }
  48052. }
  48053. rotateRight(places) {
  48054. let low, high;
  48055. if (places & 32) {
  48056. high = this.low;
  48057. low = this.high;
  48058. } else {
  48059. low = this.low;
  48060. high = this.high;
  48061. }
  48062. places &= 31;
  48063. this.low = low >>> places | high << 32 - places;
  48064. this.high = high >>> places | low << 32 - places;
  48065. }
  48066. not() {
  48067. this.high = ~this.high;
  48068. this.low = ~this.low;
  48069. }
  48070. add(word) {
  48071. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  48072. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48073. if (lowAdd > 0xffffffff) {
  48074. highAdd += 1;
  48075. }
  48076. this.low = lowAdd | 0;
  48077. this.high = highAdd | 0;
  48078. }
  48079. copyTo(bytes, offset) {
  48080. bytes[offset] = this.high >>> 24 & 0xff;
  48081. bytes[offset + 1] = this.high >> 16 & 0xff;
  48082. bytes[offset + 2] = this.high >> 8 & 0xff;
  48083. bytes[offset + 3] = this.high & 0xff;
  48084. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48085. bytes[offset + 5] = this.low >> 16 & 0xff;
  48086. bytes[offset + 6] = this.low >> 8 & 0xff;
  48087. bytes[offset + 7] = this.low & 0xff;
  48088. }
  48089. assign(word) {
  48090. this.high = word.high;
  48091. this.low = word.low;
  48092. }
  48093. }
  48094. const calculateSHA256 = function calculateSHA256Closure() {
  48095. function rotr(x, n) {
  48096. return x >>> n | x << 32 - n;
  48097. }
  48098. function ch(x, y, z) {
  48099. return x & y ^ ~x & z;
  48100. }
  48101. function maj(x, y, z) {
  48102. return x & y ^ x & z ^ y & z;
  48103. }
  48104. function sigma(x) {
  48105. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48106. }
  48107. function sigmaPrime(x) {
  48108. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48109. }
  48110. function littleSigma(x) {
  48111. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48112. }
  48113. function littleSigmaPrime(x) {
  48114. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48115. }
  48116. 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];
  48117. function hash(data, offset, length) {
  48118. let h0 = 0x6a09e667,
  48119. h1 = 0xbb67ae85,
  48120. h2 = 0x3c6ef372,
  48121. h3 = 0xa54ff53a,
  48122. h4 = 0x510e527f,
  48123. h5 = 0x9b05688c,
  48124. h6 = 0x1f83d9ab,
  48125. h7 = 0x5be0cd19;
  48126. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48127. const padded = new Uint8Array(paddedLength);
  48128. let i, j;
  48129. for (i = 0; i < length; ++i) {
  48130. padded[i] = data[offset++];
  48131. }
  48132. padded[i++] = 0x80;
  48133. const n = paddedLength - 8;
  48134. while (i < n) {
  48135. padded[i++] = 0;
  48136. }
  48137. padded[i++] = 0;
  48138. padded[i++] = 0;
  48139. padded[i++] = 0;
  48140. padded[i++] = length >>> 29 & 0xff;
  48141. padded[i++] = length >> 21 & 0xff;
  48142. padded[i++] = length >> 13 & 0xff;
  48143. padded[i++] = length >> 5 & 0xff;
  48144. padded[i++] = length << 3 & 0xff;
  48145. const w = new Uint32Array(64);
  48146. for (i = 0; i < paddedLength;) {
  48147. for (j = 0; j < 16; ++j) {
  48148. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48149. i += 4;
  48150. }
  48151. for (j = 16; j < 64; ++j) {
  48152. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48153. }
  48154. let a = h0,
  48155. b = h1,
  48156. c = h2,
  48157. d = h3,
  48158. e = h4,
  48159. f = h5,
  48160. g = h6,
  48161. h = h7,
  48162. t1,
  48163. t2;
  48164. for (j = 0; j < 64; ++j) {
  48165. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  48166. t2 = sigma(a) + maj(a, b, c);
  48167. h = g;
  48168. g = f;
  48169. f = e;
  48170. e = d + t1 | 0;
  48171. d = c;
  48172. c = b;
  48173. b = a;
  48174. a = t1 + t2 | 0;
  48175. }
  48176. h0 = h0 + a | 0;
  48177. h1 = h1 + b | 0;
  48178. h2 = h2 + c | 0;
  48179. h3 = h3 + d | 0;
  48180. h4 = h4 + e | 0;
  48181. h5 = h5 + f | 0;
  48182. h6 = h6 + g | 0;
  48183. h7 = h7 + h | 0;
  48184. }
  48185. 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]);
  48186. }
  48187. return hash;
  48188. }();
  48189. exports.calculateSHA256 = calculateSHA256;
  48190. const calculateSHA512 = function calculateSHA512Closure() {
  48191. function ch(result, x, y, z, tmp) {
  48192. result.assign(x);
  48193. result.and(y);
  48194. tmp.assign(x);
  48195. tmp.not();
  48196. tmp.and(z);
  48197. result.xor(tmp);
  48198. }
  48199. function maj(result, x, y, z, tmp) {
  48200. result.assign(x);
  48201. result.and(y);
  48202. tmp.assign(x);
  48203. tmp.and(z);
  48204. result.xor(tmp);
  48205. tmp.assign(y);
  48206. tmp.and(z);
  48207. result.xor(tmp);
  48208. }
  48209. function sigma(result, x, tmp) {
  48210. result.assign(x);
  48211. result.rotateRight(28);
  48212. tmp.assign(x);
  48213. tmp.rotateRight(34);
  48214. result.xor(tmp);
  48215. tmp.assign(x);
  48216. tmp.rotateRight(39);
  48217. result.xor(tmp);
  48218. }
  48219. function sigmaPrime(result, x, tmp) {
  48220. result.assign(x);
  48221. result.rotateRight(14);
  48222. tmp.assign(x);
  48223. tmp.rotateRight(18);
  48224. result.xor(tmp);
  48225. tmp.assign(x);
  48226. tmp.rotateRight(41);
  48227. result.xor(tmp);
  48228. }
  48229. function littleSigma(result, x, tmp) {
  48230. result.assign(x);
  48231. result.rotateRight(1);
  48232. tmp.assign(x);
  48233. tmp.rotateRight(8);
  48234. result.xor(tmp);
  48235. tmp.assign(x);
  48236. tmp.shiftRight(7);
  48237. result.xor(tmp);
  48238. }
  48239. function littleSigmaPrime(result, x, tmp) {
  48240. result.assign(x);
  48241. result.rotateRight(19);
  48242. tmp.assign(x);
  48243. tmp.rotateRight(61);
  48244. result.xor(tmp);
  48245. tmp.assign(x);
  48246. tmp.shiftRight(6);
  48247. result.xor(tmp);
  48248. }
  48249. 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)];
  48250. function hash(data, offset, length, mode384 = false) {
  48251. let h0, h1, h2, h3, h4, h5, h6, h7;
  48252. if (!mode384) {
  48253. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48254. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48255. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48256. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48257. h4 = new Word64(0x510e527f, 0xade682d1);
  48258. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48259. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48260. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48261. } else {
  48262. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48263. h1 = new Word64(0x629a292a, 0x367cd507);
  48264. h2 = new Word64(0x9159015a, 0x3070dd17);
  48265. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48266. h4 = new Word64(0x67332667, 0xffc00b31);
  48267. h5 = new Word64(0x8eb44a87, 0x68581511);
  48268. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48269. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48270. }
  48271. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48272. const padded = new Uint8Array(paddedLength);
  48273. let i, j;
  48274. for (i = 0; i < length; ++i) {
  48275. padded[i] = data[offset++];
  48276. }
  48277. padded[i++] = 0x80;
  48278. const n = paddedLength - 16;
  48279. while (i < n) {
  48280. padded[i++] = 0;
  48281. }
  48282. padded[i++] = 0;
  48283. padded[i++] = 0;
  48284. padded[i++] = 0;
  48285. padded[i++] = 0;
  48286. padded[i++] = 0;
  48287. padded[i++] = 0;
  48288. padded[i++] = 0;
  48289. padded[i++] = 0;
  48290. padded[i++] = 0;
  48291. padded[i++] = 0;
  48292. padded[i++] = 0;
  48293. padded[i++] = length >>> 29 & 0xff;
  48294. padded[i++] = length >> 21 & 0xff;
  48295. padded[i++] = length >> 13 & 0xff;
  48296. padded[i++] = length >> 5 & 0xff;
  48297. padded[i++] = length << 3 & 0xff;
  48298. const w = new Array(80);
  48299. for (i = 0; i < 80; i++) {
  48300. w[i] = new Word64(0, 0);
  48301. }
  48302. let a = new Word64(0, 0),
  48303. b = new Word64(0, 0),
  48304. c = new Word64(0, 0);
  48305. let d = new Word64(0, 0),
  48306. e = new Word64(0, 0),
  48307. f = new Word64(0, 0);
  48308. let g = new Word64(0, 0),
  48309. h = new Word64(0, 0);
  48310. const t1 = new Word64(0, 0),
  48311. t2 = new Word64(0, 0);
  48312. const tmp1 = new Word64(0, 0),
  48313. tmp2 = new Word64(0, 0);
  48314. let tmp3;
  48315. for (i = 0; i < paddedLength;) {
  48316. for (j = 0; j < 16; ++j) {
  48317. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48318. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48319. i += 8;
  48320. }
  48321. for (j = 16; j < 80; ++j) {
  48322. tmp3 = w[j];
  48323. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48324. tmp3.add(w[j - 7]);
  48325. littleSigma(tmp1, w[j - 15], tmp2);
  48326. tmp3.add(tmp1);
  48327. tmp3.add(w[j - 16]);
  48328. }
  48329. a.assign(h0);
  48330. b.assign(h1);
  48331. c.assign(h2);
  48332. d.assign(h3);
  48333. e.assign(h4);
  48334. f.assign(h5);
  48335. g.assign(h6);
  48336. h.assign(h7);
  48337. for (j = 0; j < 80; ++j) {
  48338. t1.assign(h);
  48339. sigmaPrime(tmp1, e, tmp2);
  48340. t1.add(tmp1);
  48341. ch(tmp1, e, f, g, tmp2);
  48342. t1.add(tmp1);
  48343. t1.add(k[j]);
  48344. t1.add(w[j]);
  48345. sigma(t2, a, tmp2);
  48346. maj(tmp1, a, b, c, tmp2);
  48347. t2.add(tmp1);
  48348. tmp3 = h;
  48349. h = g;
  48350. g = f;
  48351. f = e;
  48352. d.add(t1);
  48353. e = d;
  48354. d = c;
  48355. c = b;
  48356. b = a;
  48357. tmp3.assign(t1);
  48358. tmp3.add(t2);
  48359. a = tmp3;
  48360. }
  48361. h0.add(a);
  48362. h1.add(b);
  48363. h2.add(c);
  48364. h3.add(d);
  48365. h4.add(e);
  48366. h5.add(f);
  48367. h6.add(g);
  48368. h7.add(h);
  48369. }
  48370. let result;
  48371. if (!mode384) {
  48372. result = new Uint8Array(64);
  48373. h0.copyTo(result, 0);
  48374. h1.copyTo(result, 8);
  48375. h2.copyTo(result, 16);
  48376. h3.copyTo(result, 24);
  48377. h4.copyTo(result, 32);
  48378. h5.copyTo(result, 40);
  48379. h6.copyTo(result, 48);
  48380. h7.copyTo(result, 56);
  48381. } else {
  48382. result = new Uint8Array(48);
  48383. h0.copyTo(result, 0);
  48384. h1.copyTo(result, 8);
  48385. h2.copyTo(result, 16);
  48386. h3.copyTo(result, 24);
  48387. h4.copyTo(result, 32);
  48388. h5.copyTo(result, 40);
  48389. }
  48390. return result;
  48391. }
  48392. return hash;
  48393. }();
  48394. exports.calculateSHA512 = calculateSHA512;
  48395. function calculateSHA384(data, offset, length) {
  48396. return calculateSHA512(data, offset, length, true);
  48397. }
  48398. class NullCipher {
  48399. decryptBlock(data) {
  48400. return data;
  48401. }
  48402. encrypt(data) {
  48403. return data;
  48404. }
  48405. }
  48406. class AESBaseCipher {
  48407. constructor() {
  48408. if (this.constructor === AESBaseCipher) {
  48409. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  48410. }
  48411. 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]);
  48412. 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]);
  48413. 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]);
  48414. this._mixCol = new Uint8Array(256);
  48415. for (let i = 0; i < 256; i++) {
  48416. if (i < 128) {
  48417. this._mixCol[i] = i << 1;
  48418. } else {
  48419. this._mixCol[i] = i << 1 ^ 0x1b;
  48420. }
  48421. }
  48422. this.buffer = new Uint8Array(16);
  48423. this.bufferPosition = 0;
  48424. }
  48425. _expandKey(cipherKey) {
  48426. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  48427. }
  48428. _decrypt(input, key) {
  48429. let t, u, v;
  48430. const state = new Uint8Array(16);
  48431. state.set(input);
  48432. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48433. state[j] ^= key[k];
  48434. }
  48435. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  48436. t = state[13];
  48437. state[13] = state[9];
  48438. state[9] = state[5];
  48439. state[5] = state[1];
  48440. state[1] = t;
  48441. t = state[14];
  48442. u = state[10];
  48443. state[14] = state[6];
  48444. state[10] = state[2];
  48445. state[6] = t;
  48446. state[2] = u;
  48447. t = state[15];
  48448. u = state[11];
  48449. v = state[7];
  48450. state[15] = state[3];
  48451. state[11] = t;
  48452. state[7] = u;
  48453. state[3] = v;
  48454. for (let j = 0; j < 16; ++j) {
  48455. state[j] = this._inv_s[state[j]];
  48456. }
  48457. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48458. state[j] ^= key[k];
  48459. }
  48460. for (let j = 0; j < 16; j += 4) {
  48461. const s0 = this._mix[state[j]];
  48462. const s1 = this._mix[state[j + 1]];
  48463. const s2 = this._mix[state[j + 2]];
  48464. const s3 = this._mix[state[j + 3]];
  48465. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  48466. state[j] = t >>> 24 & 0xff;
  48467. state[j + 1] = t >> 16 & 0xff;
  48468. state[j + 2] = t >> 8 & 0xff;
  48469. state[j + 3] = t & 0xff;
  48470. }
  48471. }
  48472. t = state[13];
  48473. state[13] = state[9];
  48474. state[9] = state[5];
  48475. state[5] = state[1];
  48476. state[1] = t;
  48477. t = state[14];
  48478. u = state[10];
  48479. state[14] = state[6];
  48480. state[10] = state[2];
  48481. state[6] = t;
  48482. state[2] = u;
  48483. t = state[15];
  48484. u = state[11];
  48485. v = state[7];
  48486. state[15] = state[3];
  48487. state[11] = t;
  48488. state[7] = u;
  48489. state[3] = v;
  48490. for (let j = 0; j < 16; ++j) {
  48491. state[j] = this._inv_s[state[j]];
  48492. state[j] ^= key[j];
  48493. }
  48494. return state;
  48495. }
  48496. _encrypt(input, key) {
  48497. const s = this._s;
  48498. let t, u, v;
  48499. const state = new Uint8Array(16);
  48500. state.set(input);
  48501. for (let j = 0; j < 16; ++j) {
  48502. state[j] ^= key[j];
  48503. }
  48504. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  48505. for (let j = 0; j < 16; ++j) {
  48506. state[j] = s[state[j]];
  48507. }
  48508. v = state[1];
  48509. state[1] = state[5];
  48510. state[5] = state[9];
  48511. state[9] = state[13];
  48512. state[13] = v;
  48513. v = state[2];
  48514. u = state[6];
  48515. state[2] = state[10];
  48516. state[6] = state[14];
  48517. state[10] = v;
  48518. state[14] = u;
  48519. v = state[3];
  48520. u = state[7];
  48521. t = state[11];
  48522. state[3] = state[15];
  48523. state[7] = v;
  48524. state[11] = u;
  48525. state[15] = t;
  48526. for (let j = 0; j < 16; j += 4) {
  48527. const s0 = state[j + 0];
  48528. const s1 = state[j + 1];
  48529. const s2 = state[j + 2];
  48530. const s3 = state[j + 3];
  48531. t = s0 ^ s1 ^ s2 ^ s3;
  48532. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  48533. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  48534. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  48535. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  48536. }
  48537. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48538. state[j] ^= key[k];
  48539. }
  48540. }
  48541. for (let j = 0; j < 16; ++j) {
  48542. state[j] = s[state[j]];
  48543. }
  48544. v = state[1];
  48545. state[1] = state[5];
  48546. state[5] = state[9];
  48547. state[9] = state[13];
  48548. state[13] = v;
  48549. v = state[2];
  48550. u = state[6];
  48551. state[2] = state[10];
  48552. state[6] = state[14];
  48553. state[10] = v;
  48554. state[14] = u;
  48555. v = state[3];
  48556. u = state[7];
  48557. t = state[11];
  48558. state[3] = state[15];
  48559. state[7] = v;
  48560. state[11] = u;
  48561. state[15] = t;
  48562. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48563. state[j] ^= key[k];
  48564. }
  48565. return state;
  48566. }
  48567. _decryptBlock2(data, finalize) {
  48568. const sourceLength = data.length;
  48569. let buffer = this.buffer,
  48570. bufferLength = this.bufferPosition;
  48571. const result = [];
  48572. let iv = this.iv;
  48573. for (let i = 0; i < sourceLength; ++i) {
  48574. buffer[bufferLength] = data[i];
  48575. ++bufferLength;
  48576. if (bufferLength < 16) {
  48577. continue;
  48578. }
  48579. const plain = this._decrypt(buffer, this._key);
  48580. for (let j = 0; j < 16; ++j) {
  48581. plain[j] ^= iv[j];
  48582. }
  48583. iv = buffer;
  48584. result.push(plain);
  48585. buffer = new Uint8Array(16);
  48586. bufferLength = 0;
  48587. }
  48588. this.buffer = buffer;
  48589. this.bufferLength = bufferLength;
  48590. this.iv = iv;
  48591. if (result.length === 0) {
  48592. return new Uint8Array(0);
  48593. }
  48594. let outputLength = 16 * result.length;
  48595. if (finalize) {
  48596. const lastBlock = result.at(-1);
  48597. let psLen = lastBlock[15];
  48598. if (psLen <= 16) {
  48599. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  48600. if (lastBlock[i] !== psLen) {
  48601. psLen = 0;
  48602. break;
  48603. }
  48604. }
  48605. outputLength -= psLen;
  48606. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  48607. }
  48608. }
  48609. const output = new Uint8Array(outputLength);
  48610. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48611. output.set(result[i], j);
  48612. }
  48613. return output;
  48614. }
  48615. decryptBlock(data, finalize, iv = null) {
  48616. const sourceLength = data.length;
  48617. const buffer = this.buffer;
  48618. let bufferLength = this.bufferPosition;
  48619. if (iv) {
  48620. this.iv = iv;
  48621. } else {
  48622. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  48623. buffer[bufferLength] = data[i];
  48624. }
  48625. if (bufferLength < 16) {
  48626. this.bufferLength = bufferLength;
  48627. return new Uint8Array(0);
  48628. }
  48629. this.iv = buffer;
  48630. data = data.subarray(16);
  48631. }
  48632. this.buffer = new Uint8Array(16);
  48633. this.bufferLength = 0;
  48634. this.decryptBlock = this._decryptBlock2;
  48635. return this.decryptBlock(data, finalize);
  48636. }
  48637. encrypt(data, iv) {
  48638. const sourceLength = data.length;
  48639. let buffer = this.buffer,
  48640. bufferLength = this.bufferPosition;
  48641. const result = [];
  48642. if (!iv) {
  48643. iv = new Uint8Array(16);
  48644. }
  48645. for (let i = 0; i < sourceLength; ++i) {
  48646. buffer[bufferLength] = data[i];
  48647. ++bufferLength;
  48648. if (bufferLength < 16) {
  48649. continue;
  48650. }
  48651. for (let j = 0; j < 16; ++j) {
  48652. buffer[j] ^= iv[j];
  48653. }
  48654. const cipher = this._encrypt(buffer, this._key);
  48655. iv = cipher;
  48656. result.push(cipher);
  48657. buffer = new Uint8Array(16);
  48658. bufferLength = 0;
  48659. }
  48660. this.buffer = buffer;
  48661. this.bufferLength = bufferLength;
  48662. this.iv = iv;
  48663. if (result.length === 0) {
  48664. return new Uint8Array(0);
  48665. }
  48666. const outputLength = 16 * result.length;
  48667. const output = new Uint8Array(outputLength);
  48668. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48669. output.set(result[i], j);
  48670. }
  48671. return output;
  48672. }
  48673. }
  48674. class AES128Cipher extends AESBaseCipher {
  48675. constructor(key) {
  48676. super();
  48677. this._cyclesOfRepetition = 10;
  48678. this._keySize = 160;
  48679. 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]);
  48680. this._key = this._expandKey(key);
  48681. }
  48682. _expandKey(cipherKey) {
  48683. const b = 176;
  48684. const s = this._s;
  48685. const rcon = this._rcon;
  48686. const result = new Uint8Array(b);
  48687. result.set(cipherKey);
  48688. for (let j = 16, i = 1; j < b; ++i) {
  48689. let t1 = result[j - 3];
  48690. let t2 = result[j - 2];
  48691. let t3 = result[j - 1];
  48692. let t4 = result[j - 4];
  48693. t1 = s[t1];
  48694. t2 = s[t2];
  48695. t3 = s[t3];
  48696. t4 = s[t4];
  48697. t1 ^= rcon[i];
  48698. for (let n = 0; n < 4; ++n) {
  48699. result[j] = t1 ^= result[j - 16];
  48700. j++;
  48701. result[j] = t2 ^= result[j - 16];
  48702. j++;
  48703. result[j] = t3 ^= result[j - 16];
  48704. j++;
  48705. result[j] = t4 ^= result[j - 16];
  48706. j++;
  48707. }
  48708. }
  48709. return result;
  48710. }
  48711. }
  48712. exports.AES128Cipher = AES128Cipher;
  48713. class AES256Cipher extends AESBaseCipher {
  48714. constructor(key) {
  48715. super();
  48716. this._cyclesOfRepetition = 14;
  48717. this._keySize = 224;
  48718. this._key = this._expandKey(key);
  48719. }
  48720. _expandKey(cipherKey) {
  48721. const b = 240;
  48722. const s = this._s;
  48723. const result = new Uint8Array(b);
  48724. result.set(cipherKey);
  48725. let r = 1;
  48726. let t1, t2, t3, t4;
  48727. for (let j = 32, i = 1; j < b; ++i) {
  48728. if (j % 32 === 16) {
  48729. t1 = s[t1];
  48730. t2 = s[t2];
  48731. t3 = s[t3];
  48732. t4 = s[t4];
  48733. } else if (j % 32 === 0) {
  48734. t1 = result[j - 3];
  48735. t2 = result[j - 2];
  48736. t3 = result[j - 1];
  48737. t4 = result[j - 4];
  48738. t1 = s[t1];
  48739. t2 = s[t2];
  48740. t3 = s[t3];
  48741. t4 = s[t4];
  48742. t1 ^= r;
  48743. if ((r <<= 1) >= 256) {
  48744. r = (r ^ 0x1b) & 0xff;
  48745. }
  48746. }
  48747. for (let n = 0; n < 4; ++n) {
  48748. result[j] = t1 ^= result[j - 32];
  48749. j++;
  48750. result[j] = t2 ^= result[j - 32];
  48751. j++;
  48752. result[j] = t3 ^= result[j - 32];
  48753. j++;
  48754. result[j] = t4 ^= result[j - 32];
  48755. j++;
  48756. }
  48757. }
  48758. return result;
  48759. }
  48760. }
  48761. exports.AES256Cipher = AES256Cipher;
  48762. class PDF17 {
  48763. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  48764. const hashData = new Uint8Array(password.length + 56);
  48765. hashData.set(password, 0);
  48766. hashData.set(ownerValidationSalt, password.length);
  48767. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  48768. const result = calculateSHA256(hashData, 0, hashData.length);
  48769. return (0, _util.isArrayEqual)(result, ownerPassword);
  48770. }
  48771. checkUserPassword(password, userValidationSalt, userPassword) {
  48772. const hashData = new Uint8Array(password.length + 8);
  48773. hashData.set(password, 0);
  48774. hashData.set(userValidationSalt, password.length);
  48775. const result = calculateSHA256(hashData, 0, hashData.length);
  48776. return (0, _util.isArrayEqual)(result, userPassword);
  48777. }
  48778. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  48779. const hashData = new Uint8Array(password.length + 56);
  48780. hashData.set(password, 0);
  48781. hashData.set(ownerKeySalt, password.length);
  48782. hashData.set(userBytes, password.length + ownerKeySalt.length);
  48783. const key = calculateSHA256(hashData, 0, hashData.length);
  48784. const cipher = new AES256Cipher(key);
  48785. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  48786. }
  48787. getUserKey(password, userKeySalt, userEncryption) {
  48788. const hashData = new Uint8Array(password.length + 8);
  48789. hashData.set(password, 0);
  48790. hashData.set(userKeySalt, password.length);
  48791. const key = calculateSHA256(hashData, 0, hashData.length);
  48792. const cipher = new AES256Cipher(key);
  48793. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  48794. }
  48795. }
  48796. exports.PDF17 = PDF17;
  48797. const PDF20 = function PDF20Closure() {
  48798. function calculatePDF20Hash(password, input, userBytes) {
  48799. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  48800. let e = [0];
  48801. let i = 0;
  48802. while (i < 64 || e.at(-1) > i - 32) {
  48803. const combinedLength = password.length + k.length + userBytes.length,
  48804. combinedArray = new Uint8Array(combinedLength);
  48805. let writeOffset = 0;
  48806. combinedArray.set(password, writeOffset);
  48807. writeOffset += password.length;
  48808. combinedArray.set(k, writeOffset);
  48809. writeOffset += k.length;
  48810. combinedArray.set(userBytes, writeOffset);
  48811. const k1 = new Uint8Array(combinedLength * 64);
  48812. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  48813. k1.set(combinedArray, pos);
  48814. }
  48815. const cipher = new AES128Cipher(k.subarray(0, 16));
  48816. e = cipher.encrypt(k1, k.subarray(16, 32));
  48817. let remainder = 0;
  48818. for (let z = 0; z < 16; z++) {
  48819. remainder *= 256 % 3;
  48820. remainder %= 3;
  48821. remainder += (e[z] >>> 0) % 3;
  48822. remainder %= 3;
  48823. }
  48824. if (remainder === 0) {
  48825. k = calculateSHA256(e, 0, e.length);
  48826. } else if (remainder === 1) {
  48827. k = calculateSHA384(e, 0, e.length);
  48828. } else if (remainder === 2) {
  48829. k = calculateSHA512(e, 0, e.length);
  48830. }
  48831. i++;
  48832. }
  48833. return k.subarray(0, 32);
  48834. }
  48835. class PDF20 {
  48836. hash(password, concatBytes, userBytes) {
  48837. return calculatePDF20Hash(password, concatBytes, userBytes);
  48838. }
  48839. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  48840. const hashData = new Uint8Array(password.length + 56);
  48841. hashData.set(password, 0);
  48842. hashData.set(ownerValidationSalt, password.length);
  48843. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  48844. const result = calculatePDF20Hash(password, hashData, userBytes);
  48845. return (0, _util.isArrayEqual)(result, ownerPassword);
  48846. }
  48847. checkUserPassword(password, userValidationSalt, userPassword) {
  48848. const hashData = new Uint8Array(password.length + 8);
  48849. hashData.set(password, 0);
  48850. hashData.set(userValidationSalt, password.length);
  48851. const result = calculatePDF20Hash(password, hashData, []);
  48852. return (0, _util.isArrayEqual)(result, userPassword);
  48853. }
  48854. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  48855. const hashData = new Uint8Array(password.length + 56);
  48856. hashData.set(password, 0);
  48857. hashData.set(ownerKeySalt, password.length);
  48858. hashData.set(userBytes, password.length + ownerKeySalt.length);
  48859. const key = calculatePDF20Hash(password, hashData, userBytes);
  48860. const cipher = new AES256Cipher(key);
  48861. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  48862. }
  48863. getUserKey(password, userKeySalt, userEncryption) {
  48864. const hashData = new Uint8Array(password.length + 8);
  48865. hashData.set(password, 0);
  48866. hashData.set(userKeySalt, password.length);
  48867. const key = calculatePDF20Hash(password, hashData, []);
  48868. const cipher = new AES256Cipher(key);
  48869. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  48870. }
  48871. }
  48872. return PDF20;
  48873. }();
  48874. exports.PDF20 = PDF20;
  48875. class CipherTransform {
  48876. constructor(stringCipherConstructor, streamCipherConstructor) {
  48877. this.StringCipherConstructor = stringCipherConstructor;
  48878. this.StreamCipherConstructor = streamCipherConstructor;
  48879. }
  48880. createStream(stream, length) {
  48881. const cipher = new this.StreamCipherConstructor();
  48882. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  48883. return cipher.decryptBlock(data, finalize);
  48884. });
  48885. }
  48886. decryptString(s) {
  48887. const cipher = new this.StringCipherConstructor();
  48888. let data = (0, _util.stringToBytes)(s);
  48889. data = cipher.decryptBlock(data, true);
  48890. return (0, _util.bytesToString)(data);
  48891. }
  48892. encryptString(s) {
  48893. const cipher = new this.StringCipherConstructor();
  48894. if (cipher instanceof AESBaseCipher) {
  48895. const strLen = s.length;
  48896. const pad = 16 - strLen % 16;
  48897. s += String.fromCharCode(pad).repeat(pad);
  48898. const iv = new Uint8Array(16);
  48899. if (typeof crypto !== "undefined") {
  48900. crypto.getRandomValues(iv);
  48901. } else {
  48902. for (let i = 0; i < 16; i++) {
  48903. iv[i] = Math.floor(256 * Math.random());
  48904. }
  48905. }
  48906. let data = (0, _util.stringToBytes)(s);
  48907. data = cipher.encrypt(data, iv);
  48908. const buf = new Uint8Array(16 + data.length);
  48909. buf.set(iv);
  48910. buf.set(data, 16);
  48911. return (0, _util.bytesToString)(buf);
  48912. }
  48913. let data = (0, _util.stringToBytes)(s);
  48914. data = cipher.encrypt(data);
  48915. return (0, _util.bytesToString)(data);
  48916. }
  48917. }
  48918. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  48919. 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]);
  48920. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  48921. if (password) {
  48922. const passwordLength = Math.min(127, password.length);
  48923. password = password.subarray(0, passwordLength);
  48924. } else {
  48925. password = [];
  48926. }
  48927. let pdfAlgorithm;
  48928. if (revision === 6) {
  48929. pdfAlgorithm = new PDF20();
  48930. } else {
  48931. pdfAlgorithm = new PDF17();
  48932. }
  48933. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  48934. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  48935. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  48936. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  48937. }
  48938. return null;
  48939. }
  48940. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  48941. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  48942. const hashData = new Uint8Array(hashDataSize);
  48943. let i = 0,
  48944. j,
  48945. n;
  48946. if (password) {
  48947. n = Math.min(32, password.length);
  48948. for (; i < n; ++i) {
  48949. hashData[i] = password[i];
  48950. }
  48951. }
  48952. j = 0;
  48953. while (i < 32) {
  48954. hashData[i++] = defaultPasswordBytes[j++];
  48955. }
  48956. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  48957. hashData[i++] = ownerPassword[j];
  48958. }
  48959. hashData[i++] = flags & 0xff;
  48960. hashData[i++] = flags >> 8 & 0xff;
  48961. hashData[i++] = flags >> 16 & 0xff;
  48962. hashData[i++] = flags >>> 24 & 0xff;
  48963. for (j = 0, n = fileId.length; j < n; ++j) {
  48964. hashData[i++] = fileId[j];
  48965. }
  48966. if (revision >= 4 && !encryptMetadata) {
  48967. hashData[i++] = 0xff;
  48968. hashData[i++] = 0xff;
  48969. hashData[i++] = 0xff;
  48970. hashData[i++] = 0xff;
  48971. }
  48972. let hash = calculateMD5(hashData, 0, i);
  48973. const keyLengthInBytes = keyLength >> 3;
  48974. if (revision >= 3) {
  48975. for (j = 0; j < 50; ++j) {
  48976. hash = calculateMD5(hash, 0, keyLengthInBytes);
  48977. }
  48978. }
  48979. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  48980. let cipher, checkData;
  48981. if (revision >= 3) {
  48982. for (i = 0; i < 32; ++i) {
  48983. hashData[i] = defaultPasswordBytes[i];
  48984. }
  48985. for (j = 0, n = fileId.length; j < n; ++j) {
  48986. hashData[i++] = fileId[j];
  48987. }
  48988. cipher = new ARCFourCipher(encryptionKey);
  48989. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  48990. n = encryptionKey.length;
  48991. const derivedKey = new Uint8Array(n);
  48992. for (j = 1; j <= 19; ++j) {
  48993. for (let k = 0; k < n; ++k) {
  48994. derivedKey[k] = encryptionKey[k] ^ j;
  48995. }
  48996. cipher = new ARCFourCipher(derivedKey);
  48997. checkData = cipher.encryptBlock(checkData);
  48998. }
  48999. for (j = 0, n = checkData.length; j < n; ++j) {
  49000. if (userPassword[j] !== checkData[j]) {
  49001. return null;
  49002. }
  49003. }
  49004. } else {
  49005. cipher = new ARCFourCipher(encryptionKey);
  49006. checkData = cipher.encryptBlock(defaultPasswordBytes);
  49007. for (j = 0, n = checkData.length; j < n; ++j) {
  49008. if (userPassword[j] !== checkData[j]) {
  49009. return null;
  49010. }
  49011. }
  49012. }
  49013. return encryptionKey;
  49014. }
  49015. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  49016. const hashData = new Uint8Array(32);
  49017. let i = 0;
  49018. const n = Math.min(32, password.length);
  49019. for (; i < n; ++i) {
  49020. hashData[i] = password[i];
  49021. }
  49022. let j = 0;
  49023. while (i < 32) {
  49024. hashData[i++] = defaultPasswordBytes[j++];
  49025. }
  49026. let hash = calculateMD5(hashData, 0, i);
  49027. const keyLengthInBytes = keyLength >> 3;
  49028. if (revision >= 3) {
  49029. for (j = 0; j < 50; ++j) {
  49030. hash = calculateMD5(hash, 0, hash.length);
  49031. }
  49032. }
  49033. let cipher, userPassword;
  49034. if (revision >= 3) {
  49035. userPassword = ownerPassword;
  49036. const derivedKey = new Uint8Array(keyLengthInBytes);
  49037. for (j = 19; j >= 0; j--) {
  49038. for (let k = 0; k < keyLengthInBytes; ++k) {
  49039. derivedKey[k] = hash[k] ^ j;
  49040. }
  49041. cipher = new ARCFourCipher(derivedKey);
  49042. userPassword = cipher.encryptBlock(userPassword);
  49043. }
  49044. } else {
  49045. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  49046. userPassword = cipher.encryptBlock(ownerPassword);
  49047. }
  49048. return userPassword;
  49049. }
  49050. const identityName = _primitives.Name.get("Identity");
  49051. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  49052. const key = new Uint8Array(encryptionKey.length + 9);
  49053. const n = encryptionKey.length;
  49054. let i;
  49055. for (i = 0; i < n; ++i) {
  49056. key[i] = encryptionKey[i];
  49057. }
  49058. key[i++] = num & 0xff;
  49059. key[i++] = num >> 8 & 0xff;
  49060. key[i++] = num >> 16 & 0xff;
  49061. key[i++] = gen & 0xff;
  49062. key[i++] = gen >> 8 & 0xff;
  49063. if (isAes) {
  49064. key[i++] = 0x73;
  49065. key[i++] = 0x41;
  49066. key[i++] = 0x6c;
  49067. key[i++] = 0x54;
  49068. }
  49069. const hash = calculateMD5(key, 0, i);
  49070. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  49071. }
  49072. function buildCipherConstructor(cf, name, num, gen, key) {
  49073. if (!(name instanceof _primitives.Name)) {
  49074. throw new _util.FormatError("Invalid crypt filter name.");
  49075. }
  49076. const cryptFilter = cf.get(name.name);
  49077. let cfm;
  49078. if (cryptFilter !== null && cryptFilter !== undefined) {
  49079. cfm = cryptFilter.get("CFM");
  49080. }
  49081. if (!cfm || cfm.name === "None") {
  49082. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49083. return new NullCipher();
  49084. };
  49085. }
  49086. if (cfm.name === "V2") {
  49087. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49088. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49089. };
  49090. }
  49091. if (cfm.name === "AESV2") {
  49092. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49093. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49094. };
  49095. }
  49096. if (cfm.name === "AESV3") {
  49097. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49098. return new AES256Cipher(key);
  49099. };
  49100. }
  49101. throw new _util.FormatError("Unknown crypto method");
  49102. }
  49103. class CipherTransformFactory {
  49104. constructor(dict, fileId, password) {
  49105. const filter = dict.get("Filter");
  49106. if (!(0, _primitives.isName)(filter, "Standard")) {
  49107. throw new _util.FormatError("unknown encryption method");
  49108. }
  49109. this.filterName = filter.name;
  49110. this.dict = dict;
  49111. const algorithm = dict.get("V");
  49112. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49113. throw new _util.FormatError("unsupported encryption algorithm");
  49114. }
  49115. this.algorithm = algorithm;
  49116. let keyLength = dict.get("Length");
  49117. if (!keyLength) {
  49118. if (algorithm <= 3) {
  49119. keyLength = 40;
  49120. } else {
  49121. const cfDict = dict.get("CF");
  49122. const streamCryptoName = dict.get("StmF");
  49123. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  49124. cfDict.suppressEncryption = true;
  49125. const handlerDict = cfDict.get(streamCryptoName.name);
  49126. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49127. if (keyLength < 40) {
  49128. keyLength <<= 3;
  49129. }
  49130. }
  49131. }
  49132. }
  49133. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49134. throw new _util.FormatError("invalid key length");
  49135. }
  49136. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49137. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49138. const flags = dict.get("P");
  49139. const revision = dict.get("R");
  49140. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49141. this.encryptMetadata = encryptMetadata;
  49142. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49143. let passwordBytes;
  49144. if (password) {
  49145. if (revision === 6) {
  49146. try {
  49147. password = (0, _util.utf8StringToString)(password);
  49148. } catch (ex) {
  49149. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49150. }
  49151. }
  49152. passwordBytes = (0, _util.stringToBytes)(password);
  49153. }
  49154. let encryptionKey;
  49155. if (algorithm !== 5) {
  49156. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49157. } else {
  49158. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49159. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49160. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49161. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49162. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49163. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49164. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  49165. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  49166. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  49167. }
  49168. if (!encryptionKey && !password) {
  49169. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  49170. } else if (!encryptionKey && password) {
  49171. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  49172. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49173. }
  49174. if (!encryptionKey) {
  49175. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  49176. }
  49177. this.encryptionKey = encryptionKey;
  49178. if (algorithm >= 4) {
  49179. const cf = dict.get("CF");
  49180. if (cf instanceof _primitives.Dict) {
  49181. cf.suppressEncryption = true;
  49182. }
  49183. this.cf = cf;
  49184. this.stmf = dict.get("StmF") || identityName;
  49185. this.strf = dict.get("StrF") || identityName;
  49186. this.eff = dict.get("EFF") || this.stmf;
  49187. }
  49188. }
  49189. createCipherTransform(num, gen) {
  49190. if (this.algorithm === 4 || this.algorithm === 5) {
  49191. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  49192. }
  49193. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  49194. const cipherConstructor = function buildCipherCipherConstructor() {
  49195. return new ARCFourCipher(key);
  49196. };
  49197. return new CipherTransform(cipherConstructor, cipherConstructor);
  49198. }
  49199. }
  49200. return CipherTransformFactory;
  49201. }();
  49202. exports.CipherTransformFactory = CipherTransformFactory;
  49203. /***/ }),
  49204. /* 68 */
  49205. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49206. Object.defineProperty(exports, "__esModule", ({
  49207. value: true
  49208. }));
  49209. exports.DecryptStream = void 0;
  49210. var _decode_stream = __w_pdfjs_require__(19);
  49211. const chunkSize = 512;
  49212. class DecryptStream extends _decode_stream.DecodeStream {
  49213. constructor(str, maybeLength, decrypt) {
  49214. super(maybeLength);
  49215. this.str = str;
  49216. this.dict = str.dict;
  49217. this.decrypt = decrypt;
  49218. this.nextChunk = null;
  49219. this.initialized = false;
  49220. }
  49221. readBlock() {
  49222. let chunk;
  49223. if (this.initialized) {
  49224. chunk = this.nextChunk;
  49225. } else {
  49226. chunk = this.str.getBytes(chunkSize);
  49227. this.initialized = true;
  49228. }
  49229. if (!chunk || chunk.length === 0) {
  49230. this.eof = true;
  49231. return;
  49232. }
  49233. this.nextChunk = this.str.getBytes(chunkSize);
  49234. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49235. const decrypt = this.decrypt;
  49236. chunk = decrypt(chunk, !hasMoreData);
  49237. let bufferLength = this.bufferLength;
  49238. const n = chunk.length,
  49239. buffer = this.ensureBuffer(bufferLength + n);
  49240. for (let i = 0; i < n; i++) {
  49241. buffer[bufferLength++] = chunk[i];
  49242. }
  49243. this.bufferLength = bufferLength;
  49244. }
  49245. }
  49246. exports.DecryptStream = DecryptStream;
  49247. /***/ }),
  49248. /* 69 */
  49249. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49250. Object.defineProperty(exports, "__esModule", ({
  49251. value: true
  49252. }));
  49253. exports.Catalog = void 0;
  49254. var _core_utils = __w_pdfjs_require__(6);
  49255. var _util = __w_pdfjs_require__(2);
  49256. var _primitives = __w_pdfjs_require__(5);
  49257. var _name_number_tree = __w_pdfjs_require__(70);
  49258. var _base_stream = __w_pdfjs_require__(7);
  49259. var _cleanup_helper = __w_pdfjs_require__(71);
  49260. var _colorspace = __w_pdfjs_require__(14);
  49261. var _file_spec = __w_pdfjs_require__(72);
  49262. var _image_utils = __w_pdfjs_require__(59);
  49263. var _metadata_parser = __w_pdfjs_require__(73);
  49264. var _struct_tree = __w_pdfjs_require__(74);
  49265. function fetchDestination(dest) {
  49266. if (dest instanceof _primitives.Dict) {
  49267. dest = dest.get("D");
  49268. }
  49269. return Array.isArray(dest) ? dest : null;
  49270. }
  49271. class Catalog {
  49272. constructor(pdfManager, xref) {
  49273. this.pdfManager = pdfManager;
  49274. this.xref = xref;
  49275. this._catDict = xref.getCatalogObj();
  49276. if (!(this._catDict instanceof _primitives.Dict)) {
  49277. throw new _util.FormatError("Catalog object is not a dictionary.");
  49278. }
  49279. this.toplevelPagesDict;
  49280. this._actualNumPages = null;
  49281. this.fontCache = new _primitives.RefSetCache();
  49282. this.builtInCMapCache = new Map();
  49283. this.standardFontDataCache = new Map();
  49284. this.globalImageCache = new _image_utils.GlobalImageCache();
  49285. this.pageKidsCountCache = new _primitives.RefSetCache();
  49286. this.pageIndexCache = new _primitives.RefSetCache();
  49287. this.nonBlendModesSet = new _primitives.RefSet();
  49288. }
  49289. get version() {
  49290. const version = this._catDict.get("Version");
  49291. return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null);
  49292. }
  49293. get lang() {
  49294. const lang = this._catDict.get("Lang");
  49295. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  49296. }
  49297. get needsRendering() {
  49298. const needsRendering = this._catDict.get("NeedsRendering");
  49299. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  49300. }
  49301. get collection() {
  49302. let collection = null;
  49303. try {
  49304. const obj = this._catDict.get("Collection");
  49305. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49306. collection = obj;
  49307. }
  49308. } catch (ex) {
  49309. if (ex instanceof _core_utils.MissingDataException) {
  49310. throw ex;
  49311. }
  49312. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  49313. }
  49314. return (0, _util.shadow)(this, "collection", collection);
  49315. }
  49316. get acroForm() {
  49317. let acroForm = null;
  49318. try {
  49319. const obj = this._catDict.get("AcroForm");
  49320. if (obj instanceof _primitives.Dict && obj.size > 0) {
  49321. acroForm = obj;
  49322. }
  49323. } catch (ex) {
  49324. if (ex instanceof _core_utils.MissingDataException) {
  49325. throw ex;
  49326. }
  49327. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  49328. }
  49329. return (0, _util.shadow)(this, "acroForm", acroForm);
  49330. }
  49331. get acroFormRef() {
  49332. const value = this._catDict.getRaw("AcroForm");
  49333. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  49334. }
  49335. get metadata() {
  49336. const streamRef = this._catDict.getRaw("Metadata");
  49337. if (!(streamRef instanceof _primitives.Ref)) {
  49338. return (0, _util.shadow)(this, "metadata", null);
  49339. }
  49340. let metadata = null;
  49341. try {
  49342. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  49343. const stream = this.xref.fetch(streamRef, suppressEncryption);
  49344. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  49345. const type = stream.dict.get("Type");
  49346. const subtype = stream.dict.get("Subtype");
  49347. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  49348. const data = (0, _util.stringToUTF8String)(stream.getString());
  49349. if (data) {
  49350. metadata = new _metadata_parser.MetadataParser(data).serializable;
  49351. }
  49352. }
  49353. }
  49354. } catch (ex) {
  49355. if (ex instanceof _core_utils.MissingDataException) {
  49356. throw ex;
  49357. }
  49358. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  49359. }
  49360. return (0, _util.shadow)(this, "metadata", metadata);
  49361. }
  49362. get markInfo() {
  49363. let markInfo = null;
  49364. try {
  49365. markInfo = this._readMarkInfo();
  49366. } catch (ex) {
  49367. if (ex instanceof _core_utils.MissingDataException) {
  49368. throw ex;
  49369. }
  49370. (0, _util.warn)("Unable to read mark info.");
  49371. }
  49372. return (0, _util.shadow)(this, "markInfo", markInfo);
  49373. }
  49374. _readMarkInfo() {
  49375. const obj = this._catDict.get("MarkInfo");
  49376. if (!(obj instanceof _primitives.Dict)) {
  49377. return null;
  49378. }
  49379. const markInfo = {
  49380. Marked: false,
  49381. UserProperties: false,
  49382. Suspects: false
  49383. };
  49384. for (const key in markInfo) {
  49385. const value = obj.get(key);
  49386. if (typeof value === "boolean") {
  49387. markInfo[key] = value;
  49388. }
  49389. }
  49390. return markInfo;
  49391. }
  49392. get structTreeRoot() {
  49393. let structTree = null;
  49394. try {
  49395. structTree = this._readStructTreeRoot();
  49396. } catch (ex) {
  49397. if (ex instanceof _core_utils.MissingDataException) {
  49398. throw ex;
  49399. }
  49400. (0, _util.warn)("Unable read to structTreeRoot info.");
  49401. }
  49402. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  49403. }
  49404. _readStructTreeRoot() {
  49405. const obj = this._catDict.get("StructTreeRoot");
  49406. if (!(obj instanceof _primitives.Dict)) {
  49407. return null;
  49408. }
  49409. const root = new _struct_tree.StructTreeRoot(obj);
  49410. root.init();
  49411. return root;
  49412. }
  49413. get toplevelPagesDict() {
  49414. const pagesObj = this._catDict.get("Pages");
  49415. if (!(pagesObj instanceof _primitives.Dict)) {
  49416. throw new _util.FormatError("Invalid top-level pages dictionary.");
  49417. }
  49418. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  49419. }
  49420. get documentOutline() {
  49421. let obj = null;
  49422. try {
  49423. obj = this._readDocumentOutline();
  49424. } catch (ex) {
  49425. if (ex instanceof _core_utils.MissingDataException) {
  49426. throw ex;
  49427. }
  49428. (0, _util.warn)("Unable to read document outline.");
  49429. }
  49430. return (0, _util.shadow)(this, "documentOutline", obj);
  49431. }
  49432. _readDocumentOutline() {
  49433. let obj = this._catDict.get("Outlines");
  49434. if (!(obj instanceof _primitives.Dict)) {
  49435. return null;
  49436. }
  49437. obj = obj.getRaw("First");
  49438. if (!(obj instanceof _primitives.Ref)) {
  49439. return null;
  49440. }
  49441. const root = {
  49442. items: []
  49443. };
  49444. const queue = [{
  49445. obj,
  49446. parent: root
  49447. }];
  49448. const processed = new _primitives.RefSet();
  49449. processed.put(obj);
  49450. const xref = this.xref,
  49451. blackColor = new Uint8ClampedArray(3);
  49452. while (queue.length > 0) {
  49453. const i = queue.shift();
  49454. const outlineDict = xref.fetchIfRef(i.obj);
  49455. if (outlineDict === null) {
  49456. continue;
  49457. }
  49458. if (!outlineDict.has("Title")) {
  49459. throw new _util.FormatError("Invalid outline item encountered.");
  49460. }
  49461. const data = {
  49462. url: null,
  49463. dest: null
  49464. };
  49465. Catalog.parseDestDictionary({
  49466. destDict: outlineDict,
  49467. resultObj: data,
  49468. docBaseUrl: this.pdfManager.docBaseUrl
  49469. });
  49470. const title = outlineDict.get("Title");
  49471. const flags = outlineDict.get("F") || 0;
  49472. const color = outlineDict.getArray("C");
  49473. const count = outlineDict.get("Count");
  49474. let rgbColor = blackColor;
  49475. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  49476. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  49477. }
  49478. const outlineItem = {
  49479. dest: data.dest,
  49480. url: data.url,
  49481. unsafeUrl: data.unsafeUrl,
  49482. newWindow: data.newWindow,
  49483. title: (0, _util.stringToPDFString)(title),
  49484. color: rgbColor,
  49485. count: Number.isInteger(count) ? count : undefined,
  49486. bold: !!(flags & 2),
  49487. italic: !!(flags & 1),
  49488. items: []
  49489. };
  49490. i.parent.items.push(outlineItem);
  49491. obj = outlineDict.getRaw("First");
  49492. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49493. queue.push({
  49494. obj,
  49495. parent: outlineItem
  49496. });
  49497. processed.put(obj);
  49498. }
  49499. obj = outlineDict.getRaw("Next");
  49500. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  49501. queue.push({
  49502. obj,
  49503. parent: i.parent
  49504. });
  49505. processed.put(obj);
  49506. }
  49507. }
  49508. return root.items.length > 0 ? root.items : null;
  49509. }
  49510. get permissions() {
  49511. let permissions = null;
  49512. try {
  49513. permissions = this._readPermissions();
  49514. } catch (ex) {
  49515. if (ex instanceof _core_utils.MissingDataException) {
  49516. throw ex;
  49517. }
  49518. (0, _util.warn)("Unable to read permissions.");
  49519. }
  49520. return (0, _util.shadow)(this, "permissions", permissions);
  49521. }
  49522. _readPermissions() {
  49523. const encrypt = this.xref.trailer.get("Encrypt");
  49524. if (!(encrypt instanceof _primitives.Dict)) {
  49525. return null;
  49526. }
  49527. let flags = encrypt.get("P");
  49528. if (typeof flags !== "number") {
  49529. return null;
  49530. }
  49531. flags += 2 ** 32;
  49532. const permissions = [];
  49533. for (const key in _util.PermissionFlag) {
  49534. const value = _util.PermissionFlag[key];
  49535. if (flags & value) {
  49536. permissions.push(value);
  49537. }
  49538. }
  49539. return permissions;
  49540. }
  49541. get optionalContentConfig() {
  49542. let config = null;
  49543. try {
  49544. const properties = this._catDict.get("OCProperties");
  49545. if (!properties) {
  49546. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49547. }
  49548. const defaultConfig = properties.get("D");
  49549. if (!defaultConfig) {
  49550. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49551. }
  49552. const groupsData = properties.get("OCGs");
  49553. if (!Array.isArray(groupsData)) {
  49554. return (0, _util.shadow)(this, "optionalContentConfig", null);
  49555. }
  49556. const groups = [];
  49557. const groupRefs = [];
  49558. for (const groupRef of groupsData) {
  49559. if (!(groupRef instanceof _primitives.Ref)) {
  49560. continue;
  49561. }
  49562. groupRefs.push(groupRef);
  49563. const group = this.xref.fetchIfRef(groupRef);
  49564. groups.push({
  49565. id: groupRef.toString(),
  49566. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  49567. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  49568. });
  49569. }
  49570. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  49571. config.groups = groups;
  49572. } catch (ex) {
  49573. if (ex instanceof _core_utils.MissingDataException) {
  49574. throw ex;
  49575. }
  49576. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  49577. }
  49578. return (0, _util.shadow)(this, "optionalContentConfig", config);
  49579. }
  49580. _readOptionalContentConfig(config, contentGroupRefs) {
  49581. function parseOnOff(refs) {
  49582. const onParsed = [];
  49583. if (Array.isArray(refs)) {
  49584. for (const value of refs) {
  49585. if (!(value instanceof _primitives.Ref)) {
  49586. continue;
  49587. }
  49588. if (contentGroupRefs.includes(value)) {
  49589. onParsed.push(value.toString());
  49590. }
  49591. }
  49592. }
  49593. return onParsed;
  49594. }
  49595. function parseOrder(refs, nestedLevels = 0) {
  49596. if (!Array.isArray(refs)) {
  49597. return null;
  49598. }
  49599. const order = [];
  49600. for (const value of refs) {
  49601. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  49602. parsedOrderRefs.put(value);
  49603. order.push(value.toString());
  49604. continue;
  49605. }
  49606. const nestedOrder = parseNestedOrder(value, nestedLevels);
  49607. if (nestedOrder) {
  49608. order.push(nestedOrder);
  49609. }
  49610. }
  49611. if (nestedLevels > 0) {
  49612. return order;
  49613. }
  49614. const hiddenGroups = [];
  49615. for (const groupRef of contentGroupRefs) {
  49616. if (parsedOrderRefs.has(groupRef)) {
  49617. continue;
  49618. }
  49619. hiddenGroups.push(groupRef.toString());
  49620. }
  49621. if (hiddenGroups.length) {
  49622. order.push({
  49623. name: null,
  49624. order: hiddenGroups
  49625. });
  49626. }
  49627. return order;
  49628. }
  49629. function parseNestedOrder(ref, nestedLevels) {
  49630. if (++nestedLevels > MAX_NESTED_LEVELS) {
  49631. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  49632. return null;
  49633. }
  49634. const value = xref.fetchIfRef(ref);
  49635. if (!Array.isArray(value)) {
  49636. return null;
  49637. }
  49638. const nestedName = xref.fetchIfRef(value[0]);
  49639. if (typeof nestedName !== "string") {
  49640. return null;
  49641. }
  49642. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  49643. if (!nestedOrder || !nestedOrder.length) {
  49644. return null;
  49645. }
  49646. return {
  49647. name: (0, _util.stringToPDFString)(nestedName),
  49648. order: nestedOrder
  49649. };
  49650. }
  49651. const xref = this.xref,
  49652. parsedOrderRefs = new _primitives.RefSet(),
  49653. MAX_NESTED_LEVELS = 10;
  49654. return {
  49655. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  49656. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  49657. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  49658. on: parseOnOff(config.get("ON")),
  49659. off: parseOnOff(config.get("OFF")),
  49660. order: parseOrder(config.get("Order")),
  49661. groups: null
  49662. };
  49663. }
  49664. setActualNumPages(num = null) {
  49665. this._actualNumPages = num;
  49666. }
  49667. get hasActualNumPages() {
  49668. return this._actualNumPages !== null;
  49669. }
  49670. get _pagesCount() {
  49671. const obj = this.toplevelPagesDict.get("Count");
  49672. if (!Number.isInteger(obj)) {
  49673. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  49674. }
  49675. return (0, _util.shadow)(this, "_pagesCount", obj);
  49676. }
  49677. get numPages() {
  49678. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  49679. }
  49680. get destinations() {
  49681. const obj = this._readDests(),
  49682. dests = Object.create(null);
  49683. if (obj instanceof _name_number_tree.NameTree) {
  49684. for (const [key, value] of obj.getAll()) {
  49685. const dest = fetchDestination(value);
  49686. if (dest) {
  49687. dests[(0, _util.stringToPDFString)(key)] = dest;
  49688. }
  49689. }
  49690. } else if (obj instanceof _primitives.Dict) {
  49691. obj.forEach(function (key, value) {
  49692. const dest = fetchDestination(value);
  49693. if (dest) {
  49694. dests[key] = dest;
  49695. }
  49696. });
  49697. }
  49698. return (0, _util.shadow)(this, "destinations", dests);
  49699. }
  49700. getDestination(id) {
  49701. const obj = this._readDests();
  49702. if (obj instanceof _name_number_tree.NameTree) {
  49703. const dest = fetchDestination(obj.get(id));
  49704. if (dest) {
  49705. return dest;
  49706. }
  49707. const allDest = this.destinations[id];
  49708. if (allDest) {
  49709. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  49710. return allDest;
  49711. }
  49712. } else if (obj instanceof _primitives.Dict) {
  49713. const dest = fetchDestination(obj.get(id));
  49714. if (dest) {
  49715. return dest;
  49716. }
  49717. }
  49718. return null;
  49719. }
  49720. _readDests() {
  49721. const obj = this._catDict.get("Names");
  49722. if (obj && obj.has("Dests")) {
  49723. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  49724. } else if (this._catDict.has("Dests")) {
  49725. return this._catDict.get("Dests");
  49726. }
  49727. return undefined;
  49728. }
  49729. get pageLabels() {
  49730. let obj = null;
  49731. try {
  49732. obj = this._readPageLabels();
  49733. } catch (ex) {
  49734. if (ex instanceof _core_utils.MissingDataException) {
  49735. throw ex;
  49736. }
  49737. (0, _util.warn)("Unable to read page labels.");
  49738. }
  49739. return (0, _util.shadow)(this, "pageLabels", obj);
  49740. }
  49741. _readPageLabels() {
  49742. const obj = this._catDict.getRaw("PageLabels");
  49743. if (!obj) {
  49744. return null;
  49745. }
  49746. const pageLabels = new Array(this.numPages);
  49747. let style = null,
  49748. prefix = "";
  49749. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  49750. const nums = numberTree.getAll();
  49751. let currentLabel = "",
  49752. currentIndex = 1;
  49753. for (let i = 0, ii = this.numPages; i < ii; i++) {
  49754. const labelDict = nums.get(i);
  49755. if (labelDict !== undefined) {
  49756. if (!(labelDict instanceof _primitives.Dict)) {
  49757. throw new _util.FormatError("PageLabel is not a dictionary.");
  49758. }
  49759. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  49760. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  49761. }
  49762. if (labelDict.has("S")) {
  49763. const s = labelDict.get("S");
  49764. if (!(s instanceof _primitives.Name)) {
  49765. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  49766. }
  49767. style = s.name;
  49768. } else {
  49769. style = null;
  49770. }
  49771. if (labelDict.has("P")) {
  49772. const p = labelDict.get("P");
  49773. if (typeof p !== "string") {
  49774. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  49775. }
  49776. prefix = (0, _util.stringToPDFString)(p);
  49777. } else {
  49778. prefix = "";
  49779. }
  49780. if (labelDict.has("St")) {
  49781. const st = labelDict.get("St");
  49782. if (!(Number.isInteger(st) && st >= 1)) {
  49783. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  49784. }
  49785. currentIndex = st;
  49786. } else {
  49787. currentIndex = 1;
  49788. }
  49789. }
  49790. switch (style) {
  49791. case "D":
  49792. currentLabel = currentIndex;
  49793. break;
  49794. case "R":
  49795. case "r":
  49796. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  49797. break;
  49798. case "A":
  49799. case "a":
  49800. const LIMIT = 26;
  49801. const A_UPPER_CASE = 0x41,
  49802. A_LOWER_CASE = 0x61;
  49803. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  49804. const letterIndex = currentIndex - 1;
  49805. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  49806. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  49807. break;
  49808. default:
  49809. if (style) {
  49810. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  49811. }
  49812. currentLabel = "";
  49813. }
  49814. pageLabels[i] = prefix + currentLabel;
  49815. currentIndex++;
  49816. }
  49817. return pageLabels;
  49818. }
  49819. get pageLayout() {
  49820. const obj = this._catDict.get("PageLayout");
  49821. let pageLayout = "";
  49822. if (obj instanceof _primitives.Name) {
  49823. switch (obj.name) {
  49824. case "SinglePage":
  49825. case "OneColumn":
  49826. case "TwoColumnLeft":
  49827. case "TwoColumnRight":
  49828. case "TwoPageLeft":
  49829. case "TwoPageRight":
  49830. pageLayout = obj.name;
  49831. }
  49832. }
  49833. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  49834. }
  49835. get pageMode() {
  49836. const obj = this._catDict.get("PageMode");
  49837. let pageMode = "UseNone";
  49838. if (obj instanceof _primitives.Name) {
  49839. switch (obj.name) {
  49840. case "UseNone":
  49841. case "UseOutlines":
  49842. case "UseThumbs":
  49843. case "FullScreen":
  49844. case "UseOC":
  49845. case "UseAttachments":
  49846. pageMode = obj.name;
  49847. }
  49848. }
  49849. return (0, _util.shadow)(this, "pageMode", pageMode);
  49850. }
  49851. get viewerPreferences() {
  49852. const obj = this._catDict.get("ViewerPreferences");
  49853. if (!(obj instanceof _primitives.Dict)) {
  49854. return (0, _util.shadow)(this, "viewerPreferences", null);
  49855. }
  49856. let prefs = null;
  49857. for (const key of obj.getKeys()) {
  49858. const value = obj.get(key);
  49859. let prefValue;
  49860. switch (key) {
  49861. case "HideToolbar":
  49862. case "HideMenubar":
  49863. case "HideWindowUI":
  49864. case "FitWindow":
  49865. case "CenterWindow":
  49866. case "DisplayDocTitle":
  49867. case "PickTrayByPDFSize":
  49868. if (typeof value === "boolean") {
  49869. prefValue = value;
  49870. }
  49871. break;
  49872. case "NonFullScreenPageMode":
  49873. if (value instanceof _primitives.Name) {
  49874. switch (value.name) {
  49875. case "UseNone":
  49876. case "UseOutlines":
  49877. case "UseThumbs":
  49878. case "UseOC":
  49879. prefValue = value.name;
  49880. break;
  49881. default:
  49882. prefValue = "UseNone";
  49883. }
  49884. }
  49885. break;
  49886. case "Direction":
  49887. if (value instanceof _primitives.Name) {
  49888. switch (value.name) {
  49889. case "L2R":
  49890. case "R2L":
  49891. prefValue = value.name;
  49892. break;
  49893. default:
  49894. prefValue = "L2R";
  49895. }
  49896. }
  49897. break;
  49898. case "ViewArea":
  49899. case "ViewClip":
  49900. case "PrintArea":
  49901. case "PrintClip":
  49902. if (value instanceof _primitives.Name) {
  49903. switch (value.name) {
  49904. case "MediaBox":
  49905. case "CropBox":
  49906. case "BleedBox":
  49907. case "TrimBox":
  49908. case "ArtBox":
  49909. prefValue = value.name;
  49910. break;
  49911. default:
  49912. prefValue = "CropBox";
  49913. }
  49914. }
  49915. break;
  49916. case "PrintScaling":
  49917. if (value instanceof _primitives.Name) {
  49918. switch (value.name) {
  49919. case "None":
  49920. case "AppDefault":
  49921. prefValue = value.name;
  49922. break;
  49923. default:
  49924. prefValue = "AppDefault";
  49925. }
  49926. }
  49927. break;
  49928. case "Duplex":
  49929. if (value instanceof _primitives.Name) {
  49930. switch (value.name) {
  49931. case "Simplex":
  49932. case "DuplexFlipShortEdge":
  49933. case "DuplexFlipLongEdge":
  49934. prefValue = value.name;
  49935. break;
  49936. default:
  49937. prefValue = "None";
  49938. }
  49939. }
  49940. break;
  49941. case "PrintPageRange":
  49942. if (Array.isArray(value) && value.length % 2 === 0) {
  49943. const isValid = value.every((page, i, arr) => {
  49944. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  49945. });
  49946. if (isValid) {
  49947. prefValue = value;
  49948. }
  49949. }
  49950. break;
  49951. case "NumCopies":
  49952. if (Number.isInteger(value) && value > 0) {
  49953. prefValue = value;
  49954. }
  49955. break;
  49956. default:
  49957. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  49958. continue;
  49959. }
  49960. if (prefValue === undefined) {
  49961. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  49962. continue;
  49963. }
  49964. if (!prefs) {
  49965. prefs = Object.create(null);
  49966. }
  49967. prefs[key] = prefValue;
  49968. }
  49969. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  49970. }
  49971. get openAction() {
  49972. const obj = this._catDict.get("OpenAction");
  49973. const openAction = Object.create(null);
  49974. if (obj instanceof _primitives.Dict) {
  49975. const destDict = new _primitives.Dict(this.xref);
  49976. destDict.set("A", obj);
  49977. const resultObj = {
  49978. url: null,
  49979. dest: null,
  49980. action: null
  49981. };
  49982. Catalog.parseDestDictionary({
  49983. destDict,
  49984. resultObj
  49985. });
  49986. if (Array.isArray(resultObj.dest)) {
  49987. openAction.dest = resultObj.dest;
  49988. } else if (resultObj.action) {
  49989. openAction.action = resultObj.action;
  49990. }
  49991. } else if (Array.isArray(obj)) {
  49992. openAction.dest = obj;
  49993. }
  49994. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  49995. }
  49996. get attachments() {
  49997. const obj = this._catDict.get("Names");
  49998. let attachments = null;
  49999. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  50000. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  50001. for (const [key, value] of nameTree.getAll()) {
  50002. const fs = new _file_spec.FileSpec(value, this.xref);
  50003. if (!attachments) {
  50004. attachments = Object.create(null);
  50005. }
  50006. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  50007. }
  50008. }
  50009. return (0, _util.shadow)(this, "attachments", attachments);
  50010. }
  50011. get xfaImages() {
  50012. const obj = this._catDict.get("Names");
  50013. let xfaImages = null;
  50014. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  50015. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  50016. for (const [key, value] of nameTree.getAll()) {
  50017. if (!xfaImages) {
  50018. xfaImages = new _primitives.Dict(this.xref);
  50019. }
  50020. xfaImages.set((0, _util.stringToPDFString)(key), value);
  50021. }
  50022. }
  50023. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  50024. }
  50025. _collectJavaScript() {
  50026. const obj = this._catDict.get("Names");
  50027. let javaScript = null;
  50028. function appendIfJavaScriptDict(name, jsDict) {
  50029. if (!(jsDict instanceof _primitives.Dict)) {
  50030. return;
  50031. }
  50032. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  50033. return;
  50034. }
  50035. let js = jsDict.get("JS");
  50036. if (js instanceof _base_stream.BaseStream) {
  50037. js = js.getString();
  50038. } else if (typeof js !== "string") {
  50039. return;
  50040. }
  50041. if (javaScript === null) {
  50042. javaScript = new Map();
  50043. }
  50044. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  50045. javaScript.set(name, js);
  50046. }
  50047. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  50048. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  50049. for (const [key, value] of nameTree.getAll()) {
  50050. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  50051. }
  50052. }
  50053. const openAction = this._catDict.get("OpenAction");
  50054. if (openAction) {
  50055. appendIfJavaScriptDict("OpenAction", openAction);
  50056. }
  50057. return javaScript;
  50058. }
  50059. get javaScript() {
  50060. const javaScript = this._collectJavaScript();
  50061. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  50062. }
  50063. get jsActions() {
  50064. const javaScript = this._collectJavaScript();
  50065. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  50066. if (javaScript) {
  50067. if (!actions) {
  50068. actions = Object.create(null);
  50069. }
  50070. for (const [key, val] of javaScript) {
  50071. if (key in actions) {
  50072. actions[key].push(val);
  50073. } else {
  50074. actions[key] = [val];
  50075. }
  50076. }
  50077. }
  50078. return (0, _util.shadow)(this, "jsActions", actions);
  50079. }
  50080. async fontFallback(id, handler) {
  50081. const translatedFonts = await Promise.all(this.fontCache);
  50082. for (const translatedFont of translatedFonts) {
  50083. if (translatedFont.loadedName === id) {
  50084. translatedFont.fallback(handler);
  50085. return;
  50086. }
  50087. }
  50088. }
  50089. async cleanup(manuallyTriggered = false) {
  50090. (0, _cleanup_helper.clearGlobalCaches)();
  50091. this.globalImageCache.clear(manuallyTriggered);
  50092. this.pageKidsCountCache.clear();
  50093. this.pageIndexCache.clear();
  50094. this.nonBlendModesSet.clear();
  50095. const translatedFonts = await Promise.all(this.fontCache);
  50096. for (const {
  50097. dict
  50098. } of translatedFonts) {
  50099. delete dict.cacheKey;
  50100. }
  50101. this.fontCache.clear();
  50102. this.builtInCMapCache.clear();
  50103. this.standardFontDataCache.clear();
  50104. }
  50105. async getPageDict(pageIndex) {
  50106. const nodesToVisit = [this.toplevelPagesDict];
  50107. const visitedNodes = new _primitives.RefSet();
  50108. const pagesRef = this._catDict.getRaw("Pages");
  50109. if (pagesRef instanceof _primitives.Ref) {
  50110. visitedNodes.put(pagesRef);
  50111. }
  50112. const xref = this.xref,
  50113. pageKidsCountCache = this.pageKidsCountCache,
  50114. pageIndexCache = this.pageIndexCache;
  50115. let currentPageIndex = 0;
  50116. while (nodesToVisit.length) {
  50117. const currentNode = nodesToVisit.pop();
  50118. if (currentNode instanceof _primitives.Ref) {
  50119. const count = pageKidsCountCache.get(currentNode);
  50120. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  50121. currentPageIndex += count;
  50122. continue;
  50123. }
  50124. if (visitedNodes.has(currentNode)) {
  50125. throw new _util.FormatError("Pages tree contains circular reference.");
  50126. }
  50127. visitedNodes.put(currentNode);
  50128. const obj = await xref.fetchAsync(currentNode);
  50129. if (obj instanceof _primitives.Dict) {
  50130. let type = obj.getRaw("Type");
  50131. if (type instanceof _primitives.Ref) {
  50132. type = await xref.fetchAsync(type);
  50133. }
  50134. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50135. if (!pageKidsCountCache.has(currentNode)) {
  50136. pageKidsCountCache.put(currentNode, 1);
  50137. }
  50138. if (!pageIndexCache.has(currentNode)) {
  50139. pageIndexCache.put(currentNode, currentPageIndex);
  50140. }
  50141. if (currentPageIndex === pageIndex) {
  50142. return [obj, currentNode];
  50143. }
  50144. currentPageIndex++;
  50145. continue;
  50146. }
  50147. }
  50148. nodesToVisit.push(obj);
  50149. continue;
  50150. }
  50151. if (!(currentNode instanceof _primitives.Dict)) {
  50152. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  50153. }
  50154. const {
  50155. objId
  50156. } = currentNode;
  50157. let count = currentNode.getRaw("Count");
  50158. if (count instanceof _primitives.Ref) {
  50159. count = await xref.fetchAsync(count);
  50160. }
  50161. if (Number.isInteger(count) && count >= 0) {
  50162. if (objId && !pageKidsCountCache.has(objId)) {
  50163. pageKidsCountCache.put(objId, count);
  50164. }
  50165. if (currentPageIndex + count <= pageIndex) {
  50166. currentPageIndex += count;
  50167. continue;
  50168. }
  50169. }
  50170. let kids = currentNode.getRaw("Kids");
  50171. if (kids instanceof _primitives.Ref) {
  50172. kids = await xref.fetchAsync(kids);
  50173. }
  50174. if (!Array.isArray(kids)) {
  50175. let type = currentNode.getRaw("Type");
  50176. if (type instanceof _primitives.Ref) {
  50177. type = await xref.fetchAsync(type);
  50178. }
  50179. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  50180. if (currentPageIndex === pageIndex) {
  50181. return [currentNode, null];
  50182. }
  50183. currentPageIndex++;
  50184. continue;
  50185. }
  50186. throw new _util.FormatError("Page dictionary kids object is not an array.");
  50187. }
  50188. for (let last = kids.length - 1; last >= 0; last--) {
  50189. nodesToVisit.push(kids[last]);
  50190. }
  50191. }
  50192. throw new Error(`Page index ${pageIndex} not found.`);
  50193. }
  50194. async getAllPageDicts(recoveryMode = false) {
  50195. const queue = [{
  50196. currentNode: this.toplevelPagesDict,
  50197. posInKids: 0
  50198. }];
  50199. const visitedNodes = new _primitives.RefSet();
  50200. const pagesRef = this._catDict.getRaw("Pages");
  50201. if (pagesRef instanceof _primitives.Ref) {
  50202. visitedNodes.put(pagesRef);
  50203. }
  50204. const map = new Map(),
  50205. xref = this.xref,
  50206. pageIndexCache = this.pageIndexCache;
  50207. let pageIndex = 0;
  50208. function addPageDict(pageDict, pageRef) {
  50209. if (pageRef && !pageIndexCache.has(pageRef)) {
  50210. pageIndexCache.put(pageRef, pageIndex);
  50211. }
  50212. map.set(pageIndex++, [pageDict, pageRef]);
  50213. }
  50214. function addPageError(error) {
  50215. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  50216. throw error;
  50217. }
  50218. map.set(pageIndex++, [error, null]);
  50219. }
  50220. while (queue.length > 0) {
  50221. const queueItem = queue.at(-1);
  50222. const {
  50223. currentNode,
  50224. posInKids
  50225. } = queueItem;
  50226. let kids = currentNode.getRaw("Kids");
  50227. if (kids instanceof _primitives.Ref) {
  50228. try {
  50229. kids = await xref.fetchAsync(kids);
  50230. } catch (ex) {
  50231. addPageError(ex);
  50232. break;
  50233. }
  50234. }
  50235. if (!Array.isArray(kids)) {
  50236. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  50237. break;
  50238. }
  50239. if (posInKids >= kids.length) {
  50240. queue.pop();
  50241. continue;
  50242. }
  50243. const kidObj = kids[posInKids];
  50244. let obj;
  50245. if (kidObj instanceof _primitives.Ref) {
  50246. if (visitedNodes.has(kidObj)) {
  50247. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  50248. break;
  50249. }
  50250. visitedNodes.put(kidObj);
  50251. try {
  50252. obj = await xref.fetchAsync(kidObj);
  50253. } catch (ex) {
  50254. addPageError(ex);
  50255. break;
  50256. }
  50257. } else {
  50258. obj = kidObj;
  50259. }
  50260. if (!(obj instanceof _primitives.Dict)) {
  50261. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  50262. break;
  50263. }
  50264. let type = obj.getRaw("Type");
  50265. if (type instanceof _primitives.Ref) {
  50266. try {
  50267. type = await xref.fetchAsync(type);
  50268. } catch (ex) {
  50269. addPageError(ex);
  50270. break;
  50271. }
  50272. }
  50273. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  50274. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  50275. } else {
  50276. queue.push({
  50277. currentNode: obj,
  50278. posInKids: 0
  50279. });
  50280. }
  50281. queueItem.posInKids++;
  50282. }
  50283. return map;
  50284. }
  50285. getPageIndex(pageRef) {
  50286. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  50287. if (cachedPageIndex !== undefined) {
  50288. return Promise.resolve(cachedPageIndex);
  50289. }
  50290. const xref = this.xref;
  50291. function pagesBeforeRef(kidRef) {
  50292. let total = 0,
  50293. parentRef;
  50294. return xref.fetchAsync(kidRef).then(function (node) {
  50295. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  50296. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  50297. }
  50298. if (!node) {
  50299. return null;
  50300. }
  50301. if (!(node instanceof _primitives.Dict)) {
  50302. throw new _util.FormatError("Node must be a dictionary.");
  50303. }
  50304. parentRef = node.getRaw("Parent");
  50305. return node.getAsync("Parent");
  50306. }).then(function (parent) {
  50307. if (!parent) {
  50308. return null;
  50309. }
  50310. if (!(parent instanceof _primitives.Dict)) {
  50311. throw new _util.FormatError("Parent must be a dictionary.");
  50312. }
  50313. return parent.getAsync("Kids");
  50314. }).then(function (kids) {
  50315. if (!kids) {
  50316. return null;
  50317. }
  50318. const kidPromises = [];
  50319. let found = false;
  50320. for (let i = 0, ii = kids.length; i < ii; i++) {
  50321. const kid = kids[i];
  50322. if (!(kid instanceof _primitives.Ref)) {
  50323. throw new _util.FormatError("Kid must be a reference.");
  50324. }
  50325. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  50326. found = true;
  50327. break;
  50328. }
  50329. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  50330. if (!(obj instanceof _primitives.Dict)) {
  50331. throw new _util.FormatError("Kid node must be a dictionary.");
  50332. }
  50333. if (obj.has("Count")) {
  50334. total += obj.get("Count");
  50335. } else {
  50336. total++;
  50337. }
  50338. }));
  50339. }
  50340. if (!found) {
  50341. throw new _util.FormatError("Kid reference not found in parent's kids.");
  50342. }
  50343. return Promise.all(kidPromises).then(function () {
  50344. return [total, parentRef];
  50345. });
  50346. });
  50347. }
  50348. let total = 0;
  50349. const next = ref => pagesBeforeRef(ref).then(args => {
  50350. if (!args) {
  50351. this.pageIndexCache.put(pageRef, total);
  50352. return total;
  50353. }
  50354. const [count, parentRef] = args;
  50355. total += count;
  50356. return next(parentRef);
  50357. });
  50358. return next(pageRef);
  50359. }
  50360. get baseUrl() {
  50361. const uri = this._catDict.get("URI");
  50362. if (uri instanceof _primitives.Dict) {
  50363. const base = uri.get("Base");
  50364. if (typeof base === "string") {
  50365. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  50366. tryConvertEncoding: true
  50367. });
  50368. if (absoluteUrl) {
  50369. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  50370. }
  50371. }
  50372. }
  50373. return (0, _util.shadow)(this, "baseUrl", null);
  50374. }
  50375. static parseDestDictionary(params) {
  50376. const destDict = params.destDict;
  50377. if (!(destDict instanceof _primitives.Dict)) {
  50378. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  50379. return;
  50380. }
  50381. const resultObj = params.resultObj;
  50382. if (typeof resultObj !== "object") {
  50383. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  50384. return;
  50385. }
  50386. const docBaseUrl = params.docBaseUrl || null;
  50387. let action = destDict.get("A"),
  50388. url,
  50389. dest;
  50390. if (!(action instanceof _primitives.Dict)) {
  50391. if (destDict.has("Dest")) {
  50392. action = destDict.get("Dest");
  50393. } else {
  50394. action = destDict.get("AA");
  50395. if (action instanceof _primitives.Dict) {
  50396. if (action.has("D")) {
  50397. action = action.get("D");
  50398. } else if (action.has("U")) {
  50399. action = action.get("U");
  50400. }
  50401. }
  50402. }
  50403. }
  50404. if (action instanceof _primitives.Dict) {
  50405. const actionType = action.get("S");
  50406. if (!(actionType instanceof _primitives.Name)) {
  50407. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  50408. return;
  50409. }
  50410. const actionName = actionType.name;
  50411. switch (actionName) {
  50412. case "ResetForm":
  50413. const flags = action.get("Flags");
  50414. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  50415. const fields = [];
  50416. const refs = [];
  50417. for (const obj of action.get("Fields") || []) {
  50418. if (obj instanceof _primitives.Ref) {
  50419. refs.push(obj.toString());
  50420. } else if (typeof obj === "string") {
  50421. fields.push((0, _util.stringToPDFString)(obj));
  50422. }
  50423. }
  50424. resultObj.resetForm = {
  50425. fields,
  50426. refs,
  50427. include
  50428. };
  50429. break;
  50430. case "URI":
  50431. url = action.get("URI");
  50432. if (url instanceof _primitives.Name) {
  50433. url = "/" + url.name;
  50434. }
  50435. break;
  50436. case "GoTo":
  50437. dest = action.get("D");
  50438. break;
  50439. case "Launch":
  50440. case "GoToR":
  50441. const urlDict = action.get("F");
  50442. if (urlDict instanceof _primitives.Dict) {
  50443. url = urlDict.get("F") || null;
  50444. } else if (typeof urlDict === "string") {
  50445. url = urlDict;
  50446. }
  50447. let remoteDest = action.get("D");
  50448. if (remoteDest) {
  50449. if (remoteDest instanceof _primitives.Name) {
  50450. remoteDest = remoteDest.name;
  50451. }
  50452. if (typeof url === "string") {
  50453. const baseUrl = url.split("#")[0];
  50454. if (typeof remoteDest === "string") {
  50455. url = baseUrl + "#" + remoteDest;
  50456. } else if (Array.isArray(remoteDest)) {
  50457. url = baseUrl + "#" + JSON.stringify(remoteDest);
  50458. }
  50459. }
  50460. }
  50461. const newWindow = action.get("NewWindow");
  50462. if (typeof newWindow === "boolean") {
  50463. resultObj.newWindow = newWindow;
  50464. }
  50465. break;
  50466. case "Named":
  50467. const namedAction = action.get("N");
  50468. if (namedAction instanceof _primitives.Name) {
  50469. resultObj.action = namedAction.name;
  50470. }
  50471. break;
  50472. case "JavaScript":
  50473. const jsAction = action.get("JS");
  50474. let js;
  50475. if (jsAction instanceof _base_stream.BaseStream) {
  50476. js = jsAction.getString();
  50477. } else if (typeof jsAction === "string") {
  50478. js = jsAction;
  50479. }
  50480. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  50481. if (jsURL) {
  50482. url = jsURL.url;
  50483. resultObj.newWindow = jsURL.newWindow;
  50484. break;
  50485. }
  50486. default:
  50487. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  50488. break;
  50489. }
  50490. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  50491. break;
  50492. }
  50493. } else if (destDict.has("Dest")) {
  50494. dest = destDict.get("Dest");
  50495. }
  50496. if (typeof url === "string") {
  50497. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  50498. addDefaultProtocol: true,
  50499. tryConvertEncoding: true
  50500. });
  50501. if (absoluteUrl) {
  50502. resultObj.url = absoluteUrl.href;
  50503. }
  50504. resultObj.unsafeUrl = url;
  50505. }
  50506. if (dest) {
  50507. if (dest instanceof _primitives.Name) {
  50508. dest = dest.name;
  50509. }
  50510. if (typeof dest === "string") {
  50511. resultObj.dest = (0, _util.stringToPDFString)(dest);
  50512. } else if (Array.isArray(dest)) {
  50513. resultObj.dest = dest;
  50514. }
  50515. }
  50516. }
  50517. }
  50518. exports.Catalog = Catalog;
  50519. /***/ }),
  50520. /* 70 */
  50521. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50522. Object.defineProperty(exports, "__esModule", ({
  50523. value: true
  50524. }));
  50525. exports.NumberTree = exports.NameTree = void 0;
  50526. var _primitives = __w_pdfjs_require__(5);
  50527. var _util = __w_pdfjs_require__(2);
  50528. class NameOrNumberTree {
  50529. constructor(root, xref, type) {
  50530. if (this.constructor === NameOrNumberTree) {
  50531. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  50532. }
  50533. this.root = root;
  50534. this.xref = xref;
  50535. this._type = type;
  50536. }
  50537. getAll() {
  50538. const map = new Map();
  50539. if (!this.root) {
  50540. return map;
  50541. }
  50542. const xref = this.xref;
  50543. const processed = new _primitives.RefSet();
  50544. processed.put(this.root);
  50545. const queue = [this.root];
  50546. while (queue.length > 0) {
  50547. const obj = xref.fetchIfRef(queue.shift());
  50548. if (!(obj instanceof _primitives.Dict)) {
  50549. continue;
  50550. }
  50551. if (obj.has("Kids")) {
  50552. const kids = obj.get("Kids");
  50553. if (!Array.isArray(kids)) {
  50554. continue;
  50555. }
  50556. for (const kid of kids) {
  50557. if (processed.has(kid)) {
  50558. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  50559. }
  50560. queue.push(kid);
  50561. processed.put(kid);
  50562. }
  50563. continue;
  50564. }
  50565. const entries = obj.get(this._type);
  50566. if (!Array.isArray(entries)) {
  50567. continue;
  50568. }
  50569. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  50570. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  50571. }
  50572. }
  50573. return map;
  50574. }
  50575. get(key) {
  50576. if (!this.root) {
  50577. return null;
  50578. }
  50579. const xref = this.xref;
  50580. let kidsOrEntries = xref.fetchIfRef(this.root);
  50581. let loopCount = 0;
  50582. const MAX_LEVELS = 10;
  50583. while (kidsOrEntries.has("Kids")) {
  50584. if (++loopCount > MAX_LEVELS) {
  50585. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  50586. return null;
  50587. }
  50588. const kids = kidsOrEntries.get("Kids");
  50589. if (!Array.isArray(kids)) {
  50590. return null;
  50591. }
  50592. let l = 0,
  50593. r = kids.length - 1;
  50594. while (l <= r) {
  50595. const m = l + r >> 1;
  50596. const kid = xref.fetchIfRef(kids[m]);
  50597. const limits = kid.get("Limits");
  50598. if (key < xref.fetchIfRef(limits[0])) {
  50599. r = m - 1;
  50600. } else if (key > xref.fetchIfRef(limits[1])) {
  50601. l = m + 1;
  50602. } else {
  50603. kidsOrEntries = kid;
  50604. break;
  50605. }
  50606. }
  50607. if (l > r) {
  50608. return null;
  50609. }
  50610. }
  50611. const entries = kidsOrEntries.get(this._type);
  50612. if (Array.isArray(entries)) {
  50613. let l = 0,
  50614. r = entries.length - 2;
  50615. while (l <= r) {
  50616. const tmp = l + r >> 1,
  50617. m = tmp + (tmp & 1);
  50618. const currentKey = xref.fetchIfRef(entries[m]);
  50619. if (key < currentKey) {
  50620. r = m - 2;
  50621. } else if (key > currentKey) {
  50622. l = m + 2;
  50623. } else {
  50624. return xref.fetchIfRef(entries[m + 1]);
  50625. }
  50626. }
  50627. }
  50628. return null;
  50629. }
  50630. }
  50631. class NameTree extends NameOrNumberTree {
  50632. constructor(root, xref) {
  50633. super(root, xref, "Names");
  50634. }
  50635. }
  50636. exports.NameTree = NameTree;
  50637. class NumberTree extends NameOrNumberTree {
  50638. constructor(root, xref) {
  50639. super(root, xref, "Nums");
  50640. }
  50641. }
  50642. exports.NumberTree = NumberTree;
  50643. /***/ }),
  50644. /* 71 */
  50645. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50646. Object.defineProperty(exports, "__esModule", ({
  50647. value: true
  50648. }));
  50649. exports.clearGlobalCaches = clearGlobalCaches;
  50650. var _primitives = __w_pdfjs_require__(5);
  50651. var _unicode = __w_pdfjs_require__(40);
  50652. function clearGlobalCaches() {
  50653. (0, _primitives.clearPrimitiveCaches)();
  50654. (0, _unicode.clearUnicodeCaches)();
  50655. }
  50656. /***/ }),
  50657. /* 72 */
  50658. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50659. Object.defineProperty(exports, "__esModule", ({
  50660. value: true
  50661. }));
  50662. exports.FileSpec = void 0;
  50663. var _util = __w_pdfjs_require__(2);
  50664. var _base_stream = __w_pdfjs_require__(7);
  50665. var _primitives = __w_pdfjs_require__(5);
  50666. function pickPlatformItem(dict) {
  50667. if (dict.has("UF")) {
  50668. return dict.get("UF");
  50669. } else if (dict.has("F")) {
  50670. return dict.get("F");
  50671. } else if (dict.has("Unix")) {
  50672. return dict.get("Unix");
  50673. } else if (dict.has("Mac")) {
  50674. return dict.get("Mac");
  50675. } else if (dict.has("DOS")) {
  50676. return dict.get("DOS");
  50677. }
  50678. return null;
  50679. }
  50680. class FileSpec {
  50681. constructor(root, xref) {
  50682. if (!(root instanceof _primitives.Dict)) {
  50683. return;
  50684. }
  50685. this.xref = xref;
  50686. this.root = root;
  50687. if (root.has("FS")) {
  50688. this.fs = root.get("FS");
  50689. }
  50690. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  50691. if (root.has("RF")) {
  50692. (0, _util.warn)("Related file specifications are not supported");
  50693. }
  50694. this.contentAvailable = true;
  50695. if (!root.has("EF")) {
  50696. this.contentAvailable = false;
  50697. (0, _util.warn)("Non-embedded file specifications are not supported");
  50698. }
  50699. }
  50700. get filename() {
  50701. if (!this._filename && this.root) {
  50702. const filename = pickPlatformItem(this.root) || "unnamed";
  50703. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  50704. }
  50705. return this._filename;
  50706. }
  50707. get content() {
  50708. if (!this.contentAvailable) {
  50709. return null;
  50710. }
  50711. if (!this.contentRef && this.root) {
  50712. this.contentRef = pickPlatformItem(this.root.get("EF"));
  50713. }
  50714. let content = null;
  50715. if (this.contentRef) {
  50716. const fileObj = this.xref.fetchIfRef(this.contentRef);
  50717. if (fileObj instanceof _base_stream.BaseStream) {
  50718. content = fileObj.getBytes();
  50719. } else {
  50720. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  50721. }
  50722. } else {
  50723. (0, _util.warn)("Embedded file specification does not have a content");
  50724. }
  50725. return content;
  50726. }
  50727. get serializable() {
  50728. return {
  50729. filename: this.filename,
  50730. content: this.content
  50731. };
  50732. }
  50733. }
  50734. exports.FileSpec = FileSpec;
  50735. /***/ }),
  50736. /* 73 */
  50737. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50738. Object.defineProperty(exports, "__esModule", ({
  50739. value: true
  50740. }));
  50741. exports.MetadataParser = void 0;
  50742. var _xml_parser = __w_pdfjs_require__(66);
  50743. class MetadataParser {
  50744. constructor(data) {
  50745. data = this._repair(data);
  50746. const parser = new _xml_parser.SimpleXMLParser({
  50747. lowerCaseName: true
  50748. });
  50749. const xmlDocument = parser.parseFromString(data);
  50750. this._metadataMap = new Map();
  50751. this._data = data;
  50752. if (xmlDocument) {
  50753. this._parse(xmlDocument);
  50754. }
  50755. }
  50756. _repair(data) {
  50757. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  50758. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  50759. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  50760. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  50761. switch (name) {
  50762. case "amp":
  50763. return "&";
  50764. case "apos":
  50765. return "'";
  50766. case "gt":
  50767. return ">";
  50768. case "lt":
  50769. return "<";
  50770. case "quot":
  50771. return '"';
  50772. }
  50773. throw new Error(`_repair: ${name} isn't defined.`);
  50774. });
  50775. const charBuf = [];
  50776. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  50777. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  50778. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  50779. charBuf.push(String.fromCharCode(code));
  50780. } else {
  50781. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  50782. }
  50783. }
  50784. return ">" + charBuf.join("");
  50785. });
  50786. }
  50787. _getSequence(entry) {
  50788. const name = entry.nodeName;
  50789. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  50790. return null;
  50791. }
  50792. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  50793. }
  50794. _parseArray(entry) {
  50795. if (!entry.hasChildNodes()) {
  50796. return;
  50797. }
  50798. const [seqNode] = entry.childNodes;
  50799. const sequence = this._getSequence(seqNode) || [];
  50800. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  50801. }
  50802. _parse(xmlDocument) {
  50803. let rdf = xmlDocument.documentElement;
  50804. if (rdf.nodeName !== "rdf:rdf") {
  50805. rdf = rdf.firstChild;
  50806. while (rdf && rdf.nodeName !== "rdf:rdf") {
  50807. rdf = rdf.nextSibling;
  50808. }
  50809. }
  50810. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  50811. return;
  50812. }
  50813. for (const desc of rdf.childNodes) {
  50814. if (desc.nodeName !== "rdf:description") {
  50815. continue;
  50816. }
  50817. for (const entry of desc.childNodes) {
  50818. const name = entry.nodeName;
  50819. switch (name) {
  50820. case "#text":
  50821. continue;
  50822. case "dc:creator":
  50823. case "dc:subject":
  50824. this._parseArray(entry);
  50825. continue;
  50826. }
  50827. this._metadataMap.set(name, entry.textContent.trim());
  50828. }
  50829. }
  50830. }
  50831. get serializable() {
  50832. return {
  50833. parsedData: this._metadataMap,
  50834. rawData: this._data
  50835. };
  50836. }
  50837. }
  50838. exports.MetadataParser = MetadataParser;
  50839. /***/ }),
  50840. /* 74 */
  50841. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50842. Object.defineProperty(exports, "__esModule", ({
  50843. value: true
  50844. }));
  50845. exports.StructTreeRoot = exports.StructTreePage = void 0;
  50846. var _primitives = __w_pdfjs_require__(5);
  50847. var _util = __w_pdfjs_require__(2);
  50848. var _name_number_tree = __w_pdfjs_require__(70);
  50849. const MAX_DEPTH = 40;
  50850. const StructElementType = {
  50851. PAGE_CONTENT: "PAGE_CONTENT",
  50852. STREAM_CONTENT: "STREAM_CONTENT",
  50853. OBJECT: "OBJECT",
  50854. ELEMENT: "ELEMENT"
  50855. };
  50856. class StructTreeRoot {
  50857. constructor(rootDict) {
  50858. this.dict = rootDict;
  50859. this.roleMap = new Map();
  50860. }
  50861. init() {
  50862. this.readRoleMap();
  50863. }
  50864. readRoleMap() {
  50865. const roleMapDict = this.dict.get("RoleMap");
  50866. if (!(roleMapDict instanceof _primitives.Dict)) {
  50867. return;
  50868. }
  50869. roleMapDict.forEach((key, value) => {
  50870. if (!(value instanceof _primitives.Name)) {
  50871. return;
  50872. }
  50873. this.roleMap.set(key, value.name);
  50874. });
  50875. }
  50876. }
  50877. exports.StructTreeRoot = StructTreeRoot;
  50878. class StructElementNode {
  50879. constructor(tree, dict) {
  50880. this.tree = tree;
  50881. this.dict = dict;
  50882. this.kids = [];
  50883. this.parseKids();
  50884. }
  50885. get role() {
  50886. const nameObj = this.dict.get("S");
  50887. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  50888. const {
  50889. root
  50890. } = this.tree;
  50891. if (root.roleMap.has(name)) {
  50892. return root.roleMap.get(name);
  50893. }
  50894. return name;
  50895. }
  50896. parseKids() {
  50897. let pageObjId = null;
  50898. const objRef = this.dict.getRaw("Pg");
  50899. if (objRef instanceof _primitives.Ref) {
  50900. pageObjId = objRef.toString();
  50901. }
  50902. const kids = this.dict.get("K");
  50903. if (Array.isArray(kids)) {
  50904. for (const kid of kids) {
  50905. const element = this.parseKid(pageObjId, kid);
  50906. if (element) {
  50907. this.kids.push(element);
  50908. }
  50909. }
  50910. } else {
  50911. const element = this.parseKid(pageObjId, kids);
  50912. if (element) {
  50913. this.kids.push(element);
  50914. }
  50915. }
  50916. }
  50917. parseKid(pageObjId, kid) {
  50918. if (Number.isInteger(kid)) {
  50919. if (this.tree.pageDict.objId !== pageObjId) {
  50920. return null;
  50921. }
  50922. return new StructElement({
  50923. type: StructElementType.PAGE_CONTENT,
  50924. mcid: kid,
  50925. pageObjId
  50926. });
  50927. }
  50928. let kidDict = null;
  50929. if (kid instanceof _primitives.Ref) {
  50930. kidDict = this.dict.xref.fetch(kid);
  50931. } else if (kid instanceof _primitives.Dict) {
  50932. kidDict = kid;
  50933. }
  50934. if (!kidDict) {
  50935. return null;
  50936. }
  50937. const pageRef = kidDict.getRaw("Pg");
  50938. if (pageRef instanceof _primitives.Ref) {
  50939. pageObjId = pageRef.toString();
  50940. }
  50941. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  50942. if (type === "MCR") {
  50943. if (this.tree.pageDict.objId !== pageObjId) {
  50944. return null;
  50945. }
  50946. return new StructElement({
  50947. type: StructElementType.STREAM_CONTENT,
  50948. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  50949. pageObjId,
  50950. mcid: kidDict.get("MCID")
  50951. });
  50952. }
  50953. if (type === "OBJR") {
  50954. if (this.tree.pageDict.objId !== pageObjId) {
  50955. return null;
  50956. }
  50957. return new StructElement({
  50958. type: StructElementType.OBJECT,
  50959. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  50960. pageObjId
  50961. });
  50962. }
  50963. return new StructElement({
  50964. type: StructElementType.ELEMENT,
  50965. dict: kidDict
  50966. });
  50967. }
  50968. }
  50969. class StructElement {
  50970. constructor({
  50971. type,
  50972. dict = null,
  50973. mcid = null,
  50974. pageObjId = null,
  50975. refObjId = null
  50976. }) {
  50977. this.type = type;
  50978. this.dict = dict;
  50979. this.mcid = mcid;
  50980. this.pageObjId = pageObjId;
  50981. this.refObjId = refObjId;
  50982. this.parentNode = null;
  50983. }
  50984. }
  50985. class StructTreePage {
  50986. constructor(structTreeRoot, pageDict) {
  50987. this.root = structTreeRoot;
  50988. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  50989. this.pageDict = pageDict;
  50990. this.nodes = [];
  50991. }
  50992. parse() {
  50993. if (!this.root || !this.rootDict) {
  50994. return;
  50995. }
  50996. const parentTree = this.rootDict.get("ParentTree");
  50997. if (!parentTree) {
  50998. return;
  50999. }
  51000. const id = this.pageDict.get("StructParents");
  51001. if (!Number.isInteger(id)) {
  51002. return;
  51003. }
  51004. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  51005. const parentArray = numberTree.get(id);
  51006. if (!Array.isArray(parentArray)) {
  51007. return;
  51008. }
  51009. const map = new Map();
  51010. for (const ref of parentArray) {
  51011. if (ref instanceof _primitives.Ref) {
  51012. this.addNode(this.rootDict.xref.fetch(ref), map);
  51013. }
  51014. }
  51015. }
  51016. addNode(dict, map, level = 0) {
  51017. if (level > MAX_DEPTH) {
  51018. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  51019. return null;
  51020. }
  51021. if (map.has(dict)) {
  51022. return map.get(dict);
  51023. }
  51024. const element = new StructElementNode(this, dict);
  51025. map.set(dict, element);
  51026. const parent = dict.get("P");
  51027. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  51028. if (!this.addTopLevelNode(dict, element)) {
  51029. map.delete(dict);
  51030. }
  51031. return element;
  51032. }
  51033. const parentNode = this.addNode(parent, map, level + 1);
  51034. if (!parentNode) {
  51035. return element;
  51036. }
  51037. let save = false;
  51038. for (const kid of parentNode.kids) {
  51039. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  51040. kid.parentNode = element;
  51041. save = true;
  51042. }
  51043. }
  51044. if (!save) {
  51045. map.delete(dict);
  51046. }
  51047. return element;
  51048. }
  51049. addTopLevelNode(dict, element) {
  51050. const obj = this.rootDict.get("K");
  51051. if (!obj) {
  51052. return false;
  51053. }
  51054. if (obj instanceof _primitives.Dict) {
  51055. if (obj.objId !== dict.objId) {
  51056. return false;
  51057. }
  51058. this.nodes[0] = element;
  51059. return true;
  51060. }
  51061. if (!Array.isArray(obj)) {
  51062. return true;
  51063. }
  51064. let save = false;
  51065. for (let i = 0; i < obj.length; i++) {
  51066. const kidRef = obj[i];
  51067. if (kidRef && kidRef.toString() === dict.objId) {
  51068. this.nodes[i] = element;
  51069. save = true;
  51070. }
  51071. }
  51072. return save;
  51073. }
  51074. get serializable() {
  51075. function nodeToSerializable(node, parent, level = 0) {
  51076. if (level > MAX_DEPTH) {
  51077. (0, _util.warn)("StructTree too deep to be fully serialized.");
  51078. return;
  51079. }
  51080. const obj = Object.create(null);
  51081. obj.role = node.role;
  51082. obj.children = [];
  51083. parent.children.push(obj);
  51084. const alt = node.dict.get("Alt");
  51085. if (typeof alt === "string") {
  51086. obj.alt = (0, _util.stringToPDFString)(alt);
  51087. }
  51088. const lang = node.dict.get("Lang");
  51089. if (typeof lang === "string") {
  51090. obj.lang = (0, _util.stringToPDFString)(lang);
  51091. }
  51092. for (const kid of node.kids) {
  51093. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  51094. if (kidElement) {
  51095. nodeToSerializable(kidElement, obj, level + 1);
  51096. continue;
  51097. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  51098. obj.children.push({
  51099. type: "content",
  51100. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  51101. });
  51102. } else if (kid.type === StructElementType.OBJECT) {
  51103. obj.children.push({
  51104. type: "object",
  51105. id: kid.refObjId
  51106. });
  51107. }
  51108. }
  51109. }
  51110. const root = Object.create(null);
  51111. root.children = [];
  51112. root.role = "Root";
  51113. for (const child of this.nodes) {
  51114. if (!child) {
  51115. continue;
  51116. }
  51117. nodeToSerializable(child, root);
  51118. }
  51119. return root;
  51120. }
  51121. }
  51122. exports.StructTreePage = StructTreePage;
  51123. /***/ }),
  51124. /* 75 */
  51125. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51126. Object.defineProperty(exports, "__esModule", ({
  51127. value: true
  51128. }));
  51129. exports.ObjectLoader = void 0;
  51130. var _primitives = __w_pdfjs_require__(5);
  51131. var _base_stream = __w_pdfjs_require__(7);
  51132. var _core_utils = __w_pdfjs_require__(6);
  51133. var _util = __w_pdfjs_require__(2);
  51134. function mayHaveChildren(value) {
  51135. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  51136. }
  51137. function addChildren(node, nodesToVisit) {
  51138. if (node instanceof _primitives.Dict) {
  51139. node = node.getRawValues();
  51140. } else if (node instanceof _base_stream.BaseStream) {
  51141. node = node.dict.getRawValues();
  51142. } else if (!Array.isArray(node)) {
  51143. return;
  51144. }
  51145. for (const rawValue of node) {
  51146. if (mayHaveChildren(rawValue)) {
  51147. nodesToVisit.push(rawValue);
  51148. }
  51149. }
  51150. }
  51151. class ObjectLoader {
  51152. constructor(dict, keys, xref) {
  51153. this.dict = dict;
  51154. this.keys = keys;
  51155. this.xref = xref;
  51156. this.refSet = null;
  51157. }
  51158. async load() {
  51159. if (this.xref.stream.isDataLoaded) {
  51160. return undefined;
  51161. }
  51162. const {
  51163. keys,
  51164. dict
  51165. } = this;
  51166. this.refSet = new _primitives.RefSet();
  51167. const nodesToVisit = [];
  51168. for (let i = 0, ii = keys.length; i < ii; i++) {
  51169. const rawValue = dict.getRaw(keys[i]);
  51170. if (rawValue !== undefined) {
  51171. nodesToVisit.push(rawValue);
  51172. }
  51173. }
  51174. return this._walk(nodesToVisit);
  51175. }
  51176. async _walk(nodesToVisit) {
  51177. const nodesToRevisit = [];
  51178. const pendingRequests = [];
  51179. while (nodesToVisit.length) {
  51180. let currentNode = nodesToVisit.pop();
  51181. if (currentNode instanceof _primitives.Ref) {
  51182. if (this.refSet.has(currentNode)) {
  51183. continue;
  51184. }
  51185. try {
  51186. this.refSet.put(currentNode);
  51187. currentNode = this.xref.fetch(currentNode);
  51188. } catch (ex) {
  51189. if (!(ex instanceof _core_utils.MissingDataException)) {
  51190. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  51191. this.refSet = null;
  51192. const {
  51193. manager
  51194. } = this.xref.stream;
  51195. return manager.requestAllChunks();
  51196. }
  51197. nodesToRevisit.push(currentNode);
  51198. pendingRequests.push({
  51199. begin: ex.begin,
  51200. end: ex.end
  51201. });
  51202. }
  51203. }
  51204. if (currentNode instanceof _base_stream.BaseStream) {
  51205. const baseStreams = currentNode.getBaseStreams();
  51206. if (baseStreams) {
  51207. let foundMissingData = false;
  51208. for (const stream of baseStreams) {
  51209. if (stream.isDataLoaded) {
  51210. continue;
  51211. }
  51212. foundMissingData = true;
  51213. pendingRequests.push({
  51214. begin: stream.start,
  51215. end: stream.end
  51216. });
  51217. }
  51218. if (foundMissingData) {
  51219. nodesToRevisit.push(currentNode);
  51220. }
  51221. }
  51222. }
  51223. addChildren(currentNode, nodesToVisit);
  51224. }
  51225. if (pendingRequests.length) {
  51226. await this.xref.stream.manager.requestRanges(pendingRequests);
  51227. for (const node of nodesToRevisit) {
  51228. if (node instanceof _primitives.Ref) {
  51229. this.refSet.remove(node);
  51230. }
  51231. }
  51232. return this._walk(nodesToRevisit);
  51233. }
  51234. this.refSet = null;
  51235. return undefined;
  51236. }
  51237. }
  51238. exports.ObjectLoader = ObjectLoader;
  51239. /***/ }),
  51240. /* 76 */
  51241. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51242. Object.defineProperty(exports, "__esModule", ({
  51243. value: true
  51244. }));
  51245. exports.XFAFactory = void 0;
  51246. var _xfa_object = __w_pdfjs_require__(77);
  51247. var _bind = __w_pdfjs_require__(81);
  51248. var _data = __w_pdfjs_require__(87);
  51249. var _fonts = __w_pdfjs_require__(85);
  51250. var _utils = __w_pdfjs_require__(78);
  51251. var _util = __w_pdfjs_require__(2);
  51252. var _parser = __w_pdfjs_require__(88);
  51253. var _xhtml = __w_pdfjs_require__(98);
  51254. class XFAFactory {
  51255. constructor(data) {
  51256. try {
  51257. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  51258. const binder = new _bind.Binder(this.root);
  51259. this.form = binder.bind();
  51260. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  51261. this.form[_xfa_object.$globalData].template = this.form;
  51262. } catch (e) {
  51263. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  51264. }
  51265. }
  51266. isValid() {
  51267. return this.root && this.form;
  51268. }
  51269. _createPagesHelper() {
  51270. const iterator = this.form[_xfa_object.$toPages]();
  51271. return new Promise((resolve, reject) => {
  51272. const nextIteration = () => {
  51273. try {
  51274. const value = iterator.next();
  51275. if (value.done) {
  51276. resolve(value.value);
  51277. } else {
  51278. setTimeout(nextIteration, 0);
  51279. }
  51280. } catch (e) {
  51281. reject(e);
  51282. }
  51283. };
  51284. setTimeout(nextIteration, 0);
  51285. });
  51286. }
  51287. async _createPages() {
  51288. try {
  51289. this.pages = await this._createPagesHelper();
  51290. this.dims = this.pages.children.map(c => {
  51291. const {
  51292. width,
  51293. height
  51294. } = c.attributes.style;
  51295. return [0, 0, parseInt(width), parseInt(height)];
  51296. });
  51297. } catch (e) {
  51298. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  51299. }
  51300. }
  51301. getBoundingBox(pageIndex) {
  51302. return this.dims[pageIndex];
  51303. }
  51304. async getNumPages() {
  51305. if (!this.pages) {
  51306. await this._createPages();
  51307. }
  51308. return this.dims.length;
  51309. }
  51310. setImages(images) {
  51311. this.form[_xfa_object.$globalData].images = images;
  51312. }
  51313. setFonts(fonts) {
  51314. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  51315. const missingFonts = [];
  51316. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  51317. typeface = (0, _utils.stripQuotes)(typeface);
  51318. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  51319. if (!font) {
  51320. missingFonts.push(typeface);
  51321. }
  51322. }
  51323. if (missingFonts.length > 0) {
  51324. return missingFonts;
  51325. }
  51326. return null;
  51327. }
  51328. appendFonts(fonts, reallyMissingFonts) {
  51329. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  51330. }
  51331. async getPages() {
  51332. if (!this.pages) {
  51333. await this._createPages();
  51334. }
  51335. const pages = this.pages;
  51336. this.pages = null;
  51337. return pages;
  51338. }
  51339. serializeData(storage) {
  51340. return this.dataHandler.serialize(storage);
  51341. }
  51342. static _createDocument(data) {
  51343. if (!data["/xdp:xdp"]) {
  51344. return data["xdp:xdp"];
  51345. }
  51346. return Object.values(data).join("");
  51347. }
  51348. static getRichTextAsHtml(rc) {
  51349. if (!rc || typeof rc !== "string") {
  51350. return null;
  51351. }
  51352. try {
  51353. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  51354. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  51355. const newRoot = _xhtml.XhtmlNamespace.body({});
  51356. newRoot[_xfa_object.$appendChild](root);
  51357. root = newRoot;
  51358. }
  51359. const result = root[_xfa_object.$toHTML]();
  51360. if (!result.success) {
  51361. return null;
  51362. }
  51363. const {
  51364. html
  51365. } = result;
  51366. const {
  51367. attributes
  51368. } = html;
  51369. if (attributes) {
  51370. if (attributes.class) {
  51371. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  51372. }
  51373. attributes.dir = "auto";
  51374. }
  51375. return {
  51376. html,
  51377. str: root[_xfa_object.$text]()
  51378. };
  51379. } catch (e) {
  51380. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  51381. }
  51382. return null;
  51383. }
  51384. }
  51385. exports.XFAFactory = XFAFactory;
  51386. /***/ }),
  51387. /* 77 */
  51388. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51389. Object.defineProperty(exports, "__esModule", ({
  51390. value: true
  51391. }));
  51392. 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;
  51393. var _utils = __w_pdfjs_require__(78);
  51394. var _util = __w_pdfjs_require__(2);
  51395. var _core_utils = __w_pdfjs_require__(6);
  51396. var _namespaces = __w_pdfjs_require__(79);
  51397. var _som = __w_pdfjs_require__(80);
  51398. const $acceptWhitespace = Symbol();
  51399. exports.$acceptWhitespace = $acceptWhitespace;
  51400. const $addHTML = Symbol();
  51401. exports.$addHTML = $addHTML;
  51402. const $appendChild = Symbol();
  51403. exports.$appendChild = $appendChild;
  51404. const $childrenToHTML = Symbol();
  51405. exports.$childrenToHTML = $childrenToHTML;
  51406. const $clean = Symbol();
  51407. exports.$clean = $clean;
  51408. const $cleanPage = Symbol();
  51409. exports.$cleanPage = $cleanPage;
  51410. const $cleanup = Symbol();
  51411. exports.$cleanup = $cleanup;
  51412. const $clone = Symbol();
  51413. exports.$clone = $clone;
  51414. const $consumed = Symbol();
  51415. exports.$consumed = $consumed;
  51416. const $content = Symbol("content");
  51417. exports.$content = $content;
  51418. const $data = Symbol("data");
  51419. exports.$data = $data;
  51420. const $dump = Symbol();
  51421. exports.$dump = $dump;
  51422. const $extra = Symbol("extra");
  51423. exports.$extra = $extra;
  51424. const $finalize = Symbol();
  51425. exports.$finalize = $finalize;
  51426. const $flushHTML = Symbol();
  51427. exports.$flushHTML = $flushHTML;
  51428. const $getAttributeIt = Symbol();
  51429. exports.$getAttributeIt = $getAttributeIt;
  51430. const $getAttributes = Symbol();
  51431. exports.$getAttributes = $getAttributes;
  51432. const $getAvailableSpace = Symbol();
  51433. exports.$getAvailableSpace = $getAvailableSpace;
  51434. const $getChildrenByClass = Symbol();
  51435. exports.$getChildrenByClass = $getChildrenByClass;
  51436. const $getChildrenByName = Symbol();
  51437. exports.$getChildrenByName = $getChildrenByName;
  51438. const $getChildrenByNameIt = Symbol();
  51439. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  51440. const $getDataValue = Symbol();
  51441. exports.$getDataValue = $getDataValue;
  51442. const $getExtra = Symbol();
  51443. exports.$getExtra = $getExtra;
  51444. const $getRealChildrenByNameIt = Symbol();
  51445. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  51446. const $getChildren = Symbol();
  51447. exports.$getChildren = $getChildren;
  51448. const $getContainedChildren = Symbol();
  51449. exports.$getContainedChildren = $getContainedChildren;
  51450. const $getNextPage = Symbol();
  51451. exports.$getNextPage = $getNextPage;
  51452. const $getSubformParent = Symbol();
  51453. exports.$getSubformParent = $getSubformParent;
  51454. const $getParent = Symbol();
  51455. exports.$getParent = $getParent;
  51456. const $getTemplateRoot = Symbol();
  51457. exports.$getTemplateRoot = $getTemplateRoot;
  51458. const $globalData = Symbol();
  51459. exports.$globalData = $globalData;
  51460. const $hasSettableValue = Symbol();
  51461. exports.$hasSettableValue = $hasSettableValue;
  51462. const $ids = Symbol();
  51463. exports.$ids = $ids;
  51464. const $indexOf = Symbol();
  51465. exports.$indexOf = $indexOf;
  51466. const $insertAt = Symbol();
  51467. exports.$insertAt = $insertAt;
  51468. const $isCDATAXml = Symbol();
  51469. exports.$isCDATAXml = $isCDATAXml;
  51470. const $isBindable = Symbol();
  51471. exports.$isBindable = $isBindable;
  51472. const $isDataValue = Symbol();
  51473. exports.$isDataValue = $isDataValue;
  51474. const $isDescendent = Symbol();
  51475. exports.$isDescendent = $isDescendent;
  51476. const $isNsAgnostic = Symbol();
  51477. exports.$isNsAgnostic = $isNsAgnostic;
  51478. const $isSplittable = Symbol();
  51479. exports.$isSplittable = $isSplittable;
  51480. const $isThereMoreWidth = Symbol();
  51481. exports.$isThereMoreWidth = $isThereMoreWidth;
  51482. const $isTransparent = Symbol();
  51483. exports.$isTransparent = $isTransparent;
  51484. const $isUsable = Symbol();
  51485. exports.$isUsable = $isUsable;
  51486. const $lastAttribute = Symbol();
  51487. const $namespaceId = Symbol("namespaceId");
  51488. exports.$namespaceId = $namespaceId;
  51489. const $nodeName = Symbol("nodeName");
  51490. exports.$nodeName = $nodeName;
  51491. const $nsAttributes = Symbol();
  51492. exports.$nsAttributes = $nsAttributes;
  51493. const $onChild = Symbol();
  51494. exports.$onChild = $onChild;
  51495. const $onChildCheck = Symbol();
  51496. exports.$onChildCheck = $onChildCheck;
  51497. const $onText = Symbol();
  51498. exports.$onText = $onText;
  51499. const $pushGlyphs = Symbol();
  51500. exports.$pushGlyphs = $pushGlyphs;
  51501. const $popPara = Symbol();
  51502. exports.$popPara = $popPara;
  51503. const $pushPara = Symbol();
  51504. exports.$pushPara = $pushPara;
  51505. const $removeChild = Symbol();
  51506. exports.$removeChild = $removeChild;
  51507. const $root = Symbol("root");
  51508. exports.$root = $root;
  51509. const $resolvePrototypes = Symbol();
  51510. exports.$resolvePrototypes = $resolvePrototypes;
  51511. const $searchNode = Symbol();
  51512. exports.$searchNode = $searchNode;
  51513. const $setId = Symbol();
  51514. exports.$setId = $setId;
  51515. const $setSetAttributes = Symbol();
  51516. exports.$setSetAttributes = $setSetAttributes;
  51517. const $setValue = Symbol();
  51518. exports.$setValue = $setValue;
  51519. const $tabIndex = Symbol();
  51520. exports.$tabIndex = $tabIndex;
  51521. const $text = Symbol();
  51522. exports.$text = $text;
  51523. const $toPages = Symbol();
  51524. exports.$toPages = $toPages;
  51525. const $toHTML = Symbol();
  51526. exports.$toHTML = $toHTML;
  51527. const $toString = Symbol();
  51528. exports.$toString = $toString;
  51529. const $toStyle = Symbol();
  51530. exports.$toStyle = $toStyle;
  51531. const $uid = Symbol("uid");
  51532. exports.$uid = $uid;
  51533. const _applyPrototype = Symbol();
  51534. const _attributes = Symbol();
  51535. const _attributeNames = Symbol();
  51536. const _children = Symbol("_children");
  51537. const _cloneAttribute = Symbol();
  51538. const _dataValue = Symbol();
  51539. const _defaultValue = Symbol();
  51540. const _filteredChildrenGenerator = Symbol();
  51541. const _getPrototype = Symbol();
  51542. const _getUnsetAttributes = Symbol();
  51543. const _hasChildren = Symbol();
  51544. const _max = Symbol();
  51545. const _options = Symbol();
  51546. const _parent = Symbol("parent");
  51547. const _resolvePrototypesHelper = Symbol();
  51548. const _setAttributes = Symbol();
  51549. const _validator = Symbol();
  51550. let uid = 0;
  51551. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51552. class XFAObject {
  51553. constructor(nsId, name, hasChildren = false) {
  51554. this[$namespaceId] = nsId;
  51555. this[$nodeName] = name;
  51556. this[_hasChildren] = hasChildren;
  51557. this[_parent] = null;
  51558. this[_children] = [];
  51559. this[$uid] = `${name}${uid++}`;
  51560. this[$globalData] = null;
  51561. }
  51562. [$onChild](child) {
  51563. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  51564. return false;
  51565. }
  51566. const name = child[$nodeName];
  51567. const node = this[name];
  51568. if (node instanceof XFAObjectArray) {
  51569. if (node.push(child)) {
  51570. this[$appendChild](child);
  51571. return true;
  51572. }
  51573. } else {
  51574. if (node !== null) {
  51575. this[$removeChild](node);
  51576. }
  51577. this[name] = child;
  51578. this[$appendChild](child);
  51579. return true;
  51580. }
  51581. let id = "";
  51582. if (this.id) {
  51583. id = ` (id: ${this.id})`;
  51584. } else if (this.name) {
  51585. id = ` (name: ${this.name} ${this.h.value})`;
  51586. }
  51587. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  51588. return false;
  51589. }
  51590. [$onChildCheck](child) {
  51591. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  51592. }
  51593. [$isNsAgnostic]() {
  51594. return false;
  51595. }
  51596. [$acceptWhitespace]() {
  51597. return false;
  51598. }
  51599. [$isCDATAXml]() {
  51600. return false;
  51601. }
  51602. [$isBindable]() {
  51603. return false;
  51604. }
  51605. [$popPara]() {
  51606. if (this.para) {
  51607. this[$getTemplateRoot]()[$extra].paraStack.pop();
  51608. }
  51609. }
  51610. [$pushPara]() {
  51611. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  51612. }
  51613. [$setId](ids) {
  51614. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  51615. ids.set(this.id, this);
  51616. }
  51617. }
  51618. [$getTemplateRoot]() {
  51619. return this[$globalData].template;
  51620. }
  51621. [$isSplittable]() {
  51622. return false;
  51623. }
  51624. [$isThereMoreWidth]() {
  51625. return false;
  51626. }
  51627. [$appendChild](child) {
  51628. child[_parent] = this;
  51629. this[_children].push(child);
  51630. if (!child[$globalData] && this[$globalData]) {
  51631. child[$globalData] = this[$globalData];
  51632. }
  51633. }
  51634. [$removeChild](child) {
  51635. const i = this[_children].indexOf(child);
  51636. this[_children].splice(i, 1);
  51637. }
  51638. [$hasSettableValue]() {
  51639. return this.hasOwnProperty("value");
  51640. }
  51641. [$setValue](_) {}
  51642. [$onText](_) {}
  51643. [$finalize]() {}
  51644. [$clean](builder) {
  51645. delete this[_hasChildren];
  51646. if (this[$cleanup]) {
  51647. builder.clean(this[$cleanup]);
  51648. delete this[$cleanup];
  51649. }
  51650. }
  51651. [$indexOf](child) {
  51652. return this[_children].indexOf(child);
  51653. }
  51654. [$insertAt](i, child) {
  51655. child[_parent] = this;
  51656. this[_children].splice(i, 0, child);
  51657. if (!child[$globalData] && this[$globalData]) {
  51658. child[$globalData] = this[$globalData];
  51659. }
  51660. }
  51661. [$isTransparent]() {
  51662. return !this.name;
  51663. }
  51664. [$lastAttribute]() {
  51665. return "";
  51666. }
  51667. [$text]() {
  51668. if (this[_children].length === 0) {
  51669. return this[$content];
  51670. }
  51671. return this[_children].map(c => c[$text]()).join("");
  51672. }
  51673. get [_attributeNames]() {
  51674. const proto = Object.getPrototypeOf(this);
  51675. if (!proto._attributes) {
  51676. const attributes = proto._attributes = new Set();
  51677. for (const name of Object.getOwnPropertyNames(this)) {
  51678. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  51679. break;
  51680. }
  51681. attributes.add(name);
  51682. }
  51683. }
  51684. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  51685. }
  51686. [$isDescendent](parent) {
  51687. let node = this;
  51688. while (node) {
  51689. if (node === parent) {
  51690. return true;
  51691. }
  51692. node = node[$getParent]();
  51693. }
  51694. return false;
  51695. }
  51696. [$getParent]() {
  51697. return this[_parent];
  51698. }
  51699. [$getSubformParent]() {
  51700. return this[$getParent]();
  51701. }
  51702. [$getChildren](name = null) {
  51703. if (!name) {
  51704. return this[_children];
  51705. }
  51706. return this[name];
  51707. }
  51708. [$dump]() {
  51709. const dumped = Object.create(null);
  51710. if (this[$content]) {
  51711. dumped.$content = this[$content];
  51712. }
  51713. for (const name of Object.getOwnPropertyNames(this)) {
  51714. const value = this[name];
  51715. if (value === null) {
  51716. continue;
  51717. }
  51718. if (value instanceof XFAObject) {
  51719. dumped[name] = value[$dump]();
  51720. } else if (value instanceof XFAObjectArray) {
  51721. if (!value.isEmpty()) {
  51722. dumped[name] = value.dump();
  51723. }
  51724. } else {
  51725. dumped[name] = value;
  51726. }
  51727. }
  51728. return dumped;
  51729. }
  51730. [$toStyle]() {
  51731. return null;
  51732. }
  51733. [$toHTML]() {
  51734. return _utils.HTMLResult.EMPTY;
  51735. }
  51736. *[$getContainedChildren]() {
  51737. for (const node of this[$getChildren]()) {
  51738. yield node;
  51739. }
  51740. }
  51741. *[_filteredChildrenGenerator](filter, include) {
  51742. for (const node of this[$getContainedChildren]()) {
  51743. if (!filter || include === filter.has(node[$nodeName])) {
  51744. const availableSpace = this[$getAvailableSpace]();
  51745. const res = node[$toHTML](availableSpace);
  51746. if (!res.success) {
  51747. this[$extra].failingNode = node;
  51748. }
  51749. yield res;
  51750. }
  51751. }
  51752. }
  51753. [$flushHTML]() {
  51754. return null;
  51755. }
  51756. [$addHTML](html, bbox) {
  51757. this[$extra].children.push(html);
  51758. }
  51759. [$getAvailableSpace]() {}
  51760. [$childrenToHTML]({
  51761. filter = null,
  51762. include = true
  51763. }) {
  51764. if (!this[$extra].generator) {
  51765. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  51766. } else {
  51767. const availableSpace = this[$getAvailableSpace]();
  51768. const res = this[$extra].failingNode[$toHTML](availableSpace);
  51769. if (!res.success) {
  51770. return res;
  51771. }
  51772. if (res.html) {
  51773. this[$addHTML](res.html, res.bbox);
  51774. }
  51775. delete this[$extra].failingNode;
  51776. }
  51777. while (true) {
  51778. const gen = this[$extra].generator.next();
  51779. if (gen.done) {
  51780. break;
  51781. }
  51782. const res = gen.value;
  51783. if (!res.success) {
  51784. return res;
  51785. }
  51786. if (res.html) {
  51787. this[$addHTML](res.html, res.bbox);
  51788. }
  51789. }
  51790. this[$extra].generator = null;
  51791. return _utils.HTMLResult.EMPTY;
  51792. }
  51793. [$setSetAttributes](attributes) {
  51794. this[_setAttributes] = new Set(Object.keys(attributes));
  51795. }
  51796. [_getUnsetAttributes](protoAttributes) {
  51797. const allAttr = this[_attributeNames];
  51798. const setAttr = this[_setAttributes];
  51799. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  51800. }
  51801. [$resolvePrototypes](ids, ancestors = new Set()) {
  51802. for (const child of this[_children]) {
  51803. child[_resolvePrototypesHelper](ids, ancestors);
  51804. }
  51805. }
  51806. [_resolvePrototypesHelper](ids, ancestors) {
  51807. const proto = this[_getPrototype](ids, ancestors);
  51808. if (proto) {
  51809. this[_applyPrototype](proto, ids, ancestors);
  51810. } else {
  51811. this[$resolvePrototypes](ids, ancestors);
  51812. }
  51813. }
  51814. [_getPrototype](ids, ancestors) {
  51815. const {
  51816. use,
  51817. usehref
  51818. } = this;
  51819. if (!use && !usehref) {
  51820. return null;
  51821. }
  51822. let proto = null;
  51823. let somExpression = null;
  51824. let id = null;
  51825. let ref = use;
  51826. if (usehref) {
  51827. ref = usehref;
  51828. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  51829. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  51830. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  51831. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  51832. } else if (usehref.startsWith("#")) {
  51833. id = usehref.slice(1);
  51834. } else if (usehref.startsWith(".#")) {
  51835. id = usehref.slice(2);
  51836. }
  51837. } else if (use.startsWith("#")) {
  51838. id = use.slice(1);
  51839. } else {
  51840. somExpression = use;
  51841. }
  51842. this.use = this.usehref = "";
  51843. if (id) {
  51844. proto = ids.get(id);
  51845. } else {
  51846. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  51847. if (proto) {
  51848. proto = proto[0];
  51849. }
  51850. }
  51851. if (!proto) {
  51852. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  51853. return null;
  51854. }
  51855. if (proto[$nodeName] !== this[$nodeName]) {
  51856. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  51857. return null;
  51858. }
  51859. if (ancestors.has(proto)) {
  51860. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51861. return null;
  51862. }
  51863. ancestors.add(proto);
  51864. const protoProto = proto[_getPrototype](ids, ancestors);
  51865. if (protoProto) {
  51866. proto[_applyPrototype](protoProto, ids, ancestors);
  51867. }
  51868. proto[$resolvePrototypes](ids, ancestors);
  51869. ancestors.delete(proto);
  51870. return proto;
  51871. }
  51872. [_applyPrototype](proto, ids, ancestors) {
  51873. if (ancestors.has(proto)) {
  51874. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51875. return;
  51876. }
  51877. if (!this[$content] && proto[$content]) {
  51878. this[$content] = proto[$content];
  51879. }
  51880. const newAncestors = new Set(ancestors);
  51881. newAncestors.add(proto);
  51882. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  51883. this[unsetAttrName] = proto[unsetAttrName];
  51884. if (this[_setAttributes]) {
  51885. this[_setAttributes].add(unsetAttrName);
  51886. }
  51887. }
  51888. for (const name of Object.getOwnPropertyNames(this)) {
  51889. if (this[_attributeNames].has(name)) {
  51890. continue;
  51891. }
  51892. const value = this[name];
  51893. const protoValue = proto[name];
  51894. if (value instanceof XFAObjectArray) {
  51895. for (const child of value[_children]) {
  51896. child[_resolvePrototypesHelper](ids, ancestors);
  51897. }
  51898. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  51899. const child = proto[_children][i][$clone]();
  51900. if (value.push(child)) {
  51901. child[_parent] = this;
  51902. this[_children].push(child);
  51903. child[_resolvePrototypesHelper](ids, ancestors);
  51904. } else {
  51905. break;
  51906. }
  51907. }
  51908. continue;
  51909. }
  51910. if (value !== null) {
  51911. value[$resolvePrototypes](ids, ancestors);
  51912. if (protoValue) {
  51913. value[_applyPrototype](protoValue, ids, ancestors);
  51914. }
  51915. continue;
  51916. }
  51917. if (protoValue !== null) {
  51918. const child = protoValue[$clone]();
  51919. child[_parent] = this;
  51920. this[name] = child;
  51921. this[_children].push(child);
  51922. child[_resolvePrototypesHelper](ids, ancestors);
  51923. }
  51924. }
  51925. }
  51926. static [_cloneAttribute](obj) {
  51927. if (Array.isArray(obj)) {
  51928. return obj.map(x => XFAObject[_cloneAttribute](x));
  51929. }
  51930. if (typeof obj === "object" && obj !== null) {
  51931. return Object.assign({}, obj);
  51932. }
  51933. return obj;
  51934. }
  51935. [$clone]() {
  51936. const clone = Object.create(Object.getPrototypeOf(this));
  51937. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  51938. try {
  51939. clone[$symbol] = this[$symbol];
  51940. } catch (_) {
  51941. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  51942. }
  51943. }
  51944. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  51945. clone[_children] = [];
  51946. for (const name of Object.getOwnPropertyNames(this)) {
  51947. if (this[_attributeNames].has(name)) {
  51948. clone[name] = XFAObject[_cloneAttribute](this[name]);
  51949. continue;
  51950. }
  51951. const value = this[name];
  51952. if (value instanceof XFAObjectArray) {
  51953. clone[name] = new XFAObjectArray(value[_max]);
  51954. } else {
  51955. clone[name] = null;
  51956. }
  51957. }
  51958. for (const child of this[_children]) {
  51959. const name = child[$nodeName];
  51960. const clonedChild = child[$clone]();
  51961. clone[_children].push(clonedChild);
  51962. clonedChild[_parent] = clone;
  51963. if (clone[name] === null) {
  51964. clone[name] = clonedChild;
  51965. } else {
  51966. clone[name][_children].push(clonedChild);
  51967. }
  51968. }
  51969. return clone;
  51970. }
  51971. [$getChildren](name = null) {
  51972. if (!name) {
  51973. return this[_children];
  51974. }
  51975. return this[_children].filter(c => c[$nodeName] === name);
  51976. }
  51977. [$getChildrenByClass](name) {
  51978. return this[name];
  51979. }
  51980. [$getChildrenByName](name, allTransparent, first = true) {
  51981. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  51982. }
  51983. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  51984. if (name === "parent") {
  51985. yield this[_parent];
  51986. return;
  51987. }
  51988. for (const child of this[_children]) {
  51989. if (child[$nodeName] === name) {
  51990. yield child;
  51991. }
  51992. if (child.name === name) {
  51993. yield child;
  51994. }
  51995. if (allTransparent || child[$isTransparent]()) {
  51996. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  51997. }
  51998. }
  51999. if (first && this[_attributeNames].has(name)) {
  52000. yield new XFAAttribute(this, name, this[name]);
  52001. }
  52002. }
  52003. }
  52004. exports.XFAObject = XFAObject;
  52005. class XFAObjectArray {
  52006. constructor(max = Infinity) {
  52007. this[_max] = max;
  52008. this[_children] = [];
  52009. }
  52010. push(child) {
  52011. const len = this[_children].length;
  52012. if (len <= this[_max]) {
  52013. this[_children].push(child);
  52014. return true;
  52015. }
  52016. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  52017. return false;
  52018. }
  52019. isEmpty() {
  52020. return this[_children].length === 0;
  52021. }
  52022. dump() {
  52023. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  52024. }
  52025. [$clone]() {
  52026. const clone = new XFAObjectArray(this[_max]);
  52027. clone[_children] = this[_children].map(c => c[$clone]());
  52028. return clone;
  52029. }
  52030. get children() {
  52031. return this[_children];
  52032. }
  52033. clear() {
  52034. this[_children].length = 0;
  52035. }
  52036. }
  52037. exports.XFAObjectArray = XFAObjectArray;
  52038. class XFAAttribute {
  52039. constructor(node, name, value) {
  52040. this[_parent] = node;
  52041. this[$nodeName] = name;
  52042. this[$content] = value;
  52043. this[$consumed] = false;
  52044. this[$uid] = `attribute${uid++}`;
  52045. }
  52046. [$getParent]() {
  52047. return this[_parent];
  52048. }
  52049. [$isDataValue]() {
  52050. return true;
  52051. }
  52052. [$getDataValue]() {
  52053. return this[$content].trim();
  52054. }
  52055. [$setValue](value) {
  52056. value = value.value || "";
  52057. this[$content] = value.toString();
  52058. }
  52059. [$text]() {
  52060. return this[$content];
  52061. }
  52062. [$isDescendent](parent) {
  52063. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  52064. }
  52065. }
  52066. exports.XFAAttribute = XFAAttribute;
  52067. class XmlObject extends XFAObject {
  52068. constructor(nsId, name, attributes = {}) {
  52069. super(nsId, name);
  52070. this[$content] = "";
  52071. this[_dataValue] = null;
  52072. if (name !== "#text") {
  52073. const map = new Map();
  52074. this[_attributes] = map;
  52075. for (const [attrName, value] of Object.entries(attributes)) {
  52076. map.set(attrName, new XFAAttribute(this, attrName, value));
  52077. }
  52078. if (attributes.hasOwnProperty($nsAttributes)) {
  52079. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  52080. if (dataNode !== undefined) {
  52081. if (dataNode === "dataGroup") {
  52082. this[_dataValue] = false;
  52083. } else if (dataNode === "dataValue") {
  52084. this[_dataValue] = true;
  52085. }
  52086. }
  52087. }
  52088. }
  52089. this[$consumed] = false;
  52090. }
  52091. [$toString](buf) {
  52092. const tagName = this[$nodeName];
  52093. if (tagName === "#text") {
  52094. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52095. return;
  52096. }
  52097. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  52098. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  52099. buf.push(`<${prefix}${utf8TagName}`);
  52100. for (const [name, value] of this[_attributes].entries()) {
  52101. const utf8Name = (0, _util.utf8StringToString)(name);
  52102. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  52103. }
  52104. if (this[_dataValue] !== null) {
  52105. if (this[_dataValue]) {
  52106. buf.push(` xfa:dataNode="dataValue"`);
  52107. } else {
  52108. buf.push(` xfa:dataNode="dataGroup"`);
  52109. }
  52110. }
  52111. if (!this[$content] && this[_children].length === 0) {
  52112. buf.push("/>");
  52113. return;
  52114. }
  52115. buf.push(">");
  52116. if (this[$content]) {
  52117. if (typeof this[$content] === "string") {
  52118. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  52119. } else {
  52120. this[$content][$toString](buf);
  52121. }
  52122. } else {
  52123. for (const child of this[_children]) {
  52124. child[$toString](buf);
  52125. }
  52126. }
  52127. buf.push(`</${prefix}${utf8TagName}>`);
  52128. }
  52129. [$onChild](child) {
  52130. if (this[$content]) {
  52131. const node = new XmlObject(this[$namespaceId], "#text");
  52132. this[$appendChild](node);
  52133. node[$content] = this[$content];
  52134. this[$content] = "";
  52135. }
  52136. this[$appendChild](child);
  52137. return true;
  52138. }
  52139. [$onText](str) {
  52140. this[$content] += str;
  52141. }
  52142. [$finalize]() {
  52143. if (this[$content] && this[_children].length > 0) {
  52144. const node = new XmlObject(this[$namespaceId], "#text");
  52145. this[$appendChild](node);
  52146. node[$content] = this[$content];
  52147. delete this[$content];
  52148. }
  52149. }
  52150. [$toHTML]() {
  52151. if (this[$nodeName] === "#text") {
  52152. return _utils.HTMLResult.success({
  52153. name: "#text",
  52154. value: this[$content]
  52155. });
  52156. }
  52157. return _utils.HTMLResult.EMPTY;
  52158. }
  52159. [$getChildren](name = null) {
  52160. if (!name) {
  52161. return this[_children];
  52162. }
  52163. return this[_children].filter(c => c[$nodeName] === name);
  52164. }
  52165. [$getAttributes]() {
  52166. return this[_attributes];
  52167. }
  52168. [$getChildrenByClass](name) {
  52169. const value = this[_attributes].get(name);
  52170. if (value !== undefined) {
  52171. return value;
  52172. }
  52173. return this[$getChildren](name);
  52174. }
  52175. *[$getChildrenByNameIt](name, allTransparent) {
  52176. const value = this[_attributes].get(name);
  52177. if (value) {
  52178. yield value;
  52179. }
  52180. for (const child of this[_children]) {
  52181. if (child[$nodeName] === name) {
  52182. yield child;
  52183. }
  52184. if (allTransparent) {
  52185. yield* child[$getChildrenByNameIt](name, allTransparent);
  52186. }
  52187. }
  52188. }
  52189. *[$getAttributeIt](name, skipConsumed) {
  52190. const value = this[_attributes].get(name);
  52191. if (value && (!skipConsumed || !value[$consumed])) {
  52192. yield value;
  52193. }
  52194. for (const child of this[_children]) {
  52195. yield* child[$getAttributeIt](name, skipConsumed);
  52196. }
  52197. }
  52198. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  52199. for (const child of this[_children]) {
  52200. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  52201. yield child;
  52202. }
  52203. if (allTransparent) {
  52204. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  52205. }
  52206. }
  52207. }
  52208. [$isDataValue]() {
  52209. if (this[_dataValue] === null) {
  52210. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  52211. }
  52212. return this[_dataValue];
  52213. }
  52214. [$getDataValue]() {
  52215. if (this[_dataValue] === null) {
  52216. if (this[_children].length === 0) {
  52217. return this[$content].trim();
  52218. }
  52219. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  52220. return this[_children][0][$text]().trim();
  52221. }
  52222. return null;
  52223. }
  52224. return this[$content].trim();
  52225. }
  52226. [$setValue](value) {
  52227. value = value.value || "";
  52228. this[$content] = value.toString();
  52229. }
  52230. [$dump](hasNS = false) {
  52231. const dumped = Object.create(null);
  52232. if (hasNS) {
  52233. dumped.$ns = this[$namespaceId];
  52234. }
  52235. if (this[$content]) {
  52236. dumped.$content = this[$content];
  52237. }
  52238. dumped.$name = this[$nodeName];
  52239. dumped.children = [];
  52240. for (const child of this[_children]) {
  52241. dumped.children.push(child[$dump](hasNS));
  52242. }
  52243. dumped.attributes = Object.create(null);
  52244. for (const [name, value] of this[_attributes]) {
  52245. dumped.attributes[name] = value[$content];
  52246. }
  52247. return dumped;
  52248. }
  52249. }
  52250. exports.XmlObject = XmlObject;
  52251. class ContentObject extends XFAObject {
  52252. constructor(nsId, name) {
  52253. super(nsId, name);
  52254. this[$content] = "";
  52255. }
  52256. [$onText](text) {
  52257. this[$content] += text;
  52258. }
  52259. [$finalize]() {}
  52260. }
  52261. exports.ContentObject = ContentObject;
  52262. class OptionObject extends ContentObject {
  52263. constructor(nsId, name, options) {
  52264. super(nsId, name);
  52265. this[_options] = options;
  52266. }
  52267. [$finalize]() {
  52268. this[$content] = (0, _utils.getKeyword)({
  52269. data: this[$content],
  52270. defaultValue: this[_options][0],
  52271. validate: k => this[_options].includes(k)
  52272. });
  52273. }
  52274. [$clean](builder) {
  52275. super[$clean](builder);
  52276. delete this[_options];
  52277. }
  52278. }
  52279. exports.OptionObject = OptionObject;
  52280. class StringObject extends ContentObject {
  52281. [$finalize]() {
  52282. this[$content] = this[$content].trim();
  52283. }
  52284. }
  52285. exports.StringObject = StringObject;
  52286. class IntegerObject extends ContentObject {
  52287. constructor(nsId, name, defaultValue, validator) {
  52288. super(nsId, name);
  52289. this[_defaultValue] = defaultValue;
  52290. this[_validator] = validator;
  52291. }
  52292. [$finalize]() {
  52293. this[$content] = (0, _utils.getInteger)({
  52294. data: this[$content],
  52295. defaultValue: this[_defaultValue],
  52296. validate: this[_validator]
  52297. });
  52298. }
  52299. [$clean](builder) {
  52300. super[$clean](builder);
  52301. delete this[_defaultValue];
  52302. delete this[_validator];
  52303. }
  52304. }
  52305. exports.IntegerObject = IntegerObject;
  52306. class Option01 extends IntegerObject {
  52307. constructor(nsId, name) {
  52308. super(nsId, name, 0, n => n === 1);
  52309. }
  52310. }
  52311. exports.Option01 = Option01;
  52312. class Option10 extends IntegerObject {
  52313. constructor(nsId, name) {
  52314. super(nsId, name, 1, n => n === 0);
  52315. }
  52316. }
  52317. exports.Option10 = Option10;
  52318. /***/ }),
  52319. /* 78 */
  52320. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52321. Object.defineProperty(exports, "__esModule", ({
  52322. value: true
  52323. }));
  52324. exports.HTMLResult = void 0;
  52325. exports.getBBox = getBBox;
  52326. exports.getColor = getColor;
  52327. exports.getFloat = getFloat;
  52328. exports.getInteger = getInteger;
  52329. exports.getKeyword = getKeyword;
  52330. exports.getMeasurement = getMeasurement;
  52331. exports.getRatio = getRatio;
  52332. exports.getRelevant = getRelevant;
  52333. exports.getStringOption = getStringOption;
  52334. exports.stripQuotes = stripQuotes;
  52335. var _util = __w_pdfjs_require__(2);
  52336. const dimConverters = {
  52337. pt: x => x,
  52338. cm: x => x / 2.54 * 72,
  52339. mm: x => x / (10 * 2.54) * 72,
  52340. in: x => x * 72,
  52341. px: x => x
  52342. };
  52343. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  52344. function stripQuotes(str) {
  52345. if (str.startsWith("'") || str.startsWith('"')) {
  52346. return str.slice(1, str.length - 1);
  52347. }
  52348. return str;
  52349. }
  52350. function getInteger({
  52351. data,
  52352. defaultValue,
  52353. validate
  52354. }) {
  52355. if (!data) {
  52356. return defaultValue;
  52357. }
  52358. data = data.trim();
  52359. const n = parseInt(data, 10);
  52360. if (!isNaN(n) && validate(n)) {
  52361. return n;
  52362. }
  52363. return defaultValue;
  52364. }
  52365. function getFloat({
  52366. data,
  52367. defaultValue,
  52368. validate
  52369. }) {
  52370. if (!data) {
  52371. return defaultValue;
  52372. }
  52373. data = data.trim();
  52374. const n = parseFloat(data);
  52375. if (!isNaN(n) && validate(n)) {
  52376. return n;
  52377. }
  52378. return defaultValue;
  52379. }
  52380. function getKeyword({
  52381. data,
  52382. defaultValue,
  52383. validate
  52384. }) {
  52385. if (!data) {
  52386. return defaultValue;
  52387. }
  52388. data = data.trim();
  52389. if (validate(data)) {
  52390. return data;
  52391. }
  52392. return defaultValue;
  52393. }
  52394. function getStringOption(data, options) {
  52395. return getKeyword({
  52396. data,
  52397. defaultValue: options[0],
  52398. validate: k => options.includes(k)
  52399. });
  52400. }
  52401. function getMeasurement(str, def = "0") {
  52402. def = def || "0";
  52403. if (!str) {
  52404. return getMeasurement(def);
  52405. }
  52406. const match = str.trim().match(measurementPattern);
  52407. if (!match) {
  52408. return getMeasurement(def);
  52409. }
  52410. const [, valueStr, unit] = match;
  52411. const value = parseFloat(valueStr);
  52412. if (isNaN(value)) {
  52413. return getMeasurement(def);
  52414. }
  52415. if (value === 0) {
  52416. return 0;
  52417. }
  52418. const conv = dimConverters[unit];
  52419. if (conv) {
  52420. return conv(value);
  52421. }
  52422. return value;
  52423. }
  52424. function getRatio(data) {
  52425. if (!data) {
  52426. return {
  52427. num: 1,
  52428. den: 1
  52429. };
  52430. }
  52431. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  52432. if (ratio.length === 1) {
  52433. ratio.push(1);
  52434. }
  52435. if (ratio.length === 0) {
  52436. return {
  52437. num: 1,
  52438. den: 1
  52439. };
  52440. }
  52441. const [num, den] = ratio;
  52442. return {
  52443. num,
  52444. den
  52445. };
  52446. }
  52447. function getRelevant(data) {
  52448. if (!data) {
  52449. return [];
  52450. }
  52451. return data.trim().split(/\s+/).map(e => {
  52452. return {
  52453. excluded: e[0] === "-",
  52454. viewname: e.substring(1)
  52455. };
  52456. });
  52457. }
  52458. function getColor(data, def = [0, 0, 0]) {
  52459. let [r, g, b] = def;
  52460. if (!data) {
  52461. return {
  52462. r,
  52463. g,
  52464. b
  52465. };
  52466. }
  52467. 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);
  52468. if (color.length < 3) {
  52469. return {
  52470. r,
  52471. g,
  52472. b
  52473. };
  52474. }
  52475. [r, g, b] = color;
  52476. return {
  52477. r,
  52478. g,
  52479. b
  52480. };
  52481. }
  52482. function getBBox(data) {
  52483. const def = -1;
  52484. if (!data) {
  52485. return {
  52486. x: def,
  52487. y: def,
  52488. width: def,
  52489. height: def
  52490. };
  52491. }
  52492. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  52493. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  52494. return {
  52495. x: def,
  52496. y: def,
  52497. width: def,
  52498. height: def
  52499. };
  52500. }
  52501. const [x, y, width, height] = bbox;
  52502. return {
  52503. x,
  52504. y,
  52505. width,
  52506. height
  52507. };
  52508. }
  52509. class HTMLResult {
  52510. static get FAILURE() {
  52511. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  52512. }
  52513. static get EMPTY() {
  52514. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  52515. }
  52516. constructor(success, html, bbox, breakNode) {
  52517. this.success = success;
  52518. this.html = html;
  52519. this.bbox = bbox;
  52520. this.breakNode = breakNode;
  52521. }
  52522. isBreak() {
  52523. return !!this.breakNode;
  52524. }
  52525. static breakNode(node) {
  52526. return new HTMLResult(false, null, null, node);
  52527. }
  52528. static success(html, bbox = null) {
  52529. return new HTMLResult(true, html, bbox, null);
  52530. }
  52531. }
  52532. exports.HTMLResult = HTMLResult;
  52533. /***/ }),
  52534. /* 79 */
  52535. /***/ ((__unused_webpack_module, exports) => {
  52536. Object.defineProperty(exports, "__esModule", ({
  52537. value: true
  52538. }));
  52539. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  52540. const $buildXFAObject = Symbol();
  52541. exports.$buildXFAObject = $buildXFAObject;
  52542. const NamespaceIds = {
  52543. config: {
  52544. id: 0,
  52545. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  52546. },
  52547. connectionSet: {
  52548. id: 1,
  52549. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  52550. },
  52551. datasets: {
  52552. id: 2,
  52553. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  52554. },
  52555. form: {
  52556. id: 3,
  52557. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  52558. },
  52559. localeSet: {
  52560. id: 4,
  52561. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  52562. },
  52563. pdf: {
  52564. id: 5,
  52565. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  52566. },
  52567. signature: {
  52568. id: 6,
  52569. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  52570. },
  52571. sourceSet: {
  52572. id: 7,
  52573. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  52574. },
  52575. stylesheet: {
  52576. id: 8,
  52577. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  52578. },
  52579. template: {
  52580. id: 9,
  52581. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  52582. },
  52583. xdc: {
  52584. id: 10,
  52585. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  52586. },
  52587. xdp: {
  52588. id: 11,
  52589. check: ns => ns === "http://ns.adobe.com/xdp/"
  52590. },
  52591. xfdf: {
  52592. id: 12,
  52593. check: ns => ns === "http://ns.adobe.com/xfdf/"
  52594. },
  52595. xhtml: {
  52596. id: 13,
  52597. check: ns => ns === "http://www.w3.org/1999/xhtml"
  52598. },
  52599. xmpmeta: {
  52600. id: 14,
  52601. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  52602. }
  52603. };
  52604. exports.NamespaceIds = NamespaceIds;
  52605. /***/ }),
  52606. /* 80 */
  52607. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52608. Object.defineProperty(exports, "__esModule", ({
  52609. value: true
  52610. }));
  52611. exports.createDataNode = createDataNode;
  52612. exports.searchNode = searchNode;
  52613. var _xfa_object = __w_pdfjs_require__(77);
  52614. var _namespaces = __w_pdfjs_require__(79);
  52615. var _util = __w_pdfjs_require__(2);
  52616. const namePattern = /^[^.[]+/;
  52617. const indexPattern = /^[^\]]+/;
  52618. const operators = {
  52619. dot: 0,
  52620. dotDot: 1,
  52621. dotHash: 2,
  52622. dotBracket: 3,
  52623. dotParen: 4
  52624. };
  52625. 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]]);
  52626. const somCache = new WeakMap();
  52627. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52628. function parseIndex(index) {
  52629. index = index.trim();
  52630. if (index === "*") {
  52631. return Infinity;
  52632. }
  52633. return parseInt(index, 10) || 0;
  52634. }
  52635. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  52636. let match = expr.match(namePattern);
  52637. if (!match) {
  52638. return null;
  52639. }
  52640. let [name] = match;
  52641. const parsed = [{
  52642. name,
  52643. cacheName: "." + name,
  52644. index: 0,
  52645. js: null,
  52646. formCalc: null,
  52647. operator: operators.dot
  52648. }];
  52649. let pos = name.length;
  52650. while (pos < expr.length) {
  52651. const spos = pos;
  52652. const char = expr.charAt(pos++);
  52653. if (char === "[") {
  52654. match = expr.slice(pos).match(indexPattern);
  52655. if (!match) {
  52656. (0, _util.warn)("XFA - Invalid index in SOM expression");
  52657. return null;
  52658. }
  52659. parsed.at(-1).index = parseIndex(match[0]);
  52660. pos += match[0].length + 1;
  52661. continue;
  52662. }
  52663. let operator;
  52664. switch (expr.charAt(pos)) {
  52665. case ".":
  52666. if (!dotDotAllowed) {
  52667. return null;
  52668. }
  52669. pos++;
  52670. operator = operators.dotDot;
  52671. break;
  52672. case "#":
  52673. pos++;
  52674. operator = operators.dotHash;
  52675. break;
  52676. case "[":
  52677. if (noExpr) {
  52678. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  52679. return null;
  52680. }
  52681. operator = operators.dotBracket;
  52682. break;
  52683. case "(":
  52684. if (noExpr) {
  52685. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  52686. return null;
  52687. }
  52688. operator = operators.dotParen;
  52689. break;
  52690. default:
  52691. operator = operators.dot;
  52692. break;
  52693. }
  52694. match = expr.slice(pos).match(namePattern);
  52695. if (!match) {
  52696. break;
  52697. }
  52698. [name] = match;
  52699. pos += name.length;
  52700. parsed.push({
  52701. name,
  52702. cacheName: expr.slice(spos, pos),
  52703. operator,
  52704. index: 0,
  52705. js: null,
  52706. formCalc: null
  52707. });
  52708. }
  52709. return parsed;
  52710. }
  52711. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  52712. const parsed = parseExpression(expr, dotDotAllowed);
  52713. if (!parsed) {
  52714. return null;
  52715. }
  52716. const fn = shortcuts.get(parsed[0].name);
  52717. let i = 0;
  52718. let isQualified;
  52719. if (fn) {
  52720. isQualified = true;
  52721. root = [fn(root, container)];
  52722. i = 1;
  52723. } else {
  52724. isQualified = container === null;
  52725. root = [container || root];
  52726. }
  52727. for (let ii = parsed.length; i < ii; i++) {
  52728. const {
  52729. name,
  52730. cacheName,
  52731. operator,
  52732. index
  52733. } = parsed[i];
  52734. const nodes = [];
  52735. for (const node of root) {
  52736. if (!(node instanceof _xfa_object.XFAObject)) {
  52737. continue;
  52738. }
  52739. let children, cached;
  52740. if (useCache) {
  52741. cached = somCache.get(node);
  52742. if (!cached) {
  52743. cached = new Map();
  52744. somCache.set(node, cached);
  52745. }
  52746. children = cached.get(cacheName);
  52747. }
  52748. if (!children) {
  52749. switch (operator) {
  52750. case operators.dot:
  52751. children = node[_xfa_object.$getChildrenByName](name, false);
  52752. break;
  52753. case operators.dotDot:
  52754. children = node[_xfa_object.$getChildrenByName](name, true);
  52755. break;
  52756. case operators.dotHash:
  52757. children = node[_xfa_object.$getChildrenByClass](name);
  52758. if (children instanceof _xfa_object.XFAObjectArray) {
  52759. children = children.children;
  52760. } else {
  52761. children = [children];
  52762. }
  52763. break;
  52764. default:
  52765. break;
  52766. }
  52767. if (useCache) {
  52768. cached.set(cacheName, children);
  52769. }
  52770. }
  52771. if (children.length > 0) {
  52772. nodes.push(children);
  52773. }
  52774. }
  52775. if (nodes.length === 0 && !isQualified && i === 0) {
  52776. const parent = container[_xfa_object.$getParent]();
  52777. container = parent;
  52778. if (!container) {
  52779. return null;
  52780. }
  52781. i = -1;
  52782. root = [container];
  52783. continue;
  52784. }
  52785. if (isFinite(index)) {
  52786. root = nodes.filter(node => index < node.length).map(node => node[index]);
  52787. } else {
  52788. root = nodes.flat();
  52789. }
  52790. }
  52791. if (root.length === 0) {
  52792. return null;
  52793. }
  52794. return root;
  52795. }
  52796. function createNodes(root, path) {
  52797. let node = null;
  52798. for (const {
  52799. name,
  52800. index
  52801. } of path) {
  52802. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  52803. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  52804. node = new _xfa_object.XmlObject(nsId, name);
  52805. root[_xfa_object.$appendChild](node);
  52806. }
  52807. root = node;
  52808. }
  52809. return node;
  52810. }
  52811. function createDataNode(root, container, expr) {
  52812. const parsed = parseExpression(expr);
  52813. if (!parsed) {
  52814. return null;
  52815. }
  52816. if (parsed.some(x => x.operator === operators.dotDot)) {
  52817. return null;
  52818. }
  52819. const fn = shortcuts.get(parsed[0].name);
  52820. let i = 0;
  52821. if (fn) {
  52822. root = fn(root, container);
  52823. i = 1;
  52824. } else {
  52825. root = container || root;
  52826. }
  52827. for (let ii = parsed.length; i < ii; i++) {
  52828. const {
  52829. name,
  52830. operator,
  52831. index
  52832. } = parsed[i];
  52833. if (!isFinite(index)) {
  52834. parsed[i].index = 0;
  52835. return createNodes(root, parsed.slice(i));
  52836. }
  52837. let children;
  52838. switch (operator) {
  52839. case operators.dot:
  52840. children = root[_xfa_object.$getChildrenByName](name, false);
  52841. break;
  52842. case operators.dotDot:
  52843. children = root[_xfa_object.$getChildrenByName](name, true);
  52844. break;
  52845. case operators.dotHash:
  52846. children = root[_xfa_object.$getChildrenByClass](name);
  52847. if (children instanceof _xfa_object.XFAObjectArray) {
  52848. children = children.children;
  52849. } else {
  52850. children = [children];
  52851. }
  52852. break;
  52853. default:
  52854. break;
  52855. }
  52856. if (children.length === 0) {
  52857. return createNodes(root, parsed.slice(i));
  52858. }
  52859. if (index < children.length) {
  52860. const child = children[index];
  52861. if (!(child instanceof _xfa_object.XFAObject)) {
  52862. (0, _util.warn)(`XFA - Cannot create a node.`);
  52863. return null;
  52864. }
  52865. root = child;
  52866. } else {
  52867. parsed[i].index = index - children.length;
  52868. return createNodes(root, parsed.slice(i));
  52869. }
  52870. }
  52871. return null;
  52872. }
  52873. /***/ }),
  52874. /* 81 */
  52875. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52876. Object.defineProperty(exports, "__esModule", ({
  52877. value: true
  52878. }));
  52879. exports.Binder = void 0;
  52880. var _xfa_object = __w_pdfjs_require__(77);
  52881. var _template = __w_pdfjs_require__(82);
  52882. var _som = __w_pdfjs_require__(80);
  52883. var _namespaces = __w_pdfjs_require__(79);
  52884. var _util = __w_pdfjs_require__(2);
  52885. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52886. function createText(content) {
  52887. const node = new _template.Text({});
  52888. node[_xfa_object.$content] = content;
  52889. return node;
  52890. }
  52891. class Binder {
  52892. constructor(root) {
  52893. this.root = root;
  52894. this.datasets = root.datasets;
  52895. if (root.datasets && root.datasets.data) {
  52896. this.data = root.datasets.data;
  52897. } else {
  52898. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  52899. }
  52900. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  52901. this.root.form = this.form = root.template[_xfa_object.$clone]();
  52902. }
  52903. _isConsumeData() {
  52904. return !this.emptyMerge && this._mergeMode;
  52905. }
  52906. _isMatchTemplate() {
  52907. return !this._isConsumeData();
  52908. }
  52909. bind() {
  52910. this._bindElement(this.form, this.data);
  52911. return this.form;
  52912. }
  52913. getData() {
  52914. return this.data;
  52915. }
  52916. _bindValue(formNode, data, picture) {
  52917. formNode[_xfa_object.$data] = data;
  52918. if (formNode[_xfa_object.$hasSettableValue]()) {
  52919. if (data[_xfa_object.$isDataValue]()) {
  52920. const value = data[_xfa_object.$getDataValue]();
  52921. formNode[_xfa_object.$setValue](createText(value));
  52922. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  52923. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  52924. formNode[_xfa_object.$setValue](createText(value));
  52925. } else if (this._isConsumeData()) {
  52926. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52927. }
  52928. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  52929. this._bindElement(formNode, data);
  52930. } else {
  52931. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52932. }
  52933. }
  52934. _findDataByNameToConsume(name, isValue, dataNode, global) {
  52935. if (!name) {
  52936. return null;
  52937. }
  52938. let generator, match;
  52939. for (let i = 0; i < 3; i++) {
  52940. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  52941. while (true) {
  52942. match = generator.next().value;
  52943. if (!match) {
  52944. break;
  52945. }
  52946. if (isValue === match[_xfa_object.$isDataValue]()) {
  52947. return match;
  52948. }
  52949. }
  52950. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  52951. break;
  52952. }
  52953. dataNode = dataNode[_xfa_object.$getParent]();
  52954. }
  52955. if (!global) {
  52956. return null;
  52957. }
  52958. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  52959. match = generator.next().value;
  52960. if (match) {
  52961. return match;
  52962. }
  52963. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  52964. match = generator.next().value;
  52965. if (match && match[_xfa_object.$isDataValue]()) {
  52966. return match;
  52967. }
  52968. return null;
  52969. }
  52970. _setProperties(formNode, dataNode) {
  52971. if (!formNode.hasOwnProperty("setProperty")) {
  52972. return;
  52973. }
  52974. for (const {
  52975. ref,
  52976. target,
  52977. connection
  52978. } of formNode.setProperty.children) {
  52979. if (connection) {
  52980. continue;
  52981. }
  52982. if (!ref) {
  52983. continue;
  52984. }
  52985. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  52986. if (!nodes) {
  52987. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  52988. continue;
  52989. }
  52990. const [node] = nodes;
  52991. if (!node[_xfa_object.$isDescendent](this.data)) {
  52992. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  52993. continue;
  52994. }
  52995. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  52996. if (!targetNodes) {
  52997. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  52998. continue;
  52999. }
  53000. const [targetNode] = targetNodes;
  53001. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  53002. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  53003. continue;
  53004. }
  53005. const targetParent = targetNode[_xfa_object.$getParent]();
  53006. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  53007. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  53008. continue;
  53009. }
  53010. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  53011. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  53012. continue;
  53013. }
  53014. const content = node[_xfa_object.$text]();
  53015. const name = targetNode[_xfa_object.$nodeName];
  53016. if (targetNode instanceof _xfa_object.XFAAttribute) {
  53017. const attrs = Object.create(null);
  53018. attrs[name] = content;
  53019. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  53020. targetParent[name] = obj[name];
  53021. continue;
  53022. }
  53023. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  53024. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  53025. continue;
  53026. }
  53027. targetNode[_xfa_object.$data] = node;
  53028. targetNode[_xfa_object.$content] = content;
  53029. targetNode[_xfa_object.$finalize]();
  53030. }
  53031. }
  53032. _bindItems(formNode, dataNode) {
  53033. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  53034. return;
  53035. }
  53036. for (const item of formNode.items.children) {
  53037. formNode[_xfa_object.$removeChild](item);
  53038. }
  53039. formNode.items.clear();
  53040. const labels = new _template.Items({});
  53041. const values = new _template.Items({});
  53042. formNode[_xfa_object.$appendChild](labels);
  53043. formNode.items.push(labels);
  53044. formNode[_xfa_object.$appendChild](values);
  53045. formNode.items.push(values);
  53046. for (const {
  53047. ref,
  53048. labelRef,
  53049. valueRef,
  53050. connection
  53051. } of formNode.bindItems.children) {
  53052. if (connection) {
  53053. continue;
  53054. }
  53055. if (!ref) {
  53056. continue;
  53057. }
  53058. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  53059. if (!nodes) {
  53060. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  53061. continue;
  53062. }
  53063. for (const node of nodes) {
  53064. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  53065. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  53066. continue;
  53067. }
  53068. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  53069. if (!labelNodes) {
  53070. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  53071. continue;
  53072. }
  53073. const [labelNode] = labelNodes;
  53074. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  53075. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  53076. continue;
  53077. }
  53078. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  53079. if (!valueNodes) {
  53080. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  53081. continue;
  53082. }
  53083. const [valueNode] = valueNodes;
  53084. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  53085. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  53086. continue;
  53087. }
  53088. const label = createText(labelNode[_xfa_object.$text]());
  53089. const value = createText(valueNode[_xfa_object.$text]());
  53090. labels[_xfa_object.$appendChild](label);
  53091. labels.text.push(label);
  53092. values[_xfa_object.$appendChild](value);
  53093. values.text.push(value);
  53094. }
  53095. }
  53096. }
  53097. _bindOccurrences(formNode, matches, picture) {
  53098. let baseClone;
  53099. if (matches.length > 1) {
  53100. baseClone = formNode[_xfa_object.$clone]();
  53101. baseClone[_xfa_object.$removeChild](baseClone.occur);
  53102. baseClone.occur = null;
  53103. }
  53104. this._bindValue(formNode, matches[0], picture);
  53105. this._setProperties(formNode, matches[0]);
  53106. this._bindItems(formNode, matches[0]);
  53107. if (matches.length === 1) {
  53108. return;
  53109. }
  53110. const parent = formNode[_xfa_object.$getParent]();
  53111. const name = formNode[_xfa_object.$nodeName];
  53112. const pos = parent[_xfa_object.$indexOf](formNode);
  53113. for (let i = 1, ii = matches.length; i < ii; i++) {
  53114. const match = matches[i];
  53115. const clone = baseClone[_xfa_object.$clone]();
  53116. parent[name].push(clone);
  53117. parent[_xfa_object.$insertAt](pos + i, clone);
  53118. this._bindValue(clone, match, picture);
  53119. this._setProperties(clone, match);
  53120. this._bindItems(clone, match);
  53121. }
  53122. }
  53123. _createOccurrences(formNode) {
  53124. if (!this.emptyMerge) {
  53125. return;
  53126. }
  53127. const {
  53128. occur
  53129. } = formNode;
  53130. if (!occur || occur.initial <= 1) {
  53131. return;
  53132. }
  53133. const parent = formNode[_xfa_object.$getParent]();
  53134. const name = formNode[_xfa_object.$nodeName];
  53135. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  53136. return;
  53137. }
  53138. let currentNumber;
  53139. if (formNode.name) {
  53140. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  53141. } else {
  53142. currentNumber = parent[name].children.length;
  53143. }
  53144. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  53145. const ii = occur.initial - currentNumber;
  53146. if (ii) {
  53147. const nodeClone = formNode[_xfa_object.$clone]();
  53148. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  53149. nodeClone.occur = null;
  53150. parent[name].push(nodeClone);
  53151. parent[_xfa_object.$insertAt](pos, nodeClone);
  53152. for (let i = 1; i < ii; i++) {
  53153. const clone = nodeClone[_xfa_object.$clone]();
  53154. parent[name].push(clone);
  53155. parent[_xfa_object.$insertAt](pos + i, clone);
  53156. }
  53157. }
  53158. }
  53159. _getOccurInfo(formNode) {
  53160. const {
  53161. name,
  53162. occur
  53163. } = formNode;
  53164. if (!occur || !name) {
  53165. return [1, 1];
  53166. }
  53167. const max = occur.max === -1 ? Infinity : occur.max;
  53168. return [occur.min, max];
  53169. }
  53170. _setAndBind(formNode, dataNode) {
  53171. this._setProperties(formNode, dataNode);
  53172. this._bindItems(formNode, dataNode);
  53173. this._bindElement(formNode, dataNode);
  53174. }
  53175. _bindElement(formNode, dataNode) {
  53176. const uselessNodes = [];
  53177. this._createOccurrences(formNode);
  53178. for (const child of formNode[_xfa_object.$getChildren]()) {
  53179. if (child[_xfa_object.$data]) {
  53180. continue;
  53181. }
  53182. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  53183. this._mergeMode = child.mergeMode === "consumeData";
  53184. const dataChildren = dataNode[_xfa_object.$getChildren]();
  53185. if (dataChildren.length > 0) {
  53186. this._bindOccurrences(child, [dataChildren[0]], null);
  53187. } else if (this.emptyMerge) {
  53188. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53189. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  53190. dataNode[_xfa_object.$appendChild](dataChild);
  53191. this._bindElement(child, dataChild);
  53192. }
  53193. continue;
  53194. }
  53195. if (!child[_xfa_object.$isBindable]()) {
  53196. continue;
  53197. }
  53198. let global = false;
  53199. let picture = null;
  53200. let ref = null;
  53201. let match = null;
  53202. if (child.bind) {
  53203. switch (child.bind.match) {
  53204. case "none":
  53205. this._setAndBind(child, dataNode);
  53206. continue;
  53207. case "global":
  53208. global = true;
  53209. break;
  53210. case "dataRef":
  53211. if (!child.bind.ref) {
  53212. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  53213. this._setAndBind(child, dataNode);
  53214. continue;
  53215. }
  53216. ref = child.bind.ref;
  53217. break;
  53218. default:
  53219. break;
  53220. }
  53221. if (child.bind.picture) {
  53222. picture = child.bind.picture[_xfa_object.$content];
  53223. }
  53224. }
  53225. const [min, max] = this._getOccurInfo(child);
  53226. if (ref) {
  53227. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  53228. if (match === null) {
  53229. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  53230. if (!match) {
  53231. continue;
  53232. }
  53233. if (this._isConsumeData()) {
  53234. match[_xfa_object.$consumed] = true;
  53235. }
  53236. this._setAndBind(child, match);
  53237. continue;
  53238. } else {
  53239. if (this._isConsumeData()) {
  53240. match = match.filter(node => !node[_xfa_object.$consumed]);
  53241. }
  53242. if (match.length > max) {
  53243. match = match.slice(0, max);
  53244. } else if (match.length === 0) {
  53245. match = null;
  53246. }
  53247. if (match && this._isConsumeData()) {
  53248. match.forEach(node => {
  53249. node[_xfa_object.$consumed] = true;
  53250. });
  53251. }
  53252. }
  53253. } else {
  53254. if (!child.name) {
  53255. this._setAndBind(child, dataNode);
  53256. continue;
  53257. }
  53258. if (this._isConsumeData()) {
  53259. const matches = [];
  53260. while (matches.length < max) {
  53261. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  53262. if (!found) {
  53263. break;
  53264. }
  53265. found[_xfa_object.$consumed] = true;
  53266. matches.push(found);
  53267. }
  53268. match = matches.length > 0 ? matches : null;
  53269. } else {
  53270. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  53271. if (!match) {
  53272. if (min === 0) {
  53273. uselessNodes.push(child);
  53274. continue;
  53275. }
  53276. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  53277. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  53278. if (this.emptyMerge) {
  53279. match[_xfa_object.$consumed] = true;
  53280. }
  53281. dataNode[_xfa_object.$appendChild](match);
  53282. this._setAndBind(child, match);
  53283. continue;
  53284. }
  53285. if (this.emptyMerge) {
  53286. match[_xfa_object.$consumed] = true;
  53287. }
  53288. match = [match];
  53289. }
  53290. }
  53291. if (match) {
  53292. this._bindOccurrences(child, match, picture);
  53293. } else if (min > 0) {
  53294. this._setAndBind(child, dataNode);
  53295. } else {
  53296. uselessNodes.push(child);
  53297. }
  53298. }
  53299. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  53300. }
  53301. }
  53302. exports.Binder = Binder;
  53303. /***/ }),
  53304. /* 82 */
  53305. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53306. Object.defineProperty(exports, "__esModule", ({
  53307. value: true
  53308. }));
  53309. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  53310. var _xfa_object = __w_pdfjs_require__(77);
  53311. var _namespaces = __w_pdfjs_require__(79);
  53312. var _layout = __w_pdfjs_require__(83);
  53313. var _html_utils = __w_pdfjs_require__(84);
  53314. var _utils = __w_pdfjs_require__(78);
  53315. var _util = __w_pdfjs_require__(2);
  53316. var _fonts = __w_pdfjs_require__(85);
  53317. var _core_utils = __w_pdfjs_require__(6);
  53318. var _som = __w_pdfjs_require__(80);
  53319. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  53320. const SVG_NS = "http://www.w3.org/2000/svg";
  53321. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  53322. const MAX_EMPTY_PAGES = 3;
  53323. const DEFAULT_TAB_INDEX = 5000;
  53324. const HEADING_PATTERN = /^H(\d+)$/;
  53325. 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"]);
  53326. 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"]];
  53327. function getBorderDims(node) {
  53328. if (!node || !node.border) {
  53329. return {
  53330. w: 0,
  53331. h: 0
  53332. };
  53333. }
  53334. const borderExtra = node.border[_xfa_object.$getExtra]();
  53335. if (!borderExtra) {
  53336. return {
  53337. w: 0,
  53338. h: 0
  53339. };
  53340. }
  53341. return {
  53342. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  53343. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  53344. };
  53345. }
  53346. function hasMargin(node) {
  53347. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  53348. }
  53349. function _setValue(templateNode, value) {
  53350. if (!templateNode.value) {
  53351. const nodeValue = new Value({});
  53352. templateNode[_xfa_object.$appendChild](nodeValue);
  53353. templateNode.value = nodeValue;
  53354. }
  53355. templateNode.value[_xfa_object.$setValue](value);
  53356. }
  53357. function* getContainedChildren(node) {
  53358. for (const child of node[_xfa_object.$getChildren]()) {
  53359. if (child instanceof SubformSet) {
  53360. yield* child[_xfa_object.$getContainedChildren]();
  53361. continue;
  53362. }
  53363. yield child;
  53364. }
  53365. }
  53366. function isRequired(node) {
  53367. return node.validate && node.validate.nullTest === "error";
  53368. }
  53369. function setTabIndex(node) {
  53370. while (node) {
  53371. if (!node.traversal) {
  53372. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53373. return;
  53374. }
  53375. if (node[_xfa_object.$tabIndex]) {
  53376. return;
  53377. }
  53378. let next = null;
  53379. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  53380. if (child.operation === "next") {
  53381. next = child;
  53382. break;
  53383. }
  53384. }
  53385. if (!next || !next.ref) {
  53386. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  53387. return;
  53388. }
  53389. const root = node[_xfa_object.$getTemplateRoot]();
  53390. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  53391. const ref = root[_xfa_object.$searchNode](next.ref, node);
  53392. if (!ref) {
  53393. return;
  53394. }
  53395. node = ref[0];
  53396. }
  53397. }
  53398. function applyAssist(obj, attributes) {
  53399. const assist = obj.assist;
  53400. if (assist) {
  53401. const assistTitle = assist[_xfa_object.$toHTML]();
  53402. if (assistTitle) {
  53403. attributes.title = assistTitle;
  53404. }
  53405. const role = assist.role;
  53406. const match = role.match(HEADING_PATTERN);
  53407. if (match) {
  53408. const ariaRole = "heading";
  53409. const ariaLevel = match[1];
  53410. attributes.role = ariaRole;
  53411. attributes["aria-level"] = ariaLevel;
  53412. }
  53413. }
  53414. if (obj.layout === "table") {
  53415. attributes.role = "table";
  53416. } else if (obj.layout === "row") {
  53417. attributes.role = "row";
  53418. } else {
  53419. const parent = obj[_xfa_object.$getParent]();
  53420. if (parent.layout === "row") {
  53421. if (parent.assist && parent.assist.role === "TH") {
  53422. attributes.role = "columnheader";
  53423. } else {
  53424. attributes.role = "cell";
  53425. }
  53426. }
  53427. }
  53428. }
  53429. function ariaLabel(obj) {
  53430. if (!obj.assist) {
  53431. return null;
  53432. }
  53433. const assist = obj.assist;
  53434. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  53435. return assist.speak[_xfa_object.$content];
  53436. }
  53437. if (assist.toolTip) {
  53438. return assist.toolTip[_xfa_object.$content];
  53439. }
  53440. return null;
  53441. }
  53442. function valueToHtml(value) {
  53443. return _utils.HTMLResult.success({
  53444. name: "div",
  53445. attributes: {
  53446. class: ["xfaRich"],
  53447. style: Object.create(null)
  53448. },
  53449. children: [{
  53450. name: "span",
  53451. attributes: {
  53452. style: Object.create(null)
  53453. },
  53454. value
  53455. }]
  53456. });
  53457. }
  53458. function setFirstUnsplittable(node) {
  53459. const root = node[_xfa_object.$getTemplateRoot]();
  53460. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  53461. root[_xfa_object.$extra].firstUnsplittable = node;
  53462. root[_xfa_object.$extra].noLayoutFailure = true;
  53463. }
  53464. }
  53465. function unsetFirstUnsplittable(node) {
  53466. const root = node[_xfa_object.$getTemplateRoot]();
  53467. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  53468. root[_xfa_object.$extra].noLayoutFailure = false;
  53469. }
  53470. }
  53471. function handleBreak(node) {
  53472. if (node[_xfa_object.$extra]) {
  53473. return false;
  53474. }
  53475. node[_xfa_object.$extra] = Object.create(null);
  53476. if (node.targetType === "auto") {
  53477. return false;
  53478. }
  53479. const root = node[_xfa_object.$getTemplateRoot]();
  53480. let target = null;
  53481. if (node.target) {
  53482. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  53483. if (!target) {
  53484. return false;
  53485. }
  53486. target = target[0];
  53487. }
  53488. const {
  53489. currentPageArea,
  53490. currentContentArea
  53491. } = root[_xfa_object.$extra];
  53492. if (node.targetType === "pageArea") {
  53493. if (!(target instanceof PageArea)) {
  53494. target = null;
  53495. }
  53496. if (node.startNew) {
  53497. node[_xfa_object.$extra].target = target || currentPageArea;
  53498. return true;
  53499. } else if (target && target !== currentPageArea) {
  53500. node[_xfa_object.$extra].target = target;
  53501. return true;
  53502. }
  53503. return false;
  53504. }
  53505. if (!(target instanceof ContentArea)) {
  53506. target = null;
  53507. }
  53508. const pageArea = target && target[_xfa_object.$getParent]();
  53509. let index;
  53510. let nextPageArea = pageArea;
  53511. if (node.startNew) {
  53512. if (target) {
  53513. const contentAreas = pageArea.contentArea.children;
  53514. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  53515. const indexForTarget = contentAreas.indexOf(target);
  53516. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  53517. nextPageArea = null;
  53518. }
  53519. index = indexForTarget - 1;
  53520. } else {
  53521. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  53522. }
  53523. } else if (target && target !== currentContentArea) {
  53524. const contentAreas = pageArea.contentArea.children;
  53525. index = contentAreas.indexOf(target) - 1;
  53526. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  53527. } else {
  53528. return false;
  53529. }
  53530. node[_xfa_object.$extra].target = nextPageArea;
  53531. node[_xfa_object.$extra].index = index;
  53532. return true;
  53533. }
  53534. function handleOverflow(node, extraNode, space) {
  53535. const root = node[_xfa_object.$getTemplateRoot]();
  53536. const saved = root[_xfa_object.$extra].noLayoutFailure;
  53537. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  53538. extraNode[_xfa_object.$getSubformParent] = () => node;
  53539. root[_xfa_object.$extra].noLayoutFailure = true;
  53540. const res = extraNode[_xfa_object.$toHTML](space);
  53541. node[_xfa_object.$addHTML](res.html, res.bbox);
  53542. root[_xfa_object.$extra].noLayoutFailure = saved;
  53543. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  53544. }
  53545. class AppearanceFilter extends _xfa_object.StringObject {
  53546. constructor(attributes) {
  53547. super(TEMPLATE_NS_ID, "appearanceFilter");
  53548. this.id = attributes.id || "";
  53549. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53550. this.use = attributes.use || "";
  53551. this.usehref = attributes.usehref || "";
  53552. }
  53553. }
  53554. class Arc extends _xfa_object.XFAObject {
  53555. constructor(attributes) {
  53556. super(TEMPLATE_NS_ID, "arc", true);
  53557. this.circular = (0, _utils.getInteger)({
  53558. data: attributes.circular,
  53559. defaultValue: 0,
  53560. validate: x => x === 1
  53561. });
  53562. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53563. this.id = attributes.id || "";
  53564. this.startAngle = (0, _utils.getFloat)({
  53565. data: attributes.startAngle,
  53566. defaultValue: 0,
  53567. validate: x => true
  53568. });
  53569. this.sweepAngle = (0, _utils.getFloat)({
  53570. data: attributes.sweepAngle,
  53571. defaultValue: 360,
  53572. validate: x => true
  53573. });
  53574. this.use = attributes.use || "";
  53575. this.usehref = attributes.usehref || "";
  53576. this.edge = null;
  53577. this.fill = null;
  53578. }
  53579. [_xfa_object.$toHTML]() {
  53580. const edge = this.edge || new Edge({});
  53581. const edgeStyle = edge[_xfa_object.$toStyle]();
  53582. const style = Object.create(null);
  53583. if (this.fill && this.fill.presence === "visible") {
  53584. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  53585. } else {
  53586. style.fill = "transparent";
  53587. }
  53588. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  53589. style.stroke = edgeStyle.color;
  53590. let arc;
  53591. const attributes = {
  53592. xmlns: SVG_NS,
  53593. style: {
  53594. width: "100%",
  53595. height: "100%",
  53596. overflow: "visible"
  53597. }
  53598. };
  53599. if (this.sweepAngle === 360) {
  53600. arc = {
  53601. name: "ellipse",
  53602. attributes: {
  53603. xmlns: SVG_NS,
  53604. cx: "50%",
  53605. cy: "50%",
  53606. rx: "50%",
  53607. ry: "50%",
  53608. style
  53609. }
  53610. };
  53611. } else {
  53612. const startAngle = this.startAngle * Math.PI / 180;
  53613. const sweepAngle = this.sweepAngle * Math.PI / 180;
  53614. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  53615. 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))];
  53616. arc = {
  53617. name: "path",
  53618. attributes: {
  53619. xmlns: SVG_NS,
  53620. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  53621. vectorEffect: "non-scaling-stroke",
  53622. style
  53623. }
  53624. };
  53625. Object.assign(attributes, {
  53626. viewBox: "0 0 100 100",
  53627. preserveAspectRatio: "none"
  53628. });
  53629. }
  53630. const svg = {
  53631. name: "svg",
  53632. children: [arc],
  53633. attributes
  53634. };
  53635. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53636. if (hasMargin(parent)) {
  53637. return _utils.HTMLResult.success({
  53638. name: "div",
  53639. attributes: {
  53640. style: {
  53641. display: "inline",
  53642. width: "100%",
  53643. height: "100%"
  53644. }
  53645. },
  53646. children: [svg]
  53647. });
  53648. }
  53649. svg.attributes.style.position = "absolute";
  53650. return _utils.HTMLResult.success(svg);
  53651. }
  53652. }
  53653. class Area extends _xfa_object.XFAObject {
  53654. constructor(attributes) {
  53655. super(TEMPLATE_NS_ID, "area", true);
  53656. this.colSpan = (0, _utils.getInteger)({
  53657. data: attributes.colSpan,
  53658. defaultValue: 1,
  53659. validate: n => n >= 1 || n === -1
  53660. });
  53661. this.id = attributes.id || "";
  53662. this.name = attributes.name || "";
  53663. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53664. this.use = attributes.use || "";
  53665. this.usehref = attributes.usehref || "";
  53666. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53667. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53668. this.desc = null;
  53669. this.extras = null;
  53670. this.area = new _xfa_object.XFAObjectArray();
  53671. this.draw = new _xfa_object.XFAObjectArray();
  53672. this.exObject = new _xfa_object.XFAObjectArray();
  53673. this.exclGroup = new _xfa_object.XFAObjectArray();
  53674. this.field = new _xfa_object.XFAObjectArray();
  53675. this.subform = new _xfa_object.XFAObjectArray();
  53676. this.subformSet = new _xfa_object.XFAObjectArray();
  53677. }
  53678. *[_xfa_object.$getContainedChildren]() {
  53679. yield* getContainedChildren(this);
  53680. }
  53681. [_xfa_object.$isTransparent]() {
  53682. return true;
  53683. }
  53684. [_xfa_object.$isBindable]() {
  53685. return true;
  53686. }
  53687. [_xfa_object.$addHTML](html, bbox) {
  53688. const [x, y, w, h] = bbox;
  53689. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  53690. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  53691. this[_xfa_object.$extra].children.push(html);
  53692. }
  53693. [_xfa_object.$getAvailableSpace]() {
  53694. return this[_xfa_object.$extra].availableSpace;
  53695. }
  53696. [_xfa_object.$toHTML](availableSpace) {
  53697. const style = (0, _html_utils.toStyle)(this, "position");
  53698. const attributes = {
  53699. style,
  53700. id: this[_xfa_object.$uid],
  53701. class: ["xfaArea"]
  53702. };
  53703. if ((0, _html_utils.isPrintOnly)(this)) {
  53704. attributes.class.push("xfaPrintOnly");
  53705. }
  53706. if (this.name) {
  53707. attributes.xfaName = this.name;
  53708. }
  53709. const children = [];
  53710. this[_xfa_object.$extra] = {
  53711. children,
  53712. width: 0,
  53713. height: 0,
  53714. availableSpace
  53715. };
  53716. const result = this[_xfa_object.$childrenToHTML]({
  53717. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  53718. include: true
  53719. });
  53720. if (!result.success) {
  53721. if (result.isBreak()) {
  53722. return result;
  53723. }
  53724. delete this[_xfa_object.$extra];
  53725. return _utils.HTMLResult.FAILURE;
  53726. }
  53727. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  53728. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  53729. const html = {
  53730. name: "div",
  53731. attributes,
  53732. children
  53733. };
  53734. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  53735. delete this[_xfa_object.$extra];
  53736. return _utils.HTMLResult.success(html, bbox);
  53737. }
  53738. }
  53739. class Assist extends _xfa_object.XFAObject {
  53740. constructor(attributes) {
  53741. super(TEMPLATE_NS_ID, "assist", true);
  53742. this.id = attributes.id || "";
  53743. this.role = attributes.role || "";
  53744. this.use = attributes.use || "";
  53745. this.usehref = attributes.usehref || "";
  53746. this.speak = null;
  53747. this.toolTip = null;
  53748. }
  53749. [_xfa_object.$toHTML]() {
  53750. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  53751. }
  53752. }
  53753. class Barcode extends _xfa_object.XFAObject {
  53754. constructor(attributes) {
  53755. super(TEMPLATE_NS_ID, "barcode", true);
  53756. this.charEncoding = (0, _utils.getKeyword)({
  53757. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  53758. defaultValue: "",
  53759. 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}/)
  53760. });
  53761. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  53762. this.dataColumnCount = (0, _utils.getInteger)({
  53763. data: attributes.dataColumnCount,
  53764. defaultValue: -1,
  53765. validate: x => x >= 0
  53766. });
  53767. this.dataLength = (0, _utils.getInteger)({
  53768. data: attributes.dataLength,
  53769. defaultValue: -1,
  53770. validate: x => x >= 0
  53771. });
  53772. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  53773. this.dataRowCount = (0, _utils.getInteger)({
  53774. data: attributes.dataRowCount,
  53775. defaultValue: -1,
  53776. validate: x => x >= 0
  53777. });
  53778. this.endChar = attributes.endChar || "";
  53779. this.errorCorrectionLevel = (0, _utils.getInteger)({
  53780. data: attributes.errorCorrectionLevel,
  53781. defaultValue: -1,
  53782. validate: x => x >= 0 && x <= 8
  53783. });
  53784. this.id = attributes.id || "";
  53785. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  53786. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  53787. this.printCheckDigit = (0, _utils.getInteger)({
  53788. data: attributes.printCheckDigit,
  53789. defaultValue: 0,
  53790. validate: x => x === 1
  53791. });
  53792. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  53793. this.startChar = attributes.startChar || "";
  53794. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  53795. this.truncate = (0, _utils.getInteger)({
  53796. data: attributes.truncate,
  53797. defaultValue: 0,
  53798. validate: x => x === 1
  53799. });
  53800. 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"]);
  53801. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  53802. this.use = attributes.use || "";
  53803. this.usehref = attributes.usehref || "";
  53804. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  53805. this.encrypt = null;
  53806. this.extras = null;
  53807. }
  53808. }
  53809. class Bind extends _xfa_object.XFAObject {
  53810. constructor(attributes) {
  53811. super(TEMPLATE_NS_ID, "bind", true);
  53812. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  53813. this.ref = attributes.ref || "";
  53814. this.picture = null;
  53815. }
  53816. }
  53817. class BindItems extends _xfa_object.XFAObject {
  53818. constructor(attributes) {
  53819. super(TEMPLATE_NS_ID, "bindItems");
  53820. this.connection = attributes.connection || "";
  53821. this.labelRef = attributes.labelRef || "";
  53822. this.ref = attributes.ref || "";
  53823. this.valueRef = attributes.valueRef || "";
  53824. }
  53825. }
  53826. exports.BindItems = BindItems;
  53827. class Bookend extends _xfa_object.XFAObject {
  53828. constructor(attributes) {
  53829. super(TEMPLATE_NS_ID, "bookend");
  53830. this.id = attributes.id || "";
  53831. this.leader = attributes.leader || "";
  53832. this.trailer = attributes.trailer || "";
  53833. this.use = attributes.use || "";
  53834. this.usehref = attributes.usehref || "";
  53835. }
  53836. }
  53837. class BooleanElement extends _xfa_object.Option01 {
  53838. constructor(attributes) {
  53839. super(TEMPLATE_NS_ID, "boolean");
  53840. this.id = attributes.id || "";
  53841. this.name = attributes.name || "";
  53842. this.use = attributes.use || "";
  53843. this.usehref = attributes.usehref || "";
  53844. }
  53845. [_xfa_object.$toHTML](availableSpace) {
  53846. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  53847. }
  53848. }
  53849. class Border extends _xfa_object.XFAObject {
  53850. constructor(attributes) {
  53851. super(TEMPLATE_NS_ID, "border", true);
  53852. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  53853. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53854. this.id = attributes.id || "";
  53855. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53856. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53857. this.use = attributes.use || "";
  53858. this.usehref = attributes.usehref || "";
  53859. this.corner = new _xfa_object.XFAObjectArray(4);
  53860. this.edge = new _xfa_object.XFAObjectArray(4);
  53861. this.extras = null;
  53862. this.fill = null;
  53863. this.margin = null;
  53864. }
  53865. [_xfa_object.$getExtra]() {
  53866. if (!this[_xfa_object.$extra]) {
  53867. const edges = this.edge.children.slice();
  53868. if (edges.length < 4) {
  53869. const defaultEdge = edges.at(-1) || new Edge({});
  53870. for (let i = edges.length; i < 4; i++) {
  53871. edges.push(defaultEdge);
  53872. }
  53873. }
  53874. const widths = edges.map(edge => edge.thickness);
  53875. const insets = [0, 0, 0, 0];
  53876. if (this.margin) {
  53877. insets[0] = this.margin.topInset;
  53878. insets[1] = this.margin.rightInset;
  53879. insets[2] = this.margin.bottomInset;
  53880. insets[3] = this.margin.leftInset;
  53881. }
  53882. this[_xfa_object.$extra] = {
  53883. widths,
  53884. insets,
  53885. edges
  53886. };
  53887. }
  53888. return this[_xfa_object.$extra];
  53889. }
  53890. [_xfa_object.$toStyle]() {
  53891. const {
  53892. edges
  53893. } = this[_xfa_object.$getExtra]();
  53894. const edgeStyles = edges.map(node => {
  53895. const style = node[_xfa_object.$toStyle]();
  53896. style.color = style.color || "#000000";
  53897. return style;
  53898. });
  53899. const style = Object.create(null);
  53900. if (this.margin) {
  53901. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  53902. }
  53903. if (this.fill && this.fill.presence === "visible") {
  53904. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  53905. }
  53906. if (this.corner.children.some(node => node.radius !== 0)) {
  53907. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  53908. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  53909. const last = cornerStyles.at(-1);
  53910. for (let i = cornerStyles.length; i < 4; i++) {
  53911. cornerStyles.push(last);
  53912. }
  53913. }
  53914. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  53915. }
  53916. switch (this.presence) {
  53917. case "invisible":
  53918. case "hidden":
  53919. style.borderStyle = "";
  53920. break;
  53921. case "inactive":
  53922. style.borderStyle = "none";
  53923. break;
  53924. default:
  53925. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  53926. break;
  53927. }
  53928. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  53929. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  53930. return style;
  53931. }
  53932. }
  53933. class Break extends _xfa_object.XFAObject {
  53934. constructor(attributes) {
  53935. super(TEMPLATE_NS_ID, "break", true);
  53936. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53937. this.afterTarget = attributes.afterTarget || "";
  53938. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53939. this.beforeTarget = attributes.beforeTarget || "";
  53940. this.bookendLeader = attributes.bookendLeader || "";
  53941. this.bookendTrailer = attributes.bookendTrailer || "";
  53942. this.id = attributes.id || "";
  53943. this.overflowLeader = attributes.overflowLeader || "";
  53944. this.overflowTarget = attributes.overflowTarget || "";
  53945. this.overflowTrailer = attributes.overflowTrailer || "";
  53946. this.startNew = (0, _utils.getInteger)({
  53947. data: attributes.startNew,
  53948. defaultValue: 0,
  53949. validate: x => x === 1
  53950. });
  53951. this.use = attributes.use || "";
  53952. this.usehref = attributes.usehref || "";
  53953. this.extras = null;
  53954. }
  53955. }
  53956. class BreakAfter extends _xfa_object.XFAObject {
  53957. constructor(attributes) {
  53958. super(TEMPLATE_NS_ID, "breakAfter", true);
  53959. this.id = attributes.id || "";
  53960. this.leader = attributes.leader || "";
  53961. this.startNew = (0, _utils.getInteger)({
  53962. data: attributes.startNew,
  53963. defaultValue: 0,
  53964. validate: x => x === 1
  53965. });
  53966. this.target = attributes.target || "";
  53967. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  53968. this.trailer = attributes.trailer || "";
  53969. this.use = attributes.use || "";
  53970. this.usehref = attributes.usehref || "";
  53971. this.script = null;
  53972. }
  53973. }
  53974. class BreakBefore extends _xfa_object.XFAObject {
  53975. constructor(attributes) {
  53976. super(TEMPLATE_NS_ID, "breakBefore", true);
  53977. this.id = attributes.id || "";
  53978. this.leader = attributes.leader || "";
  53979. this.startNew = (0, _utils.getInteger)({
  53980. data: attributes.startNew,
  53981. defaultValue: 0,
  53982. validate: x => x === 1
  53983. });
  53984. this.target = attributes.target || "";
  53985. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  53986. this.trailer = attributes.trailer || "";
  53987. this.use = attributes.use || "";
  53988. this.usehref = attributes.usehref || "";
  53989. this.script = null;
  53990. }
  53991. [_xfa_object.$toHTML](availableSpace) {
  53992. this[_xfa_object.$extra] = {};
  53993. return _utils.HTMLResult.FAILURE;
  53994. }
  53995. }
  53996. class Button extends _xfa_object.XFAObject {
  53997. constructor(attributes) {
  53998. super(TEMPLATE_NS_ID, "button", true);
  53999. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  54000. this.id = attributes.id || "";
  54001. this.use = attributes.use || "";
  54002. this.usehref = attributes.usehref || "";
  54003. this.extras = null;
  54004. }
  54005. [_xfa_object.$toHTML](availableSpace) {
  54006. const parent = this[_xfa_object.$getParent]();
  54007. const grandpa = parent[_xfa_object.$getParent]();
  54008. const htmlButton = {
  54009. name: "button",
  54010. attributes: {
  54011. id: this[_xfa_object.$uid],
  54012. class: ["xfaButton"],
  54013. style: {}
  54014. },
  54015. children: []
  54016. };
  54017. for (const event of grandpa.event.children) {
  54018. if (event.activity !== "click" || !event.script) {
  54019. continue;
  54020. }
  54021. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  54022. if (!jsURL) {
  54023. continue;
  54024. }
  54025. const href = (0, _html_utils.fixURL)(jsURL.url);
  54026. if (!href) {
  54027. continue;
  54028. }
  54029. htmlButton.children.push({
  54030. name: "a",
  54031. attributes: {
  54032. id: "link" + this[_xfa_object.$uid],
  54033. href,
  54034. newWindow: jsURL.newWindow,
  54035. class: ["xfaLink"],
  54036. style: {}
  54037. },
  54038. children: []
  54039. });
  54040. }
  54041. return _utils.HTMLResult.success(htmlButton);
  54042. }
  54043. }
  54044. class Calculate extends _xfa_object.XFAObject {
  54045. constructor(attributes) {
  54046. super(TEMPLATE_NS_ID, "calculate", true);
  54047. this.id = attributes.id || "";
  54048. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  54049. this.use = attributes.use || "";
  54050. this.usehref = attributes.usehref || "";
  54051. this.extras = null;
  54052. this.message = null;
  54053. this.script = null;
  54054. }
  54055. }
  54056. class Caption extends _xfa_object.XFAObject {
  54057. constructor(attributes) {
  54058. super(TEMPLATE_NS_ID, "caption", true);
  54059. this.id = attributes.id || "";
  54060. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  54061. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54062. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  54063. this.use = attributes.use || "";
  54064. this.usehref = attributes.usehref || "";
  54065. this.extras = null;
  54066. this.font = null;
  54067. this.margin = null;
  54068. this.para = null;
  54069. this.value = null;
  54070. }
  54071. [_xfa_object.$setValue](value) {
  54072. _setValue(this, value);
  54073. }
  54074. [_xfa_object.$getExtra](availableSpace) {
  54075. if (!this[_xfa_object.$extra]) {
  54076. let {
  54077. width,
  54078. height
  54079. } = availableSpace;
  54080. switch (this.placement) {
  54081. case "left":
  54082. case "right":
  54083. case "inline":
  54084. width = this.reserve <= 0 ? width : this.reserve;
  54085. break;
  54086. case "top":
  54087. case "bottom":
  54088. height = this.reserve <= 0 ? height : this.reserve;
  54089. break;
  54090. }
  54091. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  54092. width,
  54093. height
  54094. });
  54095. }
  54096. return this[_xfa_object.$extra];
  54097. }
  54098. [_xfa_object.$toHTML](availableSpace) {
  54099. if (!this.value) {
  54100. return _utils.HTMLResult.EMPTY;
  54101. }
  54102. this[_xfa_object.$pushPara]();
  54103. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  54104. if (!value) {
  54105. this[_xfa_object.$popPara]();
  54106. return _utils.HTMLResult.EMPTY;
  54107. }
  54108. const savedReserve = this.reserve;
  54109. if (this.reserve <= 0) {
  54110. const {
  54111. w,
  54112. h
  54113. } = this[_xfa_object.$getExtra](availableSpace);
  54114. switch (this.placement) {
  54115. case "left":
  54116. case "right":
  54117. case "inline":
  54118. this.reserve = w;
  54119. break;
  54120. case "top":
  54121. case "bottom":
  54122. this.reserve = h;
  54123. break;
  54124. }
  54125. }
  54126. const children = [];
  54127. if (typeof value === "string") {
  54128. children.push({
  54129. name: "#text",
  54130. value
  54131. });
  54132. } else {
  54133. children.push(value);
  54134. }
  54135. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  54136. switch (this.placement) {
  54137. case "left":
  54138. case "right":
  54139. if (this.reserve > 0) {
  54140. style.width = (0, _html_utils.measureToString)(this.reserve);
  54141. }
  54142. break;
  54143. case "top":
  54144. case "bottom":
  54145. if (this.reserve > 0) {
  54146. style.height = (0, _html_utils.measureToString)(this.reserve);
  54147. }
  54148. break;
  54149. }
  54150. (0, _html_utils.setPara)(this, null, value);
  54151. this[_xfa_object.$popPara]();
  54152. this.reserve = savedReserve;
  54153. return _utils.HTMLResult.success({
  54154. name: "div",
  54155. attributes: {
  54156. style,
  54157. class: ["xfaCaption"]
  54158. },
  54159. children
  54160. });
  54161. }
  54162. }
  54163. class Certificate extends _xfa_object.StringObject {
  54164. constructor(attributes) {
  54165. super(TEMPLATE_NS_ID, "certificate");
  54166. this.id = attributes.id || "";
  54167. this.name = attributes.name || "";
  54168. this.use = attributes.use || "";
  54169. this.usehref = attributes.usehref || "";
  54170. }
  54171. }
  54172. class Certificates extends _xfa_object.XFAObject {
  54173. constructor(attributes) {
  54174. super(TEMPLATE_NS_ID, "certificates", true);
  54175. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  54176. this.id = attributes.id || "";
  54177. this.url = attributes.url || "";
  54178. this.urlPolicy = attributes.urlPolicy || "";
  54179. this.use = attributes.use || "";
  54180. this.usehref = attributes.usehref || "";
  54181. this.encryption = null;
  54182. this.issuers = null;
  54183. this.keyUsage = null;
  54184. this.oids = null;
  54185. this.signing = null;
  54186. this.subjectDNs = null;
  54187. }
  54188. }
  54189. class CheckButton extends _xfa_object.XFAObject {
  54190. constructor(attributes) {
  54191. super(TEMPLATE_NS_ID, "checkButton", true);
  54192. this.id = attributes.id || "";
  54193. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  54194. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  54195. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54196. this.use = attributes.use || "";
  54197. this.usehref = attributes.usehref || "";
  54198. this.border = null;
  54199. this.extras = null;
  54200. this.margin = null;
  54201. }
  54202. [_xfa_object.$toHTML](availableSpace) {
  54203. const style = (0, _html_utils.toStyle)("margin");
  54204. const size = (0, _html_utils.measureToString)(this.size);
  54205. style.width = style.height = size;
  54206. let type;
  54207. let className;
  54208. let groupId;
  54209. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54210. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  54211. const exportedValue = {
  54212. on: (items[0] !== undefined ? items[0] : "on").toString(),
  54213. off: (items[1] !== undefined ? items[1] : "off").toString()
  54214. };
  54215. const value = field.value && field.value[_xfa_object.$text]() || "off";
  54216. const checked = value === exportedValue.on || undefined;
  54217. const container = field[_xfa_object.$getSubformParent]();
  54218. const fieldId = field[_xfa_object.$uid];
  54219. let dataId;
  54220. if (container instanceof ExclGroup) {
  54221. groupId = container[_xfa_object.$uid];
  54222. type = "radio";
  54223. className = "xfaRadio";
  54224. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  54225. } else {
  54226. type = "checkbox";
  54227. className = "xfaCheckbox";
  54228. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  54229. }
  54230. const input = {
  54231. name: "input",
  54232. attributes: {
  54233. class: [className],
  54234. style,
  54235. fieldId,
  54236. dataId,
  54237. type,
  54238. checked,
  54239. xfaOn: exportedValue.on,
  54240. xfaOff: exportedValue.off,
  54241. "aria-label": ariaLabel(field),
  54242. "aria-required": false
  54243. }
  54244. };
  54245. if (groupId) {
  54246. input.attributes.name = groupId;
  54247. }
  54248. if (isRequired(field)) {
  54249. input.attributes["aria-required"] = true;
  54250. input.attributes.required = true;
  54251. }
  54252. return _utils.HTMLResult.success({
  54253. name: "label",
  54254. attributes: {
  54255. class: ["xfaLabel"]
  54256. },
  54257. children: [input]
  54258. });
  54259. }
  54260. }
  54261. class ChoiceList extends _xfa_object.XFAObject {
  54262. constructor(attributes) {
  54263. super(TEMPLATE_NS_ID, "choiceList", true);
  54264. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  54265. this.id = attributes.id || "";
  54266. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  54267. this.textEntry = (0, _utils.getInteger)({
  54268. data: attributes.textEntry,
  54269. defaultValue: 0,
  54270. validate: x => x === 1
  54271. });
  54272. this.use = attributes.use || "";
  54273. this.usehref = attributes.usehref || "";
  54274. this.border = null;
  54275. this.extras = null;
  54276. this.margin = null;
  54277. }
  54278. [_xfa_object.$toHTML](availableSpace) {
  54279. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  54280. const ui = this[_xfa_object.$getParent]();
  54281. const field = ui[_xfa_object.$getParent]();
  54282. const fontSize = field.font && field.font.size || 10;
  54283. const optionStyle = {
  54284. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  54285. };
  54286. const children = [];
  54287. if (field.items.children.length > 0) {
  54288. const items = field.items;
  54289. let displayedIndex = 0;
  54290. let saveIndex = 0;
  54291. if (items.children.length === 2) {
  54292. displayedIndex = items.children[0].save;
  54293. saveIndex = 1 - displayedIndex;
  54294. }
  54295. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  54296. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  54297. let selected = false;
  54298. const value = field.value && field.value[_xfa_object.$text]() || "";
  54299. for (let i = 0, ii = displayed.length; i < ii; i++) {
  54300. const option = {
  54301. name: "option",
  54302. attributes: {
  54303. value: values[i] || displayed[i],
  54304. style: optionStyle
  54305. },
  54306. value: displayed[i]
  54307. };
  54308. if (values[i] === value) {
  54309. option.attributes.selected = selected = true;
  54310. }
  54311. children.push(option);
  54312. }
  54313. if (!selected) {
  54314. children.splice(0, 0, {
  54315. name: "option",
  54316. attributes: {
  54317. hidden: true,
  54318. selected: true
  54319. },
  54320. value: " "
  54321. });
  54322. }
  54323. }
  54324. const selectAttributes = {
  54325. class: ["xfaSelect"],
  54326. fieldId: field[_xfa_object.$uid],
  54327. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54328. style,
  54329. "aria-label": ariaLabel(field),
  54330. "aria-required": false
  54331. };
  54332. if (isRequired(field)) {
  54333. selectAttributes["aria-required"] = true;
  54334. selectAttributes.required = true;
  54335. }
  54336. if (this.open === "multiSelect") {
  54337. selectAttributes.multiple = true;
  54338. }
  54339. return _utils.HTMLResult.success({
  54340. name: "label",
  54341. attributes: {
  54342. class: ["xfaLabel"]
  54343. },
  54344. children: [{
  54345. name: "select",
  54346. children,
  54347. attributes: selectAttributes
  54348. }]
  54349. });
  54350. }
  54351. }
  54352. class Color extends _xfa_object.XFAObject {
  54353. constructor(attributes) {
  54354. super(TEMPLATE_NS_ID, "color", true);
  54355. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  54356. this.id = attributes.id || "";
  54357. this.use = attributes.use || "";
  54358. this.usehref = attributes.usehref || "";
  54359. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  54360. this.extras = null;
  54361. }
  54362. [_xfa_object.$hasSettableValue]() {
  54363. return false;
  54364. }
  54365. [_xfa_object.$toStyle]() {
  54366. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  54367. }
  54368. }
  54369. class Comb extends _xfa_object.XFAObject {
  54370. constructor(attributes) {
  54371. super(TEMPLATE_NS_ID, "comb");
  54372. this.id = attributes.id || "";
  54373. this.numberOfCells = (0, _utils.getInteger)({
  54374. data: attributes.numberOfCells,
  54375. defaultValue: 0,
  54376. validate: x => x >= 0
  54377. });
  54378. this.use = attributes.use || "";
  54379. this.usehref = attributes.usehref || "";
  54380. }
  54381. }
  54382. class Connect extends _xfa_object.XFAObject {
  54383. constructor(attributes) {
  54384. super(TEMPLATE_NS_ID, "connect", true);
  54385. this.connection = attributes.connection || "";
  54386. this.id = attributes.id || "";
  54387. this.ref = attributes.ref || "";
  54388. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  54389. this.use = attributes.use || "";
  54390. this.usehref = attributes.usehref || "";
  54391. this.picture = null;
  54392. }
  54393. }
  54394. class ContentArea extends _xfa_object.XFAObject {
  54395. constructor(attributes) {
  54396. super(TEMPLATE_NS_ID, "contentArea", true);
  54397. this.h = (0, _utils.getMeasurement)(attributes.h);
  54398. this.id = attributes.id || "";
  54399. this.name = attributes.name || "";
  54400. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54401. this.use = attributes.use || "";
  54402. this.usehref = attributes.usehref || "";
  54403. this.w = (0, _utils.getMeasurement)(attributes.w);
  54404. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54405. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54406. this.desc = null;
  54407. this.extras = null;
  54408. }
  54409. [_xfa_object.$toHTML](availableSpace) {
  54410. const left = (0, _html_utils.measureToString)(this.x);
  54411. const top = (0, _html_utils.measureToString)(this.y);
  54412. const style = {
  54413. left,
  54414. top,
  54415. width: (0, _html_utils.measureToString)(this.w),
  54416. height: (0, _html_utils.measureToString)(this.h)
  54417. };
  54418. const classNames = ["xfaContentarea"];
  54419. if ((0, _html_utils.isPrintOnly)(this)) {
  54420. classNames.push("xfaPrintOnly");
  54421. }
  54422. return _utils.HTMLResult.success({
  54423. name: "div",
  54424. children: [],
  54425. attributes: {
  54426. style,
  54427. class: classNames,
  54428. id: this[_xfa_object.$uid]
  54429. }
  54430. });
  54431. }
  54432. }
  54433. class Corner extends _xfa_object.XFAObject {
  54434. constructor(attributes) {
  54435. super(TEMPLATE_NS_ID, "corner", true);
  54436. this.id = attributes.id || "";
  54437. this.inverted = (0, _utils.getInteger)({
  54438. data: attributes.inverted,
  54439. defaultValue: 0,
  54440. validate: x => x === 1
  54441. });
  54442. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  54443. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54444. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  54445. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54446. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54447. this.use = attributes.use || "";
  54448. this.usehref = attributes.usehref || "";
  54449. this.color = null;
  54450. this.extras = null;
  54451. }
  54452. [_xfa_object.$toStyle]() {
  54453. const style = (0, _html_utils.toStyle)(this, "visibility");
  54454. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  54455. return style;
  54456. }
  54457. }
  54458. class DateElement extends _xfa_object.ContentObject {
  54459. constructor(attributes) {
  54460. super(TEMPLATE_NS_ID, "date");
  54461. this.id = attributes.id || "";
  54462. this.name = attributes.name || "";
  54463. this.use = attributes.use || "";
  54464. this.usehref = attributes.usehref || "";
  54465. }
  54466. [_xfa_object.$finalize]() {
  54467. const date = this[_xfa_object.$content].trim();
  54468. this[_xfa_object.$content] = date ? new Date(date) : null;
  54469. }
  54470. [_xfa_object.$toHTML](availableSpace) {
  54471. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54472. }
  54473. }
  54474. class DateTime extends _xfa_object.ContentObject {
  54475. constructor(attributes) {
  54476. super(TEMPLATE_NS_ID, "dateTime");
  54477. this.id = attributes.id || "";
  54478. this.name = attributes.name || "";
  54479. this.use = attributes.use || "";
  54480. this.usehref = attributes.usehref || "";
  54481. }
  54482. [_xfa_object.$finalize]() {
  54483. const date = this[_xfa_object.$content].trim();
  54484. this[_xfa_object.$content] = date ? new Date(date) : null;
  54485. }
  54486. [_xfa_object.$toHTML](availableSpace) {
  54487. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  54488. }
  54489. }
  54490. class DateTimeEdit extends _xfa_object.XFAObject {
  54491. constructor(attributes) {
  54492. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  54493. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54494. this.id = attributes.id || "";
  54495. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  54496. this.use = attributes.use || "";
  54497. this.usehref = attributes.usehref || "";
  54498. this.border = null;
  54499. this.comb = null;
  54500. this.extras = null;
  54501. this.margin = null;
  54502. }
  54503. [_xfa_object.$toHTML](availableSpace) {
  54504. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54505. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54506. const html = {
  54507. name: "input",
  54508. attributes: {
  54509. type: "text",
  54510. fieldId: field[_xfa_object.$uid],
  54511. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54512. class: ["xfaTextfield"],
  54513. style,
  54514. "aria-label": ariaLabel(field),
  54515. "aria-required": false
  54516. }
  54517. };
  54518. if (isRequired(field)) {
  54519. html.attributes["aria-required"] = true;
  54520. html.attributes.required = true;
  54521. }
  54522. return _utils.HTMLResult.success({
  54523. name: "label",
  54524. attributes: {
  54525. class: ["xfaLabel"]
  54526. },
  54527. children: [html]
  54528. });
  54529. }
  54530. }
  54531. class Decimal extends _xfa_object.ContentObject {
  54532. constructor(attributes) {
  54533. super(TEMPLATE_NS_ID, "decimal");
  54534. this.fracDigits = (0, _utils.getInteger)({
  54535. data: attributes.fracDigits,
  54536. defaultValue: 2,
  54537. validate: x => true
  54538. });
  54539. this.id = attributes.id || "";
  54540. this.leadDigits = (0, _utils.getInteger)({
  54541. data: attributes.leadDigits,
  54542. defaultValue: -1,
  54543. validate: x => true
  54544. });
  54545. this.name = attributes.name || "";
  54546. this.use = attributes.use || "";
  54547. this.usehref = attributes.usehref || "";
  54548. }
  54549. [_xfa_object.$finalize]() {
  54550. const number = parseFloat(this[_xfa_object.$content].trim());
  54551. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54552. }
  54553. [_xfa_object.$toHTML](availableSpace) {
  54554. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54555. }
  54556. }
  54557. class DefaultUi extends _xfa_object.XFAObject {
  54558. constructor(attributes) {
  54559. super(TEMPLATE_NS_ID, "defaultUi", true);
  54560. this.id = attributes.id || "";
  54561. this.use = attributes.use || "";
  54562. this.usehref = attributes.usehref || "";
  54563. this.extras = null;
  54564. }
  54565. }
  54566. class Desc extends _xfa_object.XFAObject {
  54567. constructor(attributes) {
  54568. super(TEMPLATE_NS_ID, "desc", true);
  54569. this.id = attributes.id || "";
  54570. this.use = attributes.use || "";
  54571. this.usehref = attributes.usehref || "";
  54572. this.boolean = new _xfa_object.XFAObjectArray();
  54573. this.date = new _xfa_object.XFAObjectArray();
  54574. this.dateTime = new _xfa_object.XFAObjectArray();
  54575. this.decimal = new _xfa_object.XFAObjectArray();
  54576. this.exData = new _xfa_object.XFAObjectArray();
  54577. this.float = new _xfa_object.XFAObjectArray();
  54578. this.image = new _xfa_object.XFAObjectArray();
  54579. this.integer = new _xfa_object.XFAObjectArray();
  54580. this.text = new _xfa_object.XFAObjectArray();
  54581. this.time = new _xfa_object.XFAObjectArray();
  54582. }
  54583. }
  54584. class DigestMethod extends _xfa_object.OptionObject {
  54585. constructor(attributes) {
  54586. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  54587. this.id = attributes.id || "";
  54588. this.use = attributes.use || "";
  54589. this.usehref = attributes.usehref || "";
  54590. }
  54591. }
  54592. class DigestMethods extends _xfa_object.XFAObject {
  54593. constructor(attributes) {
  54594. super(TEMPLATE_NS_ID, "digestMethods", true);
  54595. this.id = attributes.id || "";
  54596. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54597. this.use = attributes.use || "";
  54598. this.usehref = attributes.usehref || "";
  54599. this.digestMethod = new _xfa_object.XFAObjectArray();
  54600. }
  54601. }
  54602. class Draw extends _xfa_object.XFAObject {
  54603. constructor(attributes) {
  54604. super(TEMPLATE_NS_ID, "draw", true);
  54605. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54606. this.colSpan = (0, _utils.getInteger)({
  54607. data: attributes.colSpan,
  54608. defaultValue: 1,
  54609. validate: n => n >= 1 || n === -1
  54610. });
  54611. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54612. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54613. this.id = attributes.id || "";
  54614. this.locale = attributes.locale || "";
  54615. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54616. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54617. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54618. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54619. this.name = attributes.name || "";
  54620. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54621. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54622. this.rotate = (0, _utils.getInteger)({
  54623. data: attributes.rotate,
  54624. defaultValue: 0,
  54625. validate: x => x % 90 === 0
  54626. });
  54627. this.use = attributes.use || "";
  54628. this.usehref = attributes.usehref || "";
  54629. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54630. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54631. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54632. this.assist = null;
  54633. this.border = null;
  54634. this.caption = null;
  54635. this.desc = null;
  54636. this.extras = null;
  54637. this.font = null;
  54638. this.keep = null;
  54639. this.margin = null;
  54640. this.para = null;
  54641. this.traversal = null;
  54642. this.ui = null;
  54643. this.value = null;
  54644. this.setProperty = new _xfa_object.XFAObjectArray();
  54645. }
  54646. [_xfa_object.$setValue](value) {
  54647. _setValue(this, value);
  54648. }
  54649. [_xfa_object.$toHTML](availableSpace) {
  54650. setTabIndex(this);
  54651. if (this.presence === "hidden" || this.presence === "inactive") {
  54652. return _utils.HTMLResult.EMPTY;
  54653. }
  54654. (0, _html_utils.fixDimensions)(this);
  54655. this[_xfa_object.$pushPara]();
  54656. const savedW = this.w;
  54657. const savedH = this.h;
  54658. const {
  54659. w,
  54660. h,
  54661. isBroken
  54662. } = (0, _html_utils.layoutNode)(this, availableSpace);
  54663. if (w && this.w === "") {
  54664. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  54665. this[_xfa_object.$popPara]();
  54666. return _utils.HTMLResult.FAILURE;
  54667. }
  54668. this.w = w;
  54669. }
  54670. if (h && this.h === "") {
  54671. this.h = h;
  54672. }
  54673. setFirstUnsplittable(this);
  54674. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54675. this.w = savedW;
  54676. this.h = savedH;
  54677. this[_xfa_object.$popPara]();
  54678. return _utils.HTMLResult.FAILURE;
  54679. }
  54680. unsetFirstUnsplittable(this);
  54681. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  54682. (0, _html_utils.setMinMaxDimensions)(this, style);
  54683. if (style.margin) {
  54684. style.padding = style.margin;
  54685. delete style.margin;
  54686. }
  54687. const classNames = ["xfaDraw"];
  54688. if (this.font) {
  54689. classNames.push("xfaFont");
  54690. }
  54691. if ((0, _html_utils.isPrintOnly)(this)) {
  54692. classNames.push("xfaPrintOnly");
  54693. }
  54694. const attributes = {
  54695. style,
  54696. id: this[_xfa_object.$uid],
  54697. class: classNames
  54698. };
  54699. if (this.name) {
  54700. attributes.xfaName = this.name;
  54701. }
  54702. const html = {
  54703. name: "div",
  54704. attributes,
  54705. children: []
  54706. };
  54707. applyAssist(this, attributes);
  54708. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  54709. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  54710. if (value === null) {
  54711. this.w = savedW;
  54712. this.h = savedH;
  54713. this[_xfa_object.$popPara]();
  54714. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54715. }
  54716. html.children.push(value);
  54717. (0, _html_utils.setPara)(this, style, value);
  54718. this.w = savedW;
  54719. this.h = savedH;
  54720. this[_xfa_object.$popPara]();
  54721. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54722. }
  54723. }
  54724. class Edge extends _xfa_object.XFAObject {
  54725. constructor(attributes) {
  54726. super(TEMPLATE_NS_ID, "edge", true);
  54727. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  54728. this.id = attributes.id || "";
  54729. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54730. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  54731. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  54732. this.use = attributes.use || "";
  54733. this.usehref = attributes.usehref || "";
  54734. this.color = null;
  54735. this.extras = null;
  54736. }
  54737. [_xfa_object.$toStyle]() {
  54738. const style = (0, _html_utils.toStyle)(this, "visibility");
  54739. Object.assign(style, {
  54740. linecap: this.cap,
  54741. width: (0, _html_utils.measureToString)(this.thickness),
  54742. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  54743. style: ""
  54744. });
  54745. if (this.presence !== "visible") {
  54746. style.style = "none";
  54747. } else {
  54748. switch (this.stroke) {
  54749. case "solid":
  54750. style.style = "solid";
  54751. break;
  54752. case "dashDot":
  54753. style.style = "dashed";
  54754. break;
  54755. case "dashDotDot":
  54756. style.style = "dashed";
  54757. break;
  54758. case "dashed":
  54759. style.style = "dashed";
  54760. break;
  54761. case "dotted":
  54762. style.style = "dotted";
  54763. break;
  54764. case "embossed":
  54765. style.style = "ridge";
  54766. break;
  54767. case "etched":
  54768. style.style = "groove";
  54769. break;
  54770. case "lowered":
  54771. style.style = "inset";
  54772. break;
  54773. case "raised":
  54774. style.style = "outset";
  54775. break;
  54776. }
  54777. }
  54778. return style;
  54779. }
  54780. }
  54781. class Encoding extends _xfa_object.OptionObject {
  54782. constructor(attributes) {
  54783. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  54784. this.id = attributes.id || "";
  54785. this.use = attributes.use || "";
  54786. this.usehref = attributes.usehref || "";
  54787. }
  54788. }
  54789. class Encodings extends _xfa_object.XFAObject {
  54790. constructor(attributes) {
  54791. super(TEMPLATE_NS_ID, "encodings", true);
  54792. this.id = attributes.id || "";
  54793. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54794. this.use = attributes.use || "";
  54795. this.usehref = attributes.usehref || "";
  54796. this.encoding = new _xfa_object.XFAObjectArray();
  54797. }
  54798. }
  54799. class Encrypt extends _xfa_object.XFAObject {
  54800. constructor(attributes) {
  54801. super(TEMPLATE_NS_ID, "encrypt", true);
  54802. this.id = attributes.id || "";
  54803. this.use = attributes.use || "";
  54804. this.usehref = attributes.usehref || "";
  54805. this.certificate = null;
  54806. }
  54807. }
  54808. class EncryptData extends _xfa_object.XFAObject {
  54809. constructor(attributes) {
  54810. super(TEMPLATE_NS_ID, "encryptData", true);
  54811. this.id = attributes.id || "";
  54812. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  54813. this.target = attributes.target || "";
  54814. this.use = attributes.use || "";
  54815. this.usehref = attributes.usehref || "";
  54816. this.filter = null;
  54817. this.manifest = null;
  54818. }
  54819. }
  54820. class Encryption extends _xfa_object.XFAObject {
  54821. constructor(attributes) {
  54822. super(TEMPLATE_NS_ID, "encryption", true);
  54823. this.id = attributes.id || "";
  54824. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54825. this.use = attributes.use || "";
  54826. this.usehref = attributes.usehref || "";
  54827. this.certificate = new _xfa_object.XFAObjectArray();
  54828. }
  54829. }
  54830. class EncryptionMethod extends _xfa_object.OptionObject {
  54831. constructor(attributes) {
  54832. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  54833. this.id = attributes.id || "";
  54834. this.use = attributes.use || "";
  54835. this.usehref = attributes.usehref || "";
  54836. }
  54837. }
  54838. class EncryptionMethods extends _xfa_object.XFAObject {
  54839. constructor(attributes) {
  54840. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  54841. this.id = attributes.id || "";
  54842. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54843. this.use = attributes.use || "";
  54844. this.usehref = attributes.usehref || "";
  54845. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  54846. }
  54847. }
  54848. class Event extends _xfa_object.XFAObject {
  54849. constructor(attributes) {
  54850. super(TEMPLATE_NS_ID, "event", true);
  54851. 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"]);
  54852. this.id = attributes.id || "";
  54853. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  54854. this.name = attributes.name || "";
  54855. this.ref = attributes.ref || "";
  54856. this.use = attributes.use || "";
  54857. this.usehref = attributes.usehref || "";
  54858. this.extras = null;
  54859. this.encryptData = null;
  54860. this.execute = null;
  54861. this.script = null;
  54862. this.signData = null;
  54863. this.submit = null;
  54864. }
  54865. }
  54866. class ExData extends _xfa_object.ContentObject {
  54867. constructor(attributes) {
  54868. super(TEMPLATE_NS_ID, "exData");
  54869. this.contentType = attributes.contentType || "";
  54870. this.href = attributes.href || "";
  54871. this.id = attributes.id || "";
  54872. this.maxLength = (0, _utils.getInteger)({
  54873. data: attributes.maxLength,
  54874. defaultValue: -1,
  54875. validate: x => x >= -1
  54876. });
  54877. this.name = attributes.name || "";
  54878. this.rid = attributes.rid || "";
  54879. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  54880. this.use = attributes.use || "";
  54881. this.usehref = attributes.usehref || "";
  54882. }
  54883. [_xfa_object.$isCDATAXml]() {
  54884. return this.contentType === "text/html";
  54885. }
  54886. [_xfa_object.$onChild](child) {
  54887. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  54888. this[_xfa_object.$content] = child;
  54889. return true;
  54890. }
  54891. if (this.contentType === "text/xml") {
  54892. this[_xfa_object.$content] = child;
  54893. return true;
  54894. }
  54895. return false;
  54896. }
  54897. [_xfa_object.$toHTML](availableSpace) {
  54898. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  54899. return _utils.HTMLResult.EMPTY;
  54900. }
  54901. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  54902. }
  54903. }
  54904. class ExObject extends _xfa_object.XFAObject {
  54905. constructor(attributes) {
  54906. super(TEMPLATE_NS_ID, "exObject", true);
  54907. this.archive = attributes.archive || "";
  54908. this.classId = attributes.classId || "";
  54909. this.codeBase = attributes.codeBase || "";
  54910. this.codeType = attributes.codeType || "";
  54911. this.id = attributes.id || "";
  54912. this.name = attributes.name || "";
  54913. this.use = attributes.use || "";
  54914. this.usehref = attributes.usehref || "";
  54915. this.extras = null;
  54916. this.boolean = new _xfa_object.XFAObjectArray();
  54917. this.date = new _xfa_object.XFAObjectArray();
  54918. this.dateTime = new _xfa_object.XFAObjectArray();
  54919. this.decimal = new _xfa_object.XFAObjectArray();
  54920. this.exData = new _xfa_object.XFAObjectArray();
  54921. this.exObject = new _xfa_object.XFAObjectArray();
  54922. this.float = new _xfa_object.XFAObjectArray();
  54923. this.image = new _xfa_object.XFAObjectArray();
  54924. this.integer = new _xfa_object.XFAObjectArray();
  54925. this.text = new _xfa_object.XFAObjectArray();
  54926. this.time = new _xfa_object.XFAObjectArray();
  54927. }
  54928. }
  54929. class ExclGroup extends _xfa_object.XFAObject {
  54930. constructor(attributes) {
  54931. super(TEMPLATE_NS_ID, "exclGroup", true);
  54932. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  54933. this.accessKey = attributes.accessKey || "";
  54934. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54935. this.colSpan = (0, _utils.getInteger)({
  54936. data: attributes.colSpan,
  54937. defaultValue: 1,
  54938. validate: n => n >= 1 || n === -1
  54939. });
  54940. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54941. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54942. this.id = attributes.id || "";
  54943. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  54944. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54945. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54946. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54947. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54948. this.name = attributes.name || "";
  54949. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54950. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54951. this.use = attributes.use || "";
  54952. this.usehref = attributes.usehref || "";
  54953. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54954. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54955. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54956. this.assist = null;
  54957. this.bind = null;
  54958. this.border = null;
  54959. this.calculate = null;
  54960. this.caption = null;
  54961. this.desc = null;
  54962. this.extras = null;
  54963. this.margin = null;
  54964. this.para = null;
  54965. this.traversal = null;
  54966. this.validate = null;
  54967. this.connect = new _xfa_object.XFAObjectArray();
  54968. this.event = new _xfa_object.XFAObjectArray();
  54969. this.field = new _xfa_object.XFAObjectArray();
  54970. this.setProperty = new _xfa_object.XFAObjectArray();
  54971. }
  54972. [_xfa_object.$isBindable]() {
  54973. return true;
  54974. }
  54975. [_xfa_object.$hasSettableValue]() {
  54976. return true;
  54977. }
  54978. [_xfa_object.$setValue](value) {
  54979. for (const field of this.field.children) {
  54980. if (!field.value) {
  54981. const nodeValue = new Value({});
  54982. field[_xfa_object.$appendChild](nodeValue);
  54983. field.value = nodeValue;
  54984. }
  54985. field.value[_xfa_object.$setValue](value);
  54986. }
  54987. }
  54988. [_xfa_object.$isThereMoreWidth]() {
  54989. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  54990. }
  54991. [_xfa_object.$isSplittable]() {
  54992. const parent = this[_xfa_object.$getSubformParent]();
  54993. if (!parent[_xfa_object.$isSplittable]()) {
  54994. return false;
  54995. }
  54996. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  54997. return this[_xfa_object.$extra]._isSplittable;
  54998. }
  54999. if (this.layout === "position" || this.layout.includes("row")) {
  55000. this[_xfa_object.$extra]._isSplittable = false;
  55001. return false;
  55002. }
  55003. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  55004. return false;
  55005. }
  55006. this[_xfa_object.$extra]._isSplittable = true;
  55007. return true;
  55008. }
  55009. [_xfa_object.$flushHTML]() {
  55010. return (0, _layout.flushHTML)(this);
  55011. }
  55012. [_xfa_object.$addHTML](html, bbox) {
  55013. (0, _layout.addHTML)(this, html, bbox);
  55014. }
  55015. [_xfa_object.$getAvailableSpace]() {
  55016. return (0, _layout.getAvailableSpace)(this);
  55017. }
  55018. [_xfa_object.$toHTML](availableSpace) {
  55019. setTabIndex(this);
  55020. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55021. return _utils.HTMLResult.EMPTY;
  55022. }
  55023. (0, _html_utils.fixDimensions)(this);
  55024. const children = [];
  55025. const attributes = {
  55026. id: this[_xfa_object.$uid],
  55027. class: []
  55028. };
  55029. (0, _html_utils.setAccess)(this, attributes.class);
  55030. if (!this[_xfa_object.$extra]) {
  55031. this[_xfa_object.$extra] = Object.create(null);
  55032. }
  55033. Object.assign(this[_xfa_object.$extra], {
  55034. children,
  55035. attributes,
  55036. attempt: 0,
  55037. line: null,
  55038. numberInLine: 0,
  55039. availableSpace: {
  55040. width: Math.min(this.w || Infinity, availableSpace.width),
  55041. height: Math.min(this.h || Infinity, availableSpace.height)
  55042. },
  55043. width: 0,
  55044. height: 0,
  55045. prevHeight: 0,
  55046. currentWidth: 0
  55047. });
  55048. const isSplittable = this[_xfa_object.$isSplittable]();
  55049. if (!isSplittable) {
  55050. setFirstUnsplittable(this);
  55051. }
  55052. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55053. return _utils.HTMLResult.FAILURE;
  55054. }
  55055. const filter = new Set(["field"]);
  55056. if (this.layout.includes("row")) {
  55057. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  55058. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  55059. this[_xfa_object.$extra].columnWidths = columnWidths;
  55060. this[_xfa_object.$extra].currentColumn = 0;
  55061. }
  55062. }
  55063. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  55064. const classNames = ["xfaExclgroup"];
  55065. const cl = (0, _html_utils.layoutClass)(this);
  55066. if (cl) {
  55067. classNames.push(cl);
  55068. }
  55069. if ((0, _html_utils.isPrintOnly)(this)) {
  55070. classNames.push("xfaPrintOnly");
  55071. }
  55072. attributes.style = style;
  55073. attributes.class = classNames;
  55074. if (this.name) {
  55075. attributes.xfaName = this.name;
  55076. }
  55077. this[_xfa_object.$pushPara]();
  55078. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55079. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55080. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55081. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55082. this[_xfa_object.$extra].numberInLine = 0;
  55083. }
  55084. const result = this[_xfa_object.$childrenToHTML]({
  55085. filter,
  55086. include: true
  55087. });
  55088. if (result.success) {
  55089. break;
  55090. }
  55091. if (result.isBreak()) {
  55092. this[_xfa_object.$popPara]();
  55093. return result;
  55094. }
  55095. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  55096. this[_xfa_object.$extra].attempt = maxRun;
  55097. break;
  55098. }
  55099. }
  55100. this[_xfa_object.$popPara]();
  55101. if (!isSplittable) {
  55102. unsetFirstUnsplittable(this);
  55103. }
  55104. if (this[_xfa_object.$extra].attempt === maxRun) {
  55105. if (!isSplittable) {
  55106. delete this[_xfa_object.$extra];
  55107. }
  55108. return _utils.HTMLResult.FAILURE;
  55109. }
  55110. let marginH = 0;
  55111. let marginV = 0;
  55112. if (this.margin) {
  55113. marginH = this.margin.leftInset + this.margin.rightInset;
  55114. marginV = this.margin.topInset + this.margin.bottomInset;
  55115. }
  55116. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55117. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55118. const bbox = [this.x, this.y, width, height];
  55119. if (this.w === "") {
  55120. style.width = (0, _html_utils.measureToString)(width);
  55121. }
  55122. if (this.h === "") {
  55123. style.height = (0, _html_utils.measureToString)(height);
  55124. }
  55125. const html = {
  55126. name: "div",
  55127. attributes,
  55128. children
  55129. };
  55130. applyAssist(this, attributes);
  55131. delete this[_xfa_object.$extra];
  55132. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55133. }
  55134. }
  55135. class Execute extends _xfa_object.XFAObject {
  55136. constructor(attributes) {
  55137. super(TEMPLATE_NS_ID, "execute");
  55138. this.connection = attributes.connection || "";
  55139. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  55140. this.id = attributes.id || "";
  55141. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55142. this.use = attributes.use || "";
  55143. this.usehref = attributes.usehref || "";
  55144. }
  55145. }
  55146. class Extras extends _xfa_object.XFAObject {
  55147. constructor(attributes) {
  55148. super(TEMPLATE_NS_ID, "extras", true);
  55149. this.id = attributes.id || "";
  55150. this.name = attributes.name || "";
  55151. this.use = attributes.use || "";
  55152. this.usehref = attributes.usehref || "";
  55153. this.boolean = new _xfa_object.XFAObjectArray();
  55154. this.date = new _xfa_object.XFAObjectArray();
  55155. this.dateTime = new _xfa_object.XFAObjectArray();
  55156. this.decimal = new _xfa_object.XFAObjectArray();
  55157. this.exData = new _xfa_object.XFAObjectArray();
  55158. this.extras = new _xfa_object.XFAObjectArray();
  55159. this.float = new _xfa_object.XFAObjectArray();
  55160. this.image = new _xfa_object.XFAObjectArray();
  55161. this.integer = new _xfa_object.XFAObjectArray();
  55162. this.text = new _xfa_object.XFAObjectArray();
  55163. this.time = new _xfa_object.XFAObjectArray();
  55164. }
  55165. }
  55166. class Field extends _xfa_object.XFAObject {
  55167. constructor(attributes) {
  55168. super(TEMPLATE_NS_ID, "field", true);
  55169. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55170. this.accessKey = attributes.accessKey || "";
  55171. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55172. this.colSpan = (0, _utils.getInteger)({
  55173. data: attributes.colSpan,
  55174. defaultValue: 1,
  55175. validate: n => n >= 1 || n === -1
  55176. });
  55177. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55178. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55179. this.id = attributes.id || "";
  55180. this.locale = attributes.locale || "";
  55181. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55182. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55183. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55184. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55185. this.name = attributes.name || "";
  55186. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55187. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55188. this.rotate = (0, _utils.getInteger)({
  55189. data: attributes.rotate,
  55190. defaultValue: 0,
  55191. validate: x => x % 90 === 0
  55192. });
  55193. this.use = attributes.use || "";
  55194. this.usehref = attributes.usehref || "";
  55195. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55196. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55197. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55198. this.assist = null;
  55199. this.bind = null;
  55200. this.border = null;
  55201. this.calculate = null;
  55202. this.caption = null;
  55203. this.desc = null;
  55204. this.extras = null;
  55205. this.font = null;
  55206. this.format = null;
  55207. this.items = new _xfa_object.XFAObjectArray(2);
  55208. this.keep = null;
  55209. this.margin = null;
  55210. this.para = null;
  55211. this.traversal = null;
  55212. this.ui = null;
  55213. this.validate = null;
  55214. this.value = null;
  55215. this.bindItems = new _xfa_object.XFAObjectArray();
  55216. this.connect = new _xfa_object.XFAObjectArray();
  55217. this.event = new _xfa_object.XFAObjectArray();
  55218. this.setProperty = new _xfa_object.XFAObjectArray();
  55219. }
  55220. [_xfa_object.$isBindable]() {
  55221. return true;
  55222. }
  55223. [_xfa_object.$setValue](value) {
  55224. _setValue(this, value);
  55225. }
  55226. [_xfa_object.$toHTML](availableSpace) {
  55227. setTabIndex(this);
  55228. if (!this.ui) {
  55229. this.ui = new Ui({});
  55230. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55231. this[_xfa_object.$appendChild](this.ui);
  55232. let node;
  55233. switch (this.items.children.length) {
  55234. case 0:
  55235. node = new TextEdit({});
  55236. this.ui.textEdit = node;
  55237. break;
  55238. case 1:
  55239. node = new CheckButton({});
  55240. this.ui.checkButton = node;
  55241. break;
  55242. case 2:
  55243. node = new ChoiceList({});
  55244. this.ui.choiceList = node;
  55245. break;
  55246. }
  55247. this.ui[_xfa_object.$appendChild](node);
  55248. }
  55249. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  55250. return _utils.HTMLResult.EMPTY;
  55251. }
  55252. if (this.caption) {
  55253. delete this.caption[_xfa_object.$extra];
  55254. }
  55255. this[_xfa_object.$pushPara]();
  55256. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  55257. const savedW = this.w;
  55258. const savedH = this.h;
  55259. let marginH = 0;
  55260. let marginV = 0;
  55261. if (this.margin) {
  55262. marginH = this.margin.leftInset + this.margin.rightInset;
  55263. marginV = this.margin.topInset + this.margin.bottomInset;
  55264. }
  55265. let borderDims = null;
  55266. if (this.w === "" || this.h === "") {
  55267. let width = null;
  55268. let height = null;
  55269. let uiW = 0;
  55270. let uiH = 0;
  55271. if (this.ui.checkButton) {
  55272. uiW = uiH = this.ui.checkButton.size;
  55273. } else {
  55274. const {
  55275. w,
  55276. h
  55277. } = (0, _html_utils.layoutNode)(this, availableSpace);
  55278. if (w !== null) {
  55279. uiW = w;
  55280. uiH = h;
  55281. } else {
  55282. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  55283. }
  55284. }
  55285. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  55286. uiW += borderDims.w;
  55287. uiH += borderDims.h;
  55288. if (this.caption) {
  55289. const {
  55290. w,
  55291. h,
  55292. isBroken
  55293. } = this.caption[_xfa_object.$getExtra](availableSpace);
  55294. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  55295. this[_xfa_object.$popPara]();
  55296. return _utils.HTMLResult.FAILURE;
  55297. }
  55298. width = w;
  55299. height = h;
  55300. switch (this.caption.placement) {
  55301. case "left":
  55302. case "right":
  55303. case "inline":
  55304. width += uiW;
  55305. break;
  55306. case "top":
  55307. case "bottom":
  55308. height += uiH;
  55309. break;
  55310. }
  55311. } else {
  55312. width = uiW;
  55313. height = uiH;
  55314. }
  55315. if (width && this.w === "") {
  55316. width += marginH;
  55317. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  55318. }
  55319. if (height && this.h === "") {
  55320. height += marginV;
  55321. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  55322. }
  55323. }
  55324. this[_xfa_object.$popPara]();
  55325. (0, _html_utils.fixDimensions)(this);
  55326. setFirstUnsplittable(this);
  55327. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55328. this.w = savedW;
  55329. this.h = savedH;
  55330. this[_xfa_object.$popPara]();
  55331. return _utils.HTMLResult.FAILURE;
  55332. }
  55333. unsetFirstUnsplittable(this);
  55334. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  55335. (0, _html_utils.setMinMaxDimensions)(this, style);
  55336. const classNames = ["xfaField"];
  55337. if (this.font) {
  55338. classNames.push("xfaFont");
  55339. }
  55340. if ((0, _html_utils.isPrintOnly)(this)) {
  55341. classNames.push("xfaPrintOnly");
  55342. }
  55343. const attributes = {
  55344. style,
  55345. id: this[_xfa_object.$uid],
  55346. class: classNames
  55347. };
  55348. if (style.margin) {
  55349. style.padding = style.margin;
  55350. delete style.margin;
  55351. }
  55352. (0, _html_utils.setAccess)(this, classNames);
  55353. if (this.name) {
  55354. attributes.xfaName = this.name;
  55355. }
  55356. const children = [];
  55357. const html = {
  55358. name: "div",
  55359. attributes,
  55360. children
  55361. };
  55362. applyAssist(this, attributes);
  55363. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  55364. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  55365. const ui = this.ui[_xfa_object.$toHTML]().html;
  55366. if (!ui) {
  55367. Object.assign(style, borderStyle);
  55368. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55369. }
  55370. if (this[_xfa_object.$tabIndex]) {
  55371. if (ui.children && ui.children[0]) {
  55372. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  55373. } else {
  55374. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  55375. }
  55376. }
  55377. if (!ui.attributes.style) {
  55378. ui.attributes.style = Object.create(null);
  55379. }
  55380. let aElement = null;
  55381. if (this.ui.button) {
  55382. if (ui.children.length === 1) {
  55383. [aElement] = ui.children.splice(0, 1);
  55384. }
  55385. Object.assign(ui.attributes.style, borderStyle);
  55386. } else {
  55387. Object.assign(style, borderStyle);
  55388. }
  55389. children.push(ui);
  55390. if (this.value) {
  55391. if (this.ui.imageEdit) {
  55392. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  55393. } else if (!this.ui.button) {
  55394. let value = "";
  55395. if (this.value.exData) {
  55396. value = this.value.exData[_xfa_object.$text]();
  55397. } else if (this.value.text) {
  55398. value = this.value.text[_xfa_object.$getExtra]();
  55399. } else {
  55400. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  55401. if (htmlValue !== null) {
  55402. value = htmlValue.children[0].value;
  55403. }
  55404. }
  55405. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  55406. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  55407. }
  55408. if (value) {
  55409. if (this.ui.numericEdit) {
  55410. value = parseFloat(value);
  55411. value = isNaN(value) ? "" : value.toString();
  55412. }
  55413. if (ui.children[0].name === "textarea") {
  55414. ui.children[0].attributes.textContent = value;
  55415. } else {
  55416. ui.children[0].attributes.value = value;
  55417. }
  55418. }
  55419. }
  55420. }
  55421. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  55422. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  55423. let captionHeight = 0;
  55424. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  55425. captionHeight = this.caption.reserve;
  55426. if (captionHeight <= 0) {
  55427. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  55428. }
  55429. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  55430. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  55431. } else {
  55432. ui.children[0].attributes.style.height = "100%";
  55433. }
  55434. }
  55435. if (aElement) {
  55436. ui.children.push(aElement);
  55437. }
  55438. if (!caption) {
  55439. if (ui.attributes.class) {
  55440. ui.attributes.class.push("xfaLeft");
  55441. }
  55442. this.w = savedW;
  55443. this.h = savedH;
  55444. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55445. }
  55446. if (this.ui.button) {
  55447. if (style.padding) {
  55448. delete style.padding;
  55449. }
  55450. if (caption.name === "div") {
  55451. caption.name = "span";
  55452. }
  55453. ui.children.push(caption);
  55454. return _utils.HTMLResult.success(html, bbox);
  55455. } else if (this.ui.checkButton) {
  55456. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  55457. }
  55458. if (!ui.attributes.class) {
  55459. ui.attributes.class = [];
  55460. }
  55461. ui.children.splice(0, 0, caption);
  55462. switch (this.caption.placement) {
  55463. case "left":
  55464. ui.attributes.class.push("xfaLeft");
  55465. break;
  55466. case "right":
  55467. ui.attributes.class.push("xfaRight");
  55468. break;
  55469. case "top":
  55470. ui.attributes.class.push("xfaTop");
  55471. break;
  55472. case "bottom":
  55473. ui.attributes.class.push("xfaBottom");
  55474. break;
  55475. case "inline":
  55476. ui.attributes.class.push("xfaLeft");
  55477. break;
  55478. }
  55479. this.w = savedW;
  55480. this.h = savedH;
  55481. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55482. }
  55483. }
  55484. exports.Field = Field;
  55485. class Fill extends _xfa_object.XFAObject {
  55486. constructor(attributes) {
  55487. super(TEMPLATE_NS_ID, "fill", true);
  55488. this.id = attributes.id || "";
  55489. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55490. this.use = attributes.use || "";
  55491. this.usehref = attributes.usehref || "";
  55492. this.color = null;
  55493. this.extras = null;
  55494. this.linear = null;
  55495. this.pattern = null;
  55496. this.radial = null;
  55497. this.solid = null;
  55498. this.stipple = null;
  55499. }
  55500. [_xfa_object.$toStyle]() {
  55501. const parent = this[_xfa_object.$getParent]();
  55502. const grandpa = parent[_xfa_object.$getParent]();
  55503. const ggrandpa = grandpa[_xfa_object.$getParent]();
  55504. const style = Object.create(null);
  55505. let propName = "color";
  55506. let altPropName = propName;
  55507. if (parent instanceof Border) {
  55508. propName = "background-color";
  55509. altPropName = "background";
  55510. if (ggrandpa instanceof Ui) {
  55511. style.backgroundColor = "white";
  55512. }
  55513. }
  55514. if (parent instanceof Rectangle || parent instanceof Arc) {
  55515. propName = altPropName = "fill";
  55516. style.fill = "white";
  55517. }
  55518. for (const name of Object.getOwnPropertyNames(this)) {
  55519. if (name === "extras" || name === "color") {
  55520. continue;
  55521. }
  55522. const obj = this[name];
  55523. if (!(obj instanceof _xfa_object.XFAObject)) {
  55524. continue;
  55525. }
  55526. const color = obj[_xfa_object.$toStyle](this.color);
  55527. if (color) {
  55528. style[color.startsWith("#") ? propName : altPropName] = color;
  55529. }
  55530. return style;
  55531. }
  55532. if (this.color && this.color.value) {
  55533. const color = this.color[_xfa_object.$toStyle]();
  55534. style[color.startsWith("#") ? propName : altPropName] = color;
  55535. }
  55536. return style;
  55537. }
  55538. }
  55539. class Filter extends _xfa_object.XFAObject {
  55540. constructor(attributes) {
  55541. super(TEMPLATE_NS_ID, "filter", true);
  55542. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  55543. this.id = attributes.id || "";
  55544. this.name = attributes.name || "";
  55545. this.use = attributes.use || "";
  55546. this.usehref = attributes.usehref || "";
  55547. this.version = (0, _utils.getInteger)({
  55548. data: this.version,
  55549. defaultValue: 5,
  55550. validate: x => x >= 1 && x <= 5
  55551. });
  55552. this.appearanceFilter = null;
  55553. this.certificates = null;
  55554. this.digestMethods = null;
  55555. this.encodings = null;
  55556. this.encryptionMethods = null;
  55557. this.handler = null;
  55558. this.lockDocument = null;
  55559. this.mdp = null;
  55560. this.reasons = null;
  55561. this.timeStamp = null;
  55562. }
  55563. }
  55564. class Float extends _xfa_object.ContentObject {
  55565. constructor(attributes) {
  55566. super(TEMPLATE_NS_ID, "float");
  55567. this.id = attributes.id || "";
  55568. this.name = attributes.name || "";
  55569. this.use = attributes.use || "";
  55570. this.usehref = attributes.usehref || "";
  55571. }
  55572. [_xfa_object.$finalize]() {
  55573. const number = parseFloat(this[_xfa_object.$content].trim());
  55574. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55575. }
  55576. [_xfa_object.$toHTML](availableSpace) {
  55577. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55578. }
  55579. }
  55580. class Font extends _xfa_object.XFAObject {
  55581. constructor(attributes) {
  55582. super(TEMPLATE_NS_ID, "font", true);
  55583. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  55584. this.fontHorizontalScale = (0, _utils.getFloat)({
  55585. data: attributes.fontHorizontalScale,
  55586. defaultValue: 100,
  55587. validate: x => x >= 0
  55588. });
  55589. this.fontVerticalScale = (0, _utils.getFloat)({
  55590. data: attributes.fontVerticalScale,
  55591. defaultValue: 100,
  55592. validate: x => x >= 0
  55593. });
  55594. this.id = attributes.id || "";
  55595. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  55596. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  55597. this.lineThrough = (0, _utils.getInteger)({
  55598. data: attributes.lineThrough,
  55599. defaultValue: 0,
  55600. validate: x => x === 1 || x === 2
  55601. });
  55602. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  55603. this.overline = (0, _utils.getInteger)({
  55604. data: attributes.overline,
  55605. defaultValue: 0,
  55606. validate: x => x === 1 || x === 2
  55607. });
  55608. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  55609. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  55610. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  55611. this.typeface = attributes.typeface || "Courier";
  55612. this.underline = (0, _utils.getInteger)({
  55613. data: attributes.underline,
  55614. defaultValue: 0,
  55615. validate: x => x === 1 || x === 2
  55616. });
  55617. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  55618. this.use = attributes.use || "";
  55619. this.usehref = attributes.usehref || "";
  55620. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  55621. this.extras = null;
  55622. this.fill = null;
  55623. }
  55624. [_xfa_object.$clean](builder) {
  55625. super[_xfa_object.$clean](builder);
  55626. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  55627. }
  55628. [_xfa_object.$toStyle]() {
  55629. const style = (0, _html_utils.toStyle)(this, "fill");
  55630. const color = style.color;
  55631. if (color) {
  55632. if (color === "#000000") {
  55633. delete style.color;
  55634. } else if (!color.startsWith("#")) {
  55635. style.background = color;
  55636. style.backgroundClip = "text";
  55637. style.color = "transparent";
  55638. }
  55639. }
  55640. if (this.baselineShift) {
  55641. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  55642. }
  55643. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  55644. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  55645. if (this.lineThrough !== 0) {
  55646. style.textDecoration = "line-through";
  55647. if (this.lineThrough === 2) {
  55648. style.textDecorationStyle = "double";
  55649. }
  55650. }
  55651. if (this.overline !== 0) {
  55652. style.textDecoration = "overline";
  55653. if (this.overline === 2) {
  55654. style.textDecorationStyle = "double";
  55655. }
  55656. }
  55657. style.fontStyle = this.posture;
  55658. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  55659. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  55660. if (this.underline !== 0) {
  55661. style.textDecoration = "underline";
  55662. if (this.underline === 2) {
  55663. style.textDecorationStyle = "double";
  55664. }
  55665. }
  55666. style.fontWeight = this.weight;
  55667. return style;
  55668. }
  55669. }
  55670. class Format extends _xfa_object.XFAObject {
  55671. constructor(attributes) {
  55672. super(TEMPLATE_NS_ID, "format", true);
  55673. this.id = attributes.id || "";
  55674. this.use = attributes.use || "";
  55675. this.usehref = attributes.usehref || "";
  55676. this.extras = null;
  55677. this.picture = null;
  55678. }
  55679. }
  55680. class Handler extends _xfa_object.StringObject {
  55681. constructor(attributes) {
  55682. super(TEMPLATE_NS_ID, "handler");
  55683. this.id = attributes.id || "";
  55684. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55685. this.use = attributes.use || "";
  55686. this.usehref = attributes.usehref || "";
  55687. }
  55688. }
  55689. class Hyphenation extends _xfa_object.XFAObject {
  55690. constructor(attributes) {
  55691. super(TEMPLATE_NS_ID, "hyphenation");
  55692. this.excludeAllCaps = (0, _utils.getInteger)({
  55693. data: attributes.excludeAllCaps,
  55694. defaultValue: 0,
  55695. validate: x => x === 1
  55696. });
  55697. this.excludeInitialCap = (0, _utils.getInteger)({
  55698. data: attributes.excludeInitialCap,
  55699. defaultValue: 0,
  55700. validate: x => x === 1
  55701. });
  55702. this.hyphenate = (0, _utils.getInteger)({
  55703. data: attributes.hyphenate,
  55704. defaultValue: 0,
  55705. validate: x => x === 1
  55706. });
  55707. this.id = attributes.id || "";
  55708. this.pushCharacterCount = (0, _utils.getInteger)({
  55709. data: attributes.pushCharacterCount,
  55710. defaultValue: 3,
  55711. validate: x => x >= 0
  55712. });
  55713. this.remainCharacterCount = (0, _utils.getInteger)({
  55714. data: attributes.remainCharacterCount,
  55715. defaultValue: 3,
  55716. validate: x => x >= 0
  55717. });
  55718. this.use = attributes.use || "";
  55719. this.usehref = attributes.usehref || "";
  55720. this.wordCharacterCount = (0, _utils.getInteger)({
  55721. data: attributes.wordCharacterCount,
  55722. defaultValue: 7,
  55723. validate: x => x >= 0
  55724. });
  55725. }
  55726. }
  55727. class Image extends _xfa_object.StringObject {
  55728. constructor(attributes) {
  55729. super(TEMPLATE_NS_ID, "image");
  55730. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  55731. this.contentType = attributes.contentType || "";
  55732. this.href = attributes.href || "";
  55733. this.id = attributes.id || "";
  55734. this.name = attributes.name || "";
  55735. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  55736. this.use = attributes.use || "";
  55737. this.usehref = attributes.usehref || "";
  55738. }
  55739. [_xfa_object.$toHTML]() {
  55740. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  55741. return _utils.HTMLResult.EMPTY;
  55742. }
  55743. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  55744. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  55745. return _utils.HTMLResult.EMPTY;
  55746. }
  55747. if (!buffer && this.transferEncoding === "base64") {
  55748. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  55749. }
  55750. if (!buffer) {
  55751. return _utils.HTMLResult.EMPTY;
  55752. }
  55753. if (!this.contentType) {
  55754. for (const [header, type] of IMAGES_HEADERS) {
  55755. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  55756. this.contentType = type;
  55757. break;
  55758. }
  55759. }
  55760. if (!this.contentType) {
  55761. return _utils.HTMLResult.EMPTY;
  55762. }
  55763. }
  55764. const blob = new Blob([buffer], {
  55765. type: this.contentType
  55766. });
  55767. let style;
  55768. switch (this.aspect) {
  55769. case "fit":
  55770. case "actual":
  55771. break;
  55772. case "height":
  55773. style = {
  55774. height: "100%",
  55775. objectFit: "fill"
  55776. };
  55777. break;
  55778. case "none":
  55779. style = {
  55780. width: "100%",
  55781. height: "100%",
  55782. objectFit: "fill"
  55783. };
  55784. break;
  55785. case "width":
  55786. style = {
  55787. width: "100%",
  55788. objectFit: "fill"
  55789. };
  55790. break;
  55791. }
  55792. const parent = this[_xfa_object.$getParent]();
  55793. return _utils.HTMLResult.success({
  55794. name: "img",
  55795. attributes: {
  55796. class: ["xfaImage"],
  55797. style,
  55798. src: URL.createObjectURL(blob),
  55799. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  55800. }
  55801. });
  55802. }
  55803. }
  55804. class ImageEdit extends _xfa_object.XFAObject {
  55805. constructor(attributes) {
  55806. super(TEMPLATE_NS_ID, "imageEdit", true);
  55807. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  55808. this.id = attributes.id || "";
  55809. this.use = attributes.use || "";
  55810. this.usehref = attributes.usehref || "";
  55811. this.border = null;
  55812. this.extras = null;
  55813. this.margin = null;
  55814. }
  55815. [_xfa_object.$toHTML](availableSpace) {
  55816. if (this.data === "embed") {
  55817. return _utils.HTMLResult.success({
  55818. name: "div",
  55819. children: [],
  55820. attributes: {}
  55821. });
  55822. }
  55823. return _utils.HTMLResult.EMPTY;
  55824. }
  55825. }
  55826. class Integer extends _xfa_object.ContentObject {
  55827. constructor(attributes) {
  55828. super(TEMPLATE_NS_ID, "integer");
  55829. this.id = attributes.id || "";
  55830. this.name = attributes.name || "";
  55831. this.use = attributes.use || "";
  55832. this.usehref = attributes.usehref || "";
  55833. }
  55834. [_xfa_object.$finalize]() {
  55835. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  55836. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55837. }
  55838. [_xfa_object.$toHTML](availableSpace) {
  55839. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55840. }
  55841. }
  55842. class Issuers extends _xfa_object.XFAObject {
  55843. constructor(attributes) {
  55844. super(TEMPLATE_NS_ID, "issuers", true);
  55845. this.id = attributes.id || "";
  55846. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55847. this.use = attributes.use || "";
  55848. this.usehref = attributes.usehref || "";
  55849. this.certificate = new _xfa_object.XFAObjectArray();
  55850. }
  55851. }
  55852. class Items extends _xfa_object.XFAObject {
  55853. constructor(attributes) {
  55854. super(TEMPLATE_NS_ID, "items", true);
  55855. this.id = attributes.id || "";
  55856. this.name = attributes.name || "";
  55857. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55858. this.ref = attributes.ref || "";
  55859. this.save = (0, _utils.getInteger)({
  55860. data: attributes.save,
  55861. defaultValue: 0,
  55862. validate: x => x === 1
  55863. });
  55864. this.use = attributes.use || "";
  55865. this.usehref = attributes.usehref || "";
  55866. this.boolean = new _xfa_object.XFAObjectArray();
  55867. this.date = new _xfa_object.XFAObjectArray();
  55868. this.dateTime = new _xfa_object.XFAObjectArray();
  55869. this.decimal = new _xfa_object.XFAObjectArray();
  55870. this.exData = new _xfa_object.XFAObjectArray();
  55871. this.float = new _xfa_object.XFAObjectArray();
  55872. this.image = new _xfa_object.XFAObjectArray();
  55873. this.integer = new _xfa_object.XFAObjectArray();
  55874. this.text = new _xfa_object.XFAObjectArray();
  55875. this.time = new _xfa_object.XFAObjectArray();
  55876. }
  55877. [_xfa_object.$toHTML]() {
  55878. const output = [];
  55879. for (const child of this[_xfa_object.$getChildren]()) {
  55880. output.push(child[_xfa_object.$text]());
  55881. }
  55882. return _utils.HTMLResult.success(output);
  55883. }
  55884. }
  55885. exports.Items = Items;
  55886. class Keep extends _xfa_object.XFAObject {
  55887. constructor(attributes) {
  55888. super(TEMPLATE_NS_ID, "keep", true);
  55889. this.id = attributes.id || "";
  55890. const options = ["none", "contentArea", "pageArea"];
  55891. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  55892. this.next = (0, _utils.getStringOption)(attributes.next, options);
  55893. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  55894. this.use = attributes.use || "";
  55895. this.usehref = attributes.usehref || "";
  55896. this.extras = null;
  55897. }
  55898. }
  55899. class KeyUsage extends _xfa_object.XFAObject {
  55900. constructor(attributes) {
  55901. super(TEMPLATE_NS_ID, "keyUsage");
  55902. const options = ["", "yes", "no"];
  55903. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  55904. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  55905. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  55906. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  55907. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  55908. this.id = attributes.id || "";
  55909. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  55910. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  55911. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  55912. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  55913. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55914. this.use = attributes.use || "";
  55915. this.usehref = attributes.usehref || "";
  55916. }
  55917. }
  55918. class Line extends _xfa_object.XFAObject {
  55919. constructor(attributes) {
  55920. super(TEMPLATE_NS_ID, "line", true);
  55921. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55922. this.id = attributes.id || "";
  55923. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  55924. this.use = attributes.use || "";
  55925. this.usehref = attributes.usehref || "";
  55926. this.edge = null;
  55927. }
  55928. [_xfa_object.$toHTML]() {
  55929. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55930. const edge = this.edge || new Edge({});
  55931. const edgeStyle = edge[_xfa_object.$toStyle]();
  55932. const style = Object.create(null);
  55933. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  55934. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  55935. style.stroke = edgeStyle.color;
  55936. let x1, y1, x2, y2;
  55937. let width = "100%";
  55938. let height = "100%";
  55939. if (parent.w <= thickness) {
  55940. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  55941. width = style.strokeWidth;
  55942. } else if (parent.h <= thickness) {
  55943. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  55944. height = style.strokeWidth;
  55945. } else {
  55946. if (this.slope === "\\") {
  55947. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  55948. } else {
  55949. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  55950. }
  55951. }
  55952. const line = {
  55953. name: "line",
  55954. attributes: {
  55955. xmlns: SVG_NS,
  55956. x1,
  55957. y1,
  55958. x2,
  55959. y2,
  55960. style
  55961. }
  55962. };
  55963. const svg = {
  55964. name: "svg",
  55965. children: [line],
  55966. attributes: {
  55967. xmlns: SVG_NS,
  55968. width,
  55969. height,
  55970. style: {
  55971. overflow: "visible"
  55972. }
  55973. }
  55974. };
  55975. if (hasMargin(parent)) {
  55976. return _utils.HTMLResult.success({
  55977. name: "div",
  55978. attributes: {
  55979. style: {
  55980. display: "inline",
  55981. width: "100%",
  55982. height: "100%"
  55983. }
  55984. },
  55985. children: [svg]
  55986. });
  55987. }
  55988. svg.attributes.style.position = "absolute";
  55989. return _utils.HTMLResult.success(svg);
  55990. }
  55991. }
  55992. class Linear extends _xfa_object.XFAObject {
  55993. constructor(attributes) {
  55994. super(TEMPLATE_NS_ID, "linear", true);
  55995. this.id = attributes.id || "";
  55996. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  55997. this.use = attributes.use || "";
  55998. this.usehref = attributes.usehref || "";
  55999. this.color = null;
  56000. this.extras = null;
  56001. }
  56002. [_xfa_object.$toStyle](startColor) {
  56003. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56004. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  56005. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56006. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  56007. }
  56008. }
  56009. class LockDocument extends _xfa_object.ContentObject {
  56010. constructor(attributes) {
  56011. super(TEMPLATE_NS_ID, "lockDocument");
  56012. this.id = attributes.id || "";
  56013. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56014. this.use = attributes.use || "";
  56015. this.usehref = attributes.usehref || "";
  56016. }
  56017. [_xfa_object.$finalize]() {
  56018. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  56019. }
  56020. }
  56021. class Manifest extends _xfa_object.XFAObject {
  56022. constructor(attributes) {
  56023. super(TEMPLATE_NS_ID, "manifest", true);
  56024. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  56025. this.id = attributes.id || "";
  56026. this.name = attributes.name || "";
  56027. this.use = attributes.use || "";
  56028. this.usehref = attributes.usehref || "";
  56029. this.extras = null;
  56030. this.ref = new _xfa_object.XFAObjectArray();
  56031. }
  56032. }
  56033. class Margin extends _xfa_object.XFAObject {
  56034. constructor(attributes) {
  56035. super(TEMPLATE_NS_ID, "margin", true);
  56036. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  56037. this.id = attributes.id || "";
  56038. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  56039. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  56040. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  56041. this.use = attributes.use || "";
  56042. this.usehref = attributes.usehref || "";
  56043. this.extras = null;
  56044. }
  56045. [_xfa_object.$toStyle]() {
  56046. return {
  56047. 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)
  56048. };
  56049. }
  56050. }
  56051. class Mdp extends _xfa_object.XFAObject {
  56052. constructor(attributes) {
  56053. super(TEMPLATE_NS_ID, "mdp");
  56054. this.id = attributes.id || "";
  56055. this.permissions = (0, _utils.getInteger)({
  56056. data: attributes.permissions,
  56057. defaultValue: 2,
  56058. validate: x => x === 1 || x === 3
  56059. });
  56060. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  56061. this.use = attributes.use || "";
  56062. this.usehref = attributes.usehref || "";
  56063. }
  56064. }
  56065. class Medium extends _xfa_object.XFAObject {
  56066. constructor(attributes) {
  56067. super(TEMPLATE_NS_ID, "medium");
  56068. this.id = attributes.id || "";
  56069. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  56070. this.long = (0, _utils.getMeasurement)(attributes.long);
  56071. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  56072. this.short = (0, _utils.getMeasurement)(attributes.short);
  56073. this.stock = attributes.stock || "";
  56074. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  56075. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  56076. this.use = attributes.use || "";
  56077. this.usehref = attributes.usehref || "";
  56078. }
  56079. }
  56080. class Message extends _xfa_object.XFAObject {
  56081. constructor(attributes) {
  56082. super(TEMPLATE_NS_ID, "message", true);
  56083. this.id = attributes.id || "";
  56084. this.use = attributes.use || "";
  56085. this.usehref = attributes.usehref || "";
  56086. this.text = new _xfa_object.XFAObjectArray();
  56087. }
  56088. }
  56089. class NumericEdit extends _xfa_object.XFAObject {
  56090. constructor(attributes) {
  56091. super(TEMPLATE_NS_ID, "numericEdit", true);
  56092. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56093. this.id = attributes.id || "";
  56094. this.use = attributes.use || "";
  56095. this.usehref = attributes.usehref || "";
  56096. this.border = null;
  56097. this.comb = null;
  56098. this.extras = null;
  56099. this.margin = null;
  56100. }
  56101. [_xfa_object.$toHTML](availableSpace) {
  56102. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56103. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56104. const html = {
  56105. name: "input",
  56106. attributes: {
  56107. type: "text",
  56108. fieldId: field[_xfa_object.$uid],
  56109. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56110. class: ["xfaTextfield"],
  56111. style,
  56112. "aria-label": ariaLabel(field),
  56113. "aria-required": false
  56114. }
  56115. };
  56116. if (isRequired(field)) {
  56117. html.attributes["aria-required"] = true;
  56118. html.attributes.required = true;
  56119. }
  56120. return _utils.HTMLResult.success({
  56121. name: "label",
  56122. attributes: {
  56123. class: ["xfaLabel"]
  56124. },
  56125. children: [html]
  56126. });
  56127. }
  56128. }
  56129. class Occur extends _xfa_object.XFAObject {
  56130. constructor(attributes) {
  56131. super(TEMPLATE_NS_ID, "occur", true);
  56132. this.id = attributes.id || "";
  56133. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  56134. data: attributes.initial,
  56135. defaultValue: "",
  56136. validate: x => true
  56137. }) : "";
  56138. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  56139. data: attributes.max,
  56140. defaultValue: 1,
  56141. validate: x => true
  56142. }) : "";
  56143. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  56144. data: attributes.min,
  56145. defaultValue: 1,
  56146. validate: x => true
  56147. }) : "";
  56148. this.use = attributes.use || "";
  56149. this.usehref = attributes.usehref || "";
  56150. this.extras = null;
  56151. }
  56152. [_xfa_object.$clean]() {
  56153. const parent = this[_xfa_object.$getParent]();
  56154. const originalMin = this.min;
  56155. if (this.min === "") {
  56156. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  56157. }
  56158. if (this.max === "") {
  56159. if (originalMin === "") {
  56160. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  56161. } else {
  56162. this.max = this.min;
  56163. }
  56164. }
  56165. if (this.max !== -1 && this.max < this.min) {
  56166. this.max = this.min;
  56167. }
  56168. if (this.initial === "") {
  56169. this.initial = parent instanceof Template ? 1 : this.min;
  56170. }
  56171. }
  56172. }
  56173. class Oid extends _xfa_object.StringObject {
  56174. constructor(attributes) {
  56175. super(TEMPLATE_NS_ID, "oid");
  56176. this.id = attributes.id || "";
  56177. this.name = attributes.name || "";
  56178. this.use = attributes.use || "";
  56179. this.usehref = attributes.usehref || "";
  56180. }
  56181. }
  56182. class Oids extends _xfa_object.XFAObject {
  56183. constructor(attributes) {
  56184. super(TEMPLATE_NS_ID, "oids", true);
  56185. this.id = attributes.id || "";
  56186. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56187. this.use = attributes.use || "";
  56188. this.usehref = attributes.usehref || "";
  56189. this.oid = new _xfa_object.XFAObjectArray();
  56190. }
  56191. }
  56192. class Overflow extends _xfa_object.XFAObject {
  56193. constructor(attributes) {
  56194. super(TEMPLATE_NS_ID, "overflow");
  56195. this.id = attributes.id || "";
  56196. this.leader = attributes.leader || "";
  56197. this.target = attributes.target || "";
  56198. this.trailer = attributes.trailer || "";
  56199. this.use = attributes.use || "";
  56200. this.usehref = attributes.usehref || "";
  56201. }
  56202. [_xfa_object.$getExtra]() {
  56203. if (!this[_xfa_object.$extra]) {
  56204. const parent = this[_xfa_object.$getParent]();
  56205. const root = this[_xfa_object.$getTemplateRoot]();
  56206. const target = root[_xfa_object.$searchNode](this.target, parent);
  56207. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  56208. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  56209. this[_xfa_object.$extra] = {
  56210. target: target && target[0] || null,
  56211. leader: leader && leader[0] || null,
  56212. trailer: trailer && trailer[0] || null,
  56213. addLeader: false,
  56214. addTrailer: false
  56215. };
  56216. }
  56217. return this[_xfa_object.$extra];
  56218. }
  56219. }
  56220. class PageArea extends _xfa_object.XFAObject {
  56221. constructor(attributes) {
  56222. super(TEMPLATE_NS_ID, "pageArea", true);
  56223. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  56224. this.id = attributes.id || "";
  56225. this.initialNumber = (0, _utils.getInteger)({
  56226. data: attributes.initialNumber,
  56227. defaultValue: 1,
  56228. validate: x => true
  56229. });
  56230. this.name = attributes.name || "";
  56231. this.numbered = (0, _utils.getInteger)({
  56232. data: attributes.numbered,
  56233. defaultValue: 1,
  56234. validate: x => true
  56235. });
  56236. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  56237. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  56238. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56239. this.use = attributes.use || "";
  56240. this.usehref = attributes.usehref || "";
  56241. this.desc = null;
  56242. this.extras = null;
  56243. this.medium = null;
  56244. this.occur = null;
  56245. this.area = new _xfa_object.XFAObjectArray();
  56246. this.contentArea = new _xfa_object.XFAObjectArray();
  56247. this.draw = new _xfa_object.XFAObjectArray();
  56248. this.exclGroup = new _xfa_object.XFAObjectArray();
  56249. this.field = new _xfa_object.XFAObjectArray();
  56250. this.subform = new _xfa_object.XFAObjectArray();
  56251. }
  56252. [_xfa_object.$isUsable]() {
  56253. if (!this[_xfa_object.$extra]) {
  56254. this[_xfa_object.$extra] = {
  56255. numberOfUse: 0
  56256. };
  56257. return true;
  56258. }
  56259. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56260. }
  56261. [_xfa_object.$cleanPage]() {
  56262. delete this[_xfa_object.$extra];
  56263. }
  56264. [_xfa_object.$getNextPage]() {
  56265. if (!this[_xfa_object.$extra]) {
  56266. this[_xfa_object.$extra] = {
  56267. numberOfUse: 0
  56268. };
  56269. }
  56270. const parent = this[_xfa_object.$getParent]();
  56271. if (parent.relation === "orderedOccurrence") {
  56272. if (this[_xfa_object.$isUsable]()) {
  56273. this[_xfa_object.$extra].numberOfUse += 1;
  56274. return this;
  56275. }
  56276. }
  56277. return parent[_xfa_object.$getNextPage]();
  56278. }
  56279. [_xfa_object.$getAvailableSpace]() {
  56280. return this[_xfa_object.$extra].space || {
  56281. width: 0,
  56282. height: 0
  56283. };
  56284. }
  56285. [_xfa_object.$toHTML]() {
  56286. if (!this[_xfa_object.$extra]) {
  56287. this[_xfa_object.$extra] = {
  56288. numberOfUse: 1
  56289. };
  56290. }
  56291. const children = [];
  56292. this[_xfa_object.$extra].children = children;
  56293. const style = Object.create(null);
  56294. if (this.medium && this.medium.short && this.medium.long) {
  56295. style.width = (0, _html_utils.measureToString)(this.medium.short);
  56296. style.height = (0, _html_utils.measureToString)(this.medium.long);
  56297. this[_xfa_object.$extra].space = {
  56298. width: this.medium.short,
  56299. height: this.medium.long
  56300. };
  56301. if (this.medium.orientation === "landscape") {
  56302. const x = style.width;
  56303. style.width = style.height;
  56304. style.height = x;
  56305. this[_xfa_object.$extra].space = {
  56306. width: this.medium.long,
  56307. height: this.medium.short
  56308. };
  56309. }
  56310. } else {
  56311. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  56312. }
  56313. this[_xfa_object.$childrenToHTML]({
  56314. filter: new Set(["area", "draw", "field", "subform"]),
  56315. include: true
  56316. });
  56317. this[_xfa_object.$childrenToHTML]({
  56318. filter: new Set(["contentArea"]),
  56319. include: true
  56320. });
  56321. return _utils.HTMLResult.success({
  56322. name: "div",
  56323. children,
  56324. attributes: {
  56325. class: ["xfaPage"],
  56326. id: this[_xfa_object.$uid],
  56327. style,
  56328. xfaName: this.name
  56329. }
  56330. });
  56331. }
  56332. }
  56333. class PageSet extends _xfa_object.XFAObject {
  56334. constructor(attributes) {
  56335. super(TEMPLATE_NS_ID, "pageSet", true);
  56336. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  56337. this.id = attributes.id || "";
  56338. this.name = attributes.name || "";
  56339. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  56340. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56341. this.use = attributes.use || "";
  56342. this.usehref = attributes.usehref || "";
  56343. this.extras = null;
  56344. this.occur = null;
  56345. this.pageArea = new _xfa_object.XFAObjectArray();
  56346. this.pageSet = new _xfa_object.XFAObjectArray();
  56347. }
  56348. [_xfa_object.$cleanPage]() {
  56349. for (const page of this.pageArea.children) {
  56350. page[_xfa_object.$cleanPage]();
  56351. }
  56352. for (const page of this.pageSet.children) {
  56353. page[_xfa_object.$cleanPage]();
  56354. }
  56355. }
  56356. [_xfa_object.$isUsable]() {
  56357. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  56358. }
  56359. [_xfa_object.$getNextPage]() {
  56360. if (!this[_xfa_object.$extra]) {
  56361. this[_xfa_object.$extra] = {
  56362. numberOfUse: 1,
  56363. pageIndex: -1,
  56364. pageSetIndex: -1
  56365. };
  56366. }
  56367. if (this.relation === "orderedOccurrence") {
  56368. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  56369. this[_xfa_object.$extra].pageIndex += 1;
  56370. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  56371. return pageArea[_xfa_object.$getNextPage]();
  56372. }
  56373. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  56374. this[_xfa_object.$extra].pageSetIndex += 1;
  56375. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  56376. }
  56377. if (this[_xfa_object.$isUsable]()) {
  56378. this[_xfa_object.$extra].numberOfUse += 1;
  56379. this[_xfa_object.$extra].pageIndex = -1;
  56380. this[_xfa_object.$extra].pageSetIndex = -1;
  56381. return this[_xfa_object.$getNextPage]();
  56382. }
  56383. const parent = this[_xfa_object.$getParent]();
  56384. if (parent instanceof PageSet) {
  56385. return parent[_xfa_object.$getNextPage]();
  56386. }
  56387. this[_xfa_object.$cleanPage]();
  56388. return this[_xfa_object.$getNextPage]();
  56389. }
  56390. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  56391. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  56392. const position = pageNumber === 0 ? "first" : "rest";
  56393. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  56394. if (page) {
  56395. return page;
  56396. }
  56397. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  56398. if (page) {
  56399. return page;
  56400. }
  56401. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  56402. if (page) {
  56403. return page;
  56404. }
  56405. return this.pageArea.children[0];
  56406. }
  56407. }
  56408. class Para extends _xfa_object.XFAObject {
  56409. constructor(attributes) {
  56410. super(TEMPLATE_NS_ID, "para", true);
  56411. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56412. this.id = attributes.id || "";
  56413. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  56414. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  56415. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  56416. this.orphans = (0, _utils.getInteger)({
  56417. data: attributes.orphans,
  56418. defaultValue: 0,
  56419. validate: x => x >= 0
  56420. });
  56421. this.preserve = attributes.preserve || "";
  56422. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  56423. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  56424. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  56425. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  56426. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  56427. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  56428. this.use = attributes.use || "";
  56429. this.usehref = attributes.usehref || "";
  56430. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  56431. this.widows = (0, _utils.getInteger)({
  56432. data: attributes.widows,
  56433. defaultValue: 0,
  56434. validate: x => x >= 0
  56435. });
  56436. this.hyphenation = null;
  56437. }
  56438. [_xfa_object.$toStyle]() {
  56439. const style = (0, _html_utils.toStyle)(this, "hAlign");
  56440. if (this.marginLeft !== "") {
  56441. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  56442. }
  56443. if (this.marginRight !== "") {
  56444. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  56445. }
  56446. if (this.spaceAbove !== "") {
  56447. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  56448. }
  56449. if (this.spaceBelow !== "") {
  56450. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  56451. }
  56452. if (this.textIndent !== "") {
  56453. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  56454. (0, _html_utils.fixTextIndent)(style);
  56455. }
  56456. if (this.lineHeight > 0) {
  56457. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  56458. }
  56459. if (this.tabDefault !== "") {
  56460. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  56461. }
  56462. if (this.tabStops.length > 0) {}
  56463. if (this.hyphenatation) {
  56464. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  56465. }
  56466. return style;
  56467. }
  56468. }
  56469. class PasswordEdit extends _xfa_object.XFAObject {
  56470. constructor(attributes) {
  56471. super(TEMPLATE_NS_ID, "passwordEdit", true);
  56472. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56473. this.id = attributes.id || "";
  56474. this.passwordChar = attributes.passwordChar || "*";
  56475. this.use = attributes.use || "";
  56476. this.usehref = attributes.usehref || "";
  56477. this.border = null;
  56478. this.extras = null;
  56479. this.margin = null;
  56480. }
  56481. }
  56482. class Pattern extends _xfa_object.XFAObject {
  56483. constructor(attributes) {
  56484. super(TEMPLATE_NS_ID, "pattern", true);
  56485. this.id = attributes.id || "";
  56486. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  56487. this.use = attributes.use || "";
  56488. this.usehref = attributes.usehref || "";
  56489. this.color = null;
  56490. this.extras = null;
  56491. }
  56492. [_xfa_object.$toStyle](startColor) {
  56493. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56494. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56495. const width = 5;
  56496. const cmd = "repeating-linear-gradient";
  56497. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  56498. switch (this.type) {
  56499. case "crossHatch":
  56500. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  56501. case "crossDiagonal":
  56502. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  56503. case "diagonalLeft":
  56504. return `${cmd}(45deg,${colors})`;
  56505. case "diagonalRight":
  56506. return `${cmd}(-45deg,${colors})`;
  56507. case "horizontal":
  56508. return `${cmd}(to top,${colors})`;
  56509. case "vertical":
  56510. return `${cmd}(to right,${colors})`;
  56511. }
  56512. return "";
  56513. }
  56514. }
  56515. class Picture extends _xfa_object.StringObject {
  56516. constructor(attributes) {
  56517. super(TEMPLATE_NS_ID, "picture");
  56518. this.id = attributes.id || "";
  56519. this.use = attributes.use || "";
  56520. this.usehref = attributes.usehref || "";
  56521. }
  56522. }
  56523. class Proto extends _xfa_object.XFAObject {
  56524. constructor(attributes) {
  56525. super(TEMPLATE_NS_ID, "proto", true);
  56526. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  56527. this.arc = new _xfa_object.XFAObjectArray();
  56528. this.area = new _xfa_object.XFAObjectArray();
  56529. this.assist = new _xfa_object.XFAObjectArray();
  56530. this.barcode = new _xfa_object.XFAObjectArray();
  56531. this.bindItems = new _xfa_object.XFAObjectArray();
  56532. this.bookend = new _xfa_object.XFAObjectArray();
  56533. this.boolean = new _xfa_object.XFAObjectArray();
  56534. this.border = new _xfa_object.XFAObjectArray();
  56535. this.break = new _xfa_object.XFAObjectArray();
  56536. this.breakAfter = new _xfa_object.XFAObjectArray();
  56537. this.breakBefore = new _xfa_object.XFAObjectArray();
  56538. this.button = new _xfa_object.XFAObjectArray();
  56539. this.calculate = new _xfa_object.XFAObjectArray();
  56540. this.caption = new _xfa_object.XFAObjectArray();
  56541. this.certificate = new _xfa_object.XFAObjectArray();
  56542. this.certificates = new _xfa_object.XFAObjectArray();
  56543. this.checkButton = new _xfa_object.XFAObjectArray();
  56544. this.choiceList = new _xfa_object.XFAObjectArray();
  56545. this.color = new _xfa_object.XFAObjectArray();
  56546. this.comb = new _xfa_object.XFAObjectArray();
  56547. this.connect = new _xfa_object.XFAObjectArray();
  56548. this.contentArea = new _xfa_object.XFAObjectArray();
  56549. this.corner = new _xfa_object.XFAObjectArray();
  56550. this.date = new _xfa_object.XFAObjectArray();
  56551. this.dateTime = new _xfa_object.XFAObjectArray();
  56552. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  56553. this.decimal = new _xfa_object.XFAObjectArray();
  56554. this.defaultUi = new _xfa_object.XFAObjectArray();
  56555. this.desc = new _xfa_object.XFAObjectArray();
  56556. this.digestMethod = new _xfa_object.XFAObjectArray();
  56557. this.digestMethods = new _xfa_object.XFAObjectArray();
  56558. this.draw = new _xfa_object.XFAObjectArray();
  56559. this.edge = new _xfa_object.XFAObjectArray();
  56560. this.encoding = new _xfa_object.XFAObjectArray();
  56561. this.encodings = new _xfa_object.XFAObjectArray();
  56562. this.encrypt = new _xfa_object.XFAObjectArray();
  56563. this.encryptData = new _xfa_object.XFAObjectArray();
  56564. this.encryption = new _xfa_object.XFAObjectArray();
  56565. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  56566. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  56567. this.event = new _xfa_object.XFAObjectArray();
  56568. this.exData = new _xfa_object.XFAObjectArray();
  56569. this.exObject = new _xfa_object.XFAObjectArray();
  56570. this.exclGroup = new _xfa_object.XFAObjectArray();
  56571. this.execute = new _xfa_object.XFAObjectArray();
  56572. this.extras = new _xfa_object.XFAObjectArray();
  56573. this.field = new _xfa_object.XFAObjectArray();
  56574. this.fill = new _xfa_object.XFAObjectArray();
  56575. this.filter = new _xfa_object.XFAObjectArray();
  56576. this.float = new _xfa_object.XFAObjectArray();
  56577. this.font = new _xfa_object.XFAObjectArray();
  56578. this.format = new _xfa_object.XFAObjectArray();
  56579. this.handler = new _xfa_object.XFAObjectArray();
  56580. this.hyphenation = new _xfa_object.XFAObjectArray();
  56581. this.image = new _xfa_object.XFAObjectArray();
  56582. this.imageEdit = new _xfa_object.XFAObjectArray();
  56583. this.integer = new _xfa_object.XFAObjectArray();
  56584. this.issuers = new _xfa_object.XFAObjectArray();
  56585. this.items = new _xfa_object.XFAObjectArray();
  56586. this.keep = new _xfa_object.XFAObjectArray();
  56587. this.keyUsage = new _xfa_object.XFAObjectArray();
  56588. this.line = new _xfa_object.XFAObjectArray();
  56589. this.linear = new _xfa_object.XFAObjectArray();
  56590. this.lockDocument = new _xfa_object.XFAObjectArray();
  56591. this.manifest = new _xfa_object.XFAObjectArray();
  56592. this.margin = new _xfa_object.XFAObjectArray();
  56593. this.mdp = new _xfa_object.XFAObjectArray();
  56594. this.medium = new _xfa_object.XFAObjectArray();
  56595. this.message = new _xfa_object.XFAObjectArray();
  56596. this.numericEdit = new _xfa_object.XFAObjectArray();
  56597. this.occur = new _xfa_object.XFAObjectArray();
  56598. this.oid = new _xfa_object.XFAObjectArray();
  56599. this.oids = new _xfa_object.XFAObjectArray();
  56600. this.overflow = new _xfa_object.XFAObjectArray();
  56601. this.pageArea = new _xfa_object.XFAObjectArray();
  56602. this.pageSet = new _xfa_object.XFAObjectArray();
  56603. this.para = new _xfa_object.XFAObjectArray();
  56604. this.passwordEdit = new _xfa_object.XFAObjectArray();
  56605. this.pattern = new _xfa_object.XFAObjectArray();
  56606. this.picture = new _xfa_object.XFAObjectArray();
  56607. this.radial = new _xfa_object.XFAObjectArray();
  56608. this.reason = new _xfa_object.XFAObjectArray();
  56609. this.reasons = new _xfa_object.XFAObjectArray();
  56610. this.rectangle = new _xfa_object.XFAObjectArray();
  56611. this.ref = new _xfa_object.XFAObjectArray();
  56612. this.script = new _xfa_object.XFAObjectArray();
  56613. this.setProperty = new _xfa_object.XFAObjectArray();
  56614. this.signData = new _xfa_object.XFAObjectArray();
  56615. this.signature = new _xfa_object.XFAObjectArray();
  56616. this.signing = new _xfa_object.XFAObjectArray();
  56617. this.solid = new _xfa_object.XFAObjectArray();
  56618. this.speak = new _xfa_object.XFAObjectArray();
  56619. this.stipple = new _xfa_object.XFAObjectArray();
  56620. this.subform = new _xfa_object.XFAObjectArray();
  56621. this.subformSet = new _xfa_object.XFAObjectArray();
  56622. this.subjectDN = new _xfa_object.XFAObjectArray();
  56623. this.subjectDNs = new _xfa_object.XFAObjectArray();
  56624. this.submit = new _xfa_object.XFAObjectArray();
  56625. this.text = new _xfa_object.XFAObjectArray();
  56626. this.textEdit = new _xfa_object.XFAObjectArray();
  56627. this.time = new _xfa_object.XFAObjectArray();
  56628. this.timeStamp = new _xfa_object.XFAObjectArray();
  56629. this.toolTip = new _xfa_object.XFAObjectArray();
  56630. this.traversal = new _xfa_object.XFAObjectArray();
  56631. this.traverse = new _xfa_object.XFAObjectArray();
  56632. this.ui = new _xfa_object.XFAObjectArray();
  56633. this.validate = new _xfa_object.XFAObjectArray();
  56634. this.value = new _xfa_object.XFAObjectArray();
  56635. this.variables = new _xfa_object.XFAObjectArray();
  56636. }
  56637. }
  56638. class Radial extends _xfa_object.XFAObject {
  56639. constructor(attributes) {
  56640. super(TEMPLATE_NS_ID, "radial", true);
  56641. this.id = attributes.id || "";
  56642. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  56643. this.use = attributes.use || "";
  56644. this.usehref = attributes.usehref || "";
  56645. this.color = null;
  56646. this.extras = null;
  56647. }
  56648. [_xfa_object.$toStyle](startColor) {
  56649. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56650. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  56651. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  56652. return `radial-gradient(circle at center, ${colors})`;
  56653. }
  56654. }
  56655. class Reason extends _xfa_object.StringObject {
  56656. constructor(attributes) {
  56657. super(TEMPLATE_NS_ID, "reason");
  56658. this.id = attributes.id || "";
  56659. this.name = attributes.name || "";
  56660. this.use = attributes.use || "";
  56661. this.usehref = attributes.usehref || "";
  56662. }
  56663. }
  56664. class Reasons extends _xfa_object.XFAObject {
  56665. constructor(attributes) {
  56666. super(TEMPLATE_NS_ID, "reasons", true);
  56667. this.id = attributes.id || "";
  56668. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56669. this.use = attributes.use || "";
  56670. this.usehref = attributes.usehref || "";
  56671. this.reason = new _xfa_object.XFAObjectArray();
  56672. }
  56673. }
  56674. class Rectangle extends _xfa_object.XFAObject {
  56675. constructor(attributes) {
  56676. super(TEMPLATE_NS_ID, "rectangle", true);
  56677. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  56678. this.id = attributes.id || "";
  56679. this.use = attributes.use || "";
  56680. this.usehref = attributes.usehref || "";
  56681. this.corner = new _xfa_object.XFAObjectArray(4);
  56682. this.edge = new _xfa_object.XFAObjectArray(4);
  56683. this.fill = null;
  56684. }
  56685. [_xfa_object.$toHTML]() {
  56686. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  56687. const edgeStyle = edge[_xfa_object.$toStyle]();
  56688. const style = Object.create(null);
  56689. if (this.fill && this.fill.presence === "visible") {
  56690. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  56691. } else {
  56692. style.fill = "transparent";
  56693. }
  56694. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  56695. style.stroke = edgeStyle.color;
  56696. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  56697. const cornerStyle = corner[_xfa_object.$toStyle]();
  56698. const rect = {
  56699. name: "rect",
  56700. attributes: {
  56701. xmlns: SVG_NS,
  56702. width: "100%",
  56703. height: "100%",
  56704. x: 0,
  56705. y: 0,
  56706. rx: cornerStyle.radius,
  56707. ry: cornerStyle.radius,
  56708. style
  56709. }
  56710. };
  56711. const svg = {
  56712. name: "svg",
  56713. children: [rect],
  56714. attributes: {
  56715. xmlns: SVG_NS,
  56716. style: {
  56717. overflow: "visible"
  56718. },
  56719. width: "100%",
  56720. height: "100%"
  56721. }
  56722. };
  56723. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56724. if (hasMargin(parent)) {
  56725. return _utils.HTMLResult.success({
  56726. name: "div",
  56727. attributes: {
  56728. style: {
  56729. display: "inline",
  56730. width: "100%",
  56731. height: "100%"
  56732. }
  56733. },
  56734. children: [svg]
  56735. });
  56736. }
  56737. svg.attributes.style.position = "absolute";
  56738. return _utils.HTMLResult.success(svg);
  56739. }
  56740. }
  56741. class RefElement extends _xfa_object.StringObject {
  56742. constructor(attributes) {
  56743. super(TEMPLATE_NS_ID, "ref");
  56744. this.id = attributes.id || "";
  56745. this.use = attributes.use || "";
  56746. this.usehref = attributes.usehref || "";
  56747. }
  56748. }
  56749. class Script extends _xfa_object.StringObject {
  56750. constructor(attributes) {
  56751. super(TEMPLATE_NS_ID, "script");
  56752. this.binding = attributes.binding || "";
  56753. this.contentType = attributes.contentType || "";
  56754. this.id = attributes.id || "";
  56755. this.name = attributes.name || "";
  56756. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  56757. this.use = attributes.use || "";
  56758. this.usehref = attributes.usehref || "";
  56759. }
  56760. }
  56761. class SetProperty extends _xfa_object.XFAObject {
  56762. constructor(attributes) {
  56763. super(TEMPLATE_NS_ID, "setProperty");
  56764. this.connection = attributes.connection || "";
  56765. this.ref = attributes.ref || "";
  56766. this.target = attributes.target || "";
  56767. }
  56768. }
  56769. exports.SetProperty = SetProperty;
  56770. class SignData extends _xfa_object.XFAObject {
  56771. constructor(attributes) {
  56772. super(TEMPLATE_NS_ID, "signData", true);
  56773. this.id = attributes.id || "";
  56774. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  56775. this.ref = attributes.ref || "";
  56776. this.target = attributes.target || "";
  56777. this.use = attributes.use || "";
  56778. this.usehref = attributes.usehref || "";
  56779. this.filter = null;
  56780. this.manifest = null;
  56781. }
  56782. }
  56783. class Signature extends _xfa_object.XFAObject {
  56784. constructor(attributes) {
  56785. super(TEMPLATE_NS_ID, "signature", true);
  56786. this.id = attributes.id || "";
  56787. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  56788. this.use = attributes.use || "";
  56789. this.usehref = attributes.usehref || "";
  56790. this.border = null;
  56791. this.extras = null;
  56792. this.filter = null;
  56793. this.manifest = null;
  56794. this.margin = null;
  56795. }
  56796. }
  56797. class Signing extends _xfa_object.XFAObject {
  56798. constructor(attributes) {
  56799. super(TEMPLATE_NS_ID, "signing", true);
  56800. this.id = attributes.id || "";
  56801. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56802. this.use = attributes.use || "";
  56803. this.usehref = attributes.usehref || "";
  56804. this.certificate = new _xfa_object.XFAObjectArray();
  56805. }
  56806. }
  56807. class Solid extends _xfa_object.XFAObject {
  56808. constructor(attributes) {
  56809. super(TEMPLATE_NS_ID, "solid", true);
  56810. this.id = attributes.id || "";
  56811. this.use = attributes.use || "";
  56812. this.usehref = attributes.usehref || "";
  56813. this.extras = null;
  56814. }
  56815. [_xfa_object.$toStyle](startColor) {
  56816. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56817. }
  56818. }
  56819. class Speak extends _xfa_object.StringObject {
  56820. constructor(attributes) {
  56821. super(TEMPLATE_NS_ID, "speak");
  56822. this.disable = (0, _utils.getInteger)({
  56823. data: attributes.disable,
  56824. defaultValue: 0,
  56825. validate: x => x === 1
  56826. });
  56827. this.id = attributes.id || "";
  56828. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  56829. this.rid = attributes.rid || "";
  56830. this.use = attributes.use || "";
  56831. this.usehref = attributes.usehref || "";
  56832. }
  56833. }
  56834. class Stipple extends _xfa_object.XFAObject {
  56835. constructor(attributes) {
  56836. super(TEMPLATE_NS_ID, "stipple", true);
  56837. this.id = attributes.id || "";
  56838. this.rate = (0, _utils.getInteger)({
  56839. data: attributes.rate,
  56840. defaultValue: 50,
  56841. validate: x => x >= 0 && x <= 100
  56842. });
  56843. this.use = attributes.use || "";
  56844. this.usehref = attributes.usehref || "";
  56845. this.color = null;
  56846. this.extras = null;
  56847. }
  56848. [_xfa_object.$toStyle](bgColor) {
  56849. const alpha = this.rate / 100;
  56850. 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));
  56851. }
  56852. }
  56853. class Subform extends _xfa_object.XFAObject {
  56854. constructor(attributes) {
  56855. super(TEMPLATE_NS_ID, "subform", true);
  56856. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  56857. this.allowMacro = (0, _utils.getInteger)({
  56858. data: attributes.allowMacro,
  56859. defaultValue: 0,
  56860. validate: x => x === 1
  56861. });
  56862. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  56863. this.colSpan = (0, _utils.getInteger)({
  56864. data: attributes.colSpan,
  56865. defaultValue: 1,
  56866. validate: n => n >= 1 || n === -1
  56867. });
  56868. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  56869. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  56870. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56871. this.id = attributes.id || "";
  56872. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  56873. this.locale = attributes.locale || "";
  56874. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  56875. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  56876. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  56877. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  56878. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  56879. this.name = attributes.name || "";
  56880. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  56881. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56882. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  56883. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  56884. this.use = attributes.use || "";
  56885. this.usehref = attributes.usehref || "";
  56886. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  56887. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  56888. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  56889. this.assist = null;
  56890. this.bind = null;
  56891. this.bookend = null;
  56892. this.border = null;
  56893. this.break = null;
  56894. this.calculate = null;
  56895. this.desc = null;
  56896. this.extras = null;
  56897. this.keep = null;
  56898. this.margin = null;
  56899. this.occur = null;
  56900. this.overflow = null;
  56901. this.pageSet = null;
  56902. this.para = null;
  56903. this.traversal = null;
  56904. this.validate = null;
  56905. this.variables = null;
  56906. this.area = new _xfa_object.XFAObjectArray();
  56907. this.breakAfter = new _xfa_object.XFAObjectArray();
  56908. this.breakBefore = new _xfa_object.XFAObjectArray();
  56909. this.connect = new _xfa_object.XFAObjectArray();
  56910. this.draw = new _xfa_object.XFAObjectArray();
  56911. this.event = new _xfa_object.XFAObjectArray();
  56912. this.exObject = new _xfa_object.XFAObjectArray();
  56913. this.exclGroup = new _xfa_object.XFAObjectArray();
  56914. this.field = new _xfa_object.XFAObjectArray();
  56915. this.proto = new _xfa_object.XFAObjectArray();
  56916. this.setProperty = new _xfa_object.XFAObjectArray();
  56917. this.subform = new _xfa_object.XFAObjectArray();
  56918. this.subformSet = new _xfa_object.XFAObjectArray();
  56919. }
  56920. [_xfa_object.$getSubformParent]() {
  56921. const parent = this[_xfa_object.$getParent]();
  56922. if (parent instanceof SubformSet) {
  56923. return parent[_xfa_object.$getSubformParent]();
  56924. }
  56925. return parent;
  56926. }
  56927. [_xfa_object.$isBindable]() {
  56928. return true;
  56929. }
  56930. [_xfa_object.$isThereMoreWidth]() {
  56931. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  56932. }
  56933. *[_xfa_object.$getContainedChildren]() {
  56934. yield* getContainedChildren(this);
  56935. }
  56936. [_xfa_object.$flushHTML]() {
  56937. return (0, _layout.flushHTML)(this);
  56938. }
  56939. [_xfa_object.$addHTML](html, bbox) {
  56940. (0, _layout.addHTML)(this, html, bbox);
  56941. }
  56942. [_xfa_object.$getAvailableSpace]() {
  56943. return (0, _layout.getAvailableSpace)(this);
  56944. }
  56945. [_xfa_object.$isSplittable]() {
  56946. const parent = this[_xfa_object.$getSubformParent]();
  56947. if (!parent[_xfa_object.$isSplittable]()) {
  56948. return false;
  56949. }
  56950. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  56951. return this[_xfa_object.$extra]._isSplittable;
  56952. }
  56953. if (this.layout === "position" || this.layout.includes("row")) {
  56954. this[_xfa_object.$extra]._isSplittable = false;
  56955. return false;
  56956. }
  56957. if (this.keep && this.keep.intact !== "none") {
  56958. this[_xfa_object.$extra]._isSplittable = false;
  56959. return false;
  56960. }
  56961. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  56962. return false;
  56963. }
  56964. this[_xfa_object.$extra]._isSplittable = true;
  56965. return true;
  56966. }
  56967. [_xfa_object.$toHTML](availableSpace) {
  56968. setTabIndex(this);
  56969. if (this.break) {
  56970. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  56971. const node = new BreakAfter({
  56972. targetType: this.break.after,
  56973. target: this.break.afterTarget,
  56974. startNew: this.break.startNew.toString()
  56975. });
  56976. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56977. this[_xfa_object.$appendChild](node);
  56978. this.breakAfter.push(node);
  56979. }
  56980. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  56981. const node = new BreakBefore({
  56982. targetType: this.break.before,
  56983. target: this.break.beforeTarget,
  56984. startNew: this.break.startNew.toString()
  56985. });
  56986. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56987. this[_xfa_object.$appendChild](node);
  56988. this.breakBefore.push(node);
  56989. }
  56990. if (this.break.overflowTarget !== "") {
  56991. const node = new Overflow({
  56992. target: this.break.overflowTarget,
  56993. leader: this.break.overflowLeader,
  56994. trailer: this.break.overflowTrailer
  56995. });
  56996. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56997. this[_xfa_object.$appendChild](node);
  56998. this.overflow.push(node);
  56999. }
  57000. this[_xfa_object.$removeChild](this.break);
  57001. this.break = null;
  57002. }
  57003. if (this.presence === "hidden" || this.presence === "inactive") {
  57004. return _utils.HTMLResult.EMPTY;
  57005. }
  57006. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  57007. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  57008. }
  57009. if (this.breakBefore.children.length >= 1) {
  57010. const breakBefore = this.breakBefore.children[0];
  57011. if (handleBreak(breakBefore)) {
  57012. return _utils.HTMLResult.breakNode(breakBefore);
  57013. }
  57014. }
  57015. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  57016. return _utils.HTMLResult.EMPTY;
  57017. }
  57018. (0, _html_utils.fixDimensions)(this);
  57019. const children = [];
  57020. const attributes = {
  57021. id: this[_xfa_object.$uid],
  57022. class: []
  57023. };
  57024. (0, _html_utils.setAccess)(this, attributes.class);
  57025. if (!this[_xfa_object.$extra]) {
  57026. this[_xfa_object.$extra] = Object.create(null);
  57027. }
  57028. Object.assign(this[_xfa_object.$extra], {
  57029. children,
  57030. line: null,
  57031. attributes,
  57032. attempt: 0,
  57033. numberInLine: 0,
  57034. availableSpace: {
  57035. width: Math.min(this.w || Infinity, availableSpace.width),
  57036. height: Math.min(this.h || Infinity, availableSpace.height)
  57037. },
  57038. width: 0,
  57039. height: 0,
  57040. prevHeight: 0,
  57041. currentWidth: 0
  57042. });
  57043. const root = this[_xfa_object.$getTemplateRoot]();
  57044. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  57045. const isSplittable = this[_xfa_object.$isSplittable]();
  57046. if (!isSplittable) {
  57047. setFirstUnsplittable(this);
  57048. }
  57049. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  57050. return _utils.HTMLResult.FAILURE;
  57051. }
  57052. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  57053. if (this.layout.includes("row")) {
  57054. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  57055. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  57056. this[_xfa_object.$extra].columnWidths = columnWidths;
  57057. this[_xfa_object.$extra].currentColumn = 0;
  57058. }
  57059. }
  57060. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  57061. const classNames = ["xfaSubform"];
  57062. const cl = (0, _html_utils.layoutClass)(this);
  57063. if (cl) {
  57064. classNames.push(cl);
  57065. }
  57066. attributes.style = style;
  57067. attributes.class = classNames;
  57068. if (this.name) {
  57069. attributes.xfaName = this.name;
  57070. }
  57071. if (this.overflow) {
  57072. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57073. if (overflowExtra.addLeader) {
  57074. overflowExtra.addLeader = false;
  57075. handleOverflow(this, overflowExtra.leader, availableSpace);
  57076. }
  57077. }
  57078. this[_xfa_object.$pushPara]();
  57079. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  57080. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  57081. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  57082. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  57083. this[_xfa_object.$extra].numberInLine = 0;
  57084. }
  57085. const result = this[_xfa_object.$childrenToHTML]({
  57086. filter,
  57087. include: true
  57088. });
  57089. if (result.success) {
  57090. break;
  57091. }
  57092. if (result.isBreak()) {
  57093. this[_xfa_object.$popPara]();
  57094. return result;
  57095. }
  57096. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  57097. this[_xfa_object.$extra].attempt = maxRun;
  57098. break;
  57099. }
  57100. }
  57101. this[_xfa_object.$popPara]();
  57102. if (!isSplittable) {
  57103. unsetFirstUnsplittable(this);
  57104. }
  57105. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  57106. if (this[_xfa_object.$extra].attempt === maxRun) {
  57107. if (this.overflow) {
  57108. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  57109. }
  57110. if (!isSplittable) {
  57111. delete this[_xfa_object.$extra];
  57112. }
  57113. return _utils.HTMLResult.FAILURE;
  57114. }
  57115. if (this.overflow) {
  57116. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  57117. if (overflowExtra.addTrailer) {
  57118. overflowExtra.addTrailer = false;
  57119. handleOverflow(this, overflowExtra.trailer, availableSpace);
  57120. }
  57121. }
  57122. let marginH = 0;
  57123. let marginV = 0;
  57124. if (this.margin) {
  57125. marginH = this.margin.leftInset + this.margin.rightInset;
  57126. marginV = this.margin.topInset + this.margin.bottomInset;
  57127. }
  57128. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  57129. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  57130. const bbox = [this.x, this.y, width, height];
  57131. if (this.w === "") {
  57132. style.width = (0, _html_utils.measureToString)(width);
  57133. }
  57134. if (this.h === "") {
  57135. style.height = (0, _html_utils.measureToString)(height);
  57136. }
  57137. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  57138. return _utils.HTMLResult.EMPTY;
  57139. }
  57140. const html = {
  57141. name: "div",
  57142. attributes,
  57143. children
  57144. };
  57145. applyAssist(this, attributes);
  57146. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  57147. if (this.breakAfter.children.length >= 1) {
  57148. const breakAfter = this.breakAfter.children[0];
  57149. if (handleBreak(breakAfter)) {
  57150. this[_xfa_object.$extra].afterBreakAfter = result;
  57151. return _utils.HTMLResult.breakNode(breakAfter);
  57152. }
  57153. }
  57154. delete this[_xfa_object.$extra];
  57155. return result;
  57156. }
  57157. }
  57158. class SubformSet extends _xfa_object.XFAObject {
  57159. constructor(attributes) {
  57160. super(TEMPLATE_NS_ID, "subformSet", true);
  57161. this.id = attributes.id || "";
  57162. this.name = attributes.name || "";
  57163. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  57164. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57165. this.use = attributes.use || "";
  57166. this.usehref = attributes.usehref || "";
  57167. this.bookend = null;
  57168. this.break = null;
  57169. this.desc = null;
  57170. this.extras = null;
  57171. this.occur = null;
  57172. this.overflow = null;
  57173. this.breakAfter = new _xfa_object.XFAObjectArray();
  57174. this.breakBefore = new _xfa_object.XFAObjectArray();
  57175. this.subform = new _xfa_object.XFAObjectArray();
  57176. this.subformSet = new _xfa_object.XFAObjectArray();
  57177. }
  57178. *[_xfa_object.$getContainedChildren]() {
  57179. yield* getContainedChildren(this);
  57180. }
  57181. [_xfa_object.$getSubformParent]() {
  57182. let parent = this[_xfa_object.$getParent]();
  57183. while (!(parent instanceof Subform)) {
  57184. parent = parent[_xfa_object.$getParent]();
  57185. }
  57186. return parent;
  57187. }
  57188. [_xfa_object.$isBindable]() {
  57189. return true;
  57190. }
  57191. }
  57192. class SubjectDN extends _xfa_object.ContentObject {
  57193. constructor(attributes) {
  57194. super(TEMPLATE_NS_ID, "subjectDN");
  57195. this.delimiter = attributes.delimiter || ",";
  57196. this.id = attributes.id || "";
  57197. this.name = attributes.name || "";
  57198. this.use = attributes.use || "";
  57199. this.usehref = attributes.usehref || "";
  57200. }
  57201. [_xfa_object.$finalize]() {
  57202. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  57203. kv = kv.split("=", 2);
  57204. kv[0] = kv[0].trim();
  57205. return kv;
  57206. }));
  57207. }
  57208. }
  57209. class SubjectDNs extends _xfa_object.XFAObject {
  57210. constructor(attributes) {
  57211. super(TEMPLATE_NS_ID, "subjectDNs", true);
  57212. this.id = attributes.id || "";
  57213. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57214. this.use = attributes.use || "";
  57215. this.usehref = attributes.usehref || "";
  57216. this.subjectDN = new _xfa_object.XFAObjectArray();
  57217. }
  57218. }
  57219. class Submit extends _xfa_object.XFAObject {
  57220. constructor(attributes) {
  57221. super(TEMPLATE_NS_ID, "submit", true);
  57222. this.embedPDF = (0, _utils.getInteger)({
  57223. data: attributes.embedPDF,
  57224. defaultValue: 0,
  57225. validate: x => x === 1
  57226. });
  57227. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  57228. this.id = attributes.id || "";
  57229. this.target = attributes.target || "";
  57230. this.textEncoding = (0, _utils.getKeyword)({
  57231. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  57232. defaultValue: "",
  57233. 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}/)
  57234. });
  57235. this.use = attributes.use || "";
  57236. this.usehref = attributes.usehref || "";
  57237. this.xdpContent = attributes.xdpContent || "";
  57238. this.encrypt = null;
  57239. this.encryptData = new _xfa_object.XFAObjectArray();
  57240. this.signData = new _xfa_object.XFAObjectArray();
  57241. }
  57242. }
  57243. class Template extends _xfa_object.XFAObject {
  57244. constructor(attributes) {
  57245. super(TEMPLATE_NS_ID, "template", true);
  57246. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  57247. this.extras = null;
  57248. this.subform = new _xfa_object.XFAObjectArray();
  57249. }
  57250. [_xfa_object.$finalize]() {
  57251. if (this.subform.children.length === 0) {
  57252. (0, _util.warn)("XFA - No subforms in template node.");
  57253. }
  57254. if (this.subform.children.length >= 2) {
  57255. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  57256. }
  57257. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  57258. }
  57259. [_xfa_object.$isSplittable]() {
  57260. return true;
  57261. }
  57262. [_xfa_object.$searchNode](expr, container) {
  57263. if (expr.startsWith("#")) {
  57264. return [this[_xfa_object.$ids].get(expr.slice(1))];
  57265. }
  57266. return (0, _som.searchNode)(this, container, expr, true, true);
  57267. }
  57268. *[_xfa_object.$toPages]() {
  57269. if (!this.subform.children.length) {
  57270. return _utils.HTMLResult.success({
  57271. name: "div",
  57272. children: []
  57273. });
  57274. }
  57275. this[_xfa_object.$extra] = {
  57276. overflowNode: null,
  57277. firstUnsplittable: null,
  57278. currentContentArea: null,
  57279. currentPageArea: null,
  57280. noLayoutFailure: false,
  57281. pageNumber: 1,
  57282. pagePosition: "first",
  57283. oddOrEven: "odd",
  57284. blankOrNotBlank: "nonBlank",
  57285. paraStack: []
  57286. };
  57287. const root = this.subform.children[0];
  57288. root.pageSet[_xfa_object.$cleanPage]();
  57289. const pageAreas = root.pageSet.pageArea.children;
  57290. const mainHtml = {
  57291. name: "div",
  57292. children: []
  57293. };
  57294. let pageArea = null;
  57295. let breakBefore = null;
  57296. let breakBeforeTarget = null;
  57297. if (root.breakBefore.children.length >= 1) {
  57298. breakBefore = root.breakBefore.children[0];
  57299. breakBeforeTarget = breakBefore.target;
  57300. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  57301. breakBefore = root.subform.children[0].breakBefore.children[0];
  57302. breakBeforeTarget = breakBefore.target;
  57303. } else if (root.break && root.break.beforeTarget) {
  57304. breakBefore = root.break;
  57305. breakBeforeTarget = breakBefore.beforeTarget;
  57306. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  57307. breakBefore = root.subform.children[0].break;
  57308. breakBeforeTarget = breakBefore.beforeTarget;
  57309. }
  57310. if (breakBefore) {
  57311. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  57312. if (target instanceof PageArea) {
  57313. pageArea = target;
  57314. breakBefore[_xfa_object.$extra] = {};
  57315. }
  57316. }
  57317. if (!pageArea) {
  57318. pageArea = pageAreas[0];
  57319. }
  57320. pageArea[_xfa_object.$extra] = {
  57321. numberOfUse: 1
  57322. };
  57323. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  57324. pageAreaParent[_xfa_object.$extra] = {
  57325. numberOfUse: 1,
  57326. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  57327. pageSetIndex: 0
  57328. };
  57329. let targetPageArea;
  57330. let leader = null;
  57331. let trailer = null;
  57332. let hasSomething = true;
  57333. let hasSomethingCounter = 0;
  57334. let startIndex = 0;
  57335. while (true) {
  57336. if (!hasSomething) {
  57337. mainHtml.children.pop();
  57338. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  57339. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  57340. return mainHtml;
  57341. }
  57342. } else {
  57343. hasSomethingCounter = 0;
  57344. }
  57345. targetPageArea = null;
  57346. this[_xfa_object.$extra].currentPageArea = pageArea;
  57347. const page = pageArea[_xfa_object.$toHTML]().html;
  57348. mainHtml.children.push(page);
  57349. if (leader) {
  57350. this[_xfa_object.$extra].noLayoutFailure = true;
  57351. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57352. leader = null;
  57353. }
  57354. if (trailer) {
  57355. this[_xfa_object.$extra].noLayoutFailure = true;
  57356. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  57357. trailer = null;
  57358. }
  57359. const contentAreas = pageArea.contentArea.children;
  57360. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  57361. hasSomething = false;
  57362. this[_xfa_object.$extra].firstUnsplittable = null;
  57363. this[_xfa_object.$extra].noLayoutFailure = false;
  57364. const flush = index => {
  57365. const html = root[_xfa_object.$flushHTML]();
  57366. if (html) {
  57367. hasSomething = hasSomething || html.children && html.children.length !== 0;
  57368. htmlContentAreas[index].children.push(html);
  57369. }
  57370. };
  57371. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  57372. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  57373. const space = {
  57374. width: contentArea.w,
  57375. height: contentArea.h
  57376. };
  57377. startIndex = 0;
  57378. if (leader) {
  57379. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  57380. leader = null;
  57381. }
  57382. if (trailer) {
  57383. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  57384. trailer = null;
  57385. }
  57386. const html = root[_xfa_object.$toHTML](space);
  57387. if (html.success) {
  57388. if (html.html) {
  57389. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  57390. htmlContentAreas[i].children.push(html.html);
  57391. } else if (!hasSomething && mainHtml.children.length > 1) {
  57392. mainHtml.children.pop();
  57393. }
  57394. return mainHtml;
  57395. }
  57396. if (html.isBreak()) {
  57397. const node = html.breakNode;
  57398. flush(i);
  57399. if (node.targetType === "auto") {
  57400. continue;
  57401. }
  57402. if (node.leader) {
  57403. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  57404. leader = leader ? leader[0] : null;
  57405. }
  57406. if (node.trailer) {
  57407. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  57408. trailer = trailer ? trailer[0] : null;
  57409. }
  57410. if (node.targetType === "pageArea") {
  57411. targetPageArea = node[_xfa_object.$extra].target;
  57412. i = Infinity;
  57413. } else if (!node[_xfa_object.$extra].target) {
  57414. i = node[_xfa_object.$extra].index;
  57415. } else {
  57416. targetPageArea = node[_xfa_object.$extra].target;
  57417. startIndex = node[_xfa_object.$extra].index + 1;
  57418. i = Infinity;
  57419. }
  57420. continue;
  57421. }
  57422. if (this[_xfa_object.$extra].overflowNode) {
  57423. const node = this[_xfa_object.$extra].overflowNode;
  57424. this[_xfa_object.$extra].overflowNode = null;
  57425. const overflowExtra = node[_xfa_object.$getExtra]();
  57426. const target = overflowExtra.target;
  57427. overflowExtra.addLeader = overflowExtra.leader !== null;
  57428. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  57429. flush(i);
  57430. const currentIndex = i;
  57431. i = Infinity;
  57432. if (target instanceof PageArea) {
  57433. targetPageArea = target;
  57434. } else if (target instanceof ContentArea) {
  57435. const index = contentAreas.indexOf(target);
  57436. if (index !== -1) {
  57437. if (index > currentIndex) {
  57438. i = index - 1;
  57439. } else {
  57440. startIndex = index;
  57441. }
  57442. } else {
  57443. targetPageArea = target[_xfa_object.$getParent]();
  57444. startIndex = targetPageArea.contentArea.children.indexOf(target);
  57445. }
  57446. }
  57447. continue;
  57448. }
  57449. flush(i);
  57450. }
  57451. this[_xfa_object.$extra].pageNumber += 1;
  57452. if (targetPageArea) {
  57453. if (targetPageArea[_xfa_object.$isUsable]()) {
  57454. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  57455. } else {
  57456. targetPageArea = null;
  57457. }
  57458. }
  57459. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  57460. yield null;
  57461. }
  57462. }
  57463. }
  57464. exports.Template = Template;
  57465. class Text extends _xfa_object.ContentObject {
  57466. constructor(attributes) {
  57467. super(TEMPLATE_NS_ID, "text");
  57468. this.id = attributes.id || "";
  57469. this.maxChars = (0, _utils.getInteger)({
  57470. data: attributes.maxChars,
  57471. defaultValue: 0,
  57472. validate: x => x >= 0
  57473. });
  57474. this.name = attributes.name || "";
  57475. this.rid = attributes.rid || "";
  57476. this.use = attributes.use || "";
  57477. this.usehref = attributes.usehref || "";
  57478. }
  57479. [_xfa_object.$acceptWhitespace]() {
  57480. return true;
  57481. }
  57482. [_xfa_object.$onChild](child) {
  57483. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  57484. this[_xfa_object.$content] = child;
  57485. return true;
  57486. }
  57487. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  57488. return false;
  57489. }
  57490. [_xfa_object.$onText](str) {
  57491. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  57492. return;
  57493. }
  57494. super[_xfa_object.$onText](str);
  57495. }
  57496. [_xfa_object.$finalize]() {
  57497. if (typeof this[_xfa_object.$content] === "string") {
  57498. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  57499. }
  57500. }
  57501. [_xfa_object.$getExtra]() {
  57502. if (typeof this[_xfa_object.$content] === "string") {
  57503. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  57504. if (line) {
  57505. acc.push(line);
  57506. }
  57507. return acc;
  57508. }, []).join("\n");
  57509. }
  57510. return this[_xfa_object.$content][_xfa_object.$text]();
  57511. }
  57512. [_xfa_object.$toHTML](availableSpace) {
  57513. if (typeof this[_xfa_object.$content] === "string") {
  57514. const html = valueToHtml(this[_xfa_object.$content]).html;
  57515. if (this[_xfa_object.$content].includes("\u2029")) {
  57516. html.name = "div";
  57517. html.children = [];
  57518. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  57519. acc.push({
  57520. name: "span",
  57521. value: line
  57522. }, {
  57523. name: "br"
  57524. });
  57525. return acc;
  57526. }, [])).forEach(lines => {
  57527. html.children.push({
  57528. name: "p",
  57529. children: lines
  57530. });
  57531. });
  57532. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  57533. html.name = "div";
  57534. html.children = [];
  57535. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  57536. html.children.push({
  57537. name: "span",
  57538. value: line
  57539. }, {
  57540. name: "br"
  57541. });
  57542. });
  57543. }
  57544. return _utils.HTMLResult.success(html);
  57545. }
  57546. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  57547. }
  57548. }
  57549. exports.Text = Text;
  57550. class TextEdit extends _xfa_object.XFAObject {
  57551. constructor(attributes) {
  57552. super(TEMPLATE_NS_ID, "textEdit", true);
  57553. this.allowRichText = (0, _utils.getInteger)({
  57554. data: attributes.allowRichText,
  57555. defaultValue: 0,
  57556. validate: x => x === 1
  57557. });
  57558. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  57559. this.id = attributes.id || "";
  57560. this.multiLine = (0, _utils.getInteger)({
  57561. data: attributes.multiLine,
  57562. defaultValue: "",
  57563. validate: x => x === 0 || x === 1
  57564. });
  57565. this.use = attributes.use || "";
  57566. this.usehref = attributes.usehref || "";
  57567. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  57568. this.border = null;
  57569. this.comb = null;
  57570. this.extras = null;
  57571. this.margin = null;
  57572. }
  57573. [_xfa_object.$toHTML](availableSpace) {
  57574. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  57575. let html;
  57576. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57577. if (this.multiLine === "") {
  57578. this.multiLine = field instanceof Draw ? 1 : 0;
  57579. }
  57580. if (this.multiLine === 1) {
  57581. html = {
  57582. name: "textarea",
  57583. attributes: {
  57584. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57585. fieldId: field[_xfa_object.$uid],
  57586. class: ["xfaTextfield"],
  57587. style,
  57588. "aria-label": ariaLabel(field),
  57589. "aria-required": false
  57590. }
  57591. };
  57592. } else {
  57593. html = {
  57594. name: "input",
  57595. attributes: {
  57596. type: "text",
  57597. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57598. fieldId: field[_xfa_object.$uid],
  57599. class: ["xfaTextfield"],
  57600. style,
  57601. "aria-label": ariaLabel(field),
  57602. "aria-required": false
  57603. }
  57604. };
  57605. }
  57606. if (isRequired(field)) {
  57607. html.attributes["aria-required"] = true;
  57608. html.attributes.required = true;
  57609. }
  57610. return _utils.HTMLResult.success({
  57611. name: "label",
  57612. attributes: {
  57613. class: ["xfaLabel"]
  57614. },
  57615. children: [html]
  57616. });
  57617. }
  57618. }
  57619. class Time extends _xfa_object.StringObject {
  57620. constructor(attributes) {
  57621. super(TEMPLATE_NS_ID, "time");
  57622. this.id = attributes.id || "";
  57623. this.name = attributes.name || "";
  57624. this.use = attributes.use || "";
  57625. this.usehref = attributes.usehref || "";
  57626. }
  57627. [_xfa_object.$finalize]() {
  57628. const date = this[_xfa_object.$content].trim();
  57629. this[_xfa_object.$content] = date ? new Date(date) : null;
  57630. }
  57631. [_xfa_object.$toHTML](availableSpace) {
  57632. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  57633. }
  57634. }
  57635. class TimeStamp extends _xfa_object.XFAObject {
  57636. constructor(attributes) {
  57637. super(TEMPLATE_NS_ID, "timeStamp");
  57638. this.id = attributes.id || "";
  57639. this.server = attributes.server || "";
  57640. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  57641. this.use = attributes.use || "";
  57642. this.usehref = attributes.usehref || "";
  57643. }
  57644. }
  57645. class ToolTip extends _xfa_object.StringObject {
  57646. constructor(attributes) {
  57647. super(TEMPLATE_NS_ID, "toolTip");
  57648. this.id = attributes.id || "";
  57649. this.rid = attributes.rid || "";
  57650. this.use = attributes.use || "";
  57651. this.usehref = attributes.usehref || "";
  57652. }
  57653. }
  57654. class Traversal extends _xfa_object.XFAObject {
  57655. constructor(attributes) {
  57656. super(TEMPLATE_NS_ID, "traversal", true);
  57657. this.id = attributes.id || "";
  57658. this.use = attributes.use || "";
  57659. this.usehref = attributes.usehref || "";
  57660. this.extras = null;
  57661. this.traverse = new _xfa_object.XFAObjectArray();
  57662. }
  57663. }
  57664. class Traverse extends _xfa_object.XFAObject {
  57665. constructor(attributes) {
  57666. super(TEMPLATE_NS_ID, "traverse", true);
  57667. this.id = attributes.id || "";
  57668. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  57669. this.ref = attributes.ref || "";
  57670. this.use = attributes.use || "";
  57671. this.usehref = attributes.usehref || "";
  57672. this.extras = null;
  57673. this.script = null;
  57674. }
  57675. get name() {
  57676. return this.operation;
  57677. }
  57678. [_xfa_object.$isTransparent]() {
  57679. return false;
  57680. }
  57681. }
  57682. class Ui extends _xfa_object.XFAObject {
  57683. constructor(attributes) {
  57684. super(TEMPLATE_NS_ID, "ui", true);
  57685. this.id = attributes.id || "";
  57686. this.use = attributes.use || "";
  57687. this.usehref = attributes.usehref || "";
  57688. this.extras = null;
  57689. this.picture = null;
  57690. this.barcode = null;
  57691. this.button = null;
  57692. this.checkButton = null;
  57693. this.choiceList = null;
  57694. this.dateTimeEdit = null;
  57695. this.defaultUi = null;
  57696. this.imageEdit = null;
  57697. this.numericEdit = null;
  57698. this.passwordEdit = null;
  57699. this.signature = null;
  57700. this.textEdit = null;
  57701. }
  57702. [_xfa_object.$getExtra]() {
  57703. if (this[_xfa_object.$extra] === undefined) {
  57704. for (const name of Object.getOwnPropertyNames(this)) {
  57705. if (name === "extras" || name === "picture") {
  57706. continue;
  57707. }
  57708. const obj = this[name];
  57709. if (!(obj instanceof _xfa_object.XFAObject)) {
  57710. continue;
  57711. }
  57712. this[_xfa_object.$extra] = obj;
  57713. return obj;
  57714. }
  57715. this[_xfa_object.$extra] = null;
  57716. }
  57717. return this[_xfa_object.$extra];
  57718. }
  57719. [_xfa_object.$toHTML](availableSpace) {
  57720. const obj = this[_xfa_object.$getExtra]();
  57721. if (obj) {
  57722. return obj[_xfa_object.$toHTML](availableSpace);
  57723. }
  57724. return _utils.HTMLResult.EMPTY;
  57725. }
  57726. }
  57727. class Validate extends _xfa_object.XFAObject {
  57728. constructor(attributes) {
  57729. super(TEMPLATE_NS_ID, "validate", true);
  57730. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  57731. this.id = attributes.id || "";
  57732. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  57733. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  57734. this.use = attributes.use || "";
  57735. this.usehref = attributes.usehref || "";
  57736. this.extras = null;
  57737. this.message = null;
  57738. this.picture = null;
  57739. this.script = null;
  57740. }
  57741. }
  57742. class Value extends _xfa_object.XFAObject {
  57743. constructor(attributes) {
  57744. super(TEMPLATE_NS_ID, "value", true);
  57745. this.id = attributes.id || "";
  57746. this.override = (0, _utils.getInteger)({
  57747. data: attributes.override,
  57748. defaultValue: 0,
  57749. validate: x => x === 1
  57750. });
  57751. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57752. this.use = attributes.use || "";
  57753. this.usehref = attributes.usehref || "";
  57754. this.arc = null;
  57755. this.boolean = null;
  57756. this.date = null;
  57757. this.dateTime = null;
  57758. this.decimal = null;
  57759. this.exData = null;
  57760. this.float = null;
  57761. this.image = null;
  57762. this.integer = null;
  57763. this.line = null;
  57764. this.rectangle = null;
  57765. this.text = null;
  57766. this.time = null;
  57767. }
  57768. [_xfa_object.$setValue](value) {
  57769. const parent = this[_xfa_object.$getParent]();
  57770. if (parent instanceof Field) {
  57771. if (parent.ui && parent.ui.imageEdit) {
  57772. if (!this.image) {
  57773. this.image = new Image({});
  57774. this[_xfa_object.$appendChild](this.image);
  57775. }
  57776. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  57777. return;
  57778. }
  57779. }
  57780. const valueName = value[_xfa_object.$nodeName];
  57781. if (this[valueName] !== null) {
  57782. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  57783. return;
  57784. }
  57785. for (const name of Object.getOwnPropertyNames(this)) {
  57786. const obj = this[name];
  57787. if (obj instanceof _xfa_object.XFAObject) {
  57788. this[name] = null;
  57789. this[_xfa_object.$removeChild](obj);
  57790. }
  57791. }
  57792. this[value[_xfa_object.$nodeName]] = value;
  57793. this[_xfa_object.$appendChild](value);
  57794. }
  57795. [_xfa_object.$text]() {
  57796. if (this.exData) {
  57797. if (typeof this.exData[_xfa_object.$content] === "string") {
  57798. return this.exData[_xfa_object.$content].trim();
  57799. }
  57800. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  57801. }
  57802. for (const name of Object.getOwnPropertyNames(this)) {
  57803. if (name === "image") {
  57804. continue;
  57805. }
  57806. const obj = this[name];
  57807. if (obj instanceof _xfa_object.XFAObject) {
  57808. return (obj[_xfa_object.$content] || "").toString().trim();
  57809. }
  57810. }
  57811. return null;
  57812. }
  57813. [_xfa_object.$toHTML](availableSpace) {
  57814. for (const name of Object.getOwnPropertyNames(this)) {
  57815. const obj = this[name];
  57816. if (!(obj instanceof _xfa_object.XFAObject)) {
  57817. continue;
  57818. }
  57819. return obj[_xfa_object.$toHTML](availableSpace);
  57820. }
  57821. return _utils.HTMLResult.EMPTY;
  57822. }
  57823. }
  57824. exports.Value = Value;
  57825. class Variables extends _xfa_object.XFAObject {
  57826. constructor(attributes) {
  57827. super(TEMPLATE_NS_ID, "variables", true);
  57828. this.id = attributes.id || "";
  57829. this.use = attributes.use || "";
  57830. this.usehref = attributes.usehref || "";
  57831. this.boolean = new _xfa_object.XFAObjectArray();
  57832. this.date = new _xfa_object.XFAObjectArray();
  57833. this.dateTime = new _xfa_object.XFAObjectArray();
  57834. this.decimal = new _xfa_object.XFAObjectArray();
  57835. this.exData = new _xfa_object.XFAObjectArray();
  57836. this.float = new _xfa_object.XFAObjectArray();
  57837. this.image = new _xfa_object.XFAObjectArray();
  57838. this.integer = new _xfa_object.XFAObjectArray();
  57839. this.manifest = new _xfa_object.XFAObjectArray();
  57840. this.script = new _xfa_object.XFAObjectArray();
  57841. this.text = new _xfa_object.XFAObjectArray();
  57842. this.time = new _xfa_object.XFAObjectArray();
  57843. }
  57844. [_xfa_object.$isTransparent]() {
  57845. return true;
  57846. }
  57847. }
  57848. class TemplateNamespace {
  57849. static [_namespaces.$buildXFAObject](name, attributes) {
  57850. if (TemplateNamespace.hasOwnProperty(name)) {
  57851. const node = TemplateNamespace[name](attributes);
  57852. node[_xfa_object.$setSetAttributes](attributes);
  57853. return node;
  57854. }
  57855. return undefined;
  57856. }
  57857. static appearanceFilter(attrs) {
  57858. return new AppearanceFilter(attrs);
  57859. }
  57860. static arc(attrs) {
  57861. return new Arc(attrs);
  57862. }
  57863. static area(attrs) {
  57864. return new Area(attrs);
  57865. }
  57866. static assist(attrs) {
  57867. return new Assist(attrs);
  57868. }
  57869. static barcode(attrs) {
  57870. return new Barcode(attrs);
  57871. }
  57872. static bind(attrs) {
  57873. return new Bind(attrs);
  57874. }
  57875. static bindItems(attrs) {
  57876. return new BindItems(attrs);
  57877. }
  57878. static bookend(attrs) {
  57879. return new Bookend(attrs);
  57880. }
  57881. static boolean(attrs) {
  57882. return new BooleanElement(attrs);
  57883. }
  57884. static border(attrs) {
  57885. return new Border(attrs);
  57886. }
  57887. static break(attrs) {
  57888. return new Break(attrs);
  57889. }
  57890. static breakAfter(attrs) {
  57891. return new BreakAfter(attrs);
  57892. }
  57893. static breakBefore(attrs) {
  57894. return new BreakBefore(attrs);
  57895. }
  57896. static button(attrs) {
  57897. return new Button(attrs);
  57898. }
  57899. static calculate(attrs) {
  57900. return new Calculate(attrs);
  57901. }
  57902. static caption(attrs) {
  57903. return new Caption(attrs);
  57904. }
  57905. static certificate(attrs) {
  57906. return new Certificate(attrs);
  57907. }
  57908. static certificates(attrs) {
  57909. return new Certificates(attrs);
  57910. }
  57911. static checkButton(attrs) {
  57912. return new CheckButton(attrs);
  57913. }
  57914. static choiceList(attrs) {
  57915. return new ChoiceList(attrs);
  57916. }
  57917. static color(attrs) {
  57918. return new Color(attrs);
  57919. }
  57920. static comb(attrs) {
  57921. return new Comb(attrs);
  57922. }
  57923. static connect(attrs) {
  57924. return new Connect(attrs);
  57925. }
  57926. static contentArea(attrs) {
  57927. return new ContentArea(attrs);
  57928. }
  57929. static corner(attrs) {
  57930. return new Corner(attrs);
  57931. }
  57932. static date(attrs) {
  57933. return new DateElement(attrs);
  57934. }
  57935. static dateTime(attrs) {
  57936. return new DateTime(attrs);
  57937. }
  57938. static dateTimeEdit(attrs) {
  57939. return new DateTimeEdit(attrs);
  57940. }
  57941. static decimal(attrs) {
  57942. return new Decimal(attrs);
  57943. }
  57944. static defaultUi(attrs) {
  57945. return new DefaultUi(attrs);
  57946. }
  57947. static desc(attrs) {
  57948. return new Desc(attrs);
  57949. }
  57950. static digestMethod(attrs) {
  57951. return new DigestMethod(attrs);
  57952. }
  57953. static digestMethods(attrs) {
  57954. return new DigestMethods(attrs);
  57955. }
  57956. static draw(attrs) {
  57957. return new Draw(attrs);
  57958. }
  57959. static edge(attrs) {
  57960. return new Edge(attrs);
  57961. }
  57962. static encoding(attrs) {
  57963. return new Encoding(attrs);
  57964. }
  57965. static encodings(attrs) {
  57966. return new Encodings(attrs);
  57967. }
  57968. static encrypt(attrs) {
  57969. return new Encrypt(attrs);
  57970. }
  57971. static encryptData(attrs) {
  57972. return new EncryptData(attrs);
  57973. }
  57974. static encryption(attrs) {
  57975. return new Encryption(attrs);
  57976. }
  57977. static encryptionMethod(attrs) {
  57978. return new EncryptionMethod(attrs);
  57979. }
  57980. static encryptionMethods(attrs) {
  57981. return new EncryptionMethods(attrs);
  57982. }
  57983. static event(attrs) {
  57984. return new Event(attrs);
  57985. }
  57986. static exData(attrs) {
  57987. return new ExData(attrs);
  57988. }
  57989. static exObject(attrs) {
  57990. return new ExObject(attrs);
  57991. }
  57992. static exclGroup(attrs) {
  57993. return new ExclGroup(attrs);
  57994. }
  57995. static execute(attrs) {
  57996. return new Execute(attrs);
  57997. }
  57998. static extras(attrs) {
  57999. return new Extras(attrs);
  58000. }
  58001. static field(attrs) {
  58002. return new Field(attrs);
  58003. }
  58004. static fill(attrs) {
  58005. return new Fill(attrs);
  58006. }
  58007. static filter(attrs) {
  58008. return new Filter(attrs);
  58009. }
  58010. static float(attrs) {
  58011. return new Float(attrs);
  58012. }
  58013. static font(attrs) {
  58014. return new Font(attrs);
  58015. }
  58016. static format(attrs) {
  58017. return new Format(attrs);
  58018. }
  58019. static handler(attrs) {
  58020. return new Handler(attrs);
  58021. }
  58022. static hyphenation(attrs) {
  58023. return new Hyphenation(attrs);
  58024. }
  58025. static image(attrs) {
  58026. return new Image(attrs);
  58027. }
  58028. static imageEdit(attrs) {
  58029. return new ImageEdit(attrs);
  58030. }
  58031. static integer(attrs) {
  58032. return new Integer(attrs);
  58033. }
  58034. static issuers(attrs) {
  58035. return new Issuers(attrs);
  58036. }
  58037. static items(attrs) {
  58038. return new Items(attrs);
  58039. }
  58040. static keep(attrs) {
  58041. return new Keep(attrs);
  58042. }
  58043. static keyUsage(attrs) {
  58044. return new KeyUsage(attrs);
  58045. }
  58046. static line(attrs) {
  58047. return new Line(attrs);
  58048. }
  58049. static linear(attrs) {
  58050. return new Linear(attrs);
  58051. }
  58052. static lockDocument(attrs) {
  58053. return new LockDocument(attrs);
  58054. }
  58055. static manifest(attrs) {
  58056. return new Manifest(attrs);
  58057. }
  58058. static margin(attrs) {
  58059. return new Margin(attrs);
  58060. }
  58061. static mdp(attrs) {
  58062. return new Mdp(attrs);
  58063. }
  58064. static medium(attrs) {
  58065. return new Medium(attrs);
  58066. }
  58067. static message(attrs) {
  58068. return new Message(attrs);
  58069. }
  58070. static numericEdit(attrs) {
  58071. return new NumericEdit(attrs);
  58072. }
  58073. static occur(attrs) {
  58074. return new Occur(attrs);
  58075. }
  58076. static oid(attrs) {
  58077. return new Oid(attrs);
  58078. }
  58079. static oids(attrs) {
  58080. return new Oids(attrs);
  58081. }
  58082. static overflow(attrs) {
  58083. return new Overflow(attrs);
  58084. }
  58085. static pageArea(attrs) {
  58086. return new PageArea(attrs);
  58087. }
  58088. static pageSet(attrs) {
  58089. return new PageSet(attrs);
  58090. }
  58091. static para(attrs) {
  58092. return new Para(attrs);
  58093. }
  58094. static passwordEdit(attrs) {
  58095. return new PasswordEdit(attrs);
  58096. }
  58097. static pattern(attrs) {
  58098. return new Pattern(attrs);
  58099. }
  58100. static picture(attrs) {
  58101. return new Picture(attrs);
  58102. }
  58103. static proto(attrs) {
  58104. return new Proto(attrs);
  58105. }
  58106. static radial(attrs) {
  58107. return new Radial(attrs);
  58108. }
  58109. static reason(attrs) {
  58110. return new Reason(attrs);
  58111. }
  58112. static reasons(attrs) {
  58113. return new Reasons(attrs);
  58114. }
  58115. static rectangle(attrs) {
  58116. return new Rectangle(attrs);
  58117. }
  58118. static ref(attrs) {
  58119. return new RefElement(attrs);
  58120. }
  58121. static script(attrs) {
  58122. return new Script(attrs);
  58123. }
  58124. static setProperty(attrs) {
  58125. return new SetProperty(attrs);
  58126. }
  58127. static signData(attrs) {
  58128. return new SignData(attrs);
  58129. }
  58130. static signature(attrs) {
  58131. return new Signature(attrs);
  58132. }
  58133. static signing(attrs) {
  58134. return new Signing(attrs);
  58135. }
  58136. static solid(attrs) {
  58137. return new Solid(attrs);
  58138. }
  58139. static speak(attrs) {
  58140. return new Speak(attrs);
  58141. }
  58142. static stipple(attrs) {
  58143. return new Stipple(attrs);
  58144. }
  58145. static subform(attrs) {
  58146. return new Subform(attrs);
  58147. }
  58148. static subformSet(attrs) {
  58149. return new SubformSet(attrs);
  58150. }
  58151. static subjectDN(attrs) {
  58152. return new SubjectDN(attrs);
  58153. }
  58154. static subjectDNs(attrs) {
  58155. return new SubjectDNs(attrs);
  58156. }
  58157. static submit(attrs) {
  58158. return new Submit(attrs);
  58159. }
  58160. static template(attrs) {
  58161. return new Template(attrs);
  58162. }
  58163. static text(attrs) {
  58164. return new Text(attrs);
  58165. }
  58166. static textEdit(attrs) {
  58167. return new TextEdit(attrs);
  58168. }
  58169. static time(attrs) {
  58170. return new Time(attrs);
  58171. }
  58172. static timeStamp(attrs) {
  58173. return new TimeStamp(attrs);
  58174. }
  58175. static toolTip(attrs) {
  58176. return new ToolTip(attrs);
  58177. }
  58178. static traversal(attrs) {
  58179. return new Traversal(attrs);
  58180. }
  58181. static traverse(attrs) {
  58182. return new Traverse(attrs);
  58183. }
  58184. static ui(attrs) {
  58185. return new Ui(attrs);
  58186. }
  58187. static validate(attrs) {
  58188. return new Validate(attrs);
  58189. }
  58190. static value(attrs) {
  58191. return new Value(attrs);
  58192. }
  58193. static variables(attrs) {
  58194. return new Variables(attrs);
  58195. }
  58196. }
  58197. exports.TemplateNamespace = TemplateNamespace;
  58198. /***/ }),
  58199. /* 83 */
  58200. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58201. Object.defineProperty(exports, "__esModule", ({
  58202. value: true
  58203. }));
  58204. exports.addHTML = addHTML;
  58205. exports.checkDimensions = checkDimensions;
  58206. exports.flushHTML = flushHTML;
  58207. exports.getAvailableSpace = getAvailableSpace;
  58208. var _xfa_object = __w_pdfjs_require__(77);
  58209. var _html_utils = __w_pdfjs_require__(84);
  58210. function createLine(node, children) {
  58211. return {
  58212. name: "div",
  58213. attributes: {
  58214. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  58215. },
  58216. children
  58217. };
  58218. }
  58219. function flushHTML(node) {
  58220. if (!node[_xfa_object.$extra]) {
  58221. return null;
  58222. }
  58223. const attributes = node[_xfa_object.$extra].attributes;
  58224. const html = {
  58225. name: "div",
  58226. attributes,
  58227. children: node[_xfa_object.$extra].children
  58228. };
  58229. if (node[_xfa_object.$extra].failingNode) {
  58230. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  58231. if (htmlFromFailing) {
  58232. if (node.layout.endsWith("-tb")) {
  58233. html.children.push(createLine(node, [htmlFromFailing]));
  58234. } else {
  58235. html.children.push(htmlFromFailing);
  58236. }
  58237. }
  58238. }
  58239. if (html.children.length === 0) {
  58240. return null;
  58241. }
  58242. return html;
  58243. }
  58244. function addHTML(node, html, bbox) {
  58245. const extra = node[_xfa_object.$extra];
  58246. const availableSpace = extra.availableSpace;
  58247. const [x, y, w, h] = bbox;
  58248. switch (node.layout) {
  58249. case "position":
  58250. {
  58251. extra.width = Math.max(extra.width, x + w);
  58252. extra.height = Math.max(extra.height, y + h);
  58253. extra.children.push(html);
  58254. break;
  58255. }
  58256. case "lr-tb":
  58257. case "rl-tb":
  58258. if (!extra.line || extra.attempt === 1) {
  58259. extra.line = createLine(node, []);
  58260. extra.children.push(extra.line);
  58261. extra.numberInLine = 0;
  58262. }
  58263. extra.numberInLine += 1;
  58264. extra.line.children.push(html);
  58265. if (extra.attempt === 0) {
  58266. extra.currentWidth += w;
  58267. extra.height = Math.max(extra.height, extra.prevHeight + h);
  58268. } else {
  58269. extra.currentWidth = w;
  58270. extra.prevHeight = extra.height;
  58271. extra.height += h;
  58272. extra.attempt = 0;
  58273. }
  58274. extra.width = Math.max(extra.width, extra.currentWidth);
  58275. break;
  58276. case "rl-row":
  58277. case "row":
  58278. {
  58279. extra.children.push(html);
  58280. extra.width += w;
  58281. extra.height = Math.max(extra.height, h);
  58282. const height = (0, _html_utils.measureToString)(extra.height);
  58283. for (const child of extra.children) {
  58284. child.attributes.style.height = height;
  58285. }
  58286. break;
  58287. }
  58288. case "table":
  58289. {
  58290. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58291. extra.height += h;
  58292. extra.children.push(html);
  58293. break;
  58294. }
  58295. case "tb":
  58296. {
  58297. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  58298. extra.height += h;
  58299. extra.children.push(html);
  58300. break;
  58301. }
  58302. }
  58303. }
  58304. function getAvailableSpace(node) {
  58305. const availableSpace = node[_xfa_object.$extra].availableSpace;
  58306. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  58307. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  58308. switch (node.layout) {
  58309. case "lr-tb":
  58310. case "rl-tb":
  58311. if (node[_xfa_object.$extra].attempt === 0) {
  58312. return {
  58313. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  58314. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  58315. };
  58316. }
  58317. return {
  58318. width: availableSpace.width - marginH,
  58319. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58320. };
  58321. case "rl-row":
  58322. case "row":
  58323. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  58324. return {
  58325. width,
  58326. height: availableSpace.height - marginH
  58327. };
  58328. case "table":
  58329. case "tb":
  58330. return {
  58331. width: availableSpace.width - marginH,
  58332. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  58333. };
  58334. case "position":
  58335. default:
  58336. return availableSpace;
  58337. }
  58338. }
  58339. function getTransformedBBox(node) {
  58340. let w = node.w === "" ? NaN : node.w;
  58341. let h = node.h === "" ? NaN : node.h;
  58342. let [centerX, centerY] = [0, 0];
  58343. switch (node.anchorType || "") {
  58344. case "bottomCenter":
  58345. [centerX, centerY] = [w / 2, h];
  58346. break;
  58347. case "bottomLeft":
  58348. [centerX, centerY] = [0, h];
  58349. break;
  58350. case "bottomRight":
  58351. [centerX, centerY] = [w, h];
  58352. break;
  58353. case "middleCenter":
  58354. [centerX, centerY] = [w / 2, h / 2];
  58355. break;
  58356. case "middleLeft":
  58357. [centerX, centerY] = [0, h / 2];
  58358. break;
  58359. case "middleRight":
  58360. [centerX, centerY] = [w, h / 2];
  58361. break;
  58362. case "topCenter":
  58363. [centerX, centerY] = [w / 2, 0];
  58364. break;
  58365. case "topRight":
  58366. [centerX, centerY] = [w, 0];
  58367. break;
  58368. }
  58369. let x, y;
  58370. switch (node.rotate || 0) {
  58371. case 0:
  58372. [x, y] = [-centerX, -centerY];
  58373. break;
  58374. case 90:
  58375. [x, y] = [-centerY, centerX];
  58376. [w, h] = [h, -w];
  58377. break;
  58378. case 180:
  58379. [x, y] = [centerX, centerY];
  58380. [w, h] = [-w, -h];
  58381. break;
  58382. case 270:
  58383. [x, y] = [centerY, -centerX];
  58384. [w, h] = [-h, w];
  58385. break;
  58386. }
  58387. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  58388. }
  58389. function checkDimensions(node, space) {
  58390. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  58391. return true;
  58392. }
  58393. if (node.w === 0 || node.h === 0) {
  58394. return true;
  58395. }
  58396. const ERROR = 2;
  58397. const parent = node[_xfa_object.$getSubformParent]();
  58398. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  58399. const [, y, w, h] = getTransformedBBox(node);
  58400. switch (parent.layout) {
  58401. case "lr-tb":
  58402. case "rl-tb":
  58403. if (attempt === 0) {
  58404. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58405. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58406. return false;
  58407. }
  58408. if (node.w !== "") {
  58409. if (Math.round(w - space.width) <= ERROR) {
  58410. return true;
  58411. }
  58412. if (parent[_xfa_object.$extra].numberInLine === 0) {
  58413. return space.height > ERROR;
  58414. }
  58415. return false;
  58416. }
  58417. return space.width > ERROR;
  58418. }
  58419. if (node.w !== "") {
  58420. return Math.round(w - space.width) <= ERROR;
  58421. }
  58422. return space.width > ERROR;
  58423. }
  58424. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58425. return true;
  58426. }
  58427. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  58428. return false;
  58429. }
  58430. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58431. return space.height > ERROR;
  58432. }
  58433. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58434. return false;
  58435. }
  58436. return space.height > ERROR;
  58437. case "table":
  58438. case "tb":
  58439. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58440. return true;
  58441. }
  58442. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  58443. return Math.round(h - space.height) <= ERROR;
  58444. }
  58445. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  58446. return space.height > ERROR;
  58447. }
  58448. if (parent[_xfa_object.$isThereMoreWidth]()) {
  58449. return false;
  58450. }
  58451. return space.height > ERROR;
  58452. case "position":
  58453. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58454. return true;
  58455. }
  58456. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  58457. return true;
  58458. }
  58459. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  58460. return h + y > area.h;
  58461. case "rl-row":
  58462. case "row":
  58463. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58464. return true;
  58465. }
  58466. if (node.h !== "") {
  58467. return Math.round(h - space.height) <= ERROR;
  58468. }
  58469. return true;
  58470. default:
  58471. return true;
  58472. }
  58473. }
  58474. /***/ }),
  58475. /* 84 */
  58476. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58477. Object.defineProperty(exports, "__esModule", ({
  58478. value: true
  58479. }));
  58480. exports.computeBbox = computeBbox;
  58481. exports.createWrapper = createWrapper;
  58482. exports.fixDimensions = fixDimensions;
  58483. exports.fixTextIndent = fixTextIndent;
  58484. exports.fixURL = fixURL;
  58485. exports.isPrintOnly = isPrintOnly;
  58486. exports.layoutClass = layoutClass;
  58487. exports.layoutNode = layoutNode;
  58488. exports.measureToString = measureToString;
  58489. exports.setAccess = setAccess;
  58490. exports.setFontFamily = setFontFamily;
  58491. exports.setMinMaxDimensions = setMinMaxDimensions;
  58492. exports.setPara = setPara;
  58493. exports.toStyle = toStyle;
  58494. var _xfa_object = __w_pdfjs_require__(77);
  58495. var _util = __w_pdfjs_require__(2);
  58496. var _utils = __w_pdfjs_require__(78);
  58497. var _fonts = __w_pdfjs_require__(85);
  58498. var _text = __w_pdfjs_require__(86);
  58499. function measureToString(m) {
  58500. if (typeof m === "string") {
  58501. return "0px";
  58502. }
  58503. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  58504. }
  58505. const converters = {
  58506. anchorType(node, style) {
  58507. const parent = node[_xfa_object.$getSubformParent]();
  58508. if (!parent || parent.layout && parent.layout !== "position") {
  58509. return;
  58510. }
  58511. if (!("transform" in style)) {
  58512. style.transform = "";
  58513. }
  58514. switch (node.anchorType) {
  58515. case "bottomCenter":
  58516. style.transform += "translate(-50%, -100%)";
  58517. break;
  58518. case "bottomLeft":
  58519. style.transform += "translate(0,-100%)";
  58520. break;
  58521. case "bottomRight":
  58522. style.transform += "translate(-100%,-100%)";
  58523. break;
  58524. case "middleCenter":
  58525. style.transform += "translate(-50%,-50%)";
  58526. break;
  58527. case "middleLeft":
  58528. style.transform += "translate(0,-50%)";
  58529. break;
  58530. case "middleRight":
  58531. style.transform += "translate(-100%,-50%)";
  58532. break;
  58533. case "topCenter":
  58534. style.transform += "translate(-50%,0)";
  58535. break;
  58536. case "topRight":
  58537. style.transform += "translate(-100%,0)";
  58538. break;
  58539. }
  58540. },
  58541. dimensions(node, style) {
  58542. const parent = node[_xfa_object.$getSubformParent]();
  58543. let width = node.w;
  58544. const height = node.h;
  58545. if (parent.layout && parent.layout.includes("row")) {
  58546. const extra = parent[_xfa_object.$extra];
  58547. const colSpan = node.colSpan;
  58548. let w;
  58549. if (colSpan === -1) {
  58550. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  58551. extra.currentColumn = 0;
  58552. } else {
  58553. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  58554. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  58555. }
  58556. if (!isNaN(w)) {
  58557. width = node.w = w;
  58558. }
  58559. }
  58560. if (width !== "") {
  58561. style.width = measureToString(width);
  58562. } else {
  58563. style.width = "auto";
  58564. }
  58565. if (height !== "") {
  58566. style.height = measureToString(height);
  58567. } else {
  58568. style.height = "auto";
  58569. }
  58570. },
  58571. position(node, style) {
  58572. const parent = node[_xfa_object.$getSubformParent]();
  58573. if (parent && parent.layout && parent.layout !== "position") {
  58574. return;
  58575. }
  58576. style.position = "absolute";
  58577. style.left = measureToString(node.x);
  58578. style.top = measureToString(node.y);
  58579. },
  58580. rotate(node, style) {
  58581. if (node.rotate) {
  58582. if (!("transform" in style)) {
  58583. style.transform = "";
  58584. }
  58585. style.transform += `rotate(-${node.rotate}deg)`;
  58586. style.transformOrigin = "top left";
  58587. }
  58588. },
  58589. presence(node, style) {
  58590. switch (node.presence) {
  58591. case "invisible":
  58592. style.visibility = "hidden";
  58593. break;
  58594. case "hidden":
  58595. case "inactive":
  58596. style.display = "none";
  58597. break;
  58598. }
  58599. },
  58600. hAlign(node, style) {
  58601. if (node[_xfa_object.$nodeName] === "para") {
  58602. switch (node.hAlign) {
  58603. case "justifyAll":
  58604. style.textAlign = "justify-all";
  58605. break;
  58606. case "radix":
  58607. style.textAlign = "left";
  58608. break;
  58609. default:
  58610. style.textAlign = node.hAlign;
  58611. }
  58612. } else {
  58613. switch (node.hAlign) {
  58614. case "left":
  58615. style.alignSelf = "start";
  58616. break;
  58617. case "center":
  58618. style.alignSelf = "center";
  58619. break;
  58620. case "right":
  58621. style.alignSelf = "end";
  58622. break;
  58623. }
  58624. }
  58625. },
  58626. margin(node, style) {
  58627. if (node.margin) {
  58628. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  58629. }
  58630. }
  58631. };
  58632. function setMinMaxDimensions(node, style) {
  58633. const parent = node[_xfa_object.$getSubformParent]();
  58634. if (parent.layout === "position") {
  58635. if (node.minW > 0) {
  58636. style.minWidth = measureToString(node.minW);
  58637. }
  58638. if (node.maxW > 0) {
  58639. style.maxWidth = measureToString(node.maxW);
  58640. }
  58641. if (node.minH > 0) {
  58642. style.minHeight = measureToString(node.minH);
  58643. }
  58644. if (node.maxH > 0) {
  58645. style.maxHeight = measureToString(node.maxH);
  58646. }
  58647. }
  58648. }
  58649. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  58650. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  58651. if (typeof text === "string") {
  58652. measure.addString(text);
  58653. } else {
  58654. text[_xfa_object.$pushGlyphs](measure);
  58655. }
  58656. return measure.compute(width);
  58657. }
  58658. function layoutNode(node, availableSpace) {
  58659. let height = null;
  58660. let width = null;
  58661. let isBroken = false;
  58662. if ((!node.w || !node.h) && node.value) {
  58663. let marginH = 0;
  58664. let marginV = 0;
  58665. if (node.margin) {
  58666. marginH = node.margin.leftInset + node.margin.rightInset;
  58667. marginV = node.margin.topInset + node.margin.bottomInset;
  58668. }
  58669. let lineHeight = null;
  58670. let margin = null;
  58671. if (node.para) {
  58672. margin = Object.create(null);
  58673. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  58674. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  58675. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  58676. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  58677. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  58678. }
  58679. let font = node.font;
  58680. if (!font) {
  58681. const root = node[_xfa_object.$getTemplateRoot]();
  58682. let parent = node[_xfa_object.$getParent]();
  58683. while (parent && parent !== root) {
  58684. if (parent.font) {
  58685. font = parent.font;
  58686. break;
  58687. }
  58688. parent = parent[_xfa_object.$getParent]();
  58689. }
  58690. }
  58691. const maxWidth = (node.w || availableSpace.width) - marginH;
  58692. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  58693. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  58694. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  58695. width = res.width;
  58696. height = res.height;
  58697. isBroken = res.isBroken;
  58698. } else {
  58699. const text = node.value[_xfa_object.$text]();
  58700. if (text) {
  58701. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  58702. width = res.width;
  58703. height = res.height;
  58704. isBroken = res.isBroken;
  58705. }
  58706. }
  58707. if (width !== null && !node.w) {
  58708. width += marginH;
  58709. }
  58710. if (height !== null && !node.h) {
  58711. height += marginV;
  58712. }
  58713. }
  58714. return {
  58715. w: width,
  58716. h: height,
  58717. isBroken
  58718. };
  58719. }
  58720. function computeBbox(node, html, availableSpace) {
  58721. let bbox;
  58722. if (node.w !== "" && node.h !== "") {
  58723. bbox = [node.x, node.y, node.w, node.h];
  58724. } else {
  58725. if (!availableSpace) {
  58726. return null;
  58727. }
  58728. let width = node.w;
  58729. if (width === "") {
  58730. if (node.maxW === 0) {
  58731. const parent = node[_xfa_object.$getSubformParent]();
  58732. if (parent.layout === "position" && parent.w !== "") {
  58733. width = 0;
  58734. } else {
  58735. width = node.minW;
  58736. }
  58737. } else {
  58738. width = Math.min(node.maxW, availableSpace.width);
  58739. }
  58740. html.attributes.style.width = measureToString(width);
  58741. }
  58742. let height = node.h;
  58743. if (height === "") {
  58744. if (node.maxH === 0) {
  58745. const parent = node[_xfa_object.$getSubformParent]();
  58746. if (parent.layout === "position" && parent.h !== "") {
  58747. height = 0;
  58748. } else {
  58749. height = node.minH;
  58750. }
  58751. } else {
  58752. height = Math.min(node.maxH, availableSpace.height);
  58753. }
  58754. html.attributes.style.height = measureToString(height);
  58755. }
  58756. bbox = [node.x, node.y, width, height];
  58757. }
  58758. return bbox;
  58759. }
  58760. function fixDimensions(node) {
  58761. const parent = node[_xfa_object.$getSubformParent]();
  58762. if (parent.layout && parent.layout.includes("row")) {
  58763. const extra = parent[_xfa_object.$extra];
  58764. const colSpan = node.colSpan;
  58765. let width;
  58766. if (colSpan === -1) {
  58767. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  58768. } else {
  58769. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  58770. }
  58771. if (!isNaN(width)) {
  58772. node.w = width;
  58773. }
  58774. }
  58775. if (parent.layout && parent.layout !== "position") {
  58776. node.x = node.y = 0;
  58777. }
  58778. if (node.layout === "table") {
  58779. if (node.w === "" && Array.isArray(node.columnWidths)) {
  58780. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  58781. }
  58782. }
  58783. }
  58784. function layoutClass(node) {
  58785. switch (node.layout) {
  58786. case "position":
  58787. return "xfaPosition";
  58788. case "lr-tb":
  58789. return "xfaLrTb";
  58790. case "rl-row":
  58791. return "xfaRlRow";
  58792. case "rl-tb":
  58793. return "xfaRlTb";
  58794. case "row":
  58795. return "xfaRow";
  58796. case "table":
  58797. return "xfaTable";
  58798. case "tb":
  58799. return "xfaTb";
  58800. default:
  58801. return "xfaPosition";
  58802. }
  58803. }
  58804. function toStyle(node, ...names) {
  58805. const style = Object.create(null);
  58806. for (const name of names) {
  58807. const value = node[name];
  58808. if (value === null) {
  58809. continue;
  58810. }
  58811. if (converters.hasOwnProperty(name)) {
  58812. converters[name](node, style);
  58813. continue;
  58814. }
  58815. if (value instanceof _xfa_object.XFAObject) {
  58816. const newStyle = value[_xfa_object.$toStyle]();
  58817. if (newStyle) {
  58818. Object.assign(style, newStyle);
  58819. } else {
  58820. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  58821. }
  58822. }
  58823. }
  58824. return style;
  58825. }
  58826. function createWrapper(node, html) {
  58827. const {
  58828. attributes
  58829. } = html;
  58830. const {
  58831. style
  58832. } = attributes;
  58833. const wrapper = {
  58834. name: "div",
  58835. attributes: {
  58836. class: ["xfaWrapper"],
  58837. style: Object.create(null)
  58838. },
  58839. children: []
  58840. };
  58841. attributes.class.push("xfaWrapped");
  58842. if (node.border) {
  58843. const {
  58844. widths,
  58845. insets
  58846. } = node.border[_xfa_object.$extra];
  58847. let width, height;
  58848. let top = insets[0];
  58849. let left = insets[3];
  58850. const insetsH = insets[0] + insets[2];
  58851. const insetsW = insets[1] + insets[3];
  58852. switch (node.border.hand) {
  58853. case "even":
  58854. top -= widths[0] / 2;
  58855. left -= widths[3] / 2;
  58856. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  58857. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  58858. break;
  58859. case "left":
  58860. top -= widths[0];
  58861. left -= widths[3];
  58862. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  58863. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  58864. break;
  58865. case "right":
  58866. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  58867. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  58868. break;
  58869. }
  58870. const classNames = ["xfaBorder"];
  58871. if (isPrintOnly(node.border)) {
  58872. classNames.push("xfaPrintOnly");
  58873. }
  58874. const border = {
  58875. name: "div",
  58876. attributes: {
  58877. class: classNames,
  58878. style: {
  58879. top: `${top}px`,
  58880. left: `${left}px`,
  58881. width,
  58882. height
  58883. }
  58884. },
  58885. children: []
  58886. };
  58887. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  58888. if (style[key] !== undefined) {
  58889. border.attributes.style[key] = style[key];
  58890. delete style[key];
  58891. }
  58892. }
  58893. wrapper.children.push(border, html);
  58894. } else {
  58895. wrapper.children.push(html);
  58896. }
  58897. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  58898. if (style[key] !== undefined) {
  58899. wrapper.attributes.style[key] = style[key];
  58900. delete style[key];
  58901. }
  58902. }
  58903. if (style.position === "absolute") {
  58904. wrapper.attributes.style.position = "absolute";
  58905. } else {
  58906. wrapper.attributes.style.position = "relative";
  58907. }
  58908. delete style.position;
  58909. if (style.alignSelf) {
  58910. wrapper.attributes.style.alignSelf = style.alignSelf;
  58911. delete style.alignSelf;
  58912. }
  58913. return wrapper;
  58914. }
  58915. function fixTextIndent(styles) {
  58916. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  58917. if (indent >= 0) {
  58918. return;
  58919. }
  58920. const align = styles.textAlign === "right" ? "right" : "left";
  58921. const name = "padding" + (align === "left" ? "Left" : "Right");
  58922. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  58923. styles[name] = `${padding - indent}px`;
  58924. }
  58925. function setAccess(node, classNames) {
  58926. switch (node.access) {
  58927. case "nonInteractive":
  58928. classNames.push("xfaNonInteractive");
  58929. break;
  58930. case "readOnly":
  58931. classNames.push("xfaReadOnly");
  58932. break;
  58933. case "protected":
  58934. classNames.push("xfaDisabled");
  58935. break;
  58936. }
  58937. }
  58938. function isPrintOnly(node) {
  58939. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  58940. }
  58941. function getCurrentPara(node) {
  58942. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  58943. return stack.length ? stack.at(-1) : null;
  58944. }
  58945. function setPara(node, nodeStyle, value) {
  58946. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  58947. if (nodeStyle) {
  58948. if (node.h === "") {
  58949. nodeStyle.height = "auto";
  58950. }
  58951. if (node.w === "") {
  58952. nodeStyle.width = "auto";
  58953. }
  58954. }
  58955. const para = getCurrentPara(node);
  58956. if (para) {
  58957. const valueStyle = value.attributes.style;
  58958. valueStyle.display = "flex";
  58959. valueStyle.flexDirection = "column";
  58960. switch (para.vAlign) {
  58961. case "top":
  58962. valueStyle.justifyContent = "start";
  58963. break;
  58964. case "bottom":
  58965. valueStyle.justifyContent = "end";
  58966. break;
  58967. case "middle":
  58968. valueStyle.justifyContent = "center";
  58969. break;
  58970. }
  58971. const paraStyle = para[_xfa_object.$toStyle]();
  58972. for (const [key, val] of Object.entries(paraStyle)) {
  58973. if (!(key in valueStyle)) {
  58974. valueStyle[key] = val;
  58975. }
  58976. }
  58977. }
  58978. }
  58979. }
  58980. function setFontFamily(xfaFont, node, fontFinder, style) {
  58981. if (!fontFinder) {
  58982. delete style.fontFamily;
  58983. return;
  58984. }
  58985. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  58986. style.fontFamily = `"${name}"`;
  58987. const typeface = fontFinder.find(name);
  58988. if (typeface) {
  58989. const {
  58990. fontFamily
  58991. } = typeface.regular.cssFontInfo;
  58992. if (fontFamily !== name) {
  58993. style.fontFamily = `"${fontFamily}"`;
  58994. }
  58995. const para = getCurrentPara(node);
  58996. if (para && para.lineHeight !== "") {
  58997. return;
  58998. }
  58999. if (style.lineHeight) {
  59000. return;
  59001. }
  59002. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59003. if (pdfFont) {
  59004. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  59005. }
  59006. }
  59007. }
  59008. function fixURL(str) {
  59009. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  59010. addDefaultProtocol: true,
  59011. tryConvertEncoding: true
  59012. });
  59013. return absoluteUrl ? absoluteUrl.href : null;
  59014. }
  59015. /***/ }),
  59016. /* 85 */
  59017. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59018. Object.defineProperty(exports, "__esModule", ({
  59019. value: true
  59020. }));
  59021. exports.FontFinder = void 0;
  59022. exports.getMetrics = getMetrics;
  59023. exports.selectFont = selectFont;
  59024. var _xfa_object = __w_pdfjs_require__(77);
  59025. var _utils = __w_pdfjs_require__(78);
  59026. var _util = __w_pdfjs_require__(2);
  59027. class FontFinder {
  59028. constructor(pdfFonts) {
  59029. this.fonts = new Map();
  59030. this.cache = new Map();
  59031. this.warned = new Set();
  59032. this.defaultFont = null;
  59033. this.add(pdfFonts);
  59034. }
  59035. add(pdfFonts, reallyMissingFonts = null) {
  59036. for (const pdfFont of pdfFonts) {
  59037. this.addPdfFont(pdfFont);
  59038. }
  59039. for (const pdfFont of this.fonts.values()) {
  59040. if (!pdfFont.regular) {
  59041. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  59042. }
  59043. }
  59044. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  59045. return;
  59046. }
  59047. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  59048. for (const missing of reallyMissingFonts) {
  59049. this.fonts.set(missing, myriad);
  59050. }
  59051. }
  59052. addPdfFont(pdfFont) {
  59053. const cssFontInfo = pdfFont.cssFontInfo;
  59054. const name = cssFontInfo.fontFamily;
  59055. let font = this.fonts.get(name);
  59056. if (!font) {
  59057. font = Object.create(null);
  59058. this.fonts.set(name, font);
  59059. if (!this.defaultFont) {
  59060. this.defaultFont = font;
  59061. }
  59062. }
  59063. let property = "";
  59064. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  59065. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  59066. property = fontWeight >= 700 ? "bolditalic" : "italic";
  59067. } else if (fontWeight >= 700) {
  59068. property = "bold";
  59069. }
  59070. if (!property) {
  59071. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  59072. property = "bold";
  59073. }
  59074. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  59075. property += "italic";
  59076. }
  59077. }
  59078. if (!property) {
  59079. property = "regular";
  59080. }
  59081. font[property] = pdfFont;
  59082. }
  59083. getDefault() {
  59084. return this.defaultFont;
  59085. }
  59086. find(fontName, mustWarn = true) {
  59087. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  59088. if (font) {
  59089. return font;
  59090. }
  59091. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  59092. let name = fontName.replace(pattern, "");
  59093. font = this.fonts.get(name);
  59094. if (font) {
  59095. this.cache.set(fontName, font);
  59096. return font;
  59097. }
  59098. name = name.toLowerCase();
  59099. const maybe = [];
  59100. for (const [family, pdfFont] of this.fonts.entries()) {
  59101. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59102. maybe.push(pdfFont);
  59103. }
  59104. }
  59105. if (maybe.length === 0) {
  59106. for (const [, pdfFont] of this.fonts.entries()) {
  59107. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59108. maybe.push(pdfFont);
  59109. }
  59110. }
  59111. }
  59112. if (maybe.length === 0) {
  59113. name = name.replace(/psmt|mt/gi, "");
  59114. for (const [family, pdfFont] of this.fonts.entries()) {
  59115. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  59116. maybe.push(pdfFont);
  59117. }
  59118. }
  59119. }
  59120. if (maybe.length === 0) {
  59121. for (const pdfFont of this.fonts.values()) {
  59122. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  59123. maybe.push(pdfFont);
  59124. }
  59125. }
  59126. }
  59127. if (maybe.length >= 1) {
  59128. if (maybe.length !== 1 && mustWarn) {
  59129. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  59130. }
  59131. this.cache.set(fontName, maybe[0]);
  59132. return maybe[0];
  59133. }
  59134. if (mustWarn && !this.warned.has(fontName)) {
  59135. this.warned.add(fontName);
  59136. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  59137. }
  59138. return null;
  59139. }
  59140. }
  59141. exports.FontFinder = FontFinder;
  59142. function selectFont(xfaFont, typeface) {
  59143. if (xfaFont.posture === "italic") {
  59144. if (xfaFont.weight === "bold") {
  59145. return typeface.bolditalic;
  59146. }
  59147. return typeface.italic;
  59148. } else if (xfaFont.weight === "bold") {
  59149. return typeface.bold;
  59150. }
  59151. return typeface.regular;
  59152. }
  59153. function getMetrics(xfaFont, real = false) {
  59154. let pdfFont = null;
  59155. if (xfaFont) {
  59156. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  59157. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  59158. pdfFont = selectFont(xfaFont, typeface);
  59159. }
  59160. if (!pdfFont) {
  59161. return {
  59162. lineHeight: 12,
  59163. lineGap: 2,
  59164. lineNoGap: 10
  59165. };
  59166. }
  59167. const size = xfaFont.size || 10;
  59168. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  59169. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59170. return {
  59171. lineHeight: lineHeight * size,
  59172. lineGap: lineGap * size,
  59173. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  59174. };
  59175. }
  59176. /***/ }),
  59177. /* 86 */
  59178. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59179. Object.defineProperty(exports, "__esModule", ({
  59180. value: true
  59181. }));
  59182. exports.TextMeasure = void 0;
  59183. var _fonts = __w_pdfjs_require__(85);
  59184. const WIDTH_FACTOR = 1.02;
  59185. class FontInfo {
  59186. constructor(xfaFont, margin, lineHeight, fontFinder) {
  59187. this.lineHeight = lineHeight;
  59188. this.paraMargin = margin || {
  59189. top: 0,
  59190. bottom: 0,
  59191. left: 0,
  59192. right: 0
  59193. };
  59194. if (!xfaFont) {
  59195. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59196. return;
  59197. }
  59198. this.xfaFont = {
  59199. typeface: xfaFont.typeface,
  59200. posture: xfaFont.posture,
  59201. weight: xfaFont.weight,
  59202. size: xfaFont.size,
  59203. letterSpacing: xfaFont.letterSpacing
  59204. };
  59205. const typeface = fontFinder.find(xfaFont.typeface);
  59206. if (!typeface) {
  59207. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59208. return;
  59209. }
  59210. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  59211. if (!this.pdfFont) {
  59212. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  59213. }
  59214. }
  59215. defaultFont(fontFinder) {
  59216. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  59217. if (font && font.regular) {
  59218. const pdfFont = font.regular;
  59219. const info = pdfFont.cssFontInfo;
  59220. const xfaFont = {
  59221. typeface: info.fontFamily,
  59222. posture: "normal",
  59223. weight: "normal",
  59224. size: 10,
  59225. letterSpacing: 0
  59226. };
  59227. return [pdfFont, xfaFont];
  59228. }
  59229. const xfaFont = {
  59230. typeface: "Courier",
  59231. posture: "normal",
  59232. weight: "normal",
  59233. size: 10,
  59234. letterSpacing: 0
  59235. };
  59236. return [null, xfaFont];
  59237. }
  59238. }
  59239. class FontSelector {
  59240. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  59241. this.fontFinder = fontFinder;
  59242. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  59243. }
  59244. pushData(xfaFont, margin, lineHeight) {
  59245. const lastFont = this.stack.at(-1);
  59246. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  59247. if (!xfaFont[name]) {
  59248. xfaFont[name] = lastFont.xfaFont[name];
  59249. }
  59250. }
  59251. for (const name of ["top", "bottom", "left", "right"]) {
  59252. if (isNaN(margin[name])) {
  59253. margin[name] = lastFont.paraMargin[name];
  59254. }
  59255. }
  59256. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  59257. if (!fontInfo.pdfFont) {
  59258. fontInfo.pdfFont = lastFont.pdfFont;
  59259. }
  59260. this.stack.push(fontInfo);
  59261. }
  59262. popFont() {
  59263. this.stack.pop();
  59264. }
  59265. topFont() {
  59266. return this.stack.at(-1);
  59267. }
  59268. }
  59269. class TextMeasure {
  59270. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  59271. this.glyphs = [];
  59272. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  59273. this.extraHeight = 0;
  59274. }
  59275. pushData(xfaFont, margin, lineHeight) {
  59276. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  59277. }
  59278. popFont(xfaFont) {
  59279. return this.fontSelector.popFont();
  59280. }
  59281. addPara() {
  59282. const lastFont = this.fontSelector.topFont();
  59283. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  59284. }
  59285. addString(str) {
  59286. if (!str) {
  59287. return;
  59288. }
  59289. const lastFont = this.fontSelector.topFont();
  59290. const fontSize = lastFont.xfaFont.size;
  59291. if (lastFont.pdfFont) {
  59292. const letterSpacing = lastFont.xfaFont.letterSpacing;
  59293. const pdfFont = lastFont.pdfFont;
  59294. const fontLineHeight = pdfFont.lineHeight || 1.2;
  59295. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  59296. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  59297. const noGap = fontLineHeight - lineGap;
  59298. const firstLineHeight = Math.max(1, noGap) * fontSize;
  59299. const scale = fontSize / 1000;
  59300. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  59301. for (const line of str.split(/[\u2029\n]/)) {
  59302. const encodedLine = pdfFont.encodeString(line).join("");
  59303. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  59304. for (const glyph of glyphs) {
  59305. const width = glyph.width || fallbackWidth;
  59306. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  59307. }
  59308. this.glyphs.push([0, 0, 0, "\n", true]);
  59309. }
  59310. this.glyphs.pop();
  59311. return;
  59312. }
  59313. for (const line of str.split(/[\u2029\n]/)) {
  59314. for (const char of line.split("")) {
  59315. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  59316. }
  59317. this.glyphs.push([0, 0, 0, "\n", true]);
  59318. }
  59319. this.glyphs.pop();
  59320. }
  59321. compute(maxWidth) {
  59322. let lastSpacePos = -1,
  59323. lastSpaceWidth = 0,
  59324. width = 0,
  59325. height = 0,
  59326. currentLineWidth = 0,
  59327. currentLineHeight = 0;
  59328. let isBroken = false;
  59329. let isFirstLine = true;
  59330. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  59331. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  59332. const isSpace = char === " ";
  59333. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  59334. if (isEOL) {
  59335. width = Math.max(width, currentLineWidth);
  59336. currentLineWidth = 0;
  59337. height += currentLineHeight;
  59338. currentLineHeight = glyphHeight;
  59339. lastSpacePos = -1;
  59340. lastSpaceWidth = 0;
  59341. isFirstLine = false;
  59342. continue;
  59343. }
  59344. if (isSpace) {
  59345. if (currentLineWidth + glyphWidth > maxWidth) {
  59346. width = Math.max(width, currentLineWidth);
  59347. currentLineWidth = 0;
  59348. height += currentLineHeight;
  59349. currentLineHeight = glyphHeight;
  59350. lastSpacePos = -1;
  59351. lastSpaceWidth = 0;
  59352. isBroken = true;
  59353. isFirstLine = false;
  59354. } else {
  59355. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59356. lastSpaceWidth = currentLineWidth;
  59357. currentLineWidth += glyphWidth;
  59358. lastSpacePos = i;
  59359. }
  59360. continue;
  59361. }
  59362. if (currentLineWidth + glyphWidth > maxWidth) {
  59363. height += currentLineHeight;
  59364. currentLineHeight = glyphHeight;
  59365. if (lastSpacePos !== -1) {
  59366. i = lastSpacePos;
  59367. width = Math.max(width, lastSpaceWidth);
  59368. currentLineWidth = 0;
  59369. lastSpacePos = -1;
  59370. lastSpaceWidth = 0;
  59371. } else {
  59372. width = Math.max(width, currentLineWidth);
  59373. currentLineWidth = glyphWidth;
  59374. }
  59375. isBroken = true;
  59376. isFirstLine = false;
  59377. continue;
  59378. }
  59379. currentLineWidth += glyphWidth;
  59380. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  59381. }
  59382. width = Math.max(width, currentLineWidth);
  59383. height += currentLineHeight + this.extraHeight;
  59384. return {
  59385. width: WIDTH_FACTOR * width,
  59386. height,
  59387. isBroken
  59388. };
  59389. }
  59390. }
  59391. exports.TextMeasure = TextMeasure;
  59392. /***/ }),
  59393. /* 87 */
  59394. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59395. Object.defineProperty(exports, "__esModule", ({
  59396. value: true
  59397. }));
  59398. exports.DataHandler = void 0;
  59399. var _xfa_object = __w_pdfjs_require__(77);
  59400. class DataHandler {
  59401. constructor(root, data) {
  59402. this.data = data;
  59403. this.dataset = root.datasets || null;
  59404. }
  59405. serialize(storage) {
  59406. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  59407. while (stack.length > 0) {
  59408. const last = stack.at(-1);
  59409. const [i, children] = last;
  59410. if (i + 1 === children.length) {
  59411. stack.pop();
  59412. continue;
  59413. }
  59414. const child = children[++last[0]];
  59415. const storageEntry = storage.get(child[_xfa_object.$uid]);
  59416. if (storageEntry) {
  59417. child[_xfa_object.$setValue](storageEntry);
  59418. } else {
  59419. const attributes = child[_xfa_object.$getAttributes]();
  59420. for (const value of attributes.values()) {
  59421. const entry = storage.get(value[_xfa_object.$uid]);
  59422. if (entry) {
  59423. value[_xfa_object.$setValue](entry);
  59424. break;
  59425. }
  59426. }
  59427. }
  59428. const nodes = child[_xfa_object.$getChildren]();
  59429. if (nodes.length > 0) {
  59430. stack.push([-1, nodes]);
  59431. }
  59432. }
  59433. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  59434. if (this.dataset) {
  59435. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  59436. if (child[_xfa_object.$nodeName] !== "data") {
  59437. child[_xfa_object.$toString](buf);
  59438. }
  59439. }
  59440. }
  59441. this.data[_xfa_object.$toString](buf);
  59442. buf.push("</xfa:datasets>");
  59443. return buf.join("");
  59444. }
  59445. }
  59446. exports.DataHandler = DataHandler;
  59447. /***/ }),
  59448. /* 88 */
  59449. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59450. Object.defineProperty(exports, "__esModule", ({
  59451. value: true
  59452. }));
  59453. exports.XFAParser = void 0;
  59454. var _xfa_object = __w_pdfjs_require__(77);
  59455. var _xml_parser = __w_pdfjs_require__(66);
  59456. var _builder = __w_pdfjs_require__(89);
  59457. var _util = __w_pdfjs_require__(2);
  59458. class XFAParser extends _xml_parser.XMLParserBase {
  59459. constructor(rootNameSpace = null, richText = false) {
  59460. super();
  59461. this._builder = new _builder.Builder(rootNameSpace);
  59462. this._stack = [];
  59463. this._globalData = {
  59464. usedTypefaces: new Set()
  59465. };
  59466. this._ids = new Map();
  59467. this._current = this._builder.buildRoot(this._ids);
  59468. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  59469. this._whiteRegex = /^\s+$/;
  59470. this._nbsps = /\xa0+/g;
  59471. this._richText = richText;
  59472. }
  59473. parse(data) {
  59474. this.parseXml(data);
  59475. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  59476. return undefined;
  59477. }
  59478. this._current[_xfa_object.$finalize]();
  59479. return this._current.element;
  59480. }
  59481. onText(text) {
  59482. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  59483. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  59484. this._current[_xfa_object.$onText](text, this._richText);
  59485. return;
  59486. }
  59487. if (this._whiteRegex.test(text)) {
  59488. return;
  59489. }
  59490. this._current[_xfa_object.$onText](text.trim());
  59491. }
  59492. onCdata(text) {
  59493. this._current[_xfa_object.$onText](text);
  59494. }
  59495. _mkAttributes(attributes, tagName) {
  59496. let namespace = null;
  59497. let prefixes = null;
  59498. const attributeObj = Object.create({});
  59499. for (const {
  59500. name,
  59501. value
  59502. } of attributes) {
  59503. if (name === "xmlns") {
  59504. if (!namespace) {
  59505. namespace = value;
  59506. } else {
  59507. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  59508. }
  59509. } else if (name.startsWith("xmlns:")) {
  59510. const prefix = name.substring("xmlns:".length);
  59511. if (!prefixes) {
  59512. prefixes = [];
  59513. }
  59514. prefixes.push({
  59515. prefix,
  59516. value
  59517. });
  59518. } else {
  59519. const i = name.indexOf(":");
  59520. if (i === -1) {
  59521. attributeObj[name] = value;
  59522. } else {
  59523. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  59524. if (!nsAttrs) {
  59525. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  59526. }
  59527. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  59528. let attrs = nsAttrs[ns];
  59529. if (!attrs) {
  59530. attrs = nsAttrs[ns] = Object.create(null);
  59531. }
  59532. attrs[attrName] = value;
  59533. }
  59534. }
  59535. }
  59536. return [namespace, prefixes, attributeObj];
  59537. }
  59538. _getNameAndPrefix(name, nsAgnostic) {
  59539. const i = name.indexOf(":");
  59540. if (i === -1) {
  59541. return [name, null];
  59542. }
  59543. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  59544. }
  59545. onBeginElement(tagName, attributes, isEmpty) {
  59546. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  59547. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  59548. const node = this._builder.build({
  59549. nsPrefix,
  59550. name,
  59551. attributes: attributesObj,
  59552. namespace,
  59553. prefixes
  59554. });
  59555. node[_xfa_object.$globalData] = this._globalData;
  59556. if (isEmpty) {
  59557. node[_xfa_object.$finalize]();
  59558. if (this._current[_xfa_object.$onChild](node)) {
  59559. node[_xfa_object.$setId](this._ids);
  59560. }
  59561. node[_xfa_object.$clean](this._builder);
  59562. return;
  59563. }
  59564. this._stack.push(this._current);
  59565. this._current = node;
  59566. }
  59567. onEndElement(name) {
  59568. const node = this._current;
  59569. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  59570. const parser = new XFAParser();
  59571. parser._globalData = this._globalData;
  59572. const root = parser.parse(node[_xfa_object.$content]);
  59573. node[_xfa_object.$content] = null;
  59574. node[_xfa_object.$onChild](root);
  59575. }
  59576. node[_xfa_object.$finalize]();
  59577. this._current = this._stack.pop();
  59578. if (this._current[_xfa_object.$onChild](node)) {
  59579. node[_xfa_object.$setId](this._ids);
  59580. }
  59581. node[_xfa_object.$clean](this._builder);
  59582. }
  59583. onError(code) {
  59584. this._errorCode = code;
  59585. }
  59586. }
  59587. exports.XFAParser = XFAParser;
  59588. /***/ }),
  59589. /* 89 */
  59590. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59591. Object.defineProperty(exports, "__esModule", ({
  59592. value: true
  59593. }));
  59594. exports.Builder = void 0;
  59595. var _namespaces = __w_pdfjs_require__(79);
  59596. var _xfa_object = __w_pdfjs_require__(77);
  59597. var _setup = __w_pdfjs_require__(90);
  59598. var _template = __w_pdfjs_require__(82);
  59599. var _unknown = __w_pdfjs_require__(99);
  59600. var _util = __w_pdfjs_require__(2);
  59601. class Root extends _xfa_object.XFAObject {
  59602. constructor(ids) {
  59603. super(-1, "root", Object.create(null));
  59604. this.element = null;
  59605. this[_xfa_object.$ids] = ids;
  59606. }
  59607. [_xfa_object.$onChild](child) {
  59608. this.element = child;
  59609. return true;
  59610. }
  59611. [_xfa_object.$finalize]() {
  59612. super[_xfa_object.$finalize]();
  59613. if (this.element.template instanceof _template.Template) {
  59614. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  59615. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  59616. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  59617. }
  59618. }
  59619. }
  59620. class Empty extends _xfa_object.XFAObject {
  59621. constructor() {
  59622. super(-1, "", Object.create(null));
  59623. }
  59624. [_xfa_object.$onChild](_) {
  59625. return false;
  59626. }
  59627. }
  59628. class Builder {
  59629. constructor(rootNameSpace = null) {
  59630. this._namespaceStack = [];
  59631. this._nsAgnosticLevel = 0;
  59632. this._namespacePrefixes = new Map();
  59633. this._namespaces = new Map();
  59634. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  59635. id
  59636. }) => id));
  59637. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  59638. }
  59639. buildRoot(ids) {
  59640. return new Root(ids);
  59641. }
  59642. build({
  59643. nsPrefix,
  59644. name,
  59645. attributes,
  59646. namespace,
  59647. prefixes
  59648. }) {
  59649. const hasNamespaceDef = namespace !== null;
  59650. if (hasNamespaceDef) {
  59651. this._namespaceStack.push(this._currentNamespace);
  59652. this._currentNamespace = this._searchNamespace(namespace);
  59653. }
  59654. if (prefixes) {
  59655. this._addNamespacePrefix(prefixes);
  59656. }
  59657. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  59658. const dataTemplate = _setup.NamespaceSetUp.datasets;
  59659. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  59660. let xfaAttrs = null;
  59661. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  59662. const nsToUse = this._getNamespaceToUse(ns);
  59663. if (nsToUse === dataTemplate) {
  59664. xfaAttrs = {
  59665. xfa: attrs
  59666. };
  59667. break;
  59668. }
  59669. }
  59670. if (xfaAttrs) {
  59671. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  59672. } else {
  59673. delete attributes[_xfa_object.$nsAttributes];
  59674. }
  59675. }
  59676. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  59677. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  59678. if (node[_xfa_object.$isNsAgnostic]()) {
  59679. this._nsAgnosticLevel++;
  59680. }
  59681. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  59682. node[_xfa_object.$cleanup] = {
  59683. hasNamespace: hasNamespaceDef,
  59684. prefixes,
  59685. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  59686. };
  59687. }
  59688. return node;
  59689. }
  59690. isNsAgnostic() {
  59691. return this._nsAgnosticLevel > 0;
  59692. }
  59693. _searchNamespace(nsName) {
  59694. let ns = this._namespaces.get(nsName);
  59695. if (ns) {
  59696. return ns;
  59697. }
  59698. for (const [name, {
  59699. check
  59700. }] of Object.entries(_namespaces.NamespaceIds)) {
  59701. if (check(nsName)) {
  59702. ns = _setup.NamespaceSetUp[name];
  59703. if (ns) {
  59704. this._namespaces.set(nsName, ns);
  59705. return ns;
  59706. }
  59707. break;
  59708. }
  59709. }
  59710. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  59711. this._namespaces.set(nsName, ns);
  59712. return ns;
  59713. }
  59714. _addNamespacePrefix(prefixes) {
  59715. for (const {
  59716. prefix,
  59717. value
  59718. } of prefixes) {
  59719. const namespace = this._searchNamespace(value);
  59720. let prefixStack = this._namespacePrefixes.get(prefix);
  59721. if (!prefixStack) {
  59722. prefixStack = [];
  59723. this._namespacePrefixes.set(prefix, prefixStack);
  59724. }
  59725. prefixStack.push(namespace);
  59726. }
  59727. }
  59728. _getNamespaceToUse(prefix) {
  59729. if (!prefix) {
  59730. return this._currentNamespace;
  59731. }
  59732. const prefixStack = this._namespacePrefixes.get(prefix);
  59733. if (prefixStack && prefixStack.length > 0) {
  59734. return prefixStack.at(-1);
  59735. }
  59736. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  59737. return null;
  59738. }
  59739. clean(data) {
  59740. const {
  59741. hasNamespace,
  59742. prefixes,
  59743. nsAgnostic
  59744. } = data;
  59745. if (hasNamespace) {
  59746. this._currentNamespace = this._namespaceStack.pop();
  59747. }
  59748. if (prefixes) {
  59749. prefixes.forEach(({
  59750. prefix
  59751. }) => {
  59752. this._namespacePrefixes.get(prefix).pop();
  59753. });
  59754. }
  59755. if (nsAgnostic) {
  59756. this._nsAgnosticLevel--;
  59757. }
  59758. }
  59759. }
  59760. exports.Builder = Builder;
  59761. /***/ }),
  59762. /* 90 */
  59763. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59764. Object.defineProperty(exports, "__esModule", ({
  59765. value: true
  59766. }));
  59767. exports.NamespaceSetUp = void 0;
  59768. var _config = __w_pdfjs_require__(91);
  59769. var _connection_set = __w_pdfjs_require__(92);
  59770. var _datasets = __w_pdfjs_require__(93);
  59771. var _locale_set = __w_pdfjs_require__(94);
  59772. var _signature = __w_pdfjs_require__(95);
  59773. var _stylesheet = __w_pdfjs_require__(96);
  59774. var _template = __w_pdfjs_require__(82);
  59775. var _xdp = __w_pdfjs_require__(97);
  59776. var _xhtml = __w_pdfjs_require__(98);
  59777. const NamespaceSetUp = {
  59778. config: _config.ConfigNamespace,
  59779. connection: _connection_set.ConnectionSetNamespace,
  59780. datasets: _datasets.DatasetsNamespace,
  59781. localeSet: _locale_set.LocaleSetNamespace,
  59782. signature: _signature.SignatureNamespace,
  59783. stylesheet: _stylesheet.StylesheetNamespace,
  59784. template: _template.TemplateNamespace,
  59785. xdp: _xdp.XdpNamespace,
  59786. xhtml: _xhtml.XhtmlNamespace
  59787. };
  59788. exports.NamespaceSetUp = NamespaceSetUp;
  59789. /***/ }),
  59790. /* 91 */
  59791. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59792. Object.defineProperty(exports, "__esModule", ({
  59793. value: true
  59794. }));
  59795. exports.ConfigNamespace = void 0;
  59796. var _namespaces = __w_pdfjs_require__(79);
  59797. var _xfa_object = __w_pdfjs_require__(77);
  59798. var _utils = __w_pdfjs_require__(78);
  59799. var _util = __w_pdfjs_require__(2);
  59800. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  59801. class Acrobat extends _xfa_object.XFAObject {
  59802. constructor(attributes) {
  59803. super(CONFIG_NS_ID, "acrobat", true);
  59804. this.acrobat7 = null;
  59805. this.autoSave = null;
  59806. this.common = null;
  59807. this.validate = null;
  59808. this.validateApprovalSignatures = null;
  59809. this.submitUrl = new _xfa_object.XFAObjectArray();
  59810. }
  59811. }
  59812. class Acrobat7 extends _xfa_object.XFAObject {
  59813. constructor(attributes) {
  59814. super(CONFIG_NS_ID, "acrobat7", true);
  59815. this.dynamicRender = null;
  59816. }
  59817. }
  59818. class ADBE_JSConsole extends _xfa_object.OptionObject {
  59819. constructor(attributes) {
  59820. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  59821. }
  59822. }
  59823. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  59824. constructor(attributes) {
  59825. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  59826. }
  59827. }
  59828. class AddSilentPrint extends _xfa_object.Option01 {
  59829. constructor(attributes) {
  59830. super(CONFIG_NS_ID, "addSilentPrint");
  59831. }
  59832. }
  59833. class AddViewerPreferences extends _xfa_object.Option01 {
  59834. constructor(attributes) {
  59835. super(CONFIG_NS_ID, "addViewerPreferences");
  59836. }
  59837. }
  59838. class AdjustData extends _xfa_object.Option10 {
  59839. constructor(attributes) {
  59840. super(CONFIG_NS_ID, "adjustData");
  59841. }
  59842. }
  59843. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  59844. constructor(attributes) {
  59845. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  59846. }
  59847. }
  59848. class Agent extends _xfa_object.XFAObject {
  59849. constructor(attributes) {
  59850. super(CONFIG_NS_ID, "agent", true);
  59851. this.name = attributes.name ? attributes.name.trim() : "";
  59852. this.common = new _xfa_object.XFAObjectArray();
  59853. }
  59854. }
  59855. class AlwaysEmbed extends _xfa_object.ContentObject {
  59856. constructor(attributes) {
  59857. super(CONFIG_NS_ID, "alwaysEmbed");
  59858. }
  59859. }
  59860. class Amd extends _xfa_object.StringObject {
  59861. constructor(attributes) {
  59862. super(CONFIG_NS_ID, "amd");
  59863. }
  59864. }
  59865. class Area extends _xfa_object.XFAObject {
  59866. constructor(attributes) {
  59867. super(CONFIG_NS_ID, "area");
  59868. this.level = (0, _utils.getInteger)({
  59869. data: attributes.level,
  59870. defaultValue: 0,
  59871. validate: n => n >= 1 && n <= 3
  59872. });
  59873. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  59874. }
  59875. }
  59876. class Attributes extends _xfa_object.OptionObject {
  59877. constructor(attributes) {
  59878. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  59879. }
  59880. }
  59881. class AutoSave extends _xfa_object.OptionObject {
  59882. constructor(attributes) {
  59883. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  59884. }
  59885. }
  59886. class Base extends _xfa_object.StringObject {
  59887. constructor(attributes) {
  59888. super(CONFIG_NS_ID, "base");
  59889. }
  59890. }
  59891. class BatchOutput extends _xfa_object.XFAObject {
  59892. constructor(attributes) {
  59893. super(CONFIG_NS_ID, "batchOutput");
  59894. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  59895. }
  59896. }
  59897. class BehaviorOverride extends _xfa_object.ContentObject {
  59898. constructor(attributes) {
  59899. super(CONFIG_NS_ID, "behaviorOverride");
  59900. }
  59901. [_xfa_object.$finalize]() {
  59902. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  59903. }
  59904. }
  59905. class Cache extends _xfa_object.XFAObject {
  59906. constructor(attributes) {
  59907. super(CONFIG_NS_ID, "cache", true);
  59908. this.templateCache = null;
  59909. }
  59910. }
  59911. class Change extends _xfa_object.Option01 {
  59912. constructor(attributes) {
  59913. super(CONFIG_NS_ID, "change");
  59914. }
  59915. }
  59916. class Common extends _xfa_object.XFAObject {
  59917. constructor(attributes) {
  59918. super(CONFIG_NS_ID, "common", true);
  59919. this.data = null;
  59920. this.locale = null;
  59921. this.localeSet = null;
  59922. this.messaging = null;
  59923. this.suppressBanner = null;
  59924. this.template = null;
  59925. this.validationMessaging = null;
  59926. this.versionControl = null;
  59927. this.log = new _xfa_object.XFAObjectArray();
  59928. }
  59929. }
  59930. class Compress extends _xfa_object.XFAObject {
  59931. constructor(attributes) {
  59932. super(CONFIG_NS_ID, "compress");
  59933. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  59934. }
  59935. }
  59936. class CompressLogicalStructure extends _xfa_object.Option01 {
  59937. constructor(attributes) {
  59938. super(CONFIG_NS_ID, "compressLogicalStructure");
  59939. }
  59940. }
  59941. class CompressObjectStream extends _xfa_object.Option10 {
  59942. constructor(attributes) {
  59943. super(CONFIG_NS_ID, "compressObjectStream");
  59944. }
  59945. }
  59946. class Compression extends _xfa_object.XFAObject {
  59947. constructor(attributes) {
  59948. super(CONFIG_NS_ID, "compression", true);
  59949. this.compressLogicalStructure = null;
  59950. this.compressObjectStream = null;
  59951. this.level = null;
  59952. this.type = null;
  59953. }
  59954. }
  59955. class Config extends _xfa_object.XFAObject {
  59956. constructor(attributes) {
  59957. super(CONFIG_NS_ID, "config", true);
  59958. this.acrobat = null;
  59959. this.present = null;
  59960. this.trace = null;
  59961. this.agent = new _xfa_object.XFAObjectArray();
  59962. }
  59963. }
  59964. class Conformance extends _xfa_object.OptionObject {
  59965. constructor(attributes) {
  59966. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  59967. }
  59968. }
  59969. class ContentCopy extends _xfa_object.Option01 {
  59970. constructor(attributes) {
  59971. super(CONFIG_NS_ID, "contentCopy");
  59972. }
  59973. }
  59974. class Copies extends _xfa_object.IntegerObject {
  59975. constructor(attributes) {
  59976. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  59977. }
  59978. }
  59979. class Creator extends _xfa_object.StringObject {
  59980. constructor(attributes) {
  59981. super(CONFIG_NS_ID, "creator");
  59982. }
  59983. }
  59984. class CurrentPage extends _xfa_object.IntegerObject {
  59985. constructor(attributes) {
  59986. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  59987. }
  59988. }
  59989. class Data extends _xfa_object.XFAObject {
  59990. constructor(attributes) {
  59991. super(CONFIG_NS_ID, "data", true);
  59992. this.adjustData = null;
  59993. this.attributes = null;
  59994. this.incrementalLoad = null;
  59995. this.outputXSL = null;
  59996. this.range = null;
  59997. this.record = null;
  59998. this.startNode = null;
  59999. this.uri = null;
  60000. this.window = null;
  60001. this.xsl = null;
  60002. this.excludeNS = new _xfa_object.XFAObjectArray();
  60003. this.transform = new _xfa_object.XFAObjectArray();
  60004. }
  60005. }
  60006. class Debug extends _xfa_object.XFAObject {
  60007. constructor(attributes) {
  60008. super(CONFIG_NS_ID, "debug", true);
  60009. this.uri = null;
  60010. }
  60011. }
  60012. class DefaultTypeface extends _xfa_object.ContentObject {
  60013. constructor(attributes) {
  60014. super(CONFIG_NS_ID, "defaultTypeface");
  60015. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  60016. }
  60017. }
  60018. class Destination extends _xfa_object.OptionObject {
  60019. constructor(attributes) {
  60020. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  60021. }
  60022. }
  60023. class DocumentAssembly extends _xfa_object.Option01 {
  60024. constructor(attributes) {
  60025. super(CONFIG_NS_ID, "documentAssembly");
  60026. }
  60027. }
  60028. class Driver extends _xfa_object.XFAObject {
  60029. constructor(attributes) {
  60030. super(CONFIG_NS_ID, "driver", true);
  60031. this.name = attributes.name ? attributes.name.trim() : "";
  60032. this.fontInfo = null;
  60033. this.xdc = null;
  60034. }
  60035. }
  60036. class DuplexOption extends _xfa_object.OptionObject {
  60037. constructor(attributes) {
  60038. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  60039. }
  60040. }
  60041. class DynamicRender extends _xfa_object.OptionObject {
  60042. constructor(attributes) {
  60043. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  60044. }
  60045. }
  60046. class Embed extends _xfa_object.Option01 {
  60047. constructor(attributes) {
  60048. super(CONFIG_NS_ID, "embed");
  60049. }
  60050. }
  60051. class Encrypt extends _xfa_object.Option01 {
  60052. constructor(attributes) {
  60053. super(CONFIG_NS_ID, "encrypt");
  60054. }
  60055. }
  60056. class Encryption extends _xfa_object.XFAObject {
  60057. constructor(attributes) {
  60058. super(CONFIG_NS_ID, "encryption", true);
  60059. this.encrypt = null;
  60060. this.encryptionLevel = null;
  60061. this.permissions = null;
  60062. }
  60063. }
  60064. class EncryptionLevel extends _xfa_object.OptionObject {
  60065. constructor(attributes) {
  60066. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  60067. }
  60068. }
  60069. class Enforce extends _xfa_object.StringObject {
  60070. constructor(attributes) {
  60071. super(CONFIG_NS_ID, "enforce");
  60072. }
  60073. }
  60074. class Equate extends _xfa_object.XFAObject {
  60075. constructor(attributes) {
  60076. super(CONFIG_NS_ID, "equate");
  60077. this.force = (0, _utils.getInteger)({
  60078. data: attributes.force,
  60079. defaultValue: 1,
  60080. validate: n => n === 0
  60081. });
  60082. this.from = attributes.from || "";
  60083. this.to = attributes.to || "";
  60084. }
  60085. }
  60086. class EquateRange extends _xfa_object.XFAObject {
  60087. constructor(attributes) {
  60088. super(CONFIG_NS_ID, "equateRange");
  60089. this.from = attributes.from || "";
  60090. this.to = attributes.to || "";
  60091. this._unicodeRange = attributes.unicodeRange || "";
  60092. }
  60093. get unicodeRange() {
  60094. const ranges = [];
  60095. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  60096. const unicodeRange = this._unicodeRange;
  60097. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  60098. range = range.split("-", 2).map(x => {
  60099. const found = x.match(unicodeRegex);
  60100. if (!found) {
  60101. return 0;
  60102. }
  60103. return parseInt(found[1], 16);
  60104. });
  60105. if (range.length === 1) {
  60106. range.push(range[0]);
  60107. }
  60108. ranges.push(range);
  60109. }
  60110. return (0, _util.shadow)(this, "unicodeRange", ranges);
  60111. }
  60112. }
  60113. class Exclude extends _xfa_object.ContentObject {
  60114. constructor(attributes) {
  60115. super(CONFIG_NS_ID, "exclude");
  60116. }
  60117. [_xfa_object.$finalize]() {
  60118. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  60119. }
  60120. }
  60121. class ExcludeNS extends _xfa_object.StringObject {
  60122. constructor(attributes) {
  60123. super(CONFIG_NS_ID, "excludeNS");
  60124. }
  60125. }
  60126. class FlipLabel extends _xfa_object.OptionObject {
  60127. constructor(attributes) {
  60128. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  60129. }
  60130. }
  60131. class FontInfo extends _xfa_object.XFAObject {
  60132. constructor(attributes) {
  60133. super(CONFIG_NS_ID, "fontInfo", true);
  60134. this.embed = null;
  60135. this.map = null;
  60136. this.subsetBelow = null;
  60137. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  60138. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  60139. this.neverEmbed = new _xfa_object.XFAObjectArray();
  60140. }
  60141. }
  60142. class FormFieldFilling extends _xfa_object.Option01 {
  60143. constructor(attributes) {
  60144. super(CONFIG_NS_ID, "formFieldFilling");
  60145. }
  60146. }
  60147. class GroupParent extends _xfa_object.StringObject {
  60148. constructor(attributes) {
  60149. super(CONFIG_NS_ID, "groupParent");
  60150. }
  60151. }
  60152. class IfEmpty extends _xfa_object.OptionObject {
  60153. constructor(attributes) {
  60154. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  60155. }
  60156. }
  60157. class IncludeXDPContent extends _xfa_object.StringObject {
  60158. constructor(attributes) {
  60159. super(CONFIG_NS_ID, "includeXDPContent");
  60160. }
  60161. }
  60162. class IncrementalLoad extends _xfa_object.OptionObject {
  60163. constructor(attributes) {
  60164. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  60165. }
  60166. }
  60167. class IncrementalMerge extends _xfa_object.Option01 {
  60168. constructor(attributes) {
  60169. super(CONFIG_NS_ID, "incrementalMerge");
  60170. }
  60171. }
  60172. class Interactive extends _xfa_object.Option01 {
  60173. constructor(attributes) {
  60174. super(CONFIG_NS_ID, "interactive");
  60175. }
  60176. }
  60177. class Jog extends _xfa_object.OptionObject {
  60178. constructor(attributes) {
  60179. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  60180. }
  60181. }
  60182. class LabelPrinter extends _xfa_object.XFAObject {
  60183. constructor(attributes) {
  60184. super(CONFIG_NS_ID, "labelPrinter", true);
  60185. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  60186. this.batchOutput = null;
  60187. this.flipLabel = null;
  60188. this.fontInfo = null;
  60189. this.xdc = null;
  60190. }
  60191. }
  60192. class Layout extends _xfa_object.OptionObject {
  60193. constructor(attributes) {
  60194. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  60195. }
  60196. }
  60197. class Level extends _xfa_object.IntegerObject {
  60198. constructor(attributes) {
  60199. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  60200. }
  60201. }
  60202. class Linearized extends _xfa_object.Option01 {
  60203. constructor(attributes) {
  60204. super(CONFIG_NS_ID, "linearized");
  60205. }
  60206. }
  60207. class Locale extends _xfa_object.StringObject {
  60208. constructor(attributes) {
  60209. super(CONFIG_NS_ID, "locale");
  60210. }
  60211. }
  60212. class LocaleSet extends _xfa_object.StringObject {
  60213. constructor(attributes) {
  60214. super(CONFIG_NS_ID, "localeSet");
  60215. }
  60216. }
  60217. class Log extends _xfa_object.XFAObject {
  60218. constructor(attributes) {
  60219. super(CONFIG_NS_ID, "log", true);
  60220. this.mode = null;
  60221. this.threshold = null;
  60222. this.to = null;
  60223. this.uri = null;
  60224. }
  60225. }
  60226. class MapElement extends _xfa_object.XFAObject {
  60227. constructor(attributes) {
  60228. super(CONFIG_NS_ID, "map", true);
  60229. this.equate = new _xfa_object.XFAObjectArray();
  60230. this.equateRange = new _xfa_object.XFAObjectArray();
  60231. }
  60232. }
  60233. class MediumInfo extends _xfa_object.XFAObject {
  60234. constructor(attributes) {
  60235. super(CONFIG_NS_ID, "mediumInfo", true);
  60236. this.map = null;
  60237. }
  60238. }
  60239. class Message extends _xfa_object.XFAObject {
  60240. constructor(attributes) {
  60241. super(CONFIG_NS_ID, "message", true);
  60242. this.msgId = null;
  60243. this.severity = null;
  60244. }
  60245. }
  60246. class Messaging extends _xfa_object.XFAObject {
  60247. constructor(attributes) {
  60248. super(CONFIG_NS_ID, "messaging", true);
  60249. this.message = new _xfa_object.XFAObjectArray();
  60250. }
  60251. }
  60252. class Mode extends _xfa_object.OptionObject {
  60253. constructor(attributes) {
  60254. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  60255. }
  60256. }
  60257. class ModifyAnnots extends _xfa_object.Option01 {
  60258. constructor(attributes) {
  60259. super(CONFIG_NS_ID, "modifyAnnots");
  60260. }
  60261. }
  60262. class MsgId extends _xfa_object.IntegerObject {
  60263. constructor(attributes) {
  60264. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  60265. }
  60266. }
  60267. class NameAttr extends _xfa_object.StringObject {
  60268. constructor(attributes) {
  60269. super(CONFIG_NS_ID, "nameAttr");
  60270. }
  60271. }
  60272. class NeverEmbed extends _xfa_object.ContentObject {
  60273. constructor(attributes) {
  60274. super(CONFIG_NS_ID, "neverEmbed");
  60275. }
  60276. }
  60277. class NumberOfCopies extends _xfa_object.IntegerObject {
  60278. constructor(attributes) {
  60279. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  60280. }
  60281. }
  60282. class OpenAction extends _xfa_object.XFAObject {
  60283. constructor(attributes) {
  60284. super(CONFIG_NS_ID, "openAction", true);
  60285. this.destination = null;
  60286. }
  60287. }
  60288. class Output extends _xfa_object.XFAObject {
  60289. constructor(attributes) {
  60290. super(CONFIG_NS_ID, "output", true);
  60291. this.to = null;
  60292. this.type = null;
  60293. this.uri = null;
  60294. }
  60295. }
  60296. class OutputBin extends _xfa_object.StringObject {
  60297. constructor(attributes) {
  60298. super(CONFIG_NS_ID, "outputBin");
  60299. }
  60300. }
  60301. class OutputXSL extends _xfa_object.XFAObject {
  60302. constructor(attributes) {
  60303. super(CONFIG_NS_ID, "outputXSL", true);
  60304. this.uri = null;
  60305. }
  60306. }
  60307. class Overprint extends _xfa_object.OptionObject {
  60308. constructor(attributes) {
  60309. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  60310. }
  60311. }
  60312. class Packets extends _xfa_object.StringObject {
  60313. constructor(attributes) {
  60314. super(CONFIG_NS_ID, "packets");
  60315. }
  60316. [_xfa_object.$finalize]() {
  60317. if (this[_xfa_object.$content] === "*") {
  60318. return;
  60319. }
  60320. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  60321. }
  60322. }
  60323. class PageOffset extends _xfa_object.XFAObject {
  60324. constructor(attributes) {
  60325. super(CONFIG_NS_ID, "pageOffset");
  60326. this.x = (0, _utils.getInteger)({
  60327. data: attributes.x,
  60328. defaultValue: "useXDCSetting",
  60329. validate: n => true
  60330. });
  60331. this.y = (0, _utils.getInteger)({
  60332. data: attributes.y,
  60333. defaultValue: "useXDCSetting",
  60334. validate: n => true
  60335. });
  60336. }
  60337. }
  60338. class PageRange extends _xfa_object.StringObject {
  60339. constructor(attributes) {
  60340. super(CONFIG_NS_ID, "pageRange");
  60341. }
  60342. [_xfa_object.$finalize]() {
  60343. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  60344. const ranges = [];
  60345. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  60346. ranges.push(numbers.slice(i, i + 2));
  60347. }
  60348. this[_xfa_object.$content] = ranges;
  60349. }
  60350. }
  60351. class Pagination extends _xfa_object.OptionObject {
  60352. constructor(attributes) {
  60353. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  60354. }
  60355. }
  60356. class PaginationOverride extends _xfa_object.OptionObject {
  60357. constructor(attributes) {
  60358. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  60359. }
  60360. }
  60361. class Part extends _xfa_object.IntegerObject {
  60362. constructor(attributes) {
  60363. super(CONFIG_NS_ID, "part", 1, n => false);
  60364. }
  60365. }
  60366. class Pcl extends _xfa_object.XFAObject {
  60367. constructor(attributes) {
  60368. super(CONFIG_NS_ID, "pcl", true);
  60369. this.name = attributes.name || "";
  60370. this.batchOutput = null;
  60371. this.fontInfo = null;
  60372. this.jog = null;
  60373. this.mediumInfo = null;
  60374. this.outputBin = null;
  60375. this.pageOffset = null;
  60376. this.staple = null;
  60377. this.xdc = null;
  60378. }
  60379. }
  60380. class Pdf extends _xfa_object.XFAObject {
  60381. constructor(attributes) {
  60382. super(CONFIG_NS_ID, "pdf", true);
  60383. this.name = attributes.name || "";
  60384. this.adobeExtensionLevel = null;
  60385. this.batchOutput = null;
  60386. this.compression = null;
  60387. this.creator = null;
  60388. this.encryption = null;
  60389. this.fontInfo = null;
  60390. this.interactive = null;
  60391. this.linearized = null;
  60392. this.openAction = null;
  60393. this.pdfa = null;
  60394. this.producer = null;
  60395. this.renderPolicy = null;
  60396. this.scriptModel = null;
  60397. this.silentPrint = null;
  60398. this.submitFormat = null;
  60399. this.tagged = null;
  60400. this.version = null;
  60401. this.viewerPreferences = null;
  60402. this.xdc = null;
  60403. }
  60404. }
  60405. class Pdfa extends _xfa_object.XFAObject {
  60406. constructor(attributes) {
  60407. super(CONFIG_NS_ID, "pdfa", true);
  60408. this.amd = null;
  60409. this.conformance = null;
  60410. this.includeXDPContent = null;
  60411. this.part = null;
  60412. }
  60413. }
  60414. class Permissions extends _xfa_object.XFAObject {
  60415. constructor(attributes) {
  60416. super(CONFIG_NS_ID, "permissions", true);
  60417. this.accessibleContent = null;
  60418. this.change = null;
  60419. this.contentCopy = null;
  60420. this.documentAssembly = null;
  60421. this.formFieldFilling = null;
  60422. this.modifyAnnots = null;
  60423. this.plaintextMetadata = null;
  60424. this.print = null;
  60425. this.printHighQuality = null;
  60426. }
  60427. }
  60428. class PickTrayByPDFSize extends _xfa_object.Option01 {
  60429. constructor(attributes) {
  60430. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  60431. }
  60432. }
  60433. class Picture extends _xfa_object.StringObject {
  60434. constructor(attributes) {
  60435. super(CONFIG_NS_ID, "picture");
  60436. }
  60437. }
  60438. class PlaintextMetadata extends _xfa_object.Option01 {
  60439. constructor(attributes) {
  60440. super(CONFIG_NS_ID, "plaintextMetadata");
  60441. }
  60442. }
  60443. class Presence extends _xfa_object.OptionObject {
  60444. constructor(attributes) {
  60445. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  60446. }
  60447. }
  60448. class Present extends _xfa_object.XFAObject {
  60449. constructor(attributes) {
  60450. super(CONFIG_NS_ID, "present", true);
  60451. this.behaviorOverride = null;
  60452. this.cache = null;
  60453. this.common = null;
  60454. this.copies = null;
  60455. this.destination = null;
  60456. this.incrementalMerge = null;
  60457. this.layout = null;
  60458. this.output = null;
  60459. this.overprint = null;
  60460. this.pagination = null;
  60461. this.paginationOverride = null;
  60462. this.script = null;
  60463. this.validate = null;
  60464. this.xdp = null;
  60465. this.driver = new _xfa_object.XFAObjectArray();
  60466. this.labelPrinter = new _xfa_object.XFAObjectArray();
  60467. this.pcl = new _xfa_object.XFAObjectArray();
  60468. this.pdf = new _xfa_object.XFAObjectArray();
  60469. this.ps = new _xfa_object.XFAObjectArray();
  60470. this.submitUrl = new _xfa_object.XFAObjectArray();
  60471. this.webClient = new _xfa_object.XFAObjectArray();
  60472. this.zpl = new _xfa_object.XFAObjectArray();
  60473. }
  60474. }
  60475. class Print extends _xfa_object.Option01 {
  60476. constructor(attributes) {
  60477. super(CONFIG_NS_ID, "print");
  60478. }
  60479. }
  60480. class PrintHighQuality extends _xfa_object.Option01 {
  60481. constructor(attributes) {
  60482. super(CONFIG_NS_ID, "printHighQuality");
  60483. }
  60484. }
  60485. class PrintScaling extends _xfa_object.OptionObject {
  60486. constructor(attributes) {
  60487. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  60488. }
  60489. }
  60490. class PrinterName extends _xfa_object.StringObject {
  60491. constructor(attributes) {
  60492. super(CONFIG_NS_ID, "printerName");
  60493. }
  60494. }
  60495. class Producer extends _xfa_object.StringObject {
  60496. constructor(attributes) {
  60497. super(CONFIG_NS_ID, "producer");
  60498. }
  60499. }
  60500. class Ps extends _xfa_object.XFAObject {
  60501. constructor(attributes) {
  60502. super(CONFIG_NS_ID, "ps", true);
  60503. this.name = attributes.name || "";
  60504. this.batchOutput = null;
  60505. this.fontInfo = null;
  60506. this.jog = null;
  60507. this.mediumInfo = null;
  60508. this.outputBin = null;
  60509. this.staple = null;
  60510. this.xdc = null;
  60511. }
  60512. }
  60513. class Range extends _xfa_object.ContentObject {
  60514. constructor(attributes) {
  60515. super(CONFIG_NS_ID, "range");
  60516. }
  60517. [_xfa_object.$finalize]() {
  60518. 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 => {
  60519. if (range.length === 1) {
  60520. range.push(range[0]);
  60521. }
  60522. return range;
  60523. });
  60524. }
  60525. }
  60526. class Record extends _xfa_object.ContentObject {
  60527. constructor(attributes) {
  60528. super(CONFIG_NS_ID, "record");
  60529. }
  60530. [_xfa_object.$finalize]() {
  60531. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  60532. const n = parseInt(this[_xfa_object.$content], 10);
  60533. if (!isNaN(n) && n >= 0) {
  60534. this[_xfa_object.$content] = n;
  60535. }
  60536. }
  60537. }
  60538. class Relevant extends _xfa_object.ContentObject {
  60539. constructor(attributes) {
  60540. super(CONFIG_NS_ID, "relevant");
  60541. }
  60542. [_xfa_object.$finalize]() {
  60543. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  60544. }
  60545. }
  60546. class Rename extends _xfa_object.ContentObject {
  60547. constructor(attributes) {
  60548. super(CONFIG_NS_ID, "rename");
  60549. }
  60550. [_xfa_object.$finalize]() {
  60551. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  60552. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  60553. (0, _util.warn)("XFA - Rename: invalid XFA name");
  60554. }
  60555. }
  60556. }
  60557. class RenderPolicy extends _xfa_object.OptionObject {
  60558. constructor(attributes) {
  60559. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  60560. }
  60561. }
  60562. class RunScripts extends _xfa_object.OptionObject {
  60563. constructor(attributes) {
  60564. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  60565. }
  60566. }
  60567. class Script extends _xfa_object.XFAObject {
  60568. constructor(attributes) {
  60569. super(CONFIG_NS_ID, "script", true);
  60570. this.currentPage = null;
  60571. this.exclude = null;
  60572. this.runScripts = null;
  60573. }
  60574. }
  60575. class ScriptModel extends _xfa_object.OptionObject {
  60576. constructor(attributes) {
  60577. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  60578. }
  60579. }
  60580. class Severity extends _xfa_object.OptionObject {
  60581. constructor(attributes) {
  60582. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  60583. }
  60584. }
  60585. class SilentPrint extends _xfa_object.XFAObject {
  60586. constructor(attributes) {
  60587. super(CONFIG_NS_ID, "silentPrint", true);
  60588. this.addSilentPrint = null;
  60589. this.printerName = null;
  60590. }
  60591. }
  60592. class Staple extends _xfa_object.XFAObject {
  60593. constructor(attributes) {
  60594. super(CONFIG_NS_ID, "staple");
  60595. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  60596. }
  60597. }
  60598. class StartNode extends _xfa_object.StringObject {
  60599. constructor(attributes) {
  60600. super(CONFIG_NS_ID, "startNode");
  60601. }
  60602. }
  60603. class StartPage extends _xfa_object.IntegerObject {
  60604. constructor(attributes) {
  60605. super(CONFIG_NS_ID, "startPage", 0, n => true);
  60606. }
  60607. }
  60608. class SubmitFormat extends _xfa_object.OptionObject {
  60609. constructor(attributes) {
  60610. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  60611. }
  60612. }
  60613. class SubmitUrl extends _xfa_object.StringObject {
  60614. constructor(attributes) {
  60615. super(CONFIG_NS_ID, "submitUrl");
  60616. }
  60617. }
  60618. class SubsetBelow extends _xfa_object.IntegerObject {
  60619. constructor(attributes) {
  60620. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  60621. }
  60622. }
  60623. class SuppressBanner extends _xfa_object.Option01 {
  60624. constructor(attributes) {
  60625. super(CONFIG_NS_ID, "suppressBanner");
  60626. }
  60627. }
  60628. class Tagged extends _xfa_object.Option01 {
  60629. constructor(attributes) {
  60630. super(CONFIG_NS_ID, "tagged");
  60631. }
  60632. }
  60633. class Template extends _xfa_object.XFAObject {
  60634. constructor(attributes) {
  60635. super(CONFIG_NS_ID, "template", true);
  60636. this.base = null;
  60637. this.relevant = null;
  60638. this.startPage = null;
  60639. this.uri = null;
  60640. this.xsl = null;
  60641. }
  60642. }
  60643. class Threshold extends _xfa_object.OptionObject {
  60644. constructor(attributes) {
  60645. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  60646. }
  60647. }
  60648. class To extends _xfa_object.OptionObject {
  60649. constructor(attributes) {
  60650. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  60651. }
  60652. }
  60653. class TemplateCache extends _xfa_object.XFAObject {
  60654. constructor(attributes) {
  60655. super(CONFIG_NS_ID, "templateCache");
  60656. this.maxEntries = (0, _utils.getInteger)({
  60657. data: attributes.maxEntries,
  60658. defaultValue: 5,
  60659. validate: n => n >= 0
  60660. });
  60661. }
  60662. }
  60663. class Trace extends _xfa_object.XFAObject {
  60664. constructor(attributes) {
  60665. super(CONFIG_NS_ID, "trace", true);
  60666. this.area = new _xfa_object.XFAObjectArray();
  60667. }
  60668. }
  60669. class Transform extends _xfa_object.XFAObject {
  60670. constructor(attributes) {
  60671. super(CONFIG_NS_ID, "transform", true);
  60672. this.groupParent = null;
  60673. this.ifEmpty = null;
  60674. this.nameAttr = null;
  60675. this.picture = null;
  60676. this.presence = null;
  60677. this.rename = null;
  60678. this.whitespace = null;
  60679. }
  60680. }
  60681. class Type extends _xfa_object.OptionObject {
  60682. constructor(attributes) {
  60683. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  60684. }
  60685. }
  60686. class Uri extends _xfa_object.StringObject {
  60687. constructor(attributes) {
  60688. super(CONFIG_NS_ID, "uri");
  60689. }
  60690. }
  60691. class Validate extends _xfa_object.OptionObject {
  60692. constructor(attributes) {
  60693. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  60694. }
  60695. }
  60696. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  60697. constructor(attributes) {
  60698. super(CONFIG_NS_ID, "validateApprovalSignatures");
  60699. }
  60700. [_xfa_object.$finalize]() {
  60701. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  60702. }
  60703. }
  60704. class ValidationMessaging extends _xfa_object.OptionObject {
  60705. constructor(attributes) {
  60706. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  60707. }
  60708. }
  60709. class Version extends _xfa_object.OptionObject {
  60710. constructor(attributes) {
  60711. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  60712. }
  60713. }
  60714. class VersionControl extends _xfa_object.XFAObject {
  60715. constructor(attributes) {
  60716. super(CONFIG_NS_ID, "VersionControl");
  60717. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  60718. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  60719. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  60720. }
  60721. }
  60722. class ViewerPreferences extends _xfa_object.XFAObject {
  60723. constructor(attributes) {
  60724. super(CONFIG_NS_ID, "viewerPreferences", true);
  60725. this.ADBE_JSConsole = null;
  60726. this.ADBE_JSDebugger = null;
  60727. this.addViewerPreferences = null;
  60728. this.duplexOption = null;
  60729. this.enforce = null;
  60730. this.numberOfCopies = null;
  60731. this.pageRange = null;
  60732. this.pickTrayByPDFSize = null;
  60733. this.printScaling = null;
  60734. }
  60735. }
  60736. class WebClient extends _xfa_object.XFAObject {
  60737. constructor(attributes) {
  60738. super(CONFIG_NS_ID, "webClient", true);
  60739. this.name = attributes.name ? attributes.name.trim() : "";
  60740. this.fontInfo = null;
  60741. this.xdc = null;
  60742. }
  60743. }
  60744. class Whitespace extends _xfa_object.OptionObject {
  60745. constructor(attributes) {
  60746. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  60747. }
  60748. }
  60749. class Window extends _xfa_object.ContentObject {
  60750. constructor(attributes) {
  60751. super(CONFIG_NS_ID, "window");
  60752. }
  60753. [_xfa_object.$finalize]() {
  60754. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  60755. if (pair.some(x => isNaN(x))) {
  60756. this[_xfa_object.$content] = [0, 0];
  60757. return;
  60758. }
  60759. if (pair.length === 1) {
  60760. pair.push(pair[0]);
  60761. }
  60762. this[_xfa_object.$content] = pair;
  60763. }
  60764. }
  60765. class Xdc extends _xfa_object.XFAObject {
  60766. constructor(attributes) {
  60767. super(CONFIG_NS_ID, "xdc", true);
  60768. this.uri = new _xfa_object.XFAObjectArray();
  60769. this.xsl = new _xfa_object.XFAObjectArray();
  60770. }
  60771. }
  60772. class Xdp extends _xfa_object.XFAObject {
  60773. constructor(attributes) {
  60774. super(CONFIG_NS_ID, "xdp", true);
  60775. this.packets = null;
  60776. }
  60777. }
  60778. class Xsl extends _xfa_object.XFAObject {
  60779. constructor(attributes) {
  60780. super(CONFIG_NS_ID, "xsl", true);
  60781. this.debug = null;
  60782. this.uri = null;
  60783. }
  60784. }
  60785. class Zpl extends _xfa_object.XFAObject {
  60786. constructor(attributes) {
  60787. super(CONFIG_NS_ID, "zpl", true);
  60788. this.name = attributes.name ? attributes.name.trim() : "";
  60789. this.batchOutput = null;
  60790. this.flipLabel = null;
  60791. this.fontInfo = null;
  60792. this.xdc = null;
  60793. }
  60794. }
  60795. class ConfigNamespace {
  60796. static [_namespaces.$buildXFAObject](name, attributes) {
  60797. if (ConfigNamespace.hasOwnProperty(name)) {
  60798. return ConfigNamespace[name](attributes);
  60799. }
  60800. return undefined;
  60801. }
  60802. static acrobat(attrs) {
  60803. return new Acrobat(attrs);
  60804. }
  60805. static acrobat7(attrs) {
  60806. return new Acrobat7(attrs);
  60807. }
  60808. static ADBE_JSConsole(attrs) {
  60809. return new ADBE_JSConsole(attrs);
  60810. }
  60811. static ADBE_JSDebugger(attrs) {
  60812. return new ADBE_JSDebugger(attrs);
  60813. }
  60814. static addSilentPrint(attrs) {
  60815. return new AddSilentPrint(attrs);
  60816. }
  60817. static addViewerPreferences(attrs) {
  60818. return new AddViewerPreferences(attrs);
  60819. }
  60820. static adjustData(attrs) {
  60821. return new AdjustData(attrs);
  60822. }
  60823. static adobeExtensionLevel(attrs) {
  60824. return new AdobeExtensionLevel(attrs);
  60825. }
  60826. static agent(attrs) {
  60827. return new Agent(attrs);
  60828. }
  60829. static alwaysEmbed(attrs) {
  60830. return new AlwaysEmbed(attrs);
  60831. }
  60832. static amd(attrs) {
  60833. return new Amd(attrs);
  60834. }
  60835. static area(attrs) {
  60836. return new Area(attrs);
  60837. }
  60838. static attributes(attrs) {
  60839. return new Attributes(attrs);
  60840. }
  60841. static autoSave(attrs) {
  60842. return new AutoSave(attrs);
  60843. }
  60844. static base(attrs) {
  60845. return new Base(attrs);
  60846. }
  60847. static batchOutput(attrs) {
  60848. return new BatchOutput(attrs);
  60849. }
  60850. static behaviorOverride(attrs) {
  60851. return new BehaviorOverride(attrs);
  60852. }
  60853. static cache(attrs) {
  60854. return new Cache(attrs);
  60855. }
  60856. static change(attrs) {
  60857. return new Change(attrs);
  60858. }
  60859. static common(attrs) {
  60860. return new Common(attrs);
  60861. }
  60862. static compress(attrs) {
  60863. return new Compress(attrs);
  60864. }
  60865. static compressLogicalStructure(attrs) {
  60866. return new CompressLogicalStructure(attrs);
  60867. }
  60868. static compressObjectStream(attrs) {
  60869. return new CompressObjectStream(attrs);
  60870. }
  60871. static compression(attrs) {
  60872. return new Compression(attrs);
  60873. }
  60874. static config(attrs) {
  60875. return new Config(attrs);
  60876. }
  60877. static conformance(attrs) {
  60878. return new Conformance(attrs);
  60879. }
  60880. static contentCopy(attrs) {
  60881. return new ContentCopy(attrs);
  60882. }
  60883. static copies(attrs) {
  60884. return new Copies(attrs);
  60885. }
  60886. static creator(attrs) {
  60887. return new Creator(attrs);
  60888. }
  60889. static currentPage(attrs) {
  60890. return new CurrentPage(attrs);
  60891. }
  60892. static data(attrs) {
  60893. return new Data(attrs);
  60894. }
  60895. static debug(attrs) {
  60896. return new Debug(attrs);
  60897. }
  60898. static defaultTypeface(attrs) {
  60899. return new DefaultTypeface(attrs);
  60900. }
  60901. static destination(attrs) {
  60902. return new Destination(attrs);
  60903. }
  60904. static documentAssembly(attrs) {
  60905. return new DocumentAssembly(attrs);
  60906. }
  60907. static driver(attrs) {
  60908. return new Driver(attrs);
  60909. }
  60910. static duplexOption(attrs) {
  60911. return new DuplexOption(attrs);
  60912. }
  60913. static dynamicRender(attrs) {
  60914. return new DynamicRender(attrs);
  60915. }
  60916. static embed(attrs) {
  60917. return new Embed(attrs);
  60918. }
  60919. static encrypt(attrs) {
  60920. return new Encrypt(attrs);
  60921. }
  60922. static encryption(attrs) {
  60923. return new Encryption(attrs);
  60924. }
  60925. static encryptionLevel(attrs) {
  60926. return new EncryptionLevel(attrs);
  60927. }
  60928. static enforce(attrs) {
  60929. return new Enforce(attrs);
  60930. }
  60931. static equate(attrs) {
  60932. return new Equate(attrs);
  60933. }
  60934. static equateRange(attrs) {
  60935. return new EquateRange(attrs);
  60936. }
  60937. static exclude(attrs) {
  60938. return new Exclude(attrs);
  60939. }
  60940. static excludeNS(attrs) {
  60941. return new ExcludeNS(attrs);
  60942. }
  60943. static flipLabel(attrs) {
  60944. return new FlipLabel(attrs);
  60945. }
  60946. static fontInfo(attrs) {
  60947. return new FontInfo(attrs);
  60948. }
  60949. static formFieldFilling(attrs) {
  60950. return new FormFieldFilling(attrs);
  60951. }
  60952. static groupParent(attrs) {
  60953. return new GroupParent(attrs);
  60954. }
  60955. static ifEmpty(attrs) {
  60956. return new IfEmpty(attrs);
  60957. }
  60958. static includeXDPContent(attrs) {
  60959. return new IncludeXDPContent(attrs);
  60960. }
  60961. static incrementalLoad(attrs) {
  60962. return new IncrementalLoad(attrs);
  60963. }
  60964. static incrementalMerge(attrs) {
  60965. return new IncrementalMerge(attrs);
  60966. }
  60967. static interactive(attrs) {
  60968. return new Interactive(attrs);
  60969. }
  60970. static jog(attrs) {
  60971. return new Jog(attrs);
  60972. }
  60973. static labelPrinter(attrs) {
  60974. return new LabelPrinter(attrs);
  60975. }
  60976. static layout(attrs) {
  60977. return new Layout(attrs);
  60978. }
  60979. static level(attrs) {
  60980. return new Level(attrs);
  60981. }
  60982. static linearized(attrs) {
  60983. return new Linearized(attrs);
  60984. }
  60985. static locale(attrs) {
  60986. return new Locale(attrs);
  60987. }
  60988. static localeSet(attrs) {
  60989. return new LocaleSet(attrs);
  60990. }
  60991. static log(attrs) {
  60992. return new Log(attrs);
  60993. }
  60994. static map(attrs) {
  60995. return new MapElement(attrs);
  60996. }
  60997. static mediumInfo(attrs) {
  60998. return new MediumInfo(attrs);
  60999. }
  61000. static message(attrs) {
  61001. return new Message(attrs);
  61002. }
  61003. static messaging(attrs) {
  61004. return new Messaging(attrs);
  61005. }
  61006. static mode(attrs) {
  61007. return new Mode(attrs);
  61008. }
  61009. static modifyAnnots(attrs) {
  61010. return new ModifyAnnots(attrs);
  61011. }
  61012. static msgId(attrs) {
  61013. return new MsgId(attrs);
  61014. }
  61015. static nameAttr(attrs) {
  61016. return new NameAttr(attrs);
  61017. }
  61018. static neverEmbed(attrs) {
  61019. return new NeverEmbed(attrs);
  61020. }
  61021. static numberOfCopies(attrs) {
  61022. return new NumberOfCopies(attrs);
  61023. }
  61024. static openAction(attrs) {
  61025. return new OpenAction(attrs);
  61026. }
  61027. static output(attrs) {
  61028. return new Output(attrs);
  61029. }
  61030. static outputBin(attrs) {
  61031. return new OutputBin(attrs);
  61032. }
  61033. static outputXSL(attrs) {
  61034. return new OutputXSL(attrs);
  61035. }
  61036. static overprint(attrs) {
  61037. return new Overprint(attrs);
  61038. }
  61039. static packets(attrs) {
  61040. return new Packets(attrs);
  61041. }
  61042. static pageOffset(attrs) {
  61043. return new PageOffset(attrs);
  61044. }
  61045. static pageRange(attrs) {
  61046. return new PageRange(attrs);
  61047. }
  61048. static pagination(attrs) {
  61049. return new Pagination(attrs);
  61050. }
  61051. static paginationOverride(attrs) {
  61052. return new PaginationOverride(attrs);
  61053. }
  61054. static part(attrs) {
  61055. return new Part(attrs);
  61056. }
  61057. static pcl(attrs) {
  61058. return new Pcl(attrs);
  61059. }
  61060. static pdf(attrs) {
  61061. return new Pdf(attrs);
  61062. }
  61063. static pdfa(attrs) {
  61064. return new Pdfa(attrs);
  61065. }
  61066. static permissions(attrs) {
  61067. return new Permissions(attrs);
  61068. }
  61069. static pickTrayByPDFSize(attrs) {
  61070. return new PickTrayByPDFSize(attrs);
  61071. }
  61072. static picture(attrs) {
  61073. return new Picture(attrs);
  61074. }
  61075. static plaintextMetadata(attrs) {
  61076. return new PlaintextMetadata(attrs);
  61077. }
  61078. static presence(attrs) {
  61079. return new Presence(attrs);
  61080. }
  61081. static present(attrs) {
  61082. return new Present(attrs);
  61083. }
  61084. static print(attrs) {
  61085. return new Print(attrs);
  61086. }
  61087. static printHighQuality(attrs) {
  61088. return new PrintHighQuality(attrs);
  61089. }
  61090. static printScaling(attrs) {
  61091. return new PrintScaling(attrs);
  61092. }
  61093. static printerName(attrs) {
  61094. return new PrinterName(attrs);
  61095. }
  61096. static producer(attrs) {
  61097. return new Producer(attrs);
  61098. }
  61099. static ps(attrs) {
  61100. return new Ps(attrs);
  61101. }
  61102. static range(attrs) {
  61103. return new Range(attrs);
  61104. }
  61105. static record(attrs) {
  61106. return new Record(attrs);
  61107. }
  61108. static relevant(attrs) {
  61109. return new Relevant(attrs);
  61110. }
  61111. static rename(attrs) {
  61112. return new Rename(attrs);
  61113. }
  61114. static renderPolicy(attrs) {
  61115. return new RenderPolicy(attrs);
  61116. }
  61117. static runScripts(attrs) {
  61118. return new RunScripts(attrs);
  61119. }
  61120. static script(attrs) {
  61121. return new Script(attrs);
  61122. }
  61123. static scriptModel(attrs) {
  61124. return new ScriptModel(attrs);
  61125. }
  61126. static severity(attrs) {
  61127. return new Severity(attrs);
  61128. }
  61129. static silentPrint(attrs) {
  61130. return new SilentPrint(attrs);
  61131. }
  61132. static staple(attrs) {
  61133. return new Staple(attrs);
  61134. }
  61135. static startNode(attrs) {
  61136. return new StartNode(attrs);
  61137. }
  61138. static startPage(attrs) {
  61139. return new StartPage(attrs);
  61140. }
  61141. static submitFormat(attrs) {
  61142. return new SubmitFormat(attrs);
  61143. }
  61144. static submitUrl(attrs) {
  61145. return new SubmitUrl(attrs);
  61146. }
  61147. static subsetBelow(attrs) {
  61148. return new SubsetBelow(attrs);
  61149. }
  61150. static suppressBanner(attrs) {
  61151. return new SuppressBanner(attrs);
  61152. }
  61153. static tagged(attrs) {
  61154. return new Tagged(attrs);
  61155. }
  61156. static template(attrs) {
  61157. return new Template(attrs);
  61158. }
  61159. static templateCache(attrs) {
  61160. return new TemplateCache(attrs);
  61161. }
  61162. static threshold(attrs) {
  61163. return new Threshold(attrs);
  61164. }
  61165. static to(attrs) {
  61166. return new To(attrs);
  61167. }
  61168. static trace(attrs) {
  61169. return new Trace(attrs);
  61170. }
  61171. static transform(attrs) {
  61172. return new Transform(attrs);
  61173. }
  61174. static type(attrs) {
  61175. return new Type(attrs);
  61176. }
  61177. static uri(attrs) {
  61178. return new Uri(attrs);
  61179. }
  61180. static validate(attrs) {
  61181. return new Validate(attrs);
  61182. }
  61183. static validateApprovalSignatures(attrs) {
  61184. return new ValidateApprovalSignatures(attrs);
  61185. }
  61186. static validationMessaging(attrs) {
  61187. return new ValidationMessaging(attrs);
  61188. }
  61189. static version(attrs) {
  61190. return new Version(attrs);
  61191. }
  61192. static versionControl(attrs) {
  61193. return new VersionControl(attrs);
  61194. }
  61195. static viewerPreferences(attrs) {
  61196. return new ViewerPreferences(attrs);
  61197. }
  61198. static webClient(attrs) {
  61199. return new WebClient(attrs);
  61200. }
  61201. static whitespace(attrs) {
  61202. return new Whitespace(attrs);
  61203. }
  61204. static window(attrs) {
  61205. return new Window(attrs);
  61206. }
  61207. static xdc(attrs) {
  61208. return new Xdc(attrs);
  61209. }
  61210. static xdp(attrs) {
  61211. return new Xdp(attrs);
  61212. }
  61213. static xsl(attrs) {
  61214. return new Xsl(attrs);
  61215. }
  61216. static zpl(attrs) {
  61217. return new Zpl(attrs);
  61218. }
  61219. }
  61220. exports.ConfigNamespace = ConfigNamespace;
  61221. /***/ }),
  61222. /* 92 */
  61223. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61224. Object.defineProperty(exports, "__esModule", ({
  61225. value: true
  61226. }));
  61227. exports.ConnectionSetNamespace = void 0;
  61228. var _namespaces = __w_pdfjs_require__(79);
  61229. var _xfa_object = __w_pdfjs_require__(77);
  61230. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  61231. class ConnectionSet extends _xfa_object.XFAObject {
  61232. constructor(attributes) {
  61233. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  61234. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  61235. this.xmlConnection = new _xfa_object.XFAObjectArray();
  61236. this.xsdConnection = new _xfa_object.XFAObjectArray();
  61237. }
  61238. }
  61239. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  61240. constructor(attributes) {
  61241. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  61242. this.id = attributes.id || "";
  61243. this.name = attributes.name || "";
  61244. this.use = attributes.use || "";
  61245. this.usehref = attributes.usehref || "";
  61246. }
  61247. }
  61248. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  61249. constructor(attributes) {
  61250. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  61251. this.id = attributes.id || "";
  61252. this.name = attributes.name || "";
  61253. this.use = attributes.use || "";
  61254. this.usehref = attributes.usehref || "";
  61255. }
  61256. }
  61257. class Operation extends _xfa_object.StringObject {
  61258. constructor(attributes) {
  61259. super(CONNECTION_SET_NS_ID, "operation");
  61260. this.id = attributes.id || "";
  61261. this.input = attributes.input || "";
  61262. this.name = attributes.name || "";
  61263. this.output = attributes.output || "";
  61264. this.use = attributes.use || "";
  61265. this.usehref = attributes.usehref || "";
  61266. }
  61267. }
  61268. class RootElement extends _xfa_object.StringObject {
  61269. constructor(attributes) {
  61270. super(CONNECTION_SET_NS_ID, "rootElement");
  61271. this.id = attributes.id || "";
  61272. this.name = attributes.name || "";
  61273. this.use = attributes.use || "";
  61274. this.usehref = attributes.usehref || "";
  61275. }
  61276. }
  61277. class SoapAction extends _xfa_object.StringObject {
  61278. constructor(attributes) {
  61279. super(CONNECTION_SET_NS_ID, "soapAction");
  61280. this.id = attributes.id || "";
  61281. this.name = attributes.name || "";
  61282. this.use = attributes.use || "";
  61283. this.usehref = attributes.usehref || "";
  61284. }
  61285. }
  61286. class SoapAddress extends _xfa_object.StringObject {
  61287. constructor(attributes) {
  61288. super(CONNECTION_SET_NS_ID, "soapAddress");
  61289. this.id = attributes.id || "";
  61290. this.name = attributes.name || "";
  61291. this.use = attributes.use || "";
  61292. this.usehref = attributes.usehref || "";
  61293. }
  61294. }
  61295. class Uri extends _xfa_object.StringObject {
  61296. constructor(attributes) {
  61297. super(CONNECTION_SET_NS_ID, "uri");
  61298. this.id = attributes.id || "";
  61299. this.name = attributes.name || "";
  61300. this.use = attributes.use || "";
  61301. this.usehref = attributes.usehref || "";
  61302. }
  61303. }
  61304. class WsdlAddress extends _xfa_object.StringObject {
  61305. constructor(attributes) {
  61306. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  61307. this.id = attributes.id || "";
  61308. this.name = attributes.name || "";
  61309. this.use = attributes.use || "";
  61310. this.usehref = attributes.usehref || "";
  61311. }
  61312. }
  61313. class WsdlConnection extends _xfa_object.XFAObject {
  61314. constructor(attributes) {
  61315. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  61316. this.dataDescription = attributes.dataDescription || "";
  61317. this.name = attributes.name || "";
  61318. this.effectiveInputPolicy = null;
  61319. this.effectiveOutputPolicy = null;
  61320. this.operation = null;
  61321. this.soapAction = null;
  61322. this.soapAddress = null;
  61323. this.wsdlAddress = null;
  61324. }
  61325. }
  61326. class XmlConnection extends _xfa_object.XFAObject {
  61327. constructor(attributes) {
  61328. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  61329. this.dataDescription = attributes.dataDescription || "";
  61330. this.name = attributes.name || "";
  61331. this.uri = null;
  61332. }
  61333. }
  61334. class XsdConnection extends _xfa_object.XFAObject {
  61335. constructor(attributes) {
  61336. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  61337. this.dataDescription = attributes.dataDescription || "";
  61338. this.name = attributes.name || "";
  61339. this.rootElement = null;
  61340. this.uri = null;
  61341. }
  61342. }
  61343. class ConnectionSetNamespace {
  61344. static [_namespaces.$buildXFAObject](name, attributes) {
  61345. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  61346. return ConnectionSetNamespace[name](attributes);
  61347. }
  61348. return undefined;
  61349. }
  61350. static connectionSet(attrs) {
  61351. return new ConnectionSet(attrs);
  61352. }
  61353. static effectiveInputPolicy(attrs) {
  61354. return new EffectiveInputPolicy(attrs);
  61355. }
  61356. static effectiveOutputPolicy(attrs) {
  61357. return new EffectiveOutputPolicy(attrs);
  61358. }
  61359. static operation(attrs) {
  61360. return new Operation(attrs);
  61361. }
  61362. static rootElement(attrs) {
  61363. return new RootElement(attrs);
  61364. }
  61365. static soapAction(attrs) {
  61366. return new SoapAction(attrs);
  61367. }
  61368. static soapAddress(attrs) {
  61369. return new SoapAddress(attrs);
  61370. }
  61371. static uri(attrs) {
  61372. return new Uri(attrs);
  61373. }
  61374. static wsdlAddress(attrs) {
  61375. return new WsdlAddress(attrs);
  61376. }
  61377. static wsdlConnection(attrs) {
  61378. return new WsdlConnection(attrs);
  61379. }
  61380. static xmlConnection(attrs) {
  61381. return new XmlConnection(attrs);
  61382. }
  61383. static xsdConnection(attrs) {
  61384. return new XsdConnection(attrs);
  61385. }
  61386. }
  61387. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  61388. /***/ }),
  61389. /* 93 */
  61390. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61391. Object.defineProperty(exports, "__esModule", ({
  61392. value: true
  61393. }));
  61394. exports.DatasetsNamespace = void 0;
  61395. var _xfa_object = __w_pdfjs_require__(77);
  61396. var _namespaces = __w_pdfjs_require__(79);
  61397. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  61398. class Data extends _xfa_object.XmlObject {
  61399. constructor(attributes) {
  61400. super(DATASETS_NS_ID, "data", attributes);
  61401. }
  61402. [_xfa_object.$isNsAgnostic]() {
  61403. return true;
  61404. }
  61405. }
  61406. class Datasets extends _xfa_object.XFAObject {
  61407. constructor(attributes) {
  61408. super(DATASETS_NS_ID, "datasets", true);
  61409. this.data = null;
  61410. this.Signature = null;
  61411. }
  61412. [_xfa_object.$onChild](child) {
  61413. const name = child[_xfa_object.$nodeName];
  61414. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  61415. this[name] = child;
  61416. }
  61417. this[_xfa_object.$appendChild](child);
  61418. }
  61419. }
  61420. class DatasetsNamespace {
  61421. static [_namespaces.$buildXFAObject](name, attributes) {
  61422. if (DatasetsNamespace.hasOwnProperty(name)) {
  61423. return DatasetsNamespace[name](attributes);
  61424. }
  61425. return undefined;
  61426. }
  61427. static datasets(attributes) {
  61428. return new Datasets(attributes);
  61429. }
  61430. static data(attributes) {
  61431. return new Data(attributes);
  61432. }
  61433. }
  61434. exports.DatasetsNamespace = DatasetsNamespace;
  61435. /***/ }),
  61436. /* 94 */
  61437. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61438. Object.defineProperty(exports, "__esModule", ({
  61439. value: true
  61440. }));
  61441. exports.LocaleSetNamespace = void 0;
  61442. var _namespaces = __w_pdfjs_require__(79);
  61443. var _xfa_object = __w_pdfjs_require__(77);
  61444. var _utils = __w_pdfjs_require__(78);
  61445. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  61446. class CalendarSymbols extends _xfa_object.XFAObject {
  61447. constructor(attributes) {
  61448. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  61449. this.name = "gregorian";
  61450. this.dayNames = new _xfa_object.XFAObjectArray(2);
  61451. this.eraNames = null;
  61452. this.meridiemNames = null;
  61453. this.monthNames = new _xfa_object.XFAObjectArray(2);
  61454. }
  61455. }
  61456. class CurrencySymbol extends _xfa_object.StringObject {
  61457. constructor(attributes) {
  61458. super(LOCALE_SET_NS_ID, "currencySymbol");
  61459. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  61460. }
  61461. }
  61462. class CurrencySymbols extends _xfa_object.XFAObject {
  61463. constructor(attributes) {
  61464. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  61465. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  61466. }
  61467. }
  61468. class DatePattern extends _xfa_object.StringObject {
  61469. constructor(attributes) {
  61470. super(LOCALE_SET_NS_ID, "datePattern");
  61471. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61472. }
  61473. }
  61474. class DatePatterns extends _xfa_object.XFAObject {
  61475. constructor(attributes) {
  61476. super(LOCALE_SET_NS_ID, "datePatterns", true);
  61477. this.datePattern = new _xfa_object.XFAObjectArray(4);
  61478. }
  61479. }
  61480. class DateTimeSymbols extends _xfa_object.ContentObject {
  61481. constructor(attributes) {
  61482. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  61483. }
  61484. }
  61485. class Day extends _xfa_object.StringObject {
  61486. constructor(attributes) {
  61487. super(LOCALE_SET_NS_ID, "day");
  61488. }
  61489. }
  61490. class DayNames extends _xfa_object.XFAObject {
  61491. constructor(attributes) {
  61492. super(LOCALE_SET_NS_ID, "dayNames", true);
  61493. this.abbr = (0, _utils.getInteger)({
  61494. data: attributes.abbr,
  61495. defaultValue: 0,
  61496. validate: x => x === 1
  61497. });
  61498. this.day = new _xfa_object.XFAObjectArray(7);
  61499. }
  61500. }
  61501. class Era extends _xfa_object.StringObject {
  61502. constructor(attributes) {
  61503. super(LOCALE_SET_NS_ID, "era");
  61504. }
  61505. }
  61506. class EraNames extends _xfa_object.XFAObject {
  61507. constructor(attributes) {
  61508. super(LOCALE_SET_NS_ID, "eraNames", true);
  61509. this.era = new _xfa_object.XFAObjectArray(2);
  61510. }
  61511. }
  61512. class Locale extends _xfa_object.XFAObject {
  61513. constructor(attributes) {
  61514. super(LOCALE_SET_NS_ID, "locale", true);
  61515. this.desc = attributes.desc || "";
  61516. this.name = "isoname";
  61517. this.calendarSymbols = null;
  61518. this.currencySymbols = null;
  61519. this.datePatterns = null;
  61520. this.dateTimeSymbols = null;
  61521. this.numberPatterns = null;
  61522. this.numberSymbols = null;
  61523. this.timePatterns = null;
  61524. this.typeFaces = null;
  61525. }
  61526. }
  61527. class LocaleSet extends _xfa_object.XFAObject {
  61528. constructor(attributes) {
  61529. super(LOCALE_SET_NS_ID, "localeSet", true);
  61530. this.locale = new _xfa_object.XFAObjectArray();
  61531. }
  61532. }
  61533. class Meridiem extends _xfa_object.StringObject {
  61534. constructor(attributes) {
  61535. super(LOCALE_SET_NS_ID, "meridiem");
  61536. }
  61537. }
  61538. class MeridiemNames extends _xfa_object.XFAObject {
  61539. constructor(attributes) {
  61540. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  61541. this.meridiem = new _xfa_object.XFAObjectArray(2);
  61542. }
  61543. }
  61544. class Month extends _xfa_object.StringObject {
  61545. constructor(attributes) {
  61546. super(LOCALE_SET_NS_ID, "month");
  61547. }
  61548. }
  61549. class MonthNames extends _xfa_object.XFAObject {
  61550. constructor(attributes) {
  61551. super(LOCALE_SET_NS_ID, "monthNames", true);
  61552. this.abbr = (0, _utils.getInteger)({
  61553. data: attributes.abbr,
  61554. defaultValue: 0,
  61555. validate: x => x === 1
  61556. });
  61557. this.month = new _xfa_object.XFAObjectArray(12);
  61558. }
  61559. }
  61560. class NumberPattern extends _xfa_object.StringObject {
  61561. constructor(attributes) {
  61562. super(LOCALE_SET_NS_ID, "numberPattern");
  61563. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61564. }
  61565. }
  61566. class NumberPatterns extends _xfa_object.XFAObject {
  61567. constructor(attributes) {
  61568. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  61569. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  61570. }
  61571. }
  61572. class NumberSymbol extends _xfa_object.StringObject {
  61573. constructor(attributes) {
  61574. super(LOCALE_SET_NS_ID, "numberSymbol");
  61575. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  61576. }
  61577. }
  61578. class NumberSymbols extends _xfa_object.XFAObject {
  61579. constructor(attributes) {
  61580. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  61581. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  61582. }
  61583. }
  61584. class TimePattern extends _xfa_object.StringObject {
  61585. constructor(attributes) {
  61586. super(LOCALE_SET_NS_ID, "timePattern");
  61587. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  61588. }
  61589. }
  61590. class TimePatterns extends _xfa_object.XFAObject {
  61591. constructor(attributes) {
  61592. super(LOCALE_SET_NS_ID, "timePatterns", true);
  61593. this.timePattern = new _xfa_object.XFAObjectArray(4);
  61594. }
  61595. }
  61596. class TypeFace extends _xfa_object.XFAObject {
  61597. constructor(attributes) {
  61598. super(LOCALE_SET_NS_ID, "typeFace", true);
  61599. this.name = attributes.name | "";
  61600. }
  61601. }
  61602. class TypeFaces extends _xfa_object.XFAObject {
  61603. constructor(attributes) {
  61604. super(LOCALE_SET_NS_ID, "typeFaces", true);
  61605. this.typeFace = new _xfa_object.XFAObjectArray();
  61606. }
  61607. }
  61608. class LocaleSetNamespace {
  61609. static [_namespaces.$buildXFAObject](name, attributes) {
  61610. if (LocaleSetNamespace.hasOwnProperty(name)) {
  61611. return LocaleSetNamespace[name](attributes);
  61612. }
  61613. return undefined;
  61614. }
  61615. static calendarSymbols(attrs) {
  61616. return new CalendarSymbols(attrs);
  61617. }
  61618. static currencySymbol(attrs) {
  61619. return new CurrencySymbol(attrs);
  61620. }
  61621. static currencySymbols(attrs) {
  61622. return new CurrencySymbols(attrs);
  61623. }
  61624. static datePattern(attrs) {
  61625. return new DatePattern(attrs);
  61626. }
  61627. static datePatterns(attrs) {
  61628. return new DatePatterns(attrs);
  61629. }
  61630. static dateTimeSymbols(attrs) {
  61631. return new DateTimeSymbols(attrs);
  61632. }
  61633. static day(attrs) {
  61634. return new Day(attrs);
  61635. }
  61636. static dayNames(attrs) {
  61637. return new DayNames(attrs);
  61638. }
  61639. static era(attrs) {
  61640. return new Era(attrs);
  61641. }
  61642. static eraNames(attrs) {
  61643. return new EraNames(attrs);
  61644. }
  61645. static locale(attrs) {
  61646. return new Locale(attrs);
  61647. }
  61648. static localeSet(attrs) {
  61649. return new LocaleSet(attrs);
  61650. }
  61651. static meridiem(attrs) {
  61652. return new Meridiem(attrs);
  61653. }
  61654. static meridiemNames(attrs) {
  61655. return new MeridiemNames(attrs);
  61656. }
  61657. static month(attrs) {
  61658. return new Month(attrs);
  61659. }
  61660. static monthNames(attrs) {
  61661. return new MonthNames(attrs);
  61662. }
  61663. static numberPattern(attrs) {
  61664. return new NumberPattern(attrs);
  61665. }
  61666. static numberPatterns(attrs) {
  61667. return new NumberPatterns(attrs);
  61668. }
  61669. static numberSymbol(attrs) {
  61670. return new NumberSymbol(attrs);
  61671. }
  61672. static numberSymbols(attrs) {
  61673. return new NumberSymbols(attrs);
  61674. }
  61675. static timePattern(attrs) {
  61676. return new TimePattern(attrs);
  61677. }
  61678. static timePatterns(attrs) {
  61679. return new TimePatterns(attrs);
  61680. }
  61681. static typeFace(attrs) {
  61682. return new TypeFace(attrs);
  61683. }
  61684. static typeFaces(attrs) {
  61685. return new TypeFaces(attrs);
  61686. }
  61687. }
  61688. exports.LocaleSetNamespace = LocaleSetNamespace;
  61689. /***/ }),
  61690. /* 95 */
  61691. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61692. Object.defineProperty(exports, "__esModule", ({
  61693. value: true
  61694. }));
  61695. exports.SignatureNamespace = void 0;
  61696. var _namespaces = __w_pdfjs_require__(79);
  61697. var _xfa_object = __w_pdfjs_require__(77);
  61698. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  61699. class Signature extends _xfa_object.XFAObject {
  61700. constructor(attributes) {
  61701. super(SIGNATURE_NS_ID, "signature", true);
  61702. }
  61703. }
  61704. class SignatureNamespace {
  61705. static [_namespaces.$buildXFAObject](name, attributes) {
  61706. if (SignatureNamespace.hasOwnProperty(name)) {
  61707. return SignatureNamespace[name](attributes);
  61708. }
  61709. return undefined;
  61710. }
  61711. static signature(attributes) {
  61712. return new Signature(attributes);
  61713. }
  61714. }
  61715. exports.SignatureNamespace = SignatureNamespace;
  61716. /***/ }),
  61717. /* 96 */
  61718. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61719. Object.defineProperty(exports, "__esModule", ({
  61720. value: true
  61721. }));
  61722. exports.StylesheetNamespace = void 0;
  61723. var _namespaces = __w_pdfjs_require__(79);
  61724. var _xfa_object = __w_pdfjs_require__(77);
  61725. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  61726. class Stylesheet extends _xfa_object.XFAObject {
  61727. constructor(attributes) {
  61728. super(STYLESHEET_NS_ID, "stylesheet", true);
  61729. }
  61730. }
  61731. class StylesheetNamespace {
  61732. static [_namespaces.$buildXFAObject](name, attributes) {
  61733. if (StylesheetNamespace.hasOwnProperty(name)) {
  61734. return StylesheetNamespace[name](attributes);
  61735. }
  61736. return undefined;
  61737. }
  61738. static stylesheet(attributes) {
  61739. return new Stylesheet(attributes);
  61740. }
  61741. }
  61742. exports.StylesheetNamespace = StylesheetNamespace;
  61743. /***/ }),
  61744. /* 97 */
  61745. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61746. Object.defineProperty(exports, "__esModule", ({
  61747. value: true
  61748. }));
  61749. exports.XdpNamespace = void 0;
  61750. var _namespaces = __w_pdfjs_require__(79);
  61751. var _xfa_object = __w_pdfjs_require__(77);
  61752. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  61753. class Xdp extends _xfa_object.XFAObject {
  61754. constructor(attributes) {
  61755. super(XDP_NS_ID, "xdp", true);
  61756. this.uuid = attributes.uuid || "";
  61757. this.timeStamp = attributes.timeStamp || "";
  61758. this.config = null;
  61759. this.connectionSet = null;
  61760. this.datasets = null;
  61761. this.localeSet = null;
  61762. this.stylesheet = new _xfa_object.XFAObjectArray();
  61763. this.template = null;
  61764. }
  61765. [_xfa_object.$onChildCheck](child) {
  61766. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  61767. return ns && child[_xfa_object.$namespaceId] === ns.id;
  61768. }
  61769. }
  61770. class XdpNamespace {
  61771. static [_namespaces.$buildXFAObject](name, attributes) {
  61772. if (XdpNamespace.hasOwnProperty(name)) {
  61773. return XdpNamespace[name](attributes);
  61774. }
  61775. return undefined;
  61776. }
  61777. static xdp(attributes) {
  61778. return new Xdp(attributes);
  61779. }
  61780. }
  61781. exports.XdpNamespace = XdpNamespace;
  61782. /***/ }),
  61783. /* 98 */
  61784. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61785. Object.defineProperty(exports, "__esModule", ({
  61786. value: true
  61787. }));
  61788. exports.XhtmlNamespace = void 0;
  61789. var _xfa_object = __w_pdfjs_require__(77);
  61790. var _namespaces = __w_pdfjs_require__(79);
  61791. var _html_utils = __w_pdfjs_require__(84);
  61792. var _utils = __w_pdfjs_require__(78);
  61793. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  61794. const $richText = Symbol();
  61795. 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"]);
  61796. 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) => {
  61797. value = original.fontSize = (0, _utils.getMeasurement)(value);
  61798. return (0, _html_utils.measureToString)(0.99 * value);
  61799. }], ["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))]]);
  61800. const spacesRegExp = /\s+/g;
  61801. const crlfRegExp = /[\r\n]+/g;
  61802. const crlfForRichTextRegExp = /\r\n?/g;
  61803. function mapStyle(styleStr, node, richText) {
  61804. const style = Object.create(null);
  61805. if (!styleStr) {
  61806. return style;
  61807. }
  61808. const original = Object.create(null);
  61809. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  61810. const mapping = StyleMapping.get(key);
  61811. if (mapping === "") {
  61812. continue;
  61813. }
  61814. let newValue = value;
  61815. if (mapping) {
  61816. if (typeof mapping === "string") {
  61817. newValue = mapping;
  61818. } else {
  61819. newValue = mapping(value, original);
  61820. }
  61821. }
  61822. if (key.endsWith("scale")) {
  61823. if (style.transform) {
  61824. style.transform = `${style[key]} ${newValue}`;
  61825. } else {
  61826. style.transform = newValue;
  61827. }
  61828. } else {
  61829. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  61830. }
  61831. }
  61832. if (style.fontFamily) {
  61833. (0, _html_utils.setFontFamily)({
  61834. typeface: style.fontFamily,
  61835. weight: style.fontWeight || "normal",
  61836. posture: style.fontStyle || "normal",
  61837. size: original.fontSize || 0
  61838. }, node, node[_xfa_object.$globalData].fontFinder, style);
  61839. }
  61840. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  61841. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  61842. const VERTICAL_FACTOR = 0.333;
  61843. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  61844. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  61845. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  61846. }
  61847. if (richText && style.fontSize) {
  61848. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  61849. }
  61850. (0, _html_utils.fixTextIndent)(style);
  61851. return style;
  61852. }
  61853. function checkStyle(node) {
  61854. if (!node.style) {
  61855. return "";
  61856. }
  61857. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  61858. if (key === "font-family") {
  61859. node[_xfa_object.$globalData].usedTypefaces.add(value);
  61860. }
  61861. return VALID_STYLES.has(key);
  61862. }).map(kv => kv.join(":")).join(";");
  61863. }
  61864. const NoWhites = new Set(["body", "html"]);
  61865. class XhtmlObject extends _xfa_object.XmlObject {
  61866. constructor(attributes, name) {
  61867. super(XHTML_NS_ID, name);
  61868. this[$richText] = false;
  61869. this.style = attributes.style || "";
  61870. }
  61871. [_xfa_object.$clean](builder) {
  61872. super[_xfa_object.$clean](builder);
  61873. this.style = checkStyle(this);
  61874. }
  61875. [_xfa_object.$acceptWhitespace]() {
  61876. return !NoWhites.has(this[_xfa_object.$nodeName]);
  61877. }
  61878. [_xfa_object.$onText](str, richText = false) {
  61879. if (!richText) {
  61880. str = str.replace(crlfRegExp, "");
  61881. if (!this.style.includes("xfa-spacerun:yes")) {
  61882. str = str.replace(spacesRegExp, " ");
  61883. }
  61884. } else {
  61885. this[$richText] = true;
  61886. }
  61887. if (str) {
  61888. this[_xfa_object.$content] += str;
  61889. }
  61890. }
  61891. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  61892. const xfaFont = Object.create(null);
  61893. const margin = {
  61894. top: NaN,
  61895. bottom: NaN,
  61896. left: NaN,
  61897. right: NaN
  61898. };
  61899. let lineHeight = null;
  61900. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  61901. switch (key) {
  61902. case "font-family":
  61903. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  61904. break;
  61905. case "font-size":
  61906. xfaFont.size = (0, _utils.getMeasurement)(value);
  61907. break;
  61908. case "font-weight":
  61909. xfaFont.weight = value;
  61910. break;
  61911. case "font-style":
  61912. xfaFont.posture = value;
  61913. break;
  61914. case "letter-spacing":
  61915. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  61916. break;
  61917. case "margin":
  61918. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  61919. switch (values.length) {
  61920. case 1:
  61921. margin.top = margin.bottom = margin.left = margin.right = values[0];
  61922. break;
  61923. case 2:
  61924. margin.top = margin.bottom = values[0];
  61925. margin.left = margin.right = values[1];
  61926. break;
  61927. case 3:
  61928. margin.top = values[0];
  61929. margin.bottom = values[2];
  61930. margin.left = margin.right = values[1];
  61931. break;
  61932. case 4:
  61933. margin.top = values[0];
  61934. margin.left = values[1];
  61935. margin.bottom = values[2];
  61936. margin.right = values[3];
  61937. break;
  61938. }
  61939. break;
  61940. case "margin-top":
  61941. margin.top = (0, _utils.getMeasurement)(value);
  61942. break;
  61943. case "margin-bottom":
  61944. margin.bottom = (0, _utils.getMeasurement)(value);
  61945. break;
  61946. case "margin-left":
  61947. margin.left = (0, _utils.getMeasurement)(value);
  61948. break;
  61949. case "margin-right":
  61950. margin.right = (0, _utils.getMeasurement)(value);
  61951. break;
  61952. case "line-height":
  61953. lineHeight = (0, _utils.getMeasurement)(value);
  61954. break;
  61955. }
  61956. }
  61957. measure.pushData(xfaFont, margin, lineHeight);
  61958. if (this[_xfa_object.$content]) {
  61959. measure.addString(this[_xfa_object.$content]);
  61960. } else {
  61961. for (const child of this[_xfa_object.$getChildren]()) {
  61962. if (child[_xfa_object.$nodeName] === "#text") {
  61963. measure.addString(child[_xfa_object.$content]);
  61964. continue;
  61965. }
  61966. child[_xfa_object.$pushGlyphs](measure);
  61967. }
  61968. }
  61969. if (mustPop) {
  61970. measure.popFont();
  61971. }
  61972. }
  61973. [_xfa_object.$toHTML](availableSpace) {
  61974. const children = [];
  61975. this[_xfa_object.$extra] = {
  61976. children
  61977. };
  61978. this[_xfa_object.$childrenToHTML]({});
  61979. if (children.length === 0 && !this[_xfa_object.$content]) {
  61980. return _utils.HTMLResult.EMPTY;
  61981. }
  61982. let value;
  61983. if (this[$richText]) {
  61984. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  61985. } else {
  61986. value = this[_xfa_object.$content] || undefined;
  61987. }
  61988. return _utils.HTMLResult.success({
  61989. name: this[_xfa_object.$nodeName],
  61990. attributes: {
  61991. href: this.href,
  61992. style: mapStyle(this.style, this, this[$richText])
  61993. },
  61994. children,
  61995. value
  61996. });
  61997. }
  61998. }
  61999. class A extends XhtmlObject {
  62000. constructor(attributes) {
  62001. super(attributes, "a");
  62002. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  62003. }
  62004. }
  62005. class B extends XhtmlObject {
  62006. constructor(attributes) {
  62007. super(attributes, "b");
  62008. }
  62009. [_xfa_object.$pushGlyphs](measure) {
  62010. measure.pushFont({
  62011. weight: "bold"
  62012. });
  62013. super[_xfa_object.$pushGlyphs](measure);
  62014. measure.popFont();
  62015. }
  62016. }
  62017. class Body extends XhtmlObject {
  62018. constructor(attributes) {
  62019. super(attributes, "body");
  62020. }
  62021. [_xfa_object.$toHTML](availableSpace) {
  62022. const res = super[_xfa_object.$toHTML](availableSpace);
  62023. const {
  62024. html
  62025. } = res;
  62026. if (!html) {
  62027. return _utils.HTMLResult.EMPTY;
  62028. }
  62029. html.name = "div";
  62030. html.attributes.class = ["xfaRich"];
  62031. return res;
  62032. }
  62033. }
  62034. class Br extends XhtmlObject {
  62035. constructor(attributes) {
  62036. super(attributes, "br");
  62037. }
  62038. [_xfa_object.$text]() {
  62039. return "\n";
  62040. }
  62041. [_xfa_object.$pushGlyphs](measure) {
  62042. measure.addString("\n");
  62043. }
  62044. [_xfa_object.$toHTML](availableSpace) {
  62045. return _utils.HTMLResult.success({
  62046. name: "br"
  62047. });
  62048. }
  62049. }
  62050. class Html extends XhtmlObject {
  62051. constructor(attributes) {
  62052. super(attributes, "html");
  62053. }
  62054. [_xfa_object.$toHTML](availableSpace) {
  62055. const children = [];
  62056. this[_xfa_object.$extra] = {
  62057. children
  62058. };
  62059. this[_xfa_object.$childrenToHTML]({});
  62060. if (children.length === 0) {
  62061. return _utils.HTMLResult.success({
  62062. name: "div",
  62063. attributes: {
  62064. class: ["xfaRich"],
  62065. style: {}
  62066. },
  62067. value: this[_xfa_object.$content] || ""
  62068. });
  62069. }
  62070. if (children.length === 1) {
  62071. const child = children[0];
  62072. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  62073. return _utils.HTMLResult.success(child);
  62074. }
  62075. }
  62076. return _utils.HTMLResult.success({
  62077. name: "div",
  62078. attributes: {
  62079. class: ["xfaRich"],
  62080. style: {}
  62081. },
  62082. children
  62083. });
  62084. }
  62085. }
  62086. class I extends XhtmlObject {
  62087. constructor(attributes) {
  62088. super(attributes, "i");
  62089. }
  62090. [_xfa_object.$pushGlyphs](measure) {
  62091. measure.pushFont({
  62092. posture: "italic"
  62093. });
  62094. super[_xfa_object.$pushGlyphs](measure);
  62095. measure.popFont();
  62096. }
  62097. }
  62098. class Li extends XhtmlObject {
  62099. constructor(attributes) {
  62100. super(attributes, "li");
  62101. }
  62102. }
  62103. class Ol extends XhtmlObject {
  62104. constructor(attributes) {
  62105. super(attributes, "ol");
  62106. }
  62107. }
  62108. class P extends XhtmlObject {
  62109. constructor(attributes) {
  62110. super(attributes, "p");
  62111. }
  62112. [_xfa_object.$pushGlyphs](measure) {
  62113. super[_xfa_object.$pushGlyphs](measure, false);
  62114. measure.addString("\n");
  62115. measure.addPara();
  62116. measure.popFont();
  62117. }
  62118. [_xfa_object.$text]() {
  62119. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  62120. if (siblings.at(-1) === this) {
  62121. return super[_xfa_object.$text]();
  62122. }
  62123. return super[_xfa_object.$text]() + "\n";
  62124. }
  62125. }
  62126. class Span extends XhtmlObject {
  62127. constructor(attributes) {
  62128. super(attributes, "span");
  62129. }
  62130. }
  62131. class Sub extends XhtmlObject {
  62132. constructor(attributes) {
  62133. super(attributes, "sub");
  62134. }
  62135. }
  62136. class Sup extends XhtmlObject {
  62137. constructor(attributes) {
  62138. super(attributes, "sup");
  62139. }
  62140. }
  62141. class Ul extends XhtmlObject {
  62142. constructor(attributes) {
  62143. super(attributes, "ul");
  62144. }
  62145. }
  62146. class XhtmlNamespace {
  62147. static [_namespaces.$buildXFAObject](name, attributes) {
  62148. if (XhtmlNamespace.hasOwnProperty(name)) {
  62149. return XhtmlNamespace[name](attributes);
  62150. }
  62151. return undefined;
  62152. }
  62153. static a(attributes) {
  62154. return new A(attributes);
  62155. }
  62156. static b(attributes) {
  62157. return new B(attributes);
  62158. }
  62159. static body(attributes) {
  62160. return new Body(attributes);
  62161. }
  62162. static br(attributes) {
  62163. return new Br(attributes);
  62164. }
  62165. static html(attributes) {
  62166. return new Html(attributes);
  62167. }
  62168. static i(attributes) {
  62169. return new I(attributes);
  62170. }
  62171. static li(attributes) {
  62172. return new Li(attributes);
  62173. }
  62174. static ol(attributes) {
  62175. return new Ol(attributes);
  62176. }
  62177. static p(attributes) {
  62178. return new P(attributes);
  62179. }
  62180. static span(attributes) {
  62181. return new Span(attributes);
  62182. }
  62183. static sub(attributes) {
  62184. return new Sub(attributes);
  62185. }
  62186. static sup(attributes) {
  62187. return new Sup(attributes);
  62188. }
  62189. static ul(attributes) {
  62190. return new Ul(attributes);
  62191. }
  62192. }
  62193. exports.XhtmlNamespace = XhtmlNamespace;
  62194. /***/ }),
  62195. /* 99 */
  62196. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62197. Object.defineProperty(exports, "__esModule", ({
  62198. value: true
  62199. }));
  62200. exports.UnknownNamespace = void 0;
  62201. var _namespaces = __w_pdfjs_require__(79);
  62202. var _xfa_object = __w_pdfjs_require__(77);
  62203. class UnknownNamespace {
  62204. constructor(nsId) {
  62205. this.namespaceId = nsId;
  62206. }
  62207. [_namespaces.$buildXFAObject](name, attributes) {
  62208. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  62209. }
  62210. }
  62211. exports.UnknownNamespace = UnknownNamespace;
  62212. /***/ }),
  62213. /* 100 */
  62214. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62215. Object.defineProperty(exports, "__esModule", ({
  62216. value: true
  62217. }));
  62218. exports.DatasetReader = void 0;
  62219. var _util = __w_pdfjs_require__(2);
  62220. var _core_utils = __w_pdfjs_require__(6);
  62221. var _xml_parser = __w_pdfjs_require__(66);
  62222. function decodeString(str) {
  62223. try {
  62224. return (0, _util.stringToUTF8String)(str);
  62225. } catch (ex) {
  62226. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  62227. return str;
  62228. }
  62229. }
  62230. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  62231. constructor(options) {
  62232. super(options);
  62233. this.node = null;
  62234. }
  62235. onEndElement(name) {
  62236. const node = super.onEndElement(name);
  62237. if (node && name === "xfa:datasets") {
  62238. this.node = node;
  62239. throw new Error("Aborting DatasetXMLParser.");
  62240. }
  62241. }
  62242. }
  62243. class DatasetReader {
  62244. constructor(data) {
  62245. if (data.datasets) {
  62246. this.node = new _xml_parser.SimpleXMLParser({
  62247. hasAttributes: true
  62248. }).parseFromString(data.datasets).documentElement;
  62249. } else {
  62250. const parser = new DatasetXMLParser({
  62251. hasAttributes: true
  62252. });
  62253. try {
  62254. parser.parseFromString(data["xdp:xdp"]);
  62255. } catch (_) {}
  62256. this.node = parser.node;
  62257. }
  62258. }
  62259. getValue(path) {
  62260. if (!this.node || !path) {
  62261. return "";
  62262. }
  62263. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  62264. if (!node) {
  62265. return "";
  62266. }
  62267. const first = node.firstChild;
  62268. if (first && first.nodeName === "value") {
  62269. return node.children.map(child => decodeString(child.textContent));
  62270. }
  62271. return decodeString(node.textContent);
  62272. }
  62273. }
  62274. exports.DatasetReader = DatasetReader;
  62275. /***/ }),
  62276. /* 101 */
  62277. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62278. Object.defineProperty(exports, "__esModule", ({
  62279. value: true
  62280. }));
  62281. exports.XRef = void 0;
  62282. var _util = __w_pdfjs_require__(2);
  62283. var _primitives = __w_pdfjs_require__(5);
  62284. var _core_utils = __w_pdfjs_require__(6);
  62285. var _parser = __w_pdfjs_require__(17);
  62286. var _base_stream = __w_pdfjs_require__(7);
  62287. var _crypto = __w_pdfjs_require__(67);
  62288. class XRef {
  62289. constructor(stream, pdfManager) {
  62290. this.stream = stream;
  62291. this.pdfManager = pdfManager;
  62292. this.entries = [];
  62293. this.xrefstms = Object.create(null);
  62294. this._cacheMap = new Map();
  62295. this._pendingRefs = new _primitives.RefSet();
  62296. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  62297. this._newRefNum = null;
  62298. }
  62299. getNewRef() {
  62300. if (this._newRefNum === null) {
  62301. this._newRefNum = this.entries.length || 1;
  62302. }
  62303. return _primitives.Ref.get(this._newRefNum++, 0);
  62304. }
  62305. resetNewRef() {
  62306. this._newRefNum = null;
  62307. }
  62308. setStartXRef(startXRef) {
  62309. this.startXRefQueue = [startXRef];
  62310. }
  62311. parse(recoveryMode = false) {
  62312. let trailerDict;
  62313. if (!recoveryMode) {
  62314. trailerDict = this.readXRef();
  62315. } else {
  62316. (0, _util.warn)("Indexing all PDF objects");
  62317. trailerDict = this.indexObjects();
  62318. }
  62319. trailerDict.assignXref(this);
  62320. this.trailer = trailerDict;
  62321. let encrypt;
  62322. try {
  62323. encrypt = trailerDict.get("Encrypt");
  62324. } catch (ex) {
  62325. if (ex instanceof _core_utils.MissingDataException) {
  62326. throw ex;
  62327. }
  62328. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  62329. }
  62330. if (encrypt instanceof _primitives.Dict) {
  62331. const ids = trailerDict.get("ID");
  62332. const fileId = ids && ids.length ? ids[0] : "";
  62333. encrypt.suppressEncryption = true;
  62334. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  62335. }
  62336. let root;
  62337. try {
  62338. root = trailerDict.get("Root");
  62339. } catch (ex) {
  62340. if (ex instanceof _core_utils.MissingDataException) {
  62341. throw ex;
  62342. }
  62343. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  62344. }
  62345. if (root instanceof _primitives.Dict) {
  62346. try {
  62347. const pages = root.get("Pages");
  62348. if (pages instanceof _primitives.Dict) {
  62349. this.root = root;
  62350. return;
  62351. }
  62352. } catch (ex) {
  62353. if (ex instanceof _core_utils.MissingDataException) {
  62354. throw ex;
  62355. }
  62356. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  62357. }
  62358. }
  62359. if (!recoveryMode) {
  62360. throw new _core_utils.XRefParseException();
  62361. }
  62362. throw new _util.InvalidPDFException("Invalid Root reference.");
  62363. }
  62364. processXRefTable(parser) {
  62365. if (!("tableState" in this)) {
  62366. this.tableState = {
  62367. entryNum: 0,
  62368. streamPos: parser.lexer.stream.pos,
  62369. parserBuf1: parser.buf1,
  62370. parserBuf2: parser.buf2
  62371. };
  62372. }
  62373. const obj = this.readXRefTable(parser);
  62374. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62375. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  62376. }
  62377. let dict = parser.getObj();
  62378. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  62379. dict = dict.dict;
  62380. }
  62381. if (!(dict instanceof _primitives.Dict)) {
  62382. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  62383. }
  62384. delete this.tableState;
  62385. return dict;
  62386. }
  62387. readXRefTable(parser) {
  62388. const stream = parser.lexer.stream;
  62389. const tableState = this.tableState;
  62390. stream.pos = tableState.streamPos;
  62391. parser.buf1 = tableState.parserBuf1;
  62392. parser.buf2 = tableState.parserBuf2;
  62393. let obj;
  62394. while (true) {
  62395. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  62396. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  62397. break;
  62398. }
  62399. tableState.firstEntryNum = obj;
  62400. tableState.entryCount = parser.getObj();
  62401. }
  62402. let first = tableState.firstEntryNum;
  62403. const count = tableState.entryCount;
  62404. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  62405. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  62406. }
  62407. for (let i = tableState.entryNum; i < count; i++) {
  62408. tableState.streamPos = stream.pos;
  62409. tableState.entryNum = i;
  62410. tableState.parserBuf1 = parser.buf1;
  62411. tableState.parserBuf2 = parser.buf2;
  62412. const entry = {};
  62413. entry.offset = parser.getObj();
  62414. entry.gen = parser.getObj();
  62415. const type = parser.getObj();
  62416. if (type instanceof _primitives.Cmd) {
  62417. switch (type.cmd) {
  62418. case "f":
  62419. entry.free = true;
  62420. break;
  62421. case "n":
  62422. entry.uncompressed = true;
  62423. break;
  62424. }
  62425. }
  62426. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  62427. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  62428. }
  62429. if (i === 0 && entry.free && first === 1) {
  62430. first = 0;
  62431. }
  62432. if (!this.entries[i + first]) {
  62433. this.entries[i + first] = entry;
  62434. }
  62435. }
  62436. tableState.entryNum = 0;
  62437. tableState.streamPos = stream.pos;
  62438. tableState.parserBuf1 = parser.buf1;
  62439. tableState.parserBuf2 = parser.buf2;
  62440. delete tableState.firstEntryNum;
  62441. delete tableState.entryCount;
  62442. }
  62443. if (this.entries[0] && !this.entries[0].free) {
  62444. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  62445. }
  62446. return obj;
  62447. }
  62448. processXRefStream(stream) {
  62449. if (!("streamState" in this)) {
  62450. const streamParameters = stream.dict;
  62451. const byteWidths = streamParameters.get("W");
  62452. let range = streamParameters.get("Index");
  62453. if (!range) {
  62454. range = [0, streamParameters.get("Size")];
  62455. }
  62456. this.streamState = {
  62457. entryRanges: range,
  62458. byteWidths,
  62459. entryNum: 0,
  62460. streamPos: stream.pos
  62461. };
  62462. }
  62463. this.readXRefStream(stream);
  62464. delete this.streamState;
  62465. return stream.dict;
  62466. }
  62467. readXRefStream(stream) {
  62468. const streamState = this.streamState;
  62469. stream.pos = streamState.streamPos;
  62470. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  62471. const entryRanges = streamState.entryRanges;
  62472. while (entryRanges.length > 0) {
  62473. const [first, n] = entryRanges;
  62474. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62475. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  62476. }
  62477. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  62478. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  62479. }
  62480. for (let i = streamState.entryNum; i < n; ++i) {
  62481. streamState.entryNum = i;
  62482. streamState.streamPos = stream.pos;
  62483. let type = 0,
  62484. offset = 0,
  62485. generation = 0;
  62486. for (let j = 0; j < typeFieldWidth; ++j) {
  62487. const typeByte = stream.getByte();
  62488. if (typeByte === -1) {
  62489. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  62490. }
  62491. type = type << 8 | typeByte;
  62492. }
  62493. if (typeFieldWidth === 0) {
  62494. type = 1;
  62495. }
  62496. for (let j = 0; j < offsetFieldWidth; ++j) {
  62497. const offsetByte = stream.getByte();
  62498. if (offsetByte === -1) {
  62499. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  62500. }
  62501. offset = offset << 8 | offsetByte;
  62502. }
  62503. for (let j = 0; j < generationFieldWidth; ++j) {
  62504. const generationByte = stream.getByte();
  62505. if (generationByte === -1) {
  62506. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  62507. }
  62508. generation = generation << 8 | generationByte;
  62509. }
  62510. const entry = {};
  62511. entry.offset = offset;
  62512. entry.gen = generation;
  62513. switch (type) {
  62514. case 0:
  62515. entry.free = true;
  62516. break;
  62517. case 1:
  62518. entry.uncompressed = true;
  62519. break;
  62520. case 2:
  62521. break;
  62522. default:
  62523. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  62524. }
  62525. if (!this.entries[first + i]) {
  62526. this.entries[first + i] = entry;
  62527. }
  62528. }
  62529. streamState.entryNum = 0;
  62530. streamState.streamPos = stream.pos;
  62531. entryRanges.splice(0, 2);
  62532. }
  62533. }
  62534. indexObjects() {
  62535. const TAB = 0x9,
  62536. LF = 0xa,
  62537. CR = 0xd,
  62538. SPACE = 0x20;
  62539. const PERCENT = 0x25,
  62540. LT = 0x3c;
  62541. function readToken(data, offset) {
  62542. let token = "",
  62543. ch = data[offset];
  62544. while (ch !== LF && ch !== CR && ch !== LT) {
  62545. if (++offset >= data.length) {
  62546. break;
  62547. }
  62548. token += String.fromCharCode(ch);
  62549. ch = data[offset];
  62550. }
  62551. return token;
  62552. }
  62553. function skipUntil(data, offset, what) {
  62554. const length = what.length,
  62555. dataLength = data.length;
  62556. let skipped = 0;
  62557. while (offset < dataLength) {
  62558. let i = 0;
  62559. while (i < length && data[offset + i] === what[i]) {
  62560. ++i;
  62561. }
  62562. if (i >= length) {
  62563. break;
  62564. }
  62565. offset++;
  62566. skipped++;
  62567. }
  62568. return skipped;
  62569. }
  62570. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  62571. const endobjRegExp = /\bendobj[\b\s]$/;
  62572. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  62573. const CHECK_CONTENT_LENGTH = 25;
  62574. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  62575. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  62576. const objBytes = new Uint8Array([111, 98, 106]);
  62577. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  62578. this.entries.length = 0;
  62579. this._cacheMap.clear();
  62580. const stream = this.stream;
  62581. stream.pos = 0;
  62582. const buffer = stream.getBytes(),
  62583. length = buffer.length;
  62584. let position = stream.start;
  62585. const trailers = [],
  62586. xrefStms = [];
  62587. while (position < length) {
  62588. let ch = buffer[position];
  62589. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  62590. ++position;
  62591. continue;
  62592. }
  62593. if (ch === PERCENT) {
  62594. do {
  62595. ++position;
  62596. if (position >= length) {
  62597. break;
  62598. }
  62599. ch = buffer[position];
  62600. } while (ch !== LF && ch !== CR);
  62601. continue;
  62602. }
  62603. const token = readToken(buffer, position);
  62604. let m;
  62605. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  62606. position += skipUntil(buffer, position, trailerBytes);
  62607. trailers.push(position);
  62608. position += skipUntil(buffer, position, startxrefBytes);
  62609. } else if (m = objRegExp.exec(token)) {
  62610. const num = m[1] | 0,
  62611. gen = m[2] | 0;
  62612. let contentLength,
  62613. startPos = position + token.length,
  62614. updateEntries = false;
  62615. if (!this.entries[num]) {
  62616. updateEntries = true;
  62617. } else if (this.entries[num].gen === gen) {
  62618. try {
  62619. const parser = new _parser.Parser({
  62620. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  62621. });
  62622. parser.getObj();
  62623. updateEntries = true;
  62624. } catch (ex) {
  62625. if (ex instanceof _core_utils.ParserEOFException) {
  62626. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  62627. } else {
  62628. updateEntries = true;
  62629. }
  62630. }
  62631. }
  62632. if (updateEntries) {
  62633. this.entries[num] = {
  62634. offset: position - stream.start,
  62635. gen,
  62636. uncompressed: true
  62637. };
  62638. }
  62639. while (startPos < buffer.length) {
  62640. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  62641. contentLength = endPos - position;
  62642. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  62643. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  62644. if (endobjRegExp.test(tokenStr)) {
  62645. break;
  62646. } else {
  62647. const objToken = nestedObjRegExp.exec(tokenStr);
  62648. if (objToken && objToken[1]) {
  62649. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  62650. contentLength -= objToken[1].length;
  62651. break;
  62652. }
  62653. }
  62654. startPos = endPos;
  62655. }
  62656. const content = buffer.subarray(position, position + contentLength);
  62657. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  62658. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  62659. xrefStms.push(position - stream.start);
  62660. this.xrefstms[position - stream.start] = 1;
  62661. }
  62662. position += contentLength;
  62663. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  62664. trailers.push(position);
  62665. position += skipUntil(buffer, position, startxrefBytes);
  62666. } else {
  62667. position += token.length + 1;
  62668. }
  62669. }
  62670. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  62671. this.startXRefQueue.push(xrefStms[i]);
  62672. this.readXRef(true);
  62673. }
  62674. let trailerDict;
  62675. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  62676. stream.pos = trailers[i];
  62677. const parser = new _parser.Parser({
  62678. lexer: new _parser.Lexer(stream),
  62679. xref: this,
  62680. allowStreams: true,
  62681. recoveryMode: true
  62682. });
  62683. const obj = parser.getObj();
  62684. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  62685. continue;
  62686. }
  62687. const dict = parser.getObj();
  62688. if (!(dict instanceof _primitives.Dict)) {
  62689. continue;
  62690. }
  62691. try {
  62692. const rootDict = dict.get("Root");
  62693. if (!(rootDict instanceof _primitives.Dict)) {
  62694. continue;
  62695. }
  62696. const pagesDict = rootDict.get("Pages");
  62697. if (!(pagesDict instanceof _primitives.Dict)) {
  62698. continue;
  62699. }
  62700. const pagesCount = pagesDict.get("Count");
  62701. if (!Number.isInteger(pagesCount)) {
  62702. continue;
  62703. }
  62704. } catch (ex) {
  62705. continue;
  62706. }
  62707. if (dict.has("ID")) {
  62708. return dict;
  62709. }
  62710. trailerDict = dict;
  62711. }
  62712. if (trailerDict) {
  62713. return trailerDict;
  62714. }
  62715. if (this.topDict) {
  62716. return this.topDict;
  62717. }
  62718. throw new _util.InvalidPDFException("Invalid PDF structure.");
  62719. }
  62720. readXRef(recoveryMode = false) {
  62721. const stream = this.stream;
  62722. const startXRefParsedCache = new Set();
  62723. try {
  62724. while (this.startXRefQueue.length) {
  62725. const startXRef = this.startXRefQueue[0];
  62726. if (startXRefParsedCache.has(startXRef)) {
  62727. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  62728. this.startXRefQueue.shift();
  62729. continue;
  62730. }
  62731. startXRefParsedCache.add(startXRef);
  62732. stream.pos = startXRef + stream.start;
  62733. const parser = new _parser.Parser({
  62734. lexer: new _parser.Lexer(stream),
  62735. xref: this,
  62736. allowStreams: true
  62737. });
  62738. let obj = parser.getObj();
  62739. let dict;
  62740. if ((0, _primitives.isCmd)(obj, "xref")) {
  62741. dict = this.processXRefTable(parser);
  62742. if (!this.topDict) {
  62743. this.topDict = dict;
  62744. }
  62745. obj = dict.get("XRefStm");
  62746. if (Number.isInteger(obj)) {
  62747. const pos = obj;
  62748. if (!(pos in this.xrefstms)) {
  62749. this.xrefstms[pos] = 1;
  62750. this.startXRefQueue.push(pos);
  62751. }
  62752. }
  62753. } else if (Number.isInteger(obj)) {
  62754. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  62755. throw new _util.FormatError("Invalid XRef stream");
  62756. }
  62757. dict = this.processXRefStream(obj);
  62758. if (!this.topDict) {
  62759. this.topDict = dict;
  62760. }
  62761. if (!dict) {
  62762. throw new _util.FormatError("Failed to read XRef stream");
  62763. }
  62764. } else {
  62765. throw new _util.FormatError("Invalid XRef stream header");
  62766. }
  62767. obj = dict.get("Prev");
  62768. if (Number.isInteger(obj)) {
  62769. this.startXRefQueue.push(obj);
  62770. } else if (obj instanceof _primitives.Ref) {
  62771. this.startXRefQueue.push(obj.num);
  62772. }
  62773. this.startXRefQueue.shift();
  62774. }
  62775. return this.topDict;
  62776. } catch (e) {
  62777. if (e instanceof _core_utils.MissingDataException) {
  62778. throw e;
  62779. }
  62780. (0, _util.info)("(while reading XRef): " + e);
  62781. this.startXRefQueue.shift();
  62782. }
  62783. if (recoveryMode) {
  62784. return undefined;
  62785. }
  62786. throw new _core_utils.XRefParseException();
  62787. }
  62788. getEntry(i) {
  62789. const xrefEntry = this.entries[i];
  62790. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  62791. return xrefEntry;
  62792. }
  62793. return null;
  62794. }
  62795. fetchIfRef(obj, suppressEncryption = false) {
  62796. if (obj instanceof _primitives.Ref) {
  62797. return this.fetch(obj, suppressEncryption);
  62798. }
  62799. return obj;
  62800. }
  62801. fetch(ref, suppressEncryption = false) {
  62802. if (!(ref instanceof _primitives.Ref)) {
  62803. throw new Error("ref object is not a reference");
  62804. }
  62805. const num = ref.num;
  62806. const cacheEntry = this._cacheMap.get(num);
  62807. if (cacheEntry !== undefined) {
  62808. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  62809. cacheEntry.objId = ref.toString();
  62810. }
  62811. return cacheEntry;
  62812. }
  62813. let xrefEntry = this.getEntry(num);
  62814. if (xrefEntry === null) {
  62815. this._cacheMap.set(num, xrefEntry);
  62816. return xrefEntry;
  62817. }
  62818. if (this._pendingRefs.has(ref)) {
  62819. this._pendingRefs.remove(ref);
  62820. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  62821. return _primitives.CIRCULAR_REF;
  62822. }
  62823. this._pendingRefs.put(ref);
  62824. try {
  62825. if (xrefEntry.uncompressed) {
  62826. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  62827. } else {
  62828. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  62829. }
  62830. this._pendingRefs.remove(ref);
  62831. } catch (ex) {
  62832. this._pendingRefs.remove(ref);
  62833. throw ex;
  62834. }
  62835. if (xrefEntry instanceof _primitives.Dict) {
  62836. xrefEntry.objId = ref.toString();
  62837. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  62838. xrefEntry.dict.objId = ref.toString();
  62839. }
  62840. return xrefEntry;
  62841. }
  62842. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  62843. const gen = ref.gen;
  62844. let num = ref.num;
  62845. if (xrefEntry.gen !== gen) {
  62846. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  62847. }
  62848. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  62849. const parser = new _parser.Parser({
  62850. lexer: new _parser.Lexer(stream),
  62851. xref: this,
  62852. allowStreams: true
  62853. });
  62854. const obj1 = parser.getObj();
  62855. const obj2 = parser.getObj();
  62856. const obj3 = parser.getObj();
  62857. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  62858. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62859. }
  62860. if (obj3.cmd !== "obj") {
  62861. if (obj3.cmd.startsWith("obj")) {
  62862. num = parseInt(obj3.cmd.substring(3), 10);
  62863. if (!Number.isNaN(num)) {
  62864. return num;
  62865. }
  62866. }
  62867. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62868. }
  62869. if (this.encrypt && !suppressEncryption) {
  62870. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  62871. } else {
  62872. xrefEntry = parser.getObj();
  62873. }
  62874. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  62875. this._cacheMap.set(num, xrefEntry);
  62876. }
  62877. return xrefEntry;
  62878. }
  62879. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  62880. const tableOffset = xrefEntry.offset;
  62881. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  62882. if (!(stream instanceof _base_stream.BaseStream)) {
  62883. throw new _util.FormatError("bad ObjStm stream");
  62884. }
  62885. const first = stream.dict.get("First");
  62886. const n = stream.dict.get("N");
  62887. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62888. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  62889. }
  62890. let parser = new _parser.Parser({
  62891. lexer: new _parser.Lexer(stream),
  62892. xref: this,
  62893. allowStreams: true
  62894. });
  62895. const nums = new Array(n);
  62896. const offsets = new Array(n);
  62897. for (let i = 0; i < n; ++i) {
  62898. const num = parser.getObj();
  62899. if (!Number.isInteger(num)) {
  62900. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  62901. }
  62902. const offset = parser.getObj();
  62903. if (!Number.isInteger(offset)) {
  62904. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  62905. }
  62906. nums[i] = num;
  62907. offsets[i] = offset;
  62908. }
  62909. const start = (stream.start || 0) + first;
  62910. const entries = new Array(n);
  62911. for (let i = 0; i < n; ++i) {
  62912. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  62913. if (length < 0) {
  62914. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  62915. }
  62916. parser = new _parser.Parser({
  62917. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  62918. xref: this,
  62919. allowStreams: true
  62920. });
  62921. const obj = parser.getObj();
  62922. entries[i] = obj;
  62923. if (obj instanceof _base_stream.BaseStream) {
  62924. continue;
  62925. }
  62926. const num = nums[i],
  62927. entry = this.entries[num];
  62928. if (entry && entry.offset === tableOffset && entry.gen === i) {
  62929. this._cacheMap.set(num, obj);
  62930. }
  62931. }
  62932. xrefEntry = entries[xrefEntry.gen];
  62933. if (xrefEntry === undefined) {
  62934. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  62935. }
  62936. return xrefEntry;
  62937. }
  62938. async fetchIfRefAsync(obj, suppressEncryption) {
  62939. if (obj instanceof _primitives.Ref) {
  62940. return this.fetchAsync(obj, suppressEncryption);
  62941. }
  62942. return obj;
  62943. }
  62944. async fetchAsync(ref, suppressEncryption) {
  62945. try {
  62946. return this.fetch(ref, suppressEncryption);
  62947. } catch (ex) {
  62948. if (!(ex instanceof _core_utils.MissingDataException)) {
  62949. throw ex;
  62950. }
  62951. await this.pdfManager.requestRange(ex.begin, ex.end);
  62952. return this.fetchAsync(ref, suppressEncryption);
  62953. }
  62954. }
  62955. getCatalogObj() {
  62956. return this.root;
  62957. }
  62958. }
  62959. exports.XRef = XRef;
  62960. /***/ }),
  62961. /* 102 */
  62962. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62963. Object.defineProperty(exports, "__esModule", ({
  62964. value: true
  62965. }));
  62966. exports.MessageHandler = void 0;
  62967. var _util = __w_pdfjs_require__(2);
  62968. const CallbackKind = {
  62969. UNKNOWN: 0,
  62970. DATA: 1,
  62971. ERROR: 2
  62972. };
  62973. const StreamKind = {
  62974. UNKNOWN: 0,
  62975. CANCEL: 1,
  62976. CANCEL_COMPLETE: 2,
  62977. CLOSE: 3,
  62978. ENQUEUE: 4,
  62979. ERROR: 5,
  62980. PULL: 6,
  62981. PULL_COMPLETE: 7,
  62982. START_COMPLETE: 8
  62983. };
  62984. function wrapReason(reason) {
  62985. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  62986. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  62987. }
  62988. switch (reason.name) {
  62989. case "AbortException":
  62990. return new _util.AbortException(reason.message);
  62991. case "MissingPDFException":
  62992. return new _util.MissingPDFException(reason.message);
  62993. case "PasswordException":
  62994. return new _util.PasswordException(reason.message, reason.code);
  62995. case "UnexpectedResponseException":
  62996. return new _util.UnexpectedResponseException(reason.message, reason.status);
  62997. case "UnknownErrorException":
  62998. return new _util.UnknownErrorException(reason.message, reason.details);
  62999. default:
  63000. return new _util.UnknownErrorException(reason.message, reason.toString());
  63001. }
  63002. }
  63003. class MessageHandler {
  63004. constructor(sourceName, targetName, comObj) {
  63005. this.sourceName = sourceName;
  63006. this.targetName = targetName;
  63007. this.comObj = comObj;
  63008. this.callbackId = 1;
  63009. this.streamId = 1;
  63010. this.streamSinks = Object.create(null);
  63011. this.streamControllers = Object.create(null);
  63012. this.callbackCapabilities = Object.create(null);
  63013. this.actionHandler = Object.create(null);
  63014. this._onComObjOnMessage = event => {
  63015. const data = event.data;
  63016. if (data.targetName !== this.sourceName) {
  63017. return;
  63018. }
  63019. if (data.stream) {
  63020. this._processStreamMessage(data);
  63021. return;
  63022. }
  63023. if (data.callback) {
  63024. const callbackId = data.callbackId;
  63025. const capability = this.callbackCapabilities[callbackId];
  63026. if (!capability) {
  63027. throw new Error(`Cannot resolve callback ${callbackId}`);
  63028. }
  63029. delete this.callbackCapabilities[callbackId];
  63030. if (data.callback === CallbackKind.DATA) {
  63031. capability.resolve(data.data);
  63032. } else if (data.callback === CallbackKind.ERROR) {
  63033. capability.reject(wrapReason(data.reason));
  63034. } else {
  63035. throw new Error("Unexpected callback case");
  63036. }
  63037. return;
  63038. }
  63039. const action = this.actionHandler[data.action];
  63040. if (!action) {
  63041. throw new Error(`Unknown action from worker: ${data.action}`);
  63042. }
  63043. if (data.callbackId) {
  63044. const cbSourceName = this.sourceName;
  63045. const cbTargetName = data.sourceName;
  63046. new Promise(function (resolve) {
  63047. resolve(action(data.data));
  63048. }).then(function (result) {
  63049. comObj.postMessage({
  63050. sourceName: cbSourceName,
  63051. targetName: cbTargetName,
  63052. callback: CallbackKind.DATA,
  63053. callbackId: data.callbackId,
  63054. data: result
  63055. });
  63056. }, function (reason) {
  63057. comObj.postMessage({
  63058. sourceName: cbSourceName,
  63059. targetName: cbTargetName,
  63060. callback: CallbackKind.ERROR,
  63061. callbackId: data.callbackId,
  63062. reason: wrapReason(reason)
  63063. });
  63064. });
  63065. return;
  63066. }
  63067. if (data.streamId) {
  63068. this._createStreamSink(data);
  63069. return;
  63070. }
  63071. action(data.data);
  63072. };
  63073. comObj.addEventListener("message", this._onComObjOnMessage);
  63074. }
  63075. on(actionName, handler) {
  63076. const ah = this.actionHandler;
  63077. if (ah[actionName]) {
  63078. throw new Error(`There is already an actionName called "${actionName}"`);
  63079. }
  63080. ah[actionName] = handler;
  63081. }
  63082. send(actionName, data, transfers) {
  63083. this.comObj.postMessage({
  63084. sourceName: this.sourceName,
  63085. targetName: this.targetName,
  63086. action: actionName,
  63087. data
  63088. }, transfers);
  63089. }
  63090. sendWithPromise(actionName, data, transfers) {
  63091. const callbackId = this.callbackId++;
  63092. const capability = (0, _util.createPromiseCapability)();
  63093. this.callbackCapabilities[callbackId] = capability;
  63094. try {
  63095. this.comObj.postMessage({
  63096. sourceName: this.sourceName,
  63097. targetName: this.targetName,
  63098. action: actionName,
  63099. callbackId,
  63100. data
  63101. }, transfers);
  63102. } catch (ex) {
  63103. capability.reject(ex);
  63104. }
  63105. return capability.promise;
  63106. }
  63107. sendWithStream(actionName, data, queueingStrategy, transfers) {
  63108. const streamId = this.streamId++,
  63109. sourceName = this.sourceName,
  63110. targetName = this.targetName,
  63111. comObj = this.comObj;
  63112. return new ReadableStream({
  63113. start: controller => {
  63114. const startCapability = (0, _util.createPromiseCapability)();
  63115. this.streamControllers[streamId] = {
  63116. controller,
  63117. startCall: startCapability,
  63118. pullCall: null,
  63119. cancelCall: null,
  63120. isClosed: false
  63121. };
  63122. comObj.postMessage({
  63123. sourceName,
  63124. targetName,
  63125. action: actionName,
  63126. streamId,
  63127. data,
  63128. desiredSize: controller.desiredSize
  63129. }, transfers);
  63130. return startCapability.promise;
  63131. },
  63132. pull: controller => {
  63133. const pullCapability = (0, _util.createPromiseCapability)();
  63134. this.streamControllers[streamId].pullCall = pullCapability;
  63135. comObj.postMessage({
  63136. sourceName,
  63137. targetName,
  63138. stream: StreamKind.PULL,
  63139. streamId,
  63140. desiredSize: controller.desiredSize
  63141. });
  63142. return pullCapability.promise;
  63143. },
  63144. cancel: reason => {
  63145. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  63146. const cancelCapability = (0, _util.createPromiseCapability)();
  63147. this.streamControllers[streamId].cancelCall = cancelCapability;
  63148. this.streamControllers[streamId].isClosed = true;
  63149. comObj.postMessage({
  63150. sourceName,
  63151. targetName,
  63152. stream: StreamKind.CANCEL,
  63153. streamId,
  63154. reason: wrapReason(reason)
  63155. });
  63156. return cancelCapability.promise;
  63157. }
  63158. }, queueingStrategy);
  63159. }
  63160. _createStreamSink(data) {
  63161. const streamId = data.streamId,
  63162. sourceName = this.sourceName,
  63163. targetName = data.sourceName,
  63164. comObj = this.comObj;
  63165. const self = this,
  63166. action = this.actionHandler[data.action];
  63167. const streamSink = {
  63168. enqueue(chunk, size = 1, transfers) {
  63169. if (this.isCancelled) {
  63170. return;
  63171. }
  63172. const lastDesiredSize = this.desiredSize;
  63173. this.desiredSize -= size;
  63174. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  63175. this.sinkCapability = (0, _util.createPromiseCapability)();
  63176. this.ready = this.sinkCapability.promise;
  63177. }
  63178. comObj.postMessage({
  63179. sourceName,
  63180. targetName,
  63181. stream: StreamKind.ENQUEUE,
  63182. streamId,
  63183. chunk
  63184. }, transfers);
  63185. },
  63186. close() {
  63187. if (this.isCancelled) {
  63188. return;
  63189. }
  63190. this.isCancelled = true;
  63191. comObj.postMessage({
  63192. sourceName,
  63193. targetName,
  63194. stream: StreamKind.CLOSE,
  63195. streamId
  63196. });
  63197. delete self.streamSinks[streamId];
  63198. },
  63199. error(reason) {
  63200. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  63201. if (this.isCancelled) {
  63202. return;
  63203. }
  63204. this.isCancelled = true;
  63205. comObj.postMessage({
  63206. sourceName,
  63207. targetName,
  63208. stream: StreamKind.ERROR,
  63209. streamId,
  63210. reason: wrapReason(reason)
  63211. });
  63212. },
  63213. sinkCapability: (0, _util.createPromiseCapability)(),
  63214. onPull: null,
  63215. onCancel: null,
  63216. isCancelled: false,
  63217. desiredSize: data.desiredSize,
  63218. ready: null
  63219. };
  63220. streamSink.sinkCapability.resolve();
  63221. streamSink.ready = streamSink.sinkCapability.promise;
  63222. this.streamSinks[streamId] = streamSink;
  63223. new Promise(function (resolve) {
  63224. resolve(action(data.data, streamSink));
  63225. }).then(function () {
  63226. comObj.postMessage({
  63227. sourceName,
  63228. targetName,
  63229. stream: StreamKind.START_COMPLETE,
  63230. streamId,
  63231. success: true
  63232. });
  63233. }, function (reason) {
  63234. comObj.postMessage({
  63235. sourceName,
  63236. targetName,
  63237. stream: StreamKind.START_COMPLETE,
  63238. streamId,
  63239. reason: wrapReason(reason)
  63240. });
  63241. });
  63242. }
  63243. _processStreamMessage(data) {
  63244. const streamId = data.streamId,
  63245. sourceName = this.sourceName,
  63246. targetName = data.sourceName,
  63247. comObj = this.comObj;
  63248. const streamController = this.streamControllers[streamId],
  63249. streamSink = this.streamSinks[streamId];
  63250. switch (data.stream) {
  63251. case StreamKind.START_COMPLETE:
  63252. if (data.success) {
  63253. streamController.startCall.resolve();
  63254. } else {
  63255. streamController.startCall.reject(wrapReason(data.reason));
  63256. }
  63257. break;
  63258. case StreamKind.PULL_COMPLETE:
  63259. if (data.success) {
  63260. streamController.pullCall.resolve();
  63261. } else {
  63262. streamController.pullCall.reject(wrapReason(data.reason));
  63263. }
  63264. break;
  63265. case StreamKind.PULL:
  63266. if (!streamSink) {
  63267. comObj.postMessage({
  63268. sourceName,
  63269. targetName,
  63270. stream: StreamKind.PULL_COMPLETE,
  63271. streamId,
  63272. success: true
  63273. });
  63274. break;
  63275. }
  63276. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  63277. streamSink.sinkCapability.resolve();
  63278. }
  63279. streamSink.desiredSize = data.desiredSize;
  63280. new Promise(function (resolve) {
  63281. resolve(streamSink.onPull && streamSink.onPull());
  63282. }).then(function () {
  63283. comObj.postMessage({
  63284. sourceName,
  63285. targetName,
  63286. stream: StreamKind.PULL_COMPLETE,
  63287. streamId,
  63288. success: true
  63289. });
  63290. }, function (reason) {
  63291. comObj.postMessage({
  63292. sourceName,
  63293. targetName,
  63294. stream: StreamKind.PULL_COMPLETE,
  63295. streamId,
  63296. reason: wrapReason(reason)
  63297. });
  63298. });
  63299. break;
  63300. case StreamKind.ENQUEUE:
  63301. (0, _util.assert)(streamController, "enqueue should have stream controller");
  63302. if (streamController.isClosed) {
  63303. break;
  63304. }
  63305. streamController.controller.enqueue(data.chunk);
  63306. break;
  63307. case StreamKind.CLOSE:
  63308. (0, _util.assert)(streamController, "close should have stream controller");
  63309. if (streamController.isClosed) {
  63310. break;
  63311. }
  63312. streamController.isClosed = true;
  63313. streamController.controller.close();
  63314. this._deleteStreamController(streamController, streamId);
  63315. break;
  63316. case StreamKind.ERROR:
  63317. (0, _util.assert)(streamController, "error should have stream controller");
  63318. streamController.controller.error(wrapReason(data.reason));
  63319. this._deleteStreamController(streamController, streamId);
  63320. break;
  63321. case StreamKind.CANCEL_COMPLETE:
  63322. if (data.success) {
  63323. streamController.cancelCall.resolve();
  63324. } else {
  63325. streamController.cancelCall.reject(wrapReason(data.reason));
  63326. }
  63327. this._deleteStreamController(streamController, streamId);
  63328. break;
  63329. case StreamKind.CANCEL:
  63330. if (!streamSink) {
  63331. break;
  63332. }
  63333. new Promise(function (resolve) {
  63334. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  63335. }).then(function () {
  63336. comObj.postMessage({
  63337. sourceName,
  63338. targetName,
  63339. stream: StreamKind.CANCEL_COMPLETE,
  63340. streamId,
  63341. success: true
  63342. });
  63343. }, function (reason) {
  63344. comObj.postMessage({
  63345. sourceName,
  63346. targetName,
  63347. stream: StreamKind.CANCEL_COMPLETE,
  63348. streamId,
  63349. reason: wrapReason(reason)
  63350. });
  63351. });
  63352. streamSink.sinkCapability.reject(wrapReason(data.reason));
  63353. streamSink.isCancelled = true;
  63354. delete this.streamSinks[streamId];
  63355. break;
  63356. default:
  63357. throw new Error("Unexpected stream case");
  63358. }
  63359. }
  63360. async _deleteStreamController(streamController, streamId) {
  63361. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  63362. delete this.streamControllers[streamId];
  63363. }
  63364. destroy() {
  63365. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  63366. }
  63367. }
  63368. exports.MessageHandler = MessageHandler;
  63369. /***/ }),
  63370. /* 103 */
  63371. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63372. Object.defineProperty(exports, "__esModule", ({
  63373. value: true
  63374. }));
  63375. exports.PDFWorkerStream = void 0;
  63376. var _util = __w_pdfjs_require__(2);
  63377. class PDFWorkerStream {
  63378. constructor(msgHandler) {
  63379. this._msgHandler = msgHandler;
  63380. this._contentLength = null;
  63381. this._fullRequestReader = null;
  63382. this._rangeRequestReaders = [];
  63383. }
  63384. getFullReader() {
  63385. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  63386. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  63387. return this._fullRequestReader;
  63388. }
  63389. getRangeReader(begin, end) {
  63390. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  63391. this._rangeRequestReaders.push(reader);
  63392. return reader;
  63393. }
  63394. cancelAllRequests(reason) {
  63395. if (this._fullRequestReader) {
  63396. this._fullRequestReader.cancel(reason);
  63397. }
  63398. for (const reader of this._rangeRequestReaders.slice(0)) {
  63399. reader.cancel(reason);
  63400. }
  63401. }
  63402. }
  63403. exports.PDFWorkerStream = PDFWorkerStream;
  63404. class PDFWorkerStreamReader {
  63405. constructor(msgHandler) {
  63406. this._msgHandler = msgHandler;
  63407. this.onProgress = null;
  63408. this._contentLength = null;
  63409. this._isRangeSupported = false;
  63410. this._isStreamingSupported = false;
  63411. const readableStream = this._msgHandler.sendWithStream("GetReader");
  63412. this._reader = readableStream.getReader();
  63413. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  63414. this._isStreamingSupported = data.isStreamingSupported;
  63415. this._isRangeSupported = data.isRangeSupported;
  63416. this._contentLength = data.contentLength;
  63417. });
  63418. }
  63419. get headersReady() {
  63420. return this._headersReady;
  63421. }
  63422. get contentLength() {
  63423. return this._contentLength;
  63424. }
  63425. get isStreamingSupported() {
  63426. return this._isStreamingSupported;
  63427. }
  63428. get isRangeSupported() {
  63429. return this._isRangeSupported;
  63430. }
  63431. async read() {
  63432. const {
  63433. value,
  63434. done
  63435. } = await this._reader.read();
  63436. if (done) {
  63437. return {
  63438. value: undefined,
  63439. done: true
  63440. };
  63441. }
  63442. return {
  63443. value: value.buffer,
  63444. done: false
  63445. };
  63446. }
  63447. cancel(reason) {
  63448. this._reader.cancel(reason);
  63449. }
  63450. }
  63451. class PDFWorkerStreamRangeReader {
  63452. constructor(begin, end, msgHandler) {
  63453. this._msgHandler = msgHandler;
  63454. this.onProgress = null;
  63455. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  63456. begin,
  63457. end
  63458. });
  63459. this._reader = readableStream.getReader();
  63460. }
  63461. get isStreamingSupported() {
  63462. return false;
  63463. }
  63464. async read() {
  63465. const {
  63466. value,
  63467. done
  63468. } = await this._reader.read();
  63469. if (done) {
  63470. return {
  63471. value: undefined,
  63472. done: true
  63473. };
  63474. }
  63475. return {
  63476. value: value.buffer,
  63477. done: false
  63478. };
  63479. }
  63480. cancel(reason) {
  63481. this._reader.cancel(reason);
  63482. }
  63483. }
  63484. /***/ })
  63485. /******/ ]);
  63486. /************************************************************************/
  63487. /******/ // The module cache
  63488. /******/ var __webpack_module_cache__ = {};
  63489. /******/
  63490. /******/ // The require function
  63491. /******/ function __w_pdfjs_require__(moduleId) {
  63492. /******/ // Check if module is in cache
  63493. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  63494. /******/ if (cachedModule !== undefined) {
  63495. /******/ return cachedModule.exports;
  63496. /******/ }
  63497. /******/ // Create a new module (and put it into the cache)
  63498. /******/ var module = __webpack_module_cache__[moduleId] = {
  63499. /******/ // no module.id needed
  63500. /******/ // no module.loaded needed
  63501. /******/ exports: {}
  63502. /******/ };
  63503. /******/
  63504. /******/ // Execute the module function
  63505. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  63506. /******/
  63507. /******/ // Return the exports of the module
  63508. /******/ return module.exports;
  63509. /******/ }
  63510. /******/
  63511. /************************************************************************/
  63512. /******/ /* webpack/runtime/define property getters */
  63513. /******/ (() => {
  63514. /******/ // define getter functions for harmony exports
  63515. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  63516. /******/ for(var key in definition) {
  63517. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  63518. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  63519. /******/ }
  63520. /******/ }
  63521. /******/ };
  63522. /******/ })();
  63523. /******/
  63524. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  63525. /******/ (() => {
  63526. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  63527. /******/ })();
  63528. /******/
  63529. /******/ /* webpack/runtime/make namespace object */
  63530. /******/ (() => {
  63531. /******/ // define __esModule on exports
  63532. /******/ __w_pdfjs_require__.r = (exports) => {
  63533. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  63534. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  63535. /******/ }
  63536. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  63537. /******/ };
  63538. /******/ })();
  63539. /******/
  63540. /************************************************************************/
  63541. var __webpack_exports__ = {};
  63542. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  63543. (() => {
  63544. var exports = __webpack_exports__;
  63545. Object.defineProperty(exports, "__esModule", ({
  63546. value: true
  63547. }));
  63548. Object.defineProperty(exports, "WorkerMessageHandler", ({
  63549. enumerable: true,
  63550. get: function () {
  63551. return _worker.WorkerMessageHandler;
  63552. }
  63553. }));
  63554. var _worker = __w_pdfjs_require__(1);
  63555. const pdfjsVersion = '2.16.105';
  63556. const pdfjsBuild = '172ccdbe5';
  63557. })();
  63558. /******/ return __webpack_exports__;
  63559. /******/ })()
  63560. ;
  63561. });
  63562. //# sourceMappingURL=pdf.worker.js.map