pdf.worker.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729
  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. /******/ var __webpack_modules__ = ([
  34. /* 0 */,
  35. /* 1 */
  36. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37. "use strict";
  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__(134);
  44. var _core_utils = __w_pdfjs_require__(135);
  45. var _pdf_manager = __w_pdfjs_require__(137);
  46. var _cleanup_helper = __w_pdfjs_require__(200);
  47. var _writer = __w_pdfjs_require__(194);
  48. var _is_node = __w_pdfjs_require__(4);
  49. var _message_handler = __w_pdfjs_require__(231);
  50. var _worker_stream = __w_pdfjs_require__(232);
  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 {
  97. docId,
  98. apiVersion
  99. } = docParams;
  100. const workerVersion = '3.0.279';
  101. if (apiVersion !== workerVersion) {
  102. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  103. }
  104. const enumerableProperties = [];
  105. for (const property in []) {
  106. enumerableProperties.push(property);
  107. }
  108. if (enumerableProperties.length) {
  109. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  110. }
  111. if (typeof ReadableStream === "undefined") {
  112. const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  113. if (_is_node.isNodeJS) {
  114. throw new Error(partialMsg + "please use a `legacy`-build instead.");
  115. }
  116. throw new Error(partialMsg + "please update to a supported browser.");
  117. }
  118. const workerHandlerName = docId + "_worker";
  119. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  120. function ensureNotTerminated() {
  121. if (terminated) {
  122. throw new Error("Worker was terminated");
  123. }
  124. }
  125. function startWorkerTask(task) {
  126. WorkerTasks.push(task);
  127. }
  128. function finishWorkerTask(task) {
  129. task.finish();
  130. const i = WorkerTasks.indexOf(task);
  131. WorkerTasks.splice(i, 1);
  132. }
  133. async function loadDocument(recoveryMode) {
  134. await pdfManager.ensureDoc("checkHeader");
  135. await pdfManager.ensureDoc("parseStartXRef");
  136. await pdfManager.ensureDoc("parse", [recoveryMode]);
  137. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  138. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  139. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  140. if (isPureXfa) {
  141. const task = new WorkerTask("loadXfaFonts");
  142. startWorkerTask(task);
  143. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  144. }
  145. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  146. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  147. return {
  148. numPages,
  149. fingerprints,
  150. htmlForXfa
  151. };
  152. }
  153. function getPdfManager(_ref) {
  154. let {
  155. data,
  156. password,
  157. disableAutoFetch,
  158. rangeChunkSize,
  159. length,
  160. docBaseUrl,
  161. enableXfa,
  162. evaluatorOptions
  163. } = _ref;
  164. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  165. let newPdfManager;
  166. if (data) {
  167. try {
  168. newPdfManager = new _pdf_manager.LocalPdfManager(docId, data, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  169. pdfManagerCapability.resolve(newPdfManager);
  170. } catch (ex) {
  171. pdfManagerCapability.reject(ex);
  172. }
  173. return pdfManagerCapability.promise;
  174. }
  175. let pdfStream,
  176. cachedChunks = [];
  177. try {
  178. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  179. } catch (ex) {
  180. pdfManagerCapability.reject(ex);
  181. return pdfManagerCapability.promise;
  182. }
  183. const fullRequest = pdfStream.getFullReader();
  184. fullRequest.headersReady.then(function () {
  185. if (!fullRequest.isRangeSupported) {
  186. return;
  187. }
  188. disableAutoFetch = disableAutoFetch || fullRequest.isStreamingSupported;
  189. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  190. msgHandler: handler,
  191. password,
  192. length: fullRequest.contentLength,
  193. disableAutoFetch,
  194. rangeChunkSize
  195. }, evaluatorOptions, enableXfa, docBaseUrl);
  196. for (const chunk of cachedChunks) {
  197. newPdfManager.sendProgressiveData(chunk);
  198. }
  199. cachedChunks = [];
  200. pdfManagerCapability.resolve(newPdfManager);
  201. cancelXHRs = null;
  202. }).catch(function (reason) {
  203. pdfManagerCapability.reject(reason);
  204. cancelXHRs = null;
  205. });
  206. let loaded = 0;
  207. const flushChunks = function () {
  208. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  209. if (length && pdfFile.length !== length) {
  210. (0, _util.warn)("reported HTTP length is different from actual");
  211. }
  212. try {
  213. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  214. pdfManagerCapability.resolve(newPdfManager);
  215. } catch (ex) {
  216. pdfManagerCapability.reject(ex);
  217. }
  218. cachedChunks = [];
  219. };
  220. const readPromise = new Promise(function (resolve, reject) {
  221. const readChunk = function (_ref2) {
  222. let {
  223. value,
  224. done
  225. } = _ref2;
  226. try {
  227. ensureNotTerminated();
  228. if (done) {
  229. if (!newPdfManager) {
  230. flushChunks();
  231. }
  232. cancelXHRs = null;
  233. return;
  234. }
  235. loaded += (0, _util.arrayByteLength)(value);
  236. if (!fullRequest.isStreamingSupported) {
  237. handler.send("DocProgress", {
  238. loaded,
  239. total: Math.max(loaded, fullRequest.contentLength || 0)
  240. });
  241. }
  242. if (newPdfManager) {
  243. newPdfManager.sendProgressiveData(value);
  244. } else {
  245. cachedChunks.push(value);
  246. }
  247. fullRequest.read().then(readChunk, reject);
  248. } catch (e) {
  249. reject(e);
  250. }
  251. };
  252. fullRequest.read().then(readChunk, reject);
  253. });
  254. readPromise.catch(function (e) {
  255. pdfManagerCapability.reject(e);
  256. cancelXHRs = null;
  257. });
  258. cancelXHRs = function (reason) {
  259. pdfStream.cancelAllRequests(reason);
  260. };
  261. return pdfManagerCapability.promise;
  262. }
  263. function setupDoc(data) {
  264. function onSuccess(doc) {
  265. ensureNotTerminated();
  266. handler.send("GetDoc", {
  267. pdfInfo: doc
  268. });
  269. }
  270. function onFailure(ex) {
  271. ensureNotTerminated();
  272. if (ex instanceof _util.PasswordException) {
  273. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  274. startWorkerTask(task);
  275. handler.sendWithPromise("PasswordRequest", ex).then(function (_ref3) {
  276. let {
  277. password
  278. } = _ref3;
  279. finishWorkerTask(task);
  280. pdfManager.updatePassword(password);
  281. pdfManagerReady();
  282. }).catch(function () {
  283. finishWorkerTask(task);
  284. handler.send("DocException", ex);
  285. });
  286. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  287. handler.send("DocException", ex);
  288. } else {
  289. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  290. }
  291. }
  292. function pdfManagerReady() {
  293. ensureNotTerminated();
  294. loadDocument(false).then(onSuccess, function (reason) {
  295. ensureNotTerminated();
  296. if (!(reason instanceof _core_utils.XRefParseException)) {
  297. onFailure(reason);
  298. return;
  299. }
  300. pdfManager.requestLoadedStream().then(function () {
  301. ensureNotTerminated();
  302. loadDocument(true).then(onSuccess, onFailure);
  303. });
  304. });
  305. }
  306. ensureNotTerminated();
  307. getPdfManager(data).then(function (newPdfManager) {
  308. if (terminated) {
  309. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  310. throw new Error("Worker was terminated");
  311. }
  312. pdfManager = newPdfManager;
  313. pdfManager.requestLoadedStream(true).then(stream => {
  314. handler.send("DataLoaded", {
  315. length: stream.bytes.byteLength
  316. });
  317. });
  318. }).then(pdfManagerReady, onFailure);
  319. }
  320. handler.on("GetPage", function wphSetupGetPage(data) {
  321. return pdfManager.getPage(data.pageIndex).then(function (page) {
  322. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function (_ref4) {
  323. let [rotate, ref, userUnit, view] = _ref4;
  324. return {
  325. rotate,
  326. ref,
  327. userUnit,
  328. view
  329. };
  330. });
  331. });
  332. });
  333. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  334. const pageRef = _primitives.Ref.get(data.num, data.gen);
  335. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  336. });
  337. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  338. return pdfManager.ensureCatalog("destinations");
  339. });
  340. handler.on("GetDestination", function wphSetupGetDestination(data) {
  341. return pdfManager.ensureCatalog("getDestination", [data.id]);
  342. });
  343. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  344. return pdfManager.ensureCatalog("pageLabels");
  345. });
  346. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  347. return pdfManager.ensureCatalog("pageLayout");
  348. });
  349. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  350. return pdfManager.ensureCatalog("pageMode");
  351. });
  352. handler.on("GetViewerPreferences", function (data) {
  353. return pdfManager.ensureCatalog("viewerPreferences");
  354. });
  355. handler.on("GetOpenAction", function (data) {
  356. return pdfManager.ensureCatalog("openAction");
  357. });
  358. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  359. return pdfManager.ensureCatalog("attachments");
  360. });
  361. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  362. return pdfManager.ensureCatalog("javaScript");
  363. });
  364. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  365. return pdfManager.ensureCatalog("jsActions");
  366. });
  367. handler.on("GetPageJSActions", function (_ref5) {
  368. let {
  369. pageIndex
  370. } = _ref5;
  371. return pdfManager.getPage(pageIndex).then(function (page) {
  372. return pdfManager.ensure(page, "jsActions");
  373. });
  374. });
  375. handler.on("GetOutline", function wphSetupGetOutline(data) {
  376. return pdfManager.ensureCatalog("documentOutline");
  377. });
  378. handler.on("GetOptionalContentConfig", function (data) {
  379. return pdfManager.ensureCatalog("optionalContentConfig");
  380. });
  381. handler.on("GetPermissions", function (data) {
  382. return pdfManager.ensureCatalog("permissions");
  383. });
  384. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  385. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  386. });
  387. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  388. return pdfManager.ensureCatalog("markInfo");
  389. });
  390. handler.on("GetData", function wphSetupGetData(data) {
  391. return pdfManager.requestLoadedStream().then(function (stream) {
  392. return stream.bytes;
  393. });
  394. });
  395. handler.on("GetAnnotations", function (_ref6) {
  396. let {
  397. pageIndex,
  398. intent
  399. } = _ref6;
  400. return pdfManager.getPage(pageIndex).then(function (page) {
  401. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  402. startWorkerTask(task);
  403. return page.getAnnotationsData(handler, task, intent).then(data => {
  404. finishWorkerTask(task);
  405. return data;
  406. }, reason => {
  407. finishWorkerTask(task);
  408. });
  409. });
  410. });
  411. handler.on("GetFieldObjects", function (data) {
  412. return pdfManager.ensureDoc("fieldObjects");
  413. });
  414. handler.on("HasJSActions", function (data) {
  415. return pdfManager.ensureDoc("hasJSActions");
  416. });
  417. handler.on("GetCalculationOrderIds", function (data) {
  418. return pdfManager.ensureDoc("calculationOrderIds");
  419. });
  420. handler.on("SaveDocument", function (_ref7) {
  421. let {
  422. isPureXfa,
  423. numPages,
  424. annotationStorage,
  425. filename
  426. } = _ref7;
  427. const promises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  428. const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  429. if (newAnnotationsByPage) {
  430. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  431. promises.push(pdfManager.getPage(pageIndex).then(page => {
  432. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  433. return page.saveNewAnnotations(handler, task, annotations).finally(function () {
  434. finishWorkerTask(task);
  435. });
  436. }));
  437. }
  438. }
  439. if (isPureXfa) {
  440. promises.push(pdfManager.serializeXfaData(annotationStorage));
  441. } else {
  442. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  443. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  444. const task = new WorkerTask(`Save: page ${pageIndex}`);
  445. return page.save(handler, task, annotationStorage).finally(function () {
  446. finishWorkerTask(task);
  447. });
  448. }));
  449. }
  450. }
  451. return Promise.all(promises).then(function (_ref8) {
  452. let [stream, acroForm, acroFormRef, xref, startXRef, ...refs] = _ref8;
  453. let newRefs = [];
  454. let xfaData = null;
  455. if (isPureXfa) {
  456. xfaData = refs[0];
  457. if (!xfaData) {
  458. return stream.bytes;
  459. }
  460. } else {
  461. newRefs = refs.flat(2);
  462. if (newRefs.length === 0) {
  463. return stream.bytes;
  464. }
  465. }
  466. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  467. let xfaDatasetsRef = null;
  468. let hasXfaDatasetsEntry = false;
  469. if (Array.isArray(xfa)) {
  470. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  471. if (xfa[i] === "datasets") {
  472. xfaDatasetsRef = xfa[i + 1];
  473. acroFormRef = null;
  474. hasXfaDatasetsEntry = true;
  475. }
  476. }
  477. if (xfaDatasetsRef === null) {
  478. xfaDatasetsRef = xref.getNewRef();
  479. }
  480. } else if (xfa) {
  481. acroFormRef = null;
  482. (0, _util.warn)("Unsupported XFA type.");
  483. }
  484. let newXrefInfo = Object.create(null);
  485. if (xref.trailer) {
  486. const infoObj = Object.create(null);
  487. const xrefInfo = xref.trailer.get("Info") || null;
  488. if (xrefInfo instanceof _primitives.Dict) {
  489. xrefInfo.forEach((key, value) => {
  490. if (typeof value === "string") {
  491. infoObj[key] = (0, _util.stringToPDFString)(value);
  492. }
  493. });
  494. }
  495. newXrefInfo = {
  496. rootRef: xref.trailer.getRaw("Root") || null,
  497. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  498. newRef: xref.getNewRef(),
  499. infoRef: xref.trailer.getRaw("Info") || null,
  500. info: infoObj,
  501. fileIds: xref.trailer.get("ID") || null,
  502. startXRef,
  503. filename
  504. };
  505. }
  506. xref.resetNewRef();
  507. return (0, _writer.incrementalUpdate)({
  508. originalData: stream.bytes,
  509. xrefInfo: newXrefInfo,
  510. newRefs,
  511. xref,
  512. hasXfa: !!xfa,
  513. xfaDatasetsRef,
  514. hasXfaDatasetsEntry,
  515. acroFormRef,
  516. acroForm,
  517. xfaData
  518. });
  519. });
  520. });
  521. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  522. const pageIndex = data.pageIndex;
  523. pdfManager.getPage(pageIndex).then(function (page) {
  524. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  525. startWorkerTask(task);
  526. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  527. page.getOperatorList({
  528. handler,
  529. sink,
  530. task,
  531. intent: data.intent,
  532. cacheKey: data.cacheKey,
  533. annotationStorage: data.annotationStorage
  534. }).then(function (operatorListInfo) {
  535. finishWorkerTask(task);
  536. if (start) {
  537. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  538. }
  539. sink.close();
  540. }, function (reason) {
  541. finishWorkerTask(task);
  542. if (task.terminated) {
  543. return;
  544. }
  545. sink.error(reason);
  546. });
  547. });
  548. });
  549. handler.on("GetTextContent", function wphExtractText(data, sink) {
  550. const pageIndex = data.pageIndex;
  551. pdfManager.getPage(pageIndex).then(function (page) {
  552. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  553. startWorkerTask(task);
  554. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  555. page.extractTextContent({
  556. handler,
  557. task,
  558. sink,
  559. includeMarkedContent: data.includeMarkedContent,
  560. combineTextItems: data.combineTextItems
  561. }).then(function () {
  562. finishWorkerTask(task);
  563. if (start) {
  564. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  565. }
  566. sink.close();
  567. }, function (reason) {
  568. finishWorkerTask(task);
  569. if (task.terminated) {
  570. return;
  571. }
  572. sink.error(reason);
  573. });
  574. });
  575. });
  576. handler.on("GetStructTree", function wphGetStructTree(data) {
  577. return pdfManager.getPage(data.pageIndex).then(function (page) {
  578. return pdfManager.ensure(page, "getStructTree");
  579. });
  580. });
  581. handler.on("FontFallback", function (data) {
  582. return pdfManager.fontFallback(data.id, handler);
  583. });
  584. handler.on("Cleanup", function wphCleanup(data) {
  585. return pdfManager.cleanup(true);
  586. });
  587. handler.on("Terminate", function wphTerminate(data) {
  588. terminated = true;
  589. const waitOn = [];
  590. if (pdfManager) {
  591. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  592. const cleanupPromise = pdfManager.cleanup();
  593. waitOn.push(cleanupPromise);
  594. pdfManager = null;
  595. } else {
  596. (0, _cleanup_helper.clearGlobalCaches)();
  597. }
  598. if (cancelXHRs) {
  599. cancelXHRs(new _util.AbortException("Worker was terminated."));
  600. }
  601. for (const task of WorkerTasks) {
  602. waitOn.push(task.finished);
  603. task.terminate();
  604. }
  605. return Promise.all(waitOn).then(function () {
  606. handler.destroy();
  607. handler = null;
  608. });
  609. });
  610. handler.on("Ready", function wphReady(data) {
  611. setupDoc(docParams);
  612. docParams = null;
  613. });
  614. return workerHandlerName;
  615. }
  616. static initializeFromPort(port) {
  617. const handler = new _message_handler.MessageHandler("worker", "main", port);
  618. WorkerMessageHandler.setup(handler, port);
  619. handler.send("ready", null);
  620. }
  621. }
  622. exports.WorkerMessageHandler = WorkerMessageHandler;
  623. function isMessagePort(maybePort) {
  624. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  625. }
  626. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  627. WorkerMessageHandler.initializeFromPort(self);
  628. }
  629. /***/ }),
  630. /* 2 */
  631. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  632. "use strict";
  633. Object.defineProperty(exports, "__esModule", ({
  634. value: true
  635. }));
  636. 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;
  637. exports.arrayByteLength = arrayByteLength;
  638. exports.arraysToBytes = arraysToBytes;
  639. exports.assert = assert;
  640. exports.bytesToString = bytesToString;
  641. exports.createPromiseCapability = createPromiseCapability;
  642. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  643. exports.escapeString = escapeString;
  644. exports.getModificationDate = getModificationDate;
  645. exports.getVerbosityLevel = getVerbosityLevel;
  646. exports.info = info;
  647. exports.isArrayBuffer = isArrayBuffer;
  648. exports.isArrayEqual = isArrayEqual;
  649. exports.isAscii = isAscii;
  650. exports.objectFromMap = objectFromMap;
  651. exports.objectSize = objectSize;
  652. exports.setVerbosityLevel = setVerbosityLevel;
  653. exports.shadow = shadow;
  654. exports.string32 = string32;
  655. exports.stringToBytes = stringToBytes;
  656. exports.stringToPDFString = stringToPDFString;
  657. exports.stringToUTF16BEString = stringToUTF16BEString;
  658. exports.stringToUTF8String = stringToUTF8String;
  659. exports.unreachable = unreachable;
  660. exports.utf8StringToString = utf8StringToString;
  661. exports.warn = warn;
  662. if (!globalThis._pdfjsCompatibilityChecked) {
  663. globalThis._pdfjsCompatibilityChecked = true;
  664. __w_pdfjs_require__(3);
  665. }
  666. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  667. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  668. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  669. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  670. const LINE_FACTOR = 1.35;
  671. exports.LINE_FACTOR = LINE_FACTOR;
  672. const LINE_DESCENT_FACTOR = 0.35;
  673. exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
  674. const RenderingIntentFlag = {
  675. ANY: 0x01,
  676. DISPLAY: 0x02,
  677. PRINT: 0x04,
  678. ANNOTATIONS_FORMS: 0x10,
  679. ANNOTATIONS_STORAGE: 0x20,
  680. ANNOTATIONS_DISABLE: 0x40,
  681. OPLIST: 0x100
  682. };
  683. exports.RenderingIntentFlag = RenderingIntentFlag;
  684. const AnnotationMode = {
  685. DISABLE: 0,
  686. ENABLE: 1,
  687. ENABLE_FORMS: 2,
  688. ENABLE_STORAGE: 3
  689. };
  690. exports.AnnotationMode = AnnotationMode;
  691. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  692. exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
  693. const AnnotationEditorType = {
  694. DISABLE: -1,
  695. NONE: 0,
  696. FREETEXT: 3,
  697. INK: 15
  698. };
  699. exports.AnnotationEditorType = AnnotationEditorType;
  700. const AnnotationEditorParamsType = {
  701. FREETEXT_SIZE: 1,
  702. FREETEXT_COLOR: 2,
  703. FREETEXT_OPACITY: 3,
  704. INK_COLOR: 11,
  705. INK_THICKNESS: 12,
  706. INK_OPACITY: 13
  707. };
  708. exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
  709. const PermissionFlag = {
  710. PRINT: 0x04,
  711. MODIFY_CONTENTS: 0x08,
  712. COPY: 0x10,
  713. MODIFY_ANNOTATIONS: 0x20,
  714. FILL_INTERACTIVE_FORMS: 0x100,
  715. COPY_FOR_ACCESSIBILITY: 0x200,
  716. ASSEMBLE: 0x400,
  717. PRINT_HIGH_QUALITY: 0x800
  718. };
  719. exports.PermissionFlag = PermissionFlag;
  720. const TextRenderingMode = {
  721. FILL: 0,
  722. STROKE: 1,
  723. FILL_STROKE: 2,
  724. INVISIBLE: 3,
  725. FILL_ADD_TO_PATH: 4,
  726. STROKE_ADD_TO_PATH: 5,
  727. FILL_STROKE_ADD_TO_PATH: 6,
  728. ADD_TO_PATH: 7,
  729. FILL_STROKE_MASK: 3,
  730. ADD_TO_PATH_FLAG: 4
  731. };
  732. exports.TextRenderingMode = TextRenderingMode;
  733. const ImageKind = {
  734. GRAYSCALE_1BPP: 1,
  735. RGB_24BPP: 2,
  736. RGBA_32BPP: 3
  737. };
  738. exports.ImageKind = ImageKind;
  739. const AnnotationType = {
  740. TEXT: 1,
  741. LINK: 2,
  742. FREETEXT: 3,
  743. LINE: 4,
  744. SQUARE: 5,
  745. CIRCLE: 6,
  746. POLYGON: 7,
  747. POLYLINE: 8,
  748. HIGHLIGHT: 9,
  749. UNDERLINE: 10,
  750. SQUIGGLY: 11,
  751. STRIKEOUT: 12,
  752. STAMP: 13,
  753. CARET: 14,
  754. INK: 15,
  755. POPUP: 16,
  756. FILEATTACHMENT: 17,
  757. SOUND: 18,
  758. MOVIE: 19,
  759. WIDGET: 20,
  760. SCREEN: 21,
  761. PRINTERMARK: 22,
  762. TRAPNET: 23,
  763. WATERMARK: 24,
  764. THREED: 25,
  765. REDACT: 26
  766. };
  767. exports.AnnotationType = AnnotationType;
  768. const AnnotationStateModelType = {
  769. MARKED: "Marked",
  770. REVIEW: "Review"
  771. };
  772. exports.AnnotationStateModelType = AnnotationStateModelType;
  773. const AnnotationMarkedState = {
  774. MARKED: "Marked",
  775. UNMARKED: "Unmarked"
  776. };
  777. exports.AnnotationMarkedState = AnnotationMarkedState;
  778. const AnnotationReviewState = {
  779. ACCEPTED: "Accepted",
  780. REJECTED: "Rejected",
  781. CANCELLED: "Cancelled",
  782. COMPLETED: "Completed",
  783. NONE: "None"
  784. };
  785. exports.AnnotationReviewState = AnnotationReviewState;
  786. const AnnotationReplyType = {
  787. GROUP: "Group",
  788. REPLY: "R"
  789. };
  790. exports.AnnotationReplyType = AnnotationReplyType;
  791. const AnnotationFlag = {
  792. INVISIBLE: 0x01,
  793. HIDDEN: 0x02,
  794. PRINT: 0x04,
  795. NOZOOM: 0x08,
  796. NOROTATE: 0x10,
  797. NOVIEW: 0x20,
  798. READONLY: 0x40,
  799. LOCKED: 0x80,
  800. TOGGLENOVIEW: 0x100,
  801. LOCKEDCONTENTS: 0x200
  802. };
  803. exports.AnnotationFlag = AnnotationFlag;
  804. const AnnotationFieldFlag = {
  805. READONLY: 0x0000001,
  806. REQUIRED: 0x0000002,
  807. NOEXPORT: 0x0000004,
  808. MULTILINE: 0x0001000,
  809. PASSWORD: 0x0002000,
  810. NOTOGGLETOOFF: 0x0004000,
  811. RADIO: 0x0008000,
  812. PUSHBUTTON: 0x0010000,
  813. COMBO: 0x0020000,
  814. EDIT: 0x0040000,
  815. SORT: 0x0080000,
  816. FILESELECT: 0x0100000,
  817. MULTISELECT: 0x0200000,
  818. DONOTSPELLCHECK: 0x0400000,
  819. DONOTSCROLL: 0x0800000,
  820. COMB: 0x1000000,
  821. RICHTEXT: 0x2000000,
  822. RADIOSINUNISON: 0x2000000,
  823. COMMITONSELCHANGE: 0x4000000
  824. };
  825. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  826. const AnnotationBorderStyleType = {
  827. SOLID: 1,
  828. DASHED: 2,
  829. BEVELED: 3,
  830. INSET: 4,
  831. UNDERLINE: 5
  832. };
  833. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  834. const AnnotationActionEventType = {
  835. E: "Mouse Enter",
  836. X: "Mouse Exit",
  837. D: "Mouse Down",
  838. U: "Mouse Up",
  839. Fo: "Focus",
  840. Bl: "Blur",
  841. PO: "PageOpen",
  842. PC: "PageClose",
  843. PV: "PageVisible",
  844. PI: "PageInvisible",
  845. K: "Keystroke",
  846. F: "Format",
  847. V: "Validate",
  848. C: "Calculate"
  849. };
  850. exports.AnnotationActionEventType = AnnotationActionEventType;
  851. const DocumentActionEventType = {
  852. WC: "WillClose",
  853. WS: "WillSave",
  854. DS: "DidSave",
  855. WP: "WillPrint",
  856. DP: "DidPrint"
  857. };
  858. exports.DocumentActionEventType = DocumentActionEventType;
  859. const PageActionEventType = {
  860. O: "PageOpen",
  861. C: "PageClose"
  862. };
  863. exports.PageActionEventType = PageActionEventType;
  864. const StreamType = {
  865. UNKNOWN: "UNKNOWN",
  866. FLATE: "FLATE",
  867. LZW: "LZW",
  868. DCT: "DCT",
  869. JPX: "JPX",
  870. JBIG: "JBIG",
  871. A85: "A85",
  872. AHX: "AHX",
  873. CCF: "CCF",
  874. RLX: "RLX"
  875. };
  876. exports.StreamType = StreamType;
  877. const FontType = {
  878. UNKNOWN: "UNKNOWN",
  879. TYPE1: "TYPE1",
  880. TYPE1STANDARD: "TYPE1STANDARD",
  881. TYPE1C: "TYPE1C",
  882. CIDFONTTYPE0: "CIDFONTTYPE0",
  883. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  884. TRUETYPE: "TRUETYPE",
  885. CIDFONTTYPE2: "CIDFONTTYPE2",
  886. TYPE3: "TYPE3",
  887. OPENTYPE: "OPENTYPE",
  888. TYPE0: "TYPE0",
  889. MMTYPE1: "MMTYPE1"
  890. };
  891. exports.FontType = FontType;
  892. const VerbosityLevel = {
  893. ERRORS: 0,
  894. WARNINGS: 1,
  895. INFOS: 5
  896. };
  897. exports.VerbosityLevel = VerbosityLevel;
  898. const CMapCompressionType = {
  899. NONE: 0,
  900. BINARY: 1
  901. };
  902. exports.CMapCompressionType = CMapCompressionType;
  903. const OPS = {
  904. dependency: 1,
  905. setLineWidth: 2,
  906. setLineCap: 3,
  907. setLineJoin: 4,
  908. setMiterLimit: 5,
  909. setDash: 6,
  910. setRenderingIntent: 7,
  911. setFlatness: 8,
  912. setGState: 9,
  913. save: 10,
  914. restore: 11,
  915. transform: 12,
  916. moveTo: 13,
  917. lineTo: 14,
  918. curveTo: 15,
  919. curveTo2: 16,
  920. curveTo3: 17,
  921. closePath: 18,
  922. rectangle: 19,
  923. stroke: 20,
  924. closeStroke: 21,
  925. fill: 22,
  926. eoFill: 23,
  927. fillStroke: 24,
  928. eoFillStroke: 25,
  929. closeFillStroke: 26,
  930. closeEOFillStroke: 27,
  931. endPath: 28,
  932. clip: 29,
  933. eoClip: 30,
  934. beginText: 31,
  935. endText: 32,
  936. setCharSpacing: 33,
  937. setWordSpacing: 34,
  938. setHScale: 35,
  939. setLeading: 36,
  940. setFont: 37,
  941. setTextRenderingMode: 38,
  942. setTextRise: 39,
  943. moveText: 40,
  944. setLeadingMoveText: 41,
  945. setTextMatrix: 42,
  946. nextLine: 43,
  947. showText: 44,
  948. showSpacedText: 45,
  949. nextLineShowText: 46,
  950. nextLineSetSpacingShowText: 47,
  951. setCharWidth: 48,
  952. setCharWidthAndBounds: 49,
  953. setStrokeColorSpace: 50,
  954. setFillColorSpace: 51,
  955. setStrokeColor: 52,
  956. setStrokeColorN: 53,
  957. setFillColor: 54,
  958. setFillColorN: 55,
  959. setStrokeGray: 56,
  960. setFillGray: 57,
  961. setStrokeRGBColor: 58,
  962. setFillRGBColor: 59,
  963. setStrokeCMYKColor: 60,
  964. setFillCMYKColor: 61,
  965. shadingFill: 62,
  966. beginInlineImage: 63,
  967. beginImageData: 64,
  968. endInlineImage: 65,
  969. paintXObject: 66,
  970. markPoint: 67,
  971. markPointProps: 68,
  972. beginMarkedContent: 69,
  973. beginMarkedContentProps: 70,
  974. endMarkedContent: 71,
  975. beginCompat: 72,
  976. endCompat: 73,
  977. paintFormXObjectBegin: 74,
  978. paintFormXObjectEnd: 75,
  979. beginGroup: 76,
  980. endGroup: 77,
  981. beginAnnotation: 80,
  982. endAnnotation: 81,
  983. paintImageMaskXObject: 83,
  984. paintImageMaskXObjectGroup: 84,
  985. paintImageXObject: 85,
  986. paintInlineImageXObject: 86,
  987. paintInlineImageXObjectGroup: 87,
  988. paintImageXObjectRepeat: 88,
  989. paintImageMaskXObjectRepeat: 89,
  990. paintSolidColorImageMask: 90,
  991. constructPath: 91
  992. };
  993. exports.OPS = OPS;
  994. const UNSUPPORTED_FEATURES = {
  995. forms: "forms",
  996. javaScript: "javaScript",
  997. signatures: "signatures",
  998. smask: "smask",
  999. shadingPattern: "shadingPattern",
  1000. errorTilingPattern: "errorTilingPattern",
  1001. errorExtGState: "errorExtGState",
  1002. errorXObject: "errorXObject",
  1003. errorFontLoadType3: "errorFontLoadType3",
  1004. errorFontState: "errorFontState",
  1005. errorFontMissing: "errorFontMissing",
  1006. errorFontTranslate: "errorFontTranslate",
  1007. errorColorSpace: "errorColorSpace",
  1008. errorOperatorList: "errorOperatorList",
  1009. errorFontToUnicode: "errorFontToUnicode",
  1010. errorFontLoadNative: "errorFontLoadNative",
  1011. errorFontBuildPath: "errorFontBuildPath",
  1012. errorFontGetPath: "errorFontGetPath",
  1013. errorMarkedContent: "errorMarkedContent",
  1014. errorContentSubStream: "errorContentSubStream"
  1015. };
  1016. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1017. const PasswordResponses = {
  1018. NEED_PASSWORD: 1,
  1019. INCORRECT_PASSWORD: 2
  1020. };
  1021. exports.PasswordResponses = PasswordResponses;
  1022. let verbosity = VerbosityLevel.WARNINGS;
  1023. function setVerbosityLevel(level) {
  1024. if (Number.isInteger(level)) {
  1025. verbosity = level;
  1026. }
  1027. }
  1028. function getVerbosityLevel() {
  1029. return verbosity;
  1030. }
  1031. function info(msg) {
  1032. if (verbosity >= VerbosityLevel.INFOS) {
  1033. console.log(`Info: ${msg}`);
  1034. }
  1035. }
  1036. function warn(msg) {
  1037. if (verbosity >= VerbosityLevel.WARNINGS) {
  1038. console.log(`Warning: ${msg}`);
  1039. }
  1040. }
  1041. function unreachable(msg) {
  1042. throw new Error(msg);
  1043. }
  1044. function assert(cond, msg) {
  1045. if (!cond) {
  1046. unreachable(msg);
  1047. }
  1048. }
  1049. function _isValidProtocol(url) {
  1050. if (!url) {
  1051. return false;
  1052. }
  1053. switch (url.protocol) {
  1054. case "http:":
  1055. case "https:":
  1056. case "ftp:":
  1057. case "mailto:":
  1058. case "tel:":
  1059. return true;
  1060. default:
  1061. return false;
  1062. }
  1063. }
  1064. function createValidAbsoluteUrl(url) {
  1065. let baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1066. let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  1067. if (!url) {
  1068. return null;
  1069. }
  1070. try {
  1071. if (options && typeof url === "string") {
  1072. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1073. const dots = url.match(/\./g);
  1074. if (dots && dots.length >= 2) {
  1075. url = `http://${url}`;
  1076. }
  1077. }
  1078. if (options.tryConvertEncoding) {
  1079. try {
  1080. url = stringToUTF8String(url);
  1081. } catch (ex) {}
  1082. }
  1083. }
  1084. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1085. if (_isValidProtocol(absoluteUrl)) {
  1086. return absoluteUrl;
  1087. }
  1088. } catch (ex) {}
  1089. return null;
  1090. }
  1091. function shadow(obj, prop, value) {
  1092. Object.defineProperty(obj, prop, {
  1093. value,
  1094. enumerable: true,
  1095. configurable: true,
  1096. writable: false
  1097. });
  1098. return value;
  1099. }
  1100. const BaseException = function BaseExceptionClosure() {
  1101. function BaseException(message, name) {
  1102. if (this.constructor === BaseException) {
  1103. unreachable("Cannot initialize BaseException.");
  1104. }
  1105. this.message = message;
  1106. this.name = name;
  1107. }
  1108. BaseException.prototype = new Error();
  1109. BaseException.constructor = BaseException;
  1110. return BaseException;
  1111. }();
  1112. exports.BaseException = BaseException;
  1113. class PasswordException extends BaseException {
  1114. constructor(msg, code) {
  1115. super(msg, "PasswordException");
  1116. this.code = code;
  1117. }
  1118. }
  1119. exports.PasswordException = PasswordException;
  1120. class UnknownErrorException extends BaseException {
  1121. constructor(msg, details) {
  1122. super(msg, "UnknownErrorException");
  1123. this.details = details;
  1124. }
  1125. }
  1126. exports.UnknownErrorException = UnknownErrorException;
  1127. class InvalidPDFException extends BaseException {
  1128. constructor(msg) {
  1129. super(msg, "InvalidPDFException");
  1130. }
  1131. }
  1132. exports.InvalidPDFException = InvalidPDFException;
  1133. class MissingPDFException extends BaseException {
  1134. constructor(msg) {
  1135. super(msg, "MissingPDFException");
  1136. }
  1137. }
  1138. exports.MissingPDFException = MissingPDFException;
  1139. class UnexpectedResponseException extends BaseException {
  1140. constructor(msg, status) {
  1141. super(msg, "UnexpectedResponseException");
  1142. this.status = status;
  1143. }
  1144. }
  1145. exports.UnexpectedResponseException = UnexpectedResponseException;
  1146. class FormatError extends BaseException {
  1147. constructor(msg) {
  1148. super(msg, "FormatError");
  1149. }
  1150. }
  1151. exports.FormatError = FormatError;
  1152. class AbortException extends BaseException {
  1153. constructor(msg) {
  1154. super(msg, "AbortException");
  1155. }
  1156. }
  1157. exports.AbortException = AbortException;
  1158. function bytesToString(bytes) {
  1159. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1160. unreachable("Invalid argument for bytesToString");
  1161. }
  1162. const length = bytes.length;
  1163. const MAX_ARGUMENT_COUNT = 8192;
  1164. if (length < MAX_ARGUMENT_COUNT) {
  1165. return String.fromCharCode.apply(null, bytes);
  1166. }
  1167. const strBuf = [];
  1168. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1169. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1170. const chunk = bytes.subarray(i, chunkEnd);
  1171. strBuf.push(String.fromCharCode.apply(null, chunk));
  1172. }
  1173. return strBuf.join("");
  1174. }
  1175. function stringToBytes(str) {
  1176. if (typeof str !== "string") {
  1177. unreachable("Invalid argument for stringToBytes");
  1178. }
  1179. const length = str.length;
  1180. const bytes = new Uint8Array(length);
  1181. for (let i = 0; i < length; ++i) {
  1182. bytes[i] = str.charCodeAt(i) & 0xff;
  1183. }
  1184. return bytes;
  1185. }
  1186. function arrayByteLength(arr) {
  1187. if (arr.length !== undefined) {
  1188. return arr.length;
  1189. }
  1190. if (arr.byteLength !== undefined) {
  1191. return arr.byteLength;
  1192. }
  1193. unreachable("Invalid argument for arrayByteLength");
  1194. }
  1195. function arraysToBytes(arr) {
  1196. const length = arr.length;
  1197. if (length === 1 && arr[0] instanceof Uint8Array) {
  1198. return arr[0];
  1199. }
  1200. let resultLength = 0;
  1201. for (let i = 0; i < length; i++) {
  1202. resultLength += arrayByteLength(arr[i]);
  1203. }
  1204. let pos = 0;
  1205. const data = new Uint8Array(resultLength);
  1206. for (let i = 0; i < length; i++) {
  1207. let item = arr[i];
  1208. if (!(item instanceof Uint8Array)) {
  1209. if (typeof item === "string") {
  1210. item = stringToBytes(item);
  1211. } else {
  1212. item = new Uint8Array(item);
  1213. }
  1214. }
  1215. const itemLength = item.byteLength;
  1216. data.set(item, pos);
  1217. pos += itemLength;
  1218. }
  1219. return data;
  1220. }
  1221. function string32(value) {
  1222. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1223. }
  1224. function objectSize(obj) {
  1225. return Object.keys(obj).length;
  1226. }
  1227. function objectFromMap(map) {
  1228. const obj = Object.create(null);
  1229. for (const [key, value] of map) {
  1230. obj[key] = value;
  1231. }
  1232. return obj;
  1233. }
  1234. function isLittleEndian() {
  1235. const buffer8 = new Uint8Array(4);
  1236. buffer8[0] = 1;
  1237. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1238. return view32[0] === 1;
  1239. }
  1240. function isEvalSupported() {
  1241. try {
  1242. new Function("");
  1243. return true;
  1244. } catch (e) {
  1245. return false;
  1246. }
  1247. }
  1248. class FeatureTest {
  1249. static get isLittleEndian() {
  1250. return shadow(this, "isLittleEndian", isLittleEndian());
  1251. }
  1252. static get isEvalSupported() {
  1253. return shadow(this, "isEvalSupported", isEvalSupported());
  1254. }
  1255. static get isOffscreenCanvasSupported() {
  1256. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1257. }
  1258. }
  1259. exports.FeatureTest = FeatureTest;
  1260. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1261. class Util {
  1262. static makeHexColor(r, g, b) {
  1263. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1264. }
  1265. static scaleMinMax(transform, minMax) {
  1266. let temp;
  1267. if (transform[0]) {
  1268. if (transform[0] < 0) {
  1269. temp = minMax[0];
  1270. minMax[0] = minMax[1];
  1271. minMax[1] = temp;
  1272. }
  1273. minMax[0] *= transform[0];
  1274. minMax[1] *= transform[0];
  1275. if (transform[3] < 0) {
  1276. temp = minMax[2];
  1277. minMax[2] = minMax[3];
  1278. minMax[3] = temp;
  1279. }
  1280. minMax[2] *= transform[3];
  1281. minMax[3] *= transform[3];
  1282. } else {
  1283. temp = minMax[0];
  1284. minMax[0] = minMax[2];
  1285. minMax[2] = temp;
  1286. temp = minMax[1];
  1287. minMax[1] = minMax[3];
  1288. minMax[3] = temp;
  1289. if (transform[1] < 0) {
  1290. temp = minMax[2];
  1291. minMax[2] = minMax[3];
  1292. minMax[3] = temp;
  1293. }
  1294. minMax[2] *= transform[1];
  1295. minMax[3] *= transform[1];
  1296. if (transform[2] < 0) {
  1297. temp = minMax[0];
  1298. minMax[0] = minMax[1];
  1299. minMax[1] = temp;
  1300. }
  1301. minMax[0] *= transform[2];
  1302. minMax[1] *= transform[2];
  1303. }
  1304. minMax[0] += transform[4];
  1305. minMax[1] += transform[4];
  1306. minMax[2] += transform[5];
  1307. minMax[3] += transform[5];
  1308. }
  1309. static transform(m1, m2) {
  1310. 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]];
  1311. }
  1312. static applyTransform(p, m) {
  1313. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1314. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1315. return [xt, yt];
  1316. }
  1317. static applyInverseTransform(p, m) {
  1318. const d = m[0] * m[3] - m[1] * m[2];
  1319. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1320. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1321. return [xt, yt];
  1322. }
  1323. static getAxialAlignedBoundingBox(r, m) {
  1324. const p1 = Util.applyTransform(r, m);
  1325. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1326. const p3 = Util.applyTransform([r[0], r[3]], m);
  1327. const p4 = Util.applyTransform([r[2], r[1]], m);
  1328. 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])];
  1329. }
  1330. static inverseTransform(m) {
  1331. const d = m[0] * m[3] - m[1] * m[2];
  1332. 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];
  1333. }
  1334. static singularValueDecompose2dScale(m) {
  1335. const transpose = [m[0], m[2], m[1], m[3]];
  1336. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1337. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1338. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1339. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1340. const first = (a + d) / 2;
  1341. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1342. const sx = first + second || 1;
  1343. const sy = first - second || 1;
  1344. return [Math.sqrt(sx), Math.sqrt(sy)];
  1345. }
  1346. static normalizeRect(rect) {
  1347. const r = rect.slice(0);
  1348. if (rect[0] > rect[2]) {
  1349. r[0] = rect[2];
  1350. r[2] = rect[0];
  1351. }
  1352. if (rect[1] > rect[3]) {
  1353. r[1] = rect[3];
  1354. r[3] = rect[1];
  1355. }
  1356. return r;
  1357. }
  1358. static intersect(rect1, rect2) {
  1359. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1360. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1361. if (xLow > xHigh) {
  1362. return null;
  1363. }
  1364. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1365. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1366. if (yLow > yHigh) {
  1367. return null;
  1368. }
  1369. return [xLow, yLow, xHigh, yHigh];
  1370. }
  1371. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1372. const tvalues = [],
  1373. bounds = [[], []];
  1374. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1375. for (let i = 0; i < 2; ++i) {
  1376. if (i === 0) {
  1377. b = 6 * x0 - 12 * x1 + 6 * x2;
  1378. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1379. c = 3 * x1 - 3 * x0;
  1380. } else {
  1381. b = 6 * y0 - 12 * y1 + 6 * y2;
  1382. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1383. c = 3 * y1 - 3 * y0;
  1384. }
  1385. if (Math.abs(a) < 1e-12) {
  1386. if (Math.abs(b) < 1e-12) {
  1387. continue;
  1388. }
  1389. t = -c / b;
  1390. if (0 < t && t < 1) {
  1391. tvalues.push(t);
  1392. }
  1393. continue;
  1394. }
  1395. b2ac = b * b - 4 * c * a;
  1396. sqrtb2ac = Math.sqrt(b2ac);
  1397. if (b2ac < 0) {
  1398. continue;
  1399. }
  1400. t1 = (-b + sqrtb2ac) / (2 * a);
  1401. if (0 < t1 && t1 < 1) {
  1402. tvalues.push(t1);
  1403. }
  1404. t2 = (-b - sqrtb2ac) / (2 * a);
  1405. if (0 < t2 && t2 < 1) {
  1406. tvalues.push(t2);
  1407. }
  1408. }
  1409. let j = tvalues.length,
  1410. mt;
  1411. const jlen = j;
  1412. while (j--) {
  1413. t = tvalues[j];
  1414. mt = 1 - t;
  1415. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1416. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1417. }
  1418. bounds[0][jlen] = x0;
  1419. bounds[1][jlen] = y0;
  1420. bounds[0][jlen + 1] = x3;
  1421. bounds[1][jlen + 1] = y3;
  1422. bounds[0].length = bounds[1].length = jlen + 2;
  1423. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1424. }
  1425. }
  1426. exports.Util = Util;
  1427. 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];
  1428. function stringToPDFString(str) {
  1429. if (str[0] >= "\xEF") {
  1430. let encoding;
  1431. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1432. encoding = "utf-16be";
  1433. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1434. encoding = "utf-16le";
  1435. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1436. encoding = "utf-8";
  1437. }
  1438. if (encoding) {
  1439. try {
  1440. const decoder = new TextDecoder(encoding, {
  1441. fatal: true
  1442. });
  1443. const buffer = stringToBytes(str);
  1444. return decoder.decode(buffer);
  1445. } catch (ex) {
  1446. warn(`stringToPDFString: "${ex}".`);
  1447. }
  1448. }
  1449. }
  1450. const strBuf = [];
  1451. for (let i = 0, ii = str.length; i < ii; i++) {
  1452. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1453. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1454. }
  1455. return strBuf.join("");
  1456. }
  1457. function escapeString(str) {
  1458. return str.replace(/([()\\\n\r])/g, match => {
  1459. if (match === "\n") {
  1460. return "\\n";
  1461. } else if (match === "\r") {
  1462. return "\\r";
  1463. }
  1464. return `\\${match}`;
  1465. });
  1466. }
  1467. function isAscii(str) {
  1468. return /^[\x00-\x7F]*$/.test(str);
  1469. }
  1470. function stringToUTF16BEString(str) {
  1471. const buf = ["\xFE\xFF"];
  1472. for (let i = 0, ii = str.length; i < ii; i++) {
  1473. const char = str.charCodeAt(i);
  1474. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1475. }
  1476. return buf.join("");
  1477. }
  1478. function stringToUTF8String(str) {
  1479. return decodeURIComponent(escape(str));
  1480. }
  1481. function utf8StringToString(str) {
  1482. return unescape(encodeURIComponent(str));
  1483. }
  1484. function isArrayBuffer(v) {
  1485. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1486. }
  1487. function isArrayEqual(arr1, arr2) {
  1488. if (arr1.length !== arr2.length) {
  1489. return false;
  1490. }
  1491. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1492. if (arr1[i] !== arr2[i]) {
  1493. return false;
  1494. }
  1495. }
  1496. return true;
  1497. }
  1498. function getModificationDate() {
  1499. let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  1500. 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")];
  1501. return buffer.join("");
  1502. }
  1503. function createPromiseCapability() {
  1504. const capability = Object.create(null);
  1505. let isSettled = false;
  1506. Object.defineProperty(capability, "settled", {
  1507. get() {
  1508. return isSettled;
  1509. }
  1510. });
  1511. capability.promise = new Promise(function (resolve, reject) {
  1512. capability.resolve = function (data) {
  1513. isSettled = true;
  1514. resolve(data);
  1515. };
  1516. capability.reject = function (reason) {
  1517. isSettled = true;
  1518. reject(reason);
  1519. };
  1520. });
  1521. return capability;
  1522. }
  1523. /***/ }),
  1524. /* 3 */
  1525. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1526. "use strict";
  1527. var _is_node = __w_pdfjs_require__(4);
  1528. (function checkNodeBtoa() {
  1529. if (globalThis.btoa || !_is_node.isNodeJS) {
  1530. return;
  1531. }
  1532. globalThis.btoa = function (chars) {
  1533. return Buffer.from(chars, "binary").toString("base64");
  1534. };
  1535. })();
  1536. (function checkNodeAtob() {
  1537. if (globalThis.atob || !_is_node.isNodeJS) {
  1538. return;
  1539. }
  1540. globalThis.atob = function (input) {
  1541. return Buffer.from(input, "base64").toString("binary");
  1542. };
  1543. })();
  1544. (function checkDOMMatrix() {
  1545. if (globalThis.DOMMatrix || !_is_node.isNodeJS) {
  1546. return;
  1547. }
  1548. globalThis.DOMMatrix = require("canvas").DOMMatrix;
  1549. })();
  1550. (function checkReadableStream() {
  1551. if (globalThis.ReadableStream || !_is_node.isNodeJS) {
  1552. return;
  1553. }
  1554. globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
  1555. })();
  1556. (function checkArrayAt() {
  1557. if (Array.prototype.at) {
  1558. return;
  1559. }
  1560. __w_pdfjs_require__(5);
  1561. })();
  1562. (function checkTypedArrayAt() {
  1563. if (Uint8Array.prototype.at) {
  1564. return;
  1565. }
  1566. __w_pdfjs_require__(80);
  1567. })();
  1568. (function checkStructuredClone() {
  1569. if (globalThis.structuredClone) {
  1570. return;
  1571. }
  1572. __w_pdfjs_require__(90);
  1573. })();
  1574. /***/ }),
  1575. /* 4 */
  1576. /***/ ((__unused_webpack_module, exports) => {
  1577. "use strict";
  1578. Object.defineProperty(exports, "__esModule", ({
  1579. value: true
  1580. }));
  1581. exports.isNodeJS = void 0;
  1582. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1583. exports.isNodeJS = isNodeJS;
  1584. /***/ }),
  1585. /* 5 */
  1586. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1587. __w_pdfjs_require__(6);
  1588. var entryUnbind = __w_pdfjs_require__(79);
  1589. module.exports = entryUnbind('Array', 'at');
  1590. /***/ }),
  1591. /* 6 */
  1592. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1593. "use strict";
  1594. var $ = __w_pdfjs_require__(7);
  1595. var toObject = __w_pdfjs_require__(45);
  1596. var lengthOfArrayLike = __w_pdfjs_require__(69);
  1597. var toIntegerOrInfinity = __w_pdfjs_require__(67);
  1598. var addToUnscopables = __w_pdfjs_require__(74);
  1599. $({
  1600. target: 'Array',
  1601. proto: true
  1602. }, {
  1603. at: function at(index) {
  1604. var O = toObject(this);
  1605. var len = lengthOfArrayLike(O);
  1606. var relativeIndex = toIntegerOrInfinity(index);
  1607. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  1608. return k < 0 || k >= len ? undefined : O[k];
  1609. }
  1610. });
  1611. addToUnscopables('at');
  1612. /***/ }),
  1613. /* 7 */
  1614. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1615. var global = __w_pdfjs_require__(8);
  1616. var getOwnPropertyDescriptor = (__w_pdfjs_require__(9).f);
  1617. var createNonEnumerableProperty = __w_pdfjs_require__(49);
  1618. var defineBuiltIn = __w_pdfjs_require__(53);
  1619. var defineGlobalProperty = __w_pdfjs_require__(43);
  1620. var copyConstructorProperties = __w_pdfjs_require__(61);
  1621. var isForced = __w_pdfjs_require__(73);
  1622. module.exports = function (options, source) {
  1623. var TARGET = options.target;
  1624. var GLOBAL = options.global;
  1625. var STATIC = options.stat;
  1626. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  1627. if (GLOBAL) {
  1628. target = global;
  1629. } else if (STATIC) {
  1630. target = global[TARGET] || defineGlobalProperty(TARGET, {});
  1631. } else {
  1632. target = (global[TARGET] || {}).prototype;
  1633. }
  1634. if (target)
  1635. for (key in source) {
  1636. sourceProperty = source[key];
  1637. if (options.dontCallGetSet) {
  1638. descriptor = getOwnPropertyDescriptor(target, key);
  1639. targetProperty = descriptor && descriptor.value;
  1640. } else
  1641. targetProperty = target[key];
  1642. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  1643. if (!FORCED && targetProperty !== undefined) {
  1644. if (typeof sourceProperty == typeof targetProperty)
  1645. continue;
  1646. copyConstructorProperties(sourceProperty, targetProperty);
  1647. }
  1648. if (options.sham || targetProperty && targetProperty.sham) {
  1649. createNonEnumerableProperty(sourceProperty, 'sham', true);
  1650. }
  1651. defineBuiltIn(target, key, sourceProperty, options);
  1652. }
  1653. };
  1654. /***/ }),
  1655. /* 8 */
  1656. /***/ ((module) => {
  1657. var check = function (it) {
  1658. return it && it.Math == Math && it;
  1659. };
  1660. module.exports = check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || check(typeof self == 'object' && self) || check(typeof global == 'object' && global) || (function () {
  1661. return this;
  1662. }()) || Function('return this')();
  1663. /***/ }),
  1664. /* 9 */
  1665. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1666. var DESCRIPTORS = __w_pdfjs_require__(10);
  1667. var call = __w_pdfjs_require__(12);
  1668. var propertyIsEnumerableModule = __w_pdfjs_require__(14);
  1669. var createPropertyDescriptor = __w_pdfjs_require__(15);
  1670. var toIndexedObject = __w_pdfjs_require__(16);
  1671. var toPropertyKey = __w_pdfjs_require__(23);
  1672. var hasOwn = __w_pdfjs_require__(44);
  1673. var IE8_DOM_DEFINE = __w_pdfjs_require__(47);
  1674. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1675. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  1676. O = toIndexedObject(O);
  1677. P = toPropertyKey(P);
  1678. if (IE8_DOM_DEFINE)
  1679. try {
  1680. return $getOwnPropertyDescriptor(O, P);
  1681. } catch (error) {
  1682. }
  1683. if (hasOwn(O, P))
  1684. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  1685. };
  1686. /***/ }),
  1687. /* 10 */
  1688. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1689. var fails = __w_pdfjs_require__(11);
  1690. module.exports = !fails(function () {
  1691. return Object.defineProperty({}, 1, {
  1692. get: function () {
  1693. return 7;
  1694. }
  1695. })[1] != 7;
  1696. });
  1697. /***/ }),
  1698. /* 11 */
  1699. /***/ ((module) => {
  1700. module.exports = function (exec) {
  1701. try {
  1702. return !!exec();
  1703. } catch (error) {
  1704. return true;
  1705. }
  1706. };
  1707. /***/ }),
  1708. /* 12 */
  1709. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1710. var NATIVE_BIND = __w_pdfjs_require__(13);
  1711. var call = Function.prototype.call;
  1712. module.exports = NATIVE_BIND ? call.bind(call) : function () {
  1713. return call.apply(call, arguments);
  1714. };
  1715. /***/ }),
  1716. /* 13 */
  1717. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1718. var fails = __w_pdfjs_require__(11);
  1719. module.exports = !fails(function () {
  1720. var test = function () {
  1721. }.bind();
  1722. return typeof test != 'function' || test.hasOwnProperty('prototype');
  1723. });
  1724. /***/ }),
  1725. /* 14 */
  1726. /***/ ((__unused_webpack_module, exports) => {
  1727. "use strict";
  1728. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  1729. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1730. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  1731. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  1732. var descriptor = getOwnPropertyDescriptor(this, V);
  1733. return !!descriptor && descriptor.enumerable;
  1734. } : $propertyIsEnumerable;
  1735. /***/ }),
  1736. /* 15 */
  1737. /***/ ((module) => {
  1738. module.exports = function (bitmap, value) {
  1739. return {
  1740. enumerable: !(bitmap & 1),
  1741. configurable: !(bitmap & 2),
  1742. writable: !(bitmap & 4),
  1743. value: value
  1744. };
  1745. };
  1746. /***/ }),
  1747. /* 16 */
  1748. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1749. var IndexedObject = __w_pdfjs_require__(17);
  1750. var requireObjectCoercible = __w_pdfjs_require__(21);
  1751. module.exports = function (it) {
  1752. return IndexedObject(requireObjectCoercible(it));
  1753. };
  1754. /***/ }),
  1755. /* 17 */
  1756. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1757. var uncurryThis = __w_pdfjs_require__(18);
  1758. var fails = __w_pdfjs_require__(11);
  1759. var classof = __w_pdfjs_require__(19);
  1760. var $Object = Object;
  1761. var split = uncurryThis(''.split);
  1762. module.exports = fails(function () {
  1763. return !$Object('z').propertyIsEnumerable(0);
  1764. }) ? function (it) {
  1765. return classof(it) == 'String' ? split(it, '') : $Object(it);
  1766. } : $Object;
  1767. /***/ }),
  1768. /* 18 */
  1769. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1770. var classofRaw = __w_pdfjs_require__(19);
  1771. var uncurryThisRaw = __w_pdfjs_require__(20);
  1772. module.exports = function (fn) {
  1773. if (classofRaw(fn) === 'Function')
  1774. return uncurryThisRaw(fn);
  1775. };
  1776. /***/ }),
  1777. /* 19 */
  1778. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1779. var uncurryThisRaw = __w_pdfjs_require__(20);
  1780. var toString = uncurryThisRaw({}.toString);
  1781. var stringSlice = uncurryThisRaw(''.slice);
  1782. module.exports = function (it) {
  1783. return stringSlice(toString(it), 8, -1);
  1784. };
  1785. /***/ }),
  1786. /* 20 */
  1787. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1788. var NATIVE_BIND = __w_pdfjs_require__(13);
  1789. var FunctionPrototype = Function.prototype;
  1790. var call = FunctionPrototype.call;
  1791. var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
  1792. module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
  1793. return function () {
  1794. return call.apply(fn, arguments);
  1795. };
  1796. };
  1797. /***/ }),
  1798. /* 21 */
  1799. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1800. var isNullOrUndefined = __w_pdfjs_require__(22);
  1801. var $TypeError = TypeError;
  1802. module.exports = function (it) {
  1803. if (isNullOrUndefined(it))
  1804. throw $TypeError("Can't call method on " + it);
  1805. return it;
  1806. };
  1807. /***/ }),
  1808. /* 22 */
  1809. /***/ ((module) => {
  1810. module.exports = function (it) {
  1811. return it === null || it === undefined;
  1812. };
  1813. /***/ }),
  1814. /* 23 */
  1815. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1816. var toPrimitive = __w_pdfjs_require__(24);
  1817. var isSymbol = __w_pdfjs_require__(28);
  1818. module.exports = function (argument) {
  1819. var key = toPrimitive(argument, 'string');
  1820. return isSymbol(key) ? key : key + '';
  1821. };
  1822. /***/ }),
  1823. /* 24 */
  1824. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1825. var call = __w_pdfjs_require__(12);
  1826. var isObject = __w_pdfjs_require__(25);
  1827. var isSymbol = __w_pdfjs_require__(28);
  1828. var getMethod = __w_pdfjs_require__(35);
  1829. var ordinaryToPrimitive = __w_pdfjs_require__(38);
  1830. var wellKnownSymbol = __w_pdfjs_require__(39);
  1831. var $TypeError = TypeError;
  1832. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  1833. module.exports = function (input, pref) {
  1834. if (!isObject(input) || isSymbol(input))
  1835. return input;
  1836. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  1837. var result;
  1838. if (exoticToPrim) {
  1839. if (pref === undefined)
  1840. pref = 'default';
  1841. result = call(exoticToPrim, input, pref);
  1842. if (!isObject(result) || isSymbol(result))
  1843. return result;
  1844. throw $TypeError("Can't convert object to primitive value");
  1845. }
  1846. if (pref === undefined)
  1847. pref = 'number';
  1848. return ordinaryToPrimitive(input, pref);
  1849. };
  1850. /***/ }),
  1851. /* 25 */
  1852. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1853. var isCallable = __w_pdfjs_require__(26);
  1854. var $documentAll = __w_pdfjs_require__(27);
  1855. var documentAll = $documentAll.all;
  1856. module.exports = $documentAll.IS_HTMLDDA ? function (it) {
  1857. return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
  1858. } : function (it) {
  1859. return typeof it == 'object' ? it !== null : isCallable(it);
  1860. };
  1861. /***/ }),
  1862. /* 26 */
  1863. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1864. var $documentAll = __w_pdfjs_require__(27);
  1865. var documentAll = $documentAll.all;
  1866. module.exports = $documentAll.IS_HTMLDDA ? function (argument) {
  1867. return typeof argument == 'function' || argument === documentAll;
  1868. } : function (argument) {
  1869. return typeof argument == 'function';
  1870. };
  1871. /***/ }),
  1872. /* 27 */
  1873. /***/ ((module) => {
  1874. var documentAll = typeof document == 'object' && document.all;
  1875. var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;
  1876. module.exports = {
  1877. all: documentAll,
  1878. IS_HTMLDDA: IS_HTMLDDA
  1879. };
  1880. /***/ }),
  1881. /* 28 */
  1882. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1883. var getBuiltIn = __w_pdfjs_require__(29);
  1884. var isCallable = __w_pdfjs_require__(26);
  1885. var isPrototypeOf = __w_pdfjs_require__(30);
  1886. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(31);
  1887. var $Object = Object;
  1888. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  1889. return typeof it == 'symbol';
  1890. } : function (it) {
  1891. var $Symbol = getBuiltIn('Symbol');
  1892. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  1893. };
  1894. /***/ }),
  1895. /* 29 */
  1896. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1897. var global = __w_pdfjs_require__(8);
  1898. var isCallable = __w_pdfjs_require__(26);
  1899. var aFunction = function (argument) {
  1900. return isCallable(argument) ? argument : undefined;
  1901. };
  1902. module.exports = function (namespace, method) {
  1903. return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
  1904. };
  1905. /***/ }),
  1906. /* 30 */
  1907. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1908. var uncurryThis = __w_pdfjs_require__(18);
  1909. module.exports = uncurryThis({}.isPrototypeOf);
  1910. /***/ }),
  1911. /* 31 */
  1912. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1913. var NATIVE_SYMBOL = __w_pdfjs_require__(32);
  1914. module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol';
  1915. /***/ }),
  1916. /* 32 */
  1917. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1918. var V8_VERSION = __w_pdfjs_require__(33);
  1919. var fails = __w_pdfjs_require__(11);
  1920. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  1921. var symbol = Symbol();
  1922. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  1923. });
  1924. /***/ }),
  1925. /* 33 */
  1926. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1927. var global = __w_pdfjs_require__(8);
  1928. var userAgent = __w_pdfjs_require__(34);
  1929. var process = global.process;
  1930. var Deno = global.Deno;
  1931. var versions = process && process.versions || Deno && Deno.version;
  1932. var v8 = versions && versions.v8;
  1933. var match, version;
  1934. if (v8) {
  1935. match = v8.split('.');
  1936. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  1937. }
  1938. if (!version && userAgent) {
  1939. match = userAgent.match(/Edge\/(\d+)/);
  1940. if (!match || match[1] >= 74) {
  1941. match = userAgent.match(/Chrome\/(\d+)/);
  1942. if (match)
  1943. version = +match[1];
  1944. }
  1945. }
  1946. module.exports = version;
  1947. /***/ }),
  1948. /* 34 */
  1949. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1950. var getBuiltIn = __w_pdfjs_require__(29);
  1951. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  1952. /***/ }),
  1953. /* 35 */
  1954. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1955. var aCallable = __w_pdfjs_require__(36);
  1956. var isNullOrUndefined = __w_pdfjs_require__(22);
  1957. module.exports = function (V, P) {
  1958. var func = V[P];
  1959. return isNullOrUndefined(func) ? undefined : aCallable(func);
  1960. };
  1961. /***/ }),
  1962. /* 36 */
  1963. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1964. var isCallable = __w_pdfjs_require__(26);
  1965. var tryToString = __w_pdfjs_require__(37);
  1966. var $TypeError = TypeError;
  1967. module.exports = function (argument) {
  1968. if (isCallable(argument))
  1969. return argument;
  1970. throw $TypeError(tryToString(argument) + ' is not a function');
  1971. };
  1972. /***/ }),
  1973. /* 37 */
  1974. /***/ ((module) => {
  1975. var $String = String;
  1976. module.exports = function (argument) {
  1977. try {
  1978. return $String(argument);
  1979. } catch (error) {
  1980. return 'Object';
  1981. }
  1982. };
  1983. /***/ }),
  1984. /* 38 */
  1985. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1986. var call = __w_pdfjs_require__(12);
  1987. var isCallable = __w_pdfjs_require__(26);
  1988. var isObject = __w_pdfjs_require__(25);
  1989. var $TypeError = TypeError;
  1990. module.exports = function (input, pref) {
  1991. var fn, val;
  1992. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1993. return val;
  1994. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  1995. return val;
  1996. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  1997. return val;
  1998. throw $TypeError("Can't convert object to primitive value");
  1999. };
  2000. /***/ }),
  2001. /* 39 */
  2002. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2003. var global = __w_pdfjs_require__(8);
  2004. var shared = __w_pdfjs_require__(40);
  2005. var hasOwn = __w_pdfjs_require__(44);
  2006. var uid = __w_pdfjs_require__(46);
  2007. var NATIVE_SYMBOL = __w_pdfjs_require__(32);
  2008. var USE_SYMBOL_AS_UID = __w_pdfjs_require__(31);
  2009. var WellKnownSymbolsStore = shared('wks');
  2010. var Symbol = global.Symbol;
  2011. var symbolFor = Symbol && Symbol['for'];
  2012. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  2013. module.exports = function (name) {
  2014. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  2015. var description = 'Symbol.' + name;
  2016. if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
  2017. WellKnownSymbolsStore[name] = Symbol[name];
  2018. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  2019. WellKnownSymbolsStore[name] = symbolFor(description);
  2020. } else {
  2021. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  2022. }
  2023. }
  2024. return WellKnownSymbolsStore[name];
  2025. };
  2026. /***/ }),
  2027. /* 40 */
  2028. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2029. var IS_PURE = __w_pdfjs_require__(41);
  2030. var store = __w_pdfjs_require__(42);
  2031. (module.exports = function (key, value) {
  2032. return store[key] || (store[key] = value !== undefined ? value : {});
  2033. })('versions', []).push({
  2034. version: '3.26.0',
  2035. mode: IS_PURE ? 'pure' : 'global',
  2036. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  2037. license: 'https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE',
  2038. source: 'https://github.com/zloirock/core-js'
  2039. });
  2040. /***/ }),
  2041. /* 41 */
  2042. /***/ ((module) => {
  2043. module.exports = false;
  2044. /***/ }),
  2045. /* 42 */
  2046. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2047. var global = __w_pdfjs_require__(8);
  2048. var defineGlobalProperty = __w_pdfjs_require__(43);
  2049. var SHARED = '__core-js_shared__';
  2050. var store = global[SHARED] || defineGlobalProperty(SHARED, {});
  2051. module.exports = store;
  2052. /***/ }),
  2053. /* 43 */
  2054. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2055. var global = __w_pdfjs_require__(8);
  2056. var defineProperty = Object.defineProperty;
  2057. module.exports = function (key, value) {
  2058. try {
  2059. defineProperty(global, key, {
  2060. value: value,
  2061. configurable: true,
  2062. writable: true
  2063. });
  2064. } catch (error) {
  2065. global[key] = value;
  2066. }
  2067. return value;
  2068. };
  2069. /***/ }),
  2070. /* 44 */
  2071. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2072. var uncurryThis = __w_pdfjs_require__(18);
  2073. var toObject = __w_pdfjs_require__(45);
  2074. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  2075. module.exports = Object.hasOwn || function hasOwn(it, key) {
  2076. return hasOwnProperty(toObject(it), key);
  2077. };
  2078. /***/ }),
  2079. /* 45 */
  2080. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2081. var requireObjectCoercible = __w_pdfjs_require__(21);
  2082. var $Object = Object;
  2083. module.exports = function (argument) {
  2084. return $Object(requireObjectCoercible(argument));
  2085. };
  2086. /***/ }),
  2087. /* 46 */
  2088. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2089. var uncurryThis = __w_pdfjs_require__(18);
  2090. var id = 0;
  2091. var postfix = Math.random();
  2092. var toString = uncurryThis(1.0.toString);
  2093. module.exports = function (key) {
  2094. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  2095. };
  2096. /***/ }),
  2097. /* 47 */
  2098. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2099. var DESCRIPTORS = __w_pdfjs_require__(10);
  2100. var fails = __w_pdfjs_require__(11);
  2101. var createElement = __w_pdfjs_require__(48);
  2102. module.exports = !DESCRIPTORS && !fails(function () {
  2103. return Object.defineProperty(createElement('div'), 'a', {
  2104. get: function () {
  2105. return 7;
  2106. }
  2107. }).a != 7;
  2108. });
  2109. /***/ }),
  2110. /* 48 */
  2111. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2112. var global = __w_pdfjs_require__(8);
  2113. var isObject = __w_pdfjs_require__(25);
  2114. var document = global.document;
  2115. var EXISTS = isObject(document) && isObject(document.createElement);
  2116. module.exports = function (it) {
  2117. return EXISTS ? document.createElement(it) : {};
  2118. };
  2119. /***/ }),
  2120. /* 49 */
  2121. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2122. var DESCRIPTORS = __w_pdfjs_require__(10);
  2123. var definePropertyModule = __w_pdfjs_require__(50);
  2124. var createPropertyDescriptor = __w_pdfjs_require__(15);
  2125. module.exports = DESCRIPTORS ? function (object, key, value) {
  2126. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  2127. } : function (object, key, value) {
  2128. object[key] = value;
  2129. return object;
  2130. };
  2131. /***/ }),
  2132. /* 50 */
  2133. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2134. var DESCRIPTORS = __w_pdfjs_require__(10);
  2135. var IE8_DOM_DEFINE = __w_pdfjs_require__(47);
  2136. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(51);
  2137. var anObject = __w_pdfjs_require__(52);
  2138. var toPropertyKey = __w_pdfjs_require__(23);
  2139. var $TypeError = TypeError;
  2140. var $defineProperty = Object.defineProperty;
  2141. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  2142. var ENUMERABLE = 'enumerable';
  2143. var CONFIGURABLE = 'configurable';
  2144. var WRITABLE = 'writable';
  2145. exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  2146. anObject(O);
  2147. P = toPropertyKey(P);
  2148. anObject(Attributes);
  2149. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  2150. var current = $getOwnPropertyDescriptor(O, P);
  2151. if (current && current[WRITABLE]) {
  2152. O[P] = Attributes.value;
  2153. Attributes = {
  2154. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  2155. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  2156. writable: false
  2157. };
  2158. }
  2159. }
  2160. return $defineProperty(O, P, Attributes);
  2161. } : $defineProperty : function defineProperty(O, P, Attributes) {
  2162. anObject(O);
  2163. P = toPropertyKey(P);
  2164. anObject(Attributes);
  2165. if (IE8_DOM_DEFINE)
  2166. try {
  2167. return $defineProperty(O, P, Attributes);
  2168. } catch (error) {
  2169. }
  2170. if ('get' in Attributes || 'set' in Attributes)
  2171. throw $TypeError('Accessors not supported');
  2172. if ('value' in Attributes)
  2173. O[P] = Attributes.value;
  2174. return O;
  2175. };
  2176. /***/ }),
  2177. /* 51 */
  2178. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2179. var DESCRIPTORS = __w_pdfjs_require__(10);
  2180. var fails = __w_pdfjs_require__(11);
  2181. module.exports = DESCRIPTORS && fails(function () {
  2182. return Object.defineProperty(function () {
  2183. }, 'prototype', {
  2184. value: 42,
  2185. writable: false
  2186. }).prototype != 42;
  2187. });
  2188. /***/ }),
  2189. /* 52 */
  2190. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2191. var isObject = __w_pdfjs_require__(25);
  2192. var $String = String;
  2193. var $TypeError = TypeError;
  2194. module.exports = function (argument) {
  2195. if (isObject(argument))
  2196. return argument;
  2197. throw $TypeError($String(argument) + ' is not an object');
  2198. };
  2199. /***/ }),
  2200. /* 53 */
  2201. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2202. var isCallable = __w_pdfjs_require__(26);
  2203. var definePropertyModule = __w_pdfjs_require__(50);
  2204. var makeBuiltIn = __w_pdfjs_require__(54);
  2205. var defineGlobalProperty = __w_pdfjs_require__(43);
  2206. module.exports = function (O, key, value, options) {
  2207. if (!options)
  2208. options = {};
  2209. var simple = options.enumerable;
  2210. var name = options.name !== undefined ? options.name : key;
  2211. if (isCallable(value))
  2212. makeBuiltIn(value, name, options);
  2213. if (options.global) {
  2214. if (simple)
  2215. O[key] = value;
  2216. else
  2217. defineGlobalProperty(key, value);
  2218. } else {
  2219. try {
  2220. if (!options.unsafe)
  2221. delete O[key];
  2222. else if (O[key])
  2223. simple = true;
  2224. } catch (error) {
  2225. }
  2226. if (simple)
  2227. O[key] = value;
  2228. else
  2229. definePropertyModule.f(O, key, {
  2230. value: value,
  2231. enumerable: false,
  2232. configurable: !options.nonConfigurable,
  2233. writable: !options.nonWritable
  2234. });
  2235. }
  2236. return O;
  2237. };
  2238. /***/ }),
  2239. /* 54 */
  2240. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2241. var fails = __w_pdfjs_require__(11);
  2242. var isCallable = __w_pdfjs_require__(26);
  2243. var hasOwn = __w_pdfjs_require__(44);
  2244. var DESCRIPTORS = __w_pdfjs_require__(10);
  2245. var CONFIGURABLE_FUNCTION_NAME = (__w_pdfjs_require__(55).CONFIGURABLE);
  2246. var inspectSource = __w_pdfjs_require__(56);
  2247. var InternalStateModule = __w_pdfjs_require__(57);
  2248. var enforceInternalState = InternalStateModule.enforce;
  2249. var getInternalState = InternalStateModule.get;
  2250. var defineProperty = Object.defineProperty;
  2251. var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
  2252. return defineProperty(function () {
  2253. }, 'length', { value: 8 }).length !== 8;
  2254. });
  2255. var TEMPLATE = String(String).split('String');
  2256. var makeBuiltIn = module.exports = function (value, name, options) {
  2257. if (String(name).slice(0, 7) === 'Symbol(') {
  2258. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  2259. }
  2260. if (options && options.getter)
  2261. name = 'get ' + name;
  2262. if (options && options.setter)
  2263. name = 'set ' + name;
  2264. if (!hasOwn(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  2265. if (DESCRIPTORS)
  2266. defineProperty(value, 'name', {
  2267. value: name,
  2268. configurable: true
  2269. });
  2270. else
  2271. value.name = name;
  2272. }
  2273. if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
  2274. defineProperty(value, 'length', { value: options.arity });
  2275. }
  2276. try {
  2277. if (options && hasOwn(options, 'constructor') && options.constructor) {
  2278. if (DESCRIPTORS)
  2279. defineProperty(value, 'prototype', { writable: false });
  2280. } else if (value.prototype)
  2281. value.prototype = undefined;
  2282. } catch (error) {
  2283. }
  2284. var state = enforceInternalState(value);
  2285. if (!hasOwn(state, 'source')) {
  2286. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  2287. }
  2288. return value;
  2289. };
  2290. Function.prototype.toString = makeBuiltIn(function toString() {
  2291. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  2292. }, 'toString');
  2293. /***/ }),
  2294. /* 55 */
  2295. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2296. var DESCRIPTORS = __w_pdfjs_require__(10);
  2297. var hasOwn = __w_pdfjs_require__(44);
  2298. var FunctionPrototype = Function.prototype;
  2299. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  2300. var EXISTS = hasOwn(FunctionPrototype, 'name');
  2301. var PROPER = EXISTS && function something() {
  2302. }.name === 'something';
  2303. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable);
  2304. module.exports = {
  2305. EXISTS: EXISTS,
  2306. PROPER: PROPER,
  2307. CONFIGURABLE: CONFIGURABLE
  2308. };
  2309. /***/ }),
  2310. /* 56 */
  2311. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2312. var uncurryThis = __w_pdfjs_require__(18);
  2313. var isCallable = __w_pdfjs_require__(26);
  2314. var store = __w_pdfjs_require__(42);
  2315. var functionToString = uncurryThis(Function.toString);
  2316. if (!isCallable(store.inspectSource)) {
  2317. store.inspectSource = function (it) {
  2318. return functionToString(it);
  2319. };
  2320. }
  2321. module.exports = store.inspectSource;
  2322. /***/ }),
  2323. /* 57 */
  2324. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2325. var NATIVE_WEAK_MAP = __w_pdfjs_require__(58);
  2326. var global = __w_pdfjs_require__(8);
  2327. var isObject = __w_pdfjs_require__(25);
  2328. var createNonEnumerableProperty = __w_pdfjs_require__(49);
  2329. var hasOwn = __w_pdfjs_require__(44);
  2330. var shared = __w_pdfjs_require__(42);
  2331. var sharedKey = __w_pdfjs_require__(59);
  2332. var hiddenKeys = __w_pdfjs_require__(60);
  2333. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  2334. var TypeError = global.TypeError;
  2335. var WeakMap = global.WeakMap;
  2336. var set, get, has;
  2337. var enforce = function (it) {
  2338. return has(it) ? get(it) : set(it, {});
  2339. };
  2340. var getterFor = function (TYPE) {
  2341. return function (it) {
  2342. var state;
  2343. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  2344. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  2345. }
  2346. return state;
  2347. };
  2348. };
  2349. if (NATIVE_WEAK_MAP || shared.state) {
  2350. var store = shared.state || (shared.state = new WeakMap());
  2351. store.get = store.get;
  2352. store.has = store.has;
  2353. store.set = store.set;
  2354. set = function (it, metadata) {
  2355. if (store.has(it))
  2356. throw TypeError(OBJECT_ALREADY_INITIALIZED);
  2357. metadata.facade = it;
  2358. store.set(it, metadata);
  2359. return metadata;
  2360. };
  2361. get = function (it) {
  2362. return store.get(it) || {};
  2363. };
  2364. has = function (it) {
  2365. return store.has(it);
  2366. };
  2367. } else {
  2368. var STATE = sharedKey('state');
  2369. hiddenKeys[STATE] = true;
  2370. set = function (it, metadata) {
  2371. if (hasOwn(it, STATE))
  2372. throw TypeError(OBJECT_ALREADY_INITIALIZED);
  2373. metadata.facade = it;
  2374. createNonEnumerableProperty(it, STATE, metadata);
  2375. return metadata;
  2376. };
  2377. get = function (it) {
  2378. return hasOwn(it, STATE) ? it[STATE] : {};
  2379. };
  2380. has = function (it) {
  2381. return hasOwn(it, STATE);
  2382. };
  2383. }
  2384. module.exports = {
  2385. set: set,
  2386. get: get,
  2387. has: has,
  2388. enforce: enforce,
  2389. getterFor: getterFor
  2390. };
  2391. /***/ }),
  2392. /* 58 */
  2393. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2394. var global = __w_pdfjs_require__(8);
  2395. var isCallable = __w_pdfjs_require__(26);
  2396. var WeakMap = global.WeakMap;
  2397. module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
  2398. /***/ }),
  2399. /* 59 */
  2400. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2401. var shared = __w_pdfjs_require__(40);
  2402. var uid = __w_pdfjs_require__(46);
  2403. var keys = shared('keys');
  2404. module.exports = function (key) {
  2405. return keys[key] || (keys[key] = uid(key));
  2406. };
  2407. /***/ }),
  2408. /* 60 */
  2409. /***/ ((module) => {
  2410. module.exports = {};
  2411. /***/ }),
  2412. /* 61 */
  2413. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2414. var hasOwn = __w_pdfjs_require__(44);
  2415. var ownKeys = __w_pdfjs_require__(62);
  2416. var getOwnPropertyDescriptorModule = __w_pdfjs_require__(9);
  2417. var definePropertyModule = __w_pdfjs_require__(50);
  2418. module.exports = function (target, source, exceptions) {
  2419. var keys = ownKeys(source);
  2420. var defineProperty = definePropertyModule.f;
  2421. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  2422. for (var i = 0; i < keys.length; i++) {
  2423. var key = keys[i];
  2424. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  2425. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  2426. }
  2427. }
  2428. };
  2429. /***/ }),
  2430. /* 62 */
  2431. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2432. var getBuiltIn = __w_pdfjs_require__(29);
  2433. var uncurryThis = __w_pdfjs_require__(18);
  2434. var getOwnPropertyNamesModule = __w_pdfjs_require__(63);
  2435. var getOwnPropertySymbolsModule = __w_pdfjs_require__(72);
  2436. var anObject = __w_pdfjs_require__(52);
  2437. var concat = uncurryThis([].concat);
  2438. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  2439. var keys = getOwnPropertyNamesModule.f(anObject(it));
  2440. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  2441. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  2442. };
  2443. /***/ }),
  2444. /* 63 */
  2445. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2446. var internalObjectKeys = __w_pdfjs_require__(64);
  2447. var enumBugKeys = __w_pdfjs_require__(71);
  2448. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  2449. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  2450. return internalObjectKeys(O, hiddenKeys);
  2451. };
  2452. /***/ }),
  2453. /* 64 */
  2454. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2455. var uncurryThis = __w_pdfjs_require__(18);
  2456. var hasOwn = __w_pdfjs_require__(44);
  2457. var toIndexedObject = __w_pdfjs_require__(16);
  2458. var indexOf = (__w_pdfjs_require__(65).indexOf);
  2459. var hiddenKeys = __w_pdfjs_require__(60);
  2460. var push = uncurryThis([].push);
  2461. module.exports = function (object, names) {
  2462. var O = toIndexedObject(object);
  2463. var i = 0;
  2464. var result = [];
  2465. var key;
  2466. for (key in O)
  2467. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  2468. while (names.length > i)
  2469. if (hasOwn(O, key = names[i++])) {
  2470. ~indexOf(result, key) || push(result, key);
  2471. }
  2472. return result;
  2473. };
  2474. /***/ }),
  2475. /* 65 */
  2476. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2477. var toIndexedObject = __w_pdfjs_require__(16);
  2478. var toAbsoluteIndex = __w_pdfjs_require__(66);
  2479. var lengthOfArrayLike = __w_pdfjs_require__(69);
  2480. var createMethod = function (IS_INCLUDES) {
  2481. return function ($this, el, fromIndex) {
  2482. var O = toIndexedObject($this);
  2483. var length = lengthOfArrayLike(O);
  2484. var index = toAbsoluteIndex(fromIndex, length);
  2485. var value;
  2486. if (IS_INCLUDES && el != el)
  2487. while (length > index) {
  2488. value = O[index++];
  2489. if (value != value)
  2490. return true;
  2491. }
  2492. else
  2493. for (; length > index; index++) {
  2494. if ((IS_INCLUDES || index in O) && O[index] === el)
  2495. return IS_INCLUDES || index || 0;
  2496. }
  2497. return !IS_INCLUDES && -1;
  2498. };
  2499. };
  2500. module.exports = {
  2501. includes: createMethod(true),
  2502. indexOf: createMethod(false)
  2503. };
  2504. /***/ }),
  2505. /* 66 */
  2506. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2507. var toIntegerOrInfinity = __w_pdfjs_require__(67);
  2508. var max = Math.max;
  2509. var min = Math.min;
  2510. module.exports = function (index, length) {
  2511. var integer = toIntegerOrInfinity(index);
  2512. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  2513. };
  2514. /***/ }),
  2515. /* 67 */
  2516. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2517. var trunc = __w_pdfjs_require__(68);
  2518. module.exports = function (argument) {
  2519. var number = +argument;
  2520. return number !== number || number === 0 ? 0 : trunc(number);
  2521. };
  2522. /***/ }),
  2523. /* 68 */
  2524. /***/ ((module) => {
  2525. var ceil = Math.ceil;
  2526. var floor = Math.floor;
  2527. module.exports = Math.trunc || function trunc(x) {
  2528. var n = +x;
  2529. return (n > 0 ? floor : ceil)(n);
  2530. };
  2531. /***/ }),
  2532. /* 69 */
  2533. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2534. var toLength = __w_pdfjs_require__(70);
  2535. module.exports = function (obj) {
  2536. return toLength(obj.length);
  2537. };
  2538. /***/ }),
  2539. /* 70 */
  2540. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2541. var toIntegerOrInfinity = __w_pdfjs_require__(67);
  2542. var min = Math.min;
  2543. module.exports = function (argument) {
  2544. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0;
  2545. };
  2546. /***/ }),
  2547. /* 71 */
  2548. /***/ ((module) => {
  2549. module.exports = [
  2550. 'constructor',
  2551. 'hasOwnProperty',
  2552. 'isPrototypeOf',
  2553. 'propertyIsEnumerable',
  2554. 'toLocaleString',
  2555. 'toString',
  2556. 'valueOf'
  2557. ];
  2558. /***/ }),
  2559. /* 72 */
  2560. /***/ ((__unused_webpack_module, exports) => {
  2561. exports.f = Object.getOwnPropertySymbols;
  2562. /***/ }),
  2563. /* 73 */
  2564. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2565. var fails = __w_pdfjs_require__(11);
  2566. var isCallable = __w_pdfjs_require__(26);
  2567. var replacement = /#|\.prototype\./;
  2568. var isForced = function (feature, detection) {
  2569. var value = data[normalize(feature)];
  2570. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  2571. };
  2572. var normalize = isForced.normalize = function (string) {
  2573. return String(string).replace(replacement, '.').toLowerCase();
  2574. };
  2575. var data = isForced.data = {};
  2576. var NATIVE = isForced.NATIVE = 'N';
  2577. var POLYFILL = isForced.POLYFILL = 'P';
  2578. module.exports = isForced;
  2579. /***/ }),
  2580. /* 74 */
  2581. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2582. var wellKnownSymbol = __w_pdfjs_require__(39);
  2583. var create = __w_pdfjs_require__(75);
  2584. var defineProperty = (__w_pdfjs_require__(50).f);
  2585. var UNSCOPABLES = wellKnownSymbol('unscopables');
  2586. var ArrayPrototype = Array.prototype;
  2587. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  2588. defineProperty(ArrayPrototype, UNSCOPABLES, {
  2589. configurable: true,
  2590. value: create(null)
  2591. });
  2592. }
  2593. module.exports = function (key) {
  2594. ArrayPrototype[UNSCOPABLES][key] = true;
  2595. };
  2596. /***/ }),
  2597. /* 75 */
  2598. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2599. var anObject = __w_pdfjs_require__(52);
  2600. var definePropertiesModule = __w_pdfjs_require__(76);
  2601. var enumBugKeys = __w_pdfjs_require__(71);
  2602. var hiddenKeys = __w_pdfjs_require__(60);
  2603. var html = __w_pdfjs_require__(78);
  2604. var documentCreateElement = __w_pdfjs_require__(48);
  2605. var sharedKey = __w_pdfjs_require__(59);
  2606. var GT = '>';
  2607. var LT = '<';
  2608. var PROTOTYPE = 'prototype';
  2609. var SCRIPT = 'script';
  2610. var IE_PROTO = sharedKey('IE_PROTO');
  2611. var EmptyConstructor = function () {
  2612. };
  2613. var scriptTag = function (content) {
  2614. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  2615. };
  2616. var NullProtoObjectViaActiveX = function (activeXDocument) {
  2617. activeXDocument.write(scriptTag(''));
  2618. activeXDocument.close();
  2619. var temp = activeXDocument.parentWindow.Object;
  2620. activeXDocument = null;
  2621. return temp;
  2622. };
  2623. var NullProtoObjectViaIFrame = function () {
  2624. var iframe = documentCreateElement('iframe');
  2625. var JS = 'java' + SCRIPT + ':';
  2626. var iframeDocument;
  2627. iframe.style.display = 'none';
  2628. html.appendChild(iframe);
  2629. iframe.src = String(JS);
  2630. iframeDocument = iframe.contentWindow.document;
  2631. iframeDocument.open();
  2632. iframeDocument.write(scriptTag('document.F=Object'));
  2633. iframeDocument.close();
  2634. return iframeDocument.F;
  2635. };
  2636. var activeXDocument;
  2637. var NullProtoObject = function () {
  2638. try {
  2639. activeXDocument = new ActiveXObject('htmlfile');
  2640. } catch (error) {
  2641. }
  2642. NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument);
  2643. var length = enumBugKeys.length;
  2644. while (length--)
  2645. delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  2646. return NullProtoObject();
  2647. };
  2648. hiddenKeys[IE_PROTO] = true;
  2649. module.exports = Object.create || function create(O, Properties) {
  2650. var result;
  2651. if (O !== null) {
  2652. EmptyConstructor[PROTOTYPE] = anObject(O);
  2653. result = new EmptyConstructor();
  2654. EmptyConstructor[PROTOTYPE] = null;
  2655. result[IE_PROTO] = O;
  2656. } else
  2657. result = NullProtoObject();
  2658. return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
  2659. };
  2660. /***/ }),
  2661. /* 76 */
  2662. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2663. var DESCRIPTORS = __w_pdfjs_require__(10);
  2664. var V8_PROTOTYPE_DEFINE_BUG = __w_pdfjs_require__(51);
  2665. var definePropertyModule = __w_pdfjs_require__(50);
  2666. var anObject = __w_pdfjs_require__(52);
  2667. var toIndexedObject = __w_pdfjs_require__(16);
  2668. var objectKeys = __w_pdfjs_require__(77);
  2669. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  2670. anObject(O);
  2671. var props = toIndexedObject(Properties);
  2672. var keys = objectKeys(Properties);
  2673. var length = keys.length;
  2674. var index = 0;
  2675. var key;
  2676. while (length > index)
  2677. definePropertyModule.f(O, key = keys[index++], props[key]);
  2678. return O;
  2679. };
  2680. /***/ }),
  2681. /* 77 */
  2682. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2683. var internalObjectKeys = __w_pdfjs_require__(64);
  2684. var enumBugKeys = __w_pdfjs_require__(71);
  2685. module.exports = Object.keys || function keys(O) {
  2686. return internalObjectKeys(O, enumBugKeys);
  2687. };
  2688. /***/ }),
  2689. /* 78 */
  2690. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2691. var getBuiltIn = __w_pdfjs_require__(29);
  2692. module.exports = getBuiltIn('document', 'documentElement');
  2693. /***/ }),
  2694. /* 79 */
  2695. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2696. var global = __w_pdfjs_require__(8);
  2697. var uncurryThis = __w_pdfjs_require__(18);
  2698. module.exports = function (CONSTRUCTOR, METHOD) {
  2699. return uncurryThis(global[CONSTRUCTOR].prototype[METHOD]);
  2700. };
  2701. /***/ }),
  2702. /* 80 */
  2703. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2704. __w_pdfjs_require__(81);
  2705. /***/ }),
  2706. /* 81 */
  2707. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2708. "use strict";
  2709. var ArrayBufferViewCore = __w_pdfjs_require__(82);
  2710. var lengthOfArrayLike = __w_pdfjs_require__(69);
  2711. var toIntegerOrInfinity = __w_pdfjs_require__(67);
  2712. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  2713. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  2714. exportTypedArrayMethod('at', function at(index) {
  2715. var O = aTypedArray(this);
  2716. var len = lengthOfArrayLike(O);
  2717. var relativeIndex = toIntegerOrInfinity(index);
  2718. var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex;
  2719. return k < 0 || k >= len ? undefined : O[k];
  2720. });
  2721. /***/ }),
  2722. /* 82 */
  2723. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2724. "use strict";
  2725. var NATIVE_ARRAY_BUFFER = __w_pdfjs_require__(83);
  2726. var DESCRIPTORS = __w_pdfjs_require__(10);
  2727. var global = __w_pdfjs_require__(8);
  2728. var isCallable = __w_pdfjs_require__(26);
  2729. var isObject = __w_pdfjs_require__(25);
  2730. var hasOwn = __w_pdfjs_require__(44);
  2731. var classof = __w_pdfjs_require__(84);
  2732. var tryToString = __w_pdfjs_require__(37);
  2733. var createNonEnumerableProperty = __w_pdfjs_require__(49);
  2734. var defineBuiltIn = __w_pdfjs_require__(53);
  2735. var defineProperty = (__w_pdfjs_require__(50).f);
  2736. var isPrototypeOf = __w_pdfjs_require__(30);
  2737. var getPrototypeOf = __w_pdfjs_require__(86);
  2738. var setPrototypeOf = __w_pdfjs_require__(88);
  2739. var wellKnownSymbol = __w_pdfjs_require__(39);
  2740. var uid = __w_pdfjs_require__(46);
  2741. var InternalStateModule = __w_pdfjs_require__(57);
  2742. var enforceInternalState = InternalStateModule.enforce;
  2743. var getInternalState = InternalStateModule.get;
  2744. var Int8Array = global.Int8Array;
  2745. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  2746. var Uint8ClampedArray = global.Uint8ClampedArray;
  2747. var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
  2748. var TypedArray = Int8Array && getPrototypeOf(Int8Array);
  2749. var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
  2750. var ObjectPrototype = Object.prototype;
  2751. var TypeError = global.TypeError;
  2752. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2753. var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
  2754. var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
  2755. var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
  2756. var TYPED_ARRAY_TAG_REQUIRED = false;
  2757. var NAME, Constructor, Prototype;
  2758. var TypedArrayConstructorsList = {
  2759. Int8Array: 1,
  2760. Uint8Array: 1,
  2761. Uint8ClampedArray: 1,
  2762. Int16Array: 2,
  2763. Uint16Array: 2,
  2764. Int32Array: 4,
  2765. Uint32Array: 4,
  2766. Float32Array: 4,
  2767. Float64Array: 8
  2768. };
  2769. var BigIntArrayConstructorsList = {
  2770. BigInt64Array: 8,
  2771. BigUint64Array: 8
  2772. };
  2773. var isView = function isView(it) {
  2774. if (!isObject(it))
  2775. return false;
  2776. var klass = classof(it);
  2777. return klass === 'DataView' || hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2778. };
  2779. var getTypedArrayConstructor = function (it) {
  2780. var proto = getPrototypeOf(it);
  2781. if (!isObject(proto))
  2782. return;
  2783. var state = getInternalState(proto);
  2784. return state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);
  2785. };
  2786. var isTypedArray = function (it) {
  2787. if (!isObject(it))
  2788. return false;
  2789. var klass = classof(it);
  2790. return hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass);
  2791. };
  2792. var aTypedArray = function (it) {
  2793. if (isTypedArray(it))
  2794. return it;
  2795. throw TypeError('Target is not a typed array');
  2796. };
  2797. var aTypedArrayConstructor = function (C) {
  2798. if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C)))
  2799. return C;
  2800. throw TypeError(tryToString(C) + ' is not a typed array constructor');
  2801. };
  2802. var exportTypedArrayMethod = function (KEY, property, forced, options) {
  2803. if (!DESCRIPTORS)
  2804. return;
  2805. if (forced)
  2806. for (var ARRAY in TypedArrayConstructorsList) {
  2807. var TypedArrayConstructor = global[ARRAY];
  2808. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY))
  2809. try {
  2810. delete TypedArrayConstructor.prototype[KEY];
  2811. } catch (error) {
  2812. try {
  2813. TypedArrayConstructor.prototype[KEY] = property;
  2814. } catch (error2) {
  2815. }
  2816. }
  2817. }
  2818. if (!TypedArrayPrototype[KEY] || forced) {
  2819. defineBuiltIn(TypedArrayPrototype, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);
  2820. }
  2821. };
  2822. var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  2823. var ARRAY, TypedArrayConstructor;
  2824. if (!DESCRIPTORS)
  2825. return;
  2826. if (setPrototypeOf) {
  2827. if (forced)
  2828. for (ARRAY in TypedArrayConstructorsList) {
  2829. TypedArrayConstructor = global[ARRAY];
  2830. if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY))
  2831. try {
  2832. delete TypedArrayConstructor[KEY];
  2833. } catch (error) {
  2834. }
  2835. }
  2836. if (!TypedArray[KEY] || forced) {
  2837. try {
  2838. return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
  2839. } catch (error) {
  2840. }
  2841. } else
  2842. return;
  2843. }
  2844. for (ARRAY in TypedArrayConstructorsList) {
  2845. TypedArrayConstructor = global[ARRAY];
  2846. if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
  2847. defineBuiltIn(TypedArrayConstructor, KEY, property);
  2848. }
  2849. }
  2850. };
  2851. for (NAME in TypedArrayConstructorsList) {
  2852. Constructor = global[NAME];
  2853. Prototype = Constructor && Constructor.prototype;
  2854. if (Prototype)
  2855. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2856. else
  2857. NATIVE_ARRAY_BUFFER_VIEWS = false;
  2858. }
  2859. for (NAME in BigIntArrayConstructorsList) {
  2860. Constructor = global[NAME];
  2861. Prototype = Constructor && Constructor.prototype;
  2862. if (Prototype)
  2863. enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
  2864. }
  2865. if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
  2866. TypedArray = function TypedArray() {
  2867. throw TypeError('Incorrect invocation');
  2868. };
  2869. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2870. for (NAME in TypedArrayConstructorsList) {
  2871. if (global[NAME])
  2872. setPrototypeOf(global[NAME], TypedArray);
  2873. }
  2874. }
  2875. if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  2876. TypedArrayPrototype = TypedArray.prototype;
  2877. if (NATIVE_ARRAY_BUFFER_VIEWS)
  2878. for (NAME in TypedArrayConstructorsList) {
  2879. if (global[NAME])
  2880. setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  2881. }
  2882. }
  2883. if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  2884. setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
  2885. }
  2886. if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
  2887. TYPED_ARRAY_TAG_REQUIRED = true;
  2888. defineProperty(TypedArrayPrototype, TO_STRING_TAG, {
  2889. get: function () {
  2890. return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  2891. }
  2892. });
  2893. for (NAME in TypedArrayConstructorsList)
  2894. if (global[NAME]) {
  2895. createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  2896. }
  2897. }
  2898. module.exports = {
  2899. NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  2900. TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,
  2901. aTypedArray: aTypedArray,
  2902. aTypedArrayConstructor: aTypedArrayConstructor,
  2903. exportTypedArrayMethod: exportTypedArrayMethod,
  2904. exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  2905. getTypedArrayConstructor: getTypedArrayConstructor,
  2906. isView: isView,
  2907. isTypedArray: isTypedArray,
  2908. TypedArray: TypedArray,
  2909. TypedArrayPrototype: TypedArrayPrototype
  2910. };
  2911. /***/ }),
  2912. /* 83 */
  2913. /***/ ((module) => {
  2914. module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
  2915. /***/ }),
  2916. /* 84 */
  2917. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2918. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(85);
  2919. var isCallable = __w_pdfjs_require__(26);
  2920. var classofRaw = __w_pdfjs_require__(19);
  2921. var wellKnownSymbol = __w_pdfjs_require__(39);
  2922. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2923. var $Object = Object;
  2924. var CORRECT_ARGUMENTS = classofRaw((function () {
  2925. return arguments;
  2926. }())) == 'Arguments';
  2927. var tryGet = function (it, key) {
  2928. try {
  2929. return it[key];
  2930. } catch (error) {
  2931. }
  2932. };
  2933. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  2934. var O, tag, result;
  2935. return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  2936. };
  2937. /***/ }),
  2938. /* 85 */
  2939. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2940. var wellKnownSymbol = __w_pdfjs_require__(39);
  2941. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2942. var test = {};
  2943. test[TO_STRING_TAG] = 'z';
  2944. module.exports = String(test) === '[object z]';
  2945. /***/ }),
  2946. /* 86 */
  2947. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2948. var hasOwn = __w_pdfjs_require__(44);
  2949. var isCallable = __w_pdfjs_require__(26);
  2950. var toObject = __w_pdfjs_require__(45);
  2951. var sharedKey = __w_pdfjs_require__(59);
  2952. var CORRECT_PROTOTYPE_GETTER = __w_pdfjs_require__(87);
  2953. var IE_PROTO = sharedKey('IE_PROTO');
  2954. var $Object = Object;
  2955. var ObjectPrototype = $Object.prototype;
  2956. module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
  2957. var object = toObject(O);
  2958. if (hasOwn(object, IE_PROTO))
  2959. return object[IE_PROTO];
  2960. var constructor = object.constructor;
  2961. if (isCallable(constructor) && object instanceof constructor) {
  2962. return constructor.prototype;
  2963. }
  2964. return object instanceof $Object ? ObjectPrototype : null;
  2965. };
  2966. /***/ }),
  2967. /* 87 */
  2968. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2969. var fails = __w_pdfjs_require__(11);
  2970. module.exports = !fails(function () {
  2971. function F() {
  2972. }
  2973. F.prototype.constructor = null;
  2974. return Object.getPrototypeOf(new F()) !== F.prototype;
  2975. });
  2976. /***/ }),
  2977. /* 88 */
  2978. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  2979. var uncurryThis = __w_pdfjs_require__(18);
  2980. var anObject = __w_pdfjs_require__(52);
  2981. var aPossiblePrototype = __w_pdfjs_require__(89);
  2982. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? (function () {
  2983. var CORRECT_SETTER = false;
  2984. var test = {};
  2985. var setter;
  2986. try {
  2987. setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  2988. setter(test, []);
  2989. CORRECT_SETTER = test instanceof Array;
  2990. } catch (error) {
  2991. }
  2992. return function setPrototypeOf(O, proto) {
  2993. anObject(O);
  2994. aPossiblePrototype(proto);
  2995. if (CORRECT_SETTER)
  2996. setter(O, proto);
  2997. else
  2998. O.__proto__ = proto;
  2999. return O;
  3000. };
  3001. }()) : undefined);
  3002. /***/ }),
  3003. /* 89 */
  3004. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3005. var isCallable = __w_pdfjs_require__(26);
  3006. var $String = String;
  3007. var $TypeError = TypeError;
  3008. module.exports = function (argument) {
  3009. if (typeof argument == 'object' || isCallable(argument))
  3010. return argument;
  3011. throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
  3012. };
  3013. /***/ }),
  3014. /* 90 */
  3015. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3016. __w_pdfjs_require__(91);
  3017. __w_pdfjs_require__(98);
  3018. __w_pdfjs_require__(100);
  3019. __w_pdfjs_require__(122);
  3020. __w_pdfjs_require__(124);
  3021. var path = __w_pdfjs_require__(133);
  3022. module.exports = path.structuredClone;
  3023. /***/ }),
  3024. /* 91 */
  3025. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3026. "use strict";
  3027. var toIndexedObject = __w_pdfjs_require__(16);
  3028. var addToUnscopables = __w_pdfjs_require__(74);
  3029. var Iterators = __w_pdfjs_require__(92);
  3030. var InternalStateModule = __w_pdfjs_require__(57);
  3031. var defineProperty = (__w_pdfjs_require__(50).f);
  3032. var defineIterator = __w_pdfjs_require__(93);
  3033. var createIterResultObject = __w_pdfjs_require__(97);
  3034. var IS_PURE = __w_pdfjs_require__(41);
  3035. var DESCRIPTORS = __w_pdfjs_require__(10);
  3036. var ARRAY_ITERATOR = 'Array Iterator';
  3037. var setInternalState = InternalStateModule.set;
  3038. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  3039. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  3040. setInternalState(this, {
  3041. type: ARRAY_ITERATOR,
  3042. target: toIndexedObject(iterated),
  3043. index: 0,
  3044. kind: kind
  3045. });
  3046. }, function () {
  3047. var state = getInternalState(this);
  3048. var target = state.target;
  3049. var kind = state.kind;
  3050. var index = state.index++;
  3051. if (!target || index >= target.length) {
  3052. state.target = undefined;
  3053. return createIterResultObject(undefined, true);
  3054. }
  3055. if (kind == 'keys')
  3056. return createIterResultObject(index, false);
  3057. if (kind == 'values')
  3058. return createIterResultObject(target[index], false);
  3059. return createIterResultObject([
  3060. index,
  3061. target[index]
  3062. ], false);
  3063. }, 'values');
  3064. var values = Iterators.Arguments = Iterators.Array;
  3065. addToUnscopables('keys');
  3066. addToUnscopables('values');
  3067. addToUnscopables('entries');
  3068. if (!IS_PURE && DESCRIPTORS && values.name !== 'values')
  3069. try {
  3070. defineProperty(values, 'name', { value: 'values' });
  3071. } catch (error) {
  3072. }
  3073. /***/ }),
  3074. /* 92 */
  3075. /***/ ((module) => {
  3076. module.exports = {};
  3077. /***/ }),
  3078. /* 93 */
  3079. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3080. "use strict";
  3081. var $ = __w_pdfjs_require__(7);
  3082. var call = __w_pdfjs_require__(12);
  3083. var IS_PURE = __w_pdfjs_require__(41);
  3084. var FunctionName = __w_pdfjs_require__(55);
  3085. var isCallable = __w_pdfjs_require__(26);
  3086. var createIteratorConstructor = __w_pdfjs_require__(94);
  3087. var getPrototypeOf = __w_pdfjs_require__(86);
  3088. var setPrototypeOf = __w_pdfjs_require__(88);
  3089. var setToStringTag = __w_pdfjs_require__(96);
  3090. var createNonEnumerableProperty = __w_pdfjs_require__(49);
  3091. var defineBuiltIn = __w_pdfjs_require__(53);
  3092. var wellKnownSymbol = __w_pdfjs_require__(39);
  3093. var Iterators = __w_pdfjs_require__(92);
  3094. var IteratorsCore = __w_pdfjs_require__(95);
  3095. var PROPER_FUNCTION_NAME = FunctionName.PROPER;
  3096. var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
  3097. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  3098. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  3099. var ITERATOR = wellKnownSymbol('iterator');
  3100. var KEYS = 'keys';
  3101. var VALUES = 'values';
  3102. var ENTRIES = 'entries';
  3103. var returnThis = function () {
  3104. return this;
  3105. };
  3106. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  3107. createIteratorConstructor(IteratorConstructor, NAME, next);
  3108. var getIterationMethod = function (KIND) {
  3109. if (KIND === DEFAULT && defaultIterator)
  3110. return defaultIterator;
  3111. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype)
  3112. return IterablePrototype[KIND];
  3113. switch (KIND) {
  3114. case KEYS:
  3115. return function keys() {
  3116. return new IteratorConstructor(this, KIND);
  3117. };
  3118. case VALUES:
  3119. return function values() {
  3120. return new IteratorConstructor(this, KIND);
  3121. };
  3122. case ENTRIES:
  3123. return function entries() {
  3124. return new IteratorConstructor(this, KIND);
  3125. };
  3126. }
  3127. return function () {
  3128. return new IteratorConstructor(this);
  3129. };
  3130. };
  3131. var TO_STRING_TAG = NAME + ' Iterator';
  3132. var INCORRECT_VALUES_NAME = false;
  3133. var IterablePrototype = Iterable.prototype;
  3134. var nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT];
  3135. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  3136. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  3137. var CurrentIteratorPrototype, methods, KEY;
  3138. if (anyNativeIterator) {
  3139. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  3140. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  3141. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  3142. if (setPrototypeOf) {
  3143. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  3144. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
  3145. defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
  3146. }
  3147. }
  3148. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  3149. if (IS_PURE)
  3150. Iterators[TO_STRING_TAG] = returnThis;
  3151. }
  3152. }
  3153. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  3154. if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
  3155. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  3156. } else {
  3157. INCORRECT_VALUES_NAME = true;
  3158. defaultIterator = function values() {
  3159. return call(nativeIterator, this);
  3160. };
  3161. }
  3162. }
  3163. if (DEFAULT) {
  3164. methods = {
  3165. values: getIterationMethod(VALUES),
  3166. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  3167. entries: getIterationMethod(ENTRIES)
  3168. };
  3169. if (FORCED)
  3170. for (KEY in methods) {
  3171. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  3172. defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
  3173. }
  3174. }
  3175. else
  3176. $({
  3177. target: NAME,
  3178. proto: true,
  3179. forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME
  3180. }, methods);
  3181. }
  3182. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  3183. defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
  3184. }
  3185. Iterators[NAME] = defaultIterator;
  3186. return methods;
  3187. };
  3188. /***/ }),
  3189. /* 94 */
  3190. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3191. "use strict";
  3192. var IteratorPrototype = (__w_pdfjs_require__(95).IteratorPrototype);
  3193. var create = __w_pdfjs_require__(75);
  3194. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3195. var setToStringTag = __w_pdfjs_require__(96);
  3196. var Iterators = __w_pdfjs_require__(92);
  3197. var returnThis = function () {
  3198. return this;
  3199. };
  3200. module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  3201. var TO_STRING_TAG = NAME + ' Iterator';
  3202. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  3203. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  3204. Iterators[TO_STRING_TAG] = returnThis;
  3205. return IteratorConstructor;
  3206. };
  3207. /***/ }),
  3208. /* 95 */
  3209. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3210. "use strict";
  3211. var fails = __w_pdfjs_require__(11);
  3212. var isCallable = __w_pdfjs_require__(26);
  3213. var isObject = __w_pdfjs_require__(25);
  3214. var create = __w_pdfjs_require__(75);
  3215. var getPrototypeOf = __w_pdfjs_require__(86);
  3216. var defineBuiltIn = __w_pdfjs_require__(53);
  3217. var wellKnownSymbol = __w_pdfjs_require__(39);
  3218. var IS_PURE = __w_pdfjs_require__(41);
  3219. var ITERATOR = wellKnownSymbol('iterator');
  3220. var BUGGY_SAFARI_ITERATORS = false;
  3221. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  3222. if ([].keys) {
  3223. arrayIterator = [].keys();
  3224. if (!('next' in arrayIterator))
  3225. BUGGY_SAFARI_ITERATORS = true;
  3226. else {
  3227. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  3228. if (PrototypeOfArrayIteratorPrototype !== Object.prototype)
  3229. IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  3230. }
  3231. }
  3232. var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
  3233. var test = {};
  3234. return IteratorPrototype[ITERATOR].call(test) !== test;
  3235. });
  3236. if (NEW_ITERATOR_PROTOTYPE)
  3237. IteratorPrototype = {};
  3238. else if (IS_PURE)
  3239. IteratorPrototype = create(IteratorPrototype);
  3240. if (!isCallable(IteratorPrototype[ITERATOR])) {
  3241. defineBuiltIn(IteratorPrototype, ITERATOR, function () {
  3242. return this;
  3243. });
  3244. }
  3245. module.exports = {
  3246. IteratorPrototype: IteratorPrototype,
  3247. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  3248. };
  3249. /***/ }),
  3250. /* 96 */
  3251. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3252. var defineProperty = (__w_pdfjs_require__(50).f);
  3253. var hasOwn = __w_pdfjs_require__(44);
  3254. var wellKnownSymbol = __w_pdfjs_require__(39);
  3255. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  3256. module.exports = function (target, TAG, STATIC) {
  3257. if (target && !STATIC)
  3258. target = target.prototype;
  3259. if (target && !hasOwn(target, TO_STRING_TAG)) {
  3260. defineProperty(target, TO_STRING_TAG, {
  3261. configurable: true,
  3262. value: TAG
  3263. });
  3264. }
  3265. };
  3266. /***/ }),
  3267. /* 97 */
  3268. /***/ ((module) => {
  3269. module.exports = function (value, done) {
  3270. return {
  3271. value: value,
  3272. done: done
  3273. };
  3274. };
  3275. /***/ }),
  3276. /* 98 */
  3277. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3278. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(85);
  3279. var defineBuiltIn = __w_pdfjs_require__(53);
  3280. var toString = __w_pdfjs_require__(99);
  3281. if (!TO_STRING_TAG_SUPPORT) {
  3282. defineBuiltIn(Object.prototype, 'toString', toString, { unsafe: true });
  3283. }
  3284. /***/ }),
  3285. /* 99 */
  3286. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3287. "use strict";
  3288. var TO_STRING_TAG_SUPPORT = __w_pdfjs_require__(85);
  3289. var classof = __w_pdfjs_require__(84);
  3290. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  3291. return '[object ' + classof(this) + ']';
  3292. };
  3293. /***/ }),
  3294. /* 100 */
  3295. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3296. __w_pdfjs_require__(101);
  3297. /***/ }),
  3298. /* 101 */
  3299. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3300. "use strict";
  3301. var collection = __w_pdfjs_require__(102);
  3302. var collectionStrong = __w_pdfjs_require__(119);
  3303. collection('Map', function (init) {
  3304. return function Map() {
  3305. return init(this, arguments.length ? arguments[0] : undefined);
  3306. };
  3307. }, collectionStrong);
  3308. /***/ }),
  3309. /* 102 */
  3310. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3311. "use strict";
  3312. var $ = __w_pdfjs_require__(7);
  3313. var global = __w_pdfjs_require__(8);
  3314. var uncurryThis = __w_pdfjs_require__(18);
  3315. var isForced = __w_pdfjs_require__(73);
  3316. var defineBuiltIn = __w_pdfjs_require__(53);
  3317. var InternalMetadataModule = __w_pdfjs_require__(103);
  3318. var iterate = __w_pdfjs_require__(110);
  3319. var anInstance = __w_pdfjs_require__(116);
  3320. var isCallable = __w_pdfjs_require__(26);
  3321. var isNullOrUndefined = __w_pdfjs_require__(22);
  3322. var isObject = __w_pdfjs_require__(25);
  3323. var fails = __w_pdfjs_require__(11);
  3324. var checkCorrectnessOfIteration = __w_pdfjs_require__(117);
  3325. var setToStringTag = __w_pdfjs_require__(96);
  3326. var inheritIfRequired = __w_pdfjs_require__(118);
  3327. module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
  3328. var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
  3329. var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
  3330. var ADDER = IS_MAP ? 'set' : 'add';
  3331. var NativeConstructor = global[CONSTRUCTOR_NAME];
  3332. var NativePrototype = NativeConstructor && NativeConstructor.prototype;
  3333. var Constructor = NativeConstructor;
  3334. var exported = {};
  3335. var fixMethod = function (KEY) {
  3336. var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]);
  3337. defineBuiltIn(NativePrototype, KEY, KEY == 'add' ? function add(value) {
  3338. uncurriedNativeMethod(this, value === 0 ? 0 : value);
  3339. return this;
  3340. } : KEY == 'delete' ? function (key) {
  3341. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3342. } : KEY == 'get' ? function get(key) {
  3343. return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3344. } : KEY == 'has' ? function has(key) {
  3345. return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
  3346. } : function set(key, value) {
  3347. uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
  3348. return this;
  3349. });
  3350. };
  3351. var REPLACE = isForced(CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
  3352. new NativeConstructor().entries().next();
  3353. })));
  3354. if (REPLACE) {
  3355. Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
  3356. InternalMetadataModule.enable();
  3357. } else if (isForced(CONSTRUCTOR_NAME, true)) {
  3358. var instance = new Constructor();
  3359. var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
  3360. var THROWS_ON_PRIMITIVES = fails(function () {
  3361. instance.has(1);
  3362. });
  3363. var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) {
  3364. new NativeConstructor(iterable);
  3365. });
  3366. var BUGGY_ZERO = !IS_WEAK && fails(function () {
  3367. var $instance = new NativeConstructor();
  3368. var index = 5;
  3369. while (index--)
  3370. $instance[ADDER](index, index);
  3371. return !$instance.has(-0);
  3372. });
  3373. if (!ACCEPT_ITERABLES) {
  3374. Constructor = wrapper(function (dummy, iterable) {
  3375. anInstance(dummy, NativePrototype);
  3376. var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
  3377. if (!isNullOrUndefined(iterable))
  3378. iterate(iterable, that[ADDER], {
  3379. that: that,
  3380. AS_ENTRIES: IS_MAP
  3381. });
  3382. return that;
  3383. });
  3384. Constructor.prototype = NativePrototype;
  3385. NativePrototype.constructor = Constructor;
  3386. }
  3387. if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
  3388. fixMethod('delete');
  3389. fixMethod('has');
  3390. IS_MAP && fixMethod('get');
  3391. }
  3392. if (BUGGY_ZERO || HASNT_CHAINING)
  3393. fixMethod(ADDER);
  3394. if (IS_WEAK && NativePrototype.clear)
  3395. delete NativePrototype.clear;
  3396. }
  3397. exported[CONSTRUCTOR_NAME] = Constructor;
  3398. $({
  3399. global: true,
  3400. constructor: true,
  3401. forced: Constructor != NativeConstructor
  3402. }, exported);
  3403. setToStringTag(Constructor, CONSTRUCTOR_NAME);
  3404. if (!IS_WEAK)
  3405. common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
  3406. return Constructor;
  3407. };
  3408. /***/ }),
  3409. /* 103 */
  3410. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3411. var $ = __w_pdfjs_require__(7);
  3412. var uncurryThis = __w_pdfjs_require__(18);
  3413. var hiddenKeys = __w_pdfjs_require__(60);
  3414. var isObject = __w_pdfjs_require__(25);
  3415. var hasOwn = __w_pdfjs_require__(44);
  3416. var defineProperty = (__w_pdfjs_require__(50).f);
  3417. var getOwnPropertyNamesModule = __w_pdfjs_require__(63);
  3418. var getOwnPropertyNamesExternalModule = __w_pdfjs_require__(104);
  3419. var isExtensible = __w_pdfjs_require__(107);
  3420. var uid = __w_pdfjs_require__(46);
  3421. var FREEZING = __w_pdfjs_require__(109);
  3422. var REQUIRED = false;
  3423. var METADATA = uid('meta');
  3424. var id = 0;
  3425. var setMetadata = function (it) {
  3426. defineProperty(it, METADATA, {
  3427. value: {
  3428. objectID: 'O' + id++,
  3429. weakData: {}
  3430. }
  3431. });
  3432. };
  3433. var fastKey = function (it, create) {
  3434. if (!isObject(it))
  3435. return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  3436. if (!hasOwn(it, METADATA)) {
  3437. if (!isExtensible(it))
  3438. return 'F';
  3439. if (!create)
  3440. return 'E';
  3441. setMetadata(it);
  3442. }
  3443. return it[METADATA].objectID;
  3444. };
  3445. var getWeakData = function (it, create) {
  3446. if (!hasOwn(it, METADATA)) {
  3447. if (!isExtensible(it))
  3448. return true;
  3449. if (!create)
  3450. return false;
  3451. setMetadata(it);
  3452. }
  3453. return it[METADATA].weakData;
  3454. };
  3455. var onFreeze = function (it) {
  3456. if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA))
  3457. setMetadata(it);
  3458. return it;
  3459. };
  3460. var enable = function () {
  3461. meta.enable = function () {
  3462. };
  3463. REQUIRED = true;
  3464. var getOwnPropertyNames = getOwnPropertyNamesModule.f;
  3465. var splice = uncurryThis([].splice);
  3466. var test = {};
  3467. test[METADATA] = 1;
  3468. if (getOwnPropertyNames(test).length) {
  3469. getOwnPropertyNamesModule.f = function (it) {
  3470. var result = getOwnPropertyNames(it);
  3471. for (var i = 0, length = result.length; i < length; i++) {
  3472. if (result[i] === METADATA) {
  3473. splice(result, i, 1);
  3474. break;
  3475. }
  3476. }
  3477. return result;
  3478. };
  3479. $({
  3480. target: 'Object',
  3481. stat: true,
  3482. forced: true
  3483. }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f });
  3484. }
  3485. };
  3486. var meta = module.exports = {
  3487. enable: enable,
  3488. fastKey: fastKey,
  3489. getWeakData: getWeakData,
  3490. onFreeze: onFreeze
  3491. };
  3492. hiddenKeys[METADATA] = true;
  3493. /***/ }),
  3494. /* 104 */
  3495. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3496. var classof = __w_pdfjs_require__(19);
  3497. var toIndexedObject = __w_pdfjs_require__(16);
  3498. var $getOwnPropertyNames = (__w_pdfjs_require__(63).f);
  3499. var arraySlice = __w_pdfjs_require__(105);
  3500. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
  3501. var getWindowNames = function (it) {
  3502. try {
  3503. return $getOwnPropertyNames(it);
  3504. } catch (error) {
  3505. return arraySlice(windowNames);
  3506. }
  3507. };
  3508. module.exports.f = function getOwnPropertyNames(it) {
  3509. return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it));
  3510. };
  3511. /***/ }),
  3512. /* 105 */
  3513. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3514. var toAbsoluteIndex = __w_pdfjs_require__(66);
  3515. var lengthOfArrayLike = __w_pdfjs_require__(69);
  3516. var createProperty = __w_pdfjs_require__(106);
  3517. var $Array = Array;
  3518. var max = Math.max;
  3519. module.exports = function (O, start, end) {
  3520. var length = lengthOfArrayLike(O);
  3521. var k = toAbsoluteIndex(start, length);
  3522. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  3523. var result = $Array(max(fin - k, 0));
  3524. for (var n = 0; k < fin; k++, n++)
  3525. createProperty(result, n, O[k]);
  3526. result.length = n;
  3527. return result;
  3528. };
  3529. /***/ }),
  3530. /* 106 */
  3531. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3532. "use strict";
  3533. var toPropertyKey = __w_pdfjs_require__(23);
  3534. var definePropertyModule = __w_pdfjs_require__(50);
  3535. var createPropertyDescriptor = __w_pdfjs_require__(15);
  3536. module.exports = function (object, key, value) {
  3537. var propertyKey = toPropertyKey(key);
  3538. if (propertyKey in object)
  3539. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  3540. else
  3541. object[propertyKey] = value;
  3542. };
  3543. /***/ }),
  3544. /* 107 */
  3545. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3546. var fails = __w_pdfjs_require__(11);
  3547. var isObject = __w_pdfjs_require__(25);
  3548. var classof = __w_pdfjs_require__(19);
  3549. var ARRAY_BUFFER_NON_EXTENSIBLE = __w_pdfjs_require__(108);
  3550. var $isExtensible = Object.isExtensible;
  3551. var FAILS_ON_PRIMITIVES = fails(function () {
  3552. $isExtensible(1);
  3553. });
  3554. module.exports = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it) {
  3555. if (!isObject(it))
  3556. return false;
  3557. if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer')
  3558. return false;
  3559. return $isExtensible ? $isExtensible(it) : true;
  3560. } : $isExtensible;
  3561. /***/ }),
  3562. /* 108 */
  3563. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3564. var fails = __w_pdfjs_require__(11);
  3565. module.exports = fails(function () {
  3566. if (typeof ArrayBuffer == 'function') {
  3567. var buffer = new ArrayBuffer(8);
  3568. if (Object.isExtensible(buffer))
  3569. Object.defineProperty(buffer, 'a', { value: 8 });
  3570. }
  3571. });
  3572. /***/ }),
  3573. /* 109 */
  3574. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3575. var fails = __w_pdfjs_require__(11);
  3576. module.exports = !fails(function () {
  3577. return Object.isExtensible(Object.preventExtensions({}));
  3578. });
  3579. /***/ }),
  3580. /* 110 */
  3581. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3582. var bind = __w_pdfjs_require__(111);
  3583. var call = __w_pdfjs_require__(12);
  3584. var anObject = __w_pdfjs_require__(52);
  3585. var tryToString = __w_pdfjs_require__(37);
  3586. var isArrayIteratorMethod = __w_pdfjs_require__(112);
  3587. var lengthOfArrayLike = __w_pdfjs_require__(69);
  3588. var isPrototypeOf = __w_pdfjs_require__(30);
  3589. var getIterator = __w_pdfjs_require__(113);
  3590. var getIteratorMethod = __w_pdfjs_require__(114);
  3591. var iteratorClose = __w_pdfjs_require__(115);
  3592. var $TypeError = TypeError;
  3593. var Result = function (stopped, result) {
  3594. this.stopped = stopped;
  3595. this.result = result;
  3596. };
  3597. var ResultPrototype = Result.prototype;
  3598. module.exports = function (iterable, unboundFunction, options) {
  3599. var that = options && options.that;
  3600. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  3601. var IS_RECORD = !!(options && options.IS_RECORD);
  3602. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  3603. var INTERRUPTED = !!(options && options.INTERRUPTED);
  3604. var fn = bind(unboundFunction, that);
  3605. var iterator, iterFn, index, length, result, next, step;
  3606. var stop = function (condition) {
  3607. if (iterator)
  3608. iteratorClose(iterator, 'normal', condition);
  3609. return new Result(true, condition);
  3610. };
  3611. var callFn = function (value) {
  3612. if (AS_ENTRIES) {
  3613. anObject(value);
  3614. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  3615. }
  3616. return INTERRUPTED ? fn(value, stop) : fn(value);
  3617. };
  3618. if (IS_RECORD) {
  3619. iterator = iterable.iterator;
  3620. } else if (IS_ITERATOR) {
  3621. iterator = iterable;
  3622. } else {
  3623. iterFn = getIteratorMethod(iterable);
  3624. if (!iterFn)
  3625. throw $TypeError(tryToString(iterable) + ' is not iterable');
  3626. if (isArrayIteratorMethod(iterFn)) {
  3627. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  3628. result = callFn(iterable[index]);
  3629. if (result && isPrototypeOf(ResultPrototype, result))
  3630. return result;
  3631. }
  3632. return new Result(false);
  3633. }
  3634. iterator = getIterator(iterable, iterFn);
  3635. }
  3636. next = IS_RECORD ? iterable.next : iterator.next;
  3637. while (!(step = call(next, iterator)).done) {
  3638. try {
  3639. result = callFn(step.value);
  3640. } catch (error) {
  3641. iteratorClose(iterator, 'throw', error);
  3642. }
  3643. if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result))
  3644. return result;
  3645. }
  3646. return new Result(false);
  3647. };
  3648. /***/ }),
  3649. /* 111 */
  3650. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3651. var uncurryThis = __w_pdfjs_require__(18);
  3652. var aCallable = __w_pdfjs_require__(36);
  3653. var NATIVE_BIND = __w_pdfjs_require__(13);
  3654. var bind = uncurryThis(uncurryThis.bind);
  3655. module.exports = function (fn, that) {
  3656. aCallable(fn);
  3657. return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function () {
  3658. return fn.apply(that, arguments);
  3659. };
  3660. };
  3661. /***/ }),
  3662. /* 112 */
  3663. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3664. var wellKnownSymbol = __w_pdfjs_require__(39);
  3665. var Iterators = __w_pdfjs_require__(92);
  3666. var ITERATOR = wellKnownSymbol('iterator');
  3667. var ArrayPrototype = Array.prototype;
  3668. module.exports = function (it) {
  3669. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  3670. };
  3671. /***/ }),
  3672. /* 113 */
  3673. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3674. var call = __w_pdfjs_require__(12);
  3675. var aCallable = __w_pdfjs_require__(36);
  3676. var anObject = __w_pdfjs_require__(52);
  3677. var tryToString = __w_pdfjs_require__(37);
  3678. var getIteratorMethod = __w_pdfjs_require__(114);
  3679. var $TypeError = TypeError;
  3680. module.exports = function (argument, usingIterator) {
  3681. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  3682. if (aCallable(iteratorMethod))
  3683. return anObject(call(iteratorMethod, argument));
  3684. throw $TypeError(tryToString(argument) + ' is not iterable');
  3685. };
  3686. /***/ }),
  3687. /* 114 */
  3688. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3689. var classof = __w_pdfjs_require__(84);
  3690. var getMethod = __w_pdfjs_require__(35);
  3691. var isNullOrUndefined = __w_pdfjs_require__(22);
  3692. var Iterators = __w_pdfjs_require__(92);
  3693. var wellKnownSymbol = __w_pdfjs_require__(39);
  3694. var ITERATOR = wellKnownSymbol('iterator');
  3695. module.exports = function (it) {
  3696. if (!isNullOrUndefined(it))
  3697. return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)];
  3698. };
  3699. /***/ }),
  3700. /* 115 */
  3701. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3702. var call = __w_pdfjs_require__(12);
  3703. var anObject = __w_pdfjs_require__(52);
  3704. var getMethod = __w_pdfjs_require__(35);
  3705. module.exports = function (iterator, kind, value) {
  3706. var innerResult, innerError;
  3707. anObject(iterator);
  3708. try {
  3709. innerResult = getMethod(iterator, 'return');
  3710. if (!innerResult) {
  3711. if (kind === 'throw')
  3712. throw value;
  3713. return value;
  3714. }
  3715. innerResult = call(innerResult, iterator);
  3716. } catch (error) {
  3717. innerError = true;
  3718. innerResult = error;
  3719. }
  3720. if (kind === 'throw')
  3721. throw value;
  3722. if (innerError)
  3723. throw innerResult;
  3724. anObject(innerResult);
  3725. return value;
  3726. };
  3727. /***/ }),
  3728. /* 116 */
  3729. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3730. var isPrototypeOf = __w_pdfjs_require__(30);
  3731. var $TypeError = TypeError;
  3732. module.exports = function (it, Prototype) {
  3733. if (isPrototypeOf(Prototype, it))
  3734. return it;
  3735. throw $TypeError('Incorrect invocation');
  3736. };
  3737. /***/ }),
  3738. /* 117 */
  3739. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3740. var wellKnownSymbol = __w_pdfjs_require__(39);
  3741. var ITERATOR = wellKnownSymbol('iterator');
  3742. var SAFE_CLOSING = false;
  3743. try {
  3744. var called = 0;
  3745. var iteratorWithReturn = {
  3746. next: function () {
  3747. return { done: !!called++ };
  3748. },
  3749. 'return': function () {
  3750. SAFE_CLOSING = true;
  3751. }
  3752. };
  3753. iteratorWithReturn[ITERATOR] = function () {
  3754. return this;
  3755. };
  3756. Array.from(iteratorWithReturn, function () {
  3757. throw 2;
  3758. });
  3759. } catch (error) {
  3760. }
  3761. module.exports = function (exec, SKIP_CLOSING) {
  3762. if (!SKIP_CLOSING && !SAFE_CLOSING)
  3763. return false;
  3764. var ITERATION_SUPPORT = false;
  3765. try {
  3766. var object = {};
  3767. object[ITERATOR] = function () {
  3768. return {
  3769. next: function () {
  3770. return { done: ITERATION_SUPPORT = true };
  3771. }
  3772. };
  3773. };
  3774. exec(object);
  3775. } catch (error) {
  3776. }
  3777. return ITERATION_SUPPORT;
  3778. };
  3779. /***/ }),
  3780. /* 118 */
  3781. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3782. var isCallable = __w_pdfjs_require__(26);
  3783. var isObject = __w_pdfjs_require__(25);
  3784. var setPrototypeOf = __w_pdfjs_require__(88);
  3785. module.exports = function ($this, dummy, Wrapper) {
  3786. var NewTarget, NewTargetPrototype;
  3787. if (setPrototypeOf && isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype)
  3788. setPrototypeOf($this, NewTargetPrototype);
  3789. return $this;
  3790. };
  3791. /***/ }),
  3792. /* 119 */
  3793. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3794. "use strict";
  3795. var defineProperty = (__w_pdfjs_require__(50).f);
  3796. var create = __w_pdfjs_require__(75);
  3797. var defineBuiltIns = __w_pdfjs_require__(120);
  3798. var bind = __w_pdfjs_require__(111);
  3799. var anInstance = __w_pdfjs_require__(116);
  3800. var isNullOrUndefined = __w_pdfjs_require__(22);
  3801. var iterate = __w_pdfjs_require__(110);
  3802. var defineIterator = __w_pdfjs_require__(93);
  3803. var createIterResultObject = __w_pdfjs_require__(97);
  3804. var setSpecies = __w_pdfjs_require__(121);
  3805. var DESCRIPTORS = __w_pdfjs_require__(10);
  3806. var fastKey = (__w_pdfjs_require__(103).fastKey);
  3807. var InternalStateModule = __w_pdfjs_require__(57);
  3808. var setInternalState = InternalStateModule.set;
  3809. var internalStateGetterFor = InternalStateModule.getterFor;
  3810. module.exports = {
  3811. getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
  3812. var Constructor = wrapper(function (that, iterable) {
  3813. anInstance(that, Prototype);
  3814. setInternalState(that, {
  3815. type: CONSTRUCTOR_NAME,
  3816. index: create(null),
  3817. first: undefined,
  3818. last: undefined,
  3819. size: 0
  3820. });
  3821. if (!DESCRIPTORS)
  3822. that.size = 0;
  3823. if (!isNullOrUndefined(iterable))
  3824. iterate(iterable, that[ADDER], {
  3825. that: that,
  3826. AS_ENTRIES: IS_MAP
  3827. });
  3828. });
  3829. var Prototype = Constructor.prototype;
  3830. var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3831. var define = function (that, key, value) {
  3832. var state = getInternalState(that);
  3833. var entry = getEntry(that, key);
  3834. var previous, index;
  3835. if (entry) {
  3836. entry.value = value;
  3837. } else {
  3838. state.last = entry = {
  3839. index: index = fastKey(key, true),
  3840. key: key,
  3841. value: value,
  3842. previous: previous = state.last,
  3843. next: undefined,
  3844. removed: false
  3845. };
  3846. if (!state.first)
  3847. state.first = entry;
  3848. if (previous)
  3849. previous.next = entry;
  3850. if (DESCRIPTORS)
  3851. state.size++;
  3852. else
  3853. that.size++;
  3854. if (index !== 'F')
  3855. state.index[index] = entry;
  3856. }
  3857. return that;
  3858. };
  3859. var getEntry = function (that, key) {
  3860. var state = getInternalState(that);
  3861. var index = fastKey(key);
  3862. var entry;
  3863. if (index !== 'F')
  3864. return state.index[index];
  3865. for (entry = state.first; entry; entry = entry.next) {
  3866. if (entry.key == key)
  3867. return entry;
  3868. }
  3869. };
  3870. defineBuiltIns(Prototype, {
  3871. clear: function clear() {
  3872. var that = this;
  3873. var state = getInternalState(that);
  3874. var data = state.index;
  3875. var entry = state.first;
  3876. while (entry) {
  3877. entry.removed = true;
  3878. if (entry.previous)
  3879. entry.previous = entry.previous.next = undefined;
  3880. delete data[entry.index];
  3881. entry = entry.next;
  3882. }
  3883. state.first = state.last = undefined;
  3884. if (DESCRIPTORS)
  3885. state.size = 0;
  3886. else
  3887. that.size = 0;
  3888. },
  3889. 'delete': function (key) {
  3890. var that = this;
  3891. var state = getInternalState(that);
  3892. var entry = getEntry(that, key);
  3893. if (entry) {
  3894. var next = entry.next;
  3895. var prev = entry.previous;
  3896. delete state.index[entry.index];
  3897. entry.removed = true;
  3898. if (prev)
  3899. prev.next = next;
  3900. if (next)
  3901. next.previous = prev;
  3902. if (state.first == entry)
  3903. state.first = next;
  3904. if (state.last == entry)
  3905. state.last = prev;
  3906. if (DESCRIPTORS)
  3907. state.size--;
  3908. else
  3909. that.size--;
  3910. }
  3911. return !!entry;
  3912. },
  3913. forEach: function forEach(callbackfn) {
  3914. var state = getInternalState(this);
  3915. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  3916. var entry;
  3917. while (entry = entry ? entry.next : state.first) {
  3918. boundFunction(entry.value, entry.key, this);
  3919. while (entry && entry.removed)
  3920. entry = entry.previous;
  3921. }
  3922. },
  3923. has: function has(key) {
  3924. return !!getEntry(this, key);
  3925. }
  3926. });
  3927. defineBuiltIns(Prototype, IS_MAP ? {
  3928. get: function get(key) {
  3929. var entry = getEntry(this, key);
  3930. return entry && entry.value;
  3931. },
  3932. set: function set(key, value) {
  3933. return define(this, key === 0 ? 0 : key, value);
  3934. }
  3935. } : {
  3936. add: function add(value) {
  3937. return define(this, value = value === 0 ? 0 : value, value);
  3938. }
  3939. });
  3940. if (DESCRIPTORS)
  3941. defineProperty(Prototype, 'size', {
  3942. get: function () {
  3943. return getInternalState(this).size;
  3944. }
  3945. });
  3946. return Constructor;
  3947. },
  3948. setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
  3949. var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
  3950. var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
  3951. var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
  3952. defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
  3953. setInternalState(this, {
  3954. type: ITERATOR_NAME,
  3955. target: iterated,
  3956. state: getInternalCollectionState(iterated),
  3957. kind: kind,
  3958. last: undefined
  3959. });
  3960. }, function () {
  3961. var state = getInternalIteratorState(this);
  3962. var kind = state.kind;
  3963. var entry = state.last;
  3964. while (entry && entry.removed)
  3965. entry = entry.previous;
  3966. if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
  3967. state.target = undefined;
  3968. return createIterResultObject(undefined, true);
  3969. }
  3970. if (kind == 'keys')
  3971. return createIterResultObject(entry.key, false);
  3972. if (kind == 'values')
  3973. return createIterResultObject(entry.value, false);
  3974. return createIterResultObject([
  3975. entry.key,
  3976. entry.value
  3977. ], false);
  3978. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  3979. setSpecies(CONSTRUCTOR_NAME);
  3980. }
  3981. };
  3982. /***/ }),
  3983. /* 120 */
  3984. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3985. var defineBuiltIn = __w_pdfjs_require__(53);
  3986. module.exports = function (target, src, options) {
  3987. for (var key in src)
  3988. defineBuiltIn(target, key, src[key], options);
  3989. return target;
  3990. };
  3991. /***/ }),
  3992. /* 121 */
  3993. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  3994. "use strict";
  3995. var getBuiltIn = __w_pdfjs_require__(29);
  3996. var definePropertyModule = __w_pdfjs_require__(50);
  3997. var wellKnownSymbol = __w_pdfjs_require__(39);
  3998. var DESCRIPTORS = __w_pdfjs_require__(10);
  3999. var SPECIES = wellKnownSymbol('species');
  4000. module.exports = function (CONSTRUCTOR_NAME) {
  4001. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  4002. var defineProperty = definePropertyModule.f;
  4003. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  4004. defineProperty(Constructor, SPECIES, {
  4005. configurable: true,
  4006. get: function () {
  4007. return this;
  4008. }
  4009. });
  4010. }
  4011. };
  4012. /***/ }),
  4013. /* 122 */
  4014. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4015. __w_pdfjs_require__(123);
  4016. /***/ }),
  4017. /* 123 */
  4018. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4019. "use strict";
  4020. var collection = __w_pdfjs_require__(102);
  4021. var collectionStrong = __w_pdfjs_require__(119);
  4022. collection('Set', function (init) {
  4023. return function Set() {
  4024. return init(this, arguments.length ? arguments[0] : undefined);
  4025. };
  4026. }, collectionStrong);
  4027. /***/ }),
  4028. /* 124 */
  4029. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4030. var IS_PURE = __w_pdfjs_require__(41);
  4031. var $ = __w_pdfjs_require__(7);
  4032. var global = __w_pdfjs_require__(8);
  4033. var getBuiltin = __w_pdfjs_require__(29);
  4034. var uncurryThis = __w_pdfjs_require__(18);
  4035. var fails = __w_pdfjs_require__(11);
  4036. var uid = __w_pdfjs_require__(46);
  4037. var isCallable = __w_pdfjs_require__(26);
  4038. var isConstructor = __w_pdfjs_require__(125);
  4039. var isNullOrUndefined = __w_pdfjs_require__(22);
  4040. var isObject = __w_pdfjs_require__(25);
  4041. var isSymbol = __w_pdfjs_require__(28);
  4042. var iterate = __w_pdfjs_require__(110);
  4043. var anObject = __w_pdfjs_require__(52);
  4044. var classof = __w_pdfjs_require__(84);
  4045. var hasOwn = __w_pdfjs_require__(44);
  4046. var createProperty = __w_pdfjs_require__(106);
  4047. var createNonEnumerableProperty = __w_pdfjs_require__(49);
  4048. var lengthOfArrayLike = __w_pdfjs_require__(69);
  4049. var validateArgumentsLength = __w_pdfjs_require__(126);
  4050. var getRegExpFlags = __w_pdfjs_require__(127);
  4051. var ERROR_STACK_INSTALLABLE = __w_pdfjs_require__(129);
  4052. var V8 = __w_pdfjs_require__(33);
  4053. var IS_BROWSER = __w_pdfjs_require__(130);
  4054. var IS_DENO = __w_pdfjs_require__(131);
  4055. var IS_NODE = __w_pdfjs_require__(132);
  4056. var Object = global.Object;
  4057. var Date = global.Date;
  4058. var Error = global.Error;
  4059. var EvalError = global.EvalError;
  4060. var RangeError = global.RangeError;
  4061. var ReferenceError = global.ReferenceError;
  4062. var SyntaxError = global.SyntaxError;
  4063. var TypeError = global.TypeError;
  4064. var URIError = global.URIError;
  4065. var PerformanceMark = global.PerformanceMark;
  4066. var WebAssembly = global.WebAssembly;
  4067. var CompileError = WebAssembly && WebAssembly.CompileError || Error;
  4068. var LinkError = WebAssembly && WebAssembly.LinkError || Error;
  4069. var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error;
  4070. var DOMException = getBuiltin('DOMException');
  4071. var Set = getBuiltin('Set');
  4072. var Map = getBuiltin('Map');
  4073. var MapPrototype = Map.prototype;
  4074. var mapHas = uncurryThis(MapPrototype.has);
  4075. var mapGet = uncurryThis(MapPrototype.get);
  4076. var mapSet = uncurryThis(MapPrototype.set);
  4077. var setAdd = uncurryThis(Set.prototype.add);
  4078. var objectKeys = getBuiltin('Object', 'keys');
  4079. var push = uncurryThis([].push);
  4080. var thisBooleanValue = uncurryThis(true.valueOf);
  4081. var thisNumberValue = uncurryThis(1.0.valueOf);
  4082. var thisStringValue = uncurryThis(''.valueOf);
  4083. var thisTimeValue = uncurryThis(Date.prototype.getTime);
  4084. var PERFORMANCE_MARK = uid('structuredClone');
  4085. var DATA_CLONE_ERROR = 'DataCloneError';
  4086. var TRANSFERRING = 'Transferring';
  4087. var checkBasicSemantic = function (structuredCloneImplementation) {
  4088. return !fails(function () {
  4089. var set1 = new global.Set([7]);
  4090. var set2 = structuredCloneImplementation(set1);
  4091. var number = structuredCloneImplementation(Object(7));
  4092. return set2 == set1 || !set2.has(7) || typeof number != 'object' || number != 7;
  4093. }) && structuredCloneImplementation;
  4094. };
  4095. var checkErrorsCloning = function (structuredCloneImplementation, $Error) {
  4096. return !fails(function () {
  4097. var error = new $Error();
  4098. var test = structuredCloneImplementation({
  4099. a: error,
  4100. b: error
  4101. });
  4102. return !(test && test.a === test.b && test.a instanceof $Error && test.a.stack === error.stack);
  4103. });
  4104. };
  4105. var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
  4106. return !fails(function () {
  4107. var test = structuredCloneImplementation(new global.AggregateError([1], PERFORMANCE_MARK, { cause: 3 }));
  4108. return test.name != 'AggregateError' || test.errors[0] != 1 || test.message != PERFORMANCE_MARK || test.cause != 3;
  4109. });
  4110. };
  4111. var nativeStructuredClone = global.structuredClone;
  4112. var FORCED_REPLACEMENT = IS_PURE || !checkErrorsCloning(nativeStructuredClone, Error) || !checkErrorsCloning(nativeStructuredClone, DOMException) || !checkNewErrorsCloningSemantic(nativeStructuredClone);
  4113. var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
  4114. return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
  4115. });
  4116. var nativeRestrictedStructuredClone = checkBasicSemantic(nativeStructuredClone) || structuredCloneFromMark;
  4117. var throwUncloneable = function (type) {
  4118. throw new DOMException('Uncloneable type: ' + type, DATA_CLONE_ERROR);
  4119. };
  4120. var throwUnpolyfillable = function (type, action) {
  4121. throw new DOMException((action || 'Cloning') + ' of ' + type + ' cannot be properly polyfilled in this engine', DATA_CLONE_ERROR);
  4122. };
  4123. var createDataTransfer = function () {
  4124. var dataTransfer;
  4125. try {
  4126. dataTransfer = new global.DataTransfer();
  4127. } catch (error) {
  4128. try {
  4129. dataTransfer = new global.ClipboardEvent('').clipboardData;
  4130. } catch (error2) {
  4131. }
  4132. }
  4133. return dataTransfer && dataTransfer.items && dataTransfer.files ? dataTransfer : null;
  4134. };
  4135. var structuredCloneInternal = function (value, map) {
  4136. if (isSymbol(value))
  4137. throwUncloneable('Symbol');
  4138. if (!isObject(value))
  4139. return value;
  4140. if (map) {
  4141. if (mapHas(map, value))
  4142. return mapGet(map, value);
  4143. } else
  4144. map = new Map();
  4145. var type = classof(value);
  4146. var deep = false;
  4147. var C, name, cloned, dataTransfer, i, length, keys, key, source, target;
  4148. switch (type) {
  4149. case 'Array':
  4150. cloned = [];
  4151. deep = true;
  4152. break;
  4153. case 'Object':
  4154. cloned = {};
  4155. deep = true;
  4156. break;
  4157. case 'Map':
  4158. cloned = new Map();
  4159. deep = true;
  4160. break;
  4161. case 'Set':
  4162. cloned = new Set();
  4163. deep = true;
  4164. break;
  4165. case 'RegExp':
  4166. cloned = new RegExp(value.source, getRegExpFlags(value));
  4167. break;
  4168. case 'Error':
  4169. name = value.name;
  4170. switch (name) {
  4171. case 'AggregateError':
  4172. cloned = getBuiltin('AggregateError')([]);
  4173. break;
  4174. case 'EvalError':
  4175. cloned = EvalError();
  4176. break;
  4177. case 'RangeError':
  4178. cloned = RangeError();
  4179. break;
  4180. case 'ReferenceError':
  4181. cloned = ReferenceError();
  4182. break;
  4183. case 'SyntaxError':
  4184. cloned = SyntaxError();
  4185. break;
  4186. case 'TypeError':
  4187. cloned = TypeError();
  4188. break;
  4189. case 'URIError':
  4190. cloned = URIError();
  4191. break;
  4192. case 'CompileError':
  4193. cloned = CompileError();
  4194. break;
  4195. case 'LinkError':
  4196. cloned = LinkError();
  4197. break;
  4198. case 'RuntimeError':
  4199. cloned = RuntimeError();
  4200. break;
  4201. default:
  4202. cloned = Error();
  4203. }
  4204. deep = true;
  4205. break;
  4206. case 'DOMException':
  4207. cloned = new DOMException(value.message, value.name);
  4208. deep = true;
  4209. break;
  4210. case 'DataView':
  4211. case 'Int8Array':
  4212. case 'Uint8Array':
  4213. case 'Uint8ClampedArray':
  4214. case 'Int16Array':
  4215. case 'Uint16Array':
  4216. case 'Int32Array':
  4217. case 'Uint32Array':
  4218. case 'Float32Array':
  4219. case 'Float64Array':
  4220. case 'BigInt64Array':
  4221. case 'BigUint64Array':
  4222. C = global[type];
  4223. if (!isObject(C))
  4224. throwUnpolyfillable(type);
  4225. cloned = new C(structuredCloneInternal(value.buffer, map), value.byteOffset, type === 'DataView' ? value.byteLength : value.length);
  4226. break;
  4227. case 'DOMQuad':
  4228. try {
  4229. cloned = new DOMQuad(structuredCloneInternal(value.p1, map), structuredCloneInternal(value.p2, map), structuredCloneInternal(value.p3, map), structuredCloneInternal(value.p4, map));
  4230. } catch (error) {
  4231. if (nativeRestrictedStructuredClone) {
  4232. cloned = nativeRestrictedStructuredClone(value);
  4233. } else
  4234. throwUnpolyfillable(type);
  4235. }
  4236. break;
  4237. case 'FileList':
  4238. dataTransfer = createDataTransfer();
  4239. if (dataTransfer) {
  4240. for (i = 0, length = lengthOfArrayLike(value); i < length; i++) {
  4241. dataTransfer.items.add(structuredCloneInternal(value[i], map));
  4242. }
  4243. cloned = dataTransfer.files;
  4244. } else if (nativeRestrictedStructuredClone) {
  4245. cloned = nativeRestrictedStructuredClone(value);
  4246. } else
  4247. throwUnpolyfillable(type);
  4248. break;
  4249. case 'ImageData':
  4250. try {
  4251. cloned = new ImageData(structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace });
  4252. } catch (error) {
  4253. if (nativeRestrictedStructuredClone) {
  4254. cloned = nativeRestrictedStructuredClone(value);
  4255. } else
  4256. throwUnpolyfillable(type);
  4257. }
  4258. break;
  4259. default:
  4260. if (nativeRestrictedStructuredClone) {
  4261. cloned = nativeRestrictedStructuredClone(value);
  4262. } else
  4263. switch (type) {
  4264. case 'BigInt':
  4265. cloned = Object(value.valueOf());
  4266. break;
  4267. case 'Boolean':
  4268. cloned = Object(thisBooleanValue(value));
  4269. break;
  4270. case 'Number':
  4271. cloned = Object(thisNumberValue(value));
  4272. break;
  4273. case 'String':
  4274. cloned = Object(thisStringValue(value));
  4275. break;
  4276. case 'Date':
  4277. cloned = new Date(thisTimeValue(value));
  4278. break;
  4279. case 'ArrayBuffer':
  4280. C = global.DataView;
  4281. if (!C && typeof value.slice != 'function')
  4282. throwUnpolyfillable(type);
  4283. try {
  4284. if (typeof value.slice == 'function') {
  4285. cloned = value.slice(0);
  4286. } else {
  4287. length = value.byteLength;
  4288. cloned = new ArrayBuffer(length);
  4289. source = new C(value);
  4290. target = new C(cloned);
  4291. for (i = 0; i < length; i++) {
  4292. target.setUint8(i, source.getUint8(i));
  4293. }
  4294. }
  4295. } catch (error) {
  4296. throw new DOMException('ArrayBuffer is detached', DATA_CLONE_ERROR);
  4297. }
  4298. break;
  4299. case 'SharedArrayBuffer':
  4300. cloned = value;
  4301. break;
  4302. case 'Blob':
  4303. try {
  4304. cloned = value.slice(0, value.size, value.type);
  4305. } catch (error) {
  4306. throwUnpolyfillable(type);
  4307. }
  4308. break;
  4309. case 'DOMPoint':
  4310. case 'DOMPointReadOnly':
  4311. C = global[type];
  4312. try {
  4313. cloned = C.fromPoint ? C.fromPoint(value) : new C(value.x, value.y, value.z, value.w);
  4314. } catch (error) {
  4315. throwUnpolyfillable(type);
  4316. }
  4317. break;
  4318. case 'DOMRect':
  4319. case 'DOMRectReadOnly':
  4320. C = global[type];
  4321. try {
  4322. cloned = C.fromRect ? C.fromRect(value) : new C(value.x, value.y, value.width, value.height);
  4323. } catch (error) {
  4324. throwUnpolyfillable(type);
  4325. }
  4326. break;
  4327. case 'DOMMatrix':
  4328. case 'DOMMatrixReadOnly':
  4329. C = global[type];
  4330. try {
  4331. cloned = C.fromMatrix ? C.fromMatrix(value) : new C(value);
  4332. } catch (error) {
  4333. throwUnpolyfillable(type);
  4334. }
  4335. break;
  4336. case 'AudioData':
  4337. case 'VideoFrame':
  4338. if (!isCallable(value.clone))
  4339. throwUnpolyfillable(type);
  4340. try {
  4341. cloned = value.clone();
  4342. } catch (error) {
  4343. throwUncloneable(type);
  4344. }
  4345. break;
  4346. case 'File':
  4347. try {
  4348. cloned = new File([value], value.name, value);
  4349. } catch (error) {
  4350. throwUnpolyfillable(type);
  4351. }
  4352. break;
  4353. case 'CropTarget':
  4354. case 'CryptoKey':
  4355. case 'FileSystemDirectoryHandle':
  4356. case 'FileSystemFileHandle':
  4357. case 'FileSystemHandle':
  4358. case 'GPUCompilationInfo':
  4359. case 'GPUCompilationMessage':
  4360. case 'ImageBitmap':
  4361. case 'RTCCertificate':
  4362. case 'WebAssembly.Module':
  4363. throwUnpolyfillable(type);
  4364. default:
  4365. throwUncloneable(type);
  4366. }
  4367. }
  4368. mapSet(map, value, cloned);
  4369. if (deep)
  4370. switch (type) {
  4371. case 'Array':
  4372. case 'Object':
  4373. keys = objectKeys(value);
  4374. for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) {
  4375. key = keys[i];
  4376. createProperty(cloned, key, structuredCloneInternal(value[key], map));
  4377. }
  4378. break;
  4379. case 'Map':
  4380. value.forEach(function (v, k) {
  4381. mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map));
  4382. });
  4383. break;
  4384. case 'Set':
  4385. value.forEach(function (v) {
  4386. setAdd(cloned, structuredCloneInternal(v, map));
  4387. });
  4388. break;
  4389. case 'Error':
  4390. createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map));
  4391. if (hasOwn(value, 'cause')) {
  4392. createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map));
  4393. }
  4394. if (name == 'AggregateError') {
  4395. cloned.errors = structuredCloneInternal(value.errors, map);
  4396. }
  4397. case 'DOMException':
  4398. if (ERROR_STACK_INSTALLABLE) {
  4399. createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map));
  4400. }
  4401. }
  4402. return cloned;
  4403. };
  4404. var PROPER_TRANSFER = nativeStructuredClone && !fails(function () {
  4405. if (IS_DENO && V8 > 92 || IS_NODE && V8 > 94 || IS_BROWSER && V8 > 97)
  4406. return false;
  4407. var buffer = new ArrayBuffer(8);
  4408. var clone = nativeStructuredClone(buffer, { transfer: [buffer] });
  4409. return buffer.byteLength != 0 || clone.byteLength != 8;
  4410. });
  4411. var tryToTransfer = function (rawTransfer, map) {
  4412. if (!isObject(rawTransfer))
  4413. throw TypeError('Transfer option cannot be converted to a sequence');
  4414. var transfer = [];
  4415. iterate(rawTransfer, function (value) {
  4416. push(transfer, anObject(value));
  4417. });
  4418. var i = 0;
  4419. var length = lengthOfArrayLike(transfer);
  4420. var value, type, C, transferredArray, transferred, canvas, context;
  4421. if (PROPER_TRANSFER) {
  4422. transferredArray = nativeStructuredClone(transfer, { transfer: transfer });
  4423. while (i < length)
  4424. mapSet(map, transfer[i], transferredArray[i++]);
  4425. } else
  4426. while (i < length) {
  4427. value = transfer[i++];
  4428. if (mapHas(map, value))
  4429. throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR);
  4430. type = classof(value);
  4431. switch (type) {
  4432. case 'ImageBitmap':
  4433. C = global.OffscreenCanvas;
  4434. if (!isConstructor(C))
  4435. throwUnpolyfillable(type, TRANSFERRING);
  4436. try {
  4437. canvas = new C(value.width, value.height);
  4438. context = canvas.getContext('bitmaprenderer');
  4439. context.transferFromImageBitmap(value);
  4440. transferred = canvas.transferToImageBitmap();
  4441. } catch (error) {
  4442. }
  4443. break;
  4444. case 'AudioData':
  4445. case 'VideoFrame':
  4446. if (!isCallable(value.clone) || !isCallable(value.close))
  4447. throwUnpolyfillable(type, TRANSFERRING);
  4448. try {
  4449. transferred = value.clone();
  4450. value.close();
  4451. } catch (error) {
  4452. }
  4453. break;
  4454. case 'ArrayBuffer':
  4455. case 'MediaSourceHandle':
  4456. case 'MessagePort':
  4457. case 'OffscreenCanvas':
  4458. case 'ReadableStream':
  4459. case 'TransformStream':
  4460. case 'WritableStream':
  4461. throwUnpolyfillable(type, TRANSFERRING);
  4462. }
  4463. if (transferred === undefined)
  4464. throw new DOMException('This object cannot be transferred: ' + type, DATA_CLONE_ERROR);
  4465. mapSet(map, value, transferred);
  4466. }
  4467. };
  4468. $({
  4469. global: true,
  4470. enumerable: true,
  4471. sham: !PROPER_TRANSFER,
  4472. forced: FORCED_REPLACEMENT
  4473. }, {
  4474. structuredClone: function structuredClone(value) {
  4475. var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined;
  4476. var transfer = options ? options.transfer : undefined;
  4477. var map;
  4478. if (transfer !== undefined) {
  4479. map = new Map();
  4480. tryToTransfer(transfer, map);
  4481. }
  4482. return structuredCloneInternal(value, map);
  4483. }
  4484. });
  4485. /***/ }),
  4486. /* 125 */
  4487. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4488. var uncurryThis = __w_pdfjs_require__(18);
  4489. var fails = __w_pdfjs_require__(11);
  4490. var isCallable = __w_pdfjs_require__(26);
  4491. var classof = __w_pdfjs_require__(84);
  4492. var getBuiltIn = __w_pdfjs_require__(29);
  4493. var inspectSource = __w_pdfjs_require__(56);
  4494. var noop = function () {
  4495. };
  4496. var empty = [];
  4497. var construct = getBuiltIn('Reflect', 'construct');
  4498. var constructorRegExp = /^\s*(?:class|function)\b/;
  4499. var exec = uncurryThis(constructorRegExp.exec);
  4500. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  4501. var isConstructorModern = function isConstructor(argument) {
  4502. if (!isCallable(argument))
  4503. return false;
  4504. try {
  4505. construct(noop, empty, argument);
  4506. return true;
  4507. } catch (error) {
  4508. return false;
  4509. }
  4510. };
  4511. var isConstructorLegacy = function isConstructor(argument) {
  4512. if (!isCallable(argument))
  4513. return false;
  4514. switch (classof(argument)) {
  4515. case 'AsyncFunction':
  4516. case 'GeneratorFunction':
  4517. case 'AsyncGeneratorFunction':
  4518. return false;
  4519. }
  4520. try {
  4521. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  4522. } catch (error) {
  4523. return true;
  4524. }
  4525. };
  4526. isConstructorLegacy.sham = true;
  4527. module.exports = !construct || fails(function () {
  4528. var called;
  4529. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () {
  4530. called = true;
  4531. }) || called;
  4532. }) ? isConstructorLegacy : isConstructorModern;
  4533. /***/ }),
  4534. /* 126 */
  4535. /***/ ((module) => {
  4536. var $TypeError = TypeError;
  4537. module.exports = function (passed, required) {
  4538. if (passed < required)
  4539. throw $TypeError('Not enough arguments');
  4540. return passed;
  4541. };
  4542. /***/ }),
  4543. /* 127 */
  4544. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4545. var call = __w_pdfjs_require__(12);
  4546. var hasOwn = __w_pdfjs_require__(44);
  4547. var isPrototypeOf = __w_pdfjs_require__(30);
  4548. var regExpFlags = __w_pdfjs_require__(128);
  4549. var RegExpPrototype = RegExp.prototype;
  4550. module.exports = function (R) {
  4551. var flags = R.flags;
  4552. return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R) ? call(regExpFlags, R) : flags;
  4553. };
  4554. /***/ }),
  4555. /* 128 */
  4556. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4557. "use strict";
  4558. var anObject = __w_pdfjs_require__(52);
  4559. module.exports = function () {
  4560. var that = anObject(this);
  4561. var result = '';
  4562. if (that.hasIndices)
  4563. result += 'd';
  4564. if (that.global)
  4565. result += 'g';
  4566. if (that.ignoreCase)
  4567. result += 'i';
  4568. if (that.multiline)
  4569. result += 'm';
  4570. if (that.dotAll)
  4571. result += 's';
  4572. if (that.unicode)
  4573. result += 'u';
  4574. if (that.unicodeSets)
  4575. result += 'v';
  4576. if (that.sticky)
  4577. result += 'y';
  4578. return result;
  4579. };
  4580. /***/ }),
  4581. /* 129 */
  4582. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4583. var fails = __w_pdfjs_require__(11);
  4584. var createPropertyDescriptor = __w_pdfjs_require__(15);
  4585. module.exports = !fails(function () {
  4586. var error = Error('a');
  4587. if (!('stack' in error))
  4588. return true;
  4589. Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
  4590. return error.stack !== 7;
  4591. });
  4592. /***/ }),
  4593. /* 130 */
  4594. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4595. var IS_DENO = __w_pdfjs_require__(131);
  4596. var IS_NODE = __w_pdfjs_require__(132);
  4597. module.exports = !IS_DENO && !IS_NODE && typeof window == 'object' && typeof document == 'object';
  4598. /***/ }),
  4599. /* 131 */
  4600. /***/ ((module) => {
  4601. module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
  4602. /***/ }),
  4603. /* 132 */
  4604. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4605. var classof = __w_pdfjs_require__(19);
  4606. var global = __w_pdfjs_require__(8);
  4607. module.exports = classof(global.process) == 'process';
  4608. /***/ }),
  4609. /* 133 */
  4610. /***/ ((module, __unused_webpack_exports, __w_pdfjs_require__) => {
  4611. var global = __w_pdfjs_require__(8);
  4612. module.exports = global;
  4613. /***/ }),
  4614. /* 134 */
  4615. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4616. "use strict";
  4617. Object.defineProperty(exports, "__esModule", ({
  4618. value: true
  4619. }));
  4620. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  4621. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  4622. exports.isCmd = isCmd;
  4623. exports.isDict = isDict;
  4624. exports.isName = isName;
  4625. exports.isRefsEqual = isRefsEqual;
  4626. var _util = __w_pdfjs_require__(2);
  4627. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  4628. exports.CIRCULAR_REF = CIRCULAR_REF;
  4629. const EOF = Symbol("EOF");
  4630. exports.EOF = EOF;
  4631. const Name = function NameClosure() {
  4632. let nameCache = Object.create(null);
  4633. class Name {
  4634. constructor(name) {
  4635. this.name = name;
  4636. }
  4637. static get(name) {
  4638. return nameCache[name] || (nameCache[name] = new Name(name));
  4639. }
  4640. static _clearCache() {
  4641. nameCache = Object.create(null);
  4642. }
  4643. }
  4644. return Name;
  4645. }();
  4646. exports.Name = Name;
  4647. const Cmd = function CmdClosure() {
  4648. let cmdCache = Object.create(null);
  4649. class Cmd {
  4650. constructor(cmd) {
  4651. this.cmd = cmd;
  4652. }
  4653. static get(cmd) {
  4654. return cmdCache[cmd] || (cmdCache[cmd] = new Cmd(cmd));
  4655. }
  4656. static _clearCache() {
  4657. cmdCache = Object.create(null);
  4658. }
  4659. }
  4660. return Cmd;
  4661. }();
  4662. exports.Cmd = Cmd;
  4663. const nonSerializable = function nonSerializableClosure() {
  4664. return nonSerializable;
  4665. };
  4666. class Dict {
  4667. constructor() {
  4668. let xref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4669. this._map = Object.create(null);
  4670. this.xref = xref;
  4671. this.objId = null;
  4672. this.suppressEncryption = false;
  4673. this.__nonSerializable__ = nonSerializable;
  4674. }
  4675. assignXref(newXref) {
  4676. this.xref = newXref;
  4677. }
  4678. get size() {
  4679. return Object.keys(this._map).length;
  4680. }
  4681. get(key1, key2, key3) {
  4682. let value = this._map[key1];
  4683. if (value === undefined && key2 !== undefined) {
  4684. value = this._map[key2];
  4685. if (value === undefined && key3 !== undefined) {
  4686. value = this._map[key3];
  4687. }
  4688. }
  4689. if (value instanceof Ref && this.xref) {
  4690. return this.xref.fetch(value, this.suppressEncryption);
  4691. }
  4692. return value;
  4693. }
  4694. async getAsync(key1, key2, key3) {
  4695. let value = this._map[key1];
  4696. if (value === undefined && key2 !== undefined) {
  4697. value = this._map[key2];
  4698. if (value === undefined && key3 !== undefined) {
  4699. value = this._map[key3];
  4700. }
  4701. }
  4702. if (value instanceof Ref && this.xref) {
  4703. return this.xref.fetchAsync(value, this.suppressEncryption);
  4704. }
  4705. return value;
  4706. }
  4707. getArray(key1, key2, key3) {
  4708. let value = this._map[key1];
  4709. if (value === undefined && key2 !== undefined) {
  4710. value = this._map[key2];
  4711. if (value === undefined && key3 !== undefined) {
  4712. value = this._map[key3];
  4713. }
  4714. }
  4715. if (value instanceof Ref && this.xref) {
  4716. value = this.xref.fetch(value, this.suppressEncryption);
  4717. }
  4718. if (Array.isArray(value)) {
  4719. value = value.slice();
  4720. for (let i = 0, ii = value.length; i < ii; i++) {
  4721. if (value[i] instanceof Ref && this.xref) {
  4722. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  4723. }
  4724. }
  4725. }
  4726. return value;
  4727. }
  4728. getRaw(key) {
  4729. return this._map[key];
  4730. }
  4731. getKeys() {
  4732. return Object.keys(this._map);
  4733. }
  4734. getRawValues() {
  4735. return Object.values(this._map);
  4736. }
  4737. set(key, value) {
  4738. this._map[key] = value;
  4739. }
  4740. has(key) {
  4741. return this._map[key] !== undefined;
  4742. }
  4743. forEach(callback) {
  4744. for (const key in this._map) {
  4745. callback(key, this.get(key));
  4746. }
  4747. }
  4748. static get empty() {
  4749. const emptyDict = new Dict(null);
  4750. emptyDict.set = (key, value) => {
  4751. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  4752. };
  4753. return (0, _util.shadow)(this, "empty", emptyDict);
  4754. }
  4755. static merge(_ref) {
  4756. let {
  4757. xref,
  4758. dictArray,
  4759. mergeSubDicts = false
  4760. } = _ref;
  4761. const mergedDict = new Dict(xref),
  4762. properties = new Map();
  4763. for (const dict of dictArray) {
  4764. if (!(dict instanceof Dict)) {
  4765. continue;
  4766. }
  4767. for (const [key, value] of Object.entries(dict._map)) {
  4768. let property = properties.get(key);
  4769. if (property === undefined) {
  4770. property = [];
  4771. properties.set(key, property);
  4772. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  4773. continue;
  4774. }
  4775. property.push(value);
  4776. }
  4777. }
  4778. for (const [name, values] of properties) {
  4779. if (values.length === 1 || !(values[0] instanceof Dict)) {
  4780. mergedDict._map[name] = values[0];
  4781. continue;
  4782. }
  4783. const subDict = new Dict(xref);
  4784. for (const dict of values) {
  4785. for (const [key, value] of Object.entries(dict._map)) {
  4786. if (subDict._map[key] === undefined) {
  4787. subDict._map[key] = value;
  4788. }
  4789. }
  4790. }
  4791. if (subDict.size > 0) {
  4792. mergedDict._map[name] = subDict;
  4793. }
  4794. }
  4795. properties.clear();
  4796. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  4797. }
  4798. }
  4799. exports.Dict = Dict;
  4800. const Ref = function RefClosure() {
  4801. let refCache = Object.create(null);
  4802. class Ref {
  4803. constructor(num, gen) {
  4804. this.num = num;
  4805. this.gen = gen;
  4806. }
  4807. toString() {
  4808. if (this.gen === 0) {
  4809. return `${this.num}R`;
  4810. }
  4811. return `${this.num}R${this.gen}`;
  4812. }
  4813. static get(num, gen) {
  4814. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  4815. return refCache[key] || (refCache[key] = new Ref(num, gen));
  4816. }
  4817. static _clearCache() {
  4818. refCache = Object.create(null);
  4819. }
  4820. }
  4821. return Ref;
  4822. }();
  4823. exports.Ref = Ref;
  4824. class RefSet {
  4825. constructor() {
  4826. let parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  4827. this._set = new Set(parent && parent._set);
  4828. }
  4829. has(ref) {
  4830. return this._set.has(ref.toString());
  4831. }
  4832. put(ref) {
  4833. this._set.add(ref.toString());
  4834. }
  4835. remove(ref) {
  4836. this._set.delete(ref.toString());
  4837. }
  4838. [Symbol.iterator]() {
  4839. return this._set.values();
  4840. }
  4841. clear() {
  4842. this._set.clear();
  4843. }
  4844. }
  4845. exports.RefSet = RefSet;
  4846. class RefSetCache {
  4847. constructor() {
  4848. this._map = new Map();
  4849. }
  4850. get size() {
  4851. return this._map.size;
  4852. }
  4853. get(ref) {
  4854. return this._map.get(ref.toString());
  4855. }
  4856. has(ref) {
  4857. return this._map.has(ref.toString());
  4858. }
  4859. put(ref, obj) {
  4860. this._map.set(ref.toString(), obj);
  4861. }
  4862. putAlias(ref, aliasRef) {
  4863. this._map.set(ref.toString(), this.get(aliasRef));
  4864. }
  4865. [Symbol.iterator]() {
  4866. return this._map.values();
  4867. }
  4868. clear() {
  4869. this._map.clear();
  4870. }
  4871. }
  4872. exports.RefSetCache = RefSetCache;
  4873. function isName(v, name) {
  4874. return v instanceof Name && (name === undefined || v.name === name);
  4875. }
  4876. function isCmd(v, cmd) {
  4877. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  4878. }
  4879. function isDict(v, type) {
  4880. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  4881. }
  4882. function isRefsEqual(v1, v2) {
  4883. return v1.num === v2.num && v1.gen === v2.gen;
  4884. }
  4885. function clearPrimitiveCaches() {
  4886. Cmd._clearCache();
  4887. Name._clearCache();
  4888. Ref._clearCache();
  4889. }
  4890. /***/ }),
  4891. /* 135 */
  4892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4893. "use strict";
  4894. Object.defineProperty(exports, "__esModule", ({
  4895. value: true
  4896. }));
  4897. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = exports.DocStats = void 0;
  4898. exports.collectActions = collectActions;
  4899. exports.encodeToXmlString = encodeToXmlString;
  4900. exports.escapePDFName = escapePDFName;
  4901. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  4902. exports.getInheritableProperty = getInheritableProperty;
  4903. exports.getLookupTableFactory = getLookupTableFactory;
  4904. exports.getNewAnnotationsMap = getNewAnnotationsMap;
  4905. exports.isWhiteSpace = isWhiteSpace;
  4906. exports.log2 = log2;
  4907. exports.numberToString = numberToString;
  4908. exports.parseXFAPath = parseXFAPath;
  4909. exports.readInt8 = readInt8;
  4910. exports.readUint16 = readUint16;
  4911. exports.readUint32 = readUint32;
  4912. exports.recoverJsURL = recoverJsURL;
  4913. exports.toRomanNumerals = toRomanNumerals;
  4914. exports.validateCSSFont = validateCSSFont;
  4915. var _util = __w_pdfjs_require__(2);
  4916. var _primitives = __w_pdfjs_require__(134);
  4917. var _base_stream = __w_pdfjs_require__(136);
  4918. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  4919. exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
  4920. function getLookupTableFactory(initializer) {
  4921. let lookup;
  4922. return function () {
  4923. if (initializer) {
  4924. lookup = Object.create(null);
  4925. initializer(lookup);
  4926. initializer = null;
  4927. }
  4928. return lookup;
  4929. };
  4930. }
  4931. function getArrayLookupTableFactory(initializer) {
  4932. let lookup;
  4933. return function () {
  4934. if (initializer) {
  4935. let arr = initializer();
  4936. initializer = null;
  4937. lookup = Object.create(null);
  4938. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  4939. lookup[arr[i]] = arr[i + 1];
  4940. }
  4941. arr = null;
  4942. }
  4943. return lookup;
  4944. };
  4945. }
  4946. class MissingDataException extends _util.BaseException {
  4947. constructor(begin, end) {
  4948. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  4949. this.begin = begin;
  4950. this.end = end;
  4951. }
  4952. }
  4953. exports.MissingDataException = MissingDataException;
  4954. class ParserEOFException extends _util.BaseException {
  4955. constructor(msg) {
  4956. super(msg, "ParserEOFException");
  4957. }
  4958. }
  4959. exports.ParserEOFException = ParserEOFException;
  4960. class XRefEntryException extends _util.BaseException {
  4961. constructor(msg) {
  4962. super(msg, "XRefEntryException");
  4963. }
  4964. }
  4965. exports.XRefEntryException = XRefEntryException;
  4966. class XRefParseException extends _util.BaseException {
  4967. constructor(msg) {
  4968. super(msg, "XRefParseException");
  4969. }
  4970. }
  4971. exports.XRefParseException = XRefParseException;
  4972. class DocStats {
  4973. constructor(handler) {
  4974. this._handler = handler;
  4975. this._streamTypes = new Set();
  4976. this._fontTypes = new Set();
  4977. }
  4978. _send() {
  4979. const streamTypes = Object.create(null),
  4980. fontTypes = Object.create(null);
  4981. for (const type of this._streamTypes) {
  4982. streamTypes[type] = true;
  4983. }
  4984. for (const type of this._fontTypes) {
  4985. fontTypes[type] = true;
  4986. }
  4987. this._handler.send("DocStats", {
  4988. streamTypes,
  4989. fontTypes
  4990. });
  4991. }
  4992. addStreamType(type) {
  4993. if (this._streamTypes.has(type)) {
  4994. return;
  4995. }
  4996. this._streamTypes.add(type);
  4997. this._send();
  4998. }
  4999. addFontType(type) {
  5000. if (this._fontTypes.has(type)) {
  5001. return;
  5002. }
  5003. this._fontTypes.add(type);
  5004. this._send();
  5005. }
  5006. }
  5007. exports.DocStats = DocStats;
  5008. function getInheritableProperty(_ref) {
  5009. let {
  5010. dict,
  5011. key,
  5012. getArray = false,
  5013. stopWhenFound = true
  5014. } = _ref;
  5015. let values;
  5016. const visited = new _primitives.RefSet();
  5017. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  5018. if (dict.objId) {
  5019. visited.put(dict.objId);
  5020. }
  5021. const value = getArray ? dict.getArray(key) : dict.get(key);
  5022. if (value !== undefined) {
  5023. if (stopWhenFound) {
  5024. return value;
  5025. }
  5026. if (!values) {
  5027. values = [];
  5028. }
  5029. values.push(value);
  5030. }
  5031. dict = dict.get("Parent");
  5032. }
  5033. return values;
  5034. }
  5035. 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"];
  5036. function toRomanNumerals(number) {
  5037. let lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5038. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  5039. const romanBuf = [];
  5040. let pos;
  5041. while (number >= 1000) {
  5042. number -= 1000;
  5043. romanBuf.push("M");
  5044. }
  5045. pos = number / 100 | 0;
  5046. number %= 100;
  5047. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  5048. pos = number / 10 | 0;
  5049. number %= 10;
  5050. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  5051. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  5052. const romanStr = romanBuf.join("");
  5053. return lowerCase ? romanStr.toLowerCase() : romanStr;
  5054. }
  5055. function log2(x) {
  5056. if (x <= 0) {
  5057. return 0;
  5058. }
  5059. return Math.ceil(Math.log2(x));
  5060. }
  5061. function readInt8(data, offset) {
  5062. return data[offset] << 24 >> 24;
  5063. }
  5064. function readUint16(data, offset) {
  5065. return data[offset] << 8 | data[offset + 1];
  5066. }
  5067. function readUint32(data, offset) {
  5068. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  5069. }
  5070. function isWhiteSpace(ch) {
  5071. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  5072. }
  5073. function parseXFAPath(path) {
  5074. const positionPattern = /(.+)\[(\d+)\]$/;
  5075. return path.split(".").map(component => {
  5076. const m = component.match(positionPattern);
  5077. if (m) {
  5078. return {
  5079. name: m[1],
  5080. pos: parseInt(m[2], 10)
  5081. };
  5082. }
  5083. return {
  5084. name: component,
  5085. pos: 0
  5086. };
  5087. });
  5088. }
  5089. function escapePDFName(str) {
  5090. const buffer = [];
  5091. let start = 0;
  5092. for (let i = 0, ii = str.length; i < ii; i++) {
  5093. const char = str.charCodeAt(i);
  5094. 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) {
  5095. if (start < i) {
  5096. buffer.push(str.substring(start, i));
  5097. }
  5098. buffer.push(`#${char.toString(16)}`);
  5099. start = i + 1;
  5100. }
  5101. }
  5102. if (buffer.length === 0) {
  5103. return str;
  5104. }
  5105. if (start < str.length) {
  5106. buffer.push(str.substring(start, str.length));
  5107. }
  5108. return buffer.join("");
  5109. }
  5110. function _collectJS(entry, xref, list, parents) {
  5111. if (!entry) {
  5112. return;
  5113. }
  5114. let parent = null;
  5115. if (entry instanceof _primitives.Ref) {
  5116. if (parents.has(entry)) {
  5117. return;
  5118. }
  5119. parent = entry;
  5120. parents.put(parent);
  5121. entry = xref.fetch(entry);
  5122. }
  5123. if (Array.isArray(entry)) {
  5124. for (const element of entry) {
  5125. _collectJS(element, xref, list, parents);
  5126. }
  5127. } else if (entry instanceof _primitives.Dict) {
  5128. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  5129. const js = entry.get("JS");
  5130. let code;
  5131. if (js instanceof _base_stream.BaseStream) {
  5132. code = js.getString();
  5133. } else if (typeof js === "string") {
  5134. code = js;
  5135. }
  5136. code = code && (0, _util.stringToPDFString)(code).replace(/\u0000/g, "");
  5137. if (code) {
  5138. list.push(code);
  5139. }
  5140. }
  5141. _collectJS(entry.getRaw("Next"), xref, list, parents);
  5142. }
  5143. if (parent) {
  5144. parents.remove(parent);
  5145. }
  5146. }
  5147. function collectActions(xref, dict, eventType) {
  5148. const actions = Object.create(null);
  5149. const additionalActionsDicts = getInheritableProperty({
  5150. dict,
  5151. key: "AA",
  5152. stopWhenFound: false
  5153. });
  5154. if (additionalActionsDicts) {
  5155. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  5156. const additionalActions = additionalActionsDicts[i];
  5157. if (!(additionalActions instanceof _primitives.Dict)) {
  5158. continue;
  5159. }
  5160. for (const key of additionalActions.getKeys()) {
  5161. const action = eventType[key];
  5162. if (!action) {
  5163. continue;
  5164. }
  5165. const actionDict = additionalActions.getRaw(key);
  5166. const parents = new _primitives.RefSet();
  5167. const list = [];
  5168. _collectJS(actionDict, xref, list, parents);
  5169. if (list.length > 0) {
  5170. actions[action] = list;
  5171. }
  5172. }
  5173. }
  5174. }
  5175. if (dict.has("A")) {
  5176. const actionDict = dict.get("A");
  5177. const parents = new _primitives.RefSet();
  5178. const list = [];
  5179. _collectJS(actionDict, xref, list, parents);
  5180. if (list.length > 0) {
  5181. actions.Action = list;
  5182. }
  5183. }
  5184. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  5185. }
  5186. const XMLEntities = {
  5187. 0x3c: "&lt;",
  5188. 0x3e: "&gt;",
  5189. 0x26: "&amp;",
  5190. 0x22: "&quot;",
  5191. 0x27: "&apos;"
  5192. };
  5193. function encodeToXmlString(str) {
  5194. const buffer = [];
  5195. let start = 0;
  5196. for (let i = 0, ii = str.length; i < ii; i++) {
  5197. const char = str.codePointAt(i);
  5198. if (0x20 <= char && char <= 0x7e) {
  5199. const entity = XMLEntities[char];
  5200. if (entity) {
  5201. if (start < i) {
  5202. buffer.push(str.substring(start, i));
  5203. }
  5204. buffer.push(entity);
  5205. start = i + 1;
  5206. }
  5207. } else {
  5208. if (start < i) {
  5209. buffer.push(str.substring(start, i));
  5210. }
  5211. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  5212. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  5213. i++;
  5214. }
  5215. start = i + 1;
  5216. }
  5217. }
  5218. if (buffer.length === 0) {
  5219. return str;
  5220. }
  5221. if (start < str.length) {
  5222. buffer.push(str.substring(start, str.length));
  5223. }
  5224. return buffer.join("");
  5225. }
  5226. function validateCSSFont(cssFontInfo) {
  5227. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  5228. const DEFAULT_CSS_FONT_WEIGHT = "400";
  5229. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  5230. const {
  5231. fontFamily,
  5232. fontWeight,
  5233. italicAngle
  5234. } = cssFontInfo;
  5235. if (/^".*"$/.test(fontFamily)) {
  5236. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  5237. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  5238. return false;
  5239. }
  5240. } else if (/^'.*'$/.test(fontFamily)) {
  5241. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  5242. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  5243. return false;
  5244. }
  5245. } else {
  5246. for (const ident of fontFamily.split(/[ \t]+/)) {
  5247. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  5248. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  5249. return false;
  5250. }
  5251. }
  5252. }
  5253. const weight = fontWeight ? fontWeight.toString() : "";
  5254. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  5255. const angle = parseFloat(italicAngle);
  5256. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  5257. return true;
  5258. }
  5259. function recoverJsURL(str) {
  5260. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  5261. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  5262. const jsUrl = regex.exec(str);
  5263. if (jsUrl && jsUrl[2]) {
  5264. const url = jsUrl[2];
  5265. let newWindow = false;
  5266. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  5267. newWindow = true;
  5268. }
  5269. return {
  5270. url,
  5271. newWindow
  5272. };
  5273. }
  5274. return null;
  5275. }
  5276. function numberToString(value) {
  5277. if (Number.isInteger(value)) {
  5278. return value.toString();
  5279. }
  5280. const roundedValue = Math.round(value * 100);
  5281. if (roundedValue % 100 === 0) {
  5282. return (roundedValue / 100).toString();
  5283. }
  5284. if (roundedValue % 10 === 0) {
  5285. return value.toFixed(1);
  5286. }
  5287. return value.toFixed(2);
  5288. }
  5289. function getNewAnnotationsMap(annotationStorage) {
  5290. if (!annotationStorage) {
  5291. return null;
  5292. }
  5293. const newAnnotationsByPage = new Map();
  5294. for (const [key, value] of annotationStorage) {
  5295. if (!key.startsWith(_util.AnnotationEditorPrefix)) {
  5296. continue;
  5297. }
  5298. let annotations = newAnnotationsByPage.get(value.pageIndex);
  5299. if (!annotations) {
  5300. annotations = [];
  5301. newAnnotationsByPage.set(value.pageIndex, annotations);
  5302. }
  5303. annotations.push(value);
  5304. }
  5305. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  5306. }
  5307. /***/ }),
  5308. /* 136 */
  5309. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5310. "use strict";
  5311. Object.defineProperty(exports, "__esModule", ({
  5312. value: true
  5313. }));
  5314. exports.BaseStream = void 0;
  5315. var _util = __w_pdfjs_require__(2);
  5316. class BaseStream {
  5317. constructor() {
  5318. if (this.constructor === BaseStream) {
  5319. (0, _util.unreachable)("Cannot initialize BaseStream.");
  5320. }
  5321. }
  5322. get length() {
  5323. (0, _util.unreachable)("Abstract getter `length` accessed");
  5324. }
  5325. get isEmpty() {
  5326. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  5327. }
  5328. get isDataLoaded() {
  5329. return (0, _util.shadow)(this, "isDataLoaded", true);
  5330. }
  5331. getByte() {
  5332. (0, _util.unreachable)("Abstract method `getByte` called");
  5333. }
  5334. getBytes(length) {
  5335. (0, _util.unreachable)("Abstract method `getBytes` called");
  5336. }
  5337. peekByte() {
  5338. const peekedByte = this.getByte();
  5339. if (peekedByte !== -1) {
  5340. this.pos--;
  5341. }
  5342. return peekedByte;
  5343. }
  5344. peekBytes(length) {
  5345. const bytes = this.getBytes(length);
  5346. this.pos -= bytes.length;
  5347. return bytes;
  5348. }
  5349. getUint16() {
  5350. const b0 = this.getByte();
  5351. const b1 = this.getByte();
  5352. if (b0 === -1 || b1 === -1) {
  5353. return -1;
  5354. }
  5355. return (b0 << 8) + b1;
  5356. }
  5357. getInt32() {
  5358. const b0 = this.getByte();
  5359. const b1 = this.getByte();
  5360. const b2 = this.getByte();
  5361. const b3 = this.getByte();
  5362. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5363. }
  5364. getByteRange(begin, end) {
  5365. (0, _util.unreachable)("Abstract method `getByteRange` called");
  5366. }
  5367. getString(length) {
  5368. return (0, _util.bytesToString)(this.getBytes(length));
  5369. }
  5370. skip(n) {
  5371. this.pos += n || 1;
  5372. }
  5373. reset() {
  5374. (0, _util.unreachable)("Abstract method `reset` called");
  5375. }
  5376. moveStart() {
  5377. (0, _util.unreachable)("Abstract method `moveStart` called");
  5378. }
  5379. makeSubStream(start, length) {
  5380. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5381. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  5382. }
  5383. getBaseStreams() {
  5384. return null;
  5385. }
  5386. }
  5387. exports.BaseStream = BaseStream;
  5388. /***/ }),
  5389. /* 137 */
  5390. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5391. "use strict";
  5392. Object.defineProperty(exports, "__esModule", ({
  5393. value: true
  5394. }));
  5395. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  5396. var _util = __w_pdfjs_require__(2);
  5397. var _chunked_stream = __w_pdfjs_require__(138);
  5398. var _core_utils = __w_pdfjs_require__(135);
  5399. var _document = __w_pdfjs_require__(140);
  5400. var _stream = __w_pdfjs_require__(139);
  5401. function parseDocBaseUrl(url) {
  5402. if (url) {
  5403. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  5404. if (absoluteUrl) {
  5405. return absoluteUrl.href;
  5406. }
  5407. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  5408. }
  5409. return null;
  5410. }
  5411. class BasePdfManager {
  5412. constructor() {
  5413. if (this.constructor === BasePdfManager) {
  5414. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  5415. }
  5416. }
  5417. get docId() {
  5418. return this._docId;
  5419. }
  5420. get password() {
  5421. return this._password;
  5422. }
  5423. get docBaseUrl() {
  5424. const catalog = this.pdfDocument.catalog;
  5425. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  5426. }
  5427. ensureDoc(prop, args) {
  5428. return this.ensure(this.pdfDocument, prop, args);
  5429. }
  5430. ensureXRef(prop, args) {
  5431. return this.ensure(this.pdfDocument.xref, prop, args);
  5432. }
  5433. ensureCatalog(prop, args) {
  5434. return this.ensure(this.pdfDocument.catalog, prop, args);
  5435. }
  5436. getPage(pageIndex) {
  5437. return this.pdfDocument.getPage(pageIndex);
  5438. }
  5439. fontFallback(id, handler) {
  5440. return this.pdfDocument.fontFallback(id, handler);
  5441. }
  5442. loadXfaFonts(handler, task) {
  5443. return this.pdfDocument.loadXfaFonts(handler, task);
  5444. }
  5445. loadXfaImages() {
  5446. return this.pdfDocument.loadXfaImages();
  5447. }
  5448. serializeXfaData(annotationStorage) {
  5449. return this.pdfDocument.serializeXfaData(annotationStorage);
  5450. }
  5451. cleanup() {
  5452. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5453. return this.pdfDocument.cleanup(manuallyTriggered);
  5454. }
  5455. async ensure(obj, prop, args) {
  5456. (0, _util.unreachable)("Abstract method `ensure` called");
  5457. }
  5458. requestRange(begin, end) {
  5459. (0, _util.unreachable)("Abstract method `requestRange` called");
  5460. }
  5461. requestLoadedStream() {
  5462. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5463. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  5464. }
  5465. sendProgressiveData(chunk) {
  5466. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  5467. }
  5468. updatePassword(password) {
  5469. this._password = password;
  5470. }
  5471. terminate(reason) {
  5472. (0, _util.unreachable)("Abstract method `terminate` called");
  5473. }
  5474. }
  5475. class LocalPdfManager extends BasePdfManager {
  5476. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  5477. super();
  5478. this._docId = docId;
  5479. this._password = password;
  5480. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  5481. this.msgHandler = msgHandler;
  5482. this.evaluatorOptions = evaluatorOptions;
  5483. this.enableXfa = enableXfa;
  5484. const stream = new _stream.Stream(data);
  5485. this.pdfDocument = new _document.PDFDocument(this, stream);
  5486. this._loadedStreamPromise = Promise.resolve(stream);
  5487. }
  5488. async ensure(obj, prop, args) {
  5489. const value = obj[prop];
  5490. if (typeof value === "function") {
  5491. return value.apply(obj, args);
  5492. }
  5493. return value;
  5494. }
  5495. requestRange(begin, end) {
  5496. return Promise.resolve();
  5497. }
  5498. requestLoadedStream() {
  5499. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5500. return this._loadedStreamPromise;
  5501. }
  5502. terminate(reason) {}
  5503. }
  5504. exports.LocalPdfManager = LocalPdfManager;
  5505. class NetworkPdfManager extends BasePdfManager {
  5506. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  5507. super();
  5508. this._docId = docId;
  5509. this._password = args.password;
  5510. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  5511. this.msgHandler = args.msgHandler;
  5512. this.evaluatorOptions = evaluatorOptions;
  5513. this.enableXfa = enableXfa;
  5514. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  5515. msgHandler: args.msgHandler,
  5516. length: args.length,
  5517. disableAutoFetch: args.disableAutoFetch,
  5518. rangeChunkSize: args.rangeChunkSize
  5519. });
  5520. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  5521. }
  5522. async ensure(obj, prop, args) {
  5523. try {
  5524. const value = obj[prop];
  5525. if (typeof value === "function") {
  5526. return value.apply(obj, args);
  5527. }
  5528. return value;
  5529. } catch (ex) {
  5530. if (!(ex instanceof _core_utils.MissingDataException)) {
  5531. throw ex;
  5532. }
  5533. await this.requestRange(ex.begin, ex.end);
  5534. return this.ensure(obj, prop, args);
  5535. }
  5536. }
  5537. requestRange(begin, end) {
  5538. return this.streamManager.requestRange(begin, end);
  5539. }
  5540. requestLoadedStream() {
  5541. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5542. return this.streamManager.requestAllChunks(noFetch);
  5543. }
  5544. sendProgressiveData(chunk) {
  5545. this.streamManager.onReceiveData({
  5546. chunk
  5547. });
  5548. }
  5549. terminate(reason) {
  5550. this.streamManager.abort(reason);
  5551. }
  5552. }
  5553. exports.NetworkPdfManager = NetworkPdfManager;
  5554. /***/ }),
  5555. /* 138 */
  5556. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5557. "use strict";
  5558. Object.defineProperty(exports, "__esModule", ({
  5559. value: true
  5560. }));
  5561. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  5562. var _util = __w_pdfjs_require__(2);
  5563. var _core_utils = __w_pdfjs_require__(135);
  5564. var _stream = __w_pdfjs_require__(139);
  5565. class ChunkedStream extends _stream.Stream {
  5566. constructor(length, chunkSize, manager) {
  5567. super(new Uint8Array(length), 0, length, null);
  5568. this.chunkSize = chunkSize;
  5569. this._loadedChunks = new Set();
  5570. this.numChunks = Math.ceil(length / chunkSize);
  5571. this.manager = manager;
  5572. this.progressiveDataLength = 0;
  5573. this.lastSuccessfulEnsureByteChunk = -1;
  5574. }
  5575. getMissingChunks() {
  5576. const chunks = [];
  5577. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  5578. if (!this._loadedChunks.has(chunk)) {
  5579. chunks.push(chunk);
  5580. }
  5581. }
  5582. return chunks;
  5583. }
  5584. get numChunksLoaded() {
  5585. return this._loadedChunks.size;
  5586. }
  5587. get isDataLoaded() {
  5588. return this.numChunksLoaded === this.numChunks;
  5589. }
  5590. onReceiveData(begin, chunk) {
  5591. const chunkSize = this.chunkSize;
  5592. if (begin % chunkSize !== 0) {
  5593. throw new Error(`Bad begin offset: ${begin}`);
  5594. }
  5595. const end = begin + chunk.byteLength;
  5596. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  5597. throw new Error(`Bad end offset: ${end}`);
  5598. }
  5599. this.bytes.set(new Uint8Array(chunk), begin);
  5600. const beginChunk = Math.floor(begin / chunkSize);
  5601. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  5602. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5603. this._loadedChunks.add(curChunk);
  5604. }
  5605. }
  5606. onReceiveProgressiveData(data) {
  5607. let position = this.progressiveDataLength;
  5608. const beginChunk = Math.floor(position / this.chunkSize);
  5609. this.bytes.set(new Uint8Array(data), position);
  5610. position += data.byteLength;
  5611. this.progressiveDataLength = position;
  5612. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  5613. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5614. this._loadedChunks.add(curChunk);
  5615. }
  5616. }
  5617. ensureByte(pos) {
  5618. if (pos < this.progressiveDataLength) {
  5619. return;
  5620. }
  5621. const chunk = Math.floor(pos / this.chunkSize);
  5622. if (chunk > this.numChunks) {
  5623. return;
  5624. }
  5625. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  5626. return;
  5627. }
  5628. if (!this._loadedChunks.has(chunk)) {
  5629. throw new _core_utils.MissingDataException(pos, pos + 1);
  5630. }
  5631. this.lastSuccessfulEnsureByteChunk = chunk;
  5632. }
  5633. ensureRange(begin, end) {
  5634. if (begin >= end) {
  5635. return;
  5636. }
  5637. if (end <= this.progressiveDataLength) {
  5638. return;
  5639. }
  5640. const beginChunk = Math.floor(begin / this.chunkSize);
  5641. if (beginChunk > this.numChunks) {
  5642. return;
  5643. }
  5644. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  5645. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5646. if (!this._loadedChunks.has(chunk)) {
  5647. throw new _core_utils.MissingDataException(begin, end);
  5648. }
  5649. }
  5650. }
  5651. nextEmptyChunk(beginChunk) {
  5652. const numChunks = this.numChunks;
  5653. for (let i = 0; i < numChunks; ++i) {
  5654. const chunk = (beginChunk + i) % numChunks;
  5655. if (!this._loadedChunks.has(chunk)) {
  5656. return chunk;
  5657. }
  5658. }
  5659. return null;
  5660. }
  5661. hasChunk(chunk) {
  5662. return this._loadedChunks.has(chunk);
  5663. }
  5664. getByte() {
  5665. const pos = this.pos;
  5666. if (pos >= this.end) {
  5667. return -1;
  5668. }
  5669. if (pos >= this.progressiveDataLength) {
  5670. this.ensureByte(pos);
  5671. }
  5672. return this.bytes[this.pos++];
  5673. }
  5674. getBytes(length) {
  5675. const bytes = this.bytes;
  5676. const pos = this.pos;
  5677. const strEnd = this.end;
  5678. if (!length) {
  5679. if (strEnd > this.progressiveDataLength) {
  5680. this.ensureRange(pos, strEnd);
  5681. }
  5682. return bytes.subarray(pos, strEnd);
  5683. }
  5684. let end = pos + length;
  5685. if (end > strEnd) {
  5686. end = strEnd;
  5687. }
  5688. if (end > this.progressiveDataLength) {
  5689. this.ensureRange(pos, end);
  5690. }
  5691. this.pos = end;
  5692. return bytes.subarray(pos, end);
  5693. }
  5694. getByteRange(begin, end) {
  5695. if (begin < 0) {
  5696. begin = 0;
  5697. }
  5698. if (end > this.end) {
  5699. end = this.end;
  5700. }
  5701. if (end > this.progressiveDataLength) {
  5702. this.ensureRange(begin, end);
  5703. }
  5704. return this.bytes.subarray(begin, end);
  5705. }
  5706. makeSubStream(start, length) {
  5707. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  5708. if (length) {
  5709. if (start + length > this.progressiveDataLength) {
  5710. this.ensureRange(start, start + length);
  5711. }
  5712. } else {
  5713. if (start >= this.progressiveDataLength) {
  5714. this.ensureByte(start);
  5715. }
  5716. }
  5717. function ChunkedStreamSubstream() {}
  5718. ChunkedStreamSubstream.prototype = Object.create(this);
  5719. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  5720. const chunkSize = this.chunkSize;
  5721. const beginChunk = Math.floor(this.start / chunkSize);
  5722. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  5723. const missingChunks = [];
  5724. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5725. if (!this._loadedChunks.has(chunk)) {
  5726. missingChunks.push(chunk);
  5727. }
  5728. }
  5729. return missingChunks;
  5730. };
  5731. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  5732. get() {
  5733. if (this.numChunksLoaded === this.numChunks) {
  5734. return true;
  5735. }
  5736. return this.getMissingChunks().length === 0;
  5737. },
  5738. configurable: true
  5739. });
  5740. const subStream = new ChunkedStreamSubstream();
  5741. subStream.pos = subStream.start = start;
  5742. subStream.end = start + length || this.end;
  5743. subStream.dict = dict;
  5744. return subStream;
  5745. }
  5746. getBaseStreams() {
  5747. return [this];
  5748. }
  5749. }
  5750. exports.ChunkedStream = ChunkedStream;
  5751. class ChunkedStreamManager {
  5752. constructor(pdfNetworkStream, args) {
  5753. this.length = args.length;
  5754. this.chunkSize = args.rangeChunkSize;
  5755. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  5756. this.pdfNetworkStream = pdfNetworkStream;
  5757. this.disableAutoFetch = args.disableAutoFetch;
  5758. this.msgHandler = args.msgHandler;
  5759. this.currRequestId = 0;
  5760. this._chunksNeededByRequest = new Map();
  5761. this._requestsByChunk = new Map();
  5762. this._promisesByRequest = new Map();
  5763. this.progressiveDataLength = 0;
  5764. this.aborted = false;
  5765. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  5766. }
  5767. sendRequest(begin, end) {
  5768. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  5769. if (!rangeReader.isStreamingSupported) {
  5770. rangeReader.onProgress = this.onProgress.bind(this);
  5771. }
  5772. let chunks = [],
  5773. loaded = 0;
  5774. return new Promise((resolve, reject) => {
  5775. const readChunk = chunk => {
  5776. try {
  5777. if (!chunk.done) {
  5778. const data = chunk.value;
  5779. chunks.push(data);
  5780. loaded += (0, _util.arrayByteLength)(data);
  5781. if (rangeReader.isStreamingSupported) {
  5782. this.onProgress({
  5783. loaded
  5784. });
  5785. }
  5786. rangeReader.read().then(readChunk, reject);
  5787. return;
  5788. }
  5789. const chunkData = (0, _util.arraysToBytes)(chunks);
  5790. chunks = null;
  5791. resolve(chunkData);
  5792. } catch (e) {
  5793. reject(e);
  5794. }
  5795. };
  5796. rangeReader.read().then(readChunk, reject);
  5797. }).then(data => {
  5798. if (this.aborted) {
  5799. return;
  5800. }
  5801. this.onReceiveData({
  5802. chunk: data,
  5803. begin
  5804. });
  5805. });
  5806. }
  5807. requestAllChunks() {
  5808. let noFetch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5809. if (!noFetch) {
  5810. const missingChunks = this.stream.getMissingChunks();
  5811. this._requestChunks(missingChunks);
  5812. }
  5813. return this._loadedStreamCapability.promise;
  5814. }
  5815. _requestChunks(chunks) {
  5816. const requestId = this.currRequestId++;
  5817. const chunksNeeded = new Set();
  5818. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  5819. for (const chunk of chunks) {
  5820. if (!this.stream.hasChunk(chunk)) {
  5821. chunksNeeded.add(chunk);
  5822. }
  5823. }
  5824. if (chunksNeeded.size === 0) {
  5825. return Promise.resolve();
  5826. }
  5827. const capability = (0, _util.createPromiseCapability)();
  5828. this._promisesByRequest.set(requestId, capability);
  5829. const chunksToRequest = [];
  5830. for (const chunk of chunksNeeded) {
  5831. let requestIds = this._requestsByChunk.get(chunk);
  5832. if (!requestIds) {
  5833. requestIds = [];
  5834. this._requestsByChunk.set(chunk, requestIds);
  5835. chunksToRequest.push(chunk);
  5836. }
  5837. requestIds.push(requestId);
  5838. }
  5839. if (chunksToRequest.length > 0) {
  5840. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  5841. for (const groupedChunk of groupedChunksToRequest) {
  5842. const begin = groupedChunk.beginChunk * this.chunkSize;
  5843. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  5844. this.sendRequest(begin, end).catch(capability.reject);
  5845. }
  5846. }
  5847. return capability.promise.catch(reason => {
  5848. if (this.aborted) {
  5849. return;
  5850. }
  5851. throw reason;
  5852. });
  5853. }
  5854. getStream() {
  5855. return this.stream;
  5856. }
  5857. requestRange(begin, end) {
  5858. end = Math.min(end, this.length);
  5859. const beginChunk = this.getBeginChunk(begin);
  5860. const endChunk = this.getEndChunk(end);
  5861. const chunks = [];
  5862. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5863. chunks.push(chunk);
  5864. }
  5865. return this._requestChunks(chunks);
  5866. }
  5867. requestRanges() {
  5868. let ranges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  5869. const chunksToRequest = [];
  5870. for (const range of ranges) {
  5871. const beginChunk = this.getBeginChunk(range.begin);
  5872. const endChunk = this.getEndChunk(range.end);
  5873. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  5874. if (!chunksToRequest.includes(chunk)) {
  5875. chunksToRequest.push(chunk);
  5876. }
  5877. }
  5878. }
  5879. chunksToRequest.sort(function (a, b) {
  5880. return a - b;
  5881. });
  5882. return this._requestChunks(chunksToRequest);
  5883. }
  5884. groupChunks(chunks) {
  5885. const groupedChunks = [];
  5886. let beginChunk = -1;
  5887. let prevChunk = -1;
  5888. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  5889. const chunk = chunks[i];
  5890. if (beginChunk < 0) {
  5891. beginChunk = chunk;
  5892. }
  5893. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  5894. groupedChunks.push({
  5895. beginChunk,
  5896. endChunk: prevChunk + 1
  5897. });
  5898. beginChunk = chunk;
  5899. }
  5900. if (i + 1 === chunks.length) {
  5901. groupedChunks.push({
  5902. beginChunk,
  5903. endChunk: chunk + 1
  5904. });
  5905. }
  5906. prevChunk = chunk;
  5907. }
  5908. return groupedChunks;
  5909. }
  5910. onProgress(args) {
  5911. this.msgHandler.send("DocProgress", {
  5912. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  5913. total: this.length
  5914. });
  5915. }
  5916. onReceiveData(args) {
  5917. const chunk = args.chunk;
  5918. const isProgressive = args.begin === undefined;
  5919. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  5920. const end = begin + chunk.byteLength;
  5921. const beginChunk = Math.floor(begin / this.chunkSize);
  5922. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  5923. if (isProgressive) {
  5924. this.stream.onReceiveProgressiveData(chunk);
  5925. this.progressiveDataLength = end;
  5926. } else {
  5927. this.stream.onReceiveData(begin, chunk);
  5928. }
  5929. if (this.stream.isDataLoaded) {
  5930. this._loadedStreamCapability.resolve(this.stream);
  5931. }
  5932. const loadedRequests = [];
  5933. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  5934. const requestIds = this._requestsByChunk.get(curChunk);
  5935. if (!requestIds) {
  5936. continue;
  5937. }
  5938. this._requestsByChunk.delete(curChunk);
  5939. for (const requestId of requestIds) {
  5940. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  5941. if (chunksNeeded.has(curChunk)) {
  5942. chunksNeeded.delete(curChunk);
  5943. }
  5944. if (chunksNeeded.size > 0) {
  5945. continue;
  5946. }
  5947. loadedRequests.push(requestId);
  5948. }
  5949. }
  5950. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  5951. let nextEmptyChunk;
  5952. if (this.stream.numChunksLoaded === 1) {
  5953. const lastChunk = this.stream.numChunks - 1;
  5954. if (!this.stream.hasChunk(lastChunk)) {
  5955. nextEmptyChunk = lastChunk;
  5956. }
  5957. } else {
  5958. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  5959. }
  5960. if (Number.isInteger(nextEmptyChunk)) {
  5961. this._requestChunks([nextEmptyChunk]);
  5962. }
  5963. }
  5964. for (const requestId of loadedRequests) {
  5965. const capability = this._promisesByRequest.get(requestId);
  5966. this._promisesByRequest.delete(requestId);
  5967. capability.resolve();
  5968. }
  5969. this.msgHandler.send("DocProgress", {
  5970. loaded: this.stream.numChunksLoaded * this.chunkSize,
  5971. total: this.length
  5972. });
  5973. }
  5974. onError(err) {
  5975. this._loadedStreamCapability.reject(err);
  5976. }
  5977. getBeginChunk(begin) {
  5978. return Math.floor(begin / this.chunkSize);
  5979. }
  5980. getEndChunk(end) {
  5981. return Math.floor((end - 1) / this.chunkSize) + 1;
  5982. }
  5983. abort(reason) {
  5984. this.aborted = true;
  5985. if (this.pdfNetworkStream) {
  5986. this.pdfNetworkStream.cancelAllRequests(reason);
  5987. }
  5988. for (const capability of this._promisesByRequest.values()) {
  5989. capability.reject(reason);
  5990. }
  5991. }
  5992. }
  5993. exports.ChunkedStreamManager = ChunkedStreamManager;
  5994. /***/ }),
  5995. /* 139 */
  5996. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5997. "use strict";
  5998. Object.defineProperty(exports, "__esModule", ({
  5999. value: true
  6000. }));
  6001. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  6002. var _base_stream = __w_pdfjs_require__(136);
  6003. var _util = __w_pdfjs_require__(2);
  6004. class Stream extends _base_stream.BaseStream {
  6005. constructor(arrayBuffer, start, length, dict) {
  6006. super();
  6007. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  6008. this.start = start || 0;
  6009. this.pos = this.start;
  6010. this.end = start + length || this.bytes.length;
  6011. this.dict = dict;
  6012. }
  6013. get length() {
  6014. return this.end - this.start;
  6015. }
  6016. get isEmpty() {
  6017. return this.length === 0;
  6018. }
  6019. getByte() {
  6020. if (this.pos >= this.end) {
  6021. return -1;
  6022. }
  6023. return this.bytes[this.pos++];
  6024. }
  6025. getBytes(length) {
  6026. const bytes = this.bytes;
  6027. const pos = this.pos;
  6028. const strEnd = this.end;
  6029. if (!length) {
  6030. return bytes.subarray(pos, strEnd);
  6031. }
  6032. let end = pos + length;
  6033. if (end > strEnd) {
  6034. end = strEnd;
  6035. }
  6036. this.pos = end;
  6037. return bytes.subarray(pos, end);
  6038. }
  6039. getByteRange(begin, end) {
  6040. if (begin < 0) {
  6041. begin = 0;
  6042. }
  6043. if (end > this.end) {
  6044. end = this.end;
  6045. }
  6046. return this.bytes.subarray(begin, end);
  6047. }
  6048. reset() {
  6049. this.pos = this.start;
  6050. }
  6051. moveStart() {
  6052. this.start = this.pos;
  6053. }
  6054. makeSubStream(start, length) {
  6055. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  6056. return new Stream(this.bytes.buffer, start, length, dict);
  6057. }
  6058. }
  6059. exports.Stream = Stream;
  6060. class StringStream extends Stream {
  6061. constructor(str) {
  6062. super((0, _util.stringToBytes)(str));
  6063. }
  6064. }
  6065. exports.StringStream = StringStream;
  6066. class NullStream extends Stream {
  6067. constructor() {
  6068. super(new Uint8Array(0));
  6069. }
  6070. }
  6071. exports.NullStream = NullStream;
  6072. /***/ }),
  6073. /* 140 */
  6074. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6075. "use strict";
  6076. Object.defineProperty(exports, "__esModule", ({
  6077. value: true
  6078. }));
  6079. exports.Page = exports.PDFDocument = void 0;
  6080. var _annotation = __w_pdfjs_require__(141);
  6081. var _util = __w_pdfjs_require__(2);
  6082. var _core_utils = __w_pdfjs_require__(135);
  6083. var _primitives = __w_pdfjs_require__(134);
  6084. var _xfa_fonts = __w_pdfjs_require__(180);
  6085. var _base_stream = __w_pdfjs_require__(136);
  6086. var _crypto = __w_pdfjs_require__(196);
  6087. var _catalog = __w_pdfjs_require__(198);
  6088. var _cleanup_helper = __w_pdfjs_require__(200);
  6089. var _dataset_reader = __w_pdfjs_require__(229);
  6090. var _parser = __w_pdfjs_require__(146);
  6091. var _stream = __w_pdfjs_require__(139);
  6092. var _object_loader = __w_pdfjs_require__(204);
  6093. var _operator_list = __w_pdfjs_require__(191);
  6094. var _evaluator = __w_pdfjs_require__(144);
  6095. var _decode_stream = __w_pdfjs_require__(148);
  6096. var _struct_tree = __w_pdfjs_require__(203);
  6097. var _writer = __w_pdfjs_require__(194);
  6098. var _factory = __w_pdfjs_require__(205);
  6099. var _xref = __w_pdfjs_require__(230);
  6100. const DEFAULT_USER_UNIT = 1.0;
  6101. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  6102. class Page {
  6103. constructor(_ref) {
  6104. let {
  6105. pdfManager,
  6106. xref,
  6107. pageIndex,
  6108. pageDict,
  6109. ref,
  6110. globalIdFactory,
  6111. fontCache,
  6112. builtInCMapCache,
  6113. standardFontDataCache,
  6114. globalImageCache,
  6115. nonBlendModesSet,
  6116. xfaFactory
  6117. } = _ref;
  6118. this.pdfManager = pdfManager;
  6119. this.pageIndex = pageIndex;
  6120. this.pageDict = pageDict;
  6121. this.xref = xref;
  6122. this.ref = ref;
  6123. this.fontCache = fontCache;
  6124. this.builtInCMapCache = builtInCMapCache;
  6125. this.standardFontDataCache = standardFontDataCache;
  6126. this.globalImageCache = globalImageCache;
  6127. this.nonBlendModesSet = nonBlendModesSet;
  6128. this.evaluatorOptions = pdfManager.evaluatorOptions;
  6129. this.resourcesPromise = null;
  6130. this.xfaFactory = xfaFactory;
  6131. const idCounters = {
  6132. obj: 0
  6133. };
  6134. this._localIdFactory = class extends globalIdFactory {
  6135. static createObjId() {
  6136. return `p${pageIndex}_${++idCounters.obj}`;
  6137. }
  6138. static getPageObjId() {
  6139. return `page${ref.toString()}`;
  6140. }
  6141. };
  6142. }
  6143. _getInheritableProperty(key) {
  6144. let getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6145. const value = (0, _core_utils.getInheritableProperty)({
  6146. dict: this.pageDict,
  6147. key,
  6148. getArray,
  6149. stopWhenFound: false
  6150. });
  6151. if (!Array.isArray(value)) {
  6152. return value;
  6153. }
  6154. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  6155. return value[0];
  6156. }
  6157. return _primitives.Dict.merge({
  6158. xref: this.xref,
  6159. dictArray: value
  6160. });
  6161. }
  6162. get content() {
  6163. return this.pageDict.getArray("Contents");
  6164. }
  6165. get resources() {
  6166. const resources = this._getInheritableProperty("Resources");
  6167. return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
  6168. }
  6169. _getBoundingBox(name) {
  6170. if (this.xfaData) {
  6171. return this.xfaData.bbox;
  6172. }
  6173. const box = this._getInheritableProperty(name, true);
  6174. if (Array.isArray(box) && box.length === 4) {
  6175. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  6176. return box;
  6177. }
  6178. (0, _util.warn)(`Empty /${name} entry.`);
  6179. }
  6180. return null;
  6181. }
  6182. get mediaBox() {
  6183. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  6184. }
  6185. get cropBox() {
  6186. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  6187. }
  6188. get userUnit() {
  6189. let obj = this.pageDict.get("UserUnit");
  6190. if (typeof obj !== "number" || obj <= 0) {
  6191. obj = DEFAULT_USER_UNIT;
  6192. }
  6193. return (0, _util.shadow)(this, "userUnit", obj);
  6194. }
  6195. get view() {
  6196. const {
  6197. cropBox,
  6198. mediaBox
  6199. } = this;
  6200. let view;
  6201. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  6202. view = mediaBox;
  6203. } else {
  6204. const box = _util.Util.intersect(cropBox, mediaBox);
  6205. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  6206. view = box;
  6207. } else {
  6208. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  6209. }
  6210. }
  6211. return (0, _util.shadow)(this, "view", view || mediaBox);
  6212. }
  6213. get rotate() {
  6214. let rotate = this._getInheritableProperty("Rotate") || 0;
  6215. if (rotate % 90 !== 0) {
  6216. rotate = 0;
  6217. } else if (rotate >= 360) {
  6218. rotate %= 360;
  6219. } else if (rotate < 0) {
  6220. rotate = (rotate % 360 + 360) % 360;
  6221. }
  6222. return (0, _util.shadow)(this, "rotate", rotate);
  6223. }
  6224. _onSubStreamError(handler, reason, objId) {
  6225. if (this.evaluatorOptions.ignoreErrors) {
  6226. handler.send("UnsupportedFeature", {
  6227. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  6228. });
  6229. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  6230. return;
  6231. }
  6232. throw reason;
  6233. }
  6234. getContentStream(handler) {
  6235. return this.pdfManager.ensure(this, "content").then(content => {
  6236. if (content instanceof _base_stream.BaseStream) {
  6237. return content;
  6238. }
  6239. if (Array.isArray(content)) {
  6240. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  6241. }
  6242. return new _stream.NullStream();
  6243. });
  6244. }
  6245. get xfaData() {
  6246. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  6247. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  6248. } : null);
  6249. }
  6250. async saveNewAnnotations(handler, task, annotations) {
  6251. if (this.xfaFactory) {
  6252. throw new Error("XFA: Cannot save new annotations.");
  6253. }
  6254. const partialEvaluator = new _evaluator.PartialEvaluator({
  6255. xref: this.xref,
  6256. handler,
  6257. pageIndex: this.pageIndex,
  6258. idFactory: this._localIdFactory,
  6259. fontCache: this.fontCache,
  6260. builtInCMapCache: this.builtInCMapCache,
  6261. standardFontDataCache: this.standardFontDataCache,
  6262. globalImageCache: this.globalImageCache,
  6263. options: this.evaluatorOptions
  6264. });
  6265. const pageDict = this.pageDict;
  6266. const annotationsArray = this.annotations.slice();
  6267. const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations);
  6268. for (const {
  6269. ref
  6270. } of newData.annotations) {
  6271. annotationsArray.push(ref);
  6272. }
  6273. const savedDict = pageDict.get("Annots");
  6274. pageDict.set("Annots", annotationsArray);
  6275. const buffer = [];
  6276. let transform = null;
  6277. if (this.xref.encrypt) {
  6278. transform = this.xref.encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  6279. }
  6280. (0, _writer.writeObject)(this.ref, pageDict, buffer, transform);
  6281. if (savedDict) {
  6282. pageDict.set("Annots", savedDict);
  6283. }
  6284. const objects = newData.dependencies;
  6285. objects.push({
  6286. ref: this.ref,
  6287. data: buffer.join("")
  6288. }, ...newData.annotations);
  6289. return objects;
  6290. }
  6291. save(handler, task, annotationStorage) {
  6292. const partialEvaluator = new _evaluator.PartialEvaluator({
  6293. xref: this.xref,
  6294. handler,
  6295. pageIndex: this.pageIndex,
  6296. idFactory: this._localIdFactory,
  6297. fontCache: this.fontCache,
  6298. builtInCMapCache: this.builtInCMapCache,
  6299. standardFontDataCache: this.standardFontDataCache,
  6300. globalImageCache: this.globalImageCache,
  6301. options: this.evaluatorOptions
  6302. });
  6303. return this._parsedAnnotations.then(function (annotations) {
  6304. const newRefsPromises = [];
  6305. for (const annotation of annotations) {
  6306. if (!annotation.mustBePrinted(annotationStorage)) {
  6307. continue;
  6308. }
  6309. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  6310. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6311. return null;
  6312. }));
  6313. }
  6314. return Promise.all(newRefsPromises).then(function (newRefs) {
  6315. return newRefs.filter(newRef => !!newRef);
  6316. });
  6317. });
  6318. }
  6319. loadResources(keys) {
  6320. if (!this.resourcesPromise) {
  6321. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  6322. }
  6323. return this.resourcesPromise.then(() => {
  6324. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  6325. return objectLoader.load();
  6326. });
  6327. }
  6328. getOperatorList(_ref2) {
  6329. let {
  6330. handler,
  6331. sink,
  6332. task,
  6333. intent,
  6334. cacheKey,
  6335. annotationStorage = null
  6336. } = _ref2;
  6337. const contentStreamPromise = this.getContentStream(handler);
  6338. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  6339. const partialEvaluator = new _evaluator.PartialEvaluator({
  6340. xref: this.xref,
  6341. handler,
  6342. pageIndex: this.pageIndex,
  6343. idFactory: this._localIdFactory,
  6344. fontCache: this.fontCache,
  6345. builtInCMapCache: this.builtInCMapCache,
  6346. standardFontDataCache: this.standardFontDataCache,
  6347. globalImageCache: this.globalImageCache,
  6348. options: this.evaluatorOptions
  6349. });
  6350. const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
  6351. let newAnnotationsPromise = Promise.resolve(null);
  6352. if (newAnnotationsByPage) {
  6353. const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
  6354. if (newAnnotations) {
  6355. newAnnotationsPromise = _annotation.AnnotationFactory.printNewAnnotations(partialEvaluator, task, newAnnotations);
  6356. }
  6357. }
  6358. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6359. const pageListPromise = dataPromises.then(_ref3 => {
  6360. let [contentStream] = _ref3;
  6361. const opList = new _operator_list.OperatorList(intent, sink);
  6362. handler.send("StartRenderPage", {
  6363. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  6364. pageIndex: this.pageIndex,
  6365. cacheKey
  6366. });
  6367. return partialEvaluator.getOperatorList({
  6368. stream: contentStream,
  6369. task,
  6370. resources: this.resources,
  6371. operatorList: opList
  6372. }).then(function () {
  6373. return opList;
  6374. });
  6375. });
  6376. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function (_ref4) {
  6377. let [pageOpList, annotations, newAnnotations] = _ref4;
  6378. if (newAnnotations) {
  6379. annotations = annotations.concat(newAnnotations);
  6380. }
  6381. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  6382. pageOpList.flush(true);
  6383. return {
  6384. length: pageOpList.totalLength
  6385. };
  6386. }
  6387. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  6388. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6389. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6390. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6391. const opListPromises = [];
  6392. for (const annotation of annotations) {
  6393. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  6394. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  6395. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  6396. return {
  6397. opList: null,
  6398. separateForm: false,
  6399. separateCanvas: false
  6400. };
  6401. }));
  6402. }
  6403. }
  6404. return Promise.all(opListPromises).then(function (opLists) {
  6405. let form = false,
  6406. canvas = false;
  6407. for (const {
  6408. opList,
  6409. separateForm,
  6410. separateCanvas
  6411. } of opLists) {
  6412. pageOpList.addOpList(opList);
  6413. if (separateForm) {
  6414. form = separateForm;
  6415. }
  6416. if (separateCanvas) {
  6417. canvas = separateCanvas;
  6418. }
  6419. }
  6420. pageOpList.flush(true, {
  6421. form,
  6422. canvas
  6423. });
  6424. return {
  6425. length: pageOpList.totalLength
  6426. };
  6427. });
  6428. });
  6429. }
  6430. extractTextContent(_ref5) {
  6431. let {
  6432. handler,
  6433. task,
  6434. includeMarkedContent,
  6435. sink,
  6436. combineTextItems
  6437. } = _ref5;
  6438. const contentStreamPromise = this.getContentStream(handler);
  6439. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  6440. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  6441. return dataPromises.then(_ref6 => {
  6442. let [contentStream] = _ref6;
  6443. const partialEvaluator = new _evaluator.PartialEvaluator({
  6444. xref: this.xref,
  6445. handler,
  6446. pageIndex: this.pageIndex,
  6447. idFactory: this._localIdFactory,
  6448. fontCache: this.fontCache,
  6449. builtInCMapCache: this.builtInCMapCache,
  6450. standardFontDataCache: this.standardFontDataCache,
  6451. globalImageCache: this.globalImageCache,
  6452. options: this.evaluatorOptions
  6453. });
  6454. return partialEvaluator.getTextContent({
  6455. stream: contentStream,
  6456. task,
  6457. resources: this.resources,
  6458. includeMarkedContent,
  6459. combineTextItems,
  6460. sink,
  6461. viewBox: this.view
  6462. });
  6463. });
  6464. }
  6465. async getStructTree() {
  6466. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  6467. if (!structTreeRoot) {
  6468. return null;
  6469. }
  6470. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  6471. return structTree.serializable;
  6472. }
  6473. _parseStructTree(structTreeRoot) {
  6474. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  6475. tree.parse();
  6476. return tree;
  6477. }
  6478. async getAnnotationsData(handler, task, intent) {
  6479. const annotations = await this._parsedAnnotations;
  6480. if (annotations.length === 0) {
  6481. return [];
  6482. }
  6483. const textContentPromises = [];
  6484. const annotationsData = [];
  6485. let partialEvaluator;
  6486. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  6487. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  6488. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  6489. for (const annotation of annotations) {
  6490. const isVisible = intentAny || intentDisplay && annotation.viewable;
  6491. if (isVisible || intentPrint && annotation.printable) {
  6492. annotationsData.push(annotation.data);
  6493. }
  6494. if (annotation.hasTextContent && isVisible) {
  6495. if (!partialEvaluator) {
  6496. partialEvaluator = new _evaluator.PartialEvaluator({
  6497. xref: this.xref,
  6498. handler,
  6499. pageIndex: this.pageIndex,
  6500. idFactory: this._localIdFactory,
  6501. fontCache: this.fontCache,
  6502. builtInCMapCache: this.builtInCMapCache,
  6503. standardFontDataCache: this.standardFontDataCache,
  6504. globalImageCache: this.globalImageCache,
  6505. options: this.evaluatorOptions
  6506. });
  6507. }
  6508. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, this.view).catch(function (reason) {
  6509. (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  6510. }));
  6511. }
  6512. }
  6513. await Promise.all(textContentPromises);
  6514. return annotationsData;
  6515. }
  6516. get annotations() {
  6517. const annots = this._getInheritableProperty("Annots");
  6518. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  6519. }
  6520. get _parsedAnnotations() {
  6521. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  6522. const annotationPromises = [];
  6523. for (const annotationRef of this.annotations) {
  6524. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  6525. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  6526. return null;
  6527. }));
  6528. }
  6529. return Promise.all(annotationPromises).then(function (annotations) {
  6530. if (annotations.length === 0) {
  6531. return annotations;
  6532. }
  6533. const sortedAnnotations = [];
  6534. let popupAnnotations;
  6535. for (const annotation of annotations) {
  6536. if (!annotation) {
  6537. continue;
  6538. }
  6539. if (annotation instanceof _annotation.PopupAnnotation) {
  6540. if (!popupAnnotations) {
  6541. popupAnnotations = [];
  6542. }
  6543. popupAnnotations.push(annotation);
  6544. continue;
  6545. }
  6546. sortedAnnotations.push(annotation);
  6547. }
  6548. if (popupAnnotations) {
  6549. sortedAnnotations.push(...popupAnnotations);
  6550. }
  6551. return sortedAnnotations;
  6552. });
  6553. });
  6554. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  6555. }
  6556. get jsActions() {
  6557. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  6558. return (0, _util.shadow)(this, "jsActions", actions);
  6559. }
  6560. }
  6561. exports.Page = Page;
  6562. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  6563. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  6564. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  6565. const FINGERPRINT_FIRST_BYTES = 1024;
  6566. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  6567. function find(stream, signature) {
  6568. let limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1024;
  6569. let backwards = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  6570. const signatureLength = signature.length;
  6571. const scanBytes = stream.peekBytes(limit);
  6572. const scanLength = scanBytes.length - signatureLength;
  6573. if (scanLength <= 0) {
  6574. return false;
  6575. }
  6576. if (backwards) {
  6577. const signatureEnd = signatureLength - 1;
  6578. let pos = scanBytes.length - 1;
  6579. while (pos >= signatureEnd) {
  6580. let j = 0;
  6581. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  6582. j++;
  6583. }
  6584. if (j >= signatureLength) {
  6585. stream.pos += pos - signatureEnd;
  6586. return true;
  6587. }
  6588. pos--;
  6589. }
  6590. } else {
  6591. let pos = 0;
  6592. while (pos <= scanLength) {
  6593. let j = 0;
  6594. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  6595. j++;
  6596. }
  6597. if (j >= signatureLength) {
  6598. stream.pos += pos;
  6599. return true;
  6600. }
  6601. pos++;
  6602. }
  6603. }
  6604. return false;
  6605. }
  6606. class PDFDocument {
  6607. constructor(pdfManager, stream) {
  6608. if (stream.length <= 0) {
  6609. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  6610. }
  6611. this.pdfManager = pdfManager;
  6612. this.stream = stream;
  6613. this.xref = new _xref.XRef(stream, pdfManager);
  6614. this._pagePromises = new Map();
  6615. this._version = null;
  6616. const idCounters = {
  6617. font: 0
  6618. };
  6619. this._globalIdFactory = class {
  6620. static getDocId() {
  6621. return `g_${pdfManager.docId}`;
  6622. }
  6623. static createFontId() {
  6624. return `f${++idCounters.font}`;
  6625. }
  6626. static createObjId() {
  6627. (0, _util.unreachable)("Abstract method `createObjId` called.");
  6628. }
  6629. static getPageObjId() {
  6630. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  6631. }
  6632. };
  6633. }
  6634. parse(recoveryMode) {
  6635. this.xref.parse(recoveryMode);
  6636. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  6637. }
  6638. get linearization() {
  6639. let linearization = null;
  6640. try {
  6641. linearization = _parser.Linearization.create(this.stream);
  6642. } catch (err) {
  6643. if (err instanceof _core_utils.MissingDataException) {
  6644. throw err;
  6645. }
  6646. (0, _util.info)(err);
  6647. }
  6648. return (0, _util.shadow)(this, "linearization", linearization);
  6649. }
  6650. get startXRef() {
  6651. const stream = this.stream;
  6652. let startXRef = 0;
  6653. if (this.linearization) {
  6654. stream.reset();
  6655. if (find(stream, ENDOBJ_SIGNATURE)) {
  6656. startXRef = stream.pos + 6 - stream.start;
  6657. }
  6658. } else {
  6659. const step = 1024;
  6660. const startXRefLength = STARTXREF_SIGNATURE.length;
  6661. let found = false,
  6662. pos = stream.end;
  6663. while (!found && pos > 0) {
  6664. pos -= step - startXRefLength;
  6665. if (pos < 0) {
  6666. pos = 0;
  6667. }
  6668. stream.pos = pos;
  6669. found = find(stream, STARTXREF_SIGNATURE, step, true);
  6670. }
  6671. if (found) {
  6672. stream.skip(9);
  6673. let ch;
  6674. do {
  6675. ch = stream.getByte();
  6676. } while ((0, _core_utils.isWhiteSpace)(ch));
  6677. let str = "";
  6678. while (ch >= 0x20 && ch <= 0x39) {
  6679. str += String.fromCharCode(ch);
  6680. ch = stream.getByte();
  6681. }
  6682. startXRef = parseInt(str, 10);
  6683. if (isNaN(startXRef)) {
  6684. startXRef = 0;
  6685. }
  6686. }
  6687. }
  6688. return (0, _util.shadow)(this, "startXRef", startXRef);
  6689. }
  6690. checkHeader() {
  6691. const stream = this.stream;
  6692. stream.reset();
  6693. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  6694. return;
  6695. }
  6696. stream.moveStart();
  6697. stream.skip(PDF_HEADER_SIGNATURE.length);
  6698. let version = "",
  6699. ch;
  6700. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  6701. version += String.fromCharCode(ch);
  6702. }
  6703. if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
  6704. this._version = version;
  6705. } else {
  6706. (0, _util.warn)(`Invalid PDF header version: ${version}`);
  6707. }
  6708. }
  6709. parseStartXRef() {
  6710. this.xref.setStartXRef(this.startXRef);
  6711. }
  6712. get numPages() {
  6713. let num = 0;
  6714. if (this.catalog.hasActualNumPages) {
  6715. num = this.catalog.numPages;
  6716. } else if (this.xfaFactory) {
  6717. num = this.xfaFactory.getNumPages();
  6718. } else if (this.linearization) {
  6719. num = this.linearization.numPages;
  6720. } else {
  6721. num = this.catalog.numPages;
  6722. }
  6723. return (0, _util.shadow)(this, "numPages", num);
  6724. }
  6725. _hasOnlyDocumentSignatures(fields) {
  6726. let recursionDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  6727. const RECURSION_LIMIT = 10;
  6728. if (!Array.isArray(fields)) {
  6729. return false;
  6730. }
  6731. return fields.every(field => {
  6732. field = this.xref.fetchIfRef(field);
  6733. if (!(field instanceof _primitives.Dict)) {
  6734. return false;
  6735. }
  6736. if (field.has("Kids")) {
  6737. if (++recursionDepth > RECURSION_LIMIT) {
  6738. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  6739. return false;
  6740. }
  6741. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  6742. }
  6743. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  6744. const rectangle = field.get("Rect");
  6745. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  6746. return isSignature && isInvisible;
  6747. });
  6748. }
  6749. get _xfaStreams() {
  6750. const acroForm = this.catalog.acroForm;
  6751. if (!acroForm) {
  6752. return null;
  6753. }
  6754. const xfa = acroForm.get("XFA");
  6755. const entries = {
  6756. "xdp:xdp": "",
  6757. template: "",
  6758. datasets: "",
  6759. config: "",
  6760. connectionSet: "",
  6761. localeSet: "",
  6762. stylesheet: "",
  6763. "/xdp:xdp": ""
  6764. };
  6765. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  6766. entries["xdp:xdp"] = xfa;
  6767. return entries;
  6768. }
  6769. if (!Array.isArray(xfa) || xfa.length === 0) {
  6770. return null;
  6771. }
  6772. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  6773. let name;
  6774. if (i === 0) {
  6775. name = "xdp:xdp";
  6776. } else if (i === ii - 2) {
  6777. name = "/xdp:xdp";
  6778. } else {
  6779. name = xfa[i];
  6780. }
  6781. if (!entries.hasOwnProperty(name)) {
  6782. continue;
  6783. }
  6784. const data = this.xref.fetchIfRef(xfa[i + 1]);
  6785. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  6786. continue;
  6787. }
  6788. entries[name] = data;
  6789. }
  6790. return entries;
  6791. }
  6792. get xfaDatasets() {
  6793. const streams = this._xfaStreams;
  6794. if (!streams) {
  6795. return (0, _util.shadow)(this, "xfaDatasets", null);
  6796. }
  6797. for (const key of ["datasets", "xdp:xdp"]) {
  6798. const stream = streams[key];
  6799. if (!stream) {
  6800. continue;
  6801. }
  6802. try {
  6803. const str = (0, _util.stringToUTF8String)(stream.getString());
  6804. const data = {
  6805. [key]: str
  6806. };
  6807. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  6808. } catch (_) {
  6809. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6810. break;
  6811. }
  6812. }
  6813. return (0, _util.shadow)(this, "xfaDatasets", null);
  6814. }
  6815. get xfaData() {
  6816. const streams = this._xfaStreams;
  6817. if (!streams) {
  6818. return null;
  6819. }
  6820. const data = Object.create(null);
  6821. for (const [key, stream] of Object.entries(streams)) {
  6822. if (!stream) {
  6823. continue;
  6824. }
  6825. try {
  6826. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  6827. } catch (_) {
  6828. (0, _util.warn)("XFA - Invalid utf-8 string.");
  6829. return null;
  6830. }
  6831. }
  6832. return data;
  6833. }
  6834. get xfaFactory() {
  6835. let data;
  6836. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  6837. data = this.xfaData;
  6838. }
  6839. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  6840. }
  6841. get isPureXfa() {
  6842. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  6843. }
  6844. get htmlForXfa() {
  6845. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  6846. }
  6847. async loadXfaImages() {
  6848. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  6849. if (!xfaImagesDict) {
  6850. return;
  6851. }
  6852. const keys = xfaImagesDict.getKeys();
  6853. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  6854. await objectLoader.load();
  6855. const xfaImages = new Map();
  6856. for (const key of keys) {
  6857. const stream = xfaImagesDict.get(key);
  6858. if (stream instanceof _base_stream.BaseStream) {
  6859. xfaImages.set(key, stream.getBytes());
  6860. }
  6861. }
  6862. this.xfaFactory.setImages(xfaImages);
  6863. }
  6864. async loadXfaFonts(handler, task) {
  6865. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  6866. if (!acroForm) {
  6867. return;
  6868. }
  6869. const resources = await acroForm.getAsync("DR");
  6870. if (!(resources instanceof _primitives.Dict)) {
  6871. return;
  6872. }
  6873. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  6874. await objectLoader.load();
  6875. const fontRes = resources.get("Font");
  6876. if (!(fontRes instanceof _primitives.Dict)) {
  6877. return;
  6878. }
  6879. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  6880. options.useSystemFonts = false;
  6881. const partialEvaluator = new _evaluator.PartialEvaluator({
  6882. xref: this.xref,
  6883. handler,
  6884. pageIndex: -1,
  6885. idFactory: this._globalIdFactory,
  6886. fontCache: this.catalog.fontCache,
  6887. builtInCMapCache: this.catalog.builtInCMapCache,
  6888. standardFontDataCache: this.catalog.standardFontDataCache,
  6889. options
  6890. });
  6891. const operatorList = new _operator_list.OperatorList();
  6892. const pdfFonts = [];
  6893. const initialState = {
  6894. get font() {
  6895. return pdfFonts.at(-1);
  6896. },
  6897. set font(font) {
  6898. pdfFonts.push(font);
  6899. },
  6900. clone() {
  6901. return this;
  6902. }
  6903. };
  6904. const fonts = new Map();
  6905. fontRes.forEach((fontName, font) => {
  6906. fonts.set(fontName, font);
  6907. });
  6908. const promises = [];
  6909. for (const [fontName, font] of fonts) {
  6910. const descriptor = font.get("FontDescriptor");
  6911. if (!(descriptor instanceof _primitives.Dict)) {
  6912. continue;
  6913. }
  6914. let fontFamily = descriptor.get("FontFamily");
  6915. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  6916. const fontWeight = descriptor.get("FontWeight");
  6917. const italicAngle = -descriptor.get("ItalicAngle");
  6918. const cssFontInfo = {
  6919. fontFamily,
  6920. fontWeight,
  6921. italicAngle
  6922. };
  6923. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  6924. continue;
  6925. }
  6926. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  6927. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  6928. return null;
  6929. }));
  6930. }
  6931. await Promise.all(promises);
  6932. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  6933. if (!missingFonts) {
  6934. return;
  6935. }
  6936. options.ignoreErrors = true;
  6937. promises.length = 0;
  6938. pdfFonts.length = 0;
  6939. const reallyMissingFonts = new Set();
  6940. for (const missing of missingFonts) {
  6941. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  6942. reallyMissingFonts.add(missing);
  6943. }
  6944. }
  6945. if (reallyMissingFonts.size) {
  6946. missingFonts.push("PdfJS-Fallback");
  6947. }
  6948. for (const missing of missingFonts) {
  6949. if (reallyMissingFonts.has(missing)) {
  6950. continue;
  6951. }
  6952. for (const fontInfo of [{
  6953. name: "Regular",
  6954. fontWeight: 400,
  6955. italicAngle: 0
  6956. }, {
  6957. name: "Bold",
  6958. fontWeight: 700,
  6959. italicAngle: 0
  6960. }, {
  6961. name: "Italic",
  6962. fontWeight: 400,
  6963. italicAngle: 12
  6964. }, {
  6965. name: "BoldItalic",
  6966. fontWeight: 700,
  6967. italicAngle: 12
  6968. }]) {
  6969. const name = `${missing}-${fontInfo.name}`;
  6970. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  6971. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  6972. fontFamily: missing,
  6973. fontWeight: fontInfo.fontWeight,
  6974. italicAngle: fontInfo.italicAngle
  6975. }).catch(function (reason) {
  6976. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  6977. return null;
  6978. }));
  6979. }
  6980. }
  6981. await Promise.all(promises);
  6982. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  6983. }
  6984. async serializeXfaData(annotationStorage) {
  6985. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  6986. }
  6987. get version() {
  6988. return this.catalog.version || this._version;
  6989. }
  6990. get formInfo() {
  6991. const formInfo = {
  6992. hasFields: false,
  6993. hasAcroForm: false,
  6994. hasXfa: false,
  6995. hasSignatures: false
  6996. };
  6997. const acroForm = this.catalog.acroForm;
  6998. if (!acroForm) {
  6999. return (0, _util.shadow)(this, "formInfo", formInfo);
  7000. }
  7001. try {
  7002. const fields = acroForm.get("Fields");
  7003. const hasFields = Array.isArray(fields) && fields.length > 0;
  7004. formInfo.hasFields = hasFields;
  7005. const xfa = acroForm.get("XFA");
  7006. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  7007. const sigFlags = acroForm.get("SigFlags");
  7008. const hasSignatures = !!(sigFlags & 0x1);
  7009. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  7010. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  7011. formInfo.hasSignatures = hasSignatures;
  7012. } catch (ex) {
  7013. if (ex instanceof _core_utils.MissingDataException) {
  7014. throw ex;
  7015. }
  7016. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  7017. }
  7018. return (0, _util.shadow)(this, "formInfo", formInfo);
  7019. }
  7020. get documentInfo() {
  7021. const docInfo = {
  7022. PDFFormatVersion: this.version,
  7023. Language: this.catalog.lang,
  7024. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  7025. IsLinearized: !!this.linearization,
  7026. IsAcroFormPresent: this.formInfo.hasAcroForm,
  7027. IsXFAPresent: this.formInfo.hasXfa,
  7028. IsCollectionPresent: !!this.catalog.collection,
  7029. IsSignaturesPresent: this.formInfo.hasSignatures
  7030. };
  7031. let infoDict;
  7032. try {
  7033. infoDict = this.xref.trailer.get("Info");
  7034. } catch (err) {
  7035. if (err instanceof _core_utils.MissingDataException) {
  7036. throw err;
  7037. }
  7038. (0, _util.info)("The document information dictionary is invalid.");
  7039. }
  7040. if (!(infoDict instanceof _primitives.Dict)) {
  7041. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7042. }
  7043. for (const key of infoDict.getKeys()) {
  7044. const value = infoDict.get(key);
  7045. switch (key) {
  7046. case "Title":
  7047. case "Author":
  7048. case "Subject":
  7049. case "Keywords":
  7050. case "Creator":
  7051. case "Producer":
  7052. case "CreationDate":
  7053. case "ModDate":
  7054. if (typeof value === "string") {
  7055. docInfo[key] = (0, _util.stringToPDFString)(value);
  7056. continue;
  7057. }
  7058. break;
  7059. case "Trapped":
  7060. if (value instanceof _primitives.Name) {
  7061. docInfo[key] = value;
  7062. continue;
  7063. }
  7064. break;
  7065. default:
  7066. let customValue;
  7067. switch (typeof value) {
  7068. case "string":
  7069. customValue = (0, _util.stringToPDFString)(value);
  7070. break;
  7071. case "number":
  7072. case "boolean":
  7073. customValue = value;
  7074. break;
  7075. default:
  7076. if (value instanceof _primitives.Name) {
  7077. customValue = value;
  7078. }
  7079. break;
  7080. }
  7081. if (customValue === undefined) {
  7082. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  7083. continue;
  7084. }
  7085. if (!docInfo.Custom) {
  7086. docInfo.Custom = Object.create(null);
  7087. }
  7088. docInfo.Custom[key] = customValue;
  7089. continue;
  7090. }
  7091. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  7092. }
  7093. return (0, _util.shadow)(this, "documentInfo", docInfo);
  7094. }
  7095. get fingerprints() {
  7096. function validate(data) {
  7097. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  7098. }
  7099. function hexString(hash) {
  7100. const buf = [];
  7101. for (const num of hash) {
  7102. const hex = num.toString(16);
  7103. buf.push(hex.padStart(2, "0"));
  7104. }
  7105. return buf.join("");
  7106. }
  7107. const idArray = this.xref.trailer.get("ID");
  7108. let hashOriginal, hashModified;
  7109. if (Array.isArray(idArray) && validate(idArray[0])) {
  7110. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  7111. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  7112. hashModified = (0, _util.stringToBytes)(idArray[1]);
  7113. }
  7114. } else {
  7115. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  7116. }
  7117. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  7118. }
  7119. async _getLinearizationPage(pageIndex) {
  7120. const {
  7121. catalog,
  7122. linearization,
  7123. xref
  7124. } = this;
  7125. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  7126. try {
  7127. const obj = await xref.fetchAsync(ref);
  7128. if (obj instanceof _primitives.Dict) {
  7129. let type = obj.getRaw("Type");
  7130. if (type instanceof _primitives.Ref) {
  7131. type = await xref.fetchAsync(type);
  7132. }
  7133. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  7134. if (!catalog.pageKidsCountCache.has(ref)) {
  7135. catalog.pageKidsCountCache.put(ref, 1);
  7136. }
  7137. if (!catalog.pageIndexCache.has(ref)) {
  7138. catalog.pageIndexCache.put(ref, 0);
  7139. }
  7140. return [obj, ref];
  7141. }
  7142. }
  7143. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  7144. } catch (reason) {
  7145. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  7146. return catalog.getPageDict(pageIndex);
  7147. }
  7148. }
  7149. getPage(pageIndex) {
  7150. const cachedPromise = this._pagePromises.get(pageIndex);
  7151. if (cachedPromise) {
  7152. return cachedPromise;
  7153. }
  7154. const {
  7155. catalog,
  7156. linearization,
  7157. xfaFactory
  7158. } = this;
  7159. let promise;
  7160. if (xfaFactory) {
  7161. promise = Promise.resolve([_primitives.Dict.empty, null]);
  7162. } else if (linearization && linearization.pageFirst === pageIndex) {
  7163. promise = this._getLinearizationPage(pageIndex);
  7164. } else {
  7165. promise = catalog.getPageDict(pageIndex);
  7166. }
  7167. promise = promise.then(_ref7 => {
  7168. let [pageDict, ref] = _ref7;
  7169. return new Page({
  7170. pdfManager: this.pdfManager,
  7171. xref: this.xref,
  7172. pageIndex,
  7173. pageDict,
  7174. ref,
  7175. globalIdFactory: this._globalIdFactory,
  7176. fontCache: catalog.fontCache,
  7177. builtInCMapCache: catalog.builtInCMapCache,
  7178. standardFontDataCache: catalog.standardFontDataCache,
  7179. globalImageCache: catalog.globalImageCache,
  7180. nonBlendModesSet: catalog.nonBlendModesSet,
  7181. xfaFactory
  7182. });
  7183. });
  7184. this._pagePromises.set(pageIndex, promise);
  7185. return promise;
  7186. }
  7187. async checkFirstPage() {
  7188. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7189. if (recoveryMode) {
  7190. return;
  7191. }
  7192. try {
  7193. await this.getPage(0);
  7194. } catch (reason) {
  7195. if (reason instanceof _core_utils.XRefEntryException) {
  7196. this._pagePromises.delete(0);
  7197. await this.cleanup();
  7198. throw new _core_utils.XRefParseException();
  7199. }
  7200. }
  7201. }
  7202. async checkLastPage() {
  7203. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7204. const {
  7205. catalog,
  7206. pdfManager
  7207. } = this;
  7208. catalog.setActualNumPages();
  7209. let numPages;
  7210. try {
  7211. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  7212. if (this.xfaFactory) {
  7213. return;
  7214. } else if (this.linearization) {
  7215. numPages = this.linearization.numPages;
  7216. } else {
  7217. numPages = catalog.numPages;
  7218. }
  7219. if (!Number.isInteger(numPages)) {
  7220. throw new _util.FormatError("Page count is not an integer.");
  7221. } else if (numPages <= 1) {
  7222. return;
  7223. }
  7224. await this.getPage(numPages - 1);
  7225. } catch (reason) {
  7226. this._pagePromises.delete(numPages - 1);
  7227. await this.cleanup();
  7228. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7229. throw new _core_utils.XRefParseException();
  7230. }
  7231. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  7232. let pagesTree;
  7233. try {
  7234. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  7235. } catch (reasonAll) {
  7236. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  7237. throw new _core_utils.XRefParseException();
  7238. }
  7239. catalog.setActualNumPages(1);
  7240. return;
  7241. }
  7242. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  7243. let promise;
  7244. if (pageDict instanceof Error) {
  7245. promise = Promise.reject(pageDict);
  7246. promise.catch(() => {});
  7247. } else {
  7248. promise = Promise.resolve(new Page({
  7249. pdfManager,
  7250. xref: this.xref,
  7251. pageIndex,
  7252. pageDict,
  7253. ref,
  7254. globalIdFactory: this._globalIdFactory,
  7255. fontCache: catalog.fontCache,
  7256. builtInCMapCache: catalog.builtInCMapCache,
  7257. standardFontDataCache: catalog.standardFontDataCache,
  7258. globalImageCache: catalog.globalImageCache,
  7259. nonBlendModesSet: catalog.nonBlendModesSet,
  7260. xfaFactory: null
  7261. }));
  7262. }
  7263. this._pagePromises.set(pageIndex, promise);
  7264. }
  7265. catalog.setActualNumPages(pagesTree.size);
  7266. }
  7267. }
  7268. fontFallback(id, handler) {
  7269. return this.catalog.fontFallback(id, handler);
  7270. }
  7271. async cleanup() {
  7272. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7273. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  7274. }
  7275. _collectFieldObjects(name, fieldRef, promises) {
  7276. const field = this.xref.fetchIfRef(fieldRef);
  7277. if (field.has("T")) {
  7278. const partName = (0, _util.stringToPDFString)(field.get("T"));
  7279. if (name === "") {
  7280. name = partName;
  7281. } else {
  7282. name = `${name}.${partName}`;
  7283. }
  7284. }
  7285. if (!promises.has(name)) {
  7286. promises.set(name, []);
  7287. }
  7288. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  7289. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  7290. return null;
  7291. }));
  7292. if (field.has("Kids")) {
  7293. const kids = field.get("Kids");
  7294. for (const kid of kids) {
  7295. this._collectFieldObjects(name, kid, promises);
  7296. }
  7297. }
  7298. }
  7299. get fieldObjects() {
  7300. if (!this.formInfo.hasFields) {
  7301. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  7302. }
  7303. const allFields = Object.create(null);
  7304. const fieldPromises = new Map();
  7305. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  7306. this._collectFieldObjects("", fieldRef, fieldPromises);
  7307. }
  7308. const allPromises = [];
  7309. for (const [name, promises] of fieldPromises) {
  7310. allPromises.push(Promise.all(promises).then(fields => {
  7311. fields = fields.filter(field => !!field);
  7312. if (fields.length > 0) {
  7313. allFields[name] = fields;
  7314. }
  7315. }));
  7316. }
  7317. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  7318. }
  7319. get hasJSActions() {
  7320. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  7321. return (0, _util.shadow)(this, "hasJSActions", promise);
  7322. }
  7323. async _parseHasJSActions() {
  7324. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  7325. if (catalogJsActions) {
  7326. return true;
  7327. }
  7328. if (fieldObjects) {
  7329. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  7330. }
  7331. return false;
  7332. }
  7333. get calculationOrderIds() {
  7334. const acroForm = this.catalog.acroForm;
  7335. if (!acroForm || !acroForm.has("CO")) {
  7336. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7337. }
  7338. const calculationOrder = acroForm.get("CO");
  7339. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  7340. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7341. }
  7342. const ids = [];
  7343. for (const id of calculationOrder) {
  7344. if (id instanceof _primitives.Ref) {
  7345. ids.push(id.toString());
  7346. }
  7347. }
  7348. if (ids.length === 0) {
  7349. return (0, _util.shadow)(this, "calculationOrderIds", null);
  7350. }
  7351. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  7352. }
  7353. }
  7354. exports.PDFDocument = PDFDocument;
  7355. /***/ }),
  7356. /* 141 */
  7357. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7358. "use strict";
  7359. Object.defineProperty(exports, "__esModule", ({
  7360. value: true
  7361. }));
  7362. exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  7363. exports.getQuadPoints = getQuadPoints;
  7364. var _util = __w_pdfjs_require__(2);
  7365. var _core_utils = __w_pdfjs_require__(135);
  7366. var _default_appearance = __w_pdfjs_require__(142);
  7367. var _primitives = __w_pdfjs_require__(134);
  7368. var _writer = __w_pdfjs_require__(194);
  7369. var _base_stream = __w_pdfjs_require__(136);
  7370. var _bidi = __w_pdfjs_require__(189);
  7371. var _catalog = __w_pdfjs_require__(198);
  7372. var _colorspace = __w_pdfjs_require__(143);
  7373. var _file_spec = __w_pdfjs_require__(201);
  7374. var _object_loader = __w_pdfjs_require__(204);
  7375. var _operator_list = __w_pdfjs_require__(191);
  7376. var _stream = __w_pdfjs_require__(139);
  7377. var _factory = __w_pdfjs_require__(205);
  7378. class AnnotationFactory {
  7379. static create(xref, ref, pdfManager, idFactory, collectFields) {
  7380. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(_ref => {
  7381. let [acroForm, baseUrl, attachments, xfaDatasets, pageIndex] = _ref;
  7382. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, attachments, xfaDatasets, collectFields, pageIndex]);
  7383. });
  7384. }
  7385. static _create(xref, ref, pdfManager, idFactory, acroForm) {
  7386. let attachments = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  7387. let xfaDatasets = arguments.length > 6 ? arguments[6] : undefined;
  7388. let collectFields = arguments.length > 7 ? arguments[7] : undefined;
  7389. let pageIndex = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : -1;
  7390. const dict = xref.fetchIfRef(ref);
  7391. if (!(dict instanceof _primitives.Dict)) {
  7392. return undefined;
  7393. }
  7394. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  7395. let subtype = dict.get("Subtype");
  7396. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  7397. const parameters = {
  7398. xref,
  7399. ref,
  7400. dict,
  7401. subtype,
  7402. id,
  7403. pdfManager,
  7404. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  7405. attachments,
  7406. xfaDatasets,
  7407. collectFields,
  7408. pageIndex
  7409. };
  7410. switch (subtype) {
  7411. case "Link":
  7412. return new LinkAnnotation(parameters);
  7413. case "Text":
  7414. return new TextAnnotation(parameters);
  7415. case "Widget":
  7416. let fieldType = (0, _core_utils.getInheritableProperty)({
  7417. dict,
  7418. key: "FT"
  7419. });
  7420. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  7421. switch (fieldType) {
  7422. case "Tx":
  7423. return new TextWidgetAnnotation(parameters);
  7424. case "Btn":
  7425. return new ButtonWidgetAnnotation(parameters);
  7426. case "Ch":
  7427. return new ChoiceWidgetAnnotation(parameters);
  7428. case "Sig":
  7429. return new SignatureWidgetAnnotation(parameters);
  7430. }
  7431. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  7432. return new WidgetAnnotation(parameters);
  7433. case "Popup":
  7434. return new PopupAnnotation(parameters);
  7435. case "FreeText":
  7436. return new FreeTextAnnotation(parameters);
  7437. case "Line":
  7438. return new LineAnnotation(parameters);
  7439. case "Square":
  7440. return new SquareAnnotation(parameters);
  7441. case "Circle":
  7442. return new CircleAnnotation(parameters);
  7443. case "PolyLine":
  7444. return new PolylineAnnotation(parameters);
  7445. case "Polygon":
  7446. return new PolygonAnnotation(parameters);
  7447. case "Caret":
  7448. return new CaretAnnotation(parameters);
  7449. case "Ink":
  7450. return new InkAnnotation(parameters);
  7451. case "Highlight":
  7452. return new HighlightAnnotation(parameters);
  7453. case "Underline":
  7454. return new UnderlineAnnotation(parameters);
  7455. case "Squiggly":
  7456. return new SquigglyAnnotation(parameters);
  7457. case "StrikeOut":
  7458. return new StrikeOutAnnotation(parameters);
  7459. case "Stamp":
  7460. return new StampAnnotation(parameters);
  7461. case "FileAttachment":
  7462. return new FileAttachmentAnnotation(parameters);
  7463. default:
  7464. if (!collectFields) {
  7465. if (!subtype) {
  7466. (0, _util.warn)("Annotation is missing the required /Subtype.");
  7467. } else {
  7468. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  7469. }
  7470. }
  7471. return new Annotation(parameters);
  7472. }
  7473. }
  7474. static async _getPageIndex(xref, ref, pdfManager) {
  7475. try {
  7476. const annotDict = await xref.fetchIfRefAsync(ref);
  7477. if (!(annotDict instanceof _primitives.Dict)) {
  7478. return -1;
  7479. }
  7480. const pageRef = annotDict.getRaw("P");
  7481. if (!(pageRef instanceof _primitives.Ref)) {
  7482. return -1;
  7483. }
  7484. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  7485. return pageIndex;
  7486. } catch (ex) {
  7487. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  7488. return -1;
  7489. }
  7490. }
  7491. static async saveNewAnnotations(evaluator, task, annotations) {
  7492. const xref = evaluator.xref;
  7493. let baseFontRef;
  7494. const dependencies = [];
  7495. const promises = [];
  7496. for (const annotation of annotations) {
  7497. switch (annotation.annotationType) {
  7498. case _util.AnnotationEditorType.FREETEXT:
  7499. if (!baseFontRef) {
  7500. const baseFont = new _primitives.Dict(xref);
  7501. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  7502. baseFont.set("Type", _primitives.Name.get("Font"));
  7503. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  7504. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  7505. const buffer = [];
  7506. baseFontRef = xref.getNewRef();
  7507. (0, _writer.writeObject)(baseFontRef, baseFont, buffer, null);
  7508. dependencies.push({
  7509. ref: baseFontRef,
  7510. data: buffer.join("")
  7511. });
  7512. }
  7513. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
  7514. evaluator,
  7515. task,
  7516. baseFontRef
  7517. }));
  7518. break;
  7519. case _util.AnnotationEditorType.INK:
  7520. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
  7521. }
  7522. }
  7523. return {
  7524. annotations: await Promise.all(promises),
  7525. dependencies
  7526. };
  7527. }
  7528. static async printNewAnnotations(evaluator, task, annotations) {
  7529. if (!annotations) {
  7530. return null;
  7531. }
  7532. const xref = evaluator.xref;
  7533. const promises = [];
  7534. for (const annotation of annotations) {
  7535. switch (annotation.annotationType) {
  7536. case _util.AnnotationEditorType.FREETEXT:
  7537. promises.push(FreeTextAnnotation.createNewPrintAnnotation(xref, annotation, {
  7538. evaluator,
  7539. task
  7540. }));
  7541. break;
  7542. case _util.AnnotationEditorType.INK:
  7543. promises.push(InkAnnotation.createNewPrintAnnotation(xref, annotation));
  7544. break;
  7545. }
  7546. }
  7547. return Promise.all(promises);
  7548. }
  7549. }
  7550. exports.AnnotationFactory = AnnotationFactory;
  7551. function getRgbColor(color) {
  7552. let defaultColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Uint8ClampedArray(3);
  7553. if (!Array.isArray(color)) {
  7554. return defaultColor;
  7555. }
  7556. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  7557. switch (color.length) {
  7558. case 0:
  7559. return null;
  7560. case 1:
  7561. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  7562. return rgbColor;
  7563. case 3:
  7564. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  7565. return rgbColor;
  7566. case 4:
  7567. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  7568. return rgbColor;
  7569. default:
  7570. return defaultColor;
  7571. }
  7572. }
  7573. function getQuadPoints(dict, rect) {
  7574. if (!dict.has("QuadPoints")) {
  7575. return null;
  7576. }
  7577. const quadPoints = dict.getArray("QuadPoints");
  7578. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  7579. return null;
  7580. }
  7581. const quadPointsLists = [];
  7582. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  7583. quadPointsLists.push([]);
  7584. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  7585. const x = quadPoints[j];
  7586. const y = quadPoints[j + 1];
  7587. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  7588. return null;
  7589. }
  7590. quadPointsLists[i].push({
  7591. x,
  7592. y
  7593. });
  7594. }
  7595. }
  7596. return quadPointsLists.map(quadPointsList => {
  7597. const [minX, maxX, minY, maxY] = quadPointsList.reduce((_ref2, quadPoint) => {
  7598. let [mX, MX, mY, MY] = _ref2;
  7599. return [Math.min(mX, quadPoint.x), Math.max(MX, quadPoint.x), Math.min(mY, quadPoint.y), Math.max(MY, quadPoint.y)];
  7600. }, [Number.MAX_VALUE, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_VALUE]);
  7601. return [{
  7602. x: minX,
  7603. y: maxY
  7604. }, {
  7605. x: maxX,
  7606. y: maxY
  7607. }, {
  7608. x: minX,
  7609. y: minY
  7610. }, {
  7611. x: maxX,
  7612. y: minY
  7613. }];
  7614. });
  7615. }
  7616. function getTransformMatrix(rect, bbox, matrix) {
  7617. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  7618. if (minX === maxX || minY === maxY) {
  7619. return [1, 0, 0, 1, rect[0], rect[1]];
  7620. }
  7621. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  7622. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  7623. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  7624. }
  7625. class Annotation {
  7626. constructor(params) {
  7627. const dict = params.dict;
  7628. this.setTitle(dict.get("T"));
  7629. this.setContents(dict.get("Contents"));
  7630. this.setModificationDate(dict.get("M"));
  7631. this.setFlags(dict.get("F"));
  7632. this.setRectangle(dict.getArray("Rect"));
  7633. this.setColor(dict.getArray("C"));
  7634. this.setBorderStyle(dict);
  7635. this.setAppearance(dict);
  7636. this.setOptionalContent(dict);
  7637. const MK = dict.get("MK");
  7638. this.setBorderAndBackgroundColors(MK);
  7639. this.setRotation(MK);
  7640. this._streams = [];
  7641. if (this.appearance) {
  7642. this._streams.push(this.appearance);
  7643. }
  7644. this.data = {
  7645. annotationFlags: this.flags,
  7646. borderStyle: this.borderStyle,
  7647. color: this.color,
  7648. backgroundColor: this.backgroundColor,
  7649. borderColor: this.borderColor,
  7650. rotation: this.rotation,
  7651. contentsObj: this._contents,
  7652. hasAppearance: !!this.appearance,
  7653. id: params.id,
  7654. modificationDate: this.modificationDate,
  7655. rect: this.rectangle,
  7656. subtype: params.subtype,
  7657. hasOwnCanvas: false
  7658. };
  7659. if (params.collectFields) {
  7660. const kids = dict.get("Kids");
  7661. if (Array.isArray(kids)) {
  7662. const kidIds = [];
  7663. for (const kid of kids) {
  7664. if (kid instanceof _primitives.Ref) {
  7665. kidIds.push(kid.toString());
  7666. }
  7667. }
  7668. if (kidIds.length !== 0) {
  7669. this.data.kidIds = kidIds;
  7670. }
  7671. }
  7672. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  7673. this.data.fieldName = this._constructFieldName(dict);
  7674. this.data.pageIndex = params.pageIndex;
  7675. }
  7676. this._fallbackFontDict = null;
  7677. }
  7678. _hasFlag(flags, flag) {
  7679. return !!(flags & flag);
  7680. }
  7681. _isViewable(flags) {
  7682. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  7683. }
  7684. _isPrintable(flags) {
  7685. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  7686. }
  7687. mustBeViewed(annotationStorage) {
  7688. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7689. if (storageEntry && storageEntry.hidden !== undefined) {
  7690. return !storageEntry.hidden;
  7691. }
  7692. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  7693. }
  7694. mustBePrinted(annotationStorage) {
  7695. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  7696. if (storageEntry && storageEntry.print !== undefined) {
  7697. return storageEntry.print;
  7698. }
  7699. return this.printable;
  7700. }
  7701. get viewable() {
  7702. if (this.data.quadPoints === null) {
  7703. return false;
  7704. }
  7705. if (this.flags === 0) {
  7706. return true;
  7707. }
  7708. return this._isViewable(this.flags);
  7709. }
  7710. get printable() {
  7711. if (this.data.quadPoints === null) {
  7712. return false;
  7713. }
  7714. if (this.flags === 0) {
  7715. return false;
  7716. }
  7717. return this._isPrintable(this.flags);
  7718. }
  7719. _parseStringHelper(data) {
  7720. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  7721. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  7722. return {
  7723. str,
  7724. dir
  7725. };
  7726. }
  7727. setTitle(title) {
  7728. this._title = this._parseStringHelper(title);
  7729. }
  7730. setContents(contents) {
  7731. this._contents = this._parseStringHelper(contents);
  7732. }
  7733. setModificationDate(modificationDate) {
  7734. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  7735. }
  7736. setFlags(flags) {
  7737. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  7738. }
  7739. hasFlag(flag) {
  7740. return this._hasFlag(this.flags, flag);
  7741. }
  7742. setRectangle(rectangle) {
  7743. if (Array.isArray(rectangle) && rectangle.length === 4) {
  7744. this.rectangle = _util.Util.normalizeRect(rectangle);
  7745. } else {
  7746. this.rectangle = [0, 0, 0, 0];
  7747. }
  7748. }
  7749. setColor(color) {
  7750. this.color = getRgbColor(color);
  7751. }
  7752. setLineEndings(lineEndings) {
  7753. this.lineEndings = ["None", "None"];
  7754. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  7755. for (let i = 0; i < 2; i++) {
  7756. const obj = lineEndings[i];
  7757. if (obj instanceof _primitives.Name) {
  7758. switch (obj.name) {
  7759. case "None":
  7760. continue;
  7761. case "Square":
  7762. case "Circle":
  7763. case "Diamond":
  7764. case "OpenArrow":
  7765. case "ClosedArrow":
  7766. case "Butt":
  7767. case "ROpenArrow":
  7768. case "RClosedArrow":
  7769. case "Slash":
  7770. this.lineEndings[i] = obj.name;
  7771. continue;
  7772. }
  7773. }
  7774. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  7775. }
  7776. }
  7777. }
  7778. setRotation(mk) {
  7779. this.rotation = 0;
  7780. if (mk instanceof _primitives.Dict) {
  7781. let angle = mk.get("R") || 0;
  7782. if (Number.isInteger(angle) && angle !== 0) {
  7783. angle %= 360;
  7784. if (angle < 0) {
  7785. angle += 360;
  7786. }
  7787. if (angle % 90 === 0) {
  7788. this.rotation = angle;
  7789. }
  7790. }
  7791. }
  7792. }
  7793. setBorderAndBackgroundColors(mk) {
  7794. if (mk instanceof _primitives.Dict) {
  7795. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  7796. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  7797. } else {
  7798. this.borderColor = this.backgroundColor = null;
  7799. }
  7800. }
  7801. setBorderStyle(borderStyle) {
  7802. this.borderStyle = new AnnotationBorderStyle();
  7803. if (!(borderStyle instanceof _primitives.Dict)) {
  7804. return;
  7805. }
  7806. if (borderStyle.has("BS")) {
  7807. const dict = borderStyle.get("BS");
  7808. const dictType = dict.get("Type");
  7809. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  7810. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  7811. this.borderStyle.setStyle(dict.get("S"));
  7812. this.borderStyle.setDashArray(dict.getArray("D"));
  7813. }
  7814. } else if (borderStyle.has("Border")) {
  7815. const array = borderStyle.getArray("Border");
  7816. if (Array.isArray(array) && array.length >= 3) {
  7817. this.borderStyle.setHorizontalCornerRadius(array[0]);
  7818. this.borderStyle.setVerticalCornerRadius(array[1]);
  7819. this.borderStyle.setWidth(array[2], this.rectangle);
  7820. if (array.length === 4) {
  7821. this.borderStyle.setDashArray(array[3], true);
  7822. }
  7823. }
  7824. } else {
  7825. this.borderStyle.setWidth(0);
  7826. }
  7827. }
  7828. setAppearance(dict) {
  7829. this.appearance = null;
  7830. const appearanceStates = dict.get("AP");
  7831. if (!(appearanceStates instanceof _primitives.Dict)) {
  7832. return;
  7833. }
  7834. const normalAppearanceState = appearanceStates.get("N");
  7835. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  7836. this.appearance = normalAppearanceState;
  7837. return;
  7838. }
  7839. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  7840. return;
  7841. }
  7842. const as = dict.get("AS");
  7843. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  7844. return;
  7845. }
  7846. this.appearance = normalAppearanceState.get(as.name);
  7847. }
  7848. setOptionalContent(dict) {
  7849. this.oc = null;
  7850. const oc = dict.get("OC");
  7851. if (oc instanceof _primitives.Name) {
  7852. (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
  7853. } else if (oc instanceof _primitives.Dict) {
  7854. this.oc = oc;
  7855. }
  7856. }
  7857. loadResources(keys, appearance) {
  7858. return appearance.dict.getAsync("Resources").then(resources => {
  7859. if (!resources) {
  7860. return undefined;
  7861. }
  7862. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  7863. return objectLoader.load().then(function () {
  7864. return resources;
  7865. });
  7866. });
  7867. }
  7868. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  7869. const data = this.data;
  7870. let appearance = this.appearance;
  7871. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
  7872. if (!appearance) {
  7873. if (!isUsingOwnCanvas) {
  7874. return {
  7875. opList: new _operator_list.OperatorList(),
  7876. separateForm: false,
  7877. separateCanvas: false
  7878. };
  7879. }
  7880. appearance = new _stream.StringStream("");
  7881. appearance.dict = new _primitives.Dict();
  7882. }
  7883. const appearanceDict = appearance.dict;
  7884. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  7885. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  7886. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  7887. const transform = getTransformMatrix(data.rect, bbox, matrix);
  7888. const opList = new _operator_list.OperatorList();
  7889. let optionalContent;
  7890. if (this.oc) {
  7891. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  7892. }
  7893. if (optionalContent !== undefined) {
  7894. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  7895. }
  7896. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  7897. await evaluator.getOperatorList({
  7898. stream: appearance,
  7899. task,
  7900. resources,
  7901. operatorList: opList,
  7902. fallbackFontDict: this._fallbackFontDict
  7903. });
  7904. opList.addOp(_util.OPS.endAnnotation, []);
  7905. if (optionalContent !== undefined) {
  7906. opList.addOp(_util.OPS.endMarkedContent, []);
  7907. }
  7908. this.reset();
  7909. return {
  7910. opList,
  7911. separateForm: false,
  7912. separateCanvas: isUsingOwnCanvas
  7913. };
  7914. }
  7915. async save(evaluator, task, annotationStorage) {
  7916. return null;
  7917. }
  7918. get hasTextContent() {
  7919. return false;
  7920. }
  7921. async extractTextContent(evaluator, task, viewBox) {
  7922. if (!this.appearance) {
  7923. return;
  7924. }
  7925. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  7926. const text = [];
  7927. const buffer = [];
  7928. const sink = {
  7929. desiredSize: Math.Infinity,
  7930. ready: true,
  7931. enqueue(chunk, size) {
  7932. for (const item of chunk.items) {
  7933. buffer.push(item.str);
  7934. if (item.hasEOL) {
  7935. text.push(buffer.join(""));
  7936. buffer.length = 0;
  7937. }
  7938. }
  7939. }
  7940. };
  7941. await evaluator.getTextContent({
  7942. stream: this.appearance,
  7943. task,
  7944. resources,
  7945. includeMarkedContent: true,
  7946. combineTextItems: true,
  7947. sink,
  7948. viewBox
  7949. });
  7950. this.reset();
  7951. if (buffer.length) {
  7952. text.push(buffer.join(""));
  7953. }
  7954. if (text.length > 0) {
  7955. this.data.textContent = text;
  7956. }
  7957. }
  7958. getFieldObject() {
  7959. if (this.data.kidIds) {
  7960. return {
  7961. id: this.data.id,
  7962. actions: this.data.actions,
  7963. name: this.data.fieldName,
  7964. strokeColor: this.data.borderColor,
  7965. fillColor: this.data.backgroundColor,
  7966. type: "",
  7967. kidIds: this.data.kidIds,
  7968. page: this.data.pageIndex,
  7969. rotation: this.rotation
  7970. };
  7971. }
  7972. return null;
  7973. }
  7974. reset() {
  7975. for (const stream of this._streams) {
  7976. stream.reset();
  7977. }
  7978. }
  7979. _constructFieldName(dict) {
  7980. if (!dict.has("T") && !dict.has("Parent")) {
  7981. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  7982. return "";
  7983. }
  7984. if (!dict.has("Parent")) {
  7985. return (0, _util.stringToPDFString)(dict.get("T"));
  7986. }
  7987. const fieldName = [];
  7988. if (dict.has("T")) {
  7989. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  7990. }
  7991. let loopDict = dict;
  7992. const visited = new _primitives.RefSet();
  7993. if (dict.objId) {
  7994. visited.put(dict.objId);
  7995. }
  7996. while (loopDict.has("Parent")) {
  7997. loopDict = loopDict.get("Parent");
  7998. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  7999. break;
  8000. }
  8001. if (loopDict.objId) {
  8002. visited.put(loopDict.objId);
  8003. }
  8004. if (loopDict.has("T")) {
  8005. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  8006. }
  8007. }
  8008. return fieldName.join(".");
  8009. }
  8010. }
  8011. exports.Annotation = Annotation;
  8012. class AnnotationBorderStyle {
  8013. constructor() {
  8014. this.width = 1;
  8015. this.style = _util.AnnotationBorderStyleType.SOLID;
  8016. this.dashArray = [3];
  8017. this.horizontalCornerRadius = 0;
  8018. this.verticalCornerRadius = 0;
  8019. }
  8020. setWidth(width) {
  8021. let rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
  8022. if (width instanceof _primitives.Name) {
  8023. this.width = 0;
  8024. return;
  8025. }
  8026. if (typeof width === "number") {
  8027. if (width > 0) {
  8028. const maxWidth = (rect[2] - rect[0]) / 2;
  8029. const maxHeight = (rect[3] - rect[1]) / 2;
  8030. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  8031. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  8032. width = 1;
  8033. }
  8034. }
  8035. this.width = width;
  8036. }
  8037. }
  8038. setStyle(style) {
  8039. if (!(style instanceof _primitives.Name)) {
  8040. return;
  8041. }
  8042. switch (style.name) {
  8043. case "S":
  8044. this.style = _util.AnnotationBorderStyleType.SOLID;
  8045. break;
  8046. case "D":
  8047. this.style = _util.AnnotationBorderStyleType.DASHED;
  8048. break;
  8049. case "B":
  8050. this.style = _util.AnnotationBorderStyleType.BEVELED;
  8051. break;
  8052. case "I":
  8053. this.style = _util.AnnotationBorderStyleType.INSET;
  8054. break;
  8055. case "U":
  8056. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  8057. break;
  8058. default:
  8059. break;
  8060. }
  8061. }
  8062. setDashArray(dashArray) {
  8063. let forceStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  8064. if (Array.isArray(dashArray) && dashArray.length > 0) {
  8065. let isValid = true;
  8066. let allZeros = true;
  8067. for (const element of dashArray) {
  8068. const validNumber = +element >= 0;
  8069. if (!validNumber) {
  8070. isValid = false;
  8071. break;
  8072. } else if (element > 0) {
  8073. allZeros = false;
  8074. }
  8075. }
  8076. if (isValid && !allZeros) {
  8077. this.dashArray = dashArray;
  8078. if (forceStyle) {
  8079. this.setStyle(_primitives.Name.get("D"));
  8080. }
  8081. } else {
  8082. this.width = 0;
  8083. }
  8084. } else if (dashArray) {
  8085. this.width = 0;
  8086. }
  8087. }
  8088. setHorizontalCornerRadius(radius) {
  8089. if (Number.isInteger(radius)) {
  8090. this.horizontalCornerRadius = radius;
  8091. }
  8092. }
  8093. setVerticalCornerRadius(radius) {
  8094. if (Number.isInteger(radius)) {
  8095. this.verticalCornerRadius = radius;
  8096. }
  8097. }
  8098. }
  8099. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  8100. class MarkupAnnotation extends Annotation {
  8101. constructor(parameters) {
  8102. super(parameters);
  8103. const dict = parameters.dict;
  8104. if (dict.has("IRT")) {
  8105. const rawIRT = dict.getRaw("IRT");
  8106. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  8107. const rt = dict.get("RT");
  8108. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  8109. }
  8110. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  8111. const parent = dict.get("IRT");
  8112. this.setTitle(parent.get("T"));
  8113. this.data.titleObj = this._title;
  8114. this.setContents(parent.get("Contents"));
  8115. this.data.contentsObj = this._contents;
  8116. if (!parent.has("CreationDate")) {
  8117. this.data.creationDate = null;
  8118. } else {
  8119. this.setCreationDate(parent.get("CreationDate"));
  8120. this.data.creationDate = this.creationDate;
  8121. }
  8122. if (!parent.has("M")) {
  8123. this.data.modificationDate = null;
  8124. } else {
  8125. this.setModificationDate(parent.get("M"));
  8126. this.data.modificationDate = this.modificationDate;
  8127. }
  8128. this.data.hasPopup = parent.has("Popup");
  8129. if (!parent.has("C")) {
  8130. this.data.color = null;
  8131. } else {
  8132. this.setColor(parent.getArray("C"));
  8133. this.data.color = this.color;
  8134. }
  8135. } else {
  8136. this.data.titleObj = this._title;
  8137. this.setCreationDate(dict.get("CreationDate"));
  8138. this.data.creationDate = this.creationDate;
  8139. this.data.hasPopup = dict.has("Popup");
  8140. if (!dict.has("C")) {
  8141. this.data.color = null;
  8142. }
  8143. }
  8144. if (dict.has("RC")) {
  8145. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  8146. }
  8147. }
  8148. setCreationDate(creationDate) {
  8149. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  8150. }
  8151. _setDefaultAppearance(_ref3) {
  8152. let {
  8153. xref,
  8154. extra,
  8155. strokeColor,
  8156. fillColor,
  8157. blendMode,
  8158. strokeAlpha,
  8159. fillAlpha,
  8160. pointsCallback
  8161. } = _ref3;
  8162. let minX = Number.MAX_VALUE;
  8163. let minY = Number.MAX_VALUE;
  8164. let maxX = Number.MIN_VALUE;
  8165. let maxY = Number.MIN_VALUE;
  8166. const buffer = ["q"];
  8167. if (extra) {
  8168. buffer.push(extra);
  8169. }
  8170. if (strokeColor) {
  8171. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  8172. }
  8173. if (fillColor) {
  8174. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  8175. }
  8176. let pointsArray = this.data.quadPoints;
  8177. if (!pointsArray) {
  8178. pointsArray = [[{
  8179. x: this.rectangle[0],
  8180. y: this.rectangle[3]
  8181. }, {
  8182. x: this.rectangle[2],
  8183. y: this.rectangle[3]
  8184. }, {
  8185. x: this.rectangle[0],
  8186. y: this.rectangle[1]
  8187. }, {
  8188. x: this.rectangle[2],
  8189. y: this.rectangle[1]
  8190. }]];
  8191. }
  8192. for (const points of pointsArray) {
  8193. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  8194. minX = Math.min(minX, mX);
  8195. maxX = Math.max(maxX, MX);
  8196. minY = Math.min(minY, mY);
  8197. maxY = Math.max(maxY, MY);
  8198. }
  8199. buffer.push("Q");
  8200. const formDict = new _primitives.Dict(xref);
  8201. const appearanceStreamDict = new _primitives.Dict(xref);
  8202. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  8203. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  8204. appearanceStream.dict = appearanceStreamDict;
  8205. formDict.set("Fm0", appearanceStream);
  8206. const gsDict = new _primitives.Dict(xref);
  8207. if (blendMode) {
  8208. gsDict.set("BM", _primitives.Name.get(blendMode));
  8209. }
  8210. if (typeof strokeAlpha === "number") {
  8211. gsDict.set("CA", strokeAlpha);
  8212. }
  8213. if (typeof fillAlpha === "number") {
  8214. gsDict.set("ca", fillAlpha);
  8215. }
  8216. const stateDict = new _primitives.Dict(xref);
  8217. stateDict.set("GS0", gsDict);
  8218. const resources = new _primitives.Dict(xref);
  8219. resources.set("ExtGState", stateDict);
  8220. resources.set("XObject", formDict);
  8221. const appearanceDict = new _primitives.Dict(xref);
  8222. appearanceDict.set("Resources", resources);
  8223. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  8224. appearanceDict.set("BBox", bbox);
  8225. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  8226. this.appearance.dict = appearanceDict;
  8227. this._streams.push(this.appearance, appearanceStream);
  8228. }
  8229. static async createNewAnnotation(xref, annotation, dependencies, params) {
  8230. const annotationRef = xref.getNewRef();
  8231. const apRef = xref.getNewRef();
  8232. const annotationDict = this.createNewDict(annotation, xref, {
  8233. apRef
  8234. });
  8235. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8236. const buffer = [];
  8237. let transform = xref.encrypt ? xref.encrypt.createCipherTransform(apRef.num, apRef.gen) : null;
  8238. (0, _writer.writeObject)(apRef, ap, buffer, transform);
  8239. dependencies.push({
  8240. ref: apRef,
  8241. data: buffer.join("")
  8242. });
  8243. buffer.length = 0;
  8244. transform = xref.encrypt ? xref.encrypt.createCipherTransform(annotationRef.num, annotationRef.gen) : null;
  8245. (0, _writer.writeObject)(annotationRef, annotationDict, buffer, transform);
  8246. return {
  8247. ref: annotationRef,
  8248. data: buffer.join("")
  8249. };
  8250. }
  8251. static async createNewPrintAnnotation(xref, annotation, params) {
  8252. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  8253. const annotationDict = this.createNewDict(annotation, xref, {
  8254. ap
  8255. });
  8256. return new this.prototype.constructor({
  8257. dict: annotationDict,
  8258. xref
  8259. });
  8260. }
  8261. }
  8262. exports.MarkupAnnotation = MarkupAnnotation;
  8263. class WidgetAnnotation extends Annotation {
  8264. constructor(params) {
  8265. super(params);
  8266. const dict = params.dict;
  8267. const data = this.data;
  8268. this.ref = params.ref;
  8269. data.annotationType = _util.AnnotationType.WIDGET;
  8270. if (data.fieldName === undefined) {
  8271. data.fieldName = this._constructFieldName(dict);
  8272. }
  8273. if (data.actions === undefined) {
  8274. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  8275. }
  8276. let fieldValue = (0, _core_utils.getInheritableProperty)({
  8277. dict,
  8278. key: "V",
  8279. getArray: true
  8280. });
  8281. data.fieldValue = this._decodeFormValue(fieldValue);
  8282. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  8283. dict,
  8284. key: "DV",
  8285. getArray: true
  8286. });
  8287. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  8288. if (fieldValue === undefined && params.xfaDatasets) {
  8289. const path = this._title.str;
  8290. if (path) {
  8291. this._hasValueFromXFA = true;
  8292. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  8293. }
  8294. }
  8295. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  8296. data.fieldValue = data.defaultFieldValue;
  8297. }
  8298. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  8299. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  8300. dict,
  8301. key: "DA"
  8302. }) || params.acroForm.get("DA");
  8303. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  8304. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  8305. const fieldType = (0, _core_utils.getInheritableProperty)({
  8306. dict,
  8307. key: "FT"
  8308. });
  8309. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  8310. const localResources = (0, _core_utils.getInheritableProperty)({
  8311. dict,
  8312. key: "DR"
  8313. });
  8314. const acroFormResources = params.acroForm.get("DR");
  8315. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  8316. this._fieldResources = {
  8317. localResources,
  8318. acroFormResources,
  8319. appearanceResources,
  8320. mergedResources: _primitives.Dict.merge({
  8321. xref: params.xref,
  8322. dictArray: [localResources, appearanceResources, acroFormResources],
  8323. mergeSubDicts: true
  8324. })
  8325. };
  8326. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  8327. dict,
  8328. key: "Ff"
  8329. });
  8330. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  8331. data.fieldFlags = 0;
  8332. }
  8333. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  8334. data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
  8335. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  8336. }
  8337. _decodeFormValue(formValue) {
  8338. if (Array.isArray(formValue)) {
  8339. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  8340. } else if (formValue instanceof _primitives.Name) {
  8341. return (0, _util.stringToPDFString)(formValue.name);
  8342. } else if (typeof formValue === "string") {
  8343. return (0, _util.stringToPDFString)(formValue);
  8344. }
  8345. return null;
  8346. }
  8347. hasFieldFlag(flag) {
  8348. return !!(this.data.fieldFlags & flag);
  8349. }
  8350. static _getRotationMatrix(rotation, width, height) {
  8351. switch (rotation) {
  8352. case 90:
  8353. return [0, 1, -1, 0, width, 0];
  8354. case 180:
  8355. return [-1, 0, 0, -1, width, height];
  8356. case 270:
  8357. return [0, -1, 1, 0, 0, height];
  8358. default:
  8359. throw new Error("Invalid rotation");
  8360. }
  8361. }
  8362. getRotationMatrix(annotationStorage) {
  8363. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8364. let rotation = storageEntry && storageEntry.rotation;
  8365. if (rotation === undefined) {
  8366. rotation = this.rotation;
  8367. }
  8368. if (rotation === 0) {
  8369. return _util.IDENTITY_MATRIX;
  8370. }
  8371. const width = this.data.rect[2] - this.data.rect[0];
  8372. const height = this.data.rect[3] - this.data.rect[1];
  8373. return WidgetAnnotation._getRotationMatrix(rotation, width, height);
  8374. }
  8375. getBorderAndBackgroundAppearances(annotationStorage) {
  8376. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8377. let rotation = storageEntry && storageEntry.rotation;
  8378. if (rotation === undefined) {
  8379. rotation = this.rotation;
  8380. }
  8381. if (!this.backgroundColor && !this.borderColor) {
  8382. return "";
  8383. }
  8384. const width = this.data.rect[2] - this.data.rect[0];
  8385. const height = this.data.rect[3] - this.data.rect[1];
  8386. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  8387. let str = "";
  8388. if (this.backgroundColor) {
  8389. str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
  8390. }
  8391. if (this.borderColor) {
  8392. const borderWidth = this.borderStyle.width || 1;
  8393. str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
  8394. }
  8395. return str;
  8396. }
  8397. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  8398. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  8399. return {
  8400. opList: new _operator_list.OperatorList(),
  8401. separateForm: true,
  8402. separateCanvas: false
  8403. };
  8404. }
  8405. if (!this._hasText) {
  8406. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8407. }
  8408. const content = await this._getAppearance(evaluator, task, annotationStorage);
  8409. if (this.appearance && content === null) {
  8410. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8411. }
  8412. const opList = new _operator_list.OperatorList();
  8413. if (!this._defaultAppearance || content === null) {
  8414. return {
  8415. opList,
  8416. separateForm: false,
  8417. separateCanvas: false
  8418. };
  8419. }
  8420. const matrix = [1, 0, 0, 1, 0, 0];
  8421. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  8422. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  8423. let optionalContent;
  8424. if (this.oc) {
  8425. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  8426. }
  8427. if (optionalContent !== undefined) {
  8428. opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  8429. }
  8430. opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), false]);
  8431. const stream = new _stream.StringStream(content);
  8432. await evaluator.getOperatorList({
  8433. stream,
  8434. task,
  8435. resources: this._fieldResources.mergedResources,
  8436. operatorList: opList
  8437. });
  8438. opList.addOp(_util.OPS.endAnnotation, []);
  8439. if (optionalContent !== undefined) {
  8440. opList.addOp(_util.OPS.endMarkedContent, []);
  8441. }
  8442. return {
  8443. opList,
  8444. separateForm: false,
  8445. separateCanvas: false
  8446. };
  8447. }
  8448. _getMKDict(rotation) {
  8449. const mk = new _primitives.Dict(null);
  8450. if (rotation) {
  8451. mk.set("R", rotation);
  8452. }
  8453. if (this.borderColor) {
  8454. mk.set("BC", Array.from(this.borderColor, c => c / 255));
  8455. }
  8456. if (this.backgroundColor) {
  8457. mk.set("BG", Array.from(this.backgroundColor, c => c / 255));
  8458. }
  8459. return mk.size > 0 ? mk : null;
  8460. }
  8461. async save(evaluator, task, annotationStorage) {
  8462. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8463. let value = storageEntry && storageEntry.value;
  8464. let rotation = storageEntry && storageEntry.rotation;
  8465. if (value === this.data.fieldValue || value === undefined) {
  8466. if (!this._hasValueFromXFA && rotation === undefined) {
  8467. return null;
  8468. }
  8469. value = value || this.data.fieldValue;
  8470. }
  8471. 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])) {
  8472. return null;
  8473. }
  8474. if (rotation === undefined) {
  8475. rotation = this.rotation;
  8476. }
  8477. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  8478. if (appearance === null) {
  8479. return null;
  8480. }
  8481. const {
  8482. xref
  8483. } = evaluator;
  8484. const dict = xref.fetchIfRef(this.ref);
  8485. if (!(dict instanceof _primitives.Dict)) {
  8486. return null;
  8487. }
  8488. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  8489. const xfa = {
  8490. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  8491. value
  8492. };
  8493. const newRef = xref.getNewRef();
  8494. const AP = new _primitives.Dict(xref);
  8495. AP.set("N", newRef);
  8496. const encrypt = xref.encrypt;
  8497. let originalTransform = null;
  8498. let newTransform = null;
  8499. if (encrypt) {
  8500. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  8501. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  8502. appearance = newTransform.encryptString(appearance);
  8503. }
  8504. const encoder = val => (0, _util.isAscii)(val) ? val : (0, _util.stringToUTF16BEString)(val);
  8505. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  8506. dict.set("AP", AP);
  8507. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  8508. const maybeMK = this._getMKDict(rotation);
  8509. if (maybeMK) {
  8510. dict.set("MK", maybeMK);
  8511. }
  8512. const appearanceDict = new _primitives.Dict(xref);
  8513. appearanceDict.set("Length", appearance.length);
  8514. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  8515. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  8516. appearanceDict.set("BBox", bbox);
  8517. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  8518. if (rotationMatrix !== _util.IDENTITY_MATRIX) {
  8519. appearanceDict.set("Matrix", rotationMatrix);
  8520. }
  8521. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  8522. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  8523. bufferOriginal.push("\nendobj\n");
  8524. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  8525. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  8526. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  8527. return [{
  8528. ref: this.ref,
  8529. data: bufferOriginal.join(""),
  8530. xfa
  8531. }, {
  8532. ref: newRef,
  8533. data: bufferNew.join(""),
  8534. xfa: null
  8535. }];
  8536. }
  8537. async _getAppearance(evaluator, task, annotationStorage) {
  8538. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  8539. if (isPassword) {
  8540. return null;
  8541. }
  8542. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  8543. let value, rotation;
  8544. if (storageEntry) {
  8545. value = storageEntry.formattedValue || storageEntry.value;
  8546. rotation = storageEntry.rotation;
  8547. }
  8548. if (rotation === undefined && value === undefined) {
  8549. if (!this._hasValueFromXFA || this.appearance) {
  8550. return null;
  8551. }
  8552. }
  8553. if (value === undefined) {
  8554. value = this.data.fieldValue;
  8555. if (!value) {
  8556. return "";
  8557. }
  8558. }
  8559. if (Array.isArray(value) && value.length === 1) {
  8560. value = value[0];
  8561. }
  8562. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  8563. value = value.trim();
  8564. if (value === "") {
  8565. return "";
  8566. }
  8567. if (rotation === undefined) {
  8568. rotation = this.rotation;
  8569. }
  8570. let lineCount = -1;
  8571. if (this.data.multiLine) {
  8572. lineCount = value.split(/\r\n|\r|\n/).length;
  8573. }
  8574. const defaultPadding = 2;
  8575. const hPadding = defaultPadding;
  8576. let totalHeight = this.data.rect[3] - this.data.rect[1];
  8577. let totalWidth = this.data.rect[2] - this.data.rect[0];
  8578. if (rotation === 90 || rotation === 270) {
  8579. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  8580. }
  8581. if (!this._defaultAppearance) {
  8582. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  8583. }
  8584. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  8585. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount);
  8586. let descent = font.descent;
  8587. if (isNaN(descent)) {
  8588. descent = 0;
  8589. }
  8590. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  8591. const vPadding = defaultVPadding + Math.abs(descent) * fontSize;
  8592. const alignment = this.data.textAlignment;
  8593. if (this.data.multiLine) {
  8594. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding, annotationStorage);
  8595. }
  8596. const encodedString = font.encodeString(value).join("");
  8597. if (this.data.comb) {
  8598. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding, annotationStorage);
  8599. }
  8600. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8601. if (alignment === 0 || alignment > 2) {
  8602. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  8603. }
  8604. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  8605. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  8606. }
  8607. static async _getFontData(evaluator, task, appearanceData, resources) {
  8608. const operatorList = new _operator_list.OperatorList();
  8609. const initialState = {
  8610. font: null,
  8611. clone() {
  8612. return this;
  8613. }
  8614. };
  8615. const {
  8616. fontName,
  8617. fontSize
  8618. } = appearanceData;
  8619. await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  8620. return initialState.font;
  8621. }
  8622. _getTextWidth(text, font) {
  8623. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  8624. }
  8625. _computeFontSize(height, width, text, font, lineCount) {
  8626. let {
  8627. fontSize
  8628. } = this.data.defaultAppearanceData;
  8629. if (!fontSize) {
  8630. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  8631. if (lineCount === -1) {
  8632. const textWidth = this._getTextWidth(text, font);
  8633. fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, width / textWidth));
  8634. } else {
  8635. const lines = text.split(/\r\n?|\n/);
  8636. const cachedLines = [];
  8637. for (const line of lines) {
  8638. const encoded = font.encodeString(line).join("");
  8639. const glyphs = font.charsToGlyphs(encoded);
  8640. const positions = font.getCharPositions(encoded);
  8641. cachedLines.push({
  8642. line: encoded,
  8643. glyphs,
  8644. positions
  8645. });
  8646. }
  8647. const isTooBig = fsize => {
  8648. let totalHeight = 0;
  8649. for (const cache of cachedLines) {
  8650. const chunks = this._splitLine(null, font, fsize, width, cache);
  8651. totalHeight += chunks.length * fsize;
  8652. if (totalHeight > height) {
  8653. return true;
  8654. }
  8655. }
  8656. return false;
  8657. };
  8658. fontSize = 12;
  8659. let lineHeight = fontSize * _util.LINE_FACTOR;
  8660. let numberOfLines = Math.round(height / lineHeight);
  8661. numberOfLines = Math.max(numberOfLines, lineCount);
  8662. while (true) {
  8663. lineHeight = height / numberOfLines;
  8664. fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
  8665. if (isTooBig(fontSize)) {
  8666. numberOfLines++;
  8667. continue;
  8668. }
  8669. break;
  8670. }
  8671. }
  8672. const {
  8673. fontName,
  8674. fontColor
  8675. } = this.data.defaultAppearanceData;
  8676. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  8677. fontSize,
  8678. fontName,
  8679. fontColor
  8680. });
  8681. }
  8682. return [this._defaultAppearance, fontSize];
  8683. }
  8684. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  8685. let shift;
  8686. if (alignment === 1) {
  8687. const width = this._getTextWidth(text, font) * fontSize;
  8688. shift = (totalWidth - width) / 2;
  8689. } else if (alignment === 2) {
  8690. const width = this._getTextWidth(text, font) * fontSize;
  8691. shift = totalWidth - width - hPadding;
  8692. } else {
  8693. shift = hPadding;
  8694. }
  8695. shift = (0, _core_utils.numberToString)(shift);
  8696. vPadding = (0, _core_utils.numberToString)(vPadding);
  8697. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  8698. }
  8699. _getSaveFieldResources(xref) {
  8700. const {
  8701. localResources,
  8702. appearanceResources,
  8703. acroFormResources
  8704. } = this._fieldResources;
  8705. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  8706. if (!fontName) {
  8707. return localResources || _primitives.Dict.empty;
  8708. }
  8709. for (const resources of [localResources, appearanceResources]) {
  8710. if (resources instanceof _primitives.Dict) {
  8711. const localFont = resources.get("Font");
  8712. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  8713. return resources;
  8714. }
  8715. }
  8716. }
  8717. if (acroFormResources instanceof _primitives.Dict) {
  8718. const acroFormFont = acroFormResources.get("Font");
  8719. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  8720. const subFontDict = new _primitives.Dict(xref);
  8721. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  8722. const subResourcesDict = new _primitives.Dict(xref);
  8723. subResourcesDict.set("Font", subFontDict);
  8724. return _primitives.Dict.merge({
  8725. xref,
  8726. dictArray: [subResourcesDict, localResources],
  8727. mergeSubDicts: true
  8728. });
  8729. }
  8730. }
  8731. return localResources || _primitives.Dict.empty;
  8732. }
  8733. getFieldObject() {
  8734. return null;
  8735. }
  8736. }
  8737. class TextWidgetAnnotation extends WidgetAnnotation {
  8738. constructor(params) {
  8739. super(params);
  8740. this._hasText = true;
  8741. const dict = params.dict;
  8742. if (typeof this.data.fieldValue !== "string") {
  8743. this.data.fieldValue = "";
  8744. }
  8745. let alignment = (0, _core_utils.getInheritableProperty)({
  8746. dict,
  8747. key: "Q"
  8748. });
  8749. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  8750. alignment = null;
  8751. }
  8752. this.data.textAlignment = alignment;
  8753. let maximumLength = (0, _core_utils.getInheritableProperty)({
  8754. dict,
  8755. key: "MaxLen"
  8756. });
  8757. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  8758. maximumLength = 0;
  8759. }
  8760. this.data.maxLen = maximumLength;
  8761. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  8762. 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;
  8763. this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
  8764. }
  8765. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding, annotationStorage) {
  8766. const combWidth = (0, _core_utils.numberToString)(width / this.data.maxLen);
  8767. const buf = [];
  8768. const positions = font.getCharPositions(text);
  8769. for (const [start, end] of positions) {
  8770. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  8771. }
  8772. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8773. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  8774. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  8775. }
  8776. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding, annotationStorage) {
  8777. const lines = text.split(/\r\n?|\n/);
  8778. const buf = [];
  8779. const totalWidth = width - 2 * hPadding;
  8780. for (const line of lines) {
  8781. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  8782. for (const chunk of chunks) {
  8783. const padding = buf.length === 0 ? hPadding : 0;
  8784. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  8785. }
  8786. }
  8787. const renderedText = buf.join("\n");
  8788. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  8789. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  8790. }
  8791. _splitLine(line, font, fontSize, width) {
  8792. let cache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  8793. line = cache.line || font.encodeString(line).join("");
  8794. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  8795. if (glyphs.length <= 1) {
  8796. return [line];
  8797. }
  8798. const positions = cache.positions || font.getCharPositions(line);
  8799. const scale = fontSize / 1000;
  8800. const chunks = [];
  8801. let lastSpacePosInStringStart = -1,
  8802. lastSpacePosInStringEnd = -1,
  8803. lastSpacePos = -1,
  8804. startChunk = 0,
  8805. currentWidth = 0;
  8806. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  8807. const [start, end] = positions[i];
  8808. const glyph = glyphs[i];
  8809. const glyphWidth = glyph.width * scale;
  8810. if (glyph.unicode === " ") {
  8811. if (currentWidth + glyphWidth > width) {
  8812. chunks.push(line.substring(startChunk, start));
  8813. startChunk = start;
  8814. currentWidth = glyphWidth;
  8815. lastSpacePosInStringStart = -1;
  8816. lastSpacePos = -1;
  8817. } else {
  8818. currentWidth += glyphWidth;
  8819. lastSpacePosInStringStart = start;
  8820. lastSpacePosInStringEnd = end;
  8821. lastSpacePos = i;
  8822. }
  8823. } else {
  8824. if (currentWidth + glyphWidth > width) {
  8825. if (lastSpacePosInStringStart !== -1) {
  8826. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  8827. startChunk = lastSpacePosInStringEnd;
  8828. i = lastSpacePos + 1;
  8829. lastSpacePosInStringStart = -1;
  8830. currentWidth = 0;
  8831. } else {
  8832. chunks.push(line.substring(startChunk, start));
  8833. startChunk = start;
  8834. currentWidth = glyphWidth;
  8835. }
  8836. } else {
  8837. currentWidth += glyphWidth;
  8838. }
  8839. }
  8840. }
  8841. if (startChunk < line.length) {
  8842. chunks.push(line.substring(startChunk, line.length));
  8843. }
  8844. return chunks;
  8845. }
  8846. getFieldObject() {
  8847. return {
  8848. id: this.data.id,
  8849. value: this.data.fieldValue,
  8850. defaultValue: this.data.defaultFieldValue || "",
  8851. multiline: this.data.multiLine,
  8852. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  8853. charLimit: this.data.maxLen,
  8854. comb: this.data.comb,
  8855. editable: !this.data.readOnly,
  8856. hidden: this.data.hidden,
  8857. name: this.data.fieldName,
  8858. rect: this.data.rect,
  8859. actions: this.data.actions,
  8860. page: this.data.pageIndex,
  8861. strokeColor: this.data.borderColor,
  8862. fillColor: this.data.backgroundColor,
  8863. rotation: this.rotation,
  8864. type: "text"
  8865. };
  8866. }
  8867. }
  8868. class ButtonWidgetAnnotation extends WidgetAnnotation {
  8869. constructor(params) {
  8870. super(params);
  8871. this.checkedAppearance = null;
  8872. this.uncheckedAppearance = null;
  8873. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8874. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8875. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  8876. this.data.isTooltipOnly = false;
  8877. if (this.data.checkBox) {
  8878. this._processCheckBox(params);
  8879. } else if (this.data.radioButton) {
  8880. this._processRadioButton(params);
  8881. } else if (this.data.pushButton) {
  8882. this.data.hasOwnCanvas = true;
  8883. this._processPushButton(params);
  8884. } else {
  8885. (0, _util.warn)("Invalid field flags for button widget annotation");
  8886. }
  8887. }
  8888. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  8889. if (this.data.pushButton) {
  8890. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  8891. }
  8892. let value = null;
  8893. let rotation = null;
  8894. if (annotationStorage) {
  8895. const storageEntry = annotationStorage.get(this.data.id);
  8896. value = storageEntry ? storageEntry.value : null;
  8897. rotation = storageEntry ? storageEntry.rotation : null;
  8898. }
  8899. if (value === null && this.appearance) {
  8900. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8901. }
  8902. if (value === null || value === undefined) {
  8903. if (this.data.checkBox) {
  8904. value = this.data.fieldValue === this.data.exportValue;
  8905. } else {
  8906. value = this.data.fieldValue === this.data.buttonValue;
  8907. }
  8908. }
  8909. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  8910. if (appearance) {
  8911. const savedAppearance = this.appearance;
  8912. const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
  8913. if (rotation) {
  8914. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  8915. }
  8916. this.appearance = appearance;
  8917. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  8918. this.appearance = savedAppearance;
  8919. appearance.dict.set("Matrix", savedMatrix);
  8920. return operatorList;
  8921. }
  8922. return {
  8923. opList: new _operator_list.OperatorList(),
  8924. separateForm: false,
  8925. separateCanvas: false
  8926. };
  8927. }
  8928. async save(evaluator, task, annotationStorage) {
  8929. if (this.data.checkBox) {
  8930. return this._saveCheckbox(evaluator, task, annotationStorage);
  8931. }
  8932. if (this.data.radioButton) {
  8933. return this._saveRadioButton(evaluator, task, annotationStorage);
  8934. }
  8935. return null;
  8936. }
  8937. async _saveCheckbox(evaluator, task, annotationStorage) {
  8938. if (!annotationStorage) {
  8939. return null;
  8940. }
  8941. const storageEntry = annotationStorage.get(this.data.id);
  8942. let rotation = storageEntry && storageEntry.rotation;
  8943. let value = storageEntry && storageEntry.value;
  8944. if (rotation === undefined) {
  8945. if (value === undefined) {
  8946. return null;
  8947. }
  8948. const defaultValue = this.data.fieldValue === this.data.exportValue;
  8949. if (defaultValue === value) {
  8950. return null;
  8951. }
  8952. }
  8953. const dict = evaluator.xref.fetchIfRef(this.ref);
  8954. if (!(dict instanceof _primitives.Dict)) {
  8955. return null;
  8956. }
  8957. if (rotation === undefined) {
  8958. rotation = this.rotation;
  8959. }
  8960. if (value === undefined) {
  8961. value = this.data.fieldValue === this.data.exportValue;
  8962. }
  8963. const xfa = {
  8964. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  8965. value: value ? this.data.exportValue : ""
  8966. };
  8967. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  8968. dict.set("V", name);
  8969. dict.set("AS", name);
  8970. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  8971. const maybeMK = this._getMKDict(rotation);
  8972. if (maybeMK) {
  8973. dict.set("MK", maybeMK);
  8974. }
  8975. const encrypt = evaluator.xref.encrypt;
  8976. let originalTransform = null;
  8977. if (encrypt) {
  8978. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  8979. }
  8980. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  8981. (0, _writer.writeDict)(dict, buffer, originalTransform);
  8982. buffer.push("\nendobj\n");
  8983. return [{
  8984. ref: this.ref,
  8985. data: buffer.join(""),
  8986. xfa
  8987. }];
  8988. }
  8989. async _saveRadioButton(evaluator, task, annotationStorage) {
  8990. if (!annotationStorage) {
  8991. return null;
  8992. }
  8993. const storageEntry = annotationStorage.get(this.data.id);
  8994. let rotation = storageEntry && storageEntry.rotation;
  8995. let value = storageEntry && storageEntry.value;
  8996. if (rotation === undefined) {
  8997. if (value === undefined) {
  8998. return null;
  8999. }
  9000. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  9001. if (defaultValue === value) {
  9002. return null;
  9003. }
  9004. }
  9005. const dict = evaluator.xref.fetchIfRef(this.ref);
  9006. if (!(dict instanceof _primitives.Dict)) {
  9007. return null;
  9008. }
  9009. if (value === undefined) {
  9010. value = this.data.fieldValue === this.data.buttonValue;
  9011. }
  9012. if (rotation === undefined) {
  9013. rotation = this.rotation;
  9014. }
  9015. const xfa = {
  9016. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  9017. value: value ? this.data.buttonValue : ""
  9018. };
  9019. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  9020. let parentBuffer = null;
  9021. const encrypt = evaluator.xref.encrypt;
  9022. if (value) {
  9023. if (this.parent instanceof _primitives.Ref) {
  9024. const parent = evaluator.xref.fetch(this.parent);
  9025. let parentTransform = null;
  9026. if (encrypt) {
  9027. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  9028. }
  9029. parent.set("V", name);
  9030. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  9031. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  9032. parentBuffer.push("\nendobj\n");
  9033. } else if (this.parent instanceof _primitives.Dict) {
  9034. this.parent.set("V", name);
  9035. }
  9036. }
  9037. dict.set("AS", name);
  9038. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  9039. const maybeMK = this._getMKDict(rotation);
  9040. if (maybeMK) {
  9041. dict.set("MK", maybeMK);
  9042. }
  9043. let originalTransform = null;
  9044. if (encrypt) {
  9045. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  9046. }
  9047. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  9048. (0, _writer.writeDict)(dict, buffer, originalTransform);
  9049. buffer.push("\nendobj\n");
  9050. const newRefs = [{
  9051. ref: this.ref,
  9052. data: buffer.join(""),
  9053. xfa
  9054. }];
  9055. if (parentBuffer !== null) {
  9056. newRefs.push({
  9057. ref: this.parent,
  9058. data: parentBuffer.join(""),
  9059. xfa: null
  9060. });
  9061. }
  9062. return newRefs;
  9063. }
  9064. _getDefaultCheckedAppearance(params, type) {
  9065. const width = this.data.rect[2] - this.data.rect[0];
  9066. const height = this.data.rect[3] - this.data.rect[1];
  9067. const bbox = [0, 0, width, height];
  9068. const FONT_RATIO = 0.8;
  9069. const fontSize = Math.min(width, height) * FONT_RATIO;
  9070. let metrics, char;
  9071. if (type === "check") {
  9072. metrics = {
  9073. width: 0.755 * fontSize,
  9074. height: 0.705 * fontSize
  9075. };
  9076. char = "\x33";
  9077. } else if (type === "disc") {
  9078. metrics = {
  9079. width: 0.791 * fontSize,
  9080. height: 0.705 * fontSize
  9081. };
  9082. char = "\x6C";
  9083. } else {
  9084. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  9085. }
  9086. const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
  9087. const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
  9088. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  9089. const appearanceStreamDict = new _primitives.Dict(params.xref);
  9090. appearanceStreamDict.set("FormType", 1);
  9091. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9092. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9093. appearanceStreamDict.set("BBox", bbox);
  9094. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  9095. appearanceStreamDict.set("Length", appearance.length);
  9096. const resources = new _primitives.Dict(params.xref);
  9097. const font = new _primitives.Dict(params.xref);
  9098. font.set("PdfJsZaDb", this.fallbackFontDict);
  9099. resources.set("Font", font);
  9100. appearanceStreamDict.set("Resources", resources);
  9101. this.checkedAppearance = new _stream.StringStream(appearance);
  9102. this.checkedAppearance.dict = appearanceStreamDict;
  9103. this._streams.push(this.checkedAppearance);
  9104. }
  9105. _processCheckBox(params) {
  9106. const customAppearance = params.dict.get("AP");
  9107. if (!(customAppearance instanceof _primitives.Dict)) {
  9108. return;
  9109. }
  9110. const normalAppearance = customAppearance.get("N");
  9111. if (!(normalAppearance instanceof _primitives.Dict)) {
  9112. return;
  9113. }
  9114. const asValue = this._decodeFormValue(params.dict.get("AS"));
  9115. if (typeof asValue === "string") {
  9116. this.data.fieldValue = asValue;
  9117. }
  9118. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  9119. const exportValues = normalAppearance.getKeys();
  9120. if (exportValues.length === 0) {
  9121. exportValues.push("Off", yes);
  9122. } else if (exportValues.length === 1) {
  9123. if (exportValues[0] === "Off") {
  9124. exportValues.push(yes);
  9125. } else {
  9126. exportValues.unshift("Off");
  9127. }
  9128. } else if (exportValues.includes(yes)) {
  9129. exportValues.length = 0;
  9130. exportValues.push("Off", yes);
  9131. } else {
  9132. const otherYes = exportValues.find(v => v !== "Off");
  9133. exportValues.length = 0;
  9134. exportValues.push("Off", otherYes);
  9135. }
  9136. if (!exportValues.includes(this.data.fieldValue)) {
  9137. this.data.fieldValue = "Off";
  9138. }
  9139. this.data.exportValue = exportValues[1];
  9140. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  9141. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  9142. if (this.checkedAppearance) {
  9143. this._streams.push(this.checkedAppearance);
  9144. } else {
  9145. this._getDefaultCheckedAppearance(params, "check");
  9146. }
  9147. if (this.uncheckedAppearance) {
  9148. this._streams.push(this.uncheckedAppearance);
  9149. }
  9150. this._fallbackFontDict = this.fallbackFontDict;
  9151. }
  9152. _processRadioButton(params) {
  9153. this.data.fieldValue = this.data.buttonValue = null;
  9154. const fieldParent = params.dict.get("Parent");
  9155. if (fieldParent instanceof _primitives.Dict) {
  9156. this.parent = params.dict.getRaw("Parent");
  9157. const fieldParentValue = fieldParent.get("V");
  9158. if (fieldParentValue instanceof _primitives.Name) {
  9159. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  9160. }
  9161. }
  9162. const appearanceStates = params.dict.get("AP");
  9163. if (!(appearanceStates instanceof _primitives.Dict)) {
  9164. return;
  9165. }
  9166. const normalAppearance = appearanceStates.get("N");
  9167. if (!(normalAppearance instanceof _primitives.Dict)) {
  9168. return;
  9169. }
  9170. for (const key of normalAppearance.getKeys()) {
  9171. if (key !== "Off") {
  9172. this.data.buttonValue = this._decodeFormValue(key);
  9173. break;
  9174. }
  9175. }
  9176. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  9177. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  9178. if (this.checkedAppearance) {
  9179. this._streams.push(this.checkedAppearance);
  9180. } else {
  9181. this._getDefaultCheckedAppearance(params, "disc");
  9182. }
  9183. if (this.uncheckedAppearance) {
  9184. this._streams.push(this.uncheckedAppearance);
  9185. }
  9186. this._fallbackFontDict = this.fallbackFontDict;
  9187. }
  9188. _processPushButton(params) {
  9189. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  9190. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  9191. return;
  9192. }
  9193. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  9194. _catalog.Catalog.parseDestDictionary({
  9195. destDict: params.dict,
  9196. resultObj: this.data,
  9197. docBaseUrl: params.pdfManager.docBaseUrl,
  9198. docAttachments: params.attachments
  9199. });
  9200. }
  9201. getFieldObject() {
  9202. let type = "button";
  9203. let exportValues;
  9204. if (this.data.checkBox) {
  9205. type = "checkbox";
  9206. exportValues = this.data.exportValue;
  9207. } else if (this.data.radioButton) {
  9208. type = "radiobutton";
  9209. exportValues = this.data.buttonValue;
  9210. }
  9211. return {
  9212. id: this.data.id,
  9213. value: this.data.fieldValue || "Off",
  9214. defaultValue: this.data.defaultFieldValue,
  9215. exportValues,
  9216. editable: !this.data.readOnly,
  9217. name: this.data.fieldName,
  9218. rect: this.data.rect,
  9219. hidden: this.data.hidden,
  9220. actions: this.data.actions,
  9221. page: this.data.pageIndex,
  9222. strokeColor: this.data.borderColor,
  9223. fillColor: this.data.backgroundColor,
  9224. rotation: this.rotation,
  9225. type
  9226. };
  9227. }
  9228. get fallbackFontDict() {
  9229. const dict = new _primitives.Dict();
  9230. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  9231. dict.set("Type", _primitives.Name.get("FallbackType"));
  9232. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  9233. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  9234. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  9235. }
  9236. }
  9237. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  9238. constructor(params) {
  9239. super(params);
  9240. this.data.options = [];
  9241. const options = (0, _core_utils.getInheritableProperty)({
  9242. dict: params.dict,
  9243. key: "Opt"
  9244. });
  9245. if (Array.isArray(options)) {
  9246. const xref = params.xref;
  9247. for (let i = 0, ii = options.length; i < ii; i++) {
  9248. const option = xref.fetchIfRef(options[i]);
  9249. const isOptionArray = Array.isArray(option);
  9250. this.data.options[i] = {
  9251. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  9252. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  9253. };
  9254. }
  9255. }
  9256. if (typeof this.data.fieldValue === "string") {
  9257. this.data.fieldValue = [this.data.fieldValue];
  9258. } else if (!this.data.fieldValue) {
  9259. this.data.fieldValue = [];
  9260. }
  9261. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  9262. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  9263. this._hasText = true;
  9264. }
  9265. getFieldObject() {
  9266. const type = this.data.combo ? "combobox" : "listbox";
  9267. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  9268. return {
  9269. id: this.data.id,
  9270. value,
  9271. defaultValue: this.data.defaultFieldValue,
  9272. editable: !this.data.readOnly,
  9273. name: this.data.fieldName,
  9274. rect: this.data.rect,
  9275. numItems: this.data.fieldValue.length,
  9276. multipleSelection: this.data.multiSelect,
  9277. hidden: this.data.hidden,
  9278. actions: this.data.actions,
  9279. items: this.data.options,
  9280. page: this.data.pageIndex,
  9281. strokeColor: this.data.borderColor,
  9282. fillColor: this.data.backgroundColor,
  9283. rotation: this.rotation,
  9284. type
  9285. };
  9286. }
  9287. async _getAppearance(evaluator, task, annotationStorage) {
  9288. if (this.data.combo) {
  9289. return super._getAppearance(evaluator, task, annotationStorage);
  9290. }
  9291. if (!annotationStorage) {
  9292. return null;
  9293. }
  9294. const storageEntry = annotationStorage.get(this.data.id);
  9295. if (!storageEntry) {
  9296. return null;
  9297. }
  9298. const rotation = storageEntry.rotation;
  9299. let exportedValue = storageEntry.value;
  9300. if (rotation === undefined && exportedValue === undefined) {
  9301. return null;
  9302. }
  9303. if (exportedValue === undefined) {
  9304. exportedValue = this.data.fieldValue;
  9305. } else if (!Array.isArray(exportedValue)) {
  9306. exportedValue = [exportedValue];
  9307. }
  9308. const defaultPadding = 2;
  9309. const hPadding = defaultPadding;
  9310. let totalHeight = this.data.rect[3] - this.data.rect[1];
  9311. let totalWidth = this.data.rect[2] - this.data.rect[0];
  9312. if (rotation === 90 || rotation === 270) {
  9313. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  9314. }
  9315. const lineCount = this.data.options.length;
  9316. const valueIndices = [];
  9317. for (let i = 0; i < lineCount; i++) {
  9318. const {
  9319. exportValue
  9320. } = this.data.options[i];
  9321. if (exportedValue.includes(exportValue)) {
  9322. valueIndices.push(i);
  9323. }
  9324. }
  9325. if (!this._defaultAppearance) {
  9326. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  9327. }
  9328. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  9329. let defaultAppearance;
  9330. let {
  9331. fontSize
  9332. } = this.data.defaultAppearanceData;
  9333. if (!fontSize) {
  9334. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  9335. let lineWidth = -1;
  9336. let value;
  9337. for (const {
  9338. displayValue
  9339. } of this.data.options) {
  9340. const width = this._getTextWidth(displayValue, font);
  9341. if (width > lineWidth) {
  9342. lineWidth = width;
  9343. value = displayValue;
  9344. }
  9345. }
  9346. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * hPadding, value, font, -1);
  9347. } else {
  9348. defaultAppearance = this._defaultAppearance;
  9349. }
  9350. const lineHeight = fontSize * _util.LINE_FACTOR;
  9351. const vPadding = (lineHeight - fontSize) / 2;
  9352. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  9353. let firstIndex;
  9354. if (valueIndices.length === 1) {
  9355. const valuePosition = valueIndices[0];
  9356. const indexInPage = valuePosition % numberOfVisibleLines;
  9357. firstIndex = valuePosition - indexInPage;
  9358. } else {
  9359. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  9360. }
  9361. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  9362. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  9363. if (valueIndices.length) {
  9364. buf.push("0.600006 0.756866 0.854904 rg");
  9365. for (const index of valueIndices) {
  9366. if (firstIndex <= index && index < end) {
  9367. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  9368. }
  9369. }
  9370. }
  9371. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  9372. for (let i = firstIndex; i < end; i++) {
  9373. const {
  9374. displayValue
  9375. } = this.data.options[i];
  9376. const hpadding = i === firstIndex ? hPadding : 0;
  9377. const vpadding = i === firstIndex ? vPadding : 0;
  9378. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, hpadding, -lineHeight + vpadding));
  9379. }
  9380. buf.push("ET Q EMC");
  9381. return buf.join("\n");
  9382. }
  9383. }
  9384. class SignatureWidgetAnnotation extends WidgetAnnotation {
  9385. constructor(params) {
  9386. super(params);
  9387. this.data.fieldValue = null;
  9388. }
  9389. getFieldObject() {
  9390. return {
  9391. id: this.data.id,
  9392. value: null,
  9393. page: this.data.pageIndex,
  9394. type: "signature"
  9395. };
  9396. }
  9397. }
  9398. class TextAnnotation extends MarkupAnnotation {
  9399. constructor(parameters) {
  9400. const DEFAULT_ICON_SIZE = 22;
  9401. super(parameters);
  9402. const dict = parameters.dict;
  9403. this.data.annotationType = _util.AnnotationType.TEXT;
  9404. if (this.data.hasAppearance) {
  9405. this.data.name = "NoIcon";
  9406. } else {
  9407. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  9408. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  9409. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  9410. }
  9411. if (dict.has("State")) {
  9412. this.data.state = dict.get("State") || null;
  9413. this.data.stateModel = dict.get("StateModel") || null;
  9414. } else {
  9415. this.data.state = null;
  9416. this.data.stateModel = null;
  9417. }
  9418. }
  9419. }
  9420. class LinkAnnotation extends Annotation {
  9421. constructor(params) {
  9422. super(params);
  9423. this.data.annotationType = _util.AnnotationType.LINK;
  9424. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  9425. if (quadPoints) {
  9426. this.data.quadPoints = quadPoints;
  9427. }
  9428. this.data.borderColor = this.data.borderColor || this.data.color;
  9429. _catalog.Catalog.parseDestDictionary({
  9430. destDict: params.dict,
  9431. resultObj: this.data,
  9432. docBaseUrl: params.pdfManager.docBaseUrl,
  9433. docAttachments: params.attachments
  9434. });
  9435. }
  9436. }
  9437. class PopupAnnotation extends Annotation {
  9438. constructor(parameters) {
  9439. super(parameters);
  9440. this.data.annotationType = _util.AnnotationType.POPUP;
  9441. let parentItem = parameters.dict.get("Parent");
  9442. if (!parentItem) {
  9443. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  9444. return;
  9445. }
  9446. const parentSubtype = parentItem.get("Subtype");
  9447. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  9448. const rawParent = parameters.dict.getRaw("Parent");
  9449. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  9450. const parentRect = parentItem.getArray("Rect");
  9451. if (Array.isArray(parentRect) && parentRect.length === 4) {
  9452. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  9453. } else {
  9454. this.data.parentRect = [0, 0, 0, 0];
  9455. }
  9456. const rt = parentItem.get("RT");
  9457. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  9458. parentItem = parentItem.get("IRT");
  9459. }
  9460. if (!parentItem.has("M")) {
  9461. this.data.modificationDate = null;
  9462. } else {
  9463. this.setModificationDate(parentItem.get("M"));
  9464. this.data.modificationDate = this.modificationDate;
  9465. }
  9466. if (!parentItem.has("C")) {
  9467. this.data.color = null;
  9468. } else {
  9469. this.setColor(parentItem.getArray("C"));
  9470. this.data.color = this.color;
  9471. }
  9472. if (!this.viewable) {
  9473. const parentFlags = parentItem.get("F");
  9474. if (this._isViewable(parentFlags)) {
  9475. this.setFlags(parentFlags);
  9476. }
  9477. }
  9478. this.setTitle(parentItem.get("T"));
  9479. this.data.titleObj = this._title;
  9480. this.setContents(parentItem.get("Contents"));
  9481. this.data.contentsObj = this._contents;
  9482. if (parentItem.has("RC")) {
  9483. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  9484. }
  9485. }
  9486. }
  9487. exports.PopupAnnotation = PopupAnnotation;
  9488. class FreeTextAnnotation extends MarkupAnnotation {
  9489. constructor(parameters) {
  9490. super(parameters);
  9491. this.data.annotationType = _util.AnnotationType.FREETEXT;
  9492. }
  9493. get hasTextContent() {
  9494. return !!this.appearance;
  9495. }
  9496. static createNewDict(annotation, xref, _ref4) {
  9497. let {
  9498. apRef,
  9499. ap
  9500. } = _ref4;
  9501. const {
  9502. color,
  9503. fontSize,
  9504. rect,
  9505. rotation,
  9506. user,
  9507. value
  9508. } = annotation;
  9509. const freetext = new _primitives.Dict(xref);
  9510. freetext.set("Type", _primitives.Name.get("Annot"));
  9511. freetext.set("Subtype", _primitives.Name.get("FreeText"));
  9512. freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  9513. freetext.set("Rect", rect);
  9514. const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
  9515. freetext.set("DA", da);
  9516. freetext.set("Contents", value);
  9517. freetext.set("F", 4);
  9518. freetext.set("Border", [0, 0, 0]);
  9519. freetext.set("Rotate", rotation);
  9520. if (user) {
  9521. freetext.set("T", (0, _util.stringToUTF8String)(user));
  9522. }
  9523. const n = new _primitives.Dict(xref);
  9524. freetext.set("AP", n);
  9525. if (apRef) {
  9526. n.set("N", apRef);
  9527. } else {
  9528. n.set("N", ap);
  9529. }
  9530. return freetext;
  9531. }
  9532. static async createNewAppearanceStream(annotation, xref, params) {
  9533. const {
  9534. baseFontRef,
  9535. evaluator,
  9536. task
  9537. } = params;
  9538. const {
  9539. color,
  9540. fontSize,
  9541. rect,
  9542. rotation,
  9543. value
  9544. } = annotation;
  9545. const resources = new _primitives.Dict(xref);
  9546. const font = new _primitives.Dict(xref);
  9547. if (baseFontRef) {
  9548. font.set("Helv", baseFontRef);
  9549. } else {
  9550. const baseFont = new _primitives.Dict(xref);
  9551. baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
  9552. baseFont.set("Type", _primitives.Name.get("Font"));
  9553. baseFont.set("Subtype", _primitives.Name.get("Type1"));
  9554. baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  9555. font.set("Helv", baseFont);
  9556. }
  9557. resources.set("Font", font);
  9558. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  9559. fontName: "Helvetica",
  9560. fontSize
  9561. }, resources);
  9562. const [x1, y1, x2, y2] = rect;
  9563. let w = x2 - x1;
  9564. let h = y2 - y1;
  9565. if (rotation % 180 !== 0) {
  9566. [w, h] = [h, w];
  9567. }
  9568. const lines = value.split("\n");
  9569. const scale = fontSize / 1000;
  9570. let totalWidth = -Infinity;
  9571. const encodedLines = [];
  9572. for (let line of lines) {
  9573. line = helv.encodeString(line).join("");
  9574. encodedLines.push(line);
  9575. let lineWidth = 0;
  9576. const glyphs = helv.charsToGlyphs(line);
  9577. for (const glyph of glyphs) {
  9578. lineWidth += glyph.width * scale;
  9579. }
  9580. totalWidth = Math.max(totalWidth, lineWidth);
  9581. }
  9582. let hscale = 1;
  9583. if (totalWidth > w) {
  9584. hscale = w / totalWidth;
  9585. }
  9586. let vscale = 1;
  9587. const lineHeight = _util.LINE_FACTOR * fontSize;
  9588. const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
  9589. const totalHeight = lineHeight * lines.length;
  9590. if (totalHeight > h) {
  9591. vscale = h / totalHeight;
  9592. }
  9593. const fscale = Math.min(hscale, vscale);
  9594. const newFontSize = fontSize * fscale;
  9595. 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`];
  9596. const vShift = (0, _core_utils.numberToString)(lineHeight);
  9597. for (const line of encodedLines) {
  9598. buffer.push(`0 -${vShift} Td (${(0, _util.escapeString)(line)}) Tj`);
  9599. }
  9600. buffer.push("ET", "Q");
  9601. const appearance = buffer.join("\n");
  9602. const appearanceStreamDict = new _primitives.Dict(xref);
  9603. appearanceStreamDict.set("FormType", 1);
  9604. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9605. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9606. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  9607. appearanceStreamDict.set("Length", appearance.length);
  9608. appearanceStreamDict.set("Resources", resources);
  9609. if (rotation) {
  9610. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  9611. appearanceStreamDict.set("Matrix", matrix);
  9612. }
  9613. const ap = new _stream.StringStream(appearance);
  9614. ap.dict = appearanceStreamDict;
  9615. return ap;
  9616. }
  9617. }
  9618. class LineAnnotation extends MarkupAnnotation {
  9619. constructor(parameters) {
  9620. super(parameters);
  9621. const {
  9622. dict
  9623. } = parameters;
  9624. this.data.annotationType = _util.AnnotationType.LINE;
  9625. const lineCoordinates = dict.getArray("L");
  9626. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  9627. this.setLineEndings(dict.getArray("LE"));
  9628. this.data.lineEndings = this.lineEndings;
  9629. if (!this.appearance) {
  9630. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  9631. const strokeAlpha = dict.get("CA");
  9632. let fillColor = null,
  9633. interiorColor = dict.getArray("IC");
  9634. if (interiorColor) {
  9635. interiorColor = getRgbColor(interiorColor, null);
  9636. fillColor = interiorColor ? Array.from(interiorColor, c => c / 255) : null;
  9637. }
  9638. const fillAlpha = fillColor ? strokeAlpha : null;
  9639. const borderWidth = this.borderStyle.width || 1,
  9640. borderAdjust = 2 * borderWidth;
  9641. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  9642. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9643. this.rectangle = bbox;
  9644. }
  9645. this._setDefaultAppearance({
  9646. xref: parameters.xref,
  9647. extra: `${borderWidth} w`,
  9648. strokeColor,
  9649. fillColor,
  9650. strokeAlpha,
  9651. fillAlpha,
  9652. pointsCallback: (buffer, points) => {
  9653. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  9654. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  9655. }
  9656. });
  9657. }
  9658. }
  9659. }
  9660. class SquareAnnotation extends MarkupAnnotation {
  9661. constructor(parameters) {
  9662. super(parameters);
  9663. this.data.annotationType = _util.AnnotationType.SQUARE;
  9664. if (!this.appearance) {
  9665. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  9666. const strokeAlpha = parameters.dict.get("CA");
  9667. let fillColor = null,
  9668. interiorColor = parameters.dict.getArray("IC");
  9669. if (interiorColor) {
  9670. interiorColor = getRgbColor(interiorColor, null);
  9671. fillColor = interiorColor ? Array.from(interiorColor, c => c / 255) : null;
  9672. }
  9673. const fillAlpha = fillColor ? strokeAlpha : null;
  9674. if (this.borderStyle.width === 0 && !fillColor) {
  9675. return;
  9676. }
  9677. this._setDefaultAppearance({
  9678. xref: parameters.xref,
  9679. extra: `${this.borderStyle.width} w`,
  9680. strokeColor,
  9681. fillColor,
  9682. strokeAlpha,
  9683. fillAlpha,
  9684. pointsCallback: (buffer, points) => {
  9685. const x = points[2].x + this.borderStyle.width / 2;
  9686. const y = points[2].y + this.borderStyle.width / 2;
  9687. const width = points[3].x - points[2].x - this.borderStyle.width;
  9688. const height = points[1].y - points[3].y - this.borderStyle.width;
  9689. buffer.push(`${x} ${y} ${width} ${height} re`);
  9690. if (fillColor) {
  9691. buffer.push("B");
  9692. } else {
  9693. buffer.push("S");
  9694. }
  9695. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9696. }
  9697. });
  9698. }
  9699. }
  9700. }
  9701. class CircleAnnotation extends MarkupAnnotation {
  9702. constructor(parameters) {
  9703. super(parameters);
  9704. this.data.annotationType = _util.AnnotationType.CIRCLE;
  9705. if (!this.appearance) {
  9706. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  9707. const strokeAlpha = parameters.dict.get("CA");
  9708. let fillColor = null;
  9709. let interiorColor = parameters.dict.getArray("IC");
  9710. if (interiorColor) {
  9711. interiorColor = getRgbColor(interiorColor, null);
  9712. fillColor = interiorColor ? Array.from(interiorColor, c => c / 255) : null;
  9713. }
  9714. const fillAlpha = fillColor ? strokeAlpha : null;
  9715. if (this.borderStyle.width === 0 && !fillColor) {
  9716. return;
  9717. }
  9718. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  9719. this._setDefaultAppearance({
  9720. xref: parameters.xref,
  9721. extra: `${this.borderStyle.width} w`,
  9722. strokeColor,
  9723. fillColor,
  9724. strokeAlpha,
  9725. fillAlpha,
  9726. pointsCallback: (buffer, points) => {
  9727. const x0 = points[0].x + this.borderStyle.width / 2;
  9728. const y0 = points[0].y - this.borderStyle.width / 2;
  9729. const x1 = points[3].x - this.borderStyle.width / 2;
  9730. const y1 = points[3].y + this.borderStyle.width / 2;
  9731. const xMid = x0 + (x1 - x0) / 2;
  9732. const yMid = y0 + (y1 - y0) / 2;
  9733. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  9734. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  9735. 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");
  9736. if (fillColor) {
  9737. buffer.push("B");
  9738. } else {
  9739. buffer.push("S");
  9740. }
  9741. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9742. }
  9743. });
  9744. }
  9745. }
  9746. }
  9747. class PolylineAnnotation extends MarkupAnnotation {
  9748. constructor(parameters) {
  9749. super(parameters);
  9750. const {
  9751. dict
  9752. } = parameters;
  9753. this.data.annotationType = _util.AnnotationType.POLYLINE;
  9754. this.data.vertices = [];
  9755. if (!(this instanceof PolygonAnnotation)) {
  9756. this.setLineEndings(dict.getArray("LE"));
  9757. this.data.lineEndings = this.lineEndings;
  9758. }
  9759. const rawVertices = dict.getArray("Vertices");
  9760. if (!Array.isArray(rawVertices)) {
  9761. return;
  9762. }
  9763. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  9764. this.data.vertices.push({
  9765. x: rawVertices[i],
  9766. y: rawVertices[i + 1]
  9767. });
  9768. }
  9769. if (!this.appearance) {
  9770. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  9771. const strokeAlpha = dict.get("CA");
  9772. const borderWidth = this.borderStyle.width || 1,
  9773. borderAdjust = 2 * borderWidth;
  9774. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9775. for (const vertex of this.data.vertices) {
  9776. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  9777. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  9778. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  9779. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  9780. }
  9781. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9782. this.rectangle = bbox;
  9783. }
  9784. this._setDefaultAppearance({
  9785. xref: parameters.xref,
  9786. extra: `${borderWidth} w`,
  9787. strokeColor,
  9788. strokeAlpha,
  9789. pointsCallback: (buffer, points) => {
  9790. const vertices = this.data.vertices;
  9791. for (let i = 0, ii = vertices.length; i < ii; i++) {
  9792. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  9793. }
  9794. buffer.push("S");
  9795. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9796. }
  9797. });
  9798. }
  9799. }
  9800. }
  9801. class PolygonAnnotation extends PolylineAnnotation {
  9802. constructor(parameters) {
  9803. super(parameters);
  9804. this.data.annotationType = _util.AnnotationType.POLYGON;
  9805. }
  9806. }
  9807. class CaretAnnotation extends MarkupAnnotation {
  9808. constructor(parameters) {
  9809. super(parameters);
  9810. this.data.annotationType = _util.AnnotationType.CARET;
  9811. }
  9812. }
  9813. class InkAnnotation extends MarkupAnnotation {
  9814. constructor(parameters) {
  9815. super(parameters);
  9816. this.data.annotationType = _util.AnnotationType.INK;
  9817. this.data.inkLists = [];
  9818. const rawInkLists = parameters.dict.getArray("InkList");
  9819. if (!Array.isArray(rawInkLists)) {
  9820. return;
  9821. }
  9822. const xref = parameters.xref;
  9823. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  9824. this.data.inkLists.push([]);
  9825. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  9826. this.data.inkLists[i].push({
  9827. x: xref.fetchIfRef(rawInkLists[i][j]),
  9828. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  9829. });
  9830. }
  9831. }
  9832. if (!this.appearance) {
  9833. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  9834. const strokeAlpha = parameters.dict.get("CA");
  9835. const borderWidth = this.borderStyle.width || 1,
  9836. borderAdjust = 2 * borderWidth;
  9837. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  9838. for (const inkLists of this.data.inkLists) {
  9839. for (const vertex of inkLists) {
  9840. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  9841. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  9842. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  9843. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  9844. }
  9845. }
  9846. if (!_util.Util.intersect(this.rectangle, bbox)) {
  9847. this.rectangle = bbox;
  9848. }
  9849. this._setDefaultAppearance({
  9850. xref: parameters.xref,
  9851. extra: `${borderWidth} w`,
  9852. strokeColor,
  9853. strokeAlpha,
  9854. pointsCallback: (buffer, points) => {
  9855. for (const inkList of this.data.inkLists) {
  9856. for (let i = 0, ii = inkList.length; i < ii; i++) {
  9857. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  9858. }
  9859. buffer.push("S");
  9860. }
  9861. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9862. }
  9863. });
  9864. }
  9865. }
  9866. static createNewDict(annotation, xref, _ref5) {
  9867. let {
  9868. apRef,
  9869. ap
  9870. } = _ref5;
  9871. const {
  9872. paths,
  9873. rect,
  9874. rotation
  9875. } = annotation;
  9876. const ink = new _primitives.Dict(xref);
  9877. ink.set("Type", _primitives.Name.get("Annot"));
  9878. ink.set("Subtype", _primitives.Name.get("Ink"));
  9879. ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
  9880. ink.set("Rect", rect);
  9881. ink.set("InkList", paths.map(p => p.points));
  9882. ink.set("F", 4);
  9883. ink.set("Border", [0, 0, 0]);
  9884. ink.set("Rotate", rotation);
  9885. const n = new _primitives.Dict(xref);
  9886. ink.set("AP", n);
  9887. if (apRef) {
  9888. n.set("N", apRef);
  9889. } else {
  9890. n.set("N", ap);
  9891. }
  9892. return ink;
  9893. }
  9894. static async createNewAppearanceStream(annotation, xref, params) {
  9895. const {
  9896. color,
  9897. rect,
  9898. rotation,
  9899. paths,
  9900. thickness,
  9901. opacity
  9902. } = annotation;
  9903. const [x1, y1, x2, y2] = rect;
  9904. let w = x2 - x1;
  9905. let h = y2 - y1;
  9906. if (rotation % 180 !== 0) {
  9907. [w, h] = [h, w];
  9908. }
  9909. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
  9910. if (opacity !== 1) {
  9911. appearanceBuffer.push("/R0 gs");
  9912. }
  9913. const buffer = [];
  9914. for (const {
  9915. bezier
  9916. } of paths) {
  9917. buffer.length = 0;
  9918. buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
  9919. for (let i = 2, ii = bezier.length; i < ii; i += 6) {
  9920. const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
  9921. buffer.push(`${curve} c`);
  9922. }
  9923. buffer.push("S");
  9924. appearanceBuffer.push(buffer.join("\n"));
  9925. }
  9926. const appearance = appearanceBuffer.join("\n");
  9927. const appearanceStreamDict = new _primitives.Dict(xref);
  9928. appearanceStreamDict.set("FormType", 1);
  9929. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  9930. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  9931. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  9932. appearanceStreamDict.set("Length", appearance.length);
  9933. if (rotation) {
  9934. const matrix = WidgetAnnotation._getRotationMatrix(rotation, w, h);
  9935. appearanceStreamDict.set("Matrix", matrix);
  9936. }
  9937. if (opacity !== 1) {
  9938. const resources = new _primitives.Dict(xref);
  9939. const extGState = new _primitives.Dict(xref);
  9940. const r0 = new _primitives.Dict(xref);
  9941. r0.set("CA", opacity);
  9942. r0.set("Type", _primitives.Name.get("ExtGState"));
  9943. extGState.set("R0", r0);
  9944. resources.set("ExtGState", extGState);
  9945. appearanceStreamDict.set("Resources", resources);
  9946. }
  9947. const ap = new _stream.StringStream(appearance);
  9948. ap.dict = appearanceStreamDict;
  9949. return ap;
  9950. }
  9951. }
  9952. class HighlightAnnotation extends MarkupAnnotation {
  9953. constructor(parameters) {
  9954. super(parameters);
  9955. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  9956. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  9957. if (quadPoints) {
  9958. const resources = this.appearance && this.appearance.dict.get("Resources");
  9959. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  9960. if (this.appearance) {
  9961. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  9962. }
  9963. const fillColor = this.color ? Array.from(this.color, c => c / 255) : [1, 1, 0];
  9964. const fillAlpha = parameters.dict.get("CA");
  9965. this._setDefaultAppearance({
  9966. xref: parameters.xref,
  9967. fillColor,
  9968. blendMode: "Multiply",
  9969. fillAlpha,
  9970. pointsCallback: (buffer, points) => {
  9971. 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");
  9972. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9973. }
  9974. });
  9975. }
  9976. } else {
  9977. this.data.hasPopup = false;
  9978. }
  9979. }
  9980. }
  9981. class UnderlineAnnotation extends MarkupAnnotation {
  9982. constructor(parameters) {
  9983. super(parameters);
  9984. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  9985. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  9986. if (quadPoints) {
  9987. if (!this.appearance) {
  9988. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  9989. const strokeAlpha = parameters.dict.get("CA");
  9990. this._setDefaultAppearance({
  9991. xref: parameters.xref,
  9992. extra: "[] 0 d 1 w",
  9993. strokeColor,
  9994. strokeAlpha,
  9995. pointsCallback: (buffer, points) => {
  9996. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  9997. return [points[0].x, points[1].x, points[3].y, points[1].y];
  9998. }
  9999. });
  10000. }
  10001. } else {
  10002. this.data.hasPopup = false;
  10003. }
  10004. }
  10005. }
  10006. class SquigglyAnnotation extends MarkupAnnotation {
  10007. constructor(parameters) {
  10008. super(parameters);
  10009. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  10010. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  10011. if (quadPoints) {
  10012. if (!this.appearance) {
  10013. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  10014. const strokeAlpha = parameters.dict.get("CA");
  10015. this._setDefaultAppearance({
  10016. xref: parameters.xref,
  10017. extra: "[] 0 d 1 w",
  10018. strokeColor,
  10019. strokeAlpha,
  10020. pointsCallback: (buffer, points) => {
  10021. const dy = (points[0].y - points[2].y) / 6;
  10022. let shift = dy;
  10023. let x = points[2].x;
  10024. const y = points[2].y;
  10025. const xEnd = points[3].x;
  10026. buffer.push(`${x} ${y + shift} m`);
  10027. do {
  10028. x += 2;
  10029. shift = shift === 0 ? dy : 0;
  10030. buffer.push(`${x} ${y + shift} l`);
  10031. } while (x < xEnd);
  10032. buffer.push("S");
  10033. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  10034. }
  10035. });
  10036. }
  10037. } else {
  10038. this.data.hasPopup = false;
  10039. }
  10040. }
  10041. }
  10042. class StrikeOutAnnotation extends MarkupAnnotation {
  10043. constructor(parameters) {
  10044. super(parameters);
  10045. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  10046. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  10047. if (quadPoints) {
  10048. if (!this.appearance) {
  10049. const strokeColor = this.color ? Array.from(this.color, c => c / 255) : [0, 0, 0];
  10050. const strokeAlpha = parameters.dict.get("CA");
  10051. this._setDefaultAppearance({
  10052. xref: parameters.xref,
  10053. extra: "[] 0 d 1 w",
  10054. strokeColor,
  10055. strokeAlpha,
  10056. pointsCallback: (buffer, points) => {
  10057. 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");
  10058. return [points[0].x, points[1].x, points[3].y, points[1].y];
  10059. }
  10060. });
  10061. }
  10062. } else {
  10063. this.data.hasPopup = false;
  10064. }
  10065. }
  10066. }
  10067. class StampAnnotation extends MarkupAnnotation {
  10068. constructor(parameters) {
  10069. super(parameters);
  10070. this.data.annotationType = _util.AnnotationType.STAMP;
  10071. }
  10072. }
  10073. class FileAttachmentAnnotation extends MarkupAnnotation {
  10074. constructor(parameters) {
  10075. super(parameters);
  10076. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  10077. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  10078. this.data.file = file.serializable;
  10079. }
  10080. }
  10081. /***/ }),
  10082. /* 142 */
  10083. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10084. "use strict";
  10085. Object.defineProperty(exports, "__esModule", ({
  10086. value: true
  10087. }));
  10088. exports.createDefaultAppearance = createDefaultAppearance;
  10089. exports.getPdfColor = getPdfColor;
  10090. exports.parseDefaultAppearance = parseDefaultAppearance;
  10091. var _core_utils = __w_pdfjs_require__(135);
  10092. var _util = __w_pdfjs_require__(2);
  10093. var _colorspace = __w_pdfjs_require__(143);
  10094. var _evaluator = __w_pdfjs_require__(144);
  10095. var _primitives = __w_pdfjs_require__(134);
  10096. var _stream = __w_pdfjs_require__(139);
  10097. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  10098. constructor(str) {
  10099. super(new _stream.StringStream(str));
  10100. }
  10101. parse() {
  10102. const operation = {
  10103. fn: 0,
  10104. args: []
  10105. };
  10106. const result = {
  10107. fontSize: 0,
  10108. fontName: "",
  10109. fontColor: new Uint8ClampedArray(3)
  10110. };
  10111. try {
  10112. while (true) {
  10113. operation.args.length = 0;
  10114. if (!this.read(operation)) {
  10115. break;
  10116. }
  10117. if (this.savedStatesDepth !== 0) {
  10118. continue;
  10119. }
  10120. const {
  10121. fn,
  10122. args
  10123. } = operation;
  10124. switch (fn | 0) {
  10125. case _util.OPS.setFont:
  10126. const [fontName, fontSize] = args;
  10127. if (fontName instanceof _primitives.Name) {
  10128. result.fontName = fontName.name;
  10129. }
  10130. if (typeof fontSize === "number" && fontSize > 0) {
  10131. result.fontSize = fontSize;
  10132. }
  10133. break;
  10134. case _util.OPS.setFillRGBColor:
  10135. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  10136. break;
  10137. case _util.OPS.setFillGray:
  10138. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  10139. break;
  10140. case _util.OPS.setFillColorSpace:
  10141. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  10142. break;
  10143. }
  10144. }
  10145. } catch (reason) {
  10146. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  10147. }
  10148. return result;
  10149. }
  10150. }
  10151. function parseDefaultAppearance(str) {
  10152. return new DefaultAppearanceEvaluator(str).parse();
  10153. }
  10154. function getPdfColor(color, isFill) {
  10155. if (color[0] === color[1] && color[1] === color[2]) {
  10156. const gray = color[0] / 255;
  10157. return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
  10158. }
  10159. return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  10160. }
  10161. function createDefaultAppearance(_ref) {
  10162. let {
  10163. fontSize,
  10164. fontName,
  10165. fontColor
  10166. } = _ref;
  10167. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  10168. }
  10169. /***/ }),
  10170. /* 143 */
  10171. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10172. "use strict";
  10173. Object.defineProperty(exports, "__esModule", ({
  10174. value: true
  10175. }));
  10176. exports.ColorSpace = void 0;
  10177. var _util = __w_pdfjs_require__(2);
  10178. var _primitives = __w_pdfjs_require__(134);
  10179. var _base_stream = __w_pdfjs_require__(136);
  10180. var _core_utils = __w_pdfjs_require__(135);
  10181. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  10182. const COMPONENTS = 3;
  10183. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  10184. const xRatio = w1 / w2;
  10185. const yRatio = h1 / h2;
  10186. let newIndex = 0,
  10187. oldIndex;
  10188. const xScaled = new Uint16Array(w2);
  10189. const w1Scanline = w1 * COMPONENTS;
  10190. for (let i = 0; i < w2; i++) {
  10191. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  10192. }
  10193. for (let i = 0; i < h2; i++) {
  10194. const py = Math.floor(i * yRatio) * w1Scanline;
  10195. for (let j = 0; j < w2; j++) {
  10196. oldIndex = py + xScaled[j];
  10197. dest[newIndex++] = src[oldIndex++];
  10198. dest[newIndex++] = src[oldIndex++];
  10199. dest[newIndex++] = src[oldIndex++];
  10200. newIndex += alpha01;
  10201. }
  10202. }
  10203. }
  10204. class ColorSpace {
  10205. constructor(name, numComps) {
  10206. if (this.constructor === ColorSpace) {
  10207. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  10208. }
  10209. this.name = name;
  10210. this.numComps = numComps;
  10211. }
  10212. getRgb(src, srcOffset) {
  10213. const rgb = new Uint8ClampedArray(3);
  10214. this.getRgbItem(src, srcOffset, rgb, 0);
  10215. return rgb;
  10216. }
  10217. getRgbItem(src, srcOffset, dest, destOffset) {
  10218. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  10219. }
  10220. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10221. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  10222. }
  10223. getOutputLength(inputLength, alpha01) {
  10224. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  10225. }
  10226. isPassthrough(bits) {
  10227. return false;
  10228. }
  10229. isDefaultDecode(decodeMap, bpc) {
  10230. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  10231. }
  10232. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  10233. const count = originalWidth * originalHeight;
  10234. let rgbBuf = null;
  10235. const numComponentColors = 1 << bpc;
  10236. const needsResizing = originalHeight !== height || originalWidth !== width;
  10237. if (this.isPassthrough(bpc)) {
  10238. rgbBuf = comps;
  10239. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  10240. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  10241. for (let i = 0; i < numComponentColors; i++) {
  10242. allColors[i] = i;
  10243. }
  10244. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  10245. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  10246. if (!needsResizing) {
  10247. let destPos = 0;
  10248. for (let i = 0; i < count; ++i) {
  10249. const key = comps[i] * 3;
  10250. dest[destPos++] = colorMap[key];
  10251. dest[destPos++] = colorMap[key + 1];
  10252. dest[destPos++] = colorMap[key + 2];
  10253. destPos += alpha01;
  10254. }
  10255. } else {
  10256. rgbBuf = new Uint8Array(count * 3);
  10257. let rgbPos = 0;
  10258. for (let i = 0; i < count; ++i) {
  10259. const key = comps[i] * 3;
  10260. rgbBuf[rgbPos++] = colorMap[key];
  10261. rgbBuf[rgbPos++] = colorMap[key + 1];
  10262. rgbBuf[rgbPos++] = colorMap[key + 2];
  10263. }
  10264. }
  10265. } else {
  10266. if (!needsResizing) {
  10267. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  10268. } else {
  10269. rgbBuf = new Uint8ClampedArray(count * 3);
  10270. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  10271. }
  10272. }
  10273. if (rgbBuf) {
  10274. if (needsResizing) {
  10275. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  10276. } else {
  10277. let destPos = 0,
  10278. rgbPos = 0;
  10279. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  10280. dest[destPos++] = rgbBuf[rgbPos++];
  10281. dest[destPos++] = rgbBuf[rgbPos++];
  10282. dest[destPos++] = rgbBuf[rgbPos++];
  10283. destPos += alpha01;
  10284. }
  10285. }
  10286. }
  10287. }
  10288. get usesZeroToOneRange() {
  10289. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  10290. }
  10291. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  10292. if (!localColorSpaceCache) {
  10293. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  10294. }
  10295. if (!parsedColorSpace) {
  10296. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  10297. }
  10298. let csName, csRef;
  10299. if (cacheKey instanceof _primitives.Ref) {
  10300. csRef = cacheKey;
  10301. cacheKey = xref.fetch(cacheKey);
  10302. }
  10303. if (cacheKey instanceof _primitives.Name) {
  10304. csName = cacheKey.name;
  10305. }
  10306. if (csName || csRef) {
  10307. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  10308. }
  10309. }
  10310. static getCached(cacheKey, xref, localColorSpaceCache) {
  10311. if (!localColorSpaceCache) {
  10312. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  10313. }
  10314. if (cacheKey instanceof _primitives.Ref) {
  10315. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  10316. if (localColorSpace) {
  10317. return localColorSpace;
  10318. }
  10319. try {
  10320. cacheKey = xref.fetch(cacheKey);
  10321. } catch (ex) {
  10322. if (ex instanceof _core_utils.MissingDataException) {
  10323. throw ex;
  10324. }
  10325. }
  10326. }
  10327. if (cacheKey instanceof _primitives.Name) {
  10328. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  10329. if (localColorSpace) {
  10330. return localColorSpace;
  10331. }
  10332. }
  10333. return null;
  10334. }
  10335. static async parseAsync(_ref) {
  10336. let {
  10337. cs,
  10338. xref,
  10339. resources = null,
  10340. pdfFunctionFactory,
  10341. localColorSpaceCache
  10342. } = _ref;
  10343. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10344. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10345. return parsedColorSpace;
  10346. }
  10347. static parse(_ref2) {
  10348. let {
  10349. cs,
  10350. xref,
  10351. resources = null,
  10352. pdfFunctionFactory,
  10353. localColorSpaceCache
  10354. } = _ref2;
  10355. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  10356. if (cachedColorSpace) {
  10357. return cachedColorSpace;
  10358. }
  10359. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  10360. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  10361. return parsedColorSpace;
  10362. }
  10363. static _parse(cs, xref) {
  10364. let resources = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  10365. let pdfFunctionFactory = arguments.length > 3 ? arguments[3] : undefined;
  10366. cs = xref.fetchIfRef(cs);
  10367. if (cs instanceof _primitives.Name) {
  10368. switch (cs.name) {
  10369. case "G":
  10370. case "DeviceGray":
  10371. return this.singletons.gray;
  10372. case "RGB":
  10373. case "DeviceRGB":
  10374. return this.singletons.rgb;
  10375. case "CMYK":
  10376. case "DeviceCMYK":
  10377. return this.singletons.cmyk;
  10378. case "Pattern":
  10379. return new PatternCS(null);
  10380. default:
  10381. if (resources instanceof _primitives.Dict) {
  10382. const colorSpaces = resources.get("ColorSpace");
  10383. if (colorSpaces instanceof _primitives.Dict) {
  10384. const resourcesCS = colorSpaces.get(cs.name);
  10385. if (resourcesCS) {
  10386. if (resourcesCS instanceof _primitives.Name) {
  10387. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  10388. }
  10389. cs = resourcesCS;
  10390. break;
  10391. }
  10392. }
  10393. }
  10394. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  10395. }
  10396. }
  10397. if (Array.isArray(cs)) {
  10398. const mode = xref.fetchIfRef(cs[0]).name;
  10399. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  10400. switch (mode) {
  10401. case "G":
  10402. case "DeviceGray":
  10403. return this.singletons.gray;
  10404. case "RGB":
  10405. case "DeviceRGB":
  10406. return this.singletons.rgb;
  10407. case "CMYK":
  10408. case "DeviceCMYK":
  10409. return this.singletons.cmyk;
  10410. case "CalGray":
  10411. params = xref.fetchIfRef(cs[1]);
  10412. whitePoint = params.getArray("WhitePoint");
  10413. blackPoint = params.getArray("BlackPoint");
  10414. gamma = params.get("Gamma");
  10415. return new CalGrayCS(whitePoint, blackPoint, gamma);
  10416. case "CalRGB":
  10417. params = xref.fetchIfRef(cs[1]);
  10418. whitePoint = params.getArray("WhitePoint");
  10419. blackPoint = params.getArray("BlackPoint");
  10420. gamma = params.getArray("Gamma");
  10421. const matrix = params.getArray("Matrix");
  10422. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  10423. case "ICCBased":
  10424. const stream = xref.fetchIfRef(cs[1]);
  10425. const dict = stream.dict;
  10426. numComps = dict.get("N");
  10427. const alt = dict.get("Alternate");
  10428. if (alt) {
  10429. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  10430. if (altCS.numComps === numComps) {
  10431. return altCS;
  10432. }
  10433. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  10434. }
  10435. if (numComps === 1) {
  10436. return this.singletons.gray;
  10437. } else if (numComps === 3) {
  10438. return this.singletons.rgb;
  10439. } else if (numComps === 4) {
  10440. return this.singletons.cmyk;
  10441. }
  10442. break;
  10443. case "Pattern":
  10444. baseCS = cs[1] || null;
  10445. if (baseCS) {
  10446. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  10447. }
  10448. return new PatternCS(baseCS);
  10449. case "I":
  10450. case "Indexed":
  10451. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  10452. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  10453. const lookup = xref.fetchIfRef(cs[3]);
  10454. return new IndexedCS(baseCS, hiVal, lookup);
  10455. case "Separation":
  10456. case "DeviceN":
  10457. const name = xref.fetchIfRef(cs[1]);
  10458. numComps = Array.isArray(name) ? name.length : 1;
  10459. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  10460. const tintFn = pdfFunctionFactory.create(cs[3]);
  10461. return new AlternateCS(numComps, baseCS, tintFn);
  10462. case "Lab":
  10463. params = xref.fetchIfRef(cs[1]);
  10464. whitePoint = params.getArray("WhitePoint");
  10465. blackPoint = params.getArray("BlackPoint");
  10466. const range = params.getArray("Range");
  10467. return new LabCS(whitePoint, blackPoint, range);
  10468. default:
  10469. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  10470. }
  10471. }
  10472. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  10473. }
  10474. static isDefaultDecode(decode, numComps) {
  10475. if (!Array.isArray(decode)) {
  10476. return true;
  10477. }
  10478. if (numComps * 2 !== decode.length) {
  10479. (0, _util.warn)("The decode map is not the correct length");
  10480. return true;
  10481. }
  10482. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  10483. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  10484. return false;
  10485. }
  10486. }
  10487. return true;
  10488. }
  10489. static get singletons() {
  10490. return (0, _util.shadow)(this, "singletons", {
  10491. get gray() {
  10492. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  10493. },
  10494. get rgb() {
  10495. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  10496. },
  10497. get cmyk() {
  10498. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  10499. }
  10500. });
  10501. }
  10502. }
  10503. exports.ColorSpace = ColorSpace;
  10504. class AlternateCS extends ColorSpace {
  10505. constructor(numComps, base, tintFn) {
  10506. super("Alternate", numComps);
  10507. this.base = base;
  10508. this.tintFn = tintFn;
  10509. this.tmpBuf = new Float32Array(base.numComps);
  10510. }
  10511. getRgbItem(src, srcOffset, dest, destOffset) {
  10512. const tmpBuf = this.tmpBuf;
  10513. this.tintFn(src, srcOffset, tmpBuf, 0);
  10514. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  10515. }
  10516. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10517. const tintFn = this.tintFn;
  10518. const base = this.base;
  10519. const scale = 1 / ((1 << bits) - 1);
  10520. const baseNumComps = base.numComps;
  10521. const usesZeroToOneRange = base.usesZeroToOneRange;
  10522. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  10523. let pos = isPassthrough ? destOffset : 0;
  10524. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  10525. const numComps = this.numComps;
  10526. const scaled = new Float32Array(numComps);
  10527. const tinted = new Float32Array(baseNumComps);
  10528. let i, j;
  10529. for (i = 0; i < count; i++) {
  10530. for (j = 0; j < numComps; j++) {
  10531. scaled[j] = src[srcOffset++] * scale;
  10532. }
  10533. tintFn(scaled, 0, tinted, 0);
  10534. if (usesZeroToOneRange) {
  10535. for (j = 0; j < baseNumComps; j++) {
  10536. baseBuf[pos++] = tinted[j] * 255;
  10537. }
  10538. } else {
  10539. base.getRgbItem(tinted, 0, baseBuf, pos);
  10540. pos += baseNumComps;
  10541. }
  10542. }
  10543. if (!isPassthrough) {
  10544. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  10545. }
  10546. }
  10547. getOutputLength(inputLength, alpha01) {
  10548. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  10549. }
  10550. }
  10551. class PatternCS extends ColorSpace {
  10552. constructor(baseCS) {
  10553. super("Pattern", null);
  10554. this.base = baseCS;
  10555. }
  10556. isDefaultDecode(decodeMap, bpc) {
  10557. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  10558. }
  10559. }
  10560. class IndexedCS extends ColorSpace {
  10561. constructor(base, highVal, lookup) {
  10562. super("Indexed", 1);
  10563. this.base = base;
  10564. this.highVal = highVal;
  10565. const length = base.numComps * highVal;
  10566. this.lookup = new Uint8Array(length);
  10567. if (lookup instanceof _base_stream.BaseStream) {
  10568. const bytes = lookup.getBytes(length);
  10569. this.lookup.set(bytes);
  10570. } else if (typeof lookup === "string") {
  10571. for (let i = 0; i < length; ++i) {
  10572. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  10573. }
  10574. } else {
  10575. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  10576. }
  10577. }
  10578. getRgbItem(src, srcOffset, dest, destOffset) {
  10579. const numComps = this.base.numComps;
  10580. const start = src[srcOffset] * numComps;
  10581. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  10582. }
  10583. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10584. const base = this.base;
  10585. const numComps = base.numComps;
  10586. const outputDelta = base.getOutputLength(numComps, alpha01);
  10587. const lookup = this.lookup;
  10588. for (let i = 0; i < count; ++i) {
  10589. const lookupPos = src[srcOffset++] * numComps;
  10590. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  10591. destOffset += outputDelta;
  10592. }
  10593. }
  10594. getOutputLength(inputLength, alpha01) {
  10595. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  10596. }
  10597. isDefaultDecode(decodeMap, bpc) {
  10598. if (!Array.isArray(decodeMap)) {
  10599. return true;
  10600. }
  10601. if (decodeMap.length !== 2) {
  10602. (0, _util.warn)("Decode map length is not correct");
  10603. return true;
  10604. }
  10605. if (!Number.isInteger(bpc) || bpc < 1) {
  10606. (0, _util.warn)("Bits per component is not correct");
  10607. return true;
  10608. }
  10609. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  10610. }
  10611. }
  10612. class DeviceGrayCS extends ColorSpace {
  10613. constructor() {
  10614. super("DeviceGray", 1);
  10615. }
  10616. getRgbItem(src, srcOffset, dest, destOffset) {
  10617. const c = src[srcOffset] * 255;
  10618. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  10619. }
  10620. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10621. const scale = 255 / ((1 << bits) - 1);
  10622. let j = srcOffset,
  10623. q = destOffset;
  10624. for (let i = 0; i < count; ++i) {
  10625. const c = scale * src[j++];
  10626. dest[q++] = c;
  10627. dest[q++] = c;
  10628. dest[q++] = c;
  10629. q += alpha01;
  10630. }
  10631. }
  10632. getOutputLength(inputLength, alpha01) {
  10633. return inputLength * (3 + alpha01);
  10634. }
  10635. }
  10636. class DeviceRgbCS extends ColorSpace {
  10637. constructor() {
  10638. super("DeviceRGB", 3);
  10639. }
  10640. getRgbItem(src, srcOffset, dest, destOffset) {
  10641. dest[destOffset] = src[srcOffset] * 255;
  10642. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  10643. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  10644. }
  10645. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10646. if (bits === 8 && alpha01 === 0) {
  10647. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  10648. return;
  10649. }
  10650. const scale = 255 / ((1 << bits) - 1);
  10651. let j = srcOffset,
  10652. q = destOffset;
  10653. for (let i = 0; i < count; ++i) {
  10654. dest[q++] = scale * src[j++];
  10655. dest[q++] = scale * src[j++];
  10656. dest[q++] = scale * src[j++];
  10657. q += alpha01;
  10658. }
  10659. }
  10660. getOutputLength(inputLength, alpha01) {
  10661. return inputLength * (3 + alpha01) / 3 | 0;
  10662. }
  10663. isPassthrough(bits) {
  10664. return bits === 8;
  10665. }
  10666. }
  10667. const DeviceCmykCS = function DeviceCmykCSClosure() {
  10668. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  10669. const c = src[srcOffset] * srcScale;
  10670. const m = src[srcOffset + 1] * srcScale;
  10671. const y = src[srcOffset + 2] * srcScale;
  10672. const k = src[srcOffset + 3] * srcScale;
  10673. 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);
  10674. 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);
  10675. 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);
  10676. }
  10677. class DeviceCmykCS extends ColorSpace {
  10678. constructor() {
  10679. super("DeviceCMYK", 4);
  10680. }
  10681. getRgbItem(src, srcOffset, dest, destOffset) {
  10682. convertToRgb(src, srcOffset, 1, dest, destOffset);
  10683. }
  10684. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10685. const scale = 1 / ((1 << bits) - 1);
  10686. for (let i = 0; i < count; i++) {
  10687. convertToRgb(src, srcOffset, scale, dest, destOffset);
  10688. srcOffset += 4;
  10689. destOffset += 3 + alpha01;
  10690. }
  10691. }
  10692. getOutputLength(inputLength, alpha01) {
  10693. return inputLength / 4 * (3 + alpha01) | 0;
  10694. }
  10695. }
  10696. return DeviceCmykCS;
  10697. }();
  10698. const CalGrayCS = function CalGrayCSClosure() {
  10699. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  10700. const A = src[srcOffset] * scale;
  10701. const AG = A ** cs.G;
  10702. const L = cs.YW * AG;
  10703. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  10704. dest[destOffset] = val;
  10705. dest[destOffset + 1] = val;
  10706. dest[destOffset + 2] = val;
  10707. }
  10708. class CalGrayCS extends ColorSpace {
  10709. constructor(whitePoint, blackPoint, gamma) {
  10710. super("CalGray", 1);
  10711. if (!whitePoint) {
  10712. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  10713. }
  10714. blackPoint = blackPoint || [0, 0, 0];
  10715. gamma = gamma || 1;
  10716. this.XW = whitePoint[0];
  10717. this.YW = whitePoint[1];
  10718. this.ZW = whitePoint[2];
  10719. this.XB = blackPoint[0];
  10720. this.YB = blackPoint[1];
  10721. this.ZB = blackPoint[2];
  10722. this.G = gamma;
  10723. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  10724. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  10725. }
  10726. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  10727. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  10728. this.XB = this.YB = this.ZB = 0;
  10729. }
  10730. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  10731. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  10732. }
  10733. if (this.G < 1) {
  10734. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  10735. this.G = 1;
  10736. }
  10737. }
  10738. getRgbItem(src, srcOffset, dest, destOffset) {
  10739. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  10740. }
  10741. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10742. const scale = 1 / ((1 << bits) - 1);
  10743. for (let i = 0; i < count; ++i) {
  10744. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  10745. srcOffset += 1;
  10746. destOffset += 3 + alpha01;
  10747. }
  10748. }
  10749. getOutputLength(inputLength, alpha01) {
  10750. return inputLength * (3 + alpha01);
  10751. }
  10752. }
  10753. return CalGrayCS;
  10754. }();
  10755. const CalRGBCS = function CalRGBCSClosure() {
  10756. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  10757. 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]);
  10758. 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]);
  10759. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  10760. const tempNormalizeMatrix = new Float32Array(3);
  10761. const tempConvertMatrix1 = new Float32Array(3);
  10762. const tempConvertMatrix2 = new Float32Array(3);
  10763. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  10764. function matrixProduct(a, b, result) {
  10765. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  10766. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  10767. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  10768. }
  10769. function convertToFlat(sourceWhitePoint, LMS, result) {
  10770. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  10771. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  10772. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  10773. }
  10774. function convertToD65(sourceWhitePoint, LMS, result) {
  10775. const D65X = 0.95047;
  10776. const D65Y = 1;
  10777. const D65Z = 1.08883;
  10778. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  10779. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  10780. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  10781. }
  10782. function sRGBTransferFunction(color) {
  10783. if (color <= 0.0031308) {
  10784. return adjustToRange(0, 1, 12.92 * color);
  10785. }
  10786. if (color >= 0.99554525) {
  10787. return 1;
  10788. }
  10789. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  10790. }
  10791. function adjustToRange(min, max, value) {
  10792. return Math.max(min, Math.min(max, value));
  10793. }
  10794. function decodeL(L) {
  10795. if (L < 0) {
  10796. return -decodeL(-L);
  10797. }
  10798. if (L > 8.0) {
  10799. return ((L + 16) / 116) ** 3;
  10800. }
  10801. return L * DECODE_L_CONSTANT;
  10802. }
  10803. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  10804. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  10805. result[0] = XYZ_Flat[0];
  10806. result[1] = XYZ_Flat[1];
  10807. result[2] = XYZ_Flat[2];
  10808. return;
  10809. }
  10810. const zeroDecodeL = decodeL(0);
  10811. const X_DST = zeroDecodeL;
  10812. const X_SRC = decodeL(sourceBlackPoint[0]);
  10813. const Y_DST = zeroDecodeL;
  10814. const Y_SRC = decodeL(sourceBlackPoint[1]);
  10815. const Z_DST = zeroDecodeL;
  10816. const Z_SRC = decodeL(sourceBlackPoint[2]);
  10817. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  10818. const X_Offset = 1 - X_Scale;
  10819. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  10820. const Y_Offset = 1 - Y_Scale;
  10821. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  10822. const Z_Offset = 1 - Z_Scale;
  10823. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  10824. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  10825. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  10826. }
  10827. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  10828. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  10829. result[0] = XYZ_In[0];
  10830. result[1] = XYZ_In[1];
  10831. result[2] = XYZ_In[2];
  10832. return;
  10833. }
  10834. const LMS = result;
  10835. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  10836. const LMS_Flat = tempNormalizeMatrix;
  10837. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  10838. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  10839. }
  10840. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  10841. const LMS = result;
  10842. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  10843. const LMS_D65 = tempNormalizeMatrix;
  10844. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  10845. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  10846. }
  10847. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  10848. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  10849. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  10850. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  10851. const AGR = A === 1 ? 1 : A ** cs.GR;
  10852. const BGG = B === 1 ? 1 : B ** cs.GG;
  10853. const CGB = C === 1 ? 1 : C ** cs.GB;
  10854. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  10855. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  10856. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  10857. const XYZ = tempConvertMatrix1;
  10858. XYZ[0] = X;
  10859. XYZ[1] = Y;
  10860. XYZ[2] = Z;
  10861. const XYZ_Flat = tempConvertMatrix2;
  10862. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  10863. const XYZ_Black = tempConvertMatrix1;
  10864. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  10865. const XYZ_D65 = tempConvertMatrix2;
  10866. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  10867. const SRGB = tempConvertMatrix1;
  10868. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  10869. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  10870. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  10871. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  10872. }
  10873. class CalRGBCS extends ColorSpace {
  10874. constructor(whitePoint, blackPoint, gamma, matrix) {
  10875. super("CalRGB", 3);
  10876. if (!whitePoint) {
  10877. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  10878. }
  10879. blackPoint = blackPoint || new Float32Array(3);
  10880. gamma = gamma || new Float32Array([1, 1, 1]);
  10881. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  10882. const XW = whitePoint[0];
  10883. const YW = whitePoint[1];
  10884. const ZW = whitePoint[2];
  10885. this.whitePoint = whitePoint;
  10886. const XB = blackPoint[0];
  10887. const YB = blackPoint[1];
  10888. const ZB = blackPoint[2];
  10889. this.blackPoint = blackPoint;
  10890. this.GR = gamma[0];
  10891. this.GG = gamma[1];
  10892. this.GB = gamma[2];
  10893. this.MXA = matrix[0];
  10894. this.MYA = matrix[1];
  10895. this.MZA = matrix[2];
  10896. this.MXB = matrix[3];
  10897. this.MYB = matrix[4];
  10898. this.MZB = matrix[5];
  10899. this.MXC = matrix[6];
  10900. this.MYC = matrix[7];
  10901. this.MZC = matrix[8];
  10902. if (XW < 0 || ZW < 0 || YW !== 1) {
  10903. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  10904. }
  10905. if (XB < 0 || YB < 0 || ZB < 0) {
  10906. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  10907. this.blackPoint = new Float32Array(3);
  10908. }
  10909. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  10910. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  10911. this.GR = this.GG = this.GB = 1;
  10912. }
  10913. }
  10914. getRgbItem(src, srcOffset, dest, destOffset) {
  10915. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  10916. }
  10917. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10918. const scale = 1 / ((1 << bits) - 1);
  10919. for (let i = 0; i < count; ++i) {
  10920. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  10921. srcOffset += 3;
  10922. destOffset += 3 + alpha01;
  10923. }
  10924. }
  10925. getOutputLength(inputLength, alpha01) {
  10926. return inputLength * (3 + alpha01) / 3 | 0;
  10927. }
  10928. }
  10929. return CalRGBCS;
  10930. }();
  10931. const LabCS = function LabCSClosure() {
  10932. function fn_g(x) {
  10933. let result;
  10934. if (x >= 6 / 29) {
  10935. result = x ** 3;
  10936. } else {
  10937. result = 108 / 841 * (x - 4 / 29);
  10938. }
  10939. return result;
  10940. }
  10941. function decode(value, high1, low2, high2) {
  10942. return low2 + value * (high2 - low2) / high1;
  10943. }
  10944. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  10945. let Ls = src[srcOffset];
  10946. let as = src[srcOffset + 1];
  10947. let bs = src[srcOffset + 2];
  10948. if (maxVal !== false) {
  10949. Ls = decode(Ls, maxVal, 0, 100);
  10950. as = decode(as, maxVal, cs.amin, cs.amax);
  10951. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  10952. }
  10953. if (as > cs.amax) {
  10954. as = cs.amax;
  10955. } else if (as < cs.amin) {
  10956. as = cs.amin;
  10957. }
  10958. if (bs > cs.bmax) {
  10959. bs = cs.bmax;
  10960. } else if (bs < cs.bmin) {
  10961. bs = cs.bmin;
  10962. }
  10963. const M = (Ls + 16) / 116;
  10964. const L = M + as / 500;
  10965. const N = M - bs / 200;
  10966. const X = cs.XW * fn_g(L);
  10967. const Y = cs.YW * fn_g(M);
  10968. const Z = cs.ZW * fn_g(N);
  10969. let r, g, b;
  10970. if (cs.ZW < 1) {
  10971. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  10972. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  10973. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  10974. } else {
  10975. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  10976. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  10977. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  10978. }
  10979. dest[destOffset] = Math.sqrt(r) * 255;
  10980. dest[destOffset + 1] = Math.sqrt(g) * 255;
  10981. dest[destOffset + 2] = Math.sqrt(b) * 255;
  10982. }
  10983. class LabCS extends ColorSpace {
  10984. constructor(whitePoint, blackPoint, range) {
  10985. super("Lab", 3);
  10986. if (!whitePoint) {
  10987. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  10988. }
  10989. blackPoint = blackPoint || [0, 0, 0];
  10990. range = range || [-100, 100, -100, 100];
  10991. this.XW = whitePoint[0];
  10992. this.YW = whitePoint[1];
  10993. this.ZW = whitePoint[2];
  10994. this.amin = range[0];
  10995. this.amax = range[1];
  10996. this.bmin = range[2];
  10997. this.bmax = range[3];
  10998. this.XB = blackPoint[0];
  10999. this.YB = blackPoint[1];
  11000. this.ZB = blackPoint[2];
  11001. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  11002. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  11003. }
  11004. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  11005. (0, _util.info)("Invalid BlackPoint, falling back to default");
  11006. this.XB = this.YB = this.ZB = 0;
  11007. }
  11008. if (this.amin > this.amax || this.bmin > this.bmax) {
  11009. (0, _util.info)("Invalid Range, falling back to defaults");
  11010. this.amin = -100;
  11011. this.amax = 100;
  11012. this.bmin = -100;
  11013. this.bmax = 100;
  11014. }
  11015. }
  11016. getRgbItem(src, srcOffset, dest, destOffset) {
  11017. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  11018. }
  11019. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  11020. const maxVal = (1 << bits) - 1;
  11021. for (let i = 0; i < count; i++) {
  11022. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  11023. srcOffset += 3;
  11024. destOffset += 3 + alpha01;
  11025. }
  11026. }
  11027. getOutputLength(inputLength, alpha01) {
  11028. return inputLength * (3 + alpha01) / 3 | 0;
  11029. }
  11030. isDefaultDecode(decodeMap, bpc) {
  11031. return true;
  11032. }
  11033. get usesZeroToOneRange() {
  11034. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  11035. }
  11036. }
  11037. return LabCS;
  11038. }();
  11039. /***/ }),
  11040. /* 144 */
  11041. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11042. "use strict";
  11043. Object.defineProperty(exports, "__esModule", ({
  11044. value: true
  11045. }));
  11046. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  11047. var _util = __w_pdfjs_require__(2);
  11048. var _cmap = __w_pdfjs_require__(145);
  11049. var _primitives = __w_pdfjs_require__(134);
  11050. var _fonts = __w_pdfjs_require__(163);
  11051. var _fonts_utils = __w_pdfjs_require__(167);
  11052. var _encodings = __w_pdfjs_require__(166);
  11053. var _standard_fonts = __w_pdfjs_require__(170);
  11054. var _unicode = __w_pdfjs_require__(169);
  11055. var _pattern = __w_pdfjs_require__(179);
  11056. var _xfa_fonts = __w_pdfjs_require__(180);
  11057. var _to_unicode_map = __w_pdfjs_require__(171);
  11058. var _function = __w_pdfjs_require__(186);
  11059. var _parser = __w_pdfjs_require__(146);
  11060. var _image_utils = __w_pdfjs_require__(188);
  11061. var _stream = __w_pdfjs_require__(139);
  11062. var _base_stream = __w_pdfjs_require__(136);
  11063. var _bidi = __w_pdfjs_require__(189);
  11064. var _colorspace = __w_pdfjs_require__(143);
  11065. var _decode_stream = __w_pdfjs_require__(148);
  11066. var _glyphlist = __w_pdfjs_require__(168);
  11067. var _core_utils = __w_pdfjs_require__(135);
  11068. var _metrics = __w_pdfjs_require__(174);
  11069. var _murmurhash = __w_pdfjs_require__(190);
  11070. var _operator_list = __w_pdfjs_require__(191);
  11071. var _image = __w_pdfjs_require__(192);
  11072. const DefaultPartialEvaluatorOptions = Object.freeze({
  11073. maxImageSize: -1,
  11074. disableFontFace: false,
  11075. ignoreErrors: false,
  11076. isEvalSupported: true,
  11077. isOffscreenCanvasSupported: true,
  11078. fontExtraProperties: false,
  11079. useSystemFonts: true,
  11080. cMapUrl: null,
  11081. standardFontDataUrl: null
  11082. });
  11083. const PatternType = {
  11084. TILING: 1,
  11085. SHADING: 2
  11086. };
  11087. const TEXT_CHUNK_BATCH_SIZE = 10;
  11088. const deferred = Promise.resolve();
  11089. function normalizeBlendMode(value) {
  11090. let parsingArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11091. if (Array.isArray(value)) {
  11092. for (const val of value) {
  11093. const maybeBM = normalizeBlendMode(val, true);
  11094. if (maybeBM) {
  11095. return maybeBM;
  11096. }
  11097. }
  11098. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  11099. return "source-over";
  11100. }
  11101. if (!(value instanceof _primitives.Name)) {
  11102. if (parsingArray) {
  11103. return null;
  11104. }
  11105. return "source-over";
  11106. }
  11107. switch (value.name) {
  11108. case "Normal":
  11109. case "Compatible":
  11110. return "source-over";
  11111. case "Multiply":
  11112. return "multiply";
  11113. case "Screen":
  11114. return "screen";
  11115. case "Overlay":
  11116. return "overlay";
  11117. case "Darken":
  11118. return "darken";
  11119. case "Lighten":
  11120. return "lighten";
  11121. case "ColorDodge":
  11122. return "color-dodge";
  11123. case "ColorBurn":
  11124. return "color-burn";
  11125. case "HardLight":
  11126. return "hard-light";
  11127. case "SoftLight":
  11128. return "soft-light";
  11129. case "Difference":
  11130. return "difference";
  11131. case "Exclusion":
  11132. return "exclusion";
  11133. case "Hue":
  11134. return "hue";
  11135. case "Saturation":
  11136. return "saturation";
  11137. case "Color":
  11138. return "color";
  11139. case "Luminosity":
  11140. return "luminosity";
  11141. }
  11142. if (parsingArray) {
  11143. return null;
  11144. }
  11145. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  11146. return "source-over";
  11147. }
  11148. function incrementCachedImageMaskCount(data) {
  11149. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  11150. data.args[0].count++;
  11151. }
  11152. }
  11153. class TimeSlotManager {
  11154. static get TIME_SLOT_DURATION_MS() {
  11155. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  11156. }
  11157. static get CHECK_TIME_EVERY() {
  11158. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  11159. }
  11160. constructor() {
  11161. this.reset();
  11162. }
  11163. check() {
  11164. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  11165. return false;
  11166. }
  11167. this.checked = 0;
  11168. return this.endTime <= Date.now();
  11169. }
  11170. reset() {
  11171. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  11172. this.checked = 0;
  11173. }
  11174. }
  11175. class PartialEvaluator {
  11176. constructor(_ref) {
  11177. let {
  11178. xref,
  11179. handler,
  11180. pageIndex,
  11181. idFactory,
  11182. fontCache,
  11183. builtInCMapCache,
  11184. standardFontDataCache,
  11185. globalImageCache,
  11186. options = null
  11187. } = _ref;
  11188. this.xref = xref;
  11189. this.handler = handler;
  11190. this.pageIndex = pageIndex;
  11191. this.idFactory = idFactory;
  11192. this.fontCache = fontCache;
  11193. this.builtInCMapCache = builtInCMapCache;
  11194. this.standardFontDataCache = standardFontDataCache;
  11195. this.globalImageCache = globalImageCache;
  11196. this.options = options || DefaultPartialEvaluatorOptions;
  11197. this.parsingType3Font = false;
  11198. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  11199. }
  11200. get _pdfFunctionFactory() {
  11201. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  11202. xref: this.xref,
  11203. isEvalSupported: this.options.isEvalSupported
  11204. });
  11205. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  11206. }
  11207. clone() {
  11208. let newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11209. const newEvaluator = Object.create(this);
  11210. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  11211. return newEvaluator;
  11212. }
  11213. hasBlendModes(resources, nonBlendModesSet) {
  11214. if (!(resources instanceof _primitives.Dict)) {
  11215. return false;
  11216. }
  11217. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  11218. return false;
  11219. }
  11220. const processed = new _primitives.RefSet(nonBlendModesSet);
  11221. if (resources.objId) {
  11222. processed.put(resources.objId);
  11223. }
  11224. const nodes = [resources],
  11225. xref = this.xref;
  11226. while (nodes.length) {
  11227. const node = nodes.shift();
  11228. const graphicStates = node.get("ExtGState");
  11229. if (graphicStates instanceof _primitives.Dict) {
  11230. for (let graphicState of graphicStates.getRawValues()) {
  11231. if (graphicState instanceof _primitives.Ref) {
  11232. if (processed.has(graphicState)) {
  11233. continue;
  11234. }
  11235. try {
  11236. graphicState = xref.fetch(graphicState);
  11237. } catch (ex) {
  11238. processed.put(graphicState);
  11239. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  11240. continue;
  11241. }
  11242. }
  11243. if (!(graphicState instanceof _primitives.Dict)) {
  11244. continue;
  11245. }
  11246. if (graphicState.objId) {
  11247. processed.put(graphicState.objId);
  11248. }
  11249. const bm = graphicState.get("BM");
  11250. if (bm instanceof _primitives.Name) {
  11251. if (bm.name !== "Normal") {
  11252. return true;
  11253. }
  11254. continue;
  11255. }
  11256. if (bm !== undefined && Array.isArray(bm)) {
  11257. for (const element of bm) {
  11258. if (element instanceof _primitives.Name && element.name !== "Normal") {
  11259. return true;
  11260. }
  11261. }
  11262. }
  11263. }
  11264. }
  11265. const xObjects = node.get("XObject");
  11266. if (!(xObjects instanceof _primitives.Dict)) {
  11267. continue;
  11268. }
  11269. for (let xObject of xObjects.getRawValues()) {
  11270. if (xObject instanceof _primitives.Ref) {
  11271. if (processed.has(xObject)) {
  11272. continue;
  11273. }
  11274. try {
  11275. xObject = xref.fetch(xObject);
  11276. } catch (ex) {
  11277. processed.put(xObject);
  11278. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  11279. continue;
  11280. }
  11281. }
  11282. if (!(xObject instanceof _base_stream.BaseStream)) {
  11283. continue;
  11284. }
  11285. if (xObject.dict.objId) {
  11286. processed.put(xObject.dict.objId);
  11287. }
  11288. const xResources = xObject.dict.get("Resources");
  11289. if (!(xResources instanceof _primitives.Dict)) {
  11290. continue;
  11291. }
  11292. if (xResources.objId && processed.has(xResources.objId)) {
  11293. continue;
  11294. }
  11295. nodes.push(xResources);
  11296. if (xResources.objId) {
  11297. processed.put(xResources.objId);
  11298. }
  11299. }
  11300. }
  11301. for (const ref of processed) {
  11302. nonBlendModesSet.put(ref);
  11303. }
  11304. return false;
  11305. }
  11306. async fetchBuiltInCMap(name) {
  11307. const cachedData = this.builtInCMapCache.get(name);
  11308. if (cachedData) {
  11309. return cachedData;
  11310. }
  11311. let data;
  11312. if (this.options.cMapUrl !== null) {
  11313. const url = `${this.options.cMapUrl}${name}.bcmap`;
  11314. const response = await fetch(url);
  11315. if (!response.ok) {
  11316. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  11317. }
  11318. data = {
  11319. cMapData: new Uint8Array(await response.arrayBuffer()),
  11320. compressionType: _util.CMapCompressionType.BINARY
  11321. };
  11322. } else {
  11323. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  11324. name
  11325. });
  11326. }
  11327. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  11328. this.builtInCMapCache.set(name, data);
  11329. }
  11330. return data;
  11331. }
  11332. async fetchStandardFontData(name) {
  11333. const cachedData = this.standardFontDataCache.get(name);
  11334. if (cachedData) {
  11335. return new _stream.Stream(cachedData);
  11336. }
  11337. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  11338. return null;
  11339. }
  11340. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  11341. filename = standardFontNameToFileName[name];
  11342. let data;
  11343. if (this.options.standardFontDataUrl !== null) {
  11344. const url = `${this.options.standardFontDataUrl}${filename}`;
  11345. const response = await fetch(url);
  11346. if (!response.ok) {
  11347. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  11348. } else {
  11349. data = await response.arrayBuffer();
  11350. }
  11351. } else {
  11352. try {
  11353. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  11354. filename
  11355. });
  11356. } catch (e) {
  11357. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  11358. }
  11359. }
  11360. if (!data) {
  11361. return null;
  11362. }
  11363. this.standardFontDataCache.set(name, data);
  11364. return new _stream.Stream(data);
  11365. }
  11366. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  11367. const dict = xobj.dict;
  11368. const matrix = dict.getArray("Matrix");
  11369. let bbox = dict.getArray("BBox");
  11370. if (Array.isArray(bbox) && bbox.length === 4) {
  11371. bbox = _util.Util.normalizeRect(bbox);
  11372. } else {
  11373. bbox = null;
  11374. }
  11375. let optionalContent, groupOptions;
  11376. if (dict.has("OC")) {
  11377. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11378. }
  11379. if (optionalContent !== undefined) {
  11380. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  11381. }
  11382. const group = dict.get("Group");
  11383. if (group) {
  11384. groupOptions = {
  11385. matrix,
  11386. bbox,
  11387. smask,
  11388. isolated: false,
  11389. knockout: false
  11390. };
  11391. const groupSubtype = group.get("S");
  11392. let colorSpace = null;
  11393. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  11394. groupOptions.isolated = group.get("I") || false;
  11395. groupOptions.knockout = group.get("K") || false;
  11396. if (group.has("CS")) {
  11397. const cs = group.getRaw("CS");
  11398. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  11399. if (cachedColorSpace) {
  11400. colorSpace = cachedColorSpace;
  11401. } else {
  11402. colorSpace = await this.parseColorSpace({
  11403. cs,
  11404. resources,
  11405. localColorSpaceCache
  11406. });
  11407. }
  11408. }
  11409. }
  11410. if (smask && smask.backdrop) {
  11411. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  11412. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  11413. }
  11414. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  11415. }
  11416. const args = group ? [matrix, null] : [matrix, bbox];
  11417. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  11418. return this.getOperatorList({
  11419. stream: xobj,
  11420. task,
  11421. resources: dict.get("Resources") || resources,
  11422. operatorList,
  11423. initialState
  11424. }).then(function () {
  11425. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  11426. if (group) {
  11427. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  11428. }
  11429. if (optionalContent !== undefined) {
  11430. operatorList.addOp(_util.OPS.endMarkedContent, []);
  11431. }
  11432. });
  11433. }
  11434. _sendImgData(objId, imgData) {
  11435. let cacheGlobally = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  11436. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  11437. if (this.parsingType3Font || cacheGlobally) {
  11438. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  11439. }
  11440. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  11441. }
  11442. async buildPaintImageXObject(_ref2) {
  11443. let {
  11444. resources,
  11445. image,
  11446. isInline = false,
  11447. operatorList,
  11448. cacheKey,
  11449. localImageCache,
  11450. localColorSpaceCache
  11451. } = _ref2;
  11452. const dict = image.dict;
  11453. const imageRef = dict.objId;
  11454. const w = dict.get("W", "Width");
  11455. const h = dict.get("H", "Height");
  11456. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  11457. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  11458. return;
  11459. }
  11460. const maxImageSize = this.options.maxImageSize;
  11461. if (maxImageSize !== -1 && w * h > maxImageSize) {
  11462. const msg = "Image exceeded maximum allowed size and was removed.";
  11463. if (this.options.ignoreErrors) {
  11464. (0, _util.warn)(msg);
  11465. return;
  11466. }
  11467. throw new Error(msg);
  11468. }
  11469. let optionalContent;
  11470. if (dict.has("OC")) {
  11471. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  11472. }
  11473. const imageMask = dict.get("IM", "ImageMask") || false;
  11474. let imgData, args;
  11475. if (imageMask) {
  11476. const interpolate = dict.get("I", "Interpolate");
  11477. const bitStrideLength = w + 7 >> 3;
  11478. const imgArray = image.getBytes(bitStrideLength * h);
  11479. const decode = dict.getArray("D", "Decode");
  11480. if (this.parsingType3Font) {
  11481. imgData = _image.PDFImage.createRawMask({
  11482. imgArray,
  11483. width: w,
  11484. height: h,
  11485. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11486. inverseDecode: !!decode && decode[0] > 0,
  11487. interpolate
  11488. });
  11489. imgData.cached = !!cacheKey;
  11490. args = [imgData];
  11491. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11492. if (cacheKey) {
  11493. localImageCache.set(cacheKey, imageRef, {
  11494. fn: _util.OPS.paintImageMaskXObject,
  11495. args,
  11496. optionalContent
  11497. });
  11498. }
  11499. return;
  11500. }
  11501. imgData = _image.PDFImage.createMask({
  11502. imgArray,
  11503. width: w,
  11504. height: h,
  11505. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  11506. inverseDecode: !!decode && decode[0] > 0,
  11507. interpolate,
  11508. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  11509. });
  11510. if (imgData.isSingleOpaquePixel) {
  11511. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  11512. if (cacheKey) {
  11513. localImageCache.set(cacheKey, imageRef, {
  11514. fn: _util.OPS.paintSolidColorImageMask,
  11515. args: [],
  11516. optionalContent
  11517. });
  11518. }
  11519. return;
  11520. }
  11521. const objId = `mask_${this.idFactory.createObjId()}`;
  11522. operatorList.addDependency(objId);
  11523. this._sendImgData(objId, imgData);
  11524. args = [{
  11525. data: objId,
  11526. width: imgData.width,
  11527. height: imgData.height,
  11528. interpolate: imgData.interpolate,
  11529. count: 1
  11530. }];
  11531. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  11532. if (cacheKey) {
  11533. localImageCache.set(cacheKey, imageRef, {
  11534. fn: _util.OPS.paintImageMaskXObject,
  11535. args,
  11536. optionalContent
  11537. });
  11538. }
  11539. return;
  11540. }
  11541. const softMask = dict.get("SM", "SMask") || false;
  11542. const mask = dict.get("Mask") || false;
  11543. const SMALL_IMAGE_DIMENSIONS = 200;
  11544. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  11545. const imageObj = new _image.PDFImage({
  11546. xref: this.xref,
  11547. res: resources,
  11548. image,
  11549. isInline,
  11550. pdfFunctionFactory: this._pdfFunctionFactory,
  11551. localColorSpaceCache
  11552. });
  11553. imgData = imageObj.createImageData(true);
  11554. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  11555. return;
  11556. }
  11557. let objId = `img_${this.idFactory.createObjId()}`,
  11558. cacheGlobally = false;
  11559. if (this.parsingType3Font) {
  11560. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  11561. } else if (imageRef) {
  11562. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  11563. if (cacheGlobally) {
  11564. objId = `${this.idFactory.getDocId()}_${objId}`;
  11565. }
  11566. }
  11567. operatorList.addDependency(objId);
  11568. args = [objId, w, h];
  11569. _image.PDFImage.buildImage({
  11570. xref: this.xref,
  11571. res: resources,
  11572. image,
  11573. isInline,
  11574. pdfFunctionFactory: this._pdfFunctionFactory,
  11575. localColorSpaceCache
  11576. }).then(imageObj => {
  11577. imgData = imageObj.createImageData(false);
  11578. if (cacheKey && imageRef && cacheGlobally) {
  11579. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  11580. }
  11581. return this._sendImgData(objId, imgData, cacheGlobally);
  11582. }).catch(reason => {
  11583. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  11584. return this._sendImgData(objId, null, cacheGlobally);
  11585. });
  11586. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  11587. if (cacheKey) {
  11588. localImageCache.set(cacheKey, imageRef, {
  11589. fn: _util.OPS.paintImageXObject,
  11590. args,
  11591. optionalContent
  11592. });
  11593. if (imageRef) {
  11594. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  11595. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  11596. if (cacheGlobally) {
  11597. this.globalImageCache.setData(imageRef, {
  11598. objId,
  11599. fn: _util.OPS.paintImageXObject,
  11600. args,
  11601. optionalContent,
  11602. byteSize: 0
  11603. });
  11604. }
  11605. }
  11606. }
  11607. }
  11608. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  11609. const smaskContent = smask.get("G");
  11610. const smaskOptions = {
  11611. subtype: smask.get("S").name,
  11612. backdrop: smask.get("BC")
  11613. };
  11614. const transferObj = smask.get("TR");
  11615. if ((0, _function.isPDFFunction)(transferObj)) {
  11616. const transferFn = this._pdfFunctionFactory.create(transferObj);
  11617. const transferMap = new Uint8Array(256);
  11618. const tmp = new Float32Array(1);
  11619. for (let i = 0; i < 256; i++) {
  11620. tmp[0] = i / 255;
  11621. transferFn(tmp, 0, tmp, 0);
  11622. transferMap[i] = tmp[0] * 255 | 0;
  11623. }
  11624. smaskOptions.transferMap = transferMap;
  11625. }
  11626. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  11627. }
  11628. handleTransferFunction(tr) {
  11629. let transferArray;
  11630. if (Array.isArray(tr)) {
  11631. transferArray = tr;
  11632. } else if ((0, _function.isPDFFunction)(tr)) {
  11633. transferArray = [tr];
  11634. } else {
  11635. return null;
  11636. }
  11637. const transferMaps = [];
  11638. let numFns = 0,
  11639. numEffectfulFns = 0;
  11640. for (const entry of transferArray) {
  11641. const transferObj = this.xref.fetchIfRef(entry);
  11642. numFns++;
  11643. if ((0, _primitives.isName)(transferObj, "Identity")) {
  11644. transferMaps.push(null);
  11645. continue;
  11646. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  11647. return null;
  11648. }
  11649. const transferFn = this._pdfFunctionFactory.create(transferObj);
  11650. const transferMap = new Uint8Array(256),
  11651. tmp = new Float32Array(1);
  11652. for (let j = 0; j < 256; j++) {
  11653. tmp[0] = j / 255;
  11654. transferFn(tmp, 0, tmp, 0);
  11655. transferMap[j] = tmp[0] * 255 | 0;
  11656. }
  11657. transferMaps.push(transferMap);
  11658. numEffectfulFns++;
  11659. }
  11660. if (!(numFns === 1 || numFns === 4)) {
  11661. return null;
  11662. }
  11663. if (numEffectfulFns === 0) {
  11664. return null;
  11665. }
  11666. return transferMaps;
  11667. }
  11668. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  11669. const tilingOpList = new _operator_list.OperatorList();
  11670. const patternResources = _primitives.Dict.merge({
  11671. xref: this.xref,
  11672. dictArray: [patternDict.get("Resources"), resources]
  11673. });
  11674. return this.getOperatorList({
  11675. stream: pattern,
  11676. task,
  11677. resources: patternResources,
  11678. operatorList: tilingOpList
  11679. }).then(function () {
  11680. const operatorListIR = tilingOpList.getIR();
  11681. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  11682. operatorList.addDependencies(tilingOpList.dependencies);
  11683. operatorList.addOp(fn, tilingPatternIR);
  11684. if (patternDict.objId) {
  11685. localTilingPatternCache.set(null, patternDict.objId, {
  11686. operatorListIR,
  11687. dict: patternDict
  11688. });
  11689. }
  11690. }).catch(reason => {
  11691. if (reason instanceof _util.AbortException) {
  11692. return;
  11693. }
  11694. if (this.options.ignoreErrors) {
  11695. this.handler.send("UnsupportedFeature", {
  11696. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  11697. });
  11698. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  11699. return;
  11700. }
  11701. throw reason;
  11702. });
  11703. }
  11704. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  11705. let fallbackFontDict = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  11706. let cssFontInfo = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  11707. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  11708. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  11709. if (!translated.font.isType3Font) {
  11710. return translated;
  11711. }
  11712. return translated.loadType3Data(this, resources, task).then(function () {
  11713. operatorList.addDependencies(translated.type3Dependencies);
  11714. return translated;
  11715. }).catch(reason => {
  11716. this.handler.send("UnsupportedFeature", {
  11717. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  11718. });
  11719. return new TranslatedFont({
  11720. loadedName: "g_font_error",
  11721. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  11722. dict: translated.font,
  11723. evaluatorOptions: this.options
  11724. });
  11725. });
  11726. }).then(translated => {
  11727. state.font = translated.font;
  11728. translated.send(this.handler);
  11729. return translated.loadedName;
  11730. });
  11731. }
  11732. handleText(chars, state) {
  11733. const font = state.font;
  11734. const glyphs = font.charsToGlyphs(chars);
  11735. if (font.data) {
  11736. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  11737. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  11738. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  11739. }
  11740. }
  11741. return glyphs;
  11742. }
  11743. ensureStateFont(state) {
  11744. if (state.font) {
  11745. return;
  11746. }
  11747. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  11748. if (this.options.ignoreErrors) {
  11749. this.handler.send("UnsupportedFeature", {
  11750. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  11751. });
  11752. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  11753. return;
  11754. }
  11755. throw reason;
  11756. }
  11757. async setGState(_ref3) {
  11758. let {
  11759. resources,
  11760. gState,
  11761. operatorList,
  11762. cacheKey,
  11763. task,
  11764. stateManager,
  11765. localGStateCache,
  11766. localColorSpaceCache
  11767. } = _ref3;
  11768. const gStateRef = gState.objId;
  11769. let isSimpleGState = true;
  11770. const gStateObj = [];
  11771. let promise = Promise.resolve();
  11772. for (const key of gState.getKeys()) {
  11773. const value = gState.get(key);
  11774. switch (key) {
  11775. case "Type":
  11776. break;
  11777. case "LW":
  11778. case "LC":
  11779. case "LJ":
  11780. case "ML":
  11781. case "D":
  11782. case "RI":
  11783. case "FL":
  11784. case "CA":
  11785. case "ca":
  11786. gStateObj.push([key, value]);
  11787. break;
  11788. case "Font":
  11789. isSimpleGState = false;
  11790. promise = promise.then(() => {
  11791. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  11792. operatorList.addDependency(loadedName);
  11793. gStateObj.push([key, [loadedName, value[1]]]);
  11794. });
  11795. });
  11796. break;
  11797. case "BM":
  11798. gStateObj.push([key, normalizeBlendMode(value)]);
  11799. break;
  11800. case "SMask":
  11801. if ((0, _primitives.isName)(value, "None")) {
  11802. gStateObj.push([key, false]);
  11803. break;
  11804. }
  11805. if (value instanceof _primitives.Dict) {
  11806. isSimpleGState = false;
  11807. promise = promise.then(() => {
  11808. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  11809. });
  11810. gStateObj.push([key, true]);
  11811. } else {
  11812. (0, _util.warn)("Unsupported SMask type");
  11813. }
  11814. break;
  11815. case "TR":
  11816. const transferMaps = this.handleTransferFunction(value);
  11817. gStateObj.push([key, transferMaps]);
  11818. break;
  11819. case "OP":
  11820. case "op":
  11821. case "OPM":
  11822. case "BG":
  11823. case "BG2":
  11824. case "UCR":
  11825. case "UCR2":
  11826. case "TR2":
  11827. case "HT":
  11828. case "SM":
  11829. case "SA":
  11830. case "AIS":
  11831. case "TK":
  11832. (0, _util.info)("graphic state operator " + key);
  11833. break;
  11834. default:
  11835. (0, _util.info)("Unknown graphic state operator " + key);
  11836. break;
  11837. }
  11838. }
  11839. return promise.then(function () {
  11840. if (gStateObj.length > 0) {
  11841. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  11842. }
  11843. if (isSimpleGState) {
  11844. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  11845. }
  11846. });
  11847. }
  11848. loadFont(fontName, font, resources) {
  11849. let fallbackFontDict = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  11850. let cssFontInfo = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  11851. const errorFont = async () => {
  11852. return new TranslatedFont({
  11853. loadedName: "g_font_error",
  11854. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  11855. dict: font,
  11856. evaluatorOptions: this.options
  11857. });
  11858. };
  11859. const xref = this.xref;
  11860. let fontRef;
  11861. if (font) {
  11862. if (font instanceof _primitives.Ref) {
  11863. fontRef = font;
  11864. }
  11865. } else {
  11866. const fontRes = resources.get("Font");
  11867. if (fontRes) {
  11868. fontRef = fontRes.getRaw(fontName);
  11869. }
  11870. }
  11871. if (!fontRef) {
  11872. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  11873. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  11874. (0, _util.warn)(`${partialMsg}.`);
  11875. return errorFont();
  11876. }
  11877. this.handler.send("UnsupportedFeature", {
  11878. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  11879. });
  11880. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  11881. if (fallbackFontDict) {
  11882. fontRef = fallbackFontDict;
  11883. } else {
  11884. fontRef = PartialEvaluator.fallbackFontDict;
  11885. }
  11886. }
  11887. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  11888. return errorFont();
  11889. }
  11890. if (this.fontCache.has(fontRef)) {
  11891. return this.fontCache.get(fontRef);
  11892. }
  11893. font = xref.fetchIfRef(fontRef);
  11894. if (!(font instanceof _primitives.Dict)) {
  11895. return errorFont();
  11896. }
  11897. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  11898. return this.fontCache.get(font.cacheKey);
  11899. }
  11900. const fontCapability = (0, _util.createPromiseCapability)();
  11901. let preEvaluatedFont;
  11902. try {
  11903. preEvaluatedFont = this.preEvaluateFont(font);
  11904. preEvaluatedFont.cssFontInfo = cssFontInfo;
  11905. } catch (reason) {
  11906. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  11907. return errorFont();
  11908. }
  11909. const {
  11910. descriptor,
  11911. hash
  11912. } = preEvaluatedFont;
  11913. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  11914. let fontID;
  11915. if (fontRefIsRef) {
  11916. fontID = `f${fontRef.toString()}`;
  11917. }
  11918. if (hash && descriptor instanceof _primitives.Dict) {
  11919. if (!descriptor.fontAliases) {
  11920. descriptor.fontAliases = Object.create(null);
  11921. }
  11922. const fontAliases = descriptor.fontAliases;
  11923. if (fontAliases[hash]) {
  11924. const aliasFontRef = fontAliases[hash].aliasRef;
  11925. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  11926. this.fontCache.putAlias(fontRef, aliasFontRef);
  11927. return this.fontCache.get(fontRef);
  11928. }
  11929. } else {
  11930. fontAliases[hash] = {
  11931. fontID: this.idFactory.createFontId()
  11932. };
  11933. }
  11934. if (fontRefIsRef) {
  11935. fontAliases[hash].aliasRef = fontRef;
  11936. }
  11937. fontID = fontAliases[hash].fontID;
  11938. }
  11939. if (fontRefIsRef) {
  11940. this.fontCache.put(fontRef, fontCapability.promise);
  11941. } else {
  11942. if (!fontID) {
  11943. fontID = this.idFactory.createFontId();
  11944. }
  11945. font.cacheKey = `cacheKey_${fontID}`;
  11946. this.fontCache.put(font.cacheKey, fontCapability.promise);
  11947. }
  11948. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  11949. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  11950. this.translateFont(preEvaluatedFont).then(translatedFont => {
  11951. if (translatedFont.fontType !== undefined) {
  11952. xref.stats.addFontType(translatedFont.fontType);
  11953. }
  11954. fontCapability.resolve(new TranslatedFont({
  11955. loadedName: font.loadedName,
  11956. font: translatedFont,
  11957. dict: font,
  11958. evaluatorOptions: this.options
  11959. }));
  11960. }).catch(reason => {
  11961. this.handler.send("UnsupportedFeature", {
  11962. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  11963. });
  11964. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  11965. try {
  11966. const fontFile3 = descriptor && descriptor.get("FontFile3");
  11967. const subtype = fontFile3 && fontFile3.get("Subtype");
  11968. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  11969. if (fontType !== undefined) {
  11970. xref.stats.addFontType(fontType);
  11971. }
  11972. } catch (ex) {}
  11973. fontCapability.resolve(new TranslatedFont({
  11974. loadedName: font.loadedName,
  11975. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  11976. dict: font,
  11977. evaluatorOptions: this.options
  11978. }));
  11979. });
  11980. return fontCapability.promise;
  11981. }
  11982. buildPath(operatorList, fn, args) {
  11983. let parsingText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  11984. const lastIndex = operatorList.length - 1;
  11985. if (!args) {
  11986. args = [];
  11987. }
  11988. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  11989. if (parsingText) {
  11990. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  11991. operatorList.addOp(_util.OPS.save, null);
  11992. }
  11993. let minMax;
  11994. switch (fn) {
  11995. case _util.OPS.rectangle:
  11996. const x = args[0] + args[2];
  11997. const y = args[1] + args[3];
  11998. minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
  11999. break;
  12000. case _util.OPS.moveTo:
  12001. case _util.OPS.lineTo:
  12002. minMax = [args[0], args[0], args[1], args[1]];
  12003. break;
  12004. default:
  12005. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  12006. break;
  12007. }
  12008. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  12009. if (parsingText) {
  12010. operatorList.addOp(_util.OPS.restore, null);
  12011. }
  12012. } else {
  12013. const opArgs = operatorList.argsArray[lastIndex];
  12014. opArgs[0].push(fn);
  12015. opArgs[1].push(...args);
  12016. const minMax = opArgs[2];
  12017. switch (fn) {
  12018. case _util.OPS.rectangle:
  12019. const x = args[0] + args[2];
  12020. const y = args[1] + args[3];
  12021. minMax[0] = Math.min(minMax[0], args[0], x);
  12022. minMax[1] = Math.max(minMax[1], args[0], x);
  12023. minMax[2] = Math.min(minMax[2], args[1], y);
  12024. minMax[3] = Math.max(minMax[3], args[1], y);
  12025. break;
  12026. case _util.OPS.moveTo:
  12027. case _util.OPS.lineTo:
  12028. minMax[0] = Math.min(minMax[0], args[0]);
  12029. minMax[1] = Math.max(minMax[1], args[0]);
  12030. minMax[2] = Math.min(minMax[2], args[1]);
  12031. minMax[3] = Math.max(minMax[3], args[1]);
  12032. break;
  12033. }
  12034. }
  12035. }
  12036. parseColorSpace(_ref4) {
  12037. let {
  12038. cs,
  12039. resources,
  12040. localColorSpaceCache
  12041. } = _ref4;
  12042. return _colorspace.ColorSpace.parseAsync({
  12043. cs,
  12044. xref: this.xref,
  12045. resources,
  12046. pdfFunctionFactory: this._pdfFunctionFactory,
  12047. localColorSpaceCache
  12048. }).catch(reason => {
  12049. if (reason instanceof _util.AbortException) {
  12050. return null;
  12051. }
  12052. if (this.options.ignoreErrors) {
  12053. this.handler.send("UnsupportedFeature", {
  12054. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  12055. });
  12056. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  12057. return null;
  12058. }
  12059. throw reason;
  12060. });
  12061. }
  12062. parseShading(_ref5) {
  12063. let {
  12064. shading,
  12065. resources,
  12066. localColorSpaceCache,
  12067. localShadingPatternCache
  12068. } = _ref5;
  12069. let id = localShadingPatternCache.get(shading);
  12070. if (!id) {
  12071. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  12072. const patternIR = shadingFill.getIR();
  12073. id = `pattern_${this.idFactory.createObjId()}`;
  12074. localShadingPatternCache.set(shading, id);
  12075. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  12076. }
  12077. return id;
  12078. }
  12079. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  12080. const patternName = args.pop();
  12081. if (patternName instanceof _primitives.Name) {
  12082. const rawPattern = patterns.getRaw(patternName.name);
  12083. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  12084. if (localTilingPattern) {
  12085. try {
  12086. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12087. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  12088. operatorList.addOp(fn, tilingPatternIR);
  12089. return undefined;
  12090. } catch (ex) {}
  12091. }
  12092. const pattern = this.xref.fetchIfRef(rawPattern);
  12093. if (pattern) {
  12094. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  12095. const typeNum = dict.get("PatternType");
  12096. if (typeNum === PatternType.TILING) {
  12097. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  12098. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  12099. } else if (typeNum === PatternType.SHADING) {
  12100. const shading = dict.get("Shading");
  12101. const matrix = dict.getArray("Matrix");
  12102. const objId = this.parseShading({
  12103. shading,
  12104. resources,
  12105. localColorSpaceCache,
  12106. localShadingPatternCache
  12107. });
  12108. operatorList.addOp(fn, ["Shading", objId, matrix]);
  12109. return undefined;
  12110. }
  12111. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  12112. }
  12113. }
  12114. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  12115. }
  12116. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  12117. const MAX_NESTING = 10;
  12118. if (++nestingCounter > MAX_NESTING) {
  12119. (0, _util.warn)("Visibility expression is too deeply nested");
  12120. return;
  12121. }
  12122. const length = array.length;
  12123. const operator = this.xref.fetchIfRef(array[0]);
  12124. if (length < 2 || !(operator instanceof _primitives.Name)) {
  12125. (0, _util.warn)("Invalid visibility expression");
  12126. return;
  12127. }
  12128. switch (operator.name) {
  12129. case "And":
  12130. case "Or":
  12131. case "Not":
  12132. currentResult.push(operator.name);
  12133. break;
  12134. default:
  12135. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  12136. return;
  12137. }
  12138. for (let i = 1; i < length; i++) {
  12139. const raw = array[i];
  12140. const object = this.xref.fetchIfRef(raw);
  12141. if (Array.isArray(object)) {
  12142. const nestedResult = [];
  12143. currentResult.push(nestedResult);
  12144. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  12145. } else if (raw instanceof _primitives.Ref) {
  12146. currentResult.push(raw.toString());
  12147. }
  12148. }
  12149. }
  12150. async parseMarkedContentProps(contentProperties, resources) {
  12151. let optionalContent;
  12152. if (contentProperties instanceof _primitives.Name) {
  12153. const properties = resources.get("Properties");
  12154. optionalContent = properties.get(contentProperties.name);
  12155. } else if (contentProperties instanceof _primitives.Dict) {
  12156. optionalContent = contentProperties;
  12157. } else {
  12158. throw new _util.FormatError("Optional content properties malformed.");
  12159. }
  12160. const optionalContentType = optionalContent.get("Type").name;
  12161. if (optionalContentType === "OCG") {
  12162. return {
  12163. type: optionalContentType,
  12164. id: optionalContent.objId
  12165. };
  12166. } else if (optionalContentType === "OCMD") {
  12167. const expression = optionalContent.get("VE");
  12168. if (Array.isArray(expression)) {
  12169. const result = [];
  12170. this._parseVisibilityExpression(expression, 0, result);
  12171. if (result.length > 0) {
  12172. return {
  12173. type: "OCMD",
  12174. expression: result
  12175. };
  12176. }
  12177. }
  12178. const optionalContentGroups = optionalContent.get("OCGs");
  12179. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  12180. const groupIds = [];
  12181. if (Array.isArray(optionalContentGroups)) {
  12182. for (const ocg of optionalContentGroups) {
  12183. groupIds.push(ocg.toString());
  12184. }
  12185. } else {
  12186. groupIds.push(optionalContentGroups.objId);
  12187. }
  12188. return {
  12189. type: optionalContentType,
  12190. ids: groupIds,
  12191. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  12192. expression: null
  12193. };
  12194. } else if (optionalContentGroups instanceof _primitives.Ref) {
  12195. return {
  12196. type: optionalContentType,
  12197. id: optionalContentGroups.toString()
  12198. };
  12199. }
  12200. }
  12201. return null;
  12202. }
  12203. getOperatorList(_ref6) {
  12204. let {
  12205. stream,
  12206. task,
  12207. resources,
  12208. operatorList,
  12209. initialState = null,
  12210. fallbackFontDict = null
  12211. } = _ref6;
  12212. resources = resources || _primitives.Dict.empty;
  12213. initialState = initialState || new EvalState();
  12214. if (!operatorList) {
  12215. throw new Error('getOperatorList: missing "operatorList" parameter');
  12216. }
  12217. const self = this;
  12218. const xref = this.xref;
  12219. let parsingText = false;
  12220. const localImageCache = new _image_utils.LocalImageCache();
  12221. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  12222. const localGStateCache = new _image_utils.LocalGStateCache();
  12223. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  12224. const localShadingPatternCache = new Map();
  12225. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  12226. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  12227. const stateManager = new StateManager(initialState);
  12228. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  12229. const timeSlotManager = new TimeSlotManager();
  12230. function closePendingRestoreOPS(argument) {
  12231. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  12232. operatorList.addOp(_util.OPS.restore, []);
  12233. }
  12234. }
  12235. return new Promise(function promiseBody(resolve, reject) {
  12236. const next = function (promise) {
  12237. Promise.all([promise, operatorList.ready]).then(function () {
  12238. try {
  12239. promiseBody(resolve, reject);
  12240. } catch (ex) {
  12241. reject(ex);
  12242. }
  12243. }, reject);
  12244. };
  12245. task.ensureNotTerminated();
  12246. timeSlotManager.reset();
  12247. const operation = {};
  12248. let stop, i, ii, cs, name, isValidName;
  12249. while (!(stop = timeSlotManager.check())) {
  12250. operation.args = null;
  12251. if (!preprocessor.read(operation)) {
  12252. break;
  12253. }
  12254. let args = operation.args;
  12255. let fn = operation.fn;
  12256. switch (fn | 0) {
  12257. case _util.OPS.paintXObject:
  12258. isValidName = args[0] instanceof _primitives.Name;
  12259. name = args[0].name;
  12260. if (isValidName) {
  12261. const localImage = localImageCache.getByName(name);
  12262. if (localImage) {
  12263. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12264. incrementCachedImageMaskCount(localImage);
  12265. args = null;
  12266. continue;
  12267. }
  12268. }
  12269. next(new Promise(function (resolveXObject, rejectXObject) {
  12270. if (!isValidName) {
  12271. throw new _util.FormatError("XObject must be referred to by name.");
  12272. }
  12273. let xobj = xobjs.getRaw(name);
  12274. if (xobj instanceof _primitives.Ref) {
  12275. const localImage = localImageCache.getByRef(xobj);
  12276. if (localImage) {
  12277. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12278. incrementCachedImageMaskCount(localImage);
  12279. resolveXObject();
  12280. return;
  12281. }
  12282. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  12283. if (globalImage) {
  12284. operatorList.addDependency(globalImage.objId);
  12285. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  12286. resolveXObject();
  12287. return;
  12288. }
  12289. xobj = xref.fetch(xobj);
  12290. }
  12291. if (!(xobj instanceof _base_stream.BaseStream)) {
  12292. throw new _util.FormatError("XObject should be a stream");
  12293. }
  12294. const type = xobj.dict.get("Subtype");
  12295. if (!(type instanceof _primitives.Name)) {
  12296. throw new _util.FormatError("XObject should have a Name subtype");
  12297. }
  12298. if (type.name === "Form") {
  12299. stateManager.save();
  12300. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  12301. stateManager.restore();
  12302. resolveXObject();
  12303. }, rejectXObject);
  12304. return;
  12305. } else if (type.name === "Image") {
  12306. self.buildPaintImageXObject({
  12307. resources,
  12308. image: xobj,
  12309. operatorList,
  12310. cacheKey: name,
  12311. localImageCache,
  12312. localColorSpaceCache
  12313. }).then(resolveXObject, rejectXObject);
  12314. return;
  12315. } else if (type.name === "PS") {
  12316. (0, _util.info)("Ignored XObject subtype PS");
  12317. } else {
  12318. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  12319. }
  12320. resolveXObject();
  12321. }).catch(function (reason) {
  12322. if (reason instanceof _util.AbortException) {
  12323. return;
  12324. }
  12325. if (self.options.ignoreErrors) {
  12326. self.handler.send("UnsupportedFeature", {
  12327. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  12328. });
  12329. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  12330. return;
  12331. }
  12332. throw reason;
  12333. }));
  12334. return;
  12335. case _util.OPS.setFont:
  12336. var fontSize = args[1];
  12337. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  12338. operatorList.addDependency(loadedName);
  12339. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  12340. }));
  12341. return;
  12342. case _util.OPS.beginText:
  12343. parsingText = true;
  12344. break;
  12345. case _util.OPS.endText:
  12346. parsingText = false;
  12347. break;
  12348. case _util.OPS.endInlineImage:
  12349. var cacheKey = args[0].cacheKey;
  12350. if (cacheKey) {
  12351. const localImage = localImageCache.getByName(cacheKey);
  12352. if (localImage) {
  12353. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  12354. incrementCachedImageMaskCount(localImage);
  12355. args = null;
  12356. continue;
  12357. }
  12358. }
  12359. next(self.buildPaintImageXObject({
  12360. resources,
  12361. image: args[0],
  12362. isInline: true,
  12363. operatorList,
  12364. cacheKey,
  12365. localImageCache,
  12366. localColorSpaceCache
  12367. }));
  12368. return;
  12369. case _util.OPS.showText:
  12370. if (!stateManager.state.font) {
  12371. self.ensureStateFont(stateManager.state);
  12372. continue;
  12373. }
  12374. args[0] = self.handleText(args[0], stateManager.state);
  12375. break;
  12376. case _util.OPS.showSpacedText:
  12377. if (!stateManager.state.font) {
  12378. self.ensureStateFont(stateManager.state);
  12379. continue;
  12380. }
  12381. var combinedGlyphs = [];
  12382. var state = stateManager.state;
  12383. for (const arrItem of args[0]) {
  12384. if (typeof arrItem === "string") {
  12385. combinedGlyphs.push(...self.handleText(arrItem, state));
  12386. } else if (typeof arrItem === "number") {
  12387. combinedGlyphs.push(arrItem);
  12388. }
  12389. }
  12390. args[0] = combinedGlyphs;
  12391. fn = _util.OPS.showText;
  12392. break;
  12393. case _util.OPS.nextLineShowText:
  12394. if (!stateManager.state.font) {
  12395. self.ensureStateFont(stateManager.state);
  12396. continue;
  12397. }
  12398. operatorList.addOp(_util.OPS.nextLine);
  12399. args[0] = self.handleText(args[0], stateManager.state);
  12400. fn = _util.OPS.showText;
  12401. break;
  12402. case _util.OPS.nextLineSetSpacingShowText:
  12403. if (!stateManager.state.font) {
  12404. self.ensureStateFont(stateManager.state);
  12405. continue;
  12406. }
  12407. operatorList.addOp(_util.OPS.nextLine);
  12408. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  12409. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  12410. args[0] = self.handleText(args[0], stateManager.state);
  12411. fn = _util.OPS.showText;
  12412. break;
  12413. case _util.OPS.setTextRenderingMode:
  12414. stateManager.state.textRenderingMode = args[0];
  12415. break;
  12416. case _util.OPS.setFillColorSpace:
  12417. {
  12418. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12419. if (cachedColorSpace) {
  12420. stateManager.state.fillColorSpace = cachedColorSpace;
  12421. continue;
  12422. }
  12423. next(self.parseColorSpace({
  12424. cs: args[0],
  12425. resources,
  12426. localColorSpaceCache
  12427. }).then(function (colorSpace) {
  12428. if (colorSpace) {
  12429. stateManager.state.fillColorSpace = colorSpace;
  12430. }
  12431. }));
  12432. return;
  12433. }
  12434. case _util.OPS.setStrokeColorSpace:
  12435. {
  12436. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  12437. if (cachedColorSpace) {
  12438. stateManager.state.strokeColorSpace = cachedColorSpace;
  12439. continue;
  12440. }
  12441. next(self.parseColorSpace({
  12442. cs: args[0],
  12443. resources,
  12444. localColorSpaceCache
  12445. }).then(function (colorSpace) {
  12446. if (colorSpace) {
  12447. stateManager.state.strokeColorSpace = colorSpace;
  12448. }
  12449. }));
  12450. return;
  12451. }
  12452. case _util.OPS.setFillColor:
  12453. cs = stateManager.state.fillColorSpace;
  12454. args = cs.getRgb(args, 0);
  12455. fn = _util.OPS.setFillRGBColor;
  12456. break;
  12457. case _util.OPS.setStrokeColor:
  12458. cs = stateManager.state.strokeColorSpace;
  12459. args = cs.getRgb(args, 0);
  12460. fn = _util.OPS.setStrokeRGBColor;
  12461. break;
  12462. case _util.OPS.setFillGray:
  12463. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  12464. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12465. fn = _util.OPS.setFillRGBColor;
  12466. break;
  12467. case _util.OPS.setStrokeGray:
  12468. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  12469. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  12470. fn = _util.OPS.setStrokeRGBColor;
  12471. break;
  12472. case _util.OPS.setFillCMYKColor:
  12473. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12474. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12475. fn = _util.OPS.setFillRGBColor;
  12476. break;
  12477. case _util.OPS.setStrokeCMYKColor:
  12478. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  12479. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  12480. fn = _util.OPS.setStrokeRGBColor;
  12481. break;
  12482. case _util.OPS.setFillRGBColor:
  12483. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12484. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12485. break;
  12486. case _util.OPS.setStrokeRGBColor:
  12487. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  12488. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  12489. break;
  12490. case _util.OPS.setFillColorN:
  12491. cs = stateManager.state.fillColorSpace;
  12492. if (cs.name === "Pattern") {
  12493. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12494. return;
  12495. }
  12496. args = cs.getRgb(args, 0);
  12497. fn = _util.OPS.setFillRGBColor;
  12498. break;
  12499. case _util.OPS.setStrokeColorN:
  12500. cs = stateManager.state.strokeColorSpace;
  12501. if (cs.name === "Pattern") {
  12502. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  12503. return;
  12504. }
  12505. args = cs.getRgb(args, 0);
  12506. fn = _util.OPS.setStrokeRGBColor;
  12507. break;
  12508. case _util.OPS.shadingFill:
  12509. var shadingRes = resources.get("Shading");
  12510. if (!shadingRes) {
  12511. throw new _util.FormatError("No shading resource found");
  12512. }
  12513. var shading = shadingRes.get(args[0].name);
  12514. if (!shading) {
  12515. throw new _util.FormatError("No shading object found");
  12516. }
  12517. const patternId = self.parseShading({
  12518. shading,
  12519. resources,
  12520. localColorSpaceCache,
  12521. localShadingPatternCache
  12522. });
  12523. args = [patternId];
  12524. fn = _util.OPS.shadingFill;
  12525. break;
  12526. case _util.OPS.setGState:
  12527. isValidName = args[0] instanceof _primitives.Name;
  12528. name = args[0].name;
  12529. if (isValidName) {
  12530. const localGStateObj = localGStateCache.getByName(name);
  12531. if (localGStateObj) {
  12532. if (localGStateObj.length > 0) {
  12533. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  12534. }
  12535. args = null;
  12536. continue;
  12537. }
  12538. }
  12539. next(new Promise(function (resolveGState, rejectGState) {
  12540. if (!isValidName) {
  12541. throw new _util.FormatError("GState must be referred to by name.");
  12542. }
  12543. const extGState = resources.get("ExtGState");
  12544. if (!(extGState instanceof _primitives.Dict)) {
  12545. throw new _util.FormatError("ExtGState should be a dictionary.");
  12546. }
  12547. const gState = extGState.get(name);
  12548. if (!(gState instanceof _primitives.Dict)) {
  12549. throw new _util.FormatError("GState should be a dictionary.");
  12550. }
  12551. self.setGState({
  12552. resources,
  12553. gState,
  12554. operatorList,
  12555. cacheKey: name,
  12556. task,
  12557. stateManager,
  12558. localGStateCache,
  12559. localColorSpaceCache
  12560. }).then(resolveGState, rejectGState);
  12561. }).catch(function (reason) {
  12562. if (reason instanceof _util.AbortException) {
  12563. return;
  12564. }
  12565. if (self.options.ignoreErrors) {
  12566. self.handler.send("UnsupportedFeature", {
  12567. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  12568. });
  12569. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  12570. return;
  12571. }
  12572. throw reason;
  12573. }));
  12574. return;
  12575. case _util.OPS.moveTo:
  12576. case _util.OPS.lineTo:
  12577. case _util.OPS.curveTo:
  12578. case _util.OPS.curveTo2:
  12579. case _util.OPS.curveTo3:
  12580. case _util.OPS.closePath:
  12581. case _util.OPS.rectangle:
  12582. self.buildPath(operatorList, fn, args, parsingText);
  12583. continue;
  12584. case _util.OPS.markPoint:
  12585. case _util.OPS.markPointProps:
  12586. case _util.OPS.beginCompat:
  12587. case _util.OPS.endCompat:
  12588. continue;
  12589. case _util.OPS.beginMarkedContentProps:
  12590. if (!(args[0] instanceof _primitives.Name)) {
  12591. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  12592. continue;
  12593. }
  12594. if (args[0].name === "OC") {
  12595. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  12596. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  12597. }).catch(reason => {
  12598. if (reason instanceof _util.AbortException) {
  12599. return;
  12600. }
  12601. if (self.options.ignoreErrors) {
  12602. self.handler.send("UnsupportedFeature", {
  12603. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  12604. });
  12605. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  12606. return;
  12607. }
  12608. throw reason;
  12609. }));
  12610. return;
  12611. }
  12612. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  12613. break;
  12614. case _util.OPS.beginMarkedContent:
  12615. case _util.OPS.endMarkedContent:
  12616. default:
  12617. if (args !== null) {
  12618. for (i = 0, ii = args.length; i < ii; i++) {
  12619. if (args[i] instanceof _primitives.Dict) {
  12620. break;
  12621. }
  12622. }
  12623. if (i < ii) {
  12624. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  12625. continue;
  12626. }
  12627. }
  12628. }
  12629. operatorList.addOp(fn, args);
  12630. }
  12631. if (stop) {
  12632. next(deferred);
  12633. return;
  12634. }
  12635. closePendingRestoreOPS();
  12636. resolve();
  12637. }).catch(reason => {
  12638. if (reason instanceof _util.AbortException) {
  12639. return;
  12640. }
  12641. if (this.options.ignoreErrors) {
  12642. this.handler.send("UnsupportedFeature", {
  12643. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  12644. });
  12645. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  12646. closePendingRestoreOPS();
  12647. return;
  12648. }
  12649. throw reason;
  12650. });
  12651. }
  12652. getTextContent(_ref7) {
  12653. let {
  12654. stream,
  12655. task,
  12656. resources,
  12657. stateManager = null,
  12658. combineTextItems = false,
  12659. includeMarkedContent = false,
  12660. sink,
  12661. seenStyles = new Set(),
  12662. viewBox,
  12663. markedContentData = null
  12664. } = _ref7;
  12665. resources = resources || _primitives.Dict.empty;
  12666. stateManager = stateManager || new StateManager(new TextState());
  12667. if (includeMarkedContent) {
  12668. markedContentData = markedContentData || {
  12669. level: 0
  12670. };
  12671. }
  12672. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  12673. const textContent = {
  12674. items: [],
  12675. styles: Object.create(null)
  12676. };
  12677. const textContentItem = {
  12678. initialized: false,
  12679. str: [],
  12680. totalWidth: 0,
  12681. totalHeight: 0,
  12682. width: 0,
  12683. height: 0,
  12684. vertical: false,
  12685. prevTransform: null,
  12686. textAdvanceScale: 0,
  12687. spaceInFlowMin: 0,
  12688. spaceInFlowMax: 0,
  12689. trackingSpaceMin: Infinity,
  12690. negativeSpaceMax: -Infinity,
  12691. notASpace: -Infinity,
  12692. transform: null,
  12693. fontName: null,
  12694. hasEOL: false
  12695. };
  12696. const twoLastChars = [" ", " "];
  12697. let twoLastCharsPos = 0;
  12698. function saveLastChar(char) {
  12699. const nextPos = (twoLastCharsPos + 1) % 2;
  12700. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  12701. twoLastChars[twoLastCharsPos] = char;
  12702. twoLastCharsPos = nextPos;
  12703. return ret;
  12704. }
  12705. function resetLastChars() {
  12706. twoLastChars[0] = twoLastChars[1] = " ";
  12707. twoLastCharsPos = 0;
  12708. }
  12709. const TRACKING_SPACE_FACTOR = 0.1;
  12710. const NOT_A_SPACE_FACTOR = 0.03;
  12711. const NEGATIVE_SPACE_FACTOR = -0.2;
  12712. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  12713. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  12714. const self = this;
  12715. const xref = this.xref;
  12716. const showSpacedTextBuffer = [];
  12717. let xobjs = null;
  12718. const emptyXObjectCache = new _image_utils.LocalImageCache();
  12719. const emptyGStateCache = new _image_utils.LocalGStateCache();
  12720. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  12721. let textState;
  12722. function getCurrentTextTransform() {
  12723. const font = textState.font;
  12724. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  12725. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  12726. const glyphHeight = font.bbox[3] - font.bbox[1];
  12727. if (glyphHeight > 0) {
  12728. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  12729. }
  12730. }
  12731. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  12732. }
  12733. function ensureTextContentItem() {
  12734. if (textContentItem.initialized) {
  12735. return textContentItem;
  12736. }
  12737. const font = textState.font,
  12738. loadedName = font.loadedName;
  12739. if (!seenStyles.has(loadedName)) {
  12740. seenStyles.add(loadedName);
  12741. textContent.styles[loadedName] = {
  12742. fontFamily: font.fallbackName,
  12743. ascent: font.ascent,
  12744. descent: font.descent,
  12745. vertical: font.vertical
  12746. };
  12747. }
  12748. textContentItem.fontName = loadedName;
  12749. const trm = textContentItem.transform = getCurrentTextTransform();
  12750. if (!font.vertical) {
  12751. textContentItem.width = textContentItem.totalWidth = 0;
  12752. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  12753. textContentItem.vertical = false;
  12754. } else {
  12755. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  12756. textContentItem.height = textContentItem.totalHeight = 0;
  12757. textContentItem.vertical = true;
  12758. }
  12759. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  12760. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  12761. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  12762. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  12763. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  12764. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  12765. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  12766. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  12767. textContentItem.hasEOL = false;
  12768. textContentItem.initialized = true;
  12769. return textContentItem;
  12770. }
  12771. function updateAdvanceScale() {
  12772. if (!textContentItem.initialized) {
  12773. return;
  12774. }
  12775. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  12776. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  12777. const scaleFactor = scaleCtmX * scaleLineX;
  12778. if (scaleFactor === textContentItem.textAdvanceScale) {
  12779. return;
  12780. }
  12781. if (!textContentItem.vertical) {
  12782. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  12783. textContentItem.width = 0;
  12784. } else {
  12785. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  12786. textContentItem.height = 0;
  12787. }
  12788. textContentItem.textAdvanceScale = scaleFactor;
  12789. }
  12790. function runBidiTransform(textChunk) {
  12791. const text = textChunk.str.join("");
  12792. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  12793. return {
  12794. str: bidiResult.str,
  12795. dir: bidiResult.dir,
  12796. width: Math.abs(textChunk.totalWidth),
  12797. height: Math.abs(textChunk.totalHeight),
  12798. transform: textChunk.transform,
  12799. fontName: textChunk.fontName,
  12800. hasEOL: textChunk.hasEOL
  12801. };
  12802. }
  12803. function handleSetFont(fontName, fontRef) {
  12804. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  12805. if (!translated.font.isType3Font) {
  12806. return translated;
  12807. }
  12808. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  12809. return translated;
  12810. });
  12811. }).then(function (translated) {
  12812. textState.font = translated.font;
  12813. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  12814. });
  12815. }
  12816. function applyInverseRotation(x, y, matrix) {
  12817. const scale = Math.hypot(matrix[0], matrix[1]);
  12818. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  12819. }
  12820. function compareWithLastPosition() {
  12821. const currentTransform = getCurrentTextTransform();
  12822. let posX = currentTransform[4];
  12823. let posY = currentTransform[5];
  12824. const shiftedX = posX - viewBox[0];
  12825. const shiftedY = posY - viewBox[1];
  12826. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  12827. return false;
  12828. }
  12829. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  12830. return true;
  12831. }
  12832. let lastPosX = textContentItem.prevTransform[4];
  12833. let lastPosY = textContentItem.prevTransform[5];
  12834. if (lastPosX === posX && lastPosY === posY) {
  12835. return true;
  12836. }
  12837. let rotate = -1;
  12838. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  12839. rotate = currentTransform[0] > 0 ? 0 : 180;
  12840. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  12841. rotate = currentTransform[1] > 0 ? 90 : 270;
  12842. }
  12843. switch (rotate) {
  12844. case 0:
  12845. break;
  12846. case 90:
  12847. [posX, posY] = [posY, posX];
  12848. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  12849. break;
  12850. case 180:
  12851. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  12852. break;
  12853. case 270:
  12854. [posX, posY] = [-posY, -posX];
  12855. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  12856. break;
  12857. default:
  12858. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  12859. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  12860. }
  12861. if (textState.font.vertical) {
  12862. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  12863. const advanceX = posX - lastPosX;
  12864. const textOrientation = Math.sign(textContentItem.height);
  12865. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  12866. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  12867. appendEOL();
  12868. return true;
  12869. }
  12870. resetLastChars();
  12871. flushTextContentItem();
  12872. return true;
  12873. }
  12874. if (Math.abs(advanceX) > textContentItem.width) {
  12875. appendEOL();
  12876. return true;
  12877. }
  12878. if (advanceY <= textOrientation * textContentItem.notASpace) {
  12879. resetLastChars();
  12880. }
  12881. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  12882. textContentItem.height += advanceY;
  12883. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  12884. if (textContentItem.str.length === 0) {
  12885. resetLastChars();
  12886. textContent.items.push({
  12887. str: " ",
  12888. dir: "ltr",
  12889. width: 0,
  12890. height: Math.abs(advanceY),
  12891. transform: textContentItem.prevTransform,
  12892. fontName: textContentItem.fontName,
  12893. hasEOL: false
  12894. });
  12895. } else {
  12896. textContentItem.height += advanceY;
  12897. }
  12898. }
  12899. return true;
  12900. }
  12901. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  12902. const advanceY = posY - lastPosY;
  12903. const textOrientation = Math.sign(textContentItem.width);
  12904. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  12905. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  12906. appendEOL();
  12907. return true;
  12908. }
  12909. resetLastChars();
  12910. flushTextContentItem();
  12911. return true;
  12912. }
  12913. if (Math.abs(advanceY) > textContentItem.height) {
  12914. appendEOL();
  12915. return true;
  12916. }
  12917. if (advanceX <= textOrientation * textContentItem.notASpace) {
  12918. resetLastChars();
  12919. }
  12920. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  12921. textContentItem.width += advanceX;
  12922. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  12923. if (textContentItem.str.length === 0) {
  12924. resetLastChars();
  12925. textContent.items.push({
  12926. str: " ",
  12927. dir: "ltr",
  12928. width: Math.abs(advanceX),
  12929. height: 0,
  12930. transform: textContentItem.prevTransform,
  12931. fontName: textContentItem.fontName,
  12932. hasEOL: false
  12933. });
  12934. } else {
  12935. textContentItem.width += advanceX;
  12936. }
  12937. }
  12938. return true;
  12939. }
  12940. function buildTextContentItem(_ref8) {
  12941. let {
  12942. chars,
  12943. extraSpacing
  12944. } = _ref8;
  12945. const font = textState.font;
  12946. if (!chars) {
  12947. const charSpacing = textState.charSpacing + extraSpacing;
  12948. if (charSpacing) {
  12949. if (!font.vertical) {
  12950. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  12951. } else {
  12952. textState.translateTextMatrix(0, -charSpacing);
  12953. }
  12954. }
  12955. return;
  12956. }
  12957. const glyphs = font.charsToGlyphs(chars);
  12958. const scale = textState.fontMatrix[0] * textState.fontSize;
  12959. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  12960. const glyph = glyphs[i];
  12961. if (glyph.isInvisibleFormatMark) {
  12962. continue;
  12963. }
  12964. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  12965. let glyphWidth = glyph.width;
  12966. if (font.vertical) {
  12967. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  12968. }
  12969. let scaledDim = glyphWidth * scale;
  12970. if (glyph.isWhitespace) {
  12971. if (!font.vertical) {
  12972. charSpacing += scaledDim + textState.wordSpacing;
  12973. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  12974. } else {
  12975. charSpacing += -scaledDim + textState.wordSpacing;
  12976. textState.translateTextMatrix(0, -charSpacing);
  12977. }
  12978. saveLastChar(" ");
  12979. continue;
  12980. }
  12981. if (!compareWithLastPosition()) {
  12982. continue;
  12983. }
  12984. const textChunk = ensureTextContentItem();
  12985. if (glyph.isZeroWidthDiacritic) {
  12986. scaledDim = 0;
  12987. }
  12988. if (!font.vertical) {
  12989. scaledDim *= textState.textHScale;
  12990. textState.translateTextMatrix(scaledDim, 0);
  12991. textChunk.width += scaledDim;
  12992. } else {
  12993. textState.translateTextMatrix(0, scaledDim);
  12994. scaledDim = Math.abs(scaledDim);
  12995. textChunk.height += scaledDim;
  12996. }
  12997. if (scaledDim) {
  12998. textChunk.prevTransform = getCurrentTextTransform();
  12999. }
  13000. let glyphUnicode = glyph.unicode;
  13001. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  13002. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  13003. if (saveLastChar(glyphUnicode)) {
  13004. textChunk.str.push(" ");
  13005. }
  13006. textChunk.str.push(glyphUnicode);
  13007. if (charSpacing) {
  13008. if (!font.vertical) {
  13009. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  13010. } else {
  13011. textState.translateTextMatrix(0, -charSpacing);
  13012. }
  13013. }
  13014. }
  13015. }
  13016. function appendEOL() {
  13017. resetLastChars();
  13018. if (textContentItem.initialized) {
  13019. textContentItem.hasEOL = true;
  13020. flushTextContentItem();
  13021. } else {
  13022. textContent.items.push({
  13023. str: "",
  13024. dir: "ltr",
  13025. width: 0,
  13026. height: 0,
  13027. transform: getCurrentTextTransform(),
  13028. fontName: textState.font.loadedName,
  13029. hasEOL: true
  13030. });
  13031. }
  13032. }
  13033. function addFakeSpaces(width, transf, textOrientation) {
  13034. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  13035. if (textContentItem.initialized) {
  13036. resetLastChars();
  13037. textContentItem.str.push(" ");
  13038. }
  13039. return false;
  13040. }
  13041. const fontName = textContentItem.fontName;
  13042. let height = 0;
  13043. if (textContentItem.vertical) {
  13044. height = width;
  13045. width = 0;
  13046. }
  13047. flushTextContentItem();
  13048. resetLastChars();
  13049. textContent.items.push({
  13050. str: " ",
  13051. dir: "ltr",
  13052. width: Math.abs(width),
  13053. height: Math.abs(height),
  13054. transform: transf || getCurrentTextTransform(),
  13055. fontName,
  13056. hasEOL: false
  13057. });
  13058. return true;
  13059. }
  13060. function flushTextContentItem() {
  13061. if (!textContentItem.initialized || !textContentItem.str) {
  13062. return;
  13063. }
  13064. if (!textContentItem.vertical) {
  13065. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  13066. } else {
  13067. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  13068. }
  13069. textContent.items.push(runBidiTransform(textContentItem));
  13070. textContentItem.initialized = false;
  13071. textContentItem.str.length = 0;
  13072. }
  13073. function enqueueChunk() {
  13074. let batch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  13075. const length = textContent.items.length;
  13076. if (length === 0) {
  13077. return;
  13078. }
  13079. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  13080. return;
  13081. }
  13082. sink.enqueue(textContent, length);
  13083. textContent.items = [];
  13084. textContent.styles = Object.create(null);
  13085. }
  13086. const timeSlotManager = new TimeSlotManager();
  13087. return new Promise(function promiseBody(resolve, reject) {
  13088. const next = function (promise) {
  13089. enqueueChunk(true);
  13090. Promise.all([promise, sink.ready]).then(function () {
  13091. try {
  13092. promiseBody(resolve, reject);
  13093. } catch (ex) {
  13094. reject(ex);
  13095. }
  13096. }, reject);
  13097. };
  13098. task.ensureNotTerminated();
  13099. timeSlotManager.reset();
  13100. const operation = {};
  13101. let stop,
  13102. args = [];
  13103. while (!(stop = timeSlotManager.check())) {
  13104. args.length = 0;
  13105. operation.args = args;
  13106. if (!preprocessor.read(operation)) {
  13107. break;
  13108. }
  13109. textState = stateManager.state;
  13110. const fn = operation.fn;
  13111. args = operation.args;
  13112. switch (fn | 0) {
  13113. case _util.OPS.setFont:
  13114. var fontNameArg = args[0].name,
  13115. fontSizeArg = args[1];
  13116. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  13117. break;
  13118. }
  13119. flushTextContentItem();
  13120. textState.fontName = fontNameArg;
  13121. textState.fontSize = fontSizeArg;
  13122. next(handleSetFont(fontNameArg, null));
  13123. return;
  13124. case _util.OPS.setTextRise:
  13125. textState.textRise = args[0];
  13126. break;
  13127. case _util.OPS.setHScale:
  13128. textState.textHScale = args[0] / 100;
  13129. break;
  13130. case _util.OPS.setLeading:
  13131. textState.leading = args[0];
  13132. break;
  13133. case _util.OPS.moveText:
  13134. textState.translateTextLineMatrix(args[0], args[1]);
  13135. textState.textMatrix = textState.textLineMatrix.slice();
  13136. break;
  13137. case _util.OPS.setLeadingMoveText:
  13138. textState.leading = -args[1];
  13139. textState.translateTextLineMatrix(args[0], args[1]);
  13140. textState.textMatrix = textState.textLineMatrix.slice();
  13141. break;
  13142. case _util.OPS.nextLine:
  13143. textState.carriageReturn();
  13144. break;
  13145. case _util.OPS.setTextMatrix:
  13146. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13147. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  13148. updateAdvanceScale();
  13149. break;
  13150. case _util.OPS.setCharSpacing:
  13151. textState.charSpacing = args[0];
  13152. break;
  13153. case _util.OPS.setWordSpacing:
  13154. textState.wordSpacing = args[0];
  13155. break;
  13156. case _util.OPS.beginText:
  13157. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  13158. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  13159. break;
  13160. case _util.OPS.showSpacedText:
  13161. if (!stateManager.state.font) {
  13162. self.ensureStateFont(stateManager.state);
  13163. continue;
  13164. }
  13165. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  13166. const elements = args[0];
  13167. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  13168. const item = elements[i];
  13169. if (typeof item === "string") {
  13170. showSpacedTextBuffer.push(item);
  13171. } else if (typeof item === "number" && item !== 0) {
  13172. const str = showSpacedTextBuffer.join("");
  13173. showSpacedTextBuffer.length = 0;
  13174. buildTextContentItem({
  13175. chars: str,
  13176. extraSpacing: item * spaceFactor
  13177. });
  13178. }
  13179. }
  13180. const item = elements.at(-1);
  13181. if (typeof item === "string") {
  13182. showSpacedTextBuffer.push(item);
  13183. }
  13184. if (showSpacedTextBuffer.length > 0) {
  13185. const str = showSpacedTextBuffer.join("");
  13186. showSpacedTextBuffer.length = 0;
  13187. buildTextContentItem({
  13188. chars: str,
  13189. extraSpacing: 0
  13190. });
  13191. }
  13192. break;
  13193. case _util.OPS.showText:
  13194. if (!stateManager.state.font) {
  13195. self.ensureStateFont(stateManager.state);
  13196. continue;
  13197. }
  13198. buildTextContentItem({
  13199. chars: args[0],
  13200. extraSpacing: 0
  13201. });
  13202. break;
  13203. case _util.OPS.nextLineShowText:
  13204. if (!stateManager.state.font) {
  13205. self.ensureStateFont(stateManager.state);
  13206. continue;
  13207. }
  13208. textState.carriageReturn();
  13209. buildTextContentItem({
  13210. chars: args[0],
  13211. extraSpacing: 0
  13212. });
  13213. break;
  13214. case _util.OPS.nextLineSetSpacingShowText:
  13215. if (!stateManager.state.font) {
  13216. self.ensureStateFont(stateManager.state);
  13217. continue;
  13218. }
  13219. textState.wordSpacing = args[0];
  13220. textState.charSpacing = args[1];
  13221. textState.carriageReturn();
  13222. buildTextContentItem({
  13223. chars: args[2],
  13224. extraSpacing: 0
  13225. });
  13226. break;
  13227. case _util.OPS.paintXObject:
  13228. flushTextContentItem();
  13229. if (!xobjs) {
  13230. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  13231. }
  13232. var isValidName = args[0] instanceof _primitives.Name;
  13233. var name = args[0].name;
  13234. if (isValidName && emptyXObjectCache.getByName(name)) {
  13235. break;
  13236. }
  13237. next(new Promise(function (resolveXObject, rejectXObject) {
  13238. if (!isValidName) {
  13239. throw new _util.FormatError("XObject must be referred to by name.");
  13240. }
  13241. let xobj = xobjs.getRaw(name);
  13242. if (xobj instanceof _primitives.Ref) {
  13243. if (emptyXObjectCache.getByRef(xobj)) {
  13244. resolveXObject();
  13245. return;
  13246. }
  13247. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  13248. if (globalImage) {
  13249. resolveXObject();
  13250. return;
  13251. }
  13252. xobj = xref.fetch(xobj);
  13253. }
  13254. if (!(xobj instanceof _base_stream.BaseStream)) {
  13255. throw new _util.FormatError("XObject should be a stream");
  13256. }
  13257. const type = xobj.dict.get("Subtype");
  13258. if (!(type instanceof _primitives.Name)) {
  13259. throw new _util.FormatError("XObject should have a Name subtype");
  13260. }
  13261. if (type.name !== "Form") {
  13262. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13263. resolveXObject();
  13264. return;
  13265. }
  13266. const currentState = stateManager.state.clone();
  13267. const xObjStateManager = new StateManager(currentState);
  13268. const matrix = xobj.dict.getArray("Matrix");
  13269. if (Array.isArray(matrix) && matrix.length === 6) {
  13270. xObjStateManager.transform(matrix);
  13271. }
  13272. enqueueChunk();
  13273. const sinkWrapper = {
  13274. enqueueInvoked: false,
  13275. enqueue(chunk, size) {
  13276. this.enqueueInvoked = true;
  13277. sink.enqueue(chunk, size);
  13278. },
  13279. get desiredSize() {
  13280. return sink.desiredSize;
  13281. },
  13282. get ready() {
  13283. return sink.ready;
  13284. }
  13285. };
  13286. self.getTextContent({
  13287. stream: xobj,
  13288. task,
  13289. resources: xobj.dict.get("Resources") || resources,
  13290. stateManager: xObjStateManager,
  13291. combineTextItems,
  13292. includeMarkedContent,
  13293. sink: sinkWrapper,
  13294. seenStyles,
  13295. viewBox,
  13296. markedContentData
  13297. }).then(function () {
  13298. if (!sinkWrapper.enqueueInvoked) {
  13299. emptyXObjectCache.set(name, xobj.dict.objId, true);
  13300. }
  13301. resolveXObject();
  13302. }, rejectXObject);
  13303. }).catch(function (reason) {
  13304. if (reason instanceof _util.AbortException) {
  13305. return;
  13306. }
  13307. if (self.options.ignoreErrors) {
  13308. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  13309. return;
  13310. }
  13311. throw reason;
  13312. }));
  13313. return;
  13314. case _util.OPS.setGState:
  13315. isValidName = args[0] instanceof _primitives.Name;
  13316. name = args[0].name;
  13317. if (isValidName && emptyGStateCache.getByName(name)) {
  13318. break;
  13319. }
  13320. next(new Promise(function (resolveGState, rejectGState) {
  13321. if (!isValidName) {
  13322. throw new _util.FormatError("GState must be referred to by name.");
  13323. }
  13324. const extGState = resources.get("ExtGState");
  13325. if (!(extGState instanceof _primitives.Dict)) {
  13326. throw new _util.FormatError("ExtGState should be a dictionary.");
  13327. }
  13328. const gState = extGState.get(name);
  13329. if (!(gState instanceof _primitives.Dict)) {
  13330. throw new _util.FormatError("GState should be a dictionary.");
  13331. }
  13332. const gStateFont = gState.get("Font");
  13333. if (!gStateFont) {
  13334. emptyGStateCache.set(name, gState.objId, true);
  13335. resolveGState();
  13336. return;
  13337. }
  13338. flushTextContentItem();
  13339. textState.fontName = null;
  13340. textState.fontSize = gStateFont[1];
  13341. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  13342. }).catch(function (reason) {
  13343. if (reason instanceof _util.AbortException) {
  13344. return;
  13345. }
  13346. if (self.options.ignoreErrors) {
  13347. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  13348. return;
  13349. }
  13350. throw reason;
  13351. }));
  13352. return;
  13353. case _util.OPS.beginMarkedContent:
  13354. flushTextContentItem();
  13355. if (includeMarkedContent) {
  13356. markedContentData.level++;
  13357. textContent.items.push({
  13358. type: "beginMarkedContent",
  13359. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13360. });
  13361. }
  13362. break;
  13363. case _util.OPS.beginMarkedContentProps:
  13364. flushTextContentItem();
  13365. if (includeMarkedContent) {
  13366. markedContentData.level++;
  13367. let mcid = null;
  13368. if (args[1] instanceof _primitives.Dict) {
  13369. mcid = args[1].get("MCID");
  13370. }
  13371. textContent.items.push({
  13372. type: "beginMarkedContentProps",
  13373. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  13374. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  13375. });
  13376. }
  13377. break;
  13378. case _util.OPS.endMarkedContent:
  13379. flushTextContentItem();
  13380. if (includeMarkedContent) {
  13381. if (markedContentData.level === 0) {
  13382. break;
  13383. }
  13384. markedContentData.level--;
  13385. textContent.items.push({
  13386. type: "endMarkedContent"
  13387. });
  13388. }
  13389. break;
  13390. }
  13391. if (textContent.items.length >= sink.desiredSize) {
  13392. stop = true;
  13393. break;
  13394. }
  13395. }
  13396. if (stop) {
  13397. next(deferred);
  13398. return;
  13399. }
  13400. flushTextContentItem();
  13401. enqueueChunk();
  13402. resolve();
  13403. }).catch(reason => {
  13404. if (reason instanceof _util.AbortException) {
  13405. return;
  13406. }
  13407. if (this.options.ignoreErrors) {
  13408. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  13409. flushTextContentItem();
  13410. enqueueChunk();
  13411. return;
  13412. }
  13413. throw reason;
  13414. });
  13415. }
  13416. extractDataStructures(dict, baseDict, properties) {
  13417. const xref = this.xref;
  13418. let cidToGidBytes;
  13419. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  13420. if (properties.composite) {
  13421. const cidSystemInfo = dict.get("CIDSystemInfo");
  13422. if (cidSystemInfo instanceof _primitives.Dict) {
  13423. properties.cidSystemInfo = {
  13424. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  13425. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  13426. supplement: cidSystemInfo.get("Supplement")
  13427. };
  13428. }
  13429. try {
  13430. const cidToGidMap = dict.get("CIDToGIDMap");
  13431. if (cidToGidMap instanceof _base_stream.BaseStream) {
  13432. cidToGidBytes = cidToGidMap.getBytes();
  13433. }
  13434. } catch (ex) {
  13435. if (!this.options.ignoreErrors) {
  13436. throw ex;
  13437. }
  13438. (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  13439. }
  13440. }
  13441. const differences = [];
  13442. let baseEncodingName = null;
  13443. let encoding;
  13444. if (dict.has("Encoding")) {
  13445. encoding = dict.get("Encoding");
  13446. if (encoding instanceof _primitives.Dict) {
  13447. baseEncodingName = encoding.get("BaseEncoding");
  13448. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  13449. if (encoding.has("Differences")) {
  13450. const diffEncoding = encoding.get("Differences");
  13451. let index = 0;
  13452. for (const entry of diffEncoding) {
  13453. const data = xref.fetchIfRef(entry);
  13454. if (typeof data === "number") {
  13455. index = data;
  13456. } else if (data instanceof _primitives.Name) {
  13457. differences[index++] = data.name;
  13458. } else {
  13459. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  13460. }
  13461. }
  13462. }
  13463. } else if (encoding instanceof _primitives.Name) {
  13464. baseEncodingName = encoding.name;
  13465. } else {
  13466. const msg = "Encoding is not a Name nor a Dict";
  13467. if (!this.options.ignoreErrors) {
  13468. throw new _util.FormatError(msg);
  13469. }
  13470. (0, _util.warn)(msg);
  13471. }
  13472. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  13473. baseEncodingName = null;
  13474. }
  13475. }
  13476. if (baseEncodingName) {
  13477. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13478. } else {
  13479. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  13480. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  13481. encoding = _encodings.StandardEncoding;
  13482. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  13483. encoding = _encodings.WinAnsiEncoding;
  13484. }
  13485. if (isSymbolicFont) {
  13486. encoding = _encodings.MacRomanEncoding;
  13487. if (!properties.file || properties.isInternalFont) {
  13488. if (/Symbol/i.test(properties.name)) {
  13489. encoding = _encodings.SymbolSetEncoding;
  13490. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  13491. encoding = _encodings.ZapfDingbatsEncoding;
  13492. }
  13493. }
  13494. }
  13495. properties.defaultEncoding = encoding;
  13496. }
  13497. properties.differences = differences;
  13498. properties.baseEncodingName = baseEncodingName;
  13499. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  13500. properties.dict = dict;
  13501. return toUnicodePromise.then(readToUnicode => {
  13502. properties.toUnicode = readToUnicode;
  13503. return this.buildToUnicode(properties);
  13504. }).then(builtToUnicode => {
  13505. properties.toUnicode = builtToUnicode;
  13506. if (cidToGidBytes) {
  13507. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  13508. }
  13509. return properties;
  13510. });
  13511. }
  13512. _simpleFontToUnicode(properties) {
  13513. let forceGlyphs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  13514. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  13515. const toUnicode = [];
  13516. const encoding = properties.defaultEncoding.slice();
  13517. const baseEncodingName = properties.baseEncodingName;
  13518. const differences = properties.differences;
  13519. for (const charcode in differences) {
  13520. const glyphName = differences[charcode];
  13521. if (glyphName === ".notdef") {
  13522. continue;
  13523. }
  13524. encoding[charcode] = glyphName;
  13525. }
  13526. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  13527. for (const charcode in encoding) {
  13528. let glyphName = encoding[charcode];
  13529. if (glyphName === "") {
  13530. continue;
  13531. }
  13532. let unicode = glyphsUnicodeMap[glyphName];
  13533. if (unicode !== undefined) {
  13534. toUnicode[charcode] = String.fromCharCode(unicode);
  13535. continue;
  13536. }
  13537. let code = 0;
  13538. switch (glyphName[0]) {
  13539. case "G":
  13540. if (glyphName.length === 3) {
  13541. code = parseInt(glyphName.substring(1), 16);
  13542. }
  13543. break;
  13544. case "g":
  13545. if (glyphName.length === 5) {
  13546. code = parseInt(glyphName.substring(1), 16);
  13547. }
  13548. break;
  13549. case "C":
  13550. case "c":
  13551. if (glyphName.length >= 3 && glyphName.length <= 4) {
  13552. const codeStr = glyphName.substring(1);
  13553. if (forceGlyphs) {
  13554. code = parseInt(codeStr, 16);
  13555. break;
  13556. }
  13557. code = +codeStr;
  13558. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  13559. return this._simpleFontToUnicode(properties, true);
  13560. }
  13561. }
  13562. break;
  13563. case "u":
  13564. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  13565. if (unicode !== -1) {
  13566. code = unicode;
  13567. }
  13568. break;
  13569. }
  13570. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  13571. if (baseEncodingName && code === +charcode) {
  13572. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  13573. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  13574. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  13575. continue;
  13576. }
  13577. }
  13578. toUnicode[charcode] = String.fromCodePoint(code);
  13579. }
  13580. }
  13581. return toUnicode;
  13582. }
  13583. async buildToUnicode(properties) {
  13584. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  13585. if (properties.hasIncludedToUnicodeMap) {
  13586. if (!properties.composite && properties.hasEncoding) {
  13587. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  13588. }
  13589. return properties.toUnicode;
  13590. }
  13591. if (!properties.composite) {
  13592. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  13593. }
  13594. 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"))) {
  13595. const {
  13596. registry,
  13597. ordering
  13598. } = properties.cidSystemInfo;
  13599. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  13600. const ucs2CMap = await _cmap.CMapFactory.create({
  13601. encoding: ucs2CMapName,
  13602. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13603. useCMap: null
  13604. });
  13605. const toUnicode = [];
  13606. properties.cMap.forEach(function (charcode, cid) {
  13607. if (cid > 0xffff) {
  13608. throw new _util.FormatError("Max size of CID is 65,535");
  13609. }
  13610. const ucs2 = ucs2CMap.lookup(cid);
  13611. if (ucs2) {
  13612. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  13613. }
  13614. });
  13615. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  13616. }
  13617. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  13618. }
  13619. readToUnicode(cmapObj) {
  13620. if (!cmapObj) {
  13621. return Promise.resolve(null);
  13622. }
  13623. if (cmapObj instanceof _primitives.Name) {
  13624. return _cmap.CMapFactory.create({
  13625. encoding: cmapObj,
  13626. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13627. useCMap: null
  13628. }).then(function (cmap) {
  13629. if (cmap instanceof _cmap.IdentityCMap) {
  13630. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  13631. }
  13632. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  13633. });
  13634. } else if (cmapObj instanceof _base_stream.BaseStream) {
  13635. return _cmap.CMapFactory.create({
  13636. encoding: cmapObj,
  13637. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  13638. useCMap: null
  13639. }).then(function (cmap) {
  13640. if (cmap instanceof _cmap.IdentityCMap) {
  13641. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  13642. }
  13643. const map = new Array(cmap.length);
  13644. cmap.forEach(function (charCode, token) {
  13645. if (typeof token === "number") {
  13646. map[charCode] = String.fromCodePoint(token);
  13647. return;
  13648. }
  13649. const str = [];
  13650. for (let k = 0; k < token.length; k += 2) {
  13651. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  13652. if ((w1 & 0xf800) !== 0xd800) {
  13653. str.push(w1);
  13654. continue;
  13655. }
  13656. k += 2;
  13657. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  13658. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  13659. }
  13660. map[charCode] = String.fromCodePoint(...str);
  13661. });
  13662. return new _to_unicode_map.ToUnicodeMap(map);
  13663. }, reason => {
  13664. if (reason instanceof _util.AbortException) {
  13665. return null;
  13666. }
  13667. if (this.options.ignoreErrors) {
  13668. this.handler.send("UnsupportedFeature", {
  13669. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  13670. });
  13671. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  13672. return null;
  13673. }
  13674. throw reason;
  13675. });
  13676. }
  13677. return Promise.resolve(null);
  13678. }
  13679. readCidToGidMap(glyphsData, toUnicode) {
  13680. const result = [];
  13681. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  13682. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  13683. const code = j >> 1;
  13684. if (glyphID === 0 && !toUnicode.has(code)) {
  13685. continue;
  13686. }
  13687. result[code] = glyphID;
  13688. }
  13689. return result;
  13690. }
  13691. extractWidths(dict, descriptor, properties) {
  13692. const xref = this.xref;
  13693. let glyphsWidths = [];
  13694. let defaultWidth = 0;
  13695. const glyphsVMetrics = [];
  13696. let defaultVMetrics;
  13697. let i, ii, j, jj, start, code, widths;
  13698. if (properties.composite) {
  13699. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  13700. widths = dict.get("W");
  13701. if (widths) {
  13702. for (i = 0, ii = widths.length; i < ii; i++) {
  13703. start = xref.fetchIfRef(widths[i++]);
  13704. code = xref.fetchIfRef(widths[i]);
  13705. if (Array.isArray(code)) {
  13706. for (j = 0, jj = code.length; j < jj; j++) {
  13707. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  13708. }
  13709. } else {
  13710. const width = xref.fetchIfRef(widths[++i]);
  13711. for (j = start; j <= code; j++) {
  13712. glyphsWidths[j] = width;
  13713. }
  13714. }
  13715. }
  13716. }
  13717. if (properties.vertical) {
  13718. let vmetrics = dict.getArray("DW2") || [880, -1000];
  13719. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  13720. vmetrics = dict.get("W2");
  13721. if (vmetrics) {
  13722. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  13723. start = xref.fetchIfRef(vmetrics[i++]);
  13724. code = xref.fetchIfRef(vmetrics[i]);
  13725. if (Array.isArray(code)) {
  13726. for (j = 0, jj = code.length; j < jj; j++) {
  13727. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  13728. }
  13729. } else {
  13730. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  13731. for (j = start; j <= code; j++) {
  13732. glyphsVMetrics[j] = vmetric;
  13733. }
  13734. }
  13735. }
  13736. }
  13737. }
  13738. } else {
  13739. const firstChar = properties.firstChar;
  13740. widths = dict.get("Widths");
  13741. if (widths) {
  13742. j = firstChar;
  13743. for (i = 0, ii = widths.length; i < ii; i++) {
  13744. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  13745. }
  13746. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  13747. } else {
  13748. const baseFontName = dict.get("BaseFont");
  13749. if (baseFontName instanceof _primitives.Name) {
  13750. const metrics = this.getBaseFontMetrics(baseFontName.name);
  13751. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  13752. defaultWidth = metrics.defaultWidth;
  13753. }
  13754. }
  13755. }
  13756. let isMonospace = true;
  13757. let firstWidth = defaultWidth;
  13758. for (const glyph in glyphsWidths) {
  13759. const glyphWidth = glyphsWidths[glyph];
  13760. if (!glyphWidth) {
  13761. continue;
  13762. }
  13763. if (!firstWidth) {
  13764. firstWidth = glyphWidth;
  13765. continue;
  13766. }
  13767. if (firstWidth !== glyphWidth) {
  13768. isMonospace = false;
  13769. break;
  13770. }
  13771. }
  13772. if (isMonospace) {
  13773. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  13774. }
  13775. properties.defaultWidth = defaultWidth;
  13776. properties.widths = glyphsWidths;
  13777. properties.defaultVMetrics = defaultVMetrics;
  13778. properties.vmetrics = glyphsVMetrics;
  13779. }
  13780. isSerifFont(baseFontName) {
  13781. const fontNameWoStyle = baseFontName.split("-")[0];
  13782. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
  13783. }
  13784. getBaseFontMetrics(name) {
  13785. let defaultWidth = 0;
  13786. let widths = Object.create(null);
  13787. let monospace = false;
  13788. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  13789. let lookupName = stdFontMap[name] || name;
  13790. const Metrics = (0, _metrics.getMetrics)();
  13791. if (!(lookupName in Metrics)) {
  13792. if (this.isSerifFont(name)) {
  13793. lookupName = "Times-Roman";
  13794. } else {
  13795. lookupName = "Helvetica";
  13796. }
  13797. }
  13798. const glyphWidths = Metrics[lookupName];
  13799. if (typeof glyphWidths === "number") {
  13800. defaultWidth = glyphWidths;
  13801. monospace = true;
  13802. } else {
  13803. widths = glyphWidths();
  13804. }
  13805. return {
  13806. defaultWidth,
  13807. monospace,
  13808. widths
  13809. };
  13810. }
  13811. buildCharCodeToWidth(widthsByGlyphName, properties) {
  13812. const widths = Object.create(null);
  13813. const differences = properties.differences;
  13814. const encoding = properties.defaultEncoding;
  13815. for (let charCode = 0; charCode < 256; charCode++) {
  13816. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  13817. widths[charCode] = widthsByGlyphName[differences[charCode]];
  13818. continue;
  13819. }
  13820. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  13821. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  13822. continue;
  13823. }
  13824. }
  13825. return widths;
  13826. }
  13827. preEvaluateFont(dict) {
  13828. const baseDict = dict;
  13829. let type = dict.get("Subtype");
  13830. if (!(type instanceof _primitives.Name)) {
  13831. throw new _util.FormatError("invalid font Subtype");
  13832. }
  13833. let composite = false;
  13834. let hash, toUnicode;
  13835. if (type.name === "Type0") {
  13836. const df = dict.get("DescendantFonts");
  13837. if (!df) {
  13838. throw new _util.FormatError("Descendant fonts are not specified");
  13839. }
  13840. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  13841. if (!(dict instanceof _primitives.Dict)) {
  13842. throw new _util.FormatError("Descendant font is not a dictionary.");
  13843. }
  13844. type = dict.get("Subtype");
  13845. if (!(type instanceof _primitives.Name)) {
  13846. throw new _util.FormatError("invalid font Subtype");
  13847. }
  13848. composite = true;
  13849. }
  13850. const firstChar = dict.get("FirstChar") || 0,
  13851. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  13852. const descriptor = dict.get("FontDescriptor");
  13853. if (descriptor) {
  13854. hash = new _murmurhash.MurmurHash3_64();
  13855. const encoding = baseDict.getRaw("Encoding");
  13856. if (encoding instanceof _primitives.Name) {
  13857. hash.update(encoding.name);
  13858. } else if (encoding instanceof _primitives.Ref) {
  13859. hash.update(encoding.toString());
  13860. } else if (encoding instanceof _primitives.Dict) {
  13861. for (const entry of encoding.getRawValues()) {
  13862. if (entry instanceof _primitives.Name) {
  13863. hash.update(entry.name);
  13864. } else if (entry instanceof _primitives.Ref) {
  13865. hash.update(entry.toString());
  13866. } else if (Array.isArray(entry)) {
  13867. const diffLength = entry.length,
  13868. diffBuf = new Array(diffLength);
  13869. for (let j = 0; j < diffLength; j++) {
  13870. const diffEntry = entry[j];
  13871. if (diffEntry instanceof _primitives.Name) {
  13872. diffBuf[j] = diffEntry.name;
  13873. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  13874. diffBuf[j] = diffEntry.toString();
  13875. }
  13876. }
  13877. hash.update(diffBuf.join());
  13878. }
  13879. }
  13880. }
  13881. hash.update(`${firstChar}-${lastChar}`);
  13882. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  13883. if (toUnicode instanceof _base_stream.BaseStream) {
  13884. const stream = toUnicode.str || toUnicode;
  13885. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  13886. hash.update(uint8array);
  13887. } else if (toUnicode instanceof _primitives.Name) {
  13888. hash.update(toUnicode.name);
  13889. }
  13890. const widths = dict.get("Widths") || baseDict.get("Widths");
  13891. if (Array.isArray(widths)) {
  13892. const widthsBuf = [];
  13893. for (const entry of widths) {
  13894. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  13895. widthsBuf.push(entry.toString());
  13896. }
  13897. }
  13898. hash.update(widthsBuf.join());
  13899. }
  13900. if (composite) {
  13901. hash.update("compositeFont");
  13902. const compositeWidths = dict.get("W") || baseDict.get("W");
  13903. if (Array.isArray(compositeWidths)) {
  13904. const widthsBuf = [];
  13905. for (const entry of compositeWidths) {
  13906. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  13907. widthsBuf.push(entry.toString());
  13908. } else if (Array.isArray(entry)) {
  13909. const subWidthsBuf = [];
  13910. for (const element of entry) {
  13911. if (typeof element === "number" || element instanceof _primitives.Ref) {
  13912. subWidthsBuf.push(element.toString());
  13913. }
  13914. }
  13915. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  13916. }
  13917. }
  13918. hash.update(widthsBuf.join());
  13919. }
  13920. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  13921. if (cidToGidMap instanceof _primitives.Name) {
  13922. hash.update(cidToGidMap.name);
  13923. } else if (cidToGidMap instanceof _primitives.Ref) {
  13924. hash.update(cidToGidMap.toString());
  13925. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  13926. hash.update(cidToGidMap.peekBytes());
  13927. }
  13928. }
  13929. }
  13930. return {
  13931. descriptor,
  13932. dict,
  13933. baseDict,
  13934. composite,
  13935. type: type.name,
  13936. firstChar,
  13937. lastChar,
  13938. toUnicode,
  13939. hash: hash ? hash.hexdigest() : ""
  13940. };
  13941. }
  13942. async translateFont(_ref9) {
  13943. let {
  13944. descriptor,
  13945. dict,
  13946. baseDict,
  13947. composite,
  13948. type,
  13949. firstChar,
  13950. lastChar,
  13951. toUnicode,
  13952. cssFontInfo
  13953. } = _ref9;
  13954. const isType3Font = type === "Type3";
  13955. let properties;
  13956. if (!descriptor) {
  13957. if (isType3Font) {
  13958. descriptor = new _primitives.Dict(null);
  13959. descriptor.set("FontName", _primitives.Name.get(type));
  13960. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  13961. } else {
  13962. let baseFontName = dict.get("BaseFont");
  13963. if (!(baseFontName instanceof _primitives.Name)) {
  13964. throw new _util.FormatError("Base font is not specified");
  13965. }
  13966. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  13967. const metrics = this.getBaseFontMetrics(baseFontName);
  13968. const fontNameWoStyle = baseFontName.split("-")[0];
  13969. 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);
  13970. properties = {
  13971. type,
  13972. name: baseFontName,
  13973. loadedName: baseDict.loadedName,
  13974. widths: metrics.widths,
  13975. defaultWidth: metrics.defaultWidth,
  13976. isSimulatedFlags: true,
  13977. flags,
  13978. firstChar,
  13979. lastChar,
  13980. toUnicode,
  13981. xHeight: 0,
  13982. capHeight: 0,
  13983. italicAngle: 0,
  13984. isType3Font
  13985. };
  13986. const widths = dict.get("Widths");
  13987. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  13988. let file = null;
  13989. if (standardFontName) {
  13990. properties.isStandardFont = true;
  13991. file = await this.fetchStandardFontData(standardFontName);
  13992. properties.isInternalFont = !!file;
  13993. }
  13994. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  13995. if (widths) {
  13996. const glyphWidths = [];
  13997. let j = firstChar;
  13998. for (const width of widths) {
  13999. glyphWidths[j++] = this.xref.fetchIfRef(width);
  14000. }
  14001. newProperties.widths = glyphWidths;
  14002. } else {
  14003. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  14004. }
  14005. return new _fonts.Font(baseFontName, file, newProperties);
  14006. });
  14007. }
  14008. }
  14009. let fontName = descriptor.get("FontName");
  14010. let baseFont = dict.get("BaseFont");
  14011. if (typeof fontName === "string") {
  14012. fontName = _primitives.Name.get(fontName);
  14013. }
  14014. if (typeof baseFont === "string") {
  14015. baseFont = _primitives.Name.get(baseFont);
  14016. }
  14017. if (!isType3Font) {
  14018. const fontNameStr = fontName && fontName.name;
  14019. const baseFontStr = baseFont && baseFont.name;
  14020. if (fontNameStr !== baseFontStr) {
  14021. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  14022. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  14023. fontName = baseFont;
  14024. }
  14025. }
  14026. }
  14027. fontName = fontName || baseFont;
  14028. if (!(fontName instanceof _primitives.Name)) {
  14029. throw new _util.FormatError("invalid font name");
  14030. }
  14031. let fontFile, subtype, length1, length2, length3;
  14032. try {
  14033. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  14034. } catch (ex) {
  14035. if (!this.options.ignoreErrors) {
  14036. throw ex;
  14037. }
  14038. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  14039. fontFile = new _stream.NullStream();
  14040. }
  14041. let isStandardFont = false;
  14042. let isInternalFont = false;
  14043. let glyphScaleFactors = null;
  14044. if (fontFile) {
  14045. if (fontFile.dict) {
  14046. const subtypeEntry = fontFile.dict.get("Subtype");
  14047. if (subtypeEntry instanceof _primitives.Name) {
  14048. subtype = subtypeEntry.name;
  14049. }
  14050. length1 = fontFile.dict.get("Length1");
  14051. length2 = fontFile.dict.get("Length2");
  14052. length3 = fontFile.dict.get("Length3");
  14053. }
  14054. } else if (cssFontInfo) {
  14055. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  14056. if (standardFontName) {
  14057. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  14058. cssFontInfo.metrics = standardFontName.metrics || null;
  14059. glyphScaleFactors = standardFontName.factors || null;
  14060. fontFile = await this.fetchStandardFontData(standardFontName.name);
  14061. isInternalFont = !!fontFile;
  14062. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  14063. composite = true;
  14064. }
  14065. } else if (!isType3Font) {
  14066. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  14067. if (standardFontName) {
  14068. isStandardFont = true;
  14069. fontFile = await this.fetchStandardFontData(standardFontName);
  14070. isInternalFont = !!fontFile;
  14071. }
  14072. }
  14073. properties = {
  14074. type,
  14075. name: fontName.name,
  14076. subtype,
  14077. file: fontFile,
  14078. length1,
  14079. length2,
  14080. length3,
  14081. isStandardFont,
  14082. isInternalFont,
  14083. loadedName: baseDict.loadedName,
  14084. composite,
  14085. fixedPitch: false,
  14086. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  14087. firstChar,
  14088. lastChar,
  14089. toUnicode,
  14090. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  14091. ascent: descriptor.get("Ascent"),
  14092. descent: descriptor.get("Descent"),
  14093. xHeight: descriptor.get("XHeight") || 0,
  14094. capHeight: descriptor.get("CapHeight") || 0,
  14095. flags: descriptor.get("Flags"),
  14096. italicAngle: descriptor.get("ItalicAngle") || 0,
  14097. isType3Font,
  14098. cssFontInfo,
  14099. scaleFactors: glyphScaleFactors
  14100. };
  14101. if (composite) {
  14102. const cidEncoding = baseDict.get("Encoding");
  14103. if (cidEncoding instanceof _primitives.Name) {
  14104. properties.cidEncoding = cidEncoding.name;
  14105. }
  14106. const cMap = await _cmap.CMapFactory.create({
  14107. encoding: cidEncoding,
  14108. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  14109. useCMap: null
  14110. });
  14111. properties.cMap = cMap;
  14112. properties.vertical = properties.cMap.vertical;
  14113. }
  14114. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  14115. this.extractWidths(dict, descriptor, newProperties);
  14116. return new _fonts.Font(fontName.name, fontFile, newProperties);
  14117. });
  14118. }
  14119. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  14120. function buildPath(fontChar) {
  14121. const glyphName = `${font.loadedName}_path_${fontChar}`;
  14122. try {
  14123. if (font.renderer.hasBuiltPath(fontChar)) {
  14124. return;
  14125. }
  14126. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  14127. } catch (reason) {
  14128. if (evaluatorOptions.ignoreErrors) {
  14129. handler.send("UnsupportedFeature", {
  14130. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  14131. });
  14132. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  14133. return;
  14134. }
  14135. throw reason;
  14136. }
  14137. }
  14138. for (const glyph of glyphs) {
  14139. buildPath(glyph.fontChar);
  14140. const accent = glyph.accent;
  14141. if (accent && accent.fontChar) {
  14142. buildPath(accent.fontChar);
  14143. }
  14144. }
  14145. }
  14146. static get fallbackFontDict() {
  14147. const dict = new _primitives.Dict();
  14148. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  14149. dict.set("Type", _primitives.Name.get("FallbackType"));
  14150. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  14151. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  14152. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  14153. }
  14154. }
  14155. exports.PartialEvaluator = PartialEvaluator;
  14156. class TranslatedFont {
  14157. constructor(_ref10) {
  14158. let {
  14159. loadedName,
  14160. font,
  14161. dict,
  14162. evaluatorOptions
  14163. } = _ref10;
  14164. this.loadedName = loadedName;
  14165. this.font = font;
  14166. this.dict = dict;
  14167. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  14168. this.type3Loaded = null;
  14169. this.type3Dependencies = font.isType3Font ? new Set() : null;
  14170. this.sent = false;
  14171. }
  14172. send(handler) {
  14173. if (this.sent) {
  14174. return;
  14175. }
  14176. this.sent = true;
  14177. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  14178. }
  14179. fallback(handler) {
  14180. if (!this.font.data) {
  14181. return;
  14182. }
  14183. this.font.disableFontFace = true;
  14184. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  14185. }
  14186. loadType3Data(evaluator, resources, task) {
  14187. if (this.type3Loaded) {
  14188. return this.type3Loaded;
  14189. }
  14190. if (!this.font.isType3Font) {
  14191. throw new Error("Must be a Type3 font.");
  14192. }
  14193. const type3Evaluator = evaluator.clone({
  14194. ignoreErrors: false
  14195. });
  14196. type3Evaluator.parsingType3Font = true;
  14197. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  14198. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  14199. type3FontRefs.put(this.dict.objId);
  14200. }
  14201. type3Evaluator.type3FontRefs = type3FontRefs;
  14202. const translatedFont = this.font,
  14203. type3Dependencies = this.type3Dependencies;
  14204. let loadCharProcsPromise = Promise.resolve();
  14205. const charProcs = this.dict.get("CharProcs");
  14206. const fontResources = this.dict.get("Resources") || resources;
  14207. const charProcOperatorList = Object.create(null);
  14208. const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  14209. width = fontBBox[2] - fontBBox[0],
  14210. height = fontBBox[3] - fontBBox[1];
  14211. const fontBBoxSize = Math.hypot(width, height);
  14212. for (const key of charProcs.getKeys()) {
  14213. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  14214. const glyphStream = charProcs.get(key);
  14215. const operatorList = new _operator_list.OperatorList();
  14216. return type3Evaluator.getOperatorList({
  14217. stream: glyphStream,
  14218. task,
  14219. resources: fontResources,
  14220. operatorList
  14221. }).then(() => {
  14222. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  14223. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  14224. }
  14225. charProcOperatorList[key] = operatorList.getIR();
  14226. for (const dependency of operatorList.dependencies) {
  14227. type3Dependencies.add(dependency);
  14228. }
  14229. }).catch(function (reason) {
  14230. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  14231. const dummyOperatorList = new _operator_list.OperatorList();
  14232. charProcOperatorList[key] = dummyOperatorList.getIR();
  14233. });
  14234. });
  14235. }
  14236. this.type3Loaded = loadCharProcsPromise.then(() => {
  14237. translatedFont.charProcOperatorList = charProcOperatorList;
  14238. if (this._bbox) {
  14239. translatedFont.isCharBBox = true;
  14240. translatedFont.bbox = this._bbox;
  14241. }
  14242. });
  14243. return this.type3Loaded;
  14244. }
  14245. _removeType3ColorOperators(operatorList) {
  14246. let fontBBoxSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
  14247. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  14248. width = charBBox[2] - charBBox[0],
  14249. height = charBBox[3] - charBBox[1];
  14250. const charBBoxSize = Math.hypot(width, height);
  14251. if (width === 0 || height === 0) {
  14252. operatorList.fnArray.splice(0, 1);
  14253. operatorList.argsArray.splice(0, 1);
  14254. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  14255. if (!this._bbox) {
  14256. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  14257. }
  14258. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  14259. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  14260. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  14261. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  14262. }
  14263. let i = 0,
  14264. ii = operatorList.length;
  14265. while (i < ii) {
  14266. switch (operatorList.fnArray[i]) {
  14267. case _util.OPS.setCharWidthAndBounds:
  14268. break;
  14269. case _util.OPS.setStrokeColorSpace:
  14270. case _util.OPS.setFillColorSpace:
  14271. case _util.OPS.setStrokeColor:
  14272. case _util.OPS.setStrokeColorN:
  14273. case _util.OPS.setFillColor:
  14274. case _util.OPS.setFillColorN:
  14275. case _util.OPS.setStrokeGray:
  14276. case _util.OPS.setFillGray:
  14277. case _util.OPS.setStrokeRGBColor:
  14278. case _util.OPS.setFillRGBColor:
  14279. case _util.OPS.setStrokeCMYKColor:
  14280. case _util.OPS.setFillCMYKColor:
  14281. case _util.OPS.shadingFill:
  14282. case _util.OPS.setRenderingIntent:
  14283. operatorList.fnArray.splice(i, 1);
  14284. operatorList.argsArray.splice(i, 1);
  14285. ii--;
  14286. continue;
  14287. case _util.OPS.setGState:
  14288. const [gStateObj] = operatorList.argsArray[i];
  14289. let j = 0,
  14290. jj = gStateObj.length;
  14291. while (j < jj) {
  14292. const [gStateKey] = gStateObj[j];
  14293. switch (gStateKey) {
  14294. case "TR":
  14295. case "TR2":
  14296. case "HT":
  14297. case "BG":
  14298. case "BG2":
  14299. case "UCR":
  14300. case "UCR2":
  14301. gStateObj.splice(j, 1);
  14302. jj--;
  14303. continue;
  14304. }
  14305. j++;
  14306. }
  14307. break;
  14308. }
  14309. i++;
  14310. }
  14311. }
  14312. }
  14313. class StateManager {
  14314. constructor() {
  14315. let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new EvalState();
  14316. this.state = initialState;
  14317. this.stateStack = [];
  14318. }
  14319. save() {
  14320. const old = this.state;
  14321. this.stateStack.push(this.state);
  14322. this.state = old.clone();
  14323. }
  14324. restore() {
  14325. const prev = this.stateStack.pop();
  14326. if (prev) {
  14327. this.state = prev;
  14328. }
  14329. }
  14330. transform(args) {
  14331. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  14332. }
  14333. }
  14334. class TextState {
  14335. constructor() {
  14336. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14337. this.fontName = null;
  14338. this.fontSize = 0;
  14339. this.font = null;
  14340. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  14341. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  14342. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  14343. this.charSpacing = 0;
  14344. this.wordSpacing = 0;
  14345. this.leading = 0;
  14346. this.textHScale = 1;
  14347. this.textRise = 0;
  14348. }
  14349. setTextMatrix(a, b, c, d, e, f) {
  14350. const m = this.textMatrix;
  14351. m[0] = a;
  14352. m[1] = b;
  14353. m[2] = c;
  14354. m[3] = d;
  14355. m[4] = e;
  14356. m[5] = f;
  14357. }
  14358. setTextLineMatrix(a, b, c, d, e, f) {
  14359. const m = this.textLineMatrix;
  14360. m[0] = a;
  14361. m[1] = b;
  14362. m[2] = c;
  14363. m[3] = d;
  14364. m[4] = e;
  14365. m[5] = f;
  14366. }
  14367. translateTextMatrix(x, y) {
  14368. const m = this.textMatrix;
  14369. m[4] = m[0] * x + m[2] * y + m[4];
  14370. m[5] = m[1] * x + m[3] * y + m[5];
  14371. }
  14372. translateTextLineMatrix(x, y) {
  14373. const m = this.textLineMatrix;
  14374. m[4] = m[0] * x + m[2] * y + m[4];
  14375. m[5] = m[1] * x + m[3] * y + m[5];
  14376. }
  14377. carriageReturn() {
  14378. this.translateTextLineMatrix(0, -this.leading);
  14379. this.textMatrix = this.textLineMatrix.slice();
  14380. }
  14381. clone() {
  14382. const clone = Object.create(this);
  14383. clone.textMatrix = this.textMatrix.slice();
  14384. clone.textLineMatrix = this.textLineMatrix.slice();
  14385. clone.fontMatrix = this.fontMatrix.slice();
  14386. return clone;
  14387. }
  14388. }
  14389. class EvalState {
  14390. constructor() {
  14391. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  14392. this.font = null;
  14393. this.textRenderingMode = _util.TextRenderingMode.FILL;
  14394. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  14395. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  14396. }
  14397. clone() {
  14398. return Object.create(this);
  14399. }
  14400. }
  14401. class EvaluatorPreprocessor {
  14402. static get opMap() {
  14403. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  14404. t.w = {
  14405. id: _util.OPS.setLineWidth,
  14406. numArgs: 1,
  14407. variableArgs: false
  14408. };
  14409. t.J = {
  14410. id: _util.OPS.setLineCap,
  14411. numArgs: 1,
  14412. variableArgs: false
  14413. };
  14414. t.j = {
  14415. id: _util.OPS.setLineJoin,
  14416. numArgs: 1,
  14417. variableArgs: false
  14418. };
  14419. t.M = {
  14420. id: _util.OPS.setMiterLimit,
  14421. numArgs: 1,
  14422. variableArgs: false
  14423. };
  14424. t.d = {
  14425. id: _util.OPS.setDash,
  14426. numArgs: 2,
  14427. variableArgs: false
  14428. };
  14429. t.ri = {
  14430. id: _util.OPS.setRenderingIntent,
  14431. numArgs: 1,
  14432. variableArgs: false
  14433. };
  14434. t.i = {
  14435. id: _util.OPS.setFlatness,
  14436. numArgs: 1,
  14437. variableArgs: false
  14438. };
  14439. t.gs = {
  14440. id: _util.OPS.setGState,
  14441. numArgs: 1,
  14442. variableArgs: false
  14443. };
  14444. t.q = {
  14445. id: _util.OPS.save,
  14446. numArgs: 0,
  14447. variableArgs: false
  14448. };
  14449. t.Q = {
  14450. id: _util.OPS.restore,
  14451. numArgs: 0,
  14452. variableArgs: false
  14453. };
  14454. t.cm = {
  14455. id: _util.OPS.transform,
  14456. numArgs: 6,
  14457. variableArgs: false
  14458. };
  14459. t.m = {
  14460. id: _util.OPS.moveTo,
  14461. numArgs: 2,
  14462. variableArgs: false
  14463. };
  14464. t.l = {
  14465. id: _util.OPS.lineTo,
  14466. numArgs: 2,
  14467. variableArgs: false
  14468. };
  14469. t.c = {
  14470. id: _util.OPS.curveTo,
  14471. numArgs: 6,
  14472. variableArgs: false
  14473. };
  14474. t.v = {
  14475. id: _util.OPS.curveTo2,
  14476. numArgs: 4,
  14477. variableArgs: false
  14478. };
  14479. t.y = {
  14480. id: _util.OPS.curveTo3,
  14481. numArgs: 4,
  14482. variableArgs: false
  14483. };
  14484. t.h = {
  14485. id: _util.OPS.closePath,
  14486. numArgs: 0,
  14487. variableArgs: false
  14488. };
  14489. t.re = {
  14490. id: _util.OPS.rectangle,
  14491. numArgs: 4,
  14492. variableArgs: false
  14493. };
  14494. t.S = {
  14495. id: _util.OPS.stroke,
  14496. numArgs: 0,
  14497. variableArgs: false
  14498. };
  14499. t.s = {
  14500. id: _util.OPS.closeStroke,
  14501. numArgs: 0,
  14502. variableArgs: false
  14503. };
  14504. t.f = {
  14505. id: _util.OPS.fill,
  14506. numArgs: 0,
  14507. variableArgs: false
  14508. };
  14509. t.F = {
  14510. id: _util.OPS.fill,
  14511. numArgs: 0,
  14512. variableArgs: false
  14513. };
  14514. t["f*"] = {
  14515. id: _util.OPS.eoFill,
  14516. numArgs: 0,
  14517. variableArgs: false
  14518. };
  14519. t.B = {
  14520. id: _util.OPS.fillStroke,
  14521. numArgs: 0,
  14522. variableArgs: false
  14523. };
  14524. t["B*"] = {
  14525. id: _util.OPS.eoFillStroke,
  14526. numArgs: 0,
  14527. variableArgs: false
  14528. };
  14529. t.b = {
  14530. id: _util.OPS.closeFillStroke,
  14531. numArgs: 0,
  14532. variableArgs: false
  14533. };
  14534. t["b*"] = {
  14535. id: _util.OPS.closeEOFillStroke,
  14536. numArgs: 0,
  14537. variableArgs: false
  14538. };
  14539. t.n = {
  14540. id: _util.OPS.endPath,
  14541. numArgs: 0,
  14542. variableArgs: false
  14543. };
  14544. t.W = {
  14545. id: _util.OPS.clip,
  14546. numArgs: 0,
  14547. variableArgs: false
  14548. };
  14549. t["W*"] = {
  14550. id: _util.OPS.eoClip,
  14551. numArgs: 0,
  14552. variableArgs: false
  14553. };
  14554. t.BT = {
  14555. id: _util.OPS.beginText,
  14556. numArgs: 0,
  14557. variableArgs: false
  14558. };
  14559. t.ET = {
  14560. id: _util.OPS.endText,
  14561. numArgs: 0,
  14562. variableArgs: false
  14563. };
  14564. t.Tc = {
  14565. id: _util.OPS.setCharSpacing,
  14566. numArgs: 1,
  14567. variableArgs: false
  14568. };
  14569. t.Tw = {
  14570. id: _util.OPS.setWordSpacing,
  14571. numArgs: 1,
  14572. variableArgs: false
  14573. };
  14574. t.Tz = {
  14575. id: _util.OPS.setHScale,
  14576. numArgs: 1,
  14577. variableArgs: false
  14578. };
  14579. t.TL = {
  14580. id: _util.OPS.setLeading,
  14581. numArgs: 1,
  14582. variableArgs: false
  14583. };
  14584. t.Tf = {
  14585. id: _util.OPS.setFont,
  14586. numArgs: 2,
  14587. variableArgs: false
  14588. };
  14589. t.Tr = {
  14590. id: _util.OPS.setTextRenderingMode,
  14591. numArgs: 1,
  14592. variableArgs: false
  14593. };
  14594. t.Ts = {
  14595. id: _util.OPS.setTextRise,
  14596. numArgs: 1,
  14597. variableArgs: false
  14598. };
  14599. t.Td = {
  14600. id: _util.OPS.moveText,
  14601. numArgs: 2,
  14602. variableArgs: false
  14603. };
  14604. t.TD = {
  14605. id: _util.OPS.setLeadingMoveText,
  14606. numArgs: 2,
  14607. variableArgs: false
  14608. };
  14609. t.Tm = {
  14610. id: _util.OPS.setTextMatrix,
  14611. numArgs: 6,
  14612. variableArgs: false
  14613. };
  14614. t["T*"] = {
  14615. id: _util.OPS.nextLine,
  14616. numArgs: 0,
  14617. variableArgs: false
  14618. };
  14619. t.Tj = {
  14620. id: _util.OPS.showText,
  14621. numArgs: 1,
  14622. variableArgs: false
  14623. };
  14624. t.TJ = {
  14625. id: _util.OPS.showSpacedText,
  14626. numArgs: 1,
  14627. variableArgs: false
  14628. };
  14629. t["'"] = {
  14630. id: _util.OPS.nextLineShowText,
  14631. numArgs: 1,
  14632. variableArgs: false
  14633. };
  14634. t['"'] = {
  14635. id: _util.OPS.nextLineSetSpacingShowText,
  14636. numArgs: 3,
  14637. variableArgs: false
  14638. };
  14639. t.d0 = {
  14640. id: _util.OPS.setCharWidth,
  14641. numArgs: 2,
  14642. variableArgs: false
  14643. };
  14644. t.d1 = {
  14645. id: _util.OPS.setCharWidthAndBounds,
  14646. numArgs: 6,
  14647. variableArgs: false
  14648. };
  14649. t.CS = {
  14650. id: _util.OPS.setStrokeColorSpace,
  14651. numArgs: 1,
  14652. variableArgs: false
  14653. };
  14654. t.cs = {
  14655. id: _util.OPS.setFillColorSpace,
  14656. numArgs: 1,
  14657. variableArgs: false
  14658. };
  14659. t.SC = {
  14660. id: _util.OPS.setStrokeColor,
  14661. numArgs: 4,
  14662. variableArgs: true
  14663. };
  14664. t.SCN = {
  14665. id: _util.OPS.setStrokeColorN,
  14666. numArgs: 33,
  14667. variableArgs: true
  14668. };
  14669. t.sc = {
  14670. id: _util.OPS.setFillColor,
  14671. numArgs: 4,
  14672. variableArgs: true
  14673. };
  14674. t.scn = {
  14675. id: _util.OPS.setFillColorN,
  14676. numArgs: 33,
  14677. variableArgs: true
  14678. };
  14679. t.G = {
  14680. id: _util.OPS.setStrokeGray,
  14681. numArgs: 1,
  14682. variableArgs: false
  14683. };
  14684. t.g = {
  14685. id: _util.OPS.setFillGray,
  14686. numArgs: 1,
  14687. variableArgs: false
  14688. };
  14689. t.RG = {
  14690. id: _util.OPS.setStrokeRGBColor,
  14691. numArgs: 3,
  14692. variableArgs: false
  14693. };
  14694. t.rg = {
  14695. id: _util.OPS.setFillRGBColor,
  14696. numArgs: 3,
  14697. variableArgs: false
  14698. };
  14699. t.K = {
  14700. id: _util.OPS.setStrokeCMYKColor,
  14701. numArgs: 4,
  14702. variableArgs: false
  14703. };
  14704. t.k = {
  14705. id: _util.OPS.setFillCMYKColor,
  14706. numArgs: 4,
  14707. variableArgs: false
  14708. };
  14709. t.sh = {
  14710. id: _util.OPS.shadingFill,
  14711. numArgs: 1,
  14712. variableArgs: false
  14713. };
  14714. t.BI = {
  14715. id: _util.OPS.beginInlineImage,
  14716. numArgs: 0,
  14717. variableArgs: false
  14718. };
  14719. t.ID = {
  14720. id: _util.OPS.beginImageData,
  14721. numArgs: 0,
  14722. variableArgs: false
  14723. };
  14724. t.EI = {
  14725. id: _util.OPS.endInlineImage,
  14726. numArgs: 1,
  14727. variableArgs: false
  14728. };
  14729. t.Do = {
  14730. id: _util.OPS.paintXObject,
  14731. numArgs: 1,
  14732. variableArgs: false
  14733. };
  14734. t.MP = {
  14735. id: _util.OPS.markPoint,
  14736. numArgs: 1,
  14737. variableArgs: false
  14738. };
  14739. t.DP = {
  14740. id: _util.OPS.markPointProps,
  14741. numArgs: 2,
  14742. variableArgs: false
  14743. };
  14744. t.BMC = {
  14745. id: _util.OPS.beginMarkedContent,
  14746. numArgs: 1,
  14747. variableArgs: false
  14748. };
  14749. t.BDC = {
  14750. id: _util.OPS.beginMarkedContentProps,
  14751. numArgs: 2,
  14752. variableArgs: false
  14753. };
  14754. t.EMC = {
  14755. id: _util.OPS.endMarkedContent,
  14756. numArgs: 0,
  14757. variableArgs: false
  14758. };
  14759. t.BX = {
  14760. id: _util.OPS.beginCompat,
  14761. numArgs: 0,
  14762. variableArgs: false
  14763. };
  14764. t.EX = {
  14765. id: _util.OPS.endCompat,
  14766. numArgs: 0,
  14767. variableArgs: false
  14768. };
  14769. t.BM = null;
  14770. t.BD = null;
  14771. t.true = null;
  14772. t.fa = null;
  14773. t.fal = null;
  14774. t.fals = null;
  14775. t.false = null;
  14776. t.nu = null;
  14777. t.nul = null;
  14778. t.null = null;
  14779. });
  14780. return (0, _util.shadow)(this, "opMap", getOPMap());
  14781. }
  14782. static get MAX_INVALID_PATH_OPS() {
  14783. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  14784. }
  14785. constructor(stream, xref) {
  14786. let stateManager = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new StateManager();
  14787. this.parser = new _parser.Parser({
  14788. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  14789. xref
  14790. });
  14791. this.stateManager = stateManager;
  14792. this.nonProcessedArgs = [];
  14793. this._isPathOp = false;
  14794. this._numInvalidPathOPS = 0;
  14795. }
  14796. get savedStatesDepth() {
  14797. return this.stateManager.stateStack.length;
  14798. }
  14799. read(operation) {
  14800. let args = operation.args;
  14801. while (true) {
  14802. const obj = this.parser.getObj();
  14803. if (obj instanceof _primitives.Cmd) {
  14804. const cmd = obj.cmd;
  14805. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  14806. if (!opSpec) {
  14807. (0, _util.warn)(`Unknown command "${cmd}".`);
  14808. continue;
  14809. }
  14810. const fn = opSpec.id;
  14811. const numArgs = opSpec.numArgs;
  14812. let argsLength = args !== null ? args.length : 0;
  14813. if (!this._isPathOp) {
  14814. this._numInvalidPathOPS = 0;
  14815. }
  14816. this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
  14817. if (!opSpec.variableArgs) {
  14818. if (argsLength !== numArgs) {
  14819. const nonProcessedArgs = this.nonProcessedArgs;
  14820. while (argsLength > numArgs) {
  14821. nonProcessedArgs.push(args.shift());
  14822. argsLength--;
  14823. }
  14824. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  14825. if (args === null) {
  14826. args = [];
  14827. }
  14828. args.unshift(nonProcessedArgs.pop());
  14829. argsLength++;
  14830. }
  14831. }
  14832. if (argsLength < numArgs) {
  14833. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  14834. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  14835. throw new _util.FormatError(`Invalid ${partialMsg}`);
  14836. }
  14837. (0, _util.warn)(`Skipping ${partialMsg}`);
  14838. if (args !== null) {
  14839. args.length = 0;
  14840. }
  14841. continue;
  14842. }
  14843. } else if (argsLength > numArgs) {
  14844. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  14845. }
  14846. this.preprocessCommand(fn, args);
  14847. operation.fn = fn;
  14848. operation.args = args;
  14849. return true;
  14850. }
  14851. if (obj === _primitives.EOF) {
  14852. return false;
  14853. }
  14854. if (obj !== null) {
  14855. if (args === null) {
  14856. args = [];
  14857. }
  14858. args.push(obj);
  14859. if (args.length > 33) {
  14860. throw new _util.FormatError("Too many arguments");
  14861. }
  14862. }
  14863. }
  14864. }
  14865. preprocessCommand(fn, args) {
  14866. switch (fn | 0) {
  14867. case _util.OPS.save:
  14868. this.stateManager.save();
  14869. break;
  14870. case _util.OPS.restore:
  14871. this.stateManager.restore();
  14872. break;
  14873. case _util.OPS.transform:
  14874. this.stateManager.transform(args);
  14875. break;
  14876. }
  14877. }
  14878. }
  14879. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  14880. /***/ }),
  14881. /* 145 */
  14882. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14883. "use strict";
  14884. Object.defineProperty(exports, "__esModule", ({
  14885. value: true
  14886. }));
  14887. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  14888. var _util = __w_pdfjs_require__(2);
  14889. var _primitives = __w_pdfjs_require__(134);
  14890. var _base_stream = __w_pdfjs_require__(136);
  14891. var _parser = __w_pdfjs_require__(146);
  14892. var _core_utils = __w_pdfjs_require__(135);
  14893. var _stream = __w_pdfjs_require__(139);
  14894. 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"];
  14895. const MAX_MAP_RANGE = 2 ** 24 - 1;
  14896. class CMap {
  14897. constructor() {
  14898. let builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  14899. this.codespaceRanges = [[], [], [], []];
  14900. this.numCodespaceRanges = 0;
  14901. this._map = [];
  14902. this.name = "";
  14903. this.vertical = false;
  14904. this.useCMap = null;
  14905. this.builtInCMap = builtInCMap;
  14906. }
  14907. addCodespaceRange(n, low, high) {
  14908. this.codespaceRanges[n - 1].push(low, high);
  14909. this.numCodespaceRanges++;
  14910. }
  14911. mapCidRange(low, high, dstLow) {
  14912. if (high - low > MAX_MAP_RANGE) {
  14913. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  14914. }
  14915. while (low <= high) {
  14916. this._map[low++] = dstLow++;
  14917. }
  14918. }
  14919. mapBfRange(low, high, dstLow) {
  14920. if (high - low > MAX_MAP_RANGE) {
  14921. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  14922. }
  14923. const lastByte = dstLow.length - 1;
  14924. while (low <= high) {
  14925. this._map[low++] = dstLow;
  14926. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  14927. if (nextCharCode > 0xff) {
  14928. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  14929. continue;
  14930. }
  14931. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  14932. }
  14933. }
  14934. mapBfRangeToArray(low, high, array) {
  14935. if (high - low > MAX_MAP_RANGE) {
  14936. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  14937. }
  14938. const ii = array.length;
  14939. let i = 0;
  14940. while (low <= high && i < ii) {
  14941. this._map[low] = array[i++];
  14942. ++low;
  14943. }
  14944. }
  14945. mapOne(src, dst) {
  14946. this._map[src] = dst;
  14947. }
  14948. lookup(code) {
  14949. return this._map[code];
  14950. }
  14951. contains(code) {
  14952. return this._map[code] !== undefined;
  14953. }
  14954. forEach(callback) {
  14955. const map = this._map;
  14956. const length = map.length;
  14957. if (length <= 0x10000) {
  14958. for (let i = 0; i < length; i++) {
  14959. if (map[i] !== undefined) {
  14960. callback(i, map[i]);
  14961. }
  14962. }
  14963. } else {
  14964. for (const i in map) {
  14965. callback(i, map[i]);
  14966. }
  14967. }
  14968. }
  14969. charCodeOf(value) {
  14970. const map = this._map;
  14971. if (map.length <= 0x10000) {
  14972. return map.indexOf(value);
  14973. }
  14974. for (const charCode in map) {
  14975. if (map[charCode] === value) {
  14976. return charCode | 0;
  14977. }
  14978. }
  14979. return -1;
  14980. }
  14981. getMap() {
  14982. return this._map;
  14983. }
  14984. readCharCode(str, offset, out) {
  14985. let c = 0;
  14986. const codespaceRanges = this.codespaceRanges;
  14987. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  14988. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  14989. const codespaceRange = codespaceRanges[n];
  14990. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  14991. const low = codespaceRange[k++];
  14992. const high = codespaceRange[k++];
  14993. if (c >= low && c <= high) {
  14994. out.charcode = c;
  14995. out.length = n + 1;
  14996. return;
  14997. }
  14998. }
  14999. }
  15000. out.charcode = 0;
  15001. out.length = 1;
  15002. }
  15003. getCharCodeLength(charCode) {
  15004. const codespaceRanges = this.codespaceRanges;
  15005. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  15006. const codespaceRange = codespaceRanges[n];
  15007. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  15008. const low = codespaceRange[k++];
  15009. const high = codespaceRange[k++];
  15010. if (charCode >= low && charCode <= high) {
  15011. return n + 1;
  15012. }
  15013. }
  15014. }
  15015. return 1;
  15016. }
  15017. get length() {
  15018. return this._map.length;
  15019. }
  15020. get isIdentityCMap() {
  15021. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  15022. return false;
  15023. }
  15024. if (this._map.length !== 0x10000) {
  15025. return false;
  15026. }
  15027. for (let i = 0; i < 0x10000; i++) {
  15028. if (this._map[i] !== i) {
  15029. return false;
  15030. }
  15031. }
  15032. return true;
  15033. }
  15034. }
  15035. exports.CMap = CMap;
  15036. class IdentityCMap extends CMap {
  15037. constructor(vertical, n) {
  15038. super();
  15039. this.vertical = vertical;
  15040. this.addCodespaceRange(n, 0, 0xffff);
  15041. }
  15042. mapCidRange(low, high, dstLow) {
  15043. (0, _util.unreachable)("should not call mapCidRange");
  15044. }
  15045. mapBfRange(low, high, dstLow) {
  15046. (0, _util.unreachable)("should not call mapBfRange");
  15047. }
  15048. mapBfRangeToArray(low, high, array) {
  15049. (0, _util.unreachable)("should not call mapBfRangeToArray");
  15050. }
  15051. mapOne(src, dst) {
  15052. (0, _util.unreachable)("should not call mapCidOne");
  15053. }
  15054. lookup(code) {
  15055. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  15056. }
  15057. contains(code) {
  15058. return Number.isInteger(code) && code <= 0xffff;
  15059. }
  15060. forEach(callback) {
  15061. for (let i = 0; i <= 0xffff; i++) {
  15062. callback(i, i);
  15063. }
  15064. }
  15065. charCodeOf(value) {
  15066. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  15067. }
  15068. getMap() {
  15069. const map = new Array(0x10000);
  15070. for (let i = 0; i <= 0xffff; i++) {
  15071. map[i] = i;
  15072. }
  15073. return map;
  15074. }
  15075. get length() {
  15076. return 0x10000;
  15077. }
  15078. get isIdentityCMap() {
  15079. (0, _util.unreachable)("should not access .isIdentityCMap");
  15080. }
  15081. }
  15082. exports.IdentityCMap = IdentityCMap;
  15083. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  15084. function hexToInt(a, size) {
  15085. let n = 0;
  15086. for (let i = 0; i <= size; i++) {
  15087. n = n << 8 | a[i];
  15088. }
  15089. return n >>> 0;
  15090. }
  15091. function hexToStr(a, size) {
  15092. if (size === 1) {
  15093. return String.fromCharCode(a[0], a[1]);
  15094. }
  15095. if (size === 3) {
  15096. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  15097. }
  15098. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  15099. }
  15100. function addHex(a, b, size) {
  15101. let c = 0;
  15102. for (let i = size; i >= 0; i--) {
  15103. c += a[i] + b[i];
  15104. a[i] = c & 255;
  15105. c >>= 8;
  15106. }
  15107. }
  15108. function incHex(a, size) {
  15109. let c = 1;
  15110. for (let i = size; i >= 0 && c > 0; i--) {
  15111. c += a[i];
  15112. a[i] = c & 255;
  15113. c >>= 8;
  15114. }
  15115. }
  15116. const MAX_NUM_SIZE = 16;
  15117. const MAX_ENCODED_NUM_SIZE = 19;
  15118. class BinaryCMapStream {
  15119. constructor(data) {
  15120. this.buffer = data;
  15121. this.pos = 0;
  15122. this.end = data.length;
  15123. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  15124. }
  15125. readByte() {
  15126. if (this.pos >= this.end) {
  15127. return -1;
  15128. }
  15129. return this.buffer[this.pos++];
  15130. }
  15131. readNumber() {
  15132. let n = 0;
  15133. let last;
  15134. do {
  15135. const b = this.readByte();
  15136. if (b < 0) {
  15137. throw new _util.FormatError("unexpected EOF in bcmap");
  15138. }
  15139. last = !(b & 0x80);
  15140. n = n << 7 | b & 0x7f;
  15141. } while (!last);
  15142. return n;
  15143. }
  15144. readSigned() {
  15145. const n = this.readNumber();
  15146. return n & 1 ? ~(n >>> 1) : n >>> 1;
  15147. }
  15148. readHex(num, size) {
  15149. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  15150. this.pos += size + 1;
  15151. }
  15152. readHexNumber(num, size) {
  15153. let last;
  15154. const stack = this.tmpBuf;
  15155. let sp = 0;
  15156. do {
  15157. const b = this.readByte();
  15158. if (b < 0) {
  15159. throw new _util.FormatError("unexpected EOF in bcmap");
  15160. }
  15161. last = !(b & 0x80);
  15162. stack[sp++] = b & 0x7f;
  15163. } while (!last);
  15164. let i = size,
  15165. buffer = 0,
  15166. bufferSize = 0;
  15167. while (i >= 0) {
  15168. while (bufferSize < 8 && stack.length > 0) {
  15169. buffer |= stack[--sp] << bufferSize;
  15170. bufferSize += 7;
  15171. }
  15172. num[i] = buffer & 255;
  15173. i--;
  15174. buffer >>= 8;
  15175. bufferSize -= 8;
  15176. }
  15177. }
  15178. readHexSigned(num, size) {
  15179. this.readHexNumber(num, size);
  15180. const sign = num[size] & 1 ? 255 : 0;
  15181. let c = 0;
  15182. for (let i = 0; i <= size; i++) {
  15183. c = (c & 1) << 8 | num[i];
  15184. num[i] = c >> 1 ^ sign;
  15185. }
  15186. }
  15187. readString() {
  15188. const len = this.readNumber();
  15189. let s = "";
  15190. for (let i = 0; i < len; i++) {
  15191. s += String.fromCharCode(this.readNumber());
  15192. }
  15193. return s;
  15194. }
  15195. }
  15196. class BinaryCMapReader {
  15197. async process(data, cMap, extend) {
  15198. const stream = new BinaryCMapStream(data);
  15199. const header = stream.readByte();
  15200. cMap.vertical = !!(header & 1);
  15201. let useCMap = null;
  15202. const start = new Uint8Array(MAX_NUM_SIZE);
  15203. const end = new Uint8Array(MAX_NUM_SIZE);
  15204. const char = new Uint8Array(MAX_NUM_SIZE);
  15205. const charCode = new Uint8Array(MAX_NUM_SIZE);
  15206. const tmp = new Uint8Array(MAX_NUM_SIZE);
  15207. let code;
  15208. let b;
  15209. while ((b = stream.readByte()) >= 0) {
  15210. const type = b >> 5;
  15211. if (type === 7) {
  15212. switch (b & 0x1f) {
  15213. case 0:
  15214. stream.readString();
  15215. break;
  15216. case 1:
  15217. useCMap = stream.readString();
  15218. break;
  15219. }
  15220. continue;
  15221. }
  15222. const sequence = !!(b & 0x10);
  15223. const dataSize = b & 15;
  15224. if (dataSize + 1 > MAX_NUM_SIZE) {
  15225. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  15226. }
  15227. const ucs2DataSize = 1;
  15228. const subitemsCount = stream.readNumber();
  15229. switch (type) {
  15230. case 0:
  15231. stream.readHex(start, dataSize);
  15232. stream.readHexNumber(end, dataSize);
  15233. addHex(end, start, dataSize);
  15234. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15235. for (let i = 1; i < subitemsCount; i++) {
  15236. incHex(end, dataSize);
  15237. stream.readHexNumber(start, dataSize);
  15238. addHex(start, end, dataSize);
  15239. stream.readHexNumber(end, dataSize);
  15240. addHex(end, start, dataSize);
  15241. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  15242. }
  15243. break;
  15244. case 1:
  15245. stream.readHex(start, dataSize);
  15246. stream.readHexNumber(end, dataSize);
  15247. addHex(end, start, dataSize);
  15248. stream.readNumber();
  15249. for (let i = 1; i < subitemsCount; i++) {
  15250. incHex(end, dataSize);
  15251. stream.readHexNumber(start, dataSize);
  15252. addHex(start, end, dataSize);
  15253. stream.readHexNumber(end, dataSize);
  15254. addHex(end, start, dataSize);
  15255. stream.readNumber();
  15256. }
  15257. break;
  15258. case 2:
  15259. stream.readHex(char, dataSize);
  15260. code = stream.readNumber();
  15261. cMap.mapOne(hexToInt(char, dataSize), code);
  15262. for (let i = 1; i < subitemsCount; i++) {
  15263. incHex(char, dataSize);
  15264. if (!sequence) {
  15265. stream.readHexNumber(tmp, dataSize);
  15266. addHex(char, tmp, dataSize);
  15267. }
  15268. code = stream.readSigned() + (code + 1);
  15269. cMap.mapOne(hexToInt(char, dataSize), code);
  15270. }
  15271. break;
  15272. case 3:
  15273. stream.readHex(start, dataSize);
  15274. stream.readHexNumber(end, dataSize);
  15275. addHex(end, start, dataSize);
  15276. code = stream.readNumber();
  15277. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15278. for (let i = 1; i < subitemsCount; i++) {
  15279. incHex(end, dataSize);
  15280. if (!sequence) {
  15281. stream.readHexNumber(start, dataSize);
  15282. addHex(start, end, dataSize);
  15283. } else {
  15284. start.set(end);
  15285. }
  15286. stream.readHexNumber(end, dataSize);
  15287. addHex(end, start, dataSize);
  15288. code = stream.readNumber();
  15289. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  15290. }
  15291. break;
  15292. case 4:
  15293. stream.readHex(char, ucs2DataSize);
  15294. stream.readHex(charCode, dataSize);
  15295. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15296. for (let i = 1; i < subitemsCount; i++) {
  15297. incHex(char, ucs2DataSize);
  15298. if (!sequence) {
  15299. stream.readHexNumber(tmp, ucs2DataSize);
  15300. addHex(char, tmp, ucs2DataSize);
  15301. }
  15302. incHex(charCode, dataSize);
  15303. stream.readHexSigned(tmp, dataSize);
  15304. addHex(charCode, tmp, dataSize);
  15305. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  15306. }
  15307. break;
  15308. case 5:
  15309. stream.readHex(start, ucs2DataSize);
  15310. stream.readHexNumber(end, ucs2DataSize);
  15311. addHex(end, start, ucs2DataSize);
  15312. stream.readHex(charCode, dataSize);
  15313. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15314. for (let i = 1; i < subitemsCount; i++) {
  15315. incHex(end, ucs2DataSize);
  15316. if (!sequence) {
  15317. stream.readHexNumber(start, ucs2DataSize);
  15318. addHex(start, end, ucs2DataSize);
  15319. } else {
  15320. start.set(end);
  15321. }
  15322. stream.readHexNumber(end, ucs2DataSize);
  15323. addHex(end, start, ucs2DataSize);
  15324. stream.readHex(charCode, dataSize);
  15325. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  15326. }
  15327. break;
  15328. default:
  15329. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  15330. }
  15331. }
  15332. if (useCMap) {
  15333. return extend(useCMap);
  15334. }
  15335. return cMap;
  15336. }
  15337. }
  15338. return BinaryCMapReader;
  15339. }();
  15340. const CMapFactory = function CMapFactoryClosure() {
  15341. function strToInt(str) {
  15342. let a = 0;
  15343. for (let i = 0; i < str.length; i++) {
  15344. a = a << 8 | str.charCodeAt(i);
  15345. }
  15346. return a >>> 0;
  15347. }
  15348. function expectString(obj) {
  15349. if (typeof obj !== "string") {
  15350. throw new _util.FormatError("Malformed CMap: expected string.");
  15351. }
  15352. }
  15353. function expectInt(obj) {
  15354. if (!Number.isInteger(obj)) {
  15355. throw new _util.FormatError("Malformed CMap: expected int.");
  15356. }
  15357. }
  15358. function parseBfChar(cMap, lexer) {
  15359. while (true) {
  15360. let obj = lexer.getObj();
  15361. if (obj === _primitives.EOF) {
  15362. break;
  15363. }
  15364. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  15365. return;
  15366. }
  15367. expectString(obj);
  15368. const src = strToInt(obj);
  15369. obj = lexer.getObj();
  15370. expectString(obj);
  15371. const dst = obj;
  15372. cMap.mapOne(src, dst);
  15373. }
  15374. }
  15375. function parseBfRange(cMap, lexer) {
  15376. while (true) {
  15377. let obj = lexer.getObj();
  15378. if (obj === _primitives.EOF) {
  15379. break;
  15380. }
  15381. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  15382. return;
  15383. }
  15384. expectString(obj);
  15385. const low = strToInt(obj);
  15386. obj = lexer.getObj();
  15387. expectString(obj);
  15388. const high = strToInt(obj);
  15389. obj = lexer.getObj();
  15390. if (Number.isInteger(obj) || typeof obj === "string") {
  15391. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  15392. cMap.mapBfRange(low, high, dstLow);
  15393. } else if ((0, _primitives.isCmd)(obj, "[")) {
  15394. obj = lexer.getObj();
  15395. const array = [];
  15396. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  15397. array.push(obj);
  15398. obj = lexer.getObj();
  15399. }
  15400. cMap.mapBfRangeToArray(low, high, array);
  15401. } else {
  15402. break;
  15403. }
  15404. }
  15405. throw new _util.FormatError("Invalid bf range.");
  15406. }
  15407. function parseCidChar(cMap, lexer) {
  15408. while (true) {
  15409. let obj = lexer.getObj();
  15410. if (obj === _primitives.EOF) {
  15411. break;
  15412. }
  15413. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  15414. return;
  15415. }
  15416. expectString(obj);
  15417. const src = strToInt(obj);
  15418. obj = lexer.getObj();
  15419. expectInt(obj);
  15420. const dst = obj;
  15421. cMap.mapOne(src, dst);
  15422. }
  15423. }
  15424. function parseCidRange(cMap, lexer) {
  15425. while (true) {
  15426. let obj = lexer.getObj();
  15427. if (obj === _primitives.EOF) {
  15428. break;
  15429. }
  15430. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  15431. return;
  15432. }
  15433. expectString(obj);
  15434. const low = strToInt(obj);
  15435. obj = lexer.getObj();
  15436. expectString(obj);
  15437. const high = strToInt(obj);
  15438. obj = lexer.getObj();
  15439. expectInt(obj);
  15440. const dstLow = obj;
  15441. cMap.mapCidRange(low, high, dstLow);
  15442. }
  15443. }
  15444. function parseCodespaceRange(cMap, lexer) {
  15445. while (true) {
  15446. let obj = lexer.getObj();
  15447. if (obj === _primitives.EOF) {
  15448. break;
  15449. }
  15450. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  15451. return;
  15452. }
  15453. if (typeof obj !== "string") {
  15454. break;
  15455. }
  15456. const low = strToInt(obj);
  15457. obj = lexer.getObj();
  15458. if (typeof obj !== "string") {
  15459. break;
  15460. }
  15461. const high = strToInt(obj);
  15462. cMap.addCodespaceRange(obj.length, low, high);
  15463. }
  15464. throw new _util.FormatError("Invalid codespace range.");
  15465. }
  15466. function parseWMode(cMap, lexer) {
  15467. const obj = lexer.getObj();
  15468. if (Number.isInteger(obj)) {
  15469. cMap.vertical = !!obj;
  15470. }
  15471. }
  15472. function parseCMapName(cMap, lexer) {
  15473. const obj = lexer.getObj();
  15474. if (obj instanceof _primitives.Name) {
  15475. cMap.name = obj.name;
  15476. }
  15477. }
  15478. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  15479. let previous, embeddedUseCMap;
  15480. objLoop: while (true) {
  15481. try {
  15482. const obj = lexer.getObj();
  15483. if (obj === _primitives.EOF) {
  15484. break;
  15485. } else if (obj instanceof _primitives.Name) {
  15486. if (obj.name === "WMode") {
  15487. parseWMode(cMap, lexer);
  15488. } else if (obj.name === "CMapName") {
  15489. parseCMapName(cMap, lexer);
  15490. }
  15491. previous = obj;
  15492. } else if (obj instanceof _primitives.Cmd) {
  15493. switch (obj.cmd) {
  15494. case "endcmap":
  15495. break objLoop;
  15496. case "usecmap":
  15497. if (previous instanceof _primitives.Name) {
  15498. embeddedUseCMap = previous.name;
  15499. }
  15500. break;
  15501. case "begincodespacerange":
  15502. parseCodespaceRange(cMap, lexer);
  15503. break;
  15504. case "beginbfchar":
  15505. parseBfChar(cMap, lexer);
  15506. break;
  15507. case "begincidchar":
  15508. parseCidChar(cMap, lexer);
  15509. break;
  15510. case "beginbfrange":
  15511. parseBfRange(cMap, lexer);
  15512. break;
  15513. case "begincidrange":
  15514. parseCidRange(cMap, lexer);
  15515. break;
  15516. }
  15517. }
  15518. } catch (ex) {
  15519. if (ex instanceof _core_utils.MissingDataException) {
  15520. throw ex;
  15521. }
  15522. (0, _util.warn)("Invalid cMap data: " + ex);
  15523. continue;
  15524. }
  15525. }
  15526. if (!useCMap && embeddedUseCMap) {
  15527. useCMap = embeddedUseCMap;
  15528. }
  15529. if (useCMap) {
  15530. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15531. }
  15532. return cMap;
  15533. }
  15534. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  15535. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  15536. if (cMap.numCodespaceRanges === 0) {
  15537. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  15538. for (let i = 0; i < useCodespaceRanges.length; i++) {
  15539. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  15540. }
  15541. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  15542. }
  15543. cMap.useCMap.forEach(function (key, value) {
  15544. if (!cMap.contains(key)) {
  15545. cMap.mapOne(key, cMap.useCMap.lookup(key));
  15546. }
  15547. });
  15548. return cMap;
  15549. }
  15550. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  15551. if (name === "Identity-H") {
  15552. return new IdentityCMap(false, 2);
  15553. } else if (name === "Identity-V") {
  15554. return new IdentityCMap(true, 2);
  15555. }
  15556. if (!BUILT_IN_CMAPS.includes(name)) {
  15557. throw new Error("Unknown CMap name: " + name);
  15558. }
  15559. if (!fetchBuiltInCMap) {
  15560. throw new Error("Built-in CMap parameters are not provided.");
  15561. }
  15562. const {
  15563. cMapData,
  15564. compressionType
  15565. } = await fetchBuiltInCMap(name);
  15566. const cMap = new CMap(true);
  15567. if (compressionType === _util.CMapCompressionType.BINARY) {
  15568. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  15569. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  15570. });
  15571. }
  15572. if (compressionType === _util.CMapCompressionType.NONE) {
  15573. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  15574. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  15575. }
  15576. throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
  15577. }
  15578. return {
  15579. async create(params) {
  15580. const encoding = params.encoding;
  15581. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  15582. const useCMap = params.useCMap;
  15583. if (encoding instanceof _primitives.Name) {
  15584. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  15585. } else if (encoding instanceof _base_stream.BaseStream) {
  15586. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  15587. if (parsedCMap.isIdentityCMap) {
  15588. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  15589. }
  15590. return parsedCMap;
  15591. }
  15592. throw new Error("Encoding required.");
  15593. }
  15594. };
  15595. }();
  15596. exports.CMapFactory = CMapFactory;
  15597. /***/ }),
  15598. /* 146 */
  15599. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15600. "use strict";
  15601. Object.defineProperty(exports, "__esModule", ({
  15602. value: true
  15603. }));
  15604. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  15605. var _util = __w_pdfjs_require__(2);
  15606. var _primitives = __w_pdfjs_require__(134);
  15607. var _core_utils = __w_pdfjs_require__(135);
  15608. var _ascii_85_stream = __w_pdfjs_require__(147);
  15609. var _ascii_hex_stream = __w_pdfjs_require__(149);
  15610. var _ccitt_stream = __w_pdfjs_require__(150);
  15611. var _flate_stream = __w_pdfjs_require__(152);
  15612. var _jbig2_stream = __w_pdfjs_require__(153);
  15613. var _jpeg_stream = __w_pdfjs_require__(156);
  15614. var _jpx_stream = __w_pdfjs_require__(158);
  15615. var _lzw_stream = __w_pdfjs_require__(160);
  15616. var _stream = __w_pdfjs_require__(139);
  15617. var _predictor_stream = __w_pdfjs_require__(161);
  15618. var _run_length_stream = __w_pdfjs_require__(162);
  15619. const MAX_LENGTH_TO_CACHE = 1000;
  15620. const MAX_ADLER32_LENGTH = 5552;
  15621. function computeAdler32(bytes) {
  15622. const bytesLength = bytes.length;
  15623. let a = 1,
  15624. b = 0;
  15625. for (let i = 0; i < bytesLength; ++i) {
  15626. a += bytes[i] & 0xff;
  15627. b += a;
  15628. }
  15629. return b % 65521 << 16 | a % 65521;
  15630. }
  15631. class Parser {
  15632. constructor(_ref) {
  15633. let {
  15634. lexer,
  15635. xref,
  15636. allowStreams = false,
  15637. recoveryMode = false
  15638. } = _ref;
  15639. this.lexer = lexer;
  15640. this.xref = xref;
  15641. this.allowStreams = allowStreams;
  15642. this.recoveryMode = recoveryMode;
  15643. this.imageCache = Object.create(null);
  15644. this.refill();
  15645. }
  15646. refill() {
  15647. this.buf1 = this.lexer.getObj();
  15648. this.buf2 = this.lexer.getObj();
  15649. }
  15650. shift() {
  15651. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  15652. this.buf1 = this.buf2;
  15653. this.buf2 = null;
  15654. } else {
  15655. this.buf1 = this.buf2;
  15656. this.buf2 = this.lexer.getObj();
  15657. }
  15658. }
  15659. tryShift() {
  15660. try {
  15661. this.shift();
  15662. return true;
  15663. } catch (e) {
  15664. if (e instanceof _core_utils.MissingDataException) {
  15665. throw e;
  15666. }
  15667. return false;
  15668. }
  15669. }
  15670. getObj() {
  15671. let cipherTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  15672. const buf1 = this.buf1;
  15673. this.shift();
  15674. if (buf1 instanceof _primitives.Cmd) {
  15675. switch (buf1.cmd) {
  15676. case "BI":
  15677. return this.makeInlineImage(cipherTransform);
  15678. case "[":
  15679. const array = [];
  15680. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  15681. array.push(this.getObj(cipherTransform));
  15682. }
  15683. if (this.buf1 === _primitives.EOF) {
  15684. if (this.recoveryMode) {
  15685. return array;
  15686. }
  15687. throw new _core_utils.ParserEOFException("End of file inside array.");
  15688. }
  15689. this.shift();
  15690. return array;
  15691. case "<<":
  15692. const dict = new _primitives.Dict(this.xref);
  15693. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  15694. if (!(this.buf1 instanceof _primitives.Name)) {
  15695. (0, _util.info)("Malformed dictionary: key must be a name object");
  15696. this.shift();
  15697. continue;
  15698. }
  15699. const key = this.buf1.name;
  15700. this.shift();
  15701. if (this.buf1 === _primitives.EOF) {
  15702. break;
  15703. }
  15704. dict.set(key, this.getObj(cipherTransform));
  15705. }
  15706. if (this.buf1 === _primitives.EOF) {
  15707. if (this.recoveryMode) {
  15708. return dict;
  15709. }
  15710. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  15711. }
  15712. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  15713. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  15714. }
  15715. this.shift();
  15716. return dict;
  15717. default:
  15718. return buf1;
  15719. }
  15720. }
  15721. if (Number.isInteger(buf1)) {
  15722. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  15723. const ref = _primitives.Ref.get(buf1, this.buf1);
  15724. this.shift();
  15725. this.shift();
  15726. return ref;
  15727. }
  15728. return buf1;
  15729. }
  15730. if (typeof buf1 === "string") {
  15731. if (cipherTransform) {
  15732. return cipherTransform.decryptString(buf1);
  15733. }
  15734. return buf1;
  15735. }
  15736. return buf1;
  15737. }
  15738. findDefaultInlineStreamEnd(stream) {
  15739. const E = 0x45,
  15740. I = 0x49,
  15741. SPACE = 0x20,
  15742. LF = 0xa,
  15743. CR = 0xd,
  15744. NUL = 0x0;
  15745. const lexer = this.lexer,
  15746. startPos = stream.pos,
  15747. n = 10;
  15748. let state = 0,
  15749. ch,
  15750. maybeEIPos;
  15751. while ((ch = stream.getByte()) !== -1) {
  15752. if (state === 0) {
  15753. state = ch === E ? 1 : 0;
  15754. } else if (state === 1) {
  15755. state = ch === I ? 2 : 0;
  15756. } else {
  15757. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  15758. if (ch === SPACE || ch === LF || ch === CR) {
  15759. maybeEIPos = stream.pos;
  15760. const followingBytes = stream.peekBytes(n);
  15761. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  15762. ch = followingBytes[i];
  15763. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  15764. continue;
  15765. }
  15766. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  15767. state = 0;
  15768. break;
  15769. }
  15770. }
  15771. if (state !== 2) {
  15772. continue;
  15773. }
  15774. if (lexer.knownCommands) {
  15775. const nextObj = lexer.peekObj();
  15776. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  15777. state = 0;
  15778. }
  15779. } else {
  15780. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  15781. }
  15782. if (state === 2) {
  15783. break;
  15784. }
  15785. } else {
  15786. state = 0;
  15787. }
  15788. }
  15789. }
  15790. if (ch === -1) {
  15791. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  15792. if (maybeEIPos) {
  15793. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  15794. stream.skip(-(stream.pos - maybeEIPos));
  15795. }
  15796. }
  15797. let endOffset = 4;
  15798. stream.skip(-endOffset);
  15799. ch = stream.peekByte();
  15800. stream.skip(endOffset);
  15801. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  15802. endOffset--;
  15803. }
  15804. return stream.pos - endOffset - startPos;
  15805. }
  15806. findDCTDecodeInlineStreamEnd(stream) {
  15807. const startPos = stream.pos;
  15808. let foundEOI = false,
  15809. b,
  15810. markerLength;
  15811. while ((b = stream.getByte()) !== -1) {
  15812. if (b !== 0xff) {
  15813. continue;
  15814. }
  15815. switch (stream.getByte()) {
  15816. case 0x00:
  15817. break;
  15818. case 0xff:
  15819. stream.skip(-1);
  15820. break;
  15821. case 0xd9:
  15822. foundEOI = true;
  15823. break;
  15824. case 0xc0:
  15825. case 0xc1:
  15826. case 0xc2:
  15827. case 0xc3:
  15828. case 0xc5:
  15829. case 0xc6:
  15830. case 0xc7:
  15831. case 0xc9:
  15832. case 0xca:
  15833. case 0xcb:
  15834. case 0xcd:
  15835. case 0xce:
  15836. case 0xcf:
  15837. case 0xc4:
  15838. case 0xcc:
  15839. case 0xda:
  15840. case 0xdb:
  15841. case 0xdc:
  15842. case 0xdd:
  15843. case 0xde:
  15844. case 0xdf:
  15845. case 0xe0:
  15846. case 0xe1:
  15847. case 0xe2:
  15848. case 0xe3:
  15849. case 0xe4:
  15850. case 0xe5:
  15851. case 0xe6:
  15852. case 0xe7:
  15853. case 0xe8:
  15854. case 0xe9:
  15855. case 0xea:
  15856. case 0xeb:
  15857. case 0xec:
  15858. case 0xed:
  15859. case 0xee:
  15860. case 0xef:
  15861. case 0xfe:
  15862. markerLength = stream.getUint16();
  15863. if (markerLength > 2) {
  15864. stream.skip(markerLength - 2);
  15865. } else {
  15866. stream.skip(-2);
  15867. }
  15868. break;
  15869. }
  15870. if (foundEOI) {
  15871. break;
  15872. }
  15873. }
  15874. const length = stream.pos - startPos;
  15875. if (b === -1) {
  15876. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  15877. stream.skip(-length);
  15878. return this.findDefaultInlineStreamEnd(stream);
  15879. }
  15880. this.inlineStreamSkipEI(stream);
  15881. return length;
  15882. }
  15883. findASCII85DecodeInlineStreamEnd(stream) {
  15884. const TILDE = 0x7e,
  15885. GT = 0x3e;
  15886. const startPos = stream.pos;
  15887. let ch;
  15888. while ((ch = stream.getByte()) !== -1) {
  15889. if (ch === TILDE) {
  15890. const tildePos = stream.pos;
  15891. ch = stream.peekByte();
  15892. while ((0, _core_utils.isWhiteSpace)(ch)) {
  15893. stream.skip();
  15894. ch = stream.peekByte();
  15895. }
  15896. if (ch === GT) {
  15897. stream.skip();
  15898. break;
  15899. }
  15900. if (stream.pos > tildePos) {
  15901. const maybeEI = stream.peekBytes(2);
  15902. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  15903. break;
  15904. }
  15905. }
  15906. }
  15907. }
  15908. const length = stream.pos - startPos;
  15909. if (ch === -1) {
  15910. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  15911. stream.skip(-length);
  15912. return this.findDefaultInlineStreamEnd(stream);
  15913. }
  15914. this.inlineStreamSkipEI(stream);
  15915. return length;
  15916. }
  15917. findASCIIHexDecodeInlineStreamEnd(stream) {
  15918. const GT = 0x3e;
  15919. const startPos = stream.pos;
  15920. let ch;
  15921. while ((ch = stream.getByte()) !== -1) {
  15922. if (ch === GT) {
  15923. break;
  15924. }
  15925. }
  15926. const length = stream.pos - startPos;
  15927. if (ch === -1) {
  15928. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  15929. stream.skip(-length);
  15930. return this.findDefaultInlineStreamEnd(stream);
  15931. }
  15932. this.inlineStreamSkipEI(stream);
  15933. return length;
  15934. }
  15935. inlineStreamSkipEI(stream) {
  15936. const E = 0x45,
  15937. I = 0x49;
  15938. let state = 0,
  15939. ch;
  15940. while ((ch = stream.getByte()) !== -1) {
  15941. if (state === 0) {
  15942. state = ch === E ? 1 : 0;
  15943. } else if (state === 1) {
  15944. state = ch === I ? 2 : 0;
  15945. } else if (state === 2) {
  15946. break;
  15947. }
  15948. }
  15949. }
  15950. makeInlineImage(cipherTransform) {
  15951. const lexer = this.lexer;
  15952. const stream = lexer.stream;
  15953. const dict = new _primitives.Dict(this.xref);
  15954. let dictLength;
  15955. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  15956. if (!(this.buf1 instanceof _primitives.Name)) {
  15957. throw new _util.FormatError("Dictionary key must be a name object");
  15958. }
  15959. const key = this.buf1.name;
  15960. this.shift();
  15961. if (this.buf1 === _primitives.EOF) {
  15962. break;
  15963. }
  15964. dict.set(key, this.getObj(cipherTransform));
  15965. }
  15966. if (lexer.beginInlineImagePos !== -1) {
  15967. dictLength = stream.pos - lexer.beginInlineImagePos;
  15968. }
  15969. const filter = dict.get("F", "Filter");
  15970. let filterName;
  15971. if (filter instanceof _primitives.Name) {
  15972. filterName = filter.name;
  15973. } else if (Array.isArray(filter)) {
  15974. const filterZero = this.xref.fetchIfRef(filter[0]);
  15975. if (filterZero instanceof _primitives.Name) {
  15976. filterName = filterZero.name;
  15977. }
  15978. }
  15979. const startPos = stream.pos;
  15980. let length;
  15981. switch (filterName) {
  15982. case "DCT":
  15983. case "DCTDecode":
  15984. length = this.findDCTDecodeInlineStreamEnd(stream);
  15985. break;
  15986. case "A85":
  15987. case "ASCII85Decode":
  15988. length = this.findASCII85DecodeInlineStreamEnd(stream);
  15989. break;
  15990. case "AHx":
  15991. case "ASCIIHexDecode":
  15992. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  15993. break;
  15994. default:
  15995. length = this.findDefaultInlineStreamEnd(stream);
  15996. }
  15997. let imageStream = stream.makeSubStream(startPos, length, dict);
  15998. let cacheKey;
  15999. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  16000. const imageBytes = imageStream.getBytes();
  16001. imageStream.reset();
  16002. const initialStreamPos = stream.pos;
  16003. stream.pos = lexer.beginInlineImagePos;
  16004. const dictBytes = stream.getBytes(dictLength);
  16005. stream.pos = initialStreamPos;
  16006. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  16007. const cacheEntry = this.imageCache[cacheKey];
  16008. if (cacheEntry !== undefined) {
  16009. this.buf2 = _primitives.Cmd.get("EI");
  16010. this.shift();
  16011. cacheEntry.reset();
  16012. return cacheEntry;
  16013. }
  16014. }
  16015. if (cipherTransform) {
  16016. imageStream = cipherTransform.createStream(imageStream, length);
  16017. }
  16018. imageStream = this.filter(imageStream, dict, length);
  16019. imageStream.dict = dict;
  16020. if (cacheKey !== undefined) {
  16021. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  16022. this.imageCache[cacheKey] = imageStream;
  16023. }
  16024. this.buf2 = _primitives.Cmd.get("EI");
  16025. this.shift();
  16026. return imageStream;
  16027. }
  16028. _findStreamLength(startPos, signature) {
  16029. const {
  16030. stream
  16031. } = this.lexer;
  16032. stream.pos = startPos;
  16033. const SCAN_BLOCK_LENGTH = 2048;
  16034. const signatureLength = signature.length;
  16035. while (stream.pos < stream.end) {
  16036. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  16037. const scanLength = scanBytes.length - signatureLength;
  16038. if (scanLength <= 0) {
  16039. break;
  16040. }
  16041. let pos = 0;
  16042. while (pos < scanLength) {
  16043. let j = 0;
  16044. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  16045. j++;
  16046. }
  16047. if (j >= signatureLength) {
  16048. stream.pos += pos;
  16049. return stream.pos - startPos;
  16050. }
  16051. pos++;
  16052. }
  16053. stream.pos += scanLength;
  16054. }
  16055. return -1;
  16056. }
  16057. makeStream(dict, cipherTransform) {
  16058. const lexer = this.lexer;
  16059. let stream = lexer.stream;
  16060. lexer.skipToNextLine();
  16061. const startPos = stream.pos - 1;
  16062. let length = dict.get("Length");
  16063. if (!Number.isInteger(length)) {
  16064. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  16065. length = 0;
  16066. }
  16067. stream.pos = startPos + length;
  16068. lexer.nextChar();
  16069. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  16070. this.shift();
  16071. } else {
  16072. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  16073. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  16074. if (actualLength < 0) {
  16075. const MAX_TRUNCATION = 1;
  16076. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  16077. const end = ENDSTREAM_SIGNATURE.length - i;
  16078. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  16079. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  16080. if (maybeLength >= 0) {
  16081. const lastByte = stream.peekBytes(end + 1)[end];
  16082. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  16083. break;
  16084. }
  16085. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  16086. actualLength = maybeLength;
  16087. break;
  16088. }
  16089. }
  16090. if (actualLength < 0) {
  16091. throw new _util.FormatError("Missing endstream command.");
  16092. }
  16093. }
  16094. length = actualLength;
  16095. lexer.nextChar();
  16096. this.shift();
  16097. this.shift();
  16098. }
  16099. this.shift();
  16100. stream = stream.makeSubStream(startPos, length, dict);
  16101. if (cipherTransform) {
  16102. stream = cipherTransform.createStream(stream, length);
  16103. }
  16104. stream = this.filter(stream, dict, length);
  16105. stream.dict = dict;
  16106. return stream;
  16107. }
  16108. filter(stream, dict, length) {
  16109. let filter = dict.get("F", "Filter");
  16110. let params = dict.get("DP", "DecodeParms");
  16111. if (filter instanceof _primitives.Name) {
  16112. if (Array.isArray(params)) {
  16113. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  16114. }
  16115. return this.makeFilter(stream, filter.name, length, params);
  16116. }
  16117. let maybeLength = length;
  16118. if (Array.isArray(filter)) {
  16119. const filterArray = filter;
  16120. const paramsArray = params;
  16121. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  16122. filter = this.xref.fetchIfRef(filterArray[i]);
  16123. if (!(filter instanceof _primitives.Name)) {
  16124. throw new _util.FormatError(`Bad filter name "${filter}"`);
  16125. }
  16126. params = null;
  16127. if (Array.isArray(paramsArray) && i in paramsArray) {
  16128. params = this.xref.fetchIfRef(paramsArray[i]);
  16129. }
  16130. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  16131. maybeLength = null;
  16132. }
  16133. }
  16134. return stream;
  16135. }
  16136. makeFilter(stream, name, maybeLength, params) {
  16137. if (maybeLength === 0) {
  16138. (0, _util.warn)(`Empty "${name}" stream.`);
  16139. return new _stream.NullStream();
  16140. }
  16141. const xrefStats = this.xref.stats;
  16142. try {
  16143. switch (name) {
  16144. case "Fl":
  16145. case "FlateDecode":
  16146. xrefStats.addStreamType(_util.StreamType.FLATE);
  16147. if (params) {
  16148. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  16149. }
  16150. return new _flate_stream.FlateStream(stream, maybeLength);
  16151. case "LZW":
  16152. case "LZWDecode":
  16153. xrefStats.addStreamType(_util.StreamType.LZW);
  16154. let earlyChange = 1;
  16155. if (params) {
  16156. if (params.has("EarlyChange")) {
  16157. earlyChange = params.get("EarlyChange");
  16158. }
  16159. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  16160. }
  16161. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  16162. case "DCT":
  16163. case "DCTDecode":
  16164. xrefStats.addStreamType(_util.StreamType.DCT);
  16165. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  16166. case "JPX":
  16167. case "JPXDecode":
  16168. xrefStats.addStreamType(_util.StreamType.JPX);
  16169. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  16170. case "A85":
  16171. case "ASCII85Decode":
  16172. xrefStats.addStreamType(_util.StreamType.A85);
  16173. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  16174. case "AHx":
  16175. case "ASCIIHexDecode":
  16176. xrefStats.addStreamType(_util.StreamType.AHX);
  16177. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  16178. case "CCF":
  16179. case "CCITTFaxDecode":
  16180. xrefStats.addStreamType(_util.StreamType.CCF);
  16181. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  16182. case "RL":
  16183. case "RunLengthDecode":
  16184. xrefStats.addStreamType(_util.StreamType.RLX);
  16185. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  16186. case "JBIG2Decode":
  16187. xrefStats.addStreamType(_util.StreamType.JBIG);
  16188. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  16189. }
  16190. (0, _util.warn)(`Filter "${name}" is not supported.`);
  16191. return stream;
  16192. } catch (ex) {
  16193. if (ex instanceof _core_utils.MissingDataException) {
  16194. throw ex;
  16195. }
  16196. (0, _util.warn)(`Invalid stream: "${ex}"`);
  16197. return new _stream.NullStream();
  16198. }
  16199. }
  16200. }
  16201. exports.Parser = Parser;
  16202. 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];
  16203. function toHexDigit(ch) {
  16204. if (ch >= 0x30 && ch <= 0x39) {
  16205. return ch & 0x0f;
  16206. }
  16207. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  16208. return (ch & 0x0f) + 9;
  16209. }
  16210. return -1;
  16211. }
  16212. class Lexer {
  16213. constructor(stream) {
  16214. let knownCommands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  16215. this.stream = stream;
  16216. this.nextChar();
  16217. this.strBuf = [];
  16218. this.knownCommands = knownCommands;
  16219. this._hexStringNumWarn = 0;
  16220. this.beginInlineImagePos = -1;
  16221. }
  16222. nextChar() {
  16223. return this.currentChar = this.stream.getByte();
  16224. }
  16225. peekChar() {
  16226. return this.stream.peekByte();
  16227. }
  16228. getNumber() {
  16229. let ch = this.currentChar;
  16230. let eNotation = false;
  16231. let divideBy = 0;
  16232. let sign = 0;
  16233. if (ch === 0x2d) {
  16234. sign = -1;
  16235. ch = this.nextChar();
  16236. if (ch === 0x2d) {
  16237. ch = this.nextChar();
  16238. }
  16239. } else if (ch === 0x2b) {
  16240. sign = 1;
  16241. ch = this.nextChar();
  16242. }
  16243. if (ch === 0x0a || ch === 0x0d) {
  16244. do {
  16245. ch = this.nextChar();
  16246. } while (ch === 0x0a || ch === 0x0d);
  16247. }
  16248. if (ch === 0x2e) {
  16249. divideBy = 10;
  16250. ch = this.nextChar();
  16251. }
  16252. if (ch < 0x30 || ch > 0x39) {
  16253. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  16254. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  16255. (0, _util.info)(`Lexer.getNumber - "${msg}".`);
  16256. return 0;
  16257. }
  16258. throw new _util.FormatError(msg);
  16259. }
  16260. sign = sign || 1;
  16261. let baseValue = ch - 0x30;
  16262. let powerValue = 0;
  16263. let powerValueSign = 1;
  16264. while ((ch = this.nextChar()) >= 0) {
  16265. if (ch >= 0x30 && ch <= 0x39) {
  16266. const currentDigit = ch - 0x30;
  16267. if (eNotation) {
  16268. powerValue = powerValue * 10 + currentDigit;
  16269. } else {
  16270. if (divideBy !== 0) {
  16271. divideBy *= 10;
  16272. }
  16273. baseValue = baseValue * 10 + currentDigit;
  16274. }
  16275. } else if (ch === 0x2e) {
  16276. if (divideBy === 0) {
  16277. divideBy = 1;
  16278. } else {
  16279. break;
  16280. }
  16281. } else if (ch === 0x2d) {
  16282. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  16283. } else if (ch === 0x45 || ch === 0x65) {
  16284. ch = this.peekChar();
  16285. if (ch === 0x2b || ch === 0x2d) {
  16286. powerValueSign = ch === 0x2d ? -1 : 1;
  16287. this.nextChar();
  16288. } else if (ch < 0x30 || ch > 0x39) {
  16289. break;
  16290. }
  16291. eNotation = true;
  16292. } else {
  16293. break;
  16294. }
  16295. }
  16296. if (divideBy !== 0) {
  16297. baseValue /= divideBy;
  16298. }
  16299. if (eNotation) {
  16300. baseValue *= 10 ** (powerValueSign * powerValue);
  16301. }
  16302. return sign * baseValue;
  16303. }
  16304. getString() {
  16305. let numParen = 1;
  16306. let done = false;
  16307. const strBuf = this.strBuf;
  16308. strBuf.length = 0;
  16309. let ch = this.nextChar();
  16310. while (true) {
  16311. let charBuffered = false;
  16312. switch (ch | 0) {
  16313. case -1:
  16314. (0, _util.warn)("Unterminated string");
  16315. done = true;
  16316. break;
  16317. case 0x28:
  16318. ++numParen;
  16319. strBuf.push("(");
  16320. break;
  16321. case 0x29:
  16322. if (--numParen === 0) {
  16323. this.nextChar();
  16324. done = true;
  16325. } else {
  16326. strBuf.push(")");
  16327. }
  16328. break;
  16329. case 0x5c:
  16330. ch = this.nextChar();
  16331. switch (ch) {
  16332. case -1:
  16333. (0, _util.warn)("Unterminated string");
  16334. done = true;
  16335. break;
  16336. case 0x6e:
  16337. strBuf.push("\n");
  16338. break;
  16339. case 0x72:
  16340. strBuf.push("\r");
  16341. break;
  16342. case 0x74:
  16343. strBuf.push("\t");
  16344. break;
  16345. case 0x62:
  16346. strBuf.push("\b");
  16347. break;
  16348. case 0x66:
  16349. strBuf.push("\f");
  16350. break;
  16351. case 0x5c:
  16352. case 0x28:
  16353. case 0x29:
  16354. strBuf.push(String.fromCharCode(ch));
  16355. break;
  16356. case 0x30:
  16357. case 0x31:
  16358. case 0x32:
  16359. case 0x33:
  16360. case 0x34:
  16361. case 0x35:
  16362. case 0x36:
  16363. case 0x37:
  16364. let x = ch & 0x0f;
  16365. ch = this.nextChar();
  16366. charBuffered = true;
  16367. if (ch >= 0x30 && ch <= 0x37) {
  16368. x = (x << 3) + (ch & 0x0f);
  16369. ch = this.nextChar();
  16370. if (ch >= 0x30 && ch <= 0x37) {
  16371. charBuffered = false;
  16372. x = (x << 3) + (ch & 0x0f);
  16373. }
  16374. }
  16375. strBuf.push(String.fromCharCode(x));
  16376. break;
  16377. case 0x0d:
  16378. if (this.peekChar() === 0x0a) {
  16379. this.nextChar();
  16380. }
  16381. break;
  16382. case 0x0a:
  16383. break;
  16384. default:
  16385. strBuf.push(String.fromCharCode(ch));
  16386. break;
  16387. }
  16388. break;
  16389. default:
  16390. strBuf.push(String.fromCharCode(ch));
  16391. break;
  16392. }
  16393. if (done) {
  16394. break;
  16395. }
  16396. if (!charBuffered) {
  16397. ch = this.nextChar();
  16398. }
  16399. }
  16400. return strBuf.join("");
  16401. }
  16402. getName() {
  16403. let ch, previousCh;
  16404. const strBuf = this.strBuf;
  16405. strBuf.length = 0;
  16406. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16407. if (ch === 0x23) {
  16408. ch = this.nextChar();
  16409. if (specialChars[ch]) {
  16410. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  16411. strBuf.push("#");
  16412. break;
  16413. }
  16414. const x = toHexDigit(ch);
  16415. if (x !== -1) {
  16416. previousCh = ch;
  16417. ch = this.nextChar();
  16418. const x2 = toHexDigit(ch);
  16419. if (x2 === -1) {
  16420. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  16421. strBuf.push("#", String.fromCharCode(previousCh));
  16422. if (specialChars[ch]) {
  16423. break;
  16424. }
  16425. strBuf.push(String.fromCharCode(ch));
  16426. continue;
  16427. }
  16428. strBuf.push(String.fromCharCode(x << 4 | x2));
  16429. } else {
  16430. strBuf.push("#", String.fromCharCode(ch));
  16431. }
  16432. } else {
  16433. strBuf.push(String.fromCharCode(ch));
  16434. }
  16435. }
  16436. if (strBuf.length > 127) {
  16437. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  16438. }
  16439. return _primitives.Name.get(strBuf.join(""));
  16440. }
  16441. _hexStringWarn(ch) {
  16442. const MAX_HEX_STRING_NUM_WARN = 5;
  16443. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  16444. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  16445. return;
  16446. }
  16447. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  16448. return;
  16449. }
  16450. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  16451. }
  16452. getHexString() {
  16453. const strBuf = this.strBuf;
  16454. strBuf.length = 0;
  16455. let ch = this.currentChar;
  16456. let isFirstHex = true;
  16457. let firstDigit, secondDigit;
  16458. this._hexStringNumWarn = 0;
  16459. while (true) {
  16460. if (ch < 0) {
  16461. (0, _util.warn)("Unterminated hex string");
  16462. break;
  16463. } else if (ch === 0x3e) {
  16464. this.nextChar();
  16465. break;
  16466. } else if (specialChars[ch] === 1) {
  16467. ch = this.nextChar();
  16468. continue;
  16469. } else {
  16470. if (isFirstHex) {
  16471. firstDigit = toHexDigit(ch);
  16472. if (firstDigit === -1) {
  16473. this._hexStringWarn(ch);
  16474. ch = this.nextChar();
  16475. continue;
  16476. }
  16477. } else {
  16478. secondDigit = toHexDigit(ch);
  16479. if (secondDigit === -1) {
  16480. this._hexStringWarn(ch);
  16481. ch = this.nextChar();
  16482. continue;
  16483. }
  16484. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  16485. }
  16486. isFirstHex = !isFirstHex;
  16487. ch = this.nextChar();
  16488. }
  16489. }
  16490. return strBuf.join("");
  16491. }
  16492. getObj() {
  16493. let comment = false;
  16494. let ch = this.currentChar;
  16495. while (true) {
  16496. if (ch < 0) {
  16497. return _primitives.EOF;
  16498. }
  16499. if (comment) {
  16500. if (ch === 0x0a || ch === 0x0d) {
  16501. comment = false;
  16502. }
  16503. } else if (ch === 0x25) {
  16504. comment = true;
  16505. } else if (specialChars[ch] !== 1) {
  16506. break;
  16507. }
  16508. ch = this.nextChar();
  16509. }
  16510. switch (ch | 0) {
  16511. case 0x30:
  16512. case 0x31:
  16513. case 0x32:
  16514. case 0x33:
  16515. case 0x34:
  16516. case 0x35:
  16517. case 0x36:
  16518. case 0x37:
  16519. case 0x38:
  16520. case 0x39:
  16521. case 0x2b:
  16522. case 0x2d:
  16523. case 0x2e:
  16524. return this.getNumber();
  16525. case 0x28:
  16526. return this.getString();
  16527. case 0x2f:
  16528. return this.getName();
  16529. case 0x5b:
  16530. this.nextChar();
  16531. return _primitives.Cmd.get("[");
  16532. case 0x5d:
  16533. this.nextChar();
  16534. return _primitives.Cmd.get("]");
  16535. case 0x3c:
  16536. ch = this.nextChar();
  16537. if (ch === 0x3c) {
  16538. this.nextChar();
  16539. return _primitives.Cmd.get("<<");
  16540. }
  16541. return this.getHexString();
  16542. case 0x3e:
  16543. ch = this.nextChar();
  16544. if (ch === 0x3e) {
  16545. this.nextChar();
  16546. return _primitives.Cmd.get(">>");
  16547. }
  16548. return _primitives.Cmd.get(">");
  16549. case 0x7b:
  16550. this.nextChar();
  16551. return _primitives.Cmd.get("{");
  16552. case 0x7d:
  16553. this.nextChar();
  16554. return _primitives.Cmd.get("}");
  16555. case 0x29:
  16556. this.nextChar();
  16557. throw new _util.FormatError(`Illegal character: ${ch}`);
  16558. }
  16559. let str = String.fromCharCode(ch);
  16560. if (ch < 0x20 || ch > 0x7f) {
  16561. const nextCh = this.peekChar();
  16562. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  16563. this.nextChar();
  16564. return _primitives.Cmd.get(str);
  16565. }
  16566. }
  16567. const knownCommands = this.knownCommands;
  16568. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16569. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  16570. const possibleCommand = str + String.fromCharCode(ch);
  16571. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  16572. break;
  16573. }
  16574. if (str.length === 128) {
  16575. throw new _util.FormatError(`Command token too long: ${str.length}`);
  16576. }
  16577. str = possibleCommand;
  16578. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  16579. }
  16580. if (str === "true") {
  16581. return true;
  16582. }
  16583. if (str === "false") {
  16584. return false;
  16585. }
  16586. if (str === "null") {
  16587. return null;
  16588. }
  16589. if (str === "BI") {
  16590. this.beginInlineImagePos = this.stream.pos;
  16591. }
  16592. return _primitives.Cmd.get(str);
  16593. }
  16594. peekObj() {
  16595. const streamPos = this.stream.pos,
  16596. currentChar = this.currentChar,
  16597. beginInlineImagePos = this.beginInlineImagePos;
  16598. let nextObj;
  16599. try {
  16600. nextObj = this.getObj();
  16601. } catch (ex) {
  16602. if (ex instanceof _core_utils.MissingDataException) {
  16603. throw ex;
  16604. }
  16605. (0, _util.warn)(`peekObj: ${ex}`);
  16606. }
  16607. this.stream.pos = streamPos;
  16608. this.currentChar = currentChar;
  16609. this.beginInlineImagePos = beginInlineImagePos;
  16610. return nextObj;
  16611. }
  16612. skipToNextLine() {
  16613. let ch = this.currentChar;
  16614. while (ch >= 0) {
  16615. if (ch === 0x0d) {
  16616. ch = this.nextChar();
  16617. if (ch === 0x0a) {
  16618. this.nextChar();
  16619. }
  16620. break;
  16621. } else if (ch === 0x0a) {
  16622. this.nextChar();
  16623. break;
  16624. }
  16625. ch = this.nextChar();
  16626. }
  16627. }
  16628. }
  16629. exports.Lexer = Lexer;
  16630. class Linearization {
  16631. static create(stream) {
  16632. function getInt(linDict, name) {
  16633. let allowZeroValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  16634. const obj = linDict.get(name);
  16635. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  16636. return obj;
  16637. }
  16638. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  16639. }
  16640. function getHints(linDict) {
  16641. const hints = linDict.get("H");
  16642. let hintsLength;
  16643. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  16644. for (let index = 0; index < hintsLength; index++) {
  16645. const hint = hints[index];
  16646. if (!(Number.isInteger(hint) && hint > 0)) {
  16647. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  16648. }
  16649. }
  16650. return hints;
  16651. }
  16652. throw new Error("Hint array in the linearization dictionary is invalid.");
  16653. }
  16654. const parser = new Parser({
  16655. lexer: new Lexer(stream),
  16656. xref: null
  16657. });
  16658. const obj1 = parser.getObj();
  16659. const obj2 = parser.getObj();
  16660. const obj3 = parser.getObj();
  16661. const linDict = parser.getObj();
  16662. let obj, length;
  16663. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  16664. return null;
  16665. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  16666. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  16667. }
  16668. return {
  16669. length,
  16670. hints: getHints(linDict),
  16671. objectNumberFirst: getInt(linDict, "O"),
  16672. endFirst: getInt(linDict, "E"),
  16673. numPages: getInt(linDict, "N"),
  16674. mainXRefEntriesOffset: getInt(linDict, "T"),
  16675. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  16676. };
  16677. }
  16678. }
  16679. exports.Linearization = Linearization;
  16680. /***/ }),
  16681. /* 147 */
  16682. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16683. "use strict";
  16684. Object.defineProperty(exports, "__esModule", ({
  16685. value: true
  16686. }));
  16687. exports.Ascii85Stream = void 0;
  16688. var _decode_stream = __w_pdfjs_require__(148);
  16689. var _core_utils = __w_pdfjs_require__(135);
  16690. class Ascii85Stream extends _decode_stream.DecodeStream {
  16691. constructor(str, maybeLength) {
  16692. if (maybeLength) {
  16693. maybeLength *= 0.8;
  16694. }
  16695. super(maybeLength);
  16696. this.str = str;
  16697. this.dict = str.dict;
  16698. this.input = new Uint8Array(5);
  16699. }
  16700. readBlock() {
  16701. const TILDA_CHAR = 0x7e;
  16702. const Z_LOWER_CHAR = 0x7a;
  16703. const EOF = -1;
  16704. const str = this.str;
  16705. let c = str.getByte();
  16706. while ((0, _core_utils.isWhiteSpace)(c)) {
  16707. c = str.getByte();
  16708. }
  16709. if (c === EOF || c === TILDA_CHAR) {
  16710. this.eof = true;
  16711. return;
  16712. }
  16713. const bufferLength = this.bufferLength;
  16714. let buffer, i;
  16715. if (c === Z_LOWER_CHAR) {
  16716. buffer = this.ensureBuffer(bufferLength + 4);
  16717. for (i = 0; i < 4; ++i) {
  16718. buffer[bufferLength + i] = 0;
  16719. }
  16720. this.bufferLength += 4;
  16721. } else {
  16722. const input = this.input;
  16723. input[0] = c;
  16724. for (i = 1; i < 5; ++i) {
  16725. c = str.getByte();
  16726. while ((0, _core_utils.isWhiteSpace)(c)) {
  16727. c = str.getByte();
  16728. }
  16729. input[i] = c;
  16730. if (c === EOF || c === TILDA_CHAR) {
  16731. break;
  16732. }
  16733. }
  16734. buffer = this.ensureBuffer(bufferLength + i - 1);
  16735. this.bufferLength += i - 1;
  16736. if (i < 5) {
  16737. for (; i < 5; ++i) {
  16738. input[i] = 0x21 + 84;
  16739. }
  16740. this.eof = true;
  16741. }
  16742. let t = 0;
  16743. for (i = 0; i < 5; ++i) {
  16744. t = t * 85 + (input[i] - 0x21);
  16745. }
  16746. for (i = 3; i >= 0; --i) {
  16747. buffer[bufferLength + i] = t & 0xff;
  16748. t >>= 8;
  16749. }
  16750. }
  16751. }
  16752. }
  16753. exports.Ascii85Stream = Ascii85Stream;
  16754. /***/ }),
  16755. /* 148 */
  16756. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16757. "use strict";
  16758. Object.defineProperty(exports, "__esModule", ({
  16759. value: true
  16760. }));
  16761. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  16762. var _base_stream = __w_pdfjs_require__(136);
  16763. var _stream = __w_pdfjs_require__(139);
  16764. const emptyBuffer = new Uint8Array(0);
  16765. class DecodeStream extends _base_stream.BaseStream {
  16766. constructor(maybeMinBufferLength) {
  16767. super();
  16768. this._rawMinBufferLength = maybeMinBufferLength || 0;
  16769. this.pos = 0;
  16770. this.bufferLength = 0;
  16771. this.eof = false;
  16772. this.buffer = emptyBuffer;
  16773. this.minBufferLength = 512;
  16774. if (maybeMinBufferLength) {
  16775. while (this.minBufferLength < maybeMinBufferLength) {
  16776. this.minBufferLength *= 2;
  16777. }
  16778. }
  16779. }
  16780. get isEmpty() {
  16781. while (!this.eof && this.bufferLength === 0) {
  16782. this.readBlock();
  16783. }
  16784. return this.bufferLength === 0;
  16785. }
  16786. ensureBuffer(requested) {
  16787. const buffer = this.buffer;
  16788. if (requested <= buffer.byteLength) {
  16789. return buffer;
  16790. }
  16791. let size = this.minBufferLength;
  16792. while (size < requested) {
  16793. size *= 2;
  16794. }
  16795. const buffer2 = new Uint8Array(size);
  16796. buffer2.set(buffer);
  16797. return this.buffer = buffer2;
  16798. }
  16799. getByte() {
  16800. const pos = this.pos;
  16801. while (this.bufferLength <= pos) {
  16802. if (this.eof) {
  16803. return -1;
  16804. }
  16805. this.readBlock();
  16806. }
  16807. return this.buffer[this.pos++];
  16808. }
  16809. getBytes(length) {
  16810. const pos = this.pos;
  16811. let end;
  16812. if (length) {
  16813. this.ensureBuffer(pos + length);
  16814. end = pos + length;
  16815. while (!this.eof && this.bufferLength < end) {
  16816. this.readBlock();
  16817. }
  16818. const bufEnd = this.bufferLength;
  16819. if (end > bufEnd) {
  16820. end = bufEnd;
  16821. }
  16822. } else {
  16823. while (!this.eof) {
  16824. this.readBlock();
  16825. }
  16826. end = this.bufferLength;
  16827. }
  16828. this.pos = end;
  16829. return this.buffer.subarray(pos, end);
  16830. }
  16831. reset() {
  16832. this.pos = 0;
  16833. }
  16834. makeSubStream(start, length) {
  16835. let dict = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  16836. if (length === undefined) {
  16837. while (!this.eof) {
  16838. this.readBlock();
  16839. }
  16840. } else {
  16841. const end = start + length;
  16842. while (this.bufferLength <= end && !this.eof) {
  16843. this.readBlock();
  16844. }
  16845. }
  16846. return new _stream.Stream(this.buffer, start, length, dict);
  16847. }
  16848. getBaseStreams() {
  16849. return this.str ? this.str.getBaseStreams() : null;
  16850. }
  16851. }
  16852. exports.DecodeStream = DecodeStream;
  16853. class StreamsSequenceStream extends DecodeStream {
  16854. constructor(streams) {
  16855. let onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  16856. let maybeLength = 0;
  16857. for (const stream of streams) {
  16858. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  16859. }
  16860. super(maybeLength);
  16861. this.streams = streams;
  16862. this._onError = onError;
  16863. }
  16864. readBlock() {
  16865. const streams = this.streams;
  16866. if (streams.length === 0) {
  16867. this.eof = true;
  16868. return;
  16869. }
  16870. const stream = streams.shift();
  16871. let chunk;
  16872. try {
  16873. chunk = stream.getBytes();
  16874. } catch (reason) {
  16875. if (this._onError) {
  16876. this._onError(reason, stream.dict && stream.dict.objId);
  16877. return;
  16878. }
  16879. throw reason;
  16880. }
  16881. const bufferLength = this.bufferLength;
  16882. const newLength = bufferLength + chunk.length;
  16883. const buffer = this.ensureBuffer(newLength);
  16884. buffer.set(chunk, bufferLength);
  16885. this.bufferLength = newLength;
  16886. }
  16887. getBaseStreams() {
  16888. const baseStreamsBuf = [];
  16889. for (const stream of this.streams) {
  16890. const baseStreams = stream.getBaseStreams();
  16891. if (baseStreams) {
  16892. baseStreamsBuf.push(...baseStreams);
  16893. }
  16894. }
  16895. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  16896. }
  16897. }
  16898. exports.StreamsSequenceStream = StreamsSequenceStream;
  16899. /***/ }),
  16900. /* 149 */
  16901. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16902. "use strict";
  16903. Object.defineProperty(exports, "__esModule", ({
  16904. value: true
  16905. }));
  16906. exports.AsciiHexStream = void 0;
  16907. var _decode_stream = __w_pdfjs_require__(148);
  16908. class AsciiHexStream extends _decode_stream.DecodeStream {
  16909. constructor(str, maybeLength) {
  16910. if (maybeLength) {
  16911. maybeLength *= 0.5;
  16912. }
  16913. super(maybeLength);
  16914. this.str = str;
  16915. this.dict = str.dict;
  16916. this.firstDigit = -1;
  16917. }
  16918. readBlock() {
  16919. const UPSTREAM_BLOCK_SIZE = 8000;
  16920. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  16921. if (!bytes.length) {
  16922. this.eof = true;
  16923. return;
  16924. }
  16925. const maxDecodeLength = bytes.length + 1 >> 1;
  16926. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  16927. let bufferLength = this.bufferLength;
  16928. let firstDigit = this.firstDigit;
  16929. for (const ch of bytes) {
  16930. let digit;
  16931. if (ch >= 0x30 && ch <= 0x39) {
  16932. digit = ch & 0x0f;
  16933. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  16934. digit = (ch & 0x0f) + 9;
  16935. } else if (ch === 0x3e) {
  16936. this.eof = true;
  16937. break;
  16938. } else {
  16939. continue;
  16940. }
  16941. if (firstDigit < 0) {
  16942. firstDigit = digit;
  16943. } else {
  16944. buffer[bufferLength++] = firstDigit << 4 | digit;
  16945. firstDigit = -1;
  16946. }
  16947. }
  16948. if (firstDigit >= 0 && this.eof) {
  16949. buffer[bufferLength++] = firstDigit << 4;
  16950. firstDigit = -1;
  16951. }
  16952. this.firstDigit = firstDigit;
  16953. this.bufferLength = bufferLength;
  16954. }
  16955. }
  16956. exports.AsciiHexStream = AsciiHexStream;
  16957. /***/ }),
  16958. /* 150 */
  16959. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16960. "use strict";
  16961. Object.defineProperty(exports, "__esModule", ({
  16962. value: true
  16963. }));
  16964. exports.CCITTFaxStream = void 0;
  16965. var _ccitt = __w_pdfjs_require__(151);
  16966. var _decode_stream = __w_pdfjs_require__(148);
  16967. var _primitives = __w_pdfjs_require__(134);
  16968. class CCITTFaxStream extends _decode_stream.DecodeStream {
  16969. constructor(str, maybeLength, params) {
  16970. super(maybeLength);
  16971. this.str = str;
  16972. this.dict = str.dict;
  16973. if (!(params instanceof _primitives.Dict)) {
  16974. params = _primitives.Dict.empty;
  16975. }
  16976. const source = {
  16977. next() {
  16978. return str.getByte();
  16979. }
  16980. };
  16981. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  16982. K: params.get("K"),
  16983. EndOfLine: params.get("EndOfLine"),
  16984. EncodedByteAlign: params.get("EncodedByteAlign"),
  16985. Columns: params.get("Columns"),
  16986. Rows: params.get("Rows"),
  16987. EndOfBlock: params.get("EndOfBlock"),
  16988. BlackIs1: params.get("BlackIs1")
  16989. });
  16990. }
  16991. readBlock() {
  16992. while (!this.eof) {
  16993. const c = this.ccittFaxDecoder.readNextChar();
  16994. if (c === -1) {
  16995. this.eof = true;
  16996. return;
  16997. }
  16998. this.ensureBuffer(this.bufferLength + 1);
  16999. this.buffer[this.bufferLength++] = c;
  17000. }
  17001. }
  17002. }
  17003. exports.CCITTFaxStream = CCITTFaxStream;
  17004. /***/ }),
  17005. /* 151 */
  17006. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17007. "use strict";
  17008. Object.defineProperty(exports, "__esModule", ({
  17009. value: true
  17010. }));
  17011. exports.CCITTFaxDecoder = void 0;
  17012. var _util = __w_pdfjs_require__(2);
  17013. const ccittEOL = -2;
  17014. const ccittEOF = -1;
  17015. const twoDimPass = 0;
  17016. const twoDimHoriz = 1;
  17017. const twoDimVert0 = 2;
  17018. const twoDimVertR1 = 3;
  17019. const twoDimVertL1 = 4;
  17020. const twoDimVertR2 = 5;
  17021. const twoDimVertL2 = 6;
  17022. const twoDimVertR3 = 7;
  17023. const twoDimVertL3 = 8;
  17024. 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]];
  17025. 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]];
  17026. 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]];
  17027. 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]];
  17028. 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]];
  17029. 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]];
  17030. class CCITTFaxDecoder {
  17031. constructor(source) {
  17032. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  17033. if (!source || typeof source.next !== "function") {
  17034. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  17035. }
  17036. this.source = source;
  17037. this.eof = false;
  17038. this.encoding = options.K || 0;
  17039. this.eoline = options.EndOfLine || false;
  17040. this.byteAlign = options.EncodedByteAlign || false;
  17041. this.columns = options.Columns || 1728;
  17042. this.rows = options.Rows || 0;
  17043. let eoblock = options.EndOfBlock;
  17044. if (eoblock === null || eoblock === undefined) {
  17045. eoblock = true;
  17046. }
  17047. this.eoblock = eoblock;
  17048. this.black = options.BlackIs1 || false;
  17049. this.codingLine = new Uint32Array(this.columns + 1);
  17050. this.refLine = new Uint32Array(this.columns + 2);
  17051. this.codingLine[0] = this.columns;
  17052. this.codingPos = 0;
  17053. this.row = 0;
  17054. this.nextLine2D = this.encoding < 0;
  17055. this.inputBits = 0;
  17056. this.inputBuf = 0;
  17057. this.outputBits = 0;
  17058. this.rowsDone = false;
  17059. let code1;
  17060. while ((code1 = this._lookBits(12)) === 0) {
  17061. this._eatBits(1);
  17062. }
  17063. if (code1 === 1) {
  17064. this._eatBits(12);
  17065. }
  17066. if (this.encoding > 0) {
  17067. this.nextLine2D = !this._lookBits(1);
  17068. this._eatBits(1);
  17069. }
  17070. }
  17071. readNextChar() {
  17072. if (this.eof) {
  17073. return -1;
  17074. }
  17075. const refLine = this.refLine;
  17076. const codingLine = this.codingLine;
  17077. const columns = this.columns;
  17078. let refPos, blackPixels, bits, i;
  17079. if (this.outputBits === 0) {
  17080. if (this.rowsDone) {
  17081. this.eof = true;
  17082. }
  17083. if (this.eof) {
  17084. return -1;
  17085. }
  17086. this.err = false;
  17087. let code1, code2, code3;
  17088. if (this.nextLine2D) {
  17089. for (i = 0; codingLine[i] < columns; ++i) {
  17090. refLine[i] = codingLine[i];
  17091. }
  17092. refLine[i++] = columns;
  17093. refLine[i] = columns;
  17094. codingLine[0] = 0;
  17095. this.codingPos = 0;
  17096. refPos = 0;
  17097. blackPixels = 0;
  17098. while (codingLine[this.codingPos] < columns) {
  17099. code1 = this._getTwoDimCode();
  17100. switch (code1) {
  17101. case twoDimPass:
  17102. this._addPixels(refLine[refPos + 1], blackPixels);
  17103. if (refLine[refPos + 1] < columns) {
  17104. refPos += 2;
  17105. }
  17106. break;
  17107. case twoDimHoriz:
  17108. code1 = code2 = 0;
  17109. if (blackPixels) {
  17110. do {
  17111. code1 += code3 = this._getBlackCode();
  17112. } while (code3 >= 64);
  17113. do {
  17114. code2 += code3 = this._getWhiteCode();
  17115. } while (code3 >= 64);
  17116. } else {
  17117. do {
  17118. code1 += code3 = this._getWhiteCode();
  17119. } while (code3 >= 64);
  17120. do {
  17121. code2 += code3 = this._getBlackCode();
  17122. } while (code3 >= 64);
  17123. }
  17124. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17125. if (codingLine[this.codingPos] < columns) {
  17126. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  17127. }
  17128. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17129. refPos += 2;
  17130. }
  17131. break;
  17132. case twoDimVertR3:
  17133. this._addPixels(refLine[refPos] + 3, blackPixels);
  17134. blackPixels ^= 1;
  17135. if (codingLine[this.codingPos] < columns) {
  17136. ++refPos;
  17137. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17138. refPos += 2;
  17139. }
  17140. }
  17141. break;
  17142. case twoDimVertR2:
  17143. this._addPixels(refLine[refPos] + 2, blackPixels);
  17144. blackPixels ^= 1;
  17145. if (codingLine[this.codingPos] < columns) {
  17146. ++refPos;
  17147. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17148. refPos += 2;
  17149. }
  17150. }
  17151. break;
  17152. case twoDimVertR1:
  17153. this._addPixels(refLine[refPos] + 1, blackPixels);
  17154. blackPixels ^= 1;
  17155. if (codingLine[this.codingPos] < columns) {
  17156. ++refPos;
  17157. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17158. refPos += 2;
  17159. }
  17160. }
  17161. break;
  17162. case twoDimVert0:
  17163. this._addPixels(refLine[refPos], blackPixels);
  17164. blackPixels ^= 1;
  17165. if (codingLine[this.codingPos] < columns) {
  17166. ++refPos;
  17167. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17168. refPos += 2;
  17169. }
  17170. }
  17171. break;
  17172. case twoDimVertL3:
  17173. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  17174. blackPixels ^= 1;
  17175. if (codingLine[this.codingPos] < columns) {
  17176. if (refPos > 0) {
  17177. --refPos;
  17178. } else {
  17179. ++refPos;
  17180. }
  17181. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17182. refPos += 2;
  17183. }
  17184. }
  17185. break;
  17186. case twoDimVertL2:
  17187. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  17188. blackPixels ^= 1;
  17189. if (codingLine[this.codingPos] < columns) {
  17190. if (refPos > 0) {
  17191. --refPos;
  17192. } else {
  17193. ++refPos;
  17194. }
  17195. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17196. refPos += 2;
  17197. }
  17198. }
  17199. break;
  17200. case twoDimVertL1:
  17201. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  17202. blackPixels ^= 1;
  17203. if (codingLine[this.codingPos] < columns) {
  17204. if (refPos > 0) {
  17205. --refPos;
  17206. } else {
  17207. ++refPos;
  17208. }
  17209. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  17210. refPos += 2;
  17211. }
  17212. }
  17213. break;
  17214. case ccittEOF:
  17215. this._addPixels(columns, 0);
  17216. this.eof = true;
  17217. break;
  17218. default:
  17219. (0, _util.info)("bad 2d code");
  17220. this._addPixels(columns, 0);
  17221. this.err = true;
  17222. }
  17223. }
  17224. } else {
  17225. codingLine[0] = 0;
  17226. this.codingPos = 0;
  17227. blackPixels = 0;
  17228. while (codingLine[this.codingPos] < columns) {
  17229. code1 = 0;
  17230. if (blackPixels) {
  17231. do {
  17232. code1 += code3 = this._getBlackCode();
  17233. } while (code3 >= 64);
  17234. } else {
  17235. do {
  17236. code1 += code3 = this._getWhiteCode();
  17237. } while (code3 >= 64);
  17238. }
  17239. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  17240. blackPixels ^= 1;
  17241. }
  17242. }
  17243. let gotEOL = false;
  17244. if (this.byteAlign) {
  17245. this.inputBits &= ~7;
  17246. }
  17247. if (!this.eoblock && this.row === this.rows - 1) {
  17248. this.rowsDone = true;
  17249. } else {
  17250. code1 = this._lookBits(12);
  17251. if (this.eoline) {
  17252. while (code1 !== ccittEOF && code1 !== 1) {
  17253. this._eatBits(1);
  17254. code1 = this._lookBits(12);
  17255. }
  17256. } else {
  17257. while (code1 === 0) {
  17258. this._eatBits(1);
  17259. code1 = this._lookBits(12);
  17260. }
  17261. }
  17262. if (code1 === 1) {
  17263. this._eatBits(12);
  17264. gotEOL = true;
  17265. } else if (code1 === ccittEOF) {
  17266. this.eof = true;
  17267. }
  17268. }
  17269. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  17270. this.nextLine2D = !this._lookBits(1);
  17271. this._eatBits(1);
  17272. }
  17273. if (this.eoblock && gotEOL && this.byteAlign) {
  17274. code1 = this._lookBits(12);
  17275. if (code1 === 1) {
  17276. this._eatBits(12);
  17277. if (this.encoding > 0) {
  17278. this._lookBits(1);
  17279. this._eatBits(1);
  17280. }
  17281. if (this.encoding >= 0) {
  17282. for (i = 0; i < 4; ++i) {
  17283. code1 = this._lookBits(12);
  17284. if (code1 !== 1) {
  17285. (0, _util.info)("bad rtc code: " + code1);
  17286. }
  17287. this._eatBits(12);
  17288. if (this.encoding > 0) {
  17289. this._lookBits(1);
  17290. this._eatBits(1);
  17291. }
  17292. }
  17293. }
  17294. this.eof = true;
  17295. }
  17296. } else if (this.err && this.eoline) {
  17297. while (true) {
  17298. code1 = this._lookBits(13);
  17299. if (code1 === ccittEOF) {
  17300. this.eof = true;
  17301. return -1;
  17302. }
  17303. if (code1 >> 1 === 1) {
  17304. break;
  17305. }
  17306. this._eatBits(1);
  17307. }
  17308. this._eatBits(12);
  17309. if (this.encoding > 0) {
  17310. this._eatBits(1);
  17311. this.nextLine2D = !(code1 & 1);
  17312. }
  17313. }
  17314. if (codingLine[0] > 0) {
  17315. this.outputBits = codingLine[this.codingPos = 0];
  17316. } else {
  17317. this.outputBits = codingLine[this.codingPos = 1];
  17318. }
  17319. this.row++;
  17320. }
  17321. let c;
  17322. if (this.outputBits >= 8) {
  17323. c = this.codingPos & 1 ? 0 : 0xff;
  17324. this.outputBits -= 8;
  17325. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  17326. this.codingPos++;
  17327. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17328. }
  17329. } else {
  17330. bits = 8;
  17331. c = 0;
  17332. do {
  17333. if (typeof this.outputBits !== "number") {
  17334. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  17335. }
  17336. if (this.outputBits > bits) {
  17337. c <<= bits;
  17338. if (!(this.codingPos & 1)) {
  17339. c |= 0xff >> 8 - bits;
  17340. }
  17341. this.outputBits -= bits;
  17342. bits = 0;
  17343. } else {
  17344. c <<= this.outputBits;
  17345. if (!(this.codingPos & 1)) {
  17346. c |= 0xff >> 8 - this.outputBits;
  17347. }
  17348. bits -= this.outputBits;
  17349. this.outputBits = 0;
  17350. if (codingLine[this.codingPos] < columns) {
  17351. this.codingPos++;
  17352. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  17353. } else if (bits > 0) {
  17354. c <<= bits;
  17355. bits = 0;
  17356. }
  17357. }
  17358. } while (bits);
  17359. }
  17360. if (this.black) {
  17361. c ^= 0xff;
  17362. }
  17363. return c;
  17364. }
  17365. _addPixels(a1, blackPixels) {
  17366. const codingLine = this.codingLine;
  17367. let codingPos = this.codingPos;
  17368. if (a1 > codingLine[codingPos]) {
  17369. if (a1 > this.columns) {
  17370. (0, _util.info)("row is wrong length");
  17371. this.err = true;
  17372. a1 = this.columns;
  17373. }
  17374. if (codingPos & 1 ^ blackPixels) {
  17375. ++codingPos;
  17376. }
  17377. codingLine[codingPos] = a1;
  17378. }
  17379. this.codingPos = codingPos;
  17380. }
  17381. _addPixelsNeg(a1, blackPixels) {
  17382. const codingLine = this.codingLine;
  17383. let codingPos = this.codingPos;
  17384. if (a1 > codingLine[codingPos]) {
  17385. if (a1 > this.columns) {
  17386. (0, _util.info)("row is wrong length");
  17387. this.err = true;
  17388. a1 = this.columns;
  17389. }
  17390. if (codingPos & 1 ^ blackPixels) {
  17391. ++codingPos;
  17392. }
  17393. codingLine[codingPos] = a1;
  17394. } else if (a1 < codingLine[codingPos]) {
  17395. if (a1 < 0) {
  17396. (0, _util.info)("invalid code");
  17397. this.err = true;
  17398. a1 = 0;
  17399. }
  17400. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  17401. --codingPos;
  17402. }
  17403. codingLine[codingPos] = a1;
  17404. }
  17405. this.codingPos = codingPos;
  17406. }
  17407. _findTableCode(start, end, table, limit) {
  17408. const limitValue = limit || 0;
  17409. for (let i = start; i <= end; ++i) {
  17410. let code = this._lookBits(i);
  17411. if (code === ccittEOF) {
  17412. return [true, 1, false];
  17413. }
  17414. if (i < end) {
  17415. code <<= end - i;
  17416. }
  17417. if (!limitValue || code >= limitValue) {
  17418. const p = table[code - limitValue];
  17419. if (p[0] === i) {
  17420. this._eatBits(i);
  17421. return [true, p[1], true];
  17422. }
  17423. }
  17424. }
  17425. return [false, 0, false];
  17426. }
  17427. _getTwoDimCode() {
  17428. let code = 0;
  17429. let p;
  17430. if (this.eoblock) {
  17431. code = this._lookBits(7);
  17432. p = twoDimTable[code];
  17433. if (p && p[0] > 0) {
  17434. this._eatBits(p[0]);
  17435. return p[1];
  17436. }
  17437. } else {
  17438. const result = this._findTableCode(1, 7, twoDimTable);
  17439. if (result[0] && result[2]) {
  17440. return result[1];
  17441. }
  17442. }
  17443. (0, _util.info)("Bad two dim code");
  17444. return ccittEOF;
  17445. }
  17446. _getWhiteCode() {
  17447. let code = 0;
  17448. let p;
  17449. if (this.eoblock) {
  17450. code = this._lookBits(12);
  17451. if (code === ccittEOF) {
  17452. return 1;
  17453. }
  17454. if (code >> 5 === 0) {
  17455. p = whiteTable1[code];
  17456. } else {
  17457. p = whiteTable2[code >> 3];
  17458. }
  17459. if (p[0] > 0) {
  17460. this._eatBits(p[0]);
  17461. return p[1];
  17462. }
  17463. } else {
  17464. let result = this._findTableCode(1, 9, whiteTable2);
  17465. if (result[0]) {
  17466. return result[1];
  17467. }
  17468. result = this._findTableCode(11, 12, whiteTable1);
  17469. if (result[0]) {
  17470. return result[1];
  17471. }
  17472. }
  17473. (0, _util.info)("bad white code");
  17474. this._eatBits(1);
  17475. return 1;
  17476. }
  17477. _getBlackCode() {
  17478. let code, p;
  17479. if (this.eoblock) {
  17480. code = this._lookBits(13);
  17481. if (code === ccittEOF) {
  17482. return 1;
  17483. }
  17484. if (code >> 7 === 0) {
  17485. p = blackTable1[code];
  17486. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  17487. p = blackTable2[(code >> 1) - 64];
  17488. } else {
  17489. p = blackTable3[code >> 7];
  17490. }
  17491. if (p[0] > 0) {
  17492. this._eatBits(p[0]);
  17493. return p[1];
  17494. }
  17495. } else {
  17496. let result = this._findTableCode(2, 6, blackTable3);
  17497. if (result[0]) {
  17498. return result[1];
  17499. }
  17500. result = this._findTableCode(7, 12, blackTable2, 64);
  17501. if (result[0]) {
  17502. return result[1];
  17503. }
  17504. result = this._findTableCode(10, 13, blackTable1);
  17505. if (result[0]) {
  17506. return result[1];
  17507. }
  17508. }
  17509. (0, _util.info)("bad black code");
  17510. this._eatBits(1);
  17511. return 1;
  17512. }
  17513. _lookBits(n) {
  17514. let c;
  17515. while (this.inputBits < n) {
  17516. if ((c = this.source.next()) === -1) {
  17517. if (this.inputBits === 0) {
  17518. return ccittEOF;
  17519. }
  17520. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  17521. }
  17522. this.inputBuf = this.inputBuf << 8 | c;
  17523. this.inputBits += 8;
  17524. }
  17525. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  17526. }
  17527. _eatBits(n) {
  17528. if ((this.inputBits -= n) < 0) {
  17529. this.inputBits = 0;
  17530. }
  17531. }
  17532. }
  17533. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  17534. /***/ }),
  17535. /* 152 */
  17536. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17537. "use strict";
  17538. Object.defineProperty(exports, "__esModule", ({
  17539. value: true
  17540. }));
  17541. exports.FlateStream = void 0;
  17542. var _decode_stream = __w_pdfjs_require__(148);
  17543. var _util = __w_pdfjs_require__(2);
  17544. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  17545. 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]);
  17546. 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]);
  17547. 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];
  17548. 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];
  17549. class FlateStream extends _decode_stream.DecodeStream {
  17550. constructor(str, maybeLength) {
  17551. super(maybeLength);
  17552. this.str = str;
  17553. this.dict = str.dict;
  17554. const cmf = str.getByte();
  17555. const flg = str.getByte();
  17556. if (cmf === -1 || flg === -1) {
  17557. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  17558. }
  17559. if ((cmf & 0x0f) !== 0x08) {
  17560. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  17561. }
  17562. if (((cmf << 8) + flg) % 31 !== 0) {
  17563. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  17564. }
  17565. if (flg & 0x20) {
  17566. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  17567. }
  17568. this.codeSize = 0;
  17569. this.codeBuf = 0;
  17570. }
  17571. getBits(bits) {
  17572. const str = this.str;
  17573. let codeSize = this.codeSize;
  17574. let codeBuf = this.codeBuf;
  17575. let b;
  17576. while (codeSize < bits) {
  17577. if ((b = str.getByte()) === -1) {
  17578. throw new _util.FormatError("Bad encoding in flate stream");
  17579. }
  17580. codeBuf |= b << codeSize;
  17581. codeSize += 8;
  17582. }
  17583. b = codeBuf & (1 << bits) - 1;
  17584. this.codeBuf = codeBuf >> bits;
  17585. this.codeSize = codeSize -= bits;
  17586. return b;
  17587. }
  17588. getCode(table) {
  17589. const str = this.str;
  17590. const codes = table[0];
  17591. const maxLen = table[1];
  17592. let codeSize = this.codeSize;
  17593. let codeBuf = this.codeBuf;
  17594. let b;
  17595. while (codeSize < maxLen) {
  17596. if ((b = str.getByte()) === -1) {
  17597. break;
  17598. }
  17599. codeBuf |= b << codeSize;
  17600. codeSize += 8;
  17601. }
  17602. const code = codes[codeBuf & (1 << maxLen) - 1];
  17603. const codeLen = code >> 16;
  17604. const codeVal = code & 0xffff;
  17605. if (codeLen < 1 || codeSize < codeLen) {
  17606. throw new _util.FormatError("Bad encoding in flate stream");
  17607. }
  17608. this.codeBuf = codeBuf >> codeLen;
  17609. this.codeSize = codeSize - codeLen;
  17610. return codeVal;
  17611. }
  17612. generateHuffmanTable(lengths) {
  17613. const n = lengths.length;
  17614. let maxLen = 0;
  17615. let i;
  17616. for (i = 0; i < n; ++i) {
  17617. if (lengths[i] > maxLen) {
  17618. maxLen = lengths[i];
  17619. }
  17620. }
  17621. const size = 1 << maxLen;
  17622. const codes = new Int32Array(size);
  17623. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  17624. for (let val = 0; val < n; ++val) {
  17625. if (lengths[val] === len) {
  17626. let code2 = 0;
  17627. let t = code;
  17628. for (i = 0; i < len; ++i) {
  17629. code2 = code2 << 1 | t & 1;
  17630. t >>= 1;
  17631. }
  17632. for (i = code2; i < size; i += skip) {
  17633. codes[i] = len << 16 | val;
  17634. }
  17635. ++code;
  17636. }
  17637. }
  17638. }
  17639. return [codes, maxLen];
  17640. }
  17641. readBlock() {
  17642. let buffer, len;
  17643. const str = this.str;
  17644. let hdr = this.getBits(3);
  17645. if (hdr & 1) {
  17646. this.eof = true;
  17647. }
  17648. hdr >>= 1;
  17649. if (hdr === 0) {
  17650. let b;
  17651. if ((b = str.getByte()) === -1) {
  17652. throw new _util.FormatError("Bad block header in flate stream");
  17653. }
  17654. let blockLen = b;
  17655. if ((b = str.getByte()) === -1) {
  17656. throw new _util.FormatError("Bad block header in flate stream");
  17657. }
  17658. blockLen |= b << 8;
  17659. if ((b = str.getByte()) === -1) {
  17660. throw new _util.FormatError("Bad block header in flate stream");
  17661. }
  17662. let check = b;
  17663. if ((b = str.getByte()) === -1) {
  17664. throw new _util.FormatError("Bad block header in flate stream");
  17665. }
  17666. check |= b << 8;
  17667. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  17668. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  17669. }
  17670. this.codeBuf = 0;
  17671. this.codeSize = 0;
  17672. const bufferLength = this.bufferLength,
  17673. end = bufferLength + blockLen;
  17674. buffer = this.ensureBuffer(end);
  17675. this.bufferLength = end;
  17676. if (blockLen === 0) {
  17677. if (str.peekByte() === -1) {
  17678. this.eof = true;
  17679. }
  17680. } else {
  17681. const block = str.getBytes(blockLen);
  17682. buffer.set(block, bufferLength);
  17683. if (block.length < blockLen) {
  17684. this.eof = true;
  17685. }
  17686. }
  17687. return;
  17688. }
  17689. let litCodeTable;
  17690. let distCodeTable;
  17691. if (hdr === 1) {
  17692. litCodeTable = fixedLitCodeTab;
  17693. distCodeTable = fixedDistCodeTab;
  17694. } else if (hdr === 2) {
  17695. const numLitCodes = this.getBits(5) + 257;
  17696. const numDistCodes = this.getBits(5) + 1;
  17697. const numCodeLenCodes = this.getBits(4) + 4;
  17698. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  17699. let i;
  17700. for (i = 0; i < numCodeLenCodes; ++i) {
  17701. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  17702. }
  17703. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  17704. len = 0;
  17705. i = 0;
  17706. const codes = numLitCodes + numDistCodes;
  17707. const codeLengths = new Uint8Array(codes);
  17708. let bitsLength, bitsOffset, what;
  17709. while (i < codes) {
  17710. const code = this.getCode(codeLenCodeTab);
  17711. if (code === 16) {
  17712. bitsLength = 2;
  17713. bitsOffset = 3;
  17714. what = len;
  17715. } else if (code === 17) {
  17716. bitsLength = 3;
  17717. bitsOffset = 3;
  17718. what = len = 0;
  17719. } else if (code === 18) {
  17720. bitsLength = 7;
  17721. bitsOffset = 11;
  17722. what = len = 0;
  17723. } else {
  17724. codeLengths[i++] = len = code;
  17725. continue;
  17726. }
  17727. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  17728. while (repeatLength-- > 0) {
  17729. codeLengths[i++] = what;
  17730. }
  17731. }
  17732. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  17733. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  17734. } else {
  17735. throw new _util.FormatError("Unknown block type in flate stream");
  17736. }
  17737. buffer = this.buffer;
  17738. let limit = buffer ? buffer.length : 0;
  17739. let pos = this.bufferLength;
  17740. while (true) {
  17741. let code1 = this.getCode(litCodeTable);
  17742. if (code1 < 256) {
  17743. if (pos + 1 >= limit) {
  17744. buffer = this.ensureBuffer(pos + 1);
  17745. limit = buffer.length;
  17746. }
  17747. buffer[pos++] = code1;
  17748. continue;
  17749. }
  17750. if (code1 === 256) {
  17751. this.bufferLength = pos;
  17752. return;
  17753. }
  17754. code1 -= 257;
  17755. code1 = lengthDecode[code1];
  17756. let code2 = code1 >> 16;
  17757. if (code2 > 0) {
  17758. code2 = this.getBits(code2);
  17759. }
  17760. len = (code1 & 0xffff) + code2;
  17761. code1 = this.getCode(distCodeTable);
  17762. code1 = distDecode[code1];
  17763. code2 = code1 >> 16;
  17764. if (code2 > 0) {
  17765. code2 = this.getBits(code2);
  17766. }
  17767. const dist = (code1 & 0xffff) + code2;
  17768. if (pos + len >= limit) {
  17769. buffer = this.ensureBuffer(pos + len);
  17770. limit = buffer.length;
  17771. }
  17772. for (let k = 0; k < len; ++k, ++pos) {
  17773. buffer[pos] = buffer[pos - dist];
  17774. }
  17775. }
  17776. }
  17777. }
  17778. exports.FlateStream = FlateStream;
  17779. /***/ }),
  17780. /* 153 */
  17781. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17782. "use strict";
  17783. Object.defineProperty(exports, "__esModule", ({
  17784. value: true
  17785. }));
  17786. exports.Jbig2Stream = void 0;
  17787. var _base_stream = __w_pdfjs_require__(136);
  17788. var _decode_stream = __w_pdfjs_require__(148);
  17789. var _primitives = __w_pdfjs_require__(134);
  17790. var _jbig = __w_pdfjs_require__(154);
  17791. var _util = __w_pdfjs_require__(2);
  17792. class Jbig2Stream extends _decode_stream.DecodeStream {
  17793. constructor(stream, maybeLength, params) {
  17794. super(maybeLength);
  17795. this.stream = stream;
  17796. this.dict = stream.dict;
  17797. this.maybeLength = maybeLength;
  17798. this.params = params;
  17799. }
  17800. get bytes() {
  17801. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  17802. }
  17803. ensureBuffer(requested) {}
  17804. readBlock() {
  17805. if (this.eof) {
  17806. return;
  17807. }
  17808. const jbig2Image = new _jbig.Jbig2Image();
  17809. const chunks = [];
  17810. if (this.params instanceof _primitives.Dict) {
  17811. const globalsStream = this.params.get("JBIG2Globals");
  17812. if (globalsStream instanceof _base_stream.BaseStream) {
  17813. const globals = globalsStream.getBytes();
  17814. chunks.push({
  17815. data: globals,
  17816. start: 0,
  17817. end: globals.length
  17818. });
  17819. }
  17820. }
  17821. chunks.push({
  17822. data: this.bytes,
  17823. start: 0,
  17824. end: this.bytes.length
  17825. });
  17826. const data = jbig2Image.parseChunks(chunks);
  17827. const dataLength = data.length;
  17828. for (let i = 0; i < dataLength; i++) {
  17829. data[i] ^= 0xff;
  17830. }
  17831. this.buffer = data;
  17832. this.bufferLength = dataLength;
  17833. this.eof = true;
  17834. }
  17835. }
  17836. exports.Jbig2Stream = Jbig2Stream;
  17837. /***/ }),
  17838. /* 154 */
  17839. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17840. "use strict";
  17841. Object.defineProperty(exports, "__esModule", ({
  17842. value: true
  17843. }));
  17844. exports.Jbig2Image = void 0;
  17845. var _util = __w_pdfjs_require__(2);
  17846. var _core_utils = __w_pdfjs_require__(135);
  17847. var _arithmetic_decoder = __w_pdfjs_require__(155);
  17848. var _ccitt = __w_pdfjs_require__(151);
  17849. class Jbig2Error extends _util.BaseException {
  17850. constructor(msg) {
  17851. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  17852. }
  17853. }
  17854. class ContextCache {
  17855. getContexts(id) {
  17856. if (id in this) {
  17857. return this[id];
  17858. }
  17859. return this[id] = new Int8Array(1 << 16);
  17860. }
  17861. }
  17862. class DecodingContext {
  17863. constructor(data, start, end) {
  17864. this.data = data;
  17865. this.start = start;
  17866. this.end = end;
  17867. }
  17868. get decoder() {
  17869. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  17870. return (0, _util.shadow)(this, "decoder", decoder);
  17871. }
  17872. get contextCache() {
  17873. const cache = new ContextCache();
  17874. return (0, _util.shadow)(this, "contextCache", cache);
  17875. }
  17876. }
  17877. function decodeInteger(contextCache, procedure, decoder) {
  17878. const contexts = contextCache.getContexts(procedure);
  17879. let prev = 1;
  17880. function readBits(length) {
  17881. let v = 0;
  17882. for (let i = 0; i < length; i++) {
  17883. const bit = decoder.readBit(contexts, prev);
  17884. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  17885. v = v << 1 | bit;
  17886. }
  17887. return v >>> 0;
  17888. }
  17889. const sign = readBits(1);
  17890. 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);
  17891. if (sign === 0) {
  17892. return value;
  17893. } else if (value > 0) {
  17894. return -value;
  17895. }
  17896. return null;
  17897. }
  17898. function decodeIAID(contextCache, decoder, codeLength) {
  17899. const contexts = contextCache.getContexts("IAID");
  17900. let prev = 1;
  17901. for (let i = 0; i < codeLength; i++) {
  17902. const bit = decoder.readBit(contexts, prev);
  17903. prev = prev << 1 | bit;
  17904. }
  17905. if (codeLength < 31) {
  17906. return prev & (1 << codeLength) - 1;
  17907. }
  17908. return prev & 0x7fffffff;
  17909. }
  17910. 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"];
  17911. const CodingTemplates = [[{
  17912. x: -1,
  17913. y: -2
  17914. }, {
  17915. x: 0,
  17916. y: -2
  17917. }, {
  17918. x: 1,
  17919. y: -2
  17920. }, {
  17921. x: -2,
  17922. y: -1
  17923. }, {
  17924. x: -1,
  17925. y: -1
  17926. }, {
  17927. x: 0,
  17928. y: -1
  17929. }, {
  17930. x: 1,
  17931. y: -1
  17932. }, {
  17933. x: 2,
  17934. y: -1
  17935. }, {
  17936. x: -4,
  17937. y: 0
  17938. }, {
  17939. x: -3,
  17940. y: 0
  17941. }, {
  17942. x: -2,
  17943. y: 0
  17944. }, {
  17945. x: -1,
  17946. y: 0
  17947. }], [{
  17948. x: -1,
  17949. y: -2
  17950. }, {
  17951. x: 0,
  17952. y: -2
  17953. }, {
  17954. x: 1,
  17955. y: -2
  17956. }, {
  17957. x: 2,
  17958. y: -2
  17959. }, {
  17960. x: -2,
  17961. y: -1
  17962. }, {
  17963. x: -1,
  17964. y: -1
  17965. }, {
  17966. x: 0,
  17967. y: -1
  17968. }, {
  17969. x: 1,
  17970. y: -1
  17971. }, {
  17972. x: 2,
  17973. y: -1
  17974. }, {
  17975. x: -3,
  17976. y: 0
  17977. }, {
  17978. x: -2,
  17979. y: 0
  17980. }, {
  17981. x: -1,
  17982. y: 0
  17983. }], [{
  17984. x: -1,
  17985. y: -2
  17986. }, {
  17987. x: 0,
  17988. y: -2
  17989. }, {
  17990. x: 1,
  17991. y: -2
  17992. }, {
  17993. x: -2,
  17994. y: -1
  17995. }, {
  17996. x: -1,
  17997. y: -1
  17998. }, {
  17999. x: 0,
  18000. y: -1
  18001. }, {
  18002. x: 1,
  18003. y: -1
  18004. }, {
  18005. x: -2,
  18006. y: 0
  18007. }, {
  18008. x: -1,
  18009. y: 0
  18010. }], [{
  18011. x: -3,
  18012. y: -1
  18013. }, {
  18014. x: -2,
  18015. y: -1
  18016. }, {
  18017. x: -1,
  18018. y: -1
  18019. }, {
  18020. x: 0,
  18021. y: -1
  18022. }, {
  18023. x: 1,
  18024. y: -1
  18025. }, {
  18026. x: -4,
  18027. y: 0
  18028. }, {
  18029. x: -3,
  18030. y: 0
  18031. }, {
  18032. x: -2,
  18033. y: 0
  18034. }, {
  18035. x: -1,
  18036. y: 0
  18037. }]];
  18038. const RefinementTemplates = [{
  18039. coding: [{
  18040. x: 0,
  18041. y: -1
  18042. }, {
  18043. x: 1,
  18044. y: -1
  18045. }, {
  18046. x: -1,
  18047. y: 0
  18048. }],
  18049. reference: [{
  18050. x: 0,
  18051. y: -1
  18052. }, {
  18053. x: 1,
  18054. y: -1
  18055. }, {
  18056. x: -1,
  18057. y: 0
  18058. }, {
  18059. x: 0,
  18060. y: 0
  18061. }, {
  18062. x: 1,
  18063. y: 0
  18064. }, {
  18065. x: -1,
  18066. y: 1
  18067. }, {
  18068. x: 0,
  18069. y: 1
  18070. }, {
  18071. x: 1,
  18072. y: 1
  18073. }]
  18074. }, {
  18075. coding: [{
  18076. x: -1,
  18077. y: -1
  18078. }, {
  18079. x: 0,
  18080. y: -1
  18081. }, {
  18082. x: 1,
  18083. y: -1
  18084. }, {
  18085. x: -1,
  18086. y: 0
  18087. }],
  18088. reference: [{
  18089. x: 0,
  18090. y: -1
  18091. }, {
  18092. x: -1,
  18093. y: 0
  18094. }, {
  18095. x: 0,
  18096. y: 0
  18097. }, {
  18098. x: 1,
  18099. y: 0
  18100. }, {
  18101. x: 0,
  18102. y: 1
  18103. }, {
  18104. x: 1,
  18105. y: 1
  18106. }]
  18107. }];
  18108. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  18109. const RefinementReusedContexts = [0x0020, 0x0008];
  18110. function decodeBitmapTemplate0(width, height, decodingContext) {
  18111. const decoder = decodingContext.decoder;
  18112. const contexts = decodingContext.contextCache.getContexts("GB");
  18113. const bitmap = [];
  18114. let contextLabel, i, j, pixel, row, row1, row2;
  18115. const OLD_PIXEL_MASK = 0x7bf7;
  18116. for (i = 0; i < height; i++) {
  18117. row = bitmap[i] = new Uint8Array(width);
  18118. row1 = i < 1 ? row : bitmap[i - 1];
  18119. row2 = i < 2 ? row : bitmap[i - 2];
  18120. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  18121. for (j = 0; j < width; j++) {
  18122. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  18123. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  18124. }
  18125. }
  18126. return bitmap;
  18127. }
  18128. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  18129. if (mmr) {
  18130. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18131. return decodeMMRBitmap(input, width, height, false);
  18132. }
  18133. 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) {
  18134. return decodeBitmapTemplate0(width, height, decodingContext);
  18135. }
  18136. const useskip = !!skip;
  18137. const template = CodingTemplates[templateIndex].concat(at);
  18138. template.sort(function (a, b) {
  18139. return a.y - b.y || a.x - b.x;
  18140. });
  18141. const templateLength = template.length;
  18142. const templateX = new Int8Array(templateLength);
  18143. const templateY = new Int8Array(templateLength);
  18144. const changingTemplateEntries = [];
  18145. let reuseMask = 0,
  18146. minX = 0,
  18147. maxX = 0,
  18148. minY = 0;
  18149. let c, k;
  18150. for (k = 0; k < templateLength; k++) {
  18151. templateX[k] = template[k].x;
  18152. templateY[k] = template[k].y;
  18153. minX = Math.min(minX, template[k].x);
  18154. maxX = Math.max(maxX, template[k].x);
  18155. minY = Math.min(minY, template[k].y);
  18156. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  18157. reuseMask |= 1 << templateLength - 1 - k;
  18158. } else {
  18159. changingTemplateEntries.push(k);
  18160. }
  18161. }
  18162. const changingEntriesLength = changingTemplateEntries.length;
  18163. const changingTemplateX = new Int8Array(changingEntriesLength);
  18164. const changingTemplateY = new Int8Array(changingEntriesLength);
  18165. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  18166. for (c = 0; c < changingEntriesLength; c++) {
  18167. k = changingTemplateEntries[c];
  18168. changingTemplateX[c] = template[k].x;
  18169. changingTemplateY[c] = template[k].y;
  18170. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  18171. }
  18172. const sbb_left = -minX;
  18173. const sbb_top = -minY;
  18174. const sbb_right = width - maxX;
  18175. const pseudoPixelContext = ReusedContexts[templateIndex];
  18176. let row = new Uint8Array(width);
  18177. const bitmap = [];
  18178. const decoder = decodingContext.decoder;
  18179. const contexts = decodingContext.contextCache.getContexts("GB");
  18180. let ltp = 0,
  18181. j,
  18182. i0,
  18183. j0,
  18184. contextLabel = 0,
  18185. bit,
  18186. shift;
  18187. for (let i = 0; i < height; i++) {
  18188. if (prediction) {
  18189. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18190. ltp ^= sltp;
  18191. if (ltp) {
  18192. bitmap.push(row);
  18193. continue;
  18194. }
  18195. }
  18196. row = new Uint8Array(row);
  18197. bitmap.push(row);
  18198. for (j = 0; j < width; j++) {
  18199. if (useskip && skip[i][j]) {
  18200. row[j] = 0;
  18201. continue;
  18202. }
  18203. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  18204. contextLabel = contextLabel << 1 & reuseMask;
  18205. for (k = 0; k < changingEntriesLength; k++) {
  18206. i0 = i + changingTemplateY[k];
  18207. j0 = j + changingTemplateX[k];
  18208. bit = bitmap[i0][j0];
  18209. if (bit) {
  18210. bit = changingTemplateBit[k];
  18211. contextLabel |= bit;
  18212. }
  18213. }
  18214. } else {
  18215. contextLabel = 0;
  18216. shift = templateLength - 1;
  18217. for (k = 0; k < templateLength; k++, shift--) {
  18218. j0 = j + templateX[k];
  18219. if (j0 >= 0 && j0 < width) {
  18220. i0 = i + templateY[k];
  18221. if (i0 >= 0) {
  18222. bit = bitmap[i0][j0];
  18223. if (bit) {
  18224. contextLabel |= bit << shift;
  18225. }
  18226. }
  18227. }
  18228. }
  18229. }
  18230. const pixel = decoder.readBit(contexts, contextLabel);
  18231. row[j] = pixel;
  18232. }
  18233. }
  18234. return bitmap;
  18235. }
  18236. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  18237. let codingTemplate = RefinementTemplates[templateIndex].coding;
  18238. if (templateIndex === 0) {
  18239. codingTemplate = codingTemplate.concat([at[0]]);
  18240. }
  18241. const codingTemplateLength = codingTemplate.length;
  18242. const codingTemplateX = new Int32Array(codingTemplateLength);
  18243. const codingTemplateY = new Int32Array(codingTemplateLength);
  18244. let k;
  18245. for (k = 0; k < codingTemplateLength; k++) {
  18246. codingTemplateX[k] = codingTemplate[k].x;
  18247. codingTemplateY[k] = codingTemplate[k].y;
  18248. }
  18249. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  18250. if (templateIndex === 0) {
  18251. referenceTemplate = referenceTemplate.concat([at[1]]);
  18252. }
  18253. const referenceTemplateLength = referenceTemplate.length;
  18254. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  18255. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  18256. for (k = 0; k < referenceTemplateLength; k++) {
  18257. referenceTemplateX[k] = referenceTemplate[k].x;
  18258. referenceTemplateY[k] = referenceTemplate[k].y;
  18259. }
  18260. const referenceWidth = referenceBitmap[0].length;
  18261. const referenceHeight = referenceBitmap.length;
  18262. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  18263. const bitmap = [];
  18264. const decoder = decodingContext.decoder;
  18265. const contexts = decodingContext.contextCache.getContexts("GR");
  18266. let ltp = 0;
  18267. for (let i = 0; i < height; i++) {
  18268. if (prediction) {
  18269. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  18270. ltp ^= sltp;
  18271. if (ltp) {
  18272. throw new Jbig2Error("prediction is not supported");
  18273. }
  18274. }
  18275. const row = new Uint8Array(width);
  18276. bitmap.push(row);
  18277. for (let j = 0; j < width; j++) {
  18278. let i0, j0;
  18279. let contextLabel = 0;
  18280. for (k = 0; k < codingTemplateLength; k++) {
  18281. i0 = i + codingTemplateY[k];
  18282. j0 = j + codingTemplateX[k];
  18283. if (i0 < 0 || j0 < 0 || j0 >= width) {
  18284. contextLabel <<= 1;
  18285. } else {
  18286. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  18287. }
  18288. }
  18289. for (k = 0; k < referenceTemplateLength; k++) {
  18290. i0 = i + referenceTemplateY[k] - offsetY;
  18291. j0 = j + referenceTemplateX[k] - offsetX;
  18292. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  18293. contextLabel <<= 1;
  18294. } else {
  18295. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  18296. }
  18297. }
  18298. const pixel = decoder.readBit(contexts, contextLabel);
  18299. row[j] = pixel;
  18300. }
  18301. }
  18302. return bitmap;
  18303. }
  18304. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  18305. if (huffman && refinement) {
  18306. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  18307. }
  18308. const newSymbols = [];
  18309. let currentHeight = 0;
  18310. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  18311. const decoder = decodingContext.decoder;
  18312. const contextCache = decodingContext.contextCache;
  18313. let tableB1, symbolWidths;
  18314. if (huffman) {
  18315. tableB1 = getStandardTable(1);
  18316. symbolWidths = [];
  18317. symbolCodeLength = Math.max(symbolCodeLength, 1);
  18318. }
  18319. while (newSymbols.length < numberOfNewSymbols) {
  18320. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  18321. currentHeight += deltaHeight;
  18322. let currentWidth = 0,
  18323. totalWidth = 0;
  18324. const firstSymbol = huffman ? symbolWidths.length : 0;
  18325. while (true) {
  18326. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  18327. if (deltaWidth === null) {
  18328. break;
  18329. }
  18330. currentWidth += deltaWidth;
  18331. totalWidth += currentWidth;
  18332. let bitmap;
  18333. if (refinement) {
  18334. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  18335. if (numberOfInstances > 1) {
  18336. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  18337. } else {
  18338. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  18339. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18340. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18341. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  18342. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  18343. }
  18344. newSymbols.push(bitmap);
  18345. } else if (huffman) {
  18346. symbolWidths.push(currentWidth);
  18347. } else {
  18348. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  18349. newSymbols.push(bitmap);
  18350. }
  18351. }
  18352. if (huffman && !refinement) {
  18353. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  18354. huffmanInput.byteAlign();
  18355. let collectiveBitmap;
  18356. if (bitmapSize === 0) {
  18357. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  18358. } else {
  18359. const originalEnd = huffmanInput.end;
  18360. const bitmapEnd = huffmanInput.position + bitmapSize;
  18361. huffmanInput.end = bitmapEnd;
  18362. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  18363. huffmanInput.end = originalEnd;
  18364. huffmanInput.position = bitmapEnd;
  18365. }
  18366. const numberOfSymbolsDecoded = symbolWidths.length;
  18367. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  18368. newSymbols.push(collectiveBitmap);
  18369. } else {
  18370. let i,
  18371. y,
  18372. xMin = 0,
  18373. xMax,
  18374. bitmapWidth,
  18375. symbolBitmap;
  18376. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  18377. bitmapWidth = symbolWidths[i];
  18378. xMax = xMin + bitmapWidth;
  18379. symbolBitmap = [];
  18380. for (y = 0; y < currentHeight; y++) {
  18381. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18382. }
  18383. newSymbols.push(symbolBitmap);
  18384. xMin = xMax;
  18385. }
  18386. }
  18387. }
  18388. }
  18389. const exportedSymbols = [],
  18390. flags = [];
  18391. let currentFlag = false,
  18392. i,
  18393. ii;
  18394. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  18395. while (flags.length < totalSymbolsLength) {
  18396. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  18397. while (runLength--) {
  18398. flags.push(currentFlag);
  18399. }
  18400. currentFlag = !currentFlag;
  18401. }
  18402. for (i = 0, ii = symbols.length; i < ii; i++) {
  18403. if (flags[i]) {
  18404. exportedSymbols.push(symbols[i]);
  18405. }
  18406. }
  18407. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  18408. if (flags[i]) {
  18409. exportedSymbols.push(newSymbols[j]);
  18410. }
  18411. }
  18412. return exportedSymbols;
  18413. }
  18414. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  18415. if (huffman && refinement) {
  18416. throw new Jbig2Error("refinement with Huffman is not supported");
  18417. }
  18418. const bitmap = [];
  18419. let i, row;
  18420. for (i = 0; i < height; i++) {
  18421. row = new Uint8Array(width);
  18422. if (defaultPixelValue) {
  18423. for (let j = 0; j < width; j++) {
  18424. row[j] = defaultPixelValue;
  18425. }
  18426. }
  18427. bitmap.push(row);
  18428. }
  18429. const decoder = decodingContext.decoder;
  18430. const contextCache = decodingContext.contextCache;
  18431. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  18432. let firstS = 0;
  18433. i = 0;
  18434. while (i < numberOfSymbolInstances) {
  18435. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  18436. stripT += deltaT;
  18437. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  18438. firstS += deltaFirstS;
  18439. let currentS = firstS;
  18440. do {
  18441. let currentT = 0;
  18442. if (stripSize > 1) {
  18443. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  18444. }
  18445. const t = stripSize * stripT + currentT;
  18446. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  18447. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  18448. let symbolBitmap = inputSymbols[symbolId];
  18449. let symbolWidth = symbolBitmap[0].length;
  18450. let symbolHeight = symbolBitmap.length;
  18451. if (applyRefinement) {
  18452. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  18453. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  18454. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  18455. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  18456. symbolWidth += rdw;
  18457. symbolHeight += rdh;
  18458. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  18459. }
  18460. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  18461. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  18462. let s2, t2, symbolRow;
  18463. if (transposed) {
  18464. for (s2 = 0; s2 < symbolHeight; s2++) {
  18465. row = bitmap[offsetS + s2];
  18466. if (!row) {
  18467. continue;
  18468. }
  18469. symbolRow = symbolBitmap[s2];
  18470. const maxWidth = Math.min(width - offsetT, symbolWidth);
  18471. switch (combinationOperator) {
  18472. case 0:
  18473. for (t2 = 0; t2 < maxWidth; t2++) {
  18474. row[offsetT + t2] |= symbolRow[t2];
  18475. }
  18476. break;
  18477. case 2:
  18478. for (t2 = 0; t2 < maxWidth; t2++) {
  18479. row[offsetT + t2] ^= symbolRow[t2];
  18480. }
  18481. break;
  18482. default:
  18483. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18484. }
  18485. }
  18486. currentS += symbolHeight - 1;
  18487. } else {
  18488. for (t2 = 0; t2 < symbolHeight; t2++) {
  18489. row = bitmap[offsetT + t2];
  18490. if (!row) {
  18491. continue;
  18492. }
  18493. symbolRow = symbolBitmap[t2];
  18494. switch (combinationOperator) {
  18495. case 0:
  18496. for (s2 = 0; s2 < symbolWidth; s2++) {
  18497. row[offsetS + s2] |= symbolRow[s2];
  18498. }
  18499. break;
  18500. case 2:
  18501. for (s2 = 0; s2 < symbolWidth; s2++) {
  18502. row[offsetS + s2] ^= symbolRow[s2];
  18503. }
  18504. break;
  18505. default:
  18506. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  18507. }
  18508. }
  18509. currentS += symbolWidth - 1;
  18510. }
  18511. i++;
  18512. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  18513. if (deltaS === null) {
  18514. break;
  18515. }
  18516. currentS += deltaS + dsOffset;
  18517. } while (true);
  18518. }
  18519. return bitmap;
  18520. }
  18521. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  18522. const at = [];
  18523. if (!mmr) {
  18524. at.push({
  18525. x: -patternWidth,
  18526. y: 0
  18527. });
  18528. if (template === 0) {
  18529. at.push({
  18530. x: -3,
  18531. y: -1
  18532. }, {
  18533. x: 2,
  18534. y: -2
  18535. }, {
  18536. x: -2,
  18537. y: -2
  18538. });
  18539. }
  18540. }
  18541. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  18542. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  18543. const patterns = [];
  18544. for (let i = 0; i <= maxPatternIndex; i++) {
  18545. const patternBitmap = [];
  18546. const xMin = patternWidth * i;
  18547. const xMax = xMin + patternWidth;
  18548. for (let y = 0; y < patternHeight; y++) {
  18549. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  18550. }
  18551. patterns.push(patternBitmap);
  18552. }
  18553. return patterns;
  18554. }
  18555. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  18556. const skip = null;
  18557. if (enableSkip) {
  18558. throw new Jbig2Error("skip is not supported");
  18559. }
  18560. if (combinationOperator !== 0) {
  18561. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  18562. }
  18563. const regionBitmap = [];
  18564. let i, j, row;
  18565. for (i = 0; i < regionHeight; i++) {
  18566. row = new Uint8Array(regionWidth);
  18567. if (defaultPixelValue) {
  18568. for (j = 0; j < regionWidth; j++) {
  18569. row[j] = defaultPixelValue;
  18570. }
  18571. }
  18572. regionBitmap.push(row);
  18573. }
  18574. const numberOfPatterns = patterns.length;
  18575. const pattern0 = patterns[0];
  18576. const patternWidth = pattern0[0].length,
  18577. patternHeight = pattern0.length;
  18578. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  18579. const at = [];
  18580. if (!mmr) {
  18581. at.push({
  18582. x: template <= 1 ? 3 : 2,
  18583. y: -1
  18584. });
  18585. if (template === 0) {
  18586. at.push({
  18587. x: -3,
  18588. y: -1
  18589. }, {
  18590. x: 2,
  18591. y: -2
  18592. }, {
  18593. x: -2,
  18594. y: -2
  18595. });
  18596. }
  18597. }
  18598. const grayScaleBitPlanes = [];
  18599. let mmrInput, bitmap;
  18600. if (mmr) {
  18601. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  18602. }
  18603. for (i = bitsPerValue - 1; i >= 0; i--) {
  18604. if (mmr) {
  18605. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  18606. } else {
  18607. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  18608. }
  18609. grayScaleBitPlanes[i] = bitmap;
  18610. }
  18611. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  18612. for (mg = 0; mg < gridHeight; mg++) {
  18613. for (ng = 0; ng < gridWidth; ng++) {
  18614. bit = 0;
  18615. patternIndex = 0;
  18616. for (j = bitsPerValue - 1; j >= 0; j--) {
  18617. bit ^= grayScaleBitPlanes[j][mg][ng];
  18618. patternIndex |= bit << j;
  18619. }
  18620. patternBitmap = patterns[patternIndex];
  18621. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  18622. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  18623. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  18624. for (i = 0; i < patternHeight; i++) {
  18625. regionRow = regionBitmap[y + i];
  18626. patternRow = patternBitmap[i];
  18627. for (j = 0; j < patternWidth; j++) {
  18628. regionRow[x + j] |= patternRow[j];
  18629. }
  18630. }
  18631. } else {
  18632. let regionX, regionY;
  18633. for (i = 0; i < patternHeight; i++) {
  18634. regionY = y + i;
  18635. if (regionY < 0 || regionY >= regionHeight) {
  18636. continue;
  18637. }
  18638. regionRow = regionBitmap[regionY];
  18639. patternRow = patternBitmap[i];
  18640. for (j = 0; j < patternWidth; j++) {
  18641. regionX = x + j;
  18642. if (regionX >= 0 && regionX < regionWidth) {
  18643. regionRow[regionX] |= patternRow[j];
  18644. }
  18645. }
  18646. }
  18647. }
  18648. }
  18649. }
  18650. return regionBitmap;
  18651. }
  18652. function readSegmentHeader(data, start) {
  18653. const segmentHeader = {};
  18654. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  18655. const flags = data[start + 4];
  18656. const segmentType = flags & 0x3f;
  18657. if (!SegmentTypes[segmentType]) {
  18658. throw new Jbig2Error("invalid segment type: " + segmentType);
  18659. }
  18660. segmentHeader.type = segmentType;
  18661. segmentHeader.typeName = SegmentTypes[segmentType];
  18662. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  18663. const pageAssociationFieldSize = !!(flags & 0x40);
  18664. const referredFlags = data[start + 5];
  18665. let referredToCount = referredFlags >> 5 & 7;
  18666. const retainBits = [referredFlags & 31];
  18667. let position = start + 6;
  18668. if (referredFlags === 7) {
  18669. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  18670. position += 3;
  18671. let bytes = referredToCount + 7 >> 3;
  18672. retainBits[0] = data[position++];
  18673. while (--bytes > 0) {
  18674. retainBits.push(data[position++]);
  18675. }
  18676. } else if (referredFlags === 5 || referredFlags === 6) {
  18677. throw new Jbig2Error("invalid referred-to flags");
  18678. }
  18679. segmentHeader.retainBits = retainBits;
  18680. let referredToSegmentNumberSize = 4;
  18681. if (segmentHeader.number <= 256) {
  18682. referredToSegmentNumberSize = 1;
  18683. } else if (segmentHeader.number <= 65536) {
  18684. referredToSegmentNumberSize = 2;
  18685. }
  18686. const referredTo = [];
  18687. let i, ii;
  18688. for (i = 0; i < referredToCount; i++) {
  18689. let number;
  18690. if (referredToSegmentNumberSize === 1) {
  18691. number = data[position];
  18692. } else if (referredToSegmentNumberSize === 2) {
  18693. number = (0, _core_utils.readUint16)(data, position);
  18694. } else {
  18695. number = (0, _core_utils.readUint32)(data, position);
  18696. }
  18697. referredTo.push(number);
  18698. position += referredToSegmentNumberSize;
  18699. }
  18700. segmentHeader.referredTo = referredTo;
  18701. if (!pageAssociationFieldSize) {
  18702. segmentHeader.pageAssociation = data[position++];
  18703. } else {
  18704. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  18705. position += 4;
  18706. }
  18707. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  18708. position += 4;
  18709. if (segmentHeader.length === 0xffffffff) {
  18710. if (segmentType === 38) {
  18711. const genericRegionInfo = readRegionSegmentInformation(data, position);
  18712. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  18713. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  18714. const searchPatternLength = 6;
  18715. const searchPattern = new Uint8Array(searchPatternLength);
  18716. if (!genericRegionMmr) {
  18717. searchPattern[0] = 0xff;
  18718. searchPattern[1] = 0xac;
  18719. }
  18720. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  18721. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  18722. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  18723. searchPattern[5] = genericRegionInfo.height & 0xff;
  18724. for (i = position, ii = data.length; i < ii; i++) {
  18725. let j = 0;
  18726. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  18727. j++;
  18728. }
  18729. if (j === searchPatternLength) {
  18730. segmentHeader.length = i + searchPatternLength;
  18731. break;
  18732. }
  18733. }
  18734. if (segmentHeader.length === 0xffffffff) {
  18735. throw new Jbig2Error("segment end was not found");
  18736. }
  18737. } else {
  18738. throw new Jbig2Error("invalid unknown segment length");
  18739. }
  18740. }
  18741. segmentHeader.headerEnd = position;
  18742. return segmentHeader;
  18743. }
  18744. function readSegments(header, data, start, end) {
  18745. const segments = [];
  18746. let position = start;
  18747. while (position < end) {
  18748. const segmentHeader = readSegmentHeader(data, position);
  18749. position = segmentHeader.headerEnd;
  18750. const segment = {
  18751. header: segmentHeader,
  18752. data
  18753. };
  18754. if (!header.randomAccess) {
  18755. segment.start = position;
  18756. position += segmentHeader.length;
  18757. segment.end = position;
  18758. }
  18759. segments.push(segment);
  18760. if (segmentHeader.type === 51) {
  18761. break;
  18762. }
  18763. }
  18764. if (header.randomAccess) {
  18765. for (let i = 0, ii = segments.length; i < ii; i++) {
  18766. segments[i].start = position;
  18767. position += segments[i].header.length;
  18768. segments[i].end = position;
  18769. }
  18770. }
  18771. return segments;
  18772. }
  18773. function readRegionSegmentInformation(data, start) {
  18774. return {
  18775. width: (0, _core_utils.readUint32)(data, start),
  18776. height: (0, _core_utils.readUint32)(data, start + 4),
  18777. x: (0, _core_utils.readUint32)(data, start + 8),
  18778. y: (0, _core_utils.readUint32)(data, start + 12),
  18779. combinationOperator: data[start + 16] & 7
  18780. };
  18781. }
  18782. const RegionSegmentInformationFieldLength = 17;
  18783. function processSegment(segment, visitor) {
  18784. const header = segment.header;
  18785. const data = segment.data,
  18786. end = segment.end;
  18787. let position = segment.start;
  18788. let args, at, i, atLength;
  18789. switch (header.type) {
  18790. case 0:
  18791. const dictionary = {};
  18792. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  18793. dictionary.huffman = !!(dictionaryFlags & 1);
  18794. dictionary.refinement = !!(dictionaryFlags & 2);
  18795. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  18796. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  18797. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  18798. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  18799. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  18800. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  18801. dictionary.template = dictionaryFlags >> 10 & 3;
  18802. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  18803. position += 2;
  18804. if (!dictionary.huffman) {
  18805. atLength = dictionary.template === 0 ? 4 : 1;
  18806. at = [];
  18807. for (i = 0; i < atLength; i++) {
  18808. at.push({
  18809. x: (0, _core_utils.readInt8)(data, position),
  18810. y: (0, _core_utils.readInt8)(data, position + 1)
  18811. });
  18812. position += 2;
  18813. }
  18814. dictionary.at = at;
  18815. }
  18816. if (dictionary.refinement && !dictionary.refinementTemplate) {
  18817. at = [];
  18818. for (i = 0; i < 2; i++) {
  18819. at.push({
  18820. x: (0, _core_utils.readInt8)(data, position),
  18821. y: (0, _core_utils.readInt8)(data, position + 1)
  18822. });
  18823. position += 2;
  18824. }
  18825. dictionary.refinementAt = at;
  18826. }
  18827. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  18828. position += 4;
  18829. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  18830. position += 4;
  18831. args = [dictionary, header.number, header.referredTo, data, position, end];
  18832. break;
  18833. case 6:
  18834. case 7:
  18835. const textRegion = {};
  18836. textRegion.info = readRegionSegmentInformation(data, position);
  18837. position += RegionSegmentInformationFieldLength;
  18838. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  18839. position += 2;
  18840. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  18841. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  18842. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  18843. textRegion.stripSize = 1 << textRegion.logStripSize;
  18844. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  18845. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  18846. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  18847. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  18848. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  18849. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  18850. if (textRegion.huffman) {
  18851. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  18852. position += 2;
  18853. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  18854. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  18855. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  18856. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  18857. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  18858. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  18859. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  18860. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  18861. }
  18862. if (textRegion.refinement && !textRegion.refinementTemplate) {
  18863. at = [];
  18864. for (i = 0; i < 2; i++) {
  18865. at.push({
  18866. x: (0, _core_utils.readInt8)(data, position),
  18867. y: (0, _core_utils.readInt8)(data, position + 1)
  18868. });
  18869. position += 2;
  18870. }
  18871. textRegion.refinementAt = at;
  18872. }
  18873. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  18874. position += 4;
  18875. args = [textRegion, header.referredTo, data, position, end];
  18876. break;
  18877. case 16:
  18878. const patternDictionary = {};
  18879. const patternDictionaryFlags = data[position++];
  18880. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  18881. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  18882. patternDictionary.patternWidth = data[position++];
  18883. patternDictionary.patternHeight = data[position++];
  18884. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  18885. position += 4;
  18886. args = [patternDictionary, header.number, data, position, end];
  18887. break;
  18888. case 22:
  18889. case 23:
  18890. const halftoneRegion = {};
  18891. halftoneRegion.info = readRegionSegmentInformation(data, position);
  18892. position += RegionSegmentInformationFieldLength;
  18893. const halftoneRegionFlags = data[position++];
  18894. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  18895. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  18896. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  18897. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  18898. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  18899. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  18900. position += 4;
  18901. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  18902. position += 4;
  18903. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  18904. position += 4;
  18905. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  18906. position += 4;
  18907. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  18908. position += 2;
  18909. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  18910. position += 2;
  18911. args = [halftoneRegion, header.referredTo, data, position, end];
  18912. break;
  18913. case 38:
  18914. case 39:
  18915. const genericRegion = {};
  18916. genericRegion.info = readRegionSegmentInformation(data, position);
  18917. position += RegionSegmentInformationFieldLength;
  18918. const genericRegionSegmentFlags = data[position++];
  18919. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  18920. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  18921. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  18922. if (!genericRegion.mmr) {
  18923. atLength = genericRegion.template === 0 ? 4 : 1;
  18924. at = [];
  18925. for (i = 0; i < atLength; i++) {
  18926. at.push({
  18927. x: (0, _core_utils.readInt8)(data, position),
  18928. y: (0, _core_utils.readInt8)(data, position + 1)
  18929. });
  18930. position += 2;
  18931. }
  18932. genericRegion.at = at;
  18933. }
  18934. args = [genericRegion, data, position, end];
  18935. break;
  18936. case 48:
  18937. const pageInfo = {
  18938. width: (0, _core_utils.readUint32)(data, position),
  18939. height: (0, _core_utils.readUint32)(data, position + 4),
  18940. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  18941. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  18942. };
  18943. if (pageInfo.height === 0xffffffff) {
  18944. delete pageInfo.height;
  18945. }
  18946. const pageSegmentFlags = data[position + 16];
  18947. (0, _core_utils.readUint16)(data, position + 17);
  18948. pageInfo.lossless = !!(pageSegmentFlags & 1);
  18949. pageInfo.refinement = !!(pageSegmentFlags & 2);
  18950. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  18951. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  18952. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  18953. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  18954. args = [pageInfo];
  18955. break;
  18956. case 49:
  18957. break;
  18958. case 50:
  18959. break;
  18960. case 51:
  18961. break;
  18962. case 53:
  18963. args = [header.number, data, position, end];
  18964. break;
  18965. case 62:
  18966. break;
  18967. default:
  18968. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  18969. }
  18970. const callbackName = "on" + header.typeName;
  18971. if (callbackName in visitor) {
  18972. visitor[callbackName].apply(visitor, args);
  18973. }
  18974. }
  18975. function processSegments(segments, visitor) {
  18976. for (let i = 0, ii = segments.length; i < ii; i++) {
  18977. processSegment(segments[i], visitor);
  18978. }
  18979. }
  18980. function parseJbig2Chunks(chunks) {
  18981. const visitor = new SimpleSegmentVisitor();
  18982. for (let i = 0, ii = chunks.length; i < ii; i++) {
  18983. const chunk = chunks[i];
  18984. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  18985. processSegments(segments, visitor);
  18986. }
  18987. return visitor.buffer;
  18988. }
  18989. function parseJbig2(data) {
  18990. throw new Error("Not implemented: parseJbig2");
  18991. }
  18992. class SimpleSegmentVisitor {
  18993. onPageInformation(info) {
  18994. this.currentPageInfo = info;
  18995. const rowSize = info.width + 7 >> 3;
  18996. const buffer = new Uint8ClampedArray(rowSize * info.height);
  18997. if (info.defaultPixelValue) {
  18998. buffer.fill(0xff);
  18999. }
  19000. this.buffer = buffer;
  19001. }
  19002. drawBitmap(regionInfo, bitmap) {
  19003. const pageInfo = this.currentPageInfo;
  19004. const width = regionInfo.width,
  19005. height = regionInfo.height;
  19006. const rowSize = pageInfo.width + 7 >> 3;
  19007. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  19008. const buffer = this.buffer;
  19009. const mask0 = 128 >> (regionInfo.x & 7);
  19010. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  19011. let i, j, mask, offset;
  19012. switch (combinationOperator) {
  19013. case 0:
  19014. for (i = 0; i < height; i++) {
  19015. mask = mask0;
  19016. offset = offset0;
  19017. for (j = 0; j < width; j++) {
  19018. if (bitmap[i][j]) {
  19019. buffer[offset] |= mask;
  19020. }
  19021. mask >>= 1;
  19022. if (!mask) {
  19023. mask = 128;
  19024. offset++;
  19025. }
  19026. }
  19027. offset0 += rowSize;
  19028. }
  19029. break;
  19030. case 2:
  19031. for (i = 0; i < height; i++) {
  19032. mask = mask0;
  19033. offset = offset0;
  19034. for (j = 0; j < width; j++) {
  19035. if (bitmap[i][j]) {
  19036. buffer[offset] ^= mask;
  19037. }
  19038. mask >>= 1;
  19039. if (!mask) {
  19040. mask = 128;
  19041. offset++;
  19042. }
  19043. }
  19044. offset0 += rowSize;
  19045. }
  19046. break;
  19047. default:
  19048. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  19049. }
  19050. }
  19051. onImmediateGenericRegion(region, data, start, end) {
  19052. const regionInfo = region.info;
  19053. const decodingContext = new DecodingContext(data, start, end);
  19054. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  19055. this.drawBitmap(regionInfo, bitmap);
  19056. }
  19057. onImmediateLosslessGenericRegion() {
  19058. this.onImmediateGenericRegion(...arguments);
  19059. }
  19060. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  19061. let huffmanTables, huffmanInput;
  19062. if (dictionary.huffman) {
  19063. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  19064. huffmanInput = new Reader(data, start, end);
  19065. }
  19066. let symbols = this.symbols;
  19067. if (!symbols) {
  19068. this.symbols = symbols = {};
  19069. }
  19070. const inputSymbols = [];
  19071. for (const referredSegment of referredSegments) {
  19072. const referredSymbols = symbols[referredSegment];
  19073. if (referredSymbols) {
  19074. inputSymbols.push(...referredSymbols);
  19075. }
  19076. }
  19077. const decodingContext = new DecodingContext(data, start, end);
  19078. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  19079. }
  19080. onImmediateTextRegion(region, referredSegments, data, start, end) {
  19081. const regionInfo = region.info;
  19082. let huffmanTables, huffmanInput;
  19083. const symbols = this.symbols;
  19084. const inputSymbols = [];
  19085. for (const referredSegment of referredSegments) {
  19086. const referredSymbols = symbols[referredSegment];
  19087. if (referredSymbols) {
  19088. inputSymbols.push(...referredSymbols);
  19089. }
  19090. }
  19091. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  19092. if (region.huffman) {
  19093. huffmanInput = new Reader(data, start, end);
  19094. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  19095. }
  19096. const decodingContext = new DecodingContext(data, start, end);
  19097. 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);
  19098. this.drawBitmap(regionInfo, bitmap);
  19099. }
  19100. onImmediateLosslessTextRegion() {
  19101. this.onImmediateTextRegion(...arguments);
  19102. }
  19103. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  19104. let patterns = this.patterns;
  19105. if (!patterns) {
  19106. this.patterns = patterns = {};
  19107. }
  19108. const decodingContext = new DecodingContext(data, start, end);
  19109. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  19110. }
  19111. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  19112. const patterns = this.patterns[referredSegments[0]];
  19113. const regionInfo = region.info;
  19114. const decodingContext = new DecodingContext(data, start, end);
  19115. 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);
  19116. this.drawBitmap(regionInfo, bitmap);
  19117. }
  19118. onImmediateLosslessHalftoneRegion() {
  19119. this.onImmediateHalftoneRegion(...arguments);
  19120. }
  19121. onTables(currentSegment, data, start, end) {
  19122. let customTables = this.customTables;
  19123. if (!customTables) {
  19124. this.customTables = customTables = {};
  19125. }
  19126. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  19127. }
  19128. }
  19129. class HuffmanLine {
  19130. constructor(lineData) {
  19131. if (lineData.length === 2) {
  19132. this.isOOB = true;
  19133. this.rangeLow = 0;
  19134. this.prefixLength = lineData[0];
  19135. this.rangeLength = 0;
  19136. this.prefixCode = lineData[1];
  19137. this.isLowerRange = false;
  19138. } else {
  19139. this.isOOB = false;
  19140. this.rangeLow = lineData[0];
  19141. this.prefixLength = lineData[1];
  19142. this.rangeLength = lineData[2];
  19143. this.prefixCode = lineData[3];
  19144. this.isLowerRange = lineData[4] === "lower";
  19145. }
  19146. }
  19147. }
  19148. class HuffmanTreeNode {
  19149. constructor(line) {
  19150. this.children = [];
  19151. if (line) {
  19152. this.isLeaf = true;
  19153. this.rangeLength = line.rangeLength;
  19154. this.rangeLow = line.rangeLow;
  19155. this.isLowerRange = line.isLowerRange;
  19156. this.isOOB = line.isOOB;
  19157. } else {
  19158. this.isLeaf = false;
  19159. }
  19160. }
  19161. buildTree(line, shift) {
  19162. const bit = line.prefixCode >> shift & 1;
  19163. if (shift <= 0) {
  19164. this.children[bit] = new HuffmanTreeNode(line);
  19165. } else {
  19166. let node = this.children[bit];
  19167. if (!node) {
  19168. this.children[bit] = node = new HuffmanTreeNode(null);
  19169. }
  19170. node.buildTree(line, shift - 1);
  19171. }
  19172. }
  19173. decodeNode(reader) {
  19174. if (this.isLeaf) {
  19175. if (this.isOOB) {
  19176. return null;
  19177. }
  19178. const htOffset = reader.readBits(this.rangeLength);
  19179. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  19180. }
  19181. const node = this.children[reader.readBit()];
  19182. if (!node) {
  19183. throw new Jbig2Error("invalid Huffman data");
  19184. }
  19185. return node.decodeNode(reader);
  19186. }
  19187. }
  19188. class HuffmanTable {
  19189. constructor(lines, prefixCodesDone) {
  19190. if (!prefixCodesDone) {
  19191. this.assignPrefixCodes(lines);
  19192. }
  19193. this.rootNode = new HuffmanTreeNode(null);
  19194. for (let i = 0, ii = lines.length; i < ii; i++) {
  19195. const line = lines[i];
  19196. if (line.prefixLength > 0) {
  19197. this.rootNode.buildTree(line, line.prefixLength - 1);
  19198. }
  19199. }
  19200. }
  19201. decode(reader) {
  19202. return this.rootNode.decodeNode(reader);
  19203. }
  19204. assignPrefixCodes(lines) {
  19205. const linesLength = lines.length;
  19206. let prefixLengthMax = 0;
  19207. for (let i = 0; i < linesLength; i++) {
  19208. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  19209. }
  19210. const histogram = new Uint32Array(prefixLengthMax + 1);
  19211. for (let i = 0; i < linesLength; i++) {
  19212. histogram[lines[i].prefixLength]++;
  19213. }
  19214. let currentLength = 1,
  19215. firstCode = 0,
  19216. currentCode,
  19217. currentTemp,
  19218. line;
  19219. histogram[0] = 0;
  19220. while (currentLength <= prefixLengthMax) {
  19221. firstCode = firstCode + histogram[currentLength - 1] << 1;
  19222. currentCode = firstCode;
  19223. currentTemp = 0;
  19224. while (currentTemp < linesLength) {
  19225. line = lines[currentTemp];
  19226. if (line.prefixLength === currentLength) {
  19227. line.prefixCode = currentCode;
  19228. currentCode++;
  19229. }
  19230. currentTemp++;
  19231. }
  19232. currentLength++;
  19233. }
  19234. }
  19235. }
  19236. function decodeTablesSegment(data, start, end) {
  19237. const flags = data[start];
  19238. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  19239. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  19240. const reader = new Reader(data, start + 9, end);
  19241. const prefixSizeBits = (flags >> 1 & 7) + 1;
  19242. const rangeSizeBits = (flags >> 4 & 7) + 1;
  19243. const lines = [];
  19244. let prefixLength,
  19245. rangeLength,
  19246. currentRangeLow = lowestValue;
  19247. do {
  19248. prefixLength = reader.readBits(prefixSizeBits);
  19249. rangeLength = reader.readBits(rangeSizeBits);
  19250. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  19251. currentRangeLow += 1 << rangeLength;
  19252. } while (currentRangeLow < highestValue);
  19253. prefixLength = reader.readBits(prefixSizeBits);
  19254. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  19255. prefixLength = reader.readBits(prefixSizeBits);
  19256. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  19257. if (flags & 1) {
  19258. prefixLength = reader.readBits(prefixSizeBits);
  19259. lines.push(new HuffmanLine([prefixLength, 0]));
  19260. }
  19261. return new HuffmanTable(lines, false);
  19262. }
  19263. const standardTablesCache = {};
  19264. function getStandardTable(number) {
  19265. let table = standardTablesCache[number];
  19266. if (table) {
  19267. return table;
  19268. }
  19269. let lines;
  19270. switch (number) {
  19271. case 1:
  19272. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  19273. break;
  19274. case 2:
  19275. 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]];
  19276. break;
  19277. case 3:
  19278. 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]];
  19279. break;
  19280. case 4:
  19281. 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]];
  19282. break;
  19283. case 5:
  19284. 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]];
  19285. break;
  19286. case 6:
  19287. 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]];
  19288. break;
  19289. case 7:
  19290. 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]];
  19291. break;
  19292. case 8:
  19293. 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]];
  19294. break;
  19295. case 9:
  19296. 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]];
  19297. break;
  19298. case 10:
  19299. 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]];
  19300. break;
  19301. case 11:
  19302. 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]];
  19303. break;
  19304. case 12:
  19305. 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]];
  19306. break;
  19307. case 13:
  19308. 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]];
  19309. break;
  19310. case 14:
  19311. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  19312. break;
  19313. case 15:
  19314. 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]];
  19315. break;
  19316. default:
  19317. throw new Jbig2Error(`standard table B.${number} does not exist`);
  19318. }
  19319. for (let i = 0, ii = lines.length; i < ii; i++) {
  19320. lines[i] = new HuffmanLine(lines[i]);
  19321. }
  19322. table = new HuffmanTable(lines, true);
  19323. standardTablesCache[number] = table;
  19324. return table;
  19325. }
  19326. class Reader {
  19327. constructor(data, start, end) {
  19328. this.data = data;
  19329. this.start = start;
  19330. this.end = end;
  19331. this.position = start;
  19332. this.shift = -1;
  19333. this.currentByte = 0;
  19334. }
  19335. readBit() {
  19336. if (this.shift < 0) {
  19337. if (this.position >= this.end) {
  19338. throw new Jbig2Error("end of data while reading bit");
  19339. }
  19340. this.currentByte = this.data[this.position++];
  19341. this.shift = 7;
  19342. }
  19343. const bit = this.currentByte >> this.shift & 1;
  19344. this.shift--;
  19345. return bit;
  19346. }
  19347. readBits(numBits) {
  19348. let result = 0,
  19349. i;
  19350. for (i = numBits - 1; i >= 0; i--) {
  19351. result |= this.readBit() << i;
  19352. }
  19353. return result;
  19354. }
  19355. byteAlign() {
  19356. this.shift = -1;
  19357. }
  19358. next() {
  19359. if (this.position >= this.end) {
  19360. return -1;
  19361. }
  19362. return this.data[this.position++];
  19363. }
  19364. }
  19365. function getCustomHuffmanTable(index, referredTo, customTables) {
  19366. let currentIndex = 0;
  19367. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  19368. const table = customTables[referredTo[i]];
  19369. if (table) {
  19370. if (index === currentIndex) {
  19371. return table;
  19372. }
  19373. currentIndex++;
  19374. }
  19375. }
  19376. throw new Jbig2Error("can't find custom Huffman table");
  19377. }
  19378. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  19379. const codes = [];
  19380. for (let i = 0; i <= 34; i++) {
  19381. const codeLength = reader.readBits(4);
  19382. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19383. }
  19384. const runCodesTable = new HuffmanTable(codes, false);
  19385. codes.length = 0;
  19386. for (let i = 0; i < numberOfSymbols;) {
  19387. const codeLength = runCodesTable.decode(reader);
  19388. if (codeLength >= 32) {
  19389. let repeatedLength, numberOfRepeats, j;
  19390. switch (codeLength) {
  19391. case 32:
  19392. if (i === 0) {
  19393. throw new Jbig2Error("no previous value in symbol ID table");
  19394. }
  19395. numberOfRepeats = reader.readBits(2) + 3;
  19396. repeatedLength = codes[i - 1].prefixLength;
  19397. break;
  19398. case 33:
  19399. numberOfRepeats = reader.readBits(3) + 3;
  19400. repeatedLength = 0;
  19401. break;
  19402. case 34:
  19403. numberOfRepeats = reader.readBits(7) + 11;
  19404. repeatedLength = 0;
  19405. break;
  19406. default:
  19407. throw new Jbig2Error("invalid code length in symbol ID table");
  19408. }
  19409. for (j = 0; j < numberOfRepeats; j++) {
  19410. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  19411. i++;
  19412. }
  19413. } else {
  19414. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  19415. i++;
  19416. }
  19417. }
  19418. reader.byteAlign();
  19419. const symbolIDTable = new HuffmanTable(codes, false);
  19420. let customIndex = 0,
  19421. tableFirstS,
  19422. tableDeltaS,
  19423. tableDeltaT;
  19424. switch (textRegion.huffmanFS) {
  19425. case 0:
  19426. case 1:
  19427. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  19428. break;
  19429. case 3:
  19430. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19431. customIndex++;
  19432. break;
  19433. default:
  19434. throw new Jbig2Error("invalid Huffman FS selector");
  19435. }
  19436. switch (textRegion.huffmanDS) {
  19437. case 0:
  19438. case 1:
  19439. case 2:
  19440. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  19441. break;
  19442. case 3:
  19443. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19444. customIndex++;
  19445. break;
  19446. default:
  19447. throw new Jbig2Error("invalid Huffman DS selector");
  19448. }
  19449. switch (textRegion.huffmanDT) {
  19450. case 0:
  19451. case 1:
  19452. case 2:
  19453. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  19454. break;
  19455. case 3:
  19456. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19457. customIndex++;
  19458. break;
  19459. default:
  19460. throw new Jbig2Error("invalid Huffman DT selector");
  19461. }
  19462. if (textRegion.refinement) {
  19463. throw new Jbig2Error("refinement with Huffman is not supported");
  19464. }
  19465. return {
  19466. symbolIDTable,
  19467. tableFirstS,
  19468. tableDeltaS,
  19469. tableDeltaT
  19470. };
  19471. }
  19472. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  19473. let customIndex = 0,
  19474. tableDeltaHeight,
  19475. tableDeltaWidth;
  19476. switch (dictionary.huffmanDHSelector) {
  19477. case 0:
  19478. case 1:
  19479. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  19480. break;
  19481. case 3:
  19482. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19483. customIndex++;
  19484. break;
  19485. default:
  19486. throw new Jbig2Error("invalid Huffman DH selector");
  19487. }
  19488. switch (dictionary.huffmanDWSelector) {
  19489. case 0:
  19490. case 1:
  19491. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  19492. break;
  19493. case 3:
  19494. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19495. customIndex++;
  19496. break;
  19497. default:
  19498. throw new Jbig2Error("invalid Huffman DW selector");
  19499. }
  19500. let tableBitmapSize, tableAggregateInstances;
  19501. if (dictionary.bitmapSizeSelector) {
  19502. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19503. customIndex++;
  19504. } else {
  19505. tableBitmapSize = getStandardTable(1);
  19506. }
  19507. if (dictionary.aggregationInstancesSelector) {
  19508. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  19509. } else {
  19510. tableAggregateInstances = getStandardTable(1);
  19511. }
  19512. return {
  19513. tableDeltaHeight,
  19514. tableDeltaWidth,
  19515. tableBitmapSize,
  19516. tableAggregateInstances
  19517. };
  19518. }
  19519. function readUncompressedBitmap(reader, width, height) {
  19520. const bitmap = [];
  19521. for (let y = 0; y < height; y++) {
  19522. const row = new Uint8Array(width);
  19523. bitmap.push(row);
  19524. for (let x = 0; x < width; x++) {
  19525. row[x] = reader.readBit();
  19526. }
  19527. reader.byteAlign();
  19528. }
  19529. return bitmap;
  19530. }
  19531. function decodeMMRBitmap(input, width, height, endOfBlock) {
  19532. const params = {
  19533. K: -1,
  19534. Columns: width,
  19535. Rows: height,
  19536. BlackIs1: true,
  19537. EndOfBlock: endOfBlock
  19538. };
  19539. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  19540. const bitmap = [];
  19541. let currentByte,
  19542. eof = false;
  19543. for (let y = 0; y < height; y++) {
  19544. const row = new Uint8Array(width);
  19545. bitmap.push(row);
  19546. let shift = -1;
  19547. for (let x = 0; x < width; x++) {
  19548. if (shift < 0) {
  19549. currentByte = decoder.readNextChar();
  19550. if (currentByte === -1) {
  19551. currentByte = 0;
  19552. eof = true;
  19553. }
  19554. shift = 7;
  19555. }
  19556. row[x] = currentByte >> shift & 1;
  19557. shift--;
  19558. }
  19559. }
  19560. if (endOfBlock && !eof) {
  19561. const lookForEOFLimit = 5;
  19562. for (let i = 0; i < lookForEOFLimit; i++) {
  19563. if (decoder.readNextChar() === -1) {
  19564. break;
  19565. }
  19566. }
  19567. }
  19568. return bitmap;
  19569. }
  19570. class Jbig2Image {
  19571. parseChunks(chunks) {
  19572. return parseJbig2Chunks(chunks);
  19573. }
  19574. parse(data) {
  19575. throw new Error("Not implemented: Jbig2Image.parse");
  19576. }
  19577. }
  19578. exports.Jbig2Image = Jbig2Image;
  19579. /***/ }),
  19580. /* 155 */
  19581. /***/ ((__unused_webpack_module, exports) => {
  19582. "use strict";
  19583. Object.defineProperty(exports, "__esModule", ({
  19584. value: true
  19585. }));
  19586. exports.ArithmeticDecoder = void 0;
  19587. const QeTable = [{
  19588. qe: 0x5601,
  19589. nmps: 1,
  19590. nlps: 1,
  19591. switchFlag: 1
  19592. }, {
  19593. qe: 0x3401,
  19594. nmps: 2,
  19595. nlps: 6,
  19596. switchFlag: 0
  19597. }, {
  19598. qe: 0x1801,
  19599. nmps: 3,
  19600. nlps: 9,
  19601. switchFlag: 0
  19602. }, {
  19603. qe: 0x0ac1,
  19604. nmps: 4,
  19605. nlps: 12,
  19606. switchFlag: 0
  19607. }, {
  19608. qe: 0x0521,
  19609. nmps: 5,
  19610. nlps: 29,
  19611. switchFlag: 0
  19612. }, {
  19613. qe: 0x0221,
  19614. nmps: 38,
  19615. nlps: 33,
  19616. switchFlag: 0
  19617. }, {
  19618. qe: 0x5601,
  19619. nmps: 7,
  19620. nlps: 6,
  19621. switchFlag: 1
  19622. }, {
  19623. qe: 0x5401,
  19624. nmps: 8,
  19625. nlps: 14,
  19626. switchFlag: 0
  19627. }, {
  19628. qe: 0x4801,
  19629. nmps: 9,
  19630. nlps: 14,
  19631. switchFlag: 0
  19632. }, {
  19633. qe: 0x3801,
  19634. nmps: 10,
  19635. nlps: 14,
  19636. switchFlag: 0
  19637. }, {
  19638. qe: 0x3001,
  19639. nmps: 11,
  19640. nlps: 17,
  19641. switchFlag: 0
  19642. }, {
  19643. qe: 0x2401,
  19644. nmps: 12,
  19645. nlps: 18,
  19646. switchFlag: 0
  19647. }, {
  19648. qe: 0x1c01,
  19649. nmps: 13,
  19650. nlps: 20,
  19651. switchFlag: 0
  19652. }, {
  19653. qe: 0x1601,
  19654. nmps: 29,
  19655. nlps: 21,
  19656. switchFlag: 0
  19657. }, {
  19658. qe: 0x5601,
  19659. nmps: 15,
  19660. nlps: 14,
  19661. switchFlag: 1
  19662. }, {
  19663. qe: 0x5401,
  19664. nmps: 16,
  19665. nlps: 14,
  19666. switchFlag: 0
  19667. }, {
  19668. qe: 0x5101,
  19669. nmps: 17,
  19670. nlps: 15,
  19671. switchFlag: 0
  19672. }, {
  19673. qe: 0x4801,
  19674. nmps: 18,
  19675. nlps: 16,
  19676. switchFlag: 0
  19677. }, {
  19678. qe: 0x3801,
  19679. nmps: 19,
  19680. nlps: 17,
  19681. switchFlag: 0
  19682. }, {
  19683. qe: 0x3401,
  19684. nmps: 20,
  19685. nlps: 18,
  19686. switchFlag: 0
  19687. }, {
  19688. qe: 0x3001,
  19689. nmps: 21,
  19690. nlps: 19,
  19691. switchFlag: 0
  19692. }, {
  19693. qe: 0x2801,
  19694. nmps: 22,
  19695. nlps: 19,
  19696. switchFlag: 0
  19697. }, {
  19698. qe: 0x2401,
  19699. nmps: 23,
  19700. nlps: 20,
  19701. switchFlag: 0
  19702. }, {
  19703. qe: 0x2201,
  19704. nmps: 24,
  19705. nlps: 21,
  19706. switchFlag: 0
  19707. }, {
  19708. qe: 0x1c01,
  19709. nmps: 25,
  19710. nlps: 22,
  19711. switchFlag: 0
  19712. }, {
  19713. qe: 0x1801,
  19714. nmps: 26,
  19715. nlps: 23,
  19716. switchFlag: 0
  19717. }, {
  19718. qe: 0x1601,
  19719. nmps: 27,
  19720. nlps: 24,
  19721. switchFlag: 0
  19722. }, {
  19723. qe: 0x1401,
  19724. nmps: 28,
  19725. nlps: 25,
  19726. switchFlag: 0
  19727. }, {
  19728. qe: 0x1201,
  19729. nmps: 29,
  19730. nlps: 26,
  19731. switchFlag: 0
  19732. }, {
  19733. qe: 0x1101,
  19734. nmps: 30,
  19735. nlps: 27,
  19736. switchFlag: 0
  19737. }, {
  19738. qe: 0x0ac1,
  19739. nmps: 31,
  19740. nlps: 28,
  19741. switchFlag: 0
  19742. }, {
  19743. qe: 0x09c1,
  19744. nmps: 32,
  19745. nlps: 29,
  19746. switchFlag: 0
  19747. }, {
  19748. qe: 0x08a1,
  19749. nmps: 33,
  19750. nlps: 30,
  19751. switchFlag: 0
  19752. }, {
  19753. qe: 0x0521,
  19754. nmps: 34,
  19755. nlps: 31,
  19756. switchFlag: 0
  19757. }, {
  19758. qe: 0x0441,
  19759. nmps: 35,
  19760. nlps: 32,
  19761. switchFlag: 0
  19762. }, {
  19763. qe: 0x02a1,
  19764. nmps: 36,
  19765. nlps: 33,
  19766. switchFlag: 0
  19767. }, {
  19768. qe: 0x0221,
  19769. nmps: 37,
  19770. nlps: 34,
  19771. switchFlag: 0
  19772. }, {
  19773. qe: 0x0141,
  19774. nmps: 38,
  19775. nlps: 35,
  19776. switchFlag: 0
  19777. }, {
  19778. qe: 0x0111,
  19779. nmps: 39,
  19780. nlps: 36,
  19781. switchFlag: 0
  19782. }, {
  19783. qe: 0x0085,
  19784. nmps: 40,
  19785. nlps: 37,
  19786. switchFlag: 0
  19787. }, {
  19788. qe: 0x0049,
  19789. nmps: 41,
  19790. nlps: 38,
  19791. switchFlag: 0
  19792. }, {
  19793. qe: 0x0025,
  19794. nmps: 42,
  19795. nlps: 39,
  19796. switchFlag: 0
  19797. }, {
  19798. qe: 0x0015,
  19799. nmps: 43,
  19800. nlps: 40,
  19801. switchFlag: 0
  19802. }, {
  19803. qe: 0x0009,
  19804. nmps: 44,
  19805. nlps: 41,
  19806. switchFlag: 0
  19807. }, {
  19808. qe: 0x0005,
  19809. nmps: 45,
  19810. nlps: 42,
  19811. switchFlag: 0
  19812. }, {
  19813. qe: 0x0001,
  19814. nmps: 45,
  19815. nlps: 43,
  19816. switchFlag: 0
  19817. }, {
  19818. qe: 0x5601,
  19819. nmps: 46,
  19820. nlps: 46,
  19821. switchFlag: 0
  19822. }];
  19823. class ArithmeticDecoder {
  19824. constructor(data, start, end) {
  19825. this.data = data;
  19826. this.bp = start;
  19827. this.dataEnd = end;
  19828. this.chigh = data[start];
  19829. this.clow = 0;
  19830. this.byteIn();
  19831. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  19832. this.clow = this.clow << 7 & 0xffff;
  19833. this.ct -= 7;
  19834. this.a = 0x8000;
  19835. }
  19836. byteIn() {
  19837. const data = this.data;
  19838. let bp = this.bp;
  19839. if (data[bp] === 0xff) {
  19840. if (data[bp + 1] > 0x8f) {
  19841. this.clow += 0xff00;
  19842. this.ct = 8;
  19843. } else {
  19844. bp++;
  19845. this.clow += data[bp] << 9;
  19846. this.ct = 7;
  19847. this.bp = bp;
  19848. }
  19849. } else {
  19850. bp++;
  19851. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  19852. this.ct = 8;
  19853. this.bp = bp;
  19854. }
  19855. if (this.clow > 0xffff) {
  19856. this.chigh += this.clow >> 16;
  19857. this.clow &= 0xffff;
  19858. }
  19859. }
  19860. readBit(contexts, pos) {
  19861. let cx_index = contexts[pos] >> 1,
  19862. cx_mps = contexts[pos] & 1;
  19863. const qeTableIcx = QeTable[cx_index];
  19864. const qeIcx = qeTableIcx.qe;
  19865. let d;
  19866. let a = this.a - qeIcx;
  19867. if (this.chigh < qeIcx) {
  19868. if (a < qeIcx) {
  19869. a = qeIcx;
  19870. d = cx_mps;
  19871. cx_index = qeTableIcx.nmps;
  19872. } else {
  19873. a = qeIcx;
  19874. d = 1 ^ cx_mps;
  19875. if (qeTableIcx.switchFlag === 1) {
  19876. cx_mps = d;
  19877. }
  19878. cx_index = qeTableIcx.nlps;
  19879. }
  19880. } else {
  19881. this.chigh -= qeIcx;
  19882. if ((a & 0x8000) !== 0) {
  19883. this.a = a;
  19884. return cx_mps;
  19885. }
  19886. if (a < qeIcx) {
  19887. d = 1 ^ cx_mps;
  19888. if (qeTableIcx.switchFlag === 1) {
  19889. cx_mps = d;
  19890. }
  19891. cx_index = qeTableIcx.nlps;
  19892. } else {
  19893. d = cx_mps;
  19894. cx_index = qeTableIcx.nmps;
  19895. }
  19896. }
  19897. do {
  19898. if (this.ct === 0) {
  19899. this.byteIn();
  19900. }
  19901. a <<= 1;
  19902. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  19903. this.clow = this.clow << 1 & 0xffff;
  19904. this.ct--;
  19905. } while ((a & 0x8000) === 0);
  19906. this.a = a;
  19907. contexts[pos] = cx_index << 1 | cx_mps;
  19908. return d;
  19909. }
  19910. }
  19911. exports.ArithmeticDecoder = ArithmeticDecoder;
  19912. /***/ }),
  19913. /* 156 */
  19914. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19915. "use strict";
  19916. Object.defineProperty(exports, "__esModule", ({
  19917. value: true
  19918. }));
  19919. exports.JpegStream = void 0;
  19920. var _decode_stream = __w_pdfjs_require__(148);
  19921. var _primitives = __w_pdfjs_require__(134);
  19922. var _jpg = __w_pdfjs_require__(157);
  19923. var _util = __w_pdfjs_require__(2);
  19924. class JpegStream extends _decode_stream.DecodeStream {
  19925. constructor(stream, maybeLength, params) {
  19926. let ch;
  19927. while ((ch = stream.getByte()) !== -1) {
  19928. if (ch === 0xff) {
  19929. stream.skip(-1);
  19930. break;
  19931. }
  19932. }
  19933. super(maybeLength);
  19934. this.stream = stream;
  19935. this.dict = stream.dict;
  19936. this.maybeLength = maybeLength;
  19937. this.params = params;
  19938. }
  19939. get bytes() {
  19940. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  19941. }
  19942. ensureBuffer(requested) {}
  19943. readBlock() {
  19944. if (this.eof) {
  19945. return;
  19946. }
  19947. const jpegOptions = {
  19948. decodeTransform: undefined,
  19949. colorTransform: undefined
  19950. };
  19951. const decodeArr = this.dict.getArray("D", "Decode");
  19952. if (this.forceRGB && Array.isArray(decodeArr)) {
  19953. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  19954. const decodeArrLength = decodeArr.length;
  19955. const transform = new Int32Array(decodeArrLength);
  19956. let transformNeeded = false;
  19957. const maxValue = (1 << bitsPerComponent) - 1;
  19958. for (let i = 0; i < decodeArrLength; i += 2) {
  19959. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  19960. transform[i + 1] = decodeArr[i] * maxValue | 0;
  19961. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  19962. transformNeeded = true;
  19963. }
  19964. }
  19965. if (transformNeeded) {
  19966. jpegOptions.decodeTransform = transform;
  19967. }
  19968. }
  19969. if (this.params instanceof _primitives.Dict) {
  19970. const colorTransform = this.params.get("ColorTransform");
  19971. if (Number.isInteger(colorTransform)) {
  19972. jpegOptions.colorTransform = colorTransform;
  19973. }
  19974. }
  19975. const jpegImage = new _jpg.JpegImage(jpegOptions);
  19976. jpegImage.parse(this.bytes);
  19977. const data = jpegImage.getData({
  19978. width: this.drawWidth,
  19979. height: this.drawHeight,
  19980. forceRGB: this.forceRGB,
  19981. isSourcePDF: true
  19982. });
  19983. this.buffer = data;
  19984. this.bufferLength = data.length;
  19985. this.eof = true;
  19986. }
  19987. }
  19988. exports.JpegStream = JpegStream;
  19989. /***/ }),
  19990. /* 157 */
  19991. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19992. "use strict";
  19993. Object.defineProperty(exports, "__esModule", ({
  19994. value: true
  19995. }));
  19996. exports.JpegImage = void 0;
  19997. var _util = __w_pdfjs_require__(2);
  19998. var _core_utils = __w_pdfjs_require__(135);
  19999. class JpegError extends _util.BaseException {
  20000. constructor(msg) {
  20001. super(`JPEG error: ${msg}`, "JpegError");
  20002. }
  20003. }
  20004. class DNLMarkerError extends _util.BaseException {
  20005. constructor(message, scanLines) {
  20006. super(message, "DNLMarkerError");
  20007. this.scanLines = scanLines;
  20008. }
  20009. }
  20010. class EOIMarkerError extends _util.BaseException {
  20011. constructor(msg) {
  20012. super(msg, "EOIMarkerError");
  20013. }
  20014. }
  20015. 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]);
  20016. const dctCos1 = 4017;
  20017. const dctSin1 = 799;
  20018. const dctCos3 = 3406;
  20019. const dctSin3 = 2276;
  20020. const dctCos6 = 1567;
  20021. const dctSin6 = 3784;
  20022. const dctSqrt2 = 5793;
  20023. const dctSqrt1d2 = 2896;
  20024. function buildHuffmanTable(codeLengths, values) {
  20025. let k = 0,
  20026. i,
  20027. j,
  20028. length = 16;
  20029. while (length > 0 && !codeLengths[length - 1]) {
  20030. length--;
  20031. }
  20032. const code = [{
  20033. children: [],
  20034. index: 0
  20035. }];
  20036. let p = code[0],
  20037. q;
  20038. for (i = 0; i < length; i++) {
  20039. for (j = 0; j < codeLengths[i]; j++) {
  20040. p = code.pop();
  20041. p.children[p.index] = values[k];
  20042. while (p.index > 0) {
  20043. p = code.pop();
  20044. }
  20045. p.index++;
  20046. code.push(p);
  20047. while (code.length <= i) {
  20048. code.push(q = {
  20049. children: [],
  20050. index: 0
  20051. });
  20052. p.children[p.index] = q.children;
  20053. p = q;
  20054. }
  20055. k++;
  20056. }
  20057. if (i + 1 < length) {
  20058. code.push(q = {
  20059. children: [],
  20060. index: 0
  20061. });
  20062. p.children[p.index] = q.children;
  20063. p = q;
  20064. }
  20065. }
  20066. return code[0].children;
  20067. }
  20068. function getBlockBufferOffset(component, row, col) {
  20069. return 64 * ((component.blocksPerLine + 1) * row + col);
  20070. }
  20071. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  20072. let parseDNLMarker = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
  20073. const mcusPerLine = frame.mcusPerLine;
  20074. const progressive = frame.progressive;
  20075. const startOffset = offset;
  20076. let bitsData = 0,
  20077. bitsCount = 0;
  20078. function readBit() {
  20079. if (bitsCount > 0) {
  20080. bitsCount--;
  20081. return bitsData >> bitsCount & 1;
  20082. }
  20083. bitsData = data[offset++];
  20084. if (bitsData === 0xff) {
  20085. const nextByte = data[offset++];
  20086. if (nextByte) {
  20087. if (nextByte === 0xdc && parseDNLMarker) {
  20088. offset += 2;
  20089. const scanLines = (0, _core_utils.readUint16)(data, offset);
  20090. offset += 2;
  20091. if (scanLines > 0 && scanLines !== frame.scanLines) {
  20092. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  20093. }
  20094. } else if (nextByte === 0xd9) {
  20095. if (parseDNLMarker) {
  20096. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  20097. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  20098. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  20099. }
  20100. }
  20101. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  20102. }
  20103. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  20104. }
  20105. }
  20106. bitsCount = 7;
  20107. return bitsData >>> 7;
  20108. }
  20109. function decodeHuffman(tree) {
  20110. let node = tree;
  20111. while (true) {
  20112. node = node[readBit()];
  20113. switch (typeof node) {
  20114. case "number":
  20115. return node;
  20116. case "object":
  20117. continue;
  20118. }
  20119. throw new JpegError("invalid huffman sequence");
  20120. }
  20121. }
  20122. function receive(length) {
  20123. let n = 0;
  20124. while (length > 0) {
  20125. n = n << 1 | readBit();
  20126. length--;
  20127. }
  20128. return n;
  20129. }
  20130. function receiveAndExtend(length) {
  20131. if (length === 1) {
  20132. return readBit() === 1 ? 1 : -1;
  20133. }
  20134. const n = receive(length);
  20135. if (n >= 1 << length - 1) {
  20136. return n;
  20137. }
  20138. return n + (-1 << length) + 1;
  20139. }
  20140. function decodeBaseline(component, blockOffset) {
  20141. const t = decodeHuffman(component.huffmanTableDC);
  20142. const diff = t === 0 ? 0 : receiveAndExtend(t);
  20143. component.blockData[blockOffset] = component.pred += diff;
  20144. let k = 1;
  20145. while (k < 64) {
  20146. const rs = decodeHuffman(component.huffmanTableAC);
  20147. const s = rs & 15,
  20148. r = rs >> 4;
  20149. if (s === 0) {
  20150. if (r < 15) {
  20151. break;
  20152. }
  20153. k += 16;
  20154. continue;
  20155. }
  20156. k += r;
  20157. const z = dctZigZag[k];
  20158. component.blockData[blockOffset + z] = receiveAndExtend(s);
  20159. k++;
  20160. }
  20161. }
  20162. function decodeDCFirst(component, blockOffset) {
  20163. const t = decodeHuffman(component.huffmanTableDC);
  20164. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  20165. component.blockData[blockOffset] = component.pred += diff;
  20166. }
  20167. function decodeDCSuccessive(component, blockOffset) {
  20168. component.blockData[blockOffset] |= readBit() << successive;
  20169. }
  20170. let eobrun = 0;
  20171. function decodeACFirst(component, blockOffset) {
  20172. if (eobrun > 0) {
  20173. eobrun--;
  20174. return;
  20175. }
  20176. let k = spectralStart;
  20177. const e = spectralEnd;
  20178. while (k <= e) {
  20179. const rs = decodeHuffman(component.huffmanTableAC);
  20180. const s = rs & 15,
  20181. r = rs >> 4;
  20182. if (s === 0) {
  20183. if (r < 15) {
  20184. eobrun = receive(r) + (1 << r) - 1;
  20185. break;
  20186. }
  20187. k += 16;
  20188. continue;
  20189. }
  20190. k += r;
  20191. const z = dctZigZag[k];
  20192. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  20193. k++;
  20194. }
  20195. }
  20196. let successiveACState = 0,
  20197. successiveACNextValue;
  20198. function decodeACSuccessive(component, blockOffset) {
  20199. let k = spectralStart;
  20200. const e = spectralEnd;
  20201. let r = 0;
  20202. let s;
  20203. let rs;
  20204. while (k <= e) {
  20205. const offsetZ = blockOffset + dctZigZag[k];
  20206. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  20207. switch (successiveACState) {
  20208. case 0:
  20209. rs = decodeHuffman(component.huffmanTableAC);
  20210. s = rs & 15;
  20211. r = rs >> 4;
  20212. if (s === 0) {
  20213. if (r < 15) {
  20214. eobrun = receive(r) + (1 << r);
  20215. successiveACState = 4;
  20216. } else {
  20217. r = 16;
  20218. successiveACState = 1;
  20219. }
  20220. } else {
  20221. if (s !== 1) {
  20222. throw new JpegError("invalid ACn encoding");
  20223. }
  20224. successiveACNextValue = receiveAndExtend(s);
  20225. successiveACState = r ? 2 : 3;
  20226. }
  20227. continue;
  20228. case 1:
  20229. case 2:
  20230. if (component.blockData[offsetZ]) {
  20231. component.blockData[offsetZ] += sign * (readBit() << successive);
  20232. } else {
  20233. r--;
  20234. if (r === 0) {
  20235. successiveACState = successiveACState === 2 ? 3 : 0;
  20236. }
  20237. }
  20238. break;
  20239. case 3:
  20240. if (component.blockData[offsetZ]) {
  20241. component.blockData[offsetZ] += sign * (readBit() << successive);
  20242. } else {
  20243. component.blockData[offsetZ] = successiveACNextValue << successive;
  20244. successiveACState = 0;
  20245. }
  20246. break;
  20247. case 4:
  20248. if (component.blockData[offsetZ]) {
  20249. component.blockData[offsetZ] += sign * (readBit() << successive);
  20250. }
  20251. break;
  20252. }
  20253. k++;
  20254. }
  20255. if (successiveACState === 4) {
  20256. eobrun--;
  20257. if (eobrun === 0) {
  20258. successiveACState = 0;
  20259. }
  20260. }
  20261. }
  20262. let blockRow = 0;
  20263. function decodeMcu(component, decode, mcu, row, col) {
  20264. const mcuRow = mcu / mcusPerLine | 0;
  20265. const mcuCol = mcu % mcusPerLine;
  20266. blockRow = mcuRow * component.v + row;
  20267. const blockCol = mcuCol * component.h + col;
  20268. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20269. decode(component, blockOffset);
  20270. }
  20271. function decodeBlock(component, decode, mcu) {
  20272. blockRow = mcu / component.blocksPerLine | 0;
  20273. const blockCol = mcu % component.blocksPerLine;
  20274. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  20275. decode(component, blockOffset);
  20276. }
  20277. const componentsLength = components.length;
  20278. let component, i, j, k, n;
  20279. let decodeFn;
  20280. if (progressive) {
  20281. if (spectralStart === 0) {
  20282. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  20283. } else {
  20284. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  20285. }
  20286. } else {
  20287. decodeFn = decodeBaseline;
  20288. }
  20289. let mcu = 0,
  20290. fileMarker;
  20291. let mcuExpected;
  20292. if (componentsLength === 1) {
  20293. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  20294. } else {
  20295. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  20296. }
  20297. let h, v;
  20298. while (mcu <= mcuExpected) {
  20299. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  20300. if (mcuToRead > 0) {
  20301. for (i = 0; i < componentsLength; i++) {
  20302. components[i].pred = 0;
  20303. }
  20304. eobrun = 0;
  20305. if (componentsLength === 1) {
  20306. component = components[0];
  20307. for (n = 0; n < mcuToRead; n++) {
  20308. decodeBlock(component, decodeFn, mcu);
  20309. mcu++;
  20310. }
  20311. } else {
  20312. for (n = 0; n < mcuToRead; n++) {
  20313. for (i = 0; i < componentsLength; i++) {
  20314. component = components[i];
  20315. h = component.h;
  20316. v = component.v;
  20317. for (j = 0; j < v; j++) {
  20318. for (k = 0; k < h; k++) {
  20319. decodeMcu(component, decodeFn, mcu, j, k);
  20320. }
  20321. }
  20322. }
  20323. mcu++;
  20324. }
  20325. }
  20326. }
  20327. bitsCount = 0;
  20328. fileMarker = findNextFileMarker(data, offset);
  20329. if (!fileMarker) {
  20330. break;
  20331. }
  20332. if (fileMarker.invalid) {
  20333. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  20334. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  20335. offset = fileMarker.offset;
  20336. }
  20337. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  20338. offset += 2;
  20339. } else {
  20340. break;
  20341. }
  20342. }
  20343. return offset - startOffset;
  20344. }
  20345. function quantizeAndInverse(component, blockBufferOffset, p) {
  20346. const qt = component.quantizationTable,
  20347. blockData = component.blockData;
  20348. let v0, v1, v2, v3, v4, v5, v6, v7;
  20349. let p0, p1, p2, p3, p4, p5, p6, p7;
  20350. let t;
  20351. if (!qt) {
  20352. throw new JpegError("missing required Quantization Table.");
  20353. }
  20354. for (let row = 0; row < 64; row += 8) {
  20355. p0 = blockData[blockBufferOffset + row];
  20356. p1 = blockData[blockBufferOffset + row + 1];
  20357. p2 = blockData[blockBufferOffset + row + 2];
  20358. p3 = blockData[blockBufferOffset + row + 3];
  20359. p4 = blockData[blockBufferOffset + row + 4];
  20360. p5 = blockData[blockBufferOffset + row + 5];
  20361. p6 = blockData[blockBufferOffset + row + 6];
  20362. p7 = blockData[blockBufferOffset + row + 7];
  20363. p0 *= qt[row];
  20364. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20365. t = dctSqrt2 * p0 + 512 >> 10;
  20366. p[row] = t;
  20367. p[row + 1] = t;
  20368. p[row + 2] = t;
  20369. p[row + 3] = t;
  20370. p[row + 4] = t;
  20371. p[row + 5] = t;
  20372. p[row + 6] = t;
  20373. p[row + 7] = t;
  20374. continue;
  20375. }
  20376. p1 *= qt[row + 1];
  20377. p2 *= qt[row + 2];
  20378. p3 *= qt[row + 3];
  20379. p4 *= qt[row + 4];
  20380. p5 *= qt[row + 5];
  20381. p6 *= qt[row + 6];
  20382. p7 *= qt[row + 7];
  20383. v0 = dctSqrt2 * p0 + 128 >> 8;
  20384. v1 = dctSqrt2 * p4 + 128 >> 8;
  20385. v2 = p2;
  20386. v3 = p6;
  20387. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  20388. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  20389. v5 = p3 << 4;
  20390. v6 = p5 << 4;
  20391. v0 = v0 + v1 + 1 >> 1;
  20392. v1 = v0 - v1;
  20393. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  20394. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  20395. v3 = t;
  20396. v4 = v4 + v6 + 1 >> 1;
  20397. v6 = v4 - v6;
  20398. v7 = v7 + v5 + 1 >> 1;
  20399. v5 = v7 - v5;
  20400. v0 = v0 + v3 + 1 >> 1;
  20401. v3 = v0 - v3;
  20402. v1 = v1 + v2 + 1 >> 1;
  20403. v2 = v1 - v2;
  20404. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20405. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20406. v7 = t;
  20407. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20408. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20409. v6 = t;
  20410. p[row] = v0 + v7;
  20411. p[row + 7] = v0 - v7;
  20412. p[row + 1] = v1 + v6;
  20413. p[row + 6] = v1 - v6;
  20414. p[row + 2] = v2 + v5;
  20415. p[row + 5] = v2 - v5;
  20416. p[row + 3] = v3 + v4;
  20417. p[row + 4] = v3 - v4;
  20418. }
  20419. for (let col = 0; col < 8; ++col) {
  20420. p0 = p[col];
  20421. p1 = p[col + 8];
  20422. p2 = p[col + 16];
  20423. p3 = p[col + 24];
  20424. p4 = p[col + 32];
  20425. p5 = p[col + 40];
  20426. p6 = p[col + 48];
  20427. p7 = p[col + 56];
  20428. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  20429. t = dctSqrt2 * p0 + 8192 >> 14;
  20430. if (t < -2040) {
  20431. t = 0;
  20432. } else if (t >= 2024) {
  20433. t = 255;
  20434. } else {
  20435. t = t + 2056 >> 4;
  20436. }
  20437. blockData[blockBufferOffset + col] = t;
  20438. blockData[blockBufferOffset + col + 8] = t;
  20439. blockData[blockBufferOffset + col + 16] = t;
  20440. blockData[blockBufferOffset + col + 24] = t;
  20441. blockData[blockBufferOffset + col + 32] = t;
  20442. blockData[blockBufferOffset + col + 40] = t;
  20443. blockData[blockBufferOffset + col + 48] = t;
  20444. blockData[blockBufferOffset + col + 56] = t;
  20445. continue;
  20446. }
  20447. v0 = dctSqrt2 * p0 + 2048 >> 12;
  20448. v1 = dctSqrt2 * p4 + 2048 >> 12;
  20449. v2 = p2;
  20450. v3 = p6;
  20451. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  20452. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  20453. v5 = p3;
  20454. v6 = p5;
  20455. v0 = (v0 + v1 + 1 >> 1) + 4112;
  20456. v1 = v0 - v1;
  20457. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  20458. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  20459. v3 = t;
  20460. v4 = v4 + v6 + 1 >> 1;
  20461. v6 = v4 - v6;
  20462. v7 = v7 + v5 + 1 >> 1;
  20463. v5 = v7 - v5;
  20464. v0 = v0 + v3 + 1 >> 1;
  20465. v3 = v0 - v3;
  20466. v1 = v1 + v2 + 1 >> 1;
  20467. v2 = v1 - v2;
  20468. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  20469. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  20470. v7 = t;
  20471. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  20472. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  20473. v6 = t;
  20474. p0 = v0 + v7;
  20475. p7 = v0 - v7;
  20476. p1 = v1 + v6;
  20477. p6 = v1 - v6;
  20478. p2 = v2 + v5;
  20479. p5 = v2 - v5;
  20480. p3 = v3 + v4;
  20481. p4 = v3 - v4;
  20482. if (p0 < 16) {
  20483. p0 = 0;
  20484. } else if (p0 >= 4080) {
  20485. p0 = 255;
  20486. } else {
  20487. p0 >>= 4;
  20488. }
  20489. if (p1 < 16) {
  20490. p1 = 0;
  20491. } else if (p1 >= 4080) {
  20492. p1 = 255;
  20493. } else {
  20494. p1 >>= 4;
  20495. }
  20496. if (p2 < 16) {
  20497. p2 = 0;
  20498. } else if (p2 >= 4080) {
  20499. p2 = 255;
  20500. } else {
  20501. p2 >>= 4;
  20502. }
  20503. if (p3 < 16) {
  20504. p3 = 0;
  20505. } else if (p3 >= 4080) {
  20506. p3 = 255;
  20507. } else {
  20508. p3 >>= 4;
  20509. }
  20510. if (p4 < 16) {
  20511. p4 = 0;
  20512. } else if (p4 >= 4080) {
  20513. p4 = 255;
  20514. } else {
  20515. p4 >>= 4;
  20516. }
  20517. if (p5 < 16) {
  20518. p5 = 0;
  20519. } else if (p5 >= 4080) {
  20520. p5 = 255;
  20521. } else {
  20522. p5 >>= 4;
  20523. }
  20524. if (p6 < 16) {
  20525. p6 = 0;
  20526. } else if (p6 >= 4080) {
  20527. p6 = 255;
  20528. } else {
  20529. p6 >>= 4;
  20530. }
  20531. if (p7 < 16) {
  20532. p7 = 0;
  20533. } else if (p7 >= 4080) {
  20534. p7 = 255;
  20535. } else {
  20536. p7 >>= 4;
  20537. }
  20538. blockData[blockBufferOffset + col] = p0;
  20539. blockData[blockBufferOffset + col + 8] = p1;
  20540. blockData[blockBufferOffset + col + 16] = p2;
  20541. blockData[blockBufferOffset + col + 24] = p3;
  20542. blockData[blockBufferOffset + col + 32] = p4;
  20543. blockData[blockBufferOffset + col + 40] = p5;
  20544. blockData[blockBufferOffset + col + 48] = p6;
  20545. blockData[blockBufferOffset + col + 56] = p7;
  20546. }
  20547. }
  20548. function buildComponentData(frame, component) {
  20549. const blocksPerLine = component.blocksPerLine;
  20550. const blocksPerColumn = component.blocksPerColumn;
  20551. const computationBuffer = new Int16Array(64);
  20552. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  20553. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  20554. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  20555. quantizeAndInverse(component, offset, computationBuffer);
  20556. }
  20557. }
  20558. return component.blockData;
  20559. }
  20560. function findNextFileMarker(data, currentPos) {
  20561. let startPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentPos;
  20562. const maxPos = data.length - 1;
  20563. let newPos = startPos < currentPos ? startPos : currentPos;
  20564. if (currentPos >= maxPos) {
  20565. return null;
  20566. }
  20567. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  20568. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  20569. return {
  20570. invalid: null,
  20571. marker: currentMarker,
  20572. offset: currentPos
  20573. };
  20574. }
  20575. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  20576. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  20577. if (++newPos >= maxPos) {
  20578. return null;
  20579. }
  20580. newMarker = (0, _core_utils.readUint16)(data, newPos);
  20581. }
  20582. return {
  20583. invalid: currentMarker.toString(16),
  20584. marker: newMarker,
  20585. offset: newPos
  20586. };
  20587. }
  20588. class JpegImage {
  20589. constructor() {
  20590. let {
  20591. decodeTransform = null,
  20592. colorTransform = -1
  20593. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20594. this._decodeTransform = decodeTransform;
  20595. this._colorTransform = colorTransform;
  20596. }
  20597. parse(data) {
  20598. let {
  20599. dnlScanLines = null
  20600. } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20601. function readDataBlock() {
  20602. const length = (0, _core_utils.readUint16)(data, offset);
  20603. offset += 2;
  20604. let endOffset = offset + length - 2;
  20605. const fileMarker = findNextFileMarker(data, endOffset, offset);
  20606. if (fileMarker && fileMarker.invalid) {
  20607. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  20608. endOffset = fileMarker.offset;
  20609. }
  20610. const array = data.subarray(offset, endOffset);
  20611. offset += array.length;
  20612. return array;
  20613. }
  20614. function prepareComponents(frame) {
  20615. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  20616. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  20617. for (const component of frame.components) {
  20618. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  20619. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  20620. const blocksPerLineForMcu = mcusPerLine * component.h;
  20621. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  20622. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  20623. component.blockData = new Int16Array(blocksBufferSize);
  20624. component.blocksPerLine = blocksPerLine;
  20625. component.blocksPerColumn = blocksPerColumn;
  20626. }
  20627. frame.mcusPerLine = mcusPerLine;
  20628. frame.mcusPerColumn = mcusPerColumn;
  20629. }
  20630. let offset = 0;
  20631. let jfif = null;
  20632. let adobe = null;
  20633. let frame, resetInterval;
  20634. let numSOSMarkers = 0;
  20635. const quantizationTables = [];
  20636. const huffmanTablesAC = [],
  20637. huffmanTablesDC = [];
  20638. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  20639. offset += 2;
  20640. if (fileMarker !== 0xffd8) {
  20641. throw new JpegError("SOI not found");
  20642. }
  20643. fileMarker = (0, _core_utils.readUint16)(data, offset);
  20644. offset += 2;
  20645. markerLoop: while (fileMarker !== 0xffd9) {
  20646. let i, j, l;
  20647. switch (fileMarker) {
  20648. case 0xffe0:
  20649. case 0xffe1:
  20650. case 0xffe2:
  20651. case 0xffe3:
  20652. case 0xffe4:
  20653. case 0xffe5:
  20654. case 0xffe6:
  20655. case 0xffe7:
  20656. case 0xffe8:
  20657. case 0xffe9:
  20658. case 0xffea:
  20659. case 0xffeb:
  20660. case 0xffec:
  20661. case 0xffed:
  20662. case 0xffee:
  20663. case 0xffef:
  20664. case 0xfffe:
  20665. const appData = readDataBlock();
  20666. if (fileMarker === 0xffe0) {
  20667. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  20668. jfif = {
  20669. version: {
  20670. major: appData[5],
  20671. minor: appData[6]
  20672. },
  20673. densityUnits: appData[7],
  20674. xDensity: appData[8] << 8 | appData[9],
  20675. yDensity: appData[10] << 8 | appData[11],
  20676. thumbWidth: appData[12],
  20677. thumbHeight: appData[13],
  20678. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  20679. };
  20680. }
  20681. }
  20682. if (fileMarker === 0xffee) {
  20683. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  20684. adobe = {
  20685. version: appData[5] << 8 | appData[6],
  20686. flags0: appData[7] << 8 | appData[8],
  20687. flags1: appData[9] << 8 | appData[10],
  20688. transformCode: appData[11]
  20689. };
  20690. }
  20691. }
  20692. break;
  20693. case 0xffdb:
  20694. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  20695. offset += 2;
  20696. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  20697. let z;
  20698. while (offset < quantizationTablesEnd) {
  20699. const quantizationTableSpec = data[offset++];
  20700. const tableData = new Uint16Array(64);
  20701. if (quantizationTableSpec >> 4 === 0) {
  20702. for (j = 0; j < 64; j++) {
  20703. z = dctZigZag[j];
  20704. tableData[z] = data[offset++];
  20705. }
  20706. } else if (quantizationTableSpec >> 4 === 1) {
  20707. for (j = 0; j < 64; j++) {
  20708. z = dctZigZag[j];
  20709. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  20710. offset += 2;
  20711. }
  20712. } else {
  20713. throw new JpegError("DQT - invalid table spec");
  20714. }
  20715. quantizationTables[quantizationTableSpec & 15] = tableData;
  20716. }
  20717. break;
  20718. case 0xffc0:
  20719. case 0xffc1:
  20720. case 0xffc2:
  20721. if (frame) {
  20722. throw new JpegError("Only single frame JPEGs supported");
  20723. }
  20724. offset += 2;
  20725. frame = {};
  20726. frame.extended = fileMarker === 0xffc1;
  20727. frame.progressive = fileMarker === 0xffc2;
  20728. frame.precision = data[offset++];
  20729. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  20730. offset += 2;
  20731. frame.scanLines = dnlScanLines || sofScanLines;
  20732. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  20733. offset += 2;
  20734. frame.components = [];
  20735. frame.componentIds = {};
  20736. const componentsCount = data[offset++];
  20737. let maxH = 0,
  20738. maxV = 0;
  20739. for (i = 0; i < componentsCount; i++) {
  20740. const componentId = data[offset];
  20741. const h = data[offset + 1] >> 4;
  20742. const v = data[offset + 1] & 15;
  20743. if (maxH < h) {
  20744. maxH = h;
  20745. }
  20746. if (maxV < v) {
  20747. maxV = v;
  20748. }
  20749. const qId = data[offset + 2];
  20750. l = frame.components.push({
  20751. h,
  20752. v,
  20753. quantizationId: qId,
  20754. quantizationTable: null
  20755. });
  20756. frame.componentIds[componentId] = l - 1;
  20757. offset += 3;
  20758. }
  20759. frame.maxH = maxH;
  20760. frame.maxV = maxV;
  20761. prepareComponents(frame);
  20762. break;
  20763. case 0xffc4:
  20764. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  20765. offset += 2;
  20766. for (i = 2; i < huffmanLength;) {
  20767. const huffmanTableSpec = data[offset++];
  20768. const codeLengths = new Uint8Array(16);
  20769. let codeLengthSum = 0;
  20770. for (j = 0; j < 16; j++, offset++) {
  20771. codeLengthSum += codeLengths[j] = data[offset];
  20772. }
  20773. const huffmanValues = new Uint8Array(codeLengthSum);
  20774. for (j = 0; j < codeLengthSum; j++, offset++) {
  20775. huffmanValues[j] = data[offset];
  20776. }
  20777. i += 17 + codeLengthSum;
  20778. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  20779. }
  20780. break;
  20781. case 0xffdd:
  20782. offset += 2;
  20783. resetInterval = (0, _core_utils.readUint16)(data, offset);
  20784. offset += 2;
  20785. break;
  20786. case 0xffda:
  20787. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  20788. offset += 2;
  20789. const selectorsCount = data[offset++],
  20790. components = [];
  20791. for (i = 0; i < selectorsCount; i++) {
  20792. const index = data[offset++];
  20793. const componentIndex = frame.componentIds[index];
  20794. const component = frame.components[componentIndex];
  20795. component.index = index;
  20796. const tableSpec = data[offset++];
  20797. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  20798. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  20799. components.push(component);
  20800. }
  20801. const spectralStart = data[offset++],
  20802. spectralEnd = data[offset++],
  20803. successiveApproximation = data[offset++];
  20804. try {
  20805. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  20806. offset += processed;
  20807. } catch (ex) {
  20808. if (ex instanceof DNLMarkerError) {
  20809. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  20810. return this.parse(data, {
  20811. dnlScanLines: ex.scanLines
  20812. });
  20813. } else if (ex instanceof EOIMarkerError) {
  20814. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  20815. break markerLoop;
  20816. }
  20817. throw ex;
  20818. }
  20819. break;
  20820. case 0xffdc:
  20821. offset += 4;
  20822. break;
  20823. case 0xffff:
  20824. if (data[offset] !== 0xff) {
  20825. offset--;
  20826. }
  20827. break;
  20828. default:
  20829. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  20830. if (nextFileMarker && nextFileMarker.invalid) {
  20831. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  20832. offset = nextFileMarker.offset;
  20833. break;
  20834. }
  20835. if (!nextFileMarker || offset >= data.length - 1) {
  20836. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  20837. break markerLoop;
  20838. }
  20839. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  20840. }
  20841. fileMarker = (0, _core_utils.readUint16)(data, offset);
  20842. offset += 2;
  20843. }
  20844. this.width = frame.samplesPerLine;
  20845. this.height = frame.scanLines;
  20846. this.jfif = jfif;
  20847. this.adobe = adobe;
  20848. this.components = [];
  20849. for (const component of frame.components) {
  20850. const quantizationTable = quantizationTables[component.quantizationId];
  20851. if (quantizationTable) {
  20852. component.quantizationTable = quantizationTable;
  20853. }
  20854. this.components.push({
  20855. index: component.index,
  20856. output: buildComponentData(frame, component),
  20857. scaleX: component.h / frame.maxH,
  20858. scaleY: component.v / frame.maxV,
  20859. blocksPerLine: component.blocksPerLine,
  20860. blocksPerColumn: component.blocksPerColumn
  20861. });
  20862. }
  20863. this.numComponents = this.components.length;
  20864. return undefined;
  20865. }
  20866. _getLinearizedBlockData(width, height) {
  20867. let isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  20868. const scaleX = this.width / width,
  20869. scaleY = this.height / height;
  20870. let component, componentScaleX, componentScaleY, blocksPerScanline;
  20871. let x, y, i, j, k;
  20872. let index;
  20873. let offset = 0;
  20874. let output;
  20875. const numComponents = this.components.length;
  20876. const dataLength = width * height * numComponents;
  20877. const data = new Uint8ClampedArray(dataLength);
  20878. const xScaleBlockOffset = new Uint32Array(width);
  20879. const mask3LSB = 0xfffffff8;
  20880. let lastComponentScaleX;
  20881. for (i = 0; i < numComponents; i++) {
  20882. component = this.components[i];
  20883. componentScaleX = component.scaleX * scaleX;
  20884. componentScaleY = component.scaleY * scaleY;
  20885. offset = i;
  20886. output = component.output;
  20887. blocksPerScanline = component.blocksPerLine + 1 << 3;
  20888. if (componentScaleX !== lastComponentScaleX) {
  20889. for (x = 0; x < width; x++) {
  20890. j = 0 | x * componentScaleX;
  20891. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  20892. }
  20893. lastComponentScaleX = componentScaleX;
  20894. }
  20895. for (y = 0; y < height; y++) {
  20896. j = 0 | y * componentScaleY;
  20897. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  20898. for (x = 0; x < width; x++) {
  20899. data[offset] = output[index + xScaleBlockOffset[x]];
  20900. offset += numComponents;
  20901. }
  20902. }
  20903. }
  20904. let transform = this._decodeTransform;
  20905. if (!isSourcePDF && numComponents === 4 && !transform) {
  20906. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  20907. }
  20908. if (transform) {
  20909. for (i = 0; i < dataLength;) {
  20910. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  20911. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  20912. }
  20913. }
  20914. }
  20915. return data;
  20916. }
  20917. get _isColorConversionNeeded() {
  20918. if (this.adobe) {
  20919. return !!this.adobe.transformCode;
  20920. }
  20921. if (this.numComponents === 3) {
  20922. if (this._colorTransform === 0) {
  20923. return false;
  20924. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  20925. return false;
  20926. }
  20927. return true;
  20928. }
  20929. if (this._colorTransform === 1) {
  20930. return true;
  20931. }
  20932. return false;
  20933. }
  20934. _convertYccToRgb(data) {
  20935. let Y, Cb, Cr;
  20936. for (let i = 0, length = data.length; i < length; i += 3) {
  20937. Y = data[i];
  20938. Cb = data[i + 1];
  20939. Cr = data[i + 2];
  20940. data[i] = Y - 179.456 + 1.402 * Cr;
  20941. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  20942. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  20943. }
  20944. return data;
  20945. }
  20946. _convertYcckToRgb(data) {
  20947. let Y, Cb, Cr, k;
  20948. let offset = 0;
  20949. for (let i = 0, length = data.length; i < length; i += 4) {
  20950. Y = data[i];
  20951. Cb = data[i + 1];
  20952. Cr = data[i + 2];
  20953. k = data[i + 3];
  20954. 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);
  20955. 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);
  20956. 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);
  20957. }
  20958. return data.subarray(0, offset);
  20959. }
  20960. _convertYcckToCmyk(data) {
  20961. let Y, Cb, Cr;
  20962. for (let i = 0, length = data.length; i < length; i += 4) {
  20963. Y = data[i];
  20964. Cb = data[i + 1];
  20965. Cr = data[i + 2];
  20966. data[i] = 434.456 - Y - 1.402 * Cr;
  20967. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  20968. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  20969. }
  20970. return data;
  20971. }
  20972. _convertCmykToRgb(data) {
  20973. let c, m, y, k;
  20974. let offset = 0;
  20975. for (let i = 0, length = data.length; i < length; i += 4) {
  20976. c = data[i];
  20977. m = data[i + 1];
  20978. y = data[i + 2];
  20979. k = data[i + 3];
  20980. 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);
  20981. 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);
  20982. 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);
  20983. }
  20984. return data.subarray(0, offset);
  20985. }
  20986. getData(_ref) {
  20987. let {
  20988. width,
  20989. height,
  20990. forceRGB = false,
  20991. isSourcePDF = false
  20992. } = _ref;
  20993. if (this.numComponents > 4) {
  20994. throw new JpegError("Unsupported color mode");
  20995. }
  20996. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  20997. if (this.numComponents === 1 && forceRGB) {
  20998. const rgbData = new Uint8ClampedArray(data.length * 3);
  20999. let offset = 0;
  21000. for (const grayColor of data) {
  21001. rgbData[offset++] = grayColor;
  21002. rgbData[offset++] = grayColor;
  21003. rgbData[offset++] = grayColor;
  21004. }
  21005. return rgbData;
  21006. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  21007. return this._convertYccToRgb(data);
  21008. } else if (this.numComponents === 4) {
  21009. if (this._isColorConversionNeeded) {
  21010. if (forceRGB) {
  21011. return this._convertYcckToRgb(data);
  21012. }
  21013. return this._convertYcckToCmyk(data);
  21014. } else if (forceRGB) {
  21015. return this._convertCmykToRgb(data);
  21016. }
  21017. }
  21018. return data;
  21019. }
  21020. }
  21021. exports.JpegImage = JpegImage;
  21022. /***/ }),
  21023. /* 158 */
  21024. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21025. "use strict";
  21026. Object.defineProperty(exports, "__esModule", ({
  21027. value: true
  21028. }));
  21029. exports.JpxStream = void 0;
  21030. var _decode_stream = __w_pdfjs_require__(148);
  21031. var _jpx = __w_pdfjs_require__(159);
  21032. var _util = __w_pdfjs_require__(2);
  21033. class JpxStream extends _decode_stream.DecodeStream {
  21034. constructor(stream, maybeLength, params) {
  21035. super(maybeLength);
  21036. this.stream = stream;
  21037. this.dict = stream.dict;
  21038. this.maybeLength = maybeLength;
  21039. this.params = params;
  21040. }
  21041. get bytes() {
  21042. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  21043. }
  21044. ensureBuffer(requested) {}
  21045. readBlock() {
  21046. if (this.eof) {
  21047. return;
  21048. }
  21049. const jpxImage = new _jpx.JpxImage();
  21050. jpxImage.parse(this.bytes);
  21051. const width = jpxImage.width;
  21052. const height = jpxImage.height;
  21053. const componentsCount = jpxImage.componentsCount;
  21054. const tileCount = jpxImage.tiles.length;
  21055. if (tileCount === 1) {
  21056. this.buffer = jpxImage.tiles[0].items;
  21057. } else {
  21058. const data = new Uint8ClampedArray(width * height * componentsCount);
  21059. for (let k = 0; k < tileCount; k++) {
  21060. const tileComponents = jpxImage.tiles[k];
  21061. const tileWidth = tileComponents.width;
  21062. const tileHeight = tileComponents.height;
  21063. const tileLeft = tileComponents.left;
  21064. const tileTop = tileComponents.top;
  21065. const src = tileComponents.items;
  21066. let srcPosition = 0;
  21067. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  21068. const imgRowSize = width * componentsCount;
  21069. const tileRowSize = tileWidth * componentsCount;
  21070. for (let j = 0; j < tileHeight; j++) {
  21071. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  21072. data.set(rowBytes, dataPosition);
  21073. srcPosition += tileRowSize;
  21074. dataPosition += imgRowSize;
  21075. }
  21076. }
  21077. this.buffer = data;
  21078. }
  21079. this.bufferLength = this.buffer.length;
  21080. this.eof = true;
  21081. }
  21082. }
  21083. exports.JpxStream = JpxStream;
  21084. /***/ }),
  21085. /* 159 */
  21086. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21087. "use strict";
  21088. Object.defineProperty(exports, "__esModule", ({
  21089. value: true
  21090. }));
  21091. exports.JpxImage = void 0;
  21092. var _util = __w_pdfjs_require__(2);
  21093. var _core_utils = __w_pdfjs_require__(135);
  21094. var _arithmetic_decoder = __w_pdfjs_require__(155);
  21095. class JpxError extends _util.BaseException {
  21096. constructor(msg) {
  21097. super(`JPX error: ${msg}`, "JpxError");
  21098. }
  21099. }
  21100. const SubbandsGainLog2 = {
  21101. LL: 0,
  21102. LH: 1,
  21103. HL: 1,
  21104. HH: 2
  21105. };
  21106. class JpxImage {
  21107. constructor() {
  21108. this.failOnCorruptedImage = false;
  21109. }
  21110. parse(data) {
  21111. const head = (0, _core_utils.readUint16)(data, 0);
  21112. if (head === 0xff4f) {
  21113. this.parseCodestream(data, 0, data.length);
  21114. return;
  21115. }
  21116. const length = data.length;
  21117. let position = 0;
  21118. while (position < length) {
  21119. let headerSize = 8;
  21120. let lbox = (0, _core_utils.readUint32)(data, position);
  21121. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  21122. position += headerSize;
  21123. if (lbox === 1) {
  21124. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  21125. position += 8;
  21126. headerSize += 8;
  21127. }
  21128. if (lbox === 0) {
  21129. lbox = length - position + headerSize;
  21130. }
  21131. if (lbox < headerSize) {
  21132. throw new JpxError("Invalid box field size");
  21133. }
  21134. const dataLength = lbox - headerSize;
  21135. let jumpDataLength = true;
  21136. switch (tbox) {
  21137. case 0x6a703268:
  21138. jumpDataLength = false;
  21139. break;
  21140. case 0x636f6c72:
  21141. const method = data[position];
  21142. if (method === 1) {
  21143. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  21144. switch (colorspace) {
  21145. case 16:
  21146. case 17:
  21147. case 18:
  21148. break;
  21149. default:
  21150. (0, _util.warn)("Unknown colorspace " + colorspace);
  21151. break;
  21152. }
  21153. } else if (method === 2) {
  21154. (0, _util.info)("ICC profile not supported");
  21155. }
  21156. break;
  21157. case 0x6a703263:
  21158. this.parseCodestream(data, position, position + dataLength);
  21159. break;
  21160. case 0x6a502020:
  21161. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  21162. (0, _util.warn)("Invalid JP2 signature");
  21163. }
  21164. break;
  21165. case 0x6a501a1a:
  21166. case 0x66747970:
  21167. case 0x72726571:
  21168. case 0x72657320:
  21169. case 0x69686472:
  21170. break;
  21171. default:
  21172. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  21173. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  21174. break;
  21175. }
  21176. if (jumpDataLength) {
  21177. position += dataLength;
  21178. }
  21179. }
  21180. }
  21181. parseImageProperties(stream) {
  21182. let newByte = stream.getByte();
  21183. while (newByte >= 0) {
  21184. const oldByte = newByte;
  21185. newByte = stream.getByte();
  21186. const code = oldByte << 8 | newByte;
  21187. if (code === 0xff51) {
  21188. stream.skip(4);
  21189. const Xsiz = stream.getInt32() >>> 0;
  21190. const Ysiz = stream.getInt32() >>> 0;
  21191. const XOsiz = stream.getInt32() >>> 0;
  21192. const YOsiz = stream.getInt32() >>> 0;
  21193. stream.skip(16);
  21194. const Csiz = stream.getUint16();
  21195. this.width = Xsiz - XOsiz;
  21196. this.height = Ysiz - YOsiz;
  21197. this.componentsCount = Csiz;
  21198. this.bitsPerComponent = 8;
  21199. return;
  21200. }
  21201. }
  21202. throw new JpxError("No size marker found in JPX stream");
  21203. }
  21204. parseCodestream(data, start, end) {
  21205. const context = {};
  21206. let doNotRecover = false;
  21207. try {
  21208. let position = start;
  21209. while (position + 1 < end) {
  21210. const code = (0, _core_utils.readUint16)(data, position);
  21211. position += 2;
  21212. let length = 0,
  21213. j,
  21214. sqcd,
  21215. spqcds,
  21216. spqcdSize,
  21217. scalarExpounded,
  21218. tile;
  21219. switch (code) {
  21220. case 0xff4f:
  21221. context.mainHeader = true;
  21222. break;
  21223. case 0xffd9:
  21224. break;
  21225. case 0xff51:
  21226. length = (0, _core_utils.readUint16)(data, position);
  21227. const siz = {};
  21228. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  21229. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  21230. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  21231. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  21232. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  21233. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  21234. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  21235. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  21236. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  21237. siz.Csiz = componentsCount;
  21238. const components = [];
  21239. j = position + 38;
  21240. for (let i = 0; i < componentsCount; i++) {
  21241. const component = {
  21242. precision: (data[j] & 0x7f) + 1,
  21243. isSigned: !!(data[j] & 0x80),
  21244. XRsiz: data[j + 1],
  21245. YRsiz: data[j + 2]
  21246. };
  21247. j += 3;
  21248. calculateComponentDimensions(component, siz);
  21249. components.push(component);
  21250. }
  21251. context.SIZ = siz;
  21252. context.components = components;
  21253. calculateTileGrids(context, components);
  21254. context.QCC = [];
  21255. context.COC = [];
  21256. break;
  21257. case 0xff5c:
  21258. length = (0, _core_utils.readUint16)(data, position);
  21259. const qcd = {};
  21260. j = position + 2;
  21261. sqcd = data[j++];
  21262. switch (sqcd & 0x1f) {
  21263. case 0:
  21264. spqcdSize = 8;
  21265. scalarExpounded = true;
  21266. break;
  21267. case 1:
  21268. spqcdSize = 16;
  21269. scalarExpounded = false;
  21270. break;
  21271. case 2:
  21272. spqcdSize = 16;
  21273. scalarExpounded = true;
  21274. break;
  21275. default:
  21276. throw new Error("Invalid SQcd value " + sqcd);
  21277. }
  21278. qcd.noQuantization = spqcdSize === 8;
  21279. qcd.scalarExpounded = scalarExpounded;
  21280. qcd.guardBits = sqcd >> 5;
  21281. spqcds = [];
  21282. while (j < length + position) {
  21283. const spqcd = {};
  21284. if (spqcdSize === 8) {
  21285. spqcd.epsilon = data[j++] >> 3;
  21286. spqcd.mu = 0;
  21287. } else {
  21288. spqcd.epsilon = data[j] >> 3;
  21289. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21290. j += 2;
  21291. }
  21292. spqcds.push(spqcd);
  21293. }
  21294. qcd.SPqcds = spqcds;
  21295. if (context.mainHeader) {
  21296. context.QCD = qcd;
  21297. } else {
  21298. context.currentTile.QCD = qcd;
  21299. context.currentTile.QCC = [];
  21300. }
  21301. break;
  21302. case 0xff5d:
  21303. length = (0, _core_utils.readUint16)(data, position);
  21304. const qcc = {};
  21305. j = position + 2;
  21306. let cqcc;
  21307. if (context.SIZ.Csiz < 257) {
  21308. cqcc = data[j++];
  21309. } else {
  21310. cqcc = (0, _core_utils.readUint16)(data, j);
  21311. j += 2;
  21312. }
  21313. sqcd = data[j++];
  21314. switch (sqcd & 0x1f) {
  21315. case 0:
  21316. spqcdSize = 8;
  21317. scalarExpounded = true;
  21318. break;
  21319. case 1:
  21320. spqcdSize = 16;
  21321. scalarExpounded = false;
  21322. break;
  21323. case 2:
  21324. spqcdSize = 16;
  21325. scalarExpounded = true;
  21326. break;
  21327. default:
  21328. throw new Error("Invalid SQcd value " + sqcd);
  21329. }
  21330. qcc.noQuantization = spqcdSize === 8;
  21331. qcc.scalarExpounded = scalarExpounded;
  21332. qcc.guardBits = sqcd >> 5;
  21333. spqcds = [];
  21334. while (j < length + position) {
  21335. const spqcd = {};
  21336. if (spqcdSize === 8) {
  21337. spqcd.epsilon = data[j++] >> 3;
  21338. spqcd.mu = 0;
  21339. } else {
  21340. spqcd.epsilon = data[j] >> 3;
  21341. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  21342. j += 2;
  21343. }
  21344. spqcds.push(spqcd);
  21345. }
  21346. qcc.SPqcds = spqcds;
  21347. if (context.mainHeader) {
  21348. context.QCC[cqcc] = qcc;
  21349. } else {
  21350. context.currentTile.QCC[cqcc] = qcc;
  21351. }
  21352. break;
  21353. case 0xff52:
  21354. length = (0, _core_utils.readUint16)(data, position);
  21355. const cod = {};
  21356. j = position + 2;
  21357. const scod = data[j++];
  21358. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  21359. cod.sopMarkerUsed = !!(scod & 2);
  21360. cod.ephMarkerUsed = !!(scod & 4);
  21361. cod.progressionOrder = data[j++];
  21362. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  21363. j += 2;
  21364. cod.multipleComponentTransform = data[j++];
  21365. cod.decompositionLevelsCount = data[j++];
  21366. cod.xcb = (data[j++] & 0xf) + 2;
  21367. cod.ycb = (data[j++] & 0xf) + 2;
  21368. const blockStyle = data[j++];
  21369. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  21370. cod.resetContextProbabilities = !!(blockStyle & 2);
  21371. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  21372. cod.verticallyStripe = !!(blockStyle & 8);
  21373. cod.predictableTermination = !!(blockStyle & 16);
  21374. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  21375. cod.reversibleTransformation = data[j++];
  21376. if (cod.entropyCoderWithCustomPrecincts) {
  21377. const precinctsSizes = [];
  21378. while (j < length + position) {
  21379. const precinctsSize = data[j++];
  21380. precinctsSizes.push({
  21381. PPx: precinctsSize & 0xf,
  21382. PPy: precinctsSize >> 4
  21383. });
  21384. }
  21385. cod.precinctsSizes = precinctsSizes;
  21386. }
  21387. const unsupported = [];
  21388. if (cod.selectiveArithmeticCodingBypass) {
  21389. unsupported.push("selectiveArithmeticCodingBypass");
  21390. }
  21391. if (cod.terminationOnEachCodingPass) {
  21392. unsupported.push("terminationOnEachCodingPass");
  21393. }
  21394. if (cod.verticallyStripe) {
  21395. unsupported.push("verticallyStripe");
  21396. }
  21397. if (cod.predictableTermination) {
  21398. unsupported.push("predictableTermination");
  21399. }
  21400. if (unsupported.length > 0) {
  21401. doNotRecover = true;
  21402. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  21403. }
  21404. if (context.mainHeader) {
  21405. context.COD = cod;
  21406. } else {
  21407. context.currentTile.COD = cod;
  21408. context.currentTile.COC = [];
  21409. }
  21410. break;
  21411. case 0xff90:
  21412. length = (0, _core_utils.readUint16)(data, position);
  21413. tile = {};
  21414. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  21415. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  21416. tile.dataEnd = tile.length + position - 2;
  21417. tile.partIndex = data[position + 8];
  21418. tile.partsCount = data[position + 9];
  21419. context.mainHeader = false;
  21420. if (tile.partIndex === 0) {
  21421. tile.COD = context.COD;
  21422. tile.COC = context.COC.slice(0);
  21423. tile.QCD = context.QCD;
  21424. tile.QCC = context.QCC.slice(0);
  21425. }
  21426. context.currentTile = tile;
  21427. break;
  21428. case 0xff93:
  21429. tile = context.currentTile;
  21430. if (tile.partIndex === 0) {
  21431. initializeTile(context, tile.index);
  21432. buildPackets(context);
  21433. }
  21434. length = tile.dataEnd - position;
  21435. parseTilePackets(context, data, position, length);
  21436. break;
  21437. case 0xff53:
  21438. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  21439. case 0xff55:
  21440. case 0xff57:
  21441. case 0xff58:
  21442. case 0xff64:
  21443. length = (0, _core_utils.readUint16)(data, position);
  21444. break;
  21445. default:
  21446. throw new Error("Unknown codestream code: " + code.toString(16));
  21447. }
  21448. position += length;
  21449. }
  21450. } catch (e) {
  21451. if (doNotRecover || this.failOnCorruptedImage) {
  21452. throw new JpxError(e.message);
  21453. } else {
  21454. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  21455. }
  21456. }
  21457. this.tiles = transformComponents(context);
  21458. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  21459. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  21460. this.componentsCount = context.SIZ.Csiz;
  21461. }
  21462. }
  21463. exports.JpxImage = JpxImage;
  21464. function calculateComponentDimensions(component, siz) {
  21465. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  21466. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  21467. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  21468. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  21469. component.width = component.x1 - component.x0;
  21470. component.height = component.y1 - component.y0;
  21471. }
  21472. function calculateTileGrids(context, components) {
  21473. const siz = context.SIZ;
  21474. const tiles = [];
  21475. let tile;
  21476. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  21477. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  21478. for (let q = 0; q < numYtiles; q++) {
  21479. for (let p = 0; p < numXtiles; p++) {
  21480. tile = {};
  21481. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  21482. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  21483. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  21484. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  21485. tile.width = tile.tx1 - tile.tx0;
  21486. tile.height = tile.ty1 - tile.ty0;
  21487. tile.components = [];
  21488. tiles.push(tile);
  21489. }
  21490. }
  21491. context.tiles = tiles;
  21492. const componentsCount = siz.Csiz;
  21493. for (let i = 0, ii = componentsCount; i < ii; i++) {
  21494. const component = components[i];
  21495. for (let j = 0, jj = tiles.length; j < jj; j++) {
  21496. const tileComponent = {};
  21497. tile = tiles[j];
  21498. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  21499. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  21500. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  21501. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  21502. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  21503. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  21504. tile.components[i] = tileComponent;
  21505. }
  21506. }
  21507. }
  21508. function getBlocksDimensions(context, component, r) {
  21509. const codOrCoc = component.codingStyleParameters;
  21510. const result = {};
  21511. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  21512. result.PPx = 15;
  21513. result.PPy = 15;
  21514. } else {
  21515. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  21516. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  21517. }
  21518. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  21519. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  21520. return result;
  21521. }
  21522. function buildPrecincts(context, resolution, dimensions) {
  21523. const precinctWidth = 1 << dimensions.PPx;
  21524. const precinctHeight = 1 << dimensions.PPy;
  21525. const isZeroRes = resolution.resLevel === 0;
  21526. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  21527. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  21528. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  21529. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  21530. const numprecincts = numprecinctswide * numprecinctshigh;
  21531. resolution.precinctParameters = {
  21532. precinctWidth,
  21533. precinctHeight,
  21534. numprecinctswide,
  21535. numprecinctshigh,
  21536. numprecincts,
  21537. precinctWidthInSubband,
  21538. precinctHeightInSubband
  21539. };
  21540. }
  21541. function buildCodeblocks(context, subband, dimensions) {
  21542. const xcb_ = dimensions.xcb_;
  21543. const ycb_ = dimensions.ycb_;
  21544. const codeblockWidth = 1 << xcb_;
  21545. const codeblockHeight = 1 << ycb_;
  21546. const cbx0 = subband.tbx0 >> xcb_;
  21547. const cby0 = subband.tby0 >> ycb_;
  21548. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  21549. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  21550. const precinctParameters = subband.resolution.precinctParameters;
  21551. const codeblocks = [];
  21552. const precincts = [];
  21553. let i, j, codeblock, precinctNumber;
  21554. for (j = cby0; j < cby1; j++) {
  21555. for (i = cbx0; i < cbx1; i++) {
  21556. codeblock = {
  21557. cbx: i,
  21558. cby: j,
  21559. tbx0: codeblockWidth * i,
  21560. tby0: codeblockHeight * j,
  21561. tbx1: codeblockWidth * (i + 1),
  21562. tby1: codeblockHeight * (j + 1)
  21563. };
  21564. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  21565. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  21566. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  21567. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  21568. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  21569. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  21570. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  21571. codeblock.precinctNumber = precinctNumber;
  21572. codeblock.subbandType = subband.type;
  21573. codeblock.Lblock = 3;
  21574. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  21575. continue;
  21576. }
  21577. codeblocks.push(codeblock);
  21578. let precinct = precincts[precinctNumber];
  21579. if (precinct !== undefined) {
  21580. if (i < precinct.cbxMin) {
  21581. precinct.cbxMin = i;
  21582. } else if (i > precinct.cbxMax) {
  21583. precinct.cbxMax = i;
  21584. }
  21585. if (j < precinct.cbyMin) {
  21586. precinct.cbxMin = j;
  21587. } else if (j > precinct.cbyMax) {
  21588. precinct.cbyMax = j;
  21589. }
  21590. } else {
  21591. precincts[precinctNumber] = precinct = {
  21592. cbxMin: i,
  21593. cbyMin: j,
  21594. cbxMax: i,
  21595. cbyMax: j
  21596. };
  21597. }
  21598. codeblock.precinct = precinct;
  21599. }
  21600. }
  21601. subband.codeblockParameters = {
  21602. codeblockWidth: xcb_,
  21603. codeblockHeight: ycb_,
  21604. numcodeblockwide: cbx1 - cbx0 + 1,
  21605. numcodeblockhigh: cby1 - cby0 + 1
  21606. };
  21607. subband.codeblocks = codeblocks;
  21608. subband.precincts = precincts;
  21609. }
  21610. function createPacket(resolution, precinctNumber, layerNumber) {
  21611. const precinctCodeblocks = [];
  21612. const subbands = resolution.subbands;
  21613. for (let i = 0, ii = subbands.length; i < ii; i++) {
  21614. const subband = subbands[i];
  21615. const codeblocks = subband.codeblocks;
  21616. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  21617. const codeblock = codeblocks[j];
  21618. if (codeblock.precinctNumber !== precinctNumber) {
  21619. continue;
  21620. }
  21621. precinctCodeblocks.push(codeblock);
  21622. }
  21623. }
  21624. return {
  21625. layerNumber,
  21626. codeblocks: precinctCodeblocks
  21627. };
  21628. }
  21629. function LayerResolutionComponentPositionIterator(context) {
  21630. const siz = context.SIZ;
  21631. const tileIndex = context.currentTile.index;
  21632. const tile = context.tiles[tileIndex];
  21633. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21634. const componentsCount = siz.Csiz;
  21635. let maxDecompositionLevelsCount = 0;
  21636. for (let q = 0; q < componentsCount; q++) {
  21637. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  21638. }
  21639. let l = 0,
  21640. r = 0,
  21641. i = 0,
  21642. k = 0;
  21643. this.nextPacket = function JpxImage_nextPacket() {
  21644. for (; l < layersCount; l++) {
  21645. for (; r <= maxDecompositionLevelsCount; r++) {
  21646. for (; i < componentsCount; i++) {
  21647. const component = tile.components[i];
  21648. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  21649. continue;
  21650. }
  21651. const resolution = component.resolutions[r];
  21652. const numprecincts = resolution.precinctParameters.numprecincts;
  21653. for (; k < numprecincts;) {
  21654. const packet = createPacket(resolution, k, l);
  21655. k++;
  21656. return packet;
  21657. }
  21658. k = 0;
  21659. }
  21660. i = 0;
  21661. }
  21662. r = 0;
  21663. }
  21664. throw new JpxError("Out of packets");
  21665. };
  21666. }
  21667. function ResolutionLayerComponentPositionIterator(context) {
  21668. const siz = context.SIZ;
  21669. const tileIndex = context.currentTile.index;
  21670. const tile = context.tiles[tileIndex];
  21671. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21672. const componentsCount = siz.Csiz;
  21673. let maxDecompositionLevelsCount = 0;
  21674. for (let q = 0; q < componentsCount; q++) {
  21675. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  21676. }
  21677. let r = 0,
  21678. l = 0,
  21679. i = 0,
  21680. k = 0;
  21681. this.nextPacket = function JpxImage_nextPacket() {
  21682. for (; r <= maxDecompositionLevelsCount; r++) {
  21683. for (; l < layersCount; l++) {
  21684. for (; i < componentsCount; i++) {
  21685. const component = tile.components[i];
  21686. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  21687. continue;
  21688. }
  21689. const resolution = component.resolutions[r];
  21690. const numprecincts = resolution.precinctParameters.numprecincts;
  21691. for (; k < numprecincts;) {
  21692. const packet = createPacket(resolution, k, l);
  21693. k++;
  21694. return packet;
  21695. }
  21696. k = 0;
  21697. }
  21698. i = 0;
  21699. }
  21700. l = 0;
  21701. }
  21702. throw new JpxError("Out of packets");
  21703. };
  21704. }
  21705. function ResolutionPositionComponentLayerIterator(context) {
  21706. const siz = context.SIZ;
  21707. const tileIndex = context.currentTile.index;
  21708. const tile = context.tiles[tileIndex];
  21709. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21710. const componentsCount = siz.Csiz;
  21711. let l, r, c, p;
  21712. let maxDecompositionLevelsCount = 0;
  21713. for (c = 0; c < componentsCount; c++) {
  21714. const component = tile.components[c];
  21715. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  21716. }
  21717. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  21718. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  21719. let maxNumPrecincts = 0;
  21720. for (c = 0; c < componentsCount; ++c) {
  21721. const resolutions = tile.components[c].resolutions;
  21722. if (r < resolutions.length) {
  21723. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  21724. }
  21725. }
  21726. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  21727. }
  21728. l = 0;
  21729. r = 0;
  21730. c = 0;
  21731. p = 0;
  21732. this.nextPacket = function JpxImage_nextPacket() {
  21733. for (; r <= maxDecompositionLevelsCount; r++) {
  21734. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  21735. for (; c < componentsCount; c++) {
  21736. const component = tile.components[c];
  21737. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  21738. continue;
  21739. }
  21740. const resolution = component.resolutions[r];
  21741. const numprecincts = resolution.precinctParameters.numprecincts;
  21742. if (p >= numprecincts) {
  21743. continue;
  21744. }
  21745. for (; l < layersCount;) {
  21746. const packet = createPacket(resolution, p, l);
  21747. l++;
  21748. return packet;
  21749. }
  21750. l = 0;
  21751. }
  21752. c = 0;
  21753. }
  21754. p = 0;
  21755. }
  21756. throw new JpxError("Out of packets");
  21757. };
  21758. }
  21759. function PositionComponentResolutionLayerIterator(context) {
  21760. const siz = context.SIZ;
  21761. const tileIndex = context.currentTile.index;
  21762. const tile = context.tiles[tileIndex];
  21763. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21764. const componentsCount = siz.Csiz;
  21765. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  21766. const precinctsIterationSizes = precinctsSizes;
  21767. let l = 0,
  21768. r = 0,
  21769. c = 0,
  21770. px = 0,
  21771. py = 0;
  21772. this.nextPacket = function JpxImage_nextPacket() {
  21773. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  21774. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  21775. for (; c < componentsCount; c++) {
  21776. const component = tile.components[c];
  21777. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  21778. for (; r <= decompositionLevelsCount; r++) {
  21779. const resolution = component.resolutions[r];
  21780. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  21781. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  21782. if (k === null) {
  21783. continue;
  21784. }
  21785. for (; l < layersCount;) {
  21786. const packet = createPacket(resolution, k, l);
  21787. l++;
  21788. return packet;
  21789. }
  21790. l = 0;
  21791. }
  21792. r = 0;
  21793. }
  21794. c = 0;
  21795. }
  21796. px = 0;
  21797. }
  21798. throw new JpxError("Out of packets");
  21799. };
  21800. }
  21801. function ComponentPositionResolutionLayerIterator(context) {
  21802. const siz = context.SIZ;
  21803. const tileIndex = context.currentTile.index;
  21804. const tile = context.tiles[tileIndex];
  21805. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  21806. const componentsCount = siz.Csiz;
  21807. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  21808. let l = 0,
  21809. r = 0,
  21810. c = 0,
  21811. px = 0,
  21812. py = 0;
  21813. this.nextPacket = function JpxImage_nextPacket() {
  21814. for (; c < componentsCount; ++c) {
  21815. const component = tile.components[c];
  21816. const precinctsIterationSizes = precinctsSizes.components[c];
  21817. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  21818. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  21819. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  21820. for (; r <= decompositionLevelsCount; r++) {
  21821. const resolution = component.resolutions[r];
  21822. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  21823. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  21824. if (k === null) {
  21825. continue;
  21826. }
  21827. for (; l < layersCount;) {
  21828. const packet = createPacket(resolution, k, l);
  21829. l++;
  21830. return packet;
  21831. }
  21832. l = 0;
  21833. }
  21834. r = 0;
  21835. }
  21836. px = 0;
  21837. }
  21838. py = 0;
  21839. }
  21840. throw new JpxError("Out of packets");
  21841. };
  21842. }
  21843. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  21844. const posX = pxIndex * precinctIterationSizes.minWidth;
  21845. const posY = pyIndex * precinctIterationSizes.minHeight;
  21846. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  21847. return null;
  21848. }
  21849. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  21850. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  21851. }
  21852. function getPrecinctSizesInImageScale(tile) {
  21853. const componentsCount = tile.components.length;
  21854. let minWidth = Number.MAX_VALUE;
  21855. let minHeight = Number.MAX_VALUE;
  21856. let maxNumWide = 0;
  21857. let maxNumHigh = 0;
  21858. const sizePerComponent = new Array(componentsCount);
  21859. for (let c = 0; c < componentsCount; c++) {
  21860. const component = tile.components[c];
  21861. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  21862. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  21863. let minWidthCurrentComponent = Number.MAX_VALUE;
  21864. let minHeightCurrentComponent = Number.MAX_VALUE;
  21865. let maxNumWideCurrentComponent = 0;
  21866. let maxNumHighCurrentComponent = 0;
  21867. let scale = 1;
  21868. for (let r = decompositionLevelsCount; r >= 0; --r) {
  21869. const resolution = component.resolutions[r];
  21870. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  21871. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  21872. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  21873. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  21874. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  21875. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  21876. sizePerResolution[r] = {
  21877. width: widthCurrentResolution,
  21878. height: heightCurrentResolution
  21879. };
  21880. scale <<= 1;
  21881. }
  21882. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  21883. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  21884. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  21885. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  21886. sizePerComponent[c] = {
  21887. resolutions: sizePerResolution,
  21888. minWidth: minWidthCurrentComponent,
  21889. minHeight: minHeightCurrentComponent,
  21890. maxNumWide: maxNumWideCurrentComponent,
  21891. maxNumHigh: maxNumHighCurrentComponent
  21892. };
  21893. }
  21894. return {
  21895. components: sizePerComponent,
  21896. minWidth,
  21897. minHeight,
  21898. maxNumWide,
  21899. maxNumHigh
  21900. };
  21901. }
  21902. function buildPackets(context) {
  21903. const siz = context.SIZ;
  21904. const tileIndex = context.currentTile.index;
  21905. const tile = context.tiles[tileIndex];
  21906. const componentsCount = siz.Csiz;
  21907. for (let c = 0; c < componentsCount; c++) {
  21908. const component = tile.components[c];
  21909. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  21910. const resolutions = [];
  21911. const subbands = [];
  21912. for (let r = 0; r <= decompositionLevelsCount; r++) {
  21913. const blocksDimensions = getBlocksDimensions(context, component, r);
  21914. const resolution = {};
  21915. const scale = 1 << decompositionLevelsCount - r;
  21916. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  21917. resolution.try0 = Math.ceil(component.tcy0 / scale);
  21918. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  21919. resolution.try1 = Math.ceil(component.tcy1 / scale);
  21920. resolution.resLevel = r;
  21921. buildPrecincts(context, resolution, blocksDimensions);
  21922. resolutions.push(resolution);
  21923. let subband;
  21924. if (r === 0) {
  21925. subband = {};
  21926. subband.type = "LL";
  21927. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  21928. subband.tby0 = Math.ceil(component.tcy0 / scale);
  21929. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  21930. subband.tby1 = Math.ceil(component.tcy1 / scale);
  21931. subband.resolution = resolution;
  21932. buildCodeblocks(context, subband, blocksDimensions);
  21933. subbands.push(subband);
  21934. resolution.subbands = [subband];
  21935. } else {
  21936. const bscale = 1 << decompositionLevelsCount - r + 1;
  21937. const resolutionSubbands = [];
  21938. subband = {};
  21939. subband.type = "HL";
  21940. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  21941. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  21942. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  21943. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  21944. subband.resolution = resolution;
  21945. buildCodeblocks(context, subband, blocksDimensions);
  21946. subbands.push(subband);
  21947. resolutionSubbands.push(subband);
  21948. subband = {};
  21949. subband.type = "LH";
  21950. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  21951. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  21952. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  21953. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  21954. subband.resolution = resolution;
  21955. buildCodeblocks(context, subband, blocksDimensions);
  21956. subbands.push(subband);
  21957. resolutionSubbands.push(subband);
  21958. subband = {};
  21959. subband.type = "HH";
  21960. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  21961. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  21962. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  21963. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  21964. subband.resolution = resolution;
  21965. buildCodeblocks(context, subband, blocksDimensions);
  21966. subbands.push(subband);
  21967. resolutionSubbands.push(subband);
  21968. resolution.subbands = resolutionSubbands;
  21969. }
  21970. }
  21971. component.resolutions = resolutions;
  21972. component.subbands = subbands;
  21973. }
  21974. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  21975. switch (progressionOrder) {
  21976. case 0:
  21977. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  21978. break;
  21979. case 1:
  21980. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  21981. break;
  21982. case 2:
  21983. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  21984. break;
  21985. case 3:
  21986. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  21987. break;
  21988. case 4:
  21989. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  21990. break;
  21991. default:
  21992. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  21993. }
  21994. }
  21995. function parseTilePackets(context, data, offset, dataLength) {
  21996. let position = 0;
  21997. let buffer,
  21998. bufferSize = 0,
  21999. skipNextBit = false;
  22000. function readBits(count) {
  22001. while (bufferSize < count) {
  22002. const b = data[offset + position];
  22003. position++;
  22004. if (skipNextBit) {
  22005. buffer = buffer << 7 | b;
  22006. bufferSize += 7;
  22007. skipNextBit = false;
  22008. } else {
  22009. buffer = buffer << 8 | b;
  22010. bufferSize += 8;
  22011. }
  22012. if (b === 0xff) {
  22013. skipNextBit = true;
  22014. }
  22015. }
  22016. bufferSize -= count;
  22017. return buffer >>> bufferSize & (1 << count) - 1;
  22018. }
  22019. function skipMarkerIfEqual(value) {
  22020. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  22021. skipBytes(1);
  22022. return true;
  22023. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  22024. skipBytes(2);
  22025. return true;
  22026. }
  22027. return false;
  22028. }
  22029. function skipBytes(count) {
  22030. position += count;
  22031. }
  22032. function alignToByte() {
  22033. bufferSize = 0;
  22034. if (skipNextBit) {
  22035. position++;
  22036. skipNextBit = false;
  22037. }
  22038. }
  22039. function readCodingpasses() {
  22040. if (readBits(1) === 0) {
  22041. return 1;
  22042. }
  22043. if (readBits(1) === 0) {
  22044. return 2;
  22045. }
  22046. let value = readBits(2);
  22047. if (value < 3) {
  22048. return value + 3;
  22049. }
  22050. value = readBits(5);
  22051. if (value < 31) {
  22052. return value + 6;
  22053. }
  22054. value = readBits(7);
  22055. return value + 37;
  22056. }
  22057. const tileIndex = context.currentTile.index;
  22058. const tile = context.tiles[tileIndex];
  22059. const sopMarkerUsed = context.COD.sopMarkerUsed;
  22060. const ephMarkerUsed = context.COD.ephMarkerUsed;
  22061. const packetsIterator = tile.packetsIterator;
  22062. while (position < dataLength) {
  22063. alignToByte();
  22064. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  22065. skipBytes(4);
  22066. }
  22067. const packet = packetsIterator.nextPacket();
  22068. if (!readBits(1)) {
  22069. continue;
  22070. }
  22071. const layerNumber = packet.layerNumber,
  22072. queue = [];
  22073. let codeblock;
  22074. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  22075. codeblock = packet.codeblocks[i];
  22076. let precinct = codeblock.precinct;
  22077. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  22078. const codeblockRow = codeblock.cby - precinct.cbyMin;
  22079. let codeblockIncluded = false;
  22080. let firstTimeInclusion = false;
  22081. let valueReady, zeroBitPlanesTree;
  22082. if (codeblock.included !== undefined) {
  22083. codeblockIncluded = !!readBits(1);
  22084. } else {
  22085. precinct = codeblock.precinct;
  22086. let inclusionTree;
  22087. if (precinct.inclusionTree !== undefined) {
  22088. inclusionTree = precinct.inclusionTree;
  22089. } else {
  22090. const width = precinct.cbxMax - precinct.cbxMin + 1;
  22091. const height = precinct.cbyMax - precinct.cbyMin + 1;
  22092. inclusionTree = new InclusionTree(width, height, layerNumber);
  22093. zeroBitPlanesTree = new TagTree(width, height);
  22094. precinct.inclusionTree = inclusionTree;
  22095. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  22096. for (let l = 0; l < layerNumber; l++) {
  22097. if (readBits(1) !== 0) {
  22098. throw new JpxError("Invalid tag tree");
  22099. }
  22100. }
  22101. }
  22102. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  22103. while (true) {
  22104. if (readBits(1)) {
  22105. valueReady = !inclusionTree.nextLevel();
  22106. if (valueReady) {
  22107. codeblock.included = true;
  22108. codeblockIncluded = firstTimeInclusion = true;
  22109. break;
  22110. }
  22111. } else {
  22112. inclusionTree.incrementValue(layerNumber);
  22113. break;
  22114. }
  22115. }
  22116. }
  22117. }
  22118. if (!codeblockIncluded) {
  22119. continue;
  22120. }
  22121. if (firstTimeInclusion) {
  22122. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  22123. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  22124. while (true) {
  22125. if (readBits(1)) {
  22126. valueReady = !zeroBitPlanesTree.nextLevel();
  22127. if (valueReady) {
  22128. break;
  22129. }
  22130. } else {
  22131. zeroBitPlanesTree.incrementValue();
  22132. }
  22133. }
  22134. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  22135. }
  22136. const codingpasses = readCodingpasses();
  22137. while (readBits(1)) {
  22138. codeblock.Lblock++;
  22139. }
  22140. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  22141. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  22142. const codedDataLength = readBits(bits);
  22143. queue.push({
  22144. codeblock,
  22145. codingpasses,
  22146. dataLength: codedDataLength
  22147. });
  22148. }
  22149. alignToByte();
  22150. if (ephMarkerUsed) {
  22151. skipMarkerIfEqual(0x92);
  22152. }
  22153. while (queue.length > 0) {
  22154. const packetItem = queue.shift();
  22155. codeblock = packetItem.codeblock;
  22156. if (codeblock.data === undefined) {
  22157. codeblock.data = [];
  22158. }
  22159. codeblock.data.push({
  22160. data,
  22161. start: offset + position,
  22162. end: offset + position + packetItem.dataLength,
  22163. codingpasses: packetItem.codingpasses
  22164. });
  22165. position += packetItem.dataLength;
  22166. }
  22167. }
  22168. return position;
  22169. }
  22170. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  22171. const x0 = subband.tbx0;
  22172. const y0 = subband.tby0;
  22173. const width = subband.tbx1 - subband.tbx0;
  22174. const codeblocks = subband.codeblocks;
  22175. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  22176. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  22177. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  22178. const codeblock = codeblocks[i];
  22179. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  22180. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  22181. if (blockWidth === 0 || blockHeight === 0) {
  22182. continue;
  22183. }
  22184. if (codeblock.data === undefined) {
  22185. continue;
  22186. }
  22187. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  22188. let currentCodingpassType = 2;
  22189. const data = codeblock.data;
  22190. let totalLength = 0,
  22191. codingpasses = 0;
  22192. let j, jj, dataItem;
  22193. for (j = 0, jj = data.length; j < jj; j++) {
  22194. dataItem = data[j];
  22195. totalLength += dataItem.end - dataItem.start;
  22196. codingpasses += dataItem.codingpasses;
  22197. }
  22198. const encodedData = new Uint8Array(totalLength);
  22199. let position = 0;
  22200. for (j = 0, jj = data.length; j < jj; j++) {
  22201. dataItem = data[j];
  22202. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  22203. encodedData.set(chunk, position);
  22204. position += chunk.length;
  22205. }
  22206. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  22207. bitModel.setDecoder(decoder);
  22208. for (j = 0; j < codingpasses; j++) {
  22209. switch (currentCodingpassType) {
  22210. case 0:
  22211. bitModel.runSignificancePropagationPass();
  22212. break;
  22213. case 1:
  22214. bitModel.runMagnitudeRefinementPass();
  22215. break;
  22216. case 2:
  22217. bitModel.runCleanupPass();
  22218. if (segmentationSymbolUsed) {
  22219. bitModel.checkSegmentationSymbol();
  22220. }
  22221. break;
  22222. }
  22223. if (resetContextProbabilities) {
  22224. bitModel.reset();
  22225. }
  22226. currentCodingpassType = (currentCodingpassType + 1) % 3;
  22227. }
  22228. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  22229. const sign = bitModel.coefficentsSign;
  22230. const magnitude = bitModel.coefficentsMagnitude;
  22231. const bitsDecoded = bitModel.bitsDecoded;
  22232. const magnitudeCorrection = reversible ? 0 : 0.5;
  22233. let k, n, nb;
  22234. position = 0;
  22235. const interleave = subband.type !== "LL";
  22236. for (j = 0; j < blockHeight; j++) {
  22237. const row = offset / width | 0;
  22238. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  22239. for (k = 0; k < blockWidth; k++) {
  22240. n = magnitude[position];
  22241. if (n !== 0) {
  22242. n = (n + magnitudeCorrection) * delta;
  22243. if (sign[position] !== 0) {
  22244. n = -n;
  22245. }
  22246. nb = bitsDecoded[position];
  22247. const pos = interleave ? levelOffset + (offset << 1) : offset;
  22248. if (reversible && nb >= mb) {
  22249. coefficients[pos] = n;
  22250. } else {
  22251. coefficients[pos] = n * (1 << mb - nb);
  22252. }
  22253. }
  22254. offset++;
  22255. position++;
  22256. }
  22257. offset += width - blockWidth;
  22258. }
  22259. }
  22260. }
  22261. function transformTile(context, tile, c) {
  22262. const component = tile.components[c];
  22263. const codingStyleParameters = component.codingStyleParameters;
  22264. const quantizationParameters = component.quantizationParameters;
  22265. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  22266. const spqcds = quantizationParameters.SPqcds;
  22267. const scalarExpounded = quantizationParameters.scalarExpounded;
  22268. const guardBits = quantizationParameters.guardBits;
  22269. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  22270. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  22271. const precision = context.components[c].precision;
  22272. const reversible = codingStyleParameters.reversibleTransformation;
  22273. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  22274. const subbandCoefficients = [];
  22275. let b = 0;
  22276. for (let i = 0; i <= decompositionLevelsCount; i++) {
  22277. const resolution = component.resolutions[i];
  22278. const width = resolution.trx1 - resolution.trx0;
  22279. const height = resolution.try1 - resolution.try0;
  22280. const coefficients = new Float32Array(width * height);
  22281. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  22282. let mu, epsilon;
  22283. if (!scalarExpounded) {
  22284. mu = spqcds[0].mu;
  22285. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  22286. } else {
  22287. mu = spqcds[b].mu;
  22288. epsilon = spqcds[b].epsilon;
  22289. b++;
  22290. }
  22291. const subband = resolution.subbands[j];
  22292. const gainLog2 = SubbandsGainLog2[subband.type];
  22293. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  22294. const mb = guardBits + epsilon - 1;
  22295. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  22296. }
  22297. subbandCoefficients.push({
  22298. width,
  22299. height,
  22300. items: coefficients
  22301. });
  22302. }
  22303. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  22304. return {
  22305. left: component.tcx0,
  22306. top: component.tcy0,
  22307. width: result.width,
  22308. height: result.height,
  22309. items: result.items
  22310. };
  22311. }
  22312. function transformComponents(context) {
  22313. const siz = context.SIZ;
  22314. const components = context.components;
  22315. const componentsCount = siz.Csiz;
  22316. const resultImages = [];
  22317. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  22318. const tile = context.tiles[i];
  22319. const transformedTiles = [];
  22320. for (let c = 0; c < componentsCount; c++) {
  22321. transformedTiles[c] = transformTile(context, tile, c);
  22322. }
  22323. const tile0 = transformedTiles[0];
  22324. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  22325. const result = {
  22326. left: tile0.left,
  22327. top: tile0.top,
  22328. width: tile0.width,
  22329. height: tile0.height,
  22330. items: out
  22331. };
  22332. let shift, offset;
  22333. let pos = 0,
  22334. j,
  22335. jj,
  22336. y0,
  22337. y1,
  22338. y2;
  22339. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  22340. const fourComponents = componentsCount === 4;
  22341. const y0items = transformedTiles[0].items;
  22342. const y1items = transformedTiles[1].items;
  22343. const y2items = transformedTiles[2].items;
  22344. const y3items = fourComponents ? transformedTiles[3].items : null;
  22345. shift = components[0].precision - 8;
  22346. offset = (128 << shift) + 0.5;
  22347. const component0 = tile.components[0];
  22348. const alpha01 = componentsCount - 3;
  22349. jj = y0items.length;
  22350. if (!component0.codingStyleParameters.reversibleTransformation) {
  22351. for (j = 0; j < jj; j++, pos += alpha01) {
  22352. y0 = y0items[j] + offset;
  22353. y1 = y1items[j];
  22354. y2 = y2items[j];
  22355. out[pos++] = y0 + 1.402 * y2 >> shift;
  22356. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  22357. out[pos++] = y0 + 1.772 * y1 >> shift;
  22358. }
  22359. } else {
  22360. for (j = 0; j < jj; j++, pos += alpha01) {
  22361. y0 = y0items[j] + offset;
  22362. y1 = y1items[j];
  22363. y2 = y2items[j];
  22364. const g = y0 - (y2 + y1 >> 2);
  22365. out[pos++] = g + y2 >> shift;
  22366. out[pos++] = g >> shift;
  22367. out[pos++] = g + y1 >> shift;
  22368. }
  22369. }
  22370. if (fourComponents) {
  22371. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  22372. out[pos] = y3items[j] + offset >> shift;
  22373. }
  22374. }
  22375. } else {
  22376. for (let c = 0; c < componentsCount; c++) {
  22377. const items = transformedTiles[c].items;
  22378. shift = components[c].precision - 8;
  22379. offset = (128 << shift) + 0.5;
  22380. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  22381. out[pos] = items[j] + offset >> shift;
  22382. pos += componentsCount;
  22383. }
  22384. }
  22385. }
  22386. resultImages.push(result);
  22387. }
  22388. return resultImages;
  22389. }
  22390. function initializeTile(context, tileIndex) {
  22391. const siz = context.SIZ;
  22392. const componentsCount = siz.Csiz;
  22393. const tile = context.tiles[tileIndex];
  22394. for (let c = 0; c < componentsCount; c++) {
  22395. const component = tile.components[c];
  22396. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  22397. component.quantizationParameters = qcdOrQcc;
  22398. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  22399. component.codingStyleParameters = codOrCoc;
  22400. }
  22401. tile.codingStyleDefaultParameters = context.currentTile.COD;
  22402. }
  22403. class TagTree {
  22404. constructor(width, height) {
  22405. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22406. this.levels = [];
  22407. for (let i = 0; i < levelsLength; i++) {
  22408. const level = {
  22409. width,
  22410. height,
  22411. items: []
  22412. };
  22413. this.levels.push(level);
  22414. width = Math.ceil(width / 2);
  22415. height = Math.ceil(height / 2);
  22416. }
  22417. }
  22418. reset(i, j) {
  22419. let currentLevel = 0,
  22420. value = 0,
  22421. level;
  22422. while (currentLevel < this.levels.length) {
  22423. level = this.levels[currentLevel];
  22424. const index = i + j * level.width;
  22425. if (level.items[index] !== undefined) {
  22426. value = level.items[index];
  22427. break;
  22428. }
  22429. level.index = index;
  22430. i >>= 1;
  22431. j >>= 1;
  22432. currentLevel++;
  22433. }
  22434. currentLevel--;
  22435. level = this.levels[currentLevel];
  22436. level.items[level.index] = value;
  22437. this.currentLevel = currentLevel;
  22438. delete this.value;
  22439. }
  22440. incrementValue() {
  22441. const level = this.levels[this.currentLevel];
  22442. level.items[level.index]++;
  22443. }
  22444. nextLevel() {
  22445. let currentLevel = this.currentLevel;
  22446. let level = this.levels[currentLevel];
  22447. const value = level.items[level.index];
  22448. currentLevel--;
  22449. if (currentLevel < 0) {
  22450. this.value = value;
  22451. return false;
  22452. }
  22453. this.currentLevel = currentLevel;
  22454. level = this.levels[currentLevel];
  22455. level.items[level.index] = value;
  22456. return true;
  22457. }
  22458. }
  22459. class InclusionTree {
  22460. constructor(width, height, defaultValue) {
  22461. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  22462. this.levels = [];
  22463. for (let i = 0; i < levelsLength; i++) {
  22464. const items = new Uint8Array(width * height);
  22465. for (let j = 0, jj = items.length; j < jj; j++) {
  22466. items[j] = defaultValue;
  22467. }
  22468. const level = {
  22469. width,
  22470. height,
  22471. items
  22472. };
  22473. this.levels.push(level);
  22474. width = Math.ceil(width / 2);
  22475. height = Math.ceil(height / 2);
  22476. }
  22477. }
  22478. reset(i, j, stopValue) {
  22479. let currentLevel = 0;
  22480. while (currentLevel < this.levels.length) {
  22481. const level = this.levels[currentLevel];
  22482. const index = i + j * level.width;
  22483. level.index = index;
  22484. const value = level.items[index];
  22485. if (value === 0xff) {
  22486. break;
  22487. }
  22488. if (value > stopValue) {
  22489. this.currentLevel = currentLevel;
  22490. this.propagateValues();
  22491. return false;
  22492. }
  22493. i >>= 1;
  22494. j >>= 1;
  22495. currentLevel++;
  22496. }
  22497. this.currentLevel = currentLevel - 1;
  22498. return true;
  22499. }
  22500. incrementValue(stopValue) {
  22501. const level = this.levels[this.currentLevel];
  22502. level.items[level.index] = stopValue + 1;
  22503. this.propagateValues();
  22504. }
  22505. propagateValues() {
  22506. let levelIndex = this.currentLevel;
  22507. let level = this.levels[levelIndex];
  22508. const currentValue = level.items[level.index];
  22509. while (--levelIndex >= 0) {
  22510. level = this.levels[levelIndex];
  22511. level.items[level.index] = currentValue;
  22512. }
  22513. }
  22514. nextLevel() {
  22515. let currentLevel = this.currentLevel;
  22516. let level = this.levels[currentLevel];
  22517. const value = level.items[level.index];
  22518. level.items[level.index] = 0xff;
  22519. currentLevel--;
  22520. if (currentLevel < 0) {
  22521. return false;
  22522. }
  22523. this.currentLevel = currentLevel;
  22524. level = this.levels[currentLevel];
  22525. level.items[level.index] = value;
  22526. return true;
  22527. }
  22528. }
  22529. const BitModel = function BitModelClosure() {
  22530. const UNIFORM_CONTEXT = 17;
  22531. const RUNLENGTH_CONTEXT = 18;
  22532. 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]);
  22533. 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]);
  22534. 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]);
  22535. class BitModel {
  22536. constructor(width, height, subband, zeroBitPlanes, mb) {
  22537. this.width = width;
  22538. this.height = height;
  22539. let contextLabelTable;
  22540. if (subband === "HH") {
  22541. contextLabelTable = HHContextLabel;
  22542. } else if (subband === "HL") {
  22543. contextLabelTable = HLContextLabel;
  22544. } else {
  22545. contextLabelTable = LLAndLHContextsLabel;
  22546. }
  22547. this.contextLabelTable = contextLabelTable;
  22548. const coefficientCount = width * height;
  22549. this.neighborsSignificance = new Uint8Array(coefficientCount);
  22550. this.coefficentsSign = new Uint8Array(coefficientCount);
  22551. let coefficentsMagnitude;
  22552. if (mb > 14) {
  22553. coefficentsMagnitude = new Uint32Array(coefficientCount);
  22554. } else if (mb > 6) {
  22555. coefficentsMagnitude = new Uint16Array(coefficientCount);
  22556. } else {
  22557. coefficentsMagnitude = new Uint8Array(coefficientCount);
  22558. }
  22559. this.coefficentsMagnitude = coefficentsMagnitude;
  22560. this.processingFlags = new Uint8Array(coefficientCount);
  22561. const bitsDecoded = new Uint8Array(coefficientCount);
  22562. if (zeroBitPlanes !== 0) {
  22563. for (let i = 0; i < coefficientCount; i++) {
  22564. bitsDecoded[i] = zeroBitPlanes;
  22565. }
  22566. }
  22567. this.bitsDecoded = bitsDecoded;
  22568. this.reset();
  22569. }
  22570. setDecoder(decoder) {
  22571. this.decoder = decoder;
  22572. }
  22573. reset() {
  22574. this.contexts = new Int8Array(19);
  22575. this.contexts[0] = 4 << 1 | 0;
  22576. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  22577. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  22578. }
  22579. setNeighborsSignificance(row, column, index) {
  22580. const neighborsSignificance = this.neighborsSignificance;
  22581. const width = this.width,
  22582. height = this.height;
  22583. const left = column > 0;
  22584. const right = column + 1 < width;
  22585. let i;
  22586. if (row > 0) {
  22587. i = index - width;
  22588. if (left) {
  22589. neighborsSignificance[i - 1] += 0x10;
  22590. }
  22591. if (right) {
  22592. neighborsSignificance[i + 1] += 0x10;
  22593. }
  22594. neighborsSignificance[i] += 0x04;
  22595. }
  22596. if (row + 1 < height) {
  22597. i = index + width;
  22598. if (left) {
  22599. neighborsSignificance[i - 1] += 0x10;
  22600. }
  22601. if (right) {
  22602. neighborsSignificance[i + 1] += 0x10;
  22603. }
  22604. neighborsSignificance[i] += 0x04;
  22605. }
  22606. if (left) {
  22607. neighborsSignificance[index - 1] += 0x01;
  22608. }
  22609. if (right) {
  22610. neighborsSignificance[index + 1] += 0x01;
  22611. }
  22612. neighborsSignificance[index] |= 0x80;
  22613. }
  22614. runSignificancePropagationPass() {
  22615. const decoder = this.decoder;
  22616. const width = this.width,
  22617. height = this.height;
  22618. const coefficentsMagnitude = this.coefficentsMagnitude;
  22619. const coefficentsSign = this.coefficentsSign;
  22620. const neighborsSignificance = this.neighborsSignificance;
  22621. const processingFlags = this.processingFlags;
  22622. const contexts = this.contexts;
  22623. const labels = this.contextLabelTable;
  22624. const bitsDecoded = this.bitsDecoded;
  22625. const processedInverseMask = ~1;
  22626. const processedMask = 1;
  22627. const firstMagnitudeBitMask = 2;
  22628. for (let i0 = 0; i0 < height; i0 += 4) {
  22629. for (let j = 0; j < width; j++) {
  22630. let index = i0 * width + j;
  22631. for (let i1 = 0; i1 < 4; i1++, index += width) {
  22632. const i = i0 + i1;
  22633. if (i >= height) {
  22634. break;
  22635. }
  22636. processingFlags[index] &= processedInverseMask;
  22637. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  22638. continue;
  22639. }
  22640. const contextLabel = labels[neighborsSignificance[index]];
  22641. const decision = decoder.readBit(contexts, contextLabel);
  22642. if (decision) {
  22643. const sign = this.decodeSignBit(i, j, index);
  22644. coefficentsSign[index] = sign;
  22645. coefficentsMagnitude[index] = 1;
  22646. this.setNeighborsSignificance(i, j, index);
  22647. processingFlags[index] |= firstMagnitudeBitMask;
  22648. }
  22649. bitsDecoded[index]++;
  22650. processingFlags[index] |= processedMask;
  22651. }
  22652. }
  22653. }
  22654. }
  22655. decodeSignBit(row, column, index) {
  22656. const width = this.width,
  22657. height = this.height;
  22658. const coefficentsMagnitude = this.coefficentsMagnitude;
  22659. const coefficentsSign = this.coefficentsSign;
  22660. let contribution, sign0, sign1, significance1;
  22661. let contextLabel, decoded;
  22662. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  22663. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  22664. sign1 = coefficentsSign[index + 1];
  22665. if (significance1) {
  22666. sign0 = coefficentsSign[index - 1];
  22667. contribution = 1 - sign1 - sign0;
  22668. } else {
  22669. contribution = 1 - sign1 - sign1;
  22670. }
  22671. } else if (significance1) {
  22672. sign0 = coefficentsSign[index - 1];
  22673. contribution = 1 - sign0 - sign0;
  22674. } else {
  22675. contribution = 0;
  22676. }
  22677. const horizontalContribution = 3 * contribution;
  22678. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  22679. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  22680. sign1 = coefficentsSign[index + width];
  22681. if (significance1) {
  22682. sign0 = coefficentsSign[index - width];
  22683. contribution = 1 - sign1 - sign0 + horizontalContribution;
  22684. } else {
  22685. contribution = 1 - sign1 - sign1 + horizontalContribution;
  22686. }
  22687. } else if (significance1) {
  22688. sign0 = coefficentsSign[index - width];
  22689. contribution = 1 - sign0 - sign0 + horizontalContribution;
  22690. } else {
  22691. contribution = horizontalContribution;
  22692. }
  22693. if (contribution >= 0) {
  22694. contextLabel = 9 + contribution;
  22695. decoded = this.decoder.readBit(this.contexts, contextLabel);
  22696. } else {
  22697. contextLabel = 9 - contribution;
  22698. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  22699. }
  22700. return decoded;
  22701. }
  22702. runMagnitudeRefinementPass() {
  22703. const decoder = this.decoder;
  22704. const width = this.width,
  22705. height = this.height;
  22706. const coefficentsMagnitude = this.coefficentsMagnitude;
  22707. const neighborsSignificance = this.neighborsSignificance;
  22708. const contexts = this.contexts;
  22709. const bitsDecoded = this.bitsDecoded;
  22710. const processingFlags = this.processingFlags;
  22711. const processedMask = 1;
  22712. const firstMagnitudeBitMask = 2;
  22713. const length = width * height;
  22714. const width4 = width * 4;
  22715. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  22716. indexNext = Math.min(length, index0 + width4);
  22717. for (let j = 0; j < width; j++) {
  22718. for (let index = index0 + j; index < indexNext; index += width) {
  22719. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  22720. continue;
  22721. }
  22722. let contextLabel = 16;
  22723. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  22724. processingFlags[index] ^= firstMagnitudeBitMask;
  22725. const significance = neighborsSignificance[index] & 127;
  22726. contextLabel = significance === 0 ? 15 : 14;
  22727. }
  22728. const bit = decoder.readBit(contexts, contextLabel);
  22729. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  22730. bitsDecoded[index]++;
  22731. processingFlags[index] |= processedMask;
  22732. }
  22733. }
  22734. }
  22735. }
  22736. runCleanupPass() {
  22737. const decoder = this.decoder;
  22738. const width = this.width,
  22739. height = this.height;
  22740. const neighborsSignificance = this.neighborsSignificance;
  22741. const coefficentsMagnitude = this.coefficentsMagnitude;
  22742. const coefficentsSign = this.coefficentsSign;
  22743. const contexts = this.contexts;
  22744. const labels = this.contextLabelTable;
  22745. const bitsDecoded = this.bitsDecoded;
  22746. const processingFlags = this.processingFlags;
  22747. const processedMask = 1;
  22748. const firstMagnitudeBitMask = 2;
  22749. const oneRowDown = width;
  22750. const twoRowsDown = width * 2;
  22751. const threeRowsDown = width * 3;
  22752. let iNext;
  22753. for (let i0 = 0; i0 < height; i0 = iNext) {
  22754. iNext = Math.min(i0 + 4, height);
  22755. const indexBase = i0 * width;
  22756. const checkAllEmpty = i0 + 3 < height;
  22757. for (let j = 0; j < width; j++) {
  22758. const index0 = indexBase + j;
  22759. 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;
  22760. let i1 = 0,
  22761. index = index0;
  22762. let i = i0,
  22763. sign;
  22764. if (allEmpty) {
  22765. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  22766. if (!hasSignificantCoefficent) {
  22767. bitsDecoded[index0]++;
  22768. bitsDecoded[index0 + oneRowDown]++;
  22769. bitsDecoded[index0 + twoRowsDown]++;
  22770. bitsDecoded[index0 + threeRowsDown]++;
  22771. continue;
  22772. }
  22773. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  22774. if (i1 !== 0) {
  22775. i = i0 + i1;
  22776. index += i1 * width;
  22777. }
  22778. sign = this.decodeSignBit(i, j, index);
  22779. coefficentsSign[index] = sign;
  22780. coefficentsMagnitude[index] = 1;
  22781. this.setNeighborsSignificance(i, j, index);
  22782. processingFlags[index] |= firstMagnitudeBitMask;
  22783. index = index0;
  22784. for (let i2 = i0; i2 <= i; i2++, index += width) {
  22785. bitsDecoded[index]++;
  22786. }
  22787. i1++;
  22788. }
  22789. for (i = i0 + i1; i < iNext; i++, index += width) {
  22790. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  22791. continue;
  22792. }
  22793. const contextLabel = labels[neighborsSignificance[index]];
  22794. const decision = decoder.readBit(contexts, contextLabel);
  22795. if (decision === 1) {
  22796. sign = this.decodeSignBit(i, j, index);
  22797. coefficentsSign[index] = sign;
  22798. coefficentsMagnitude[index] = 1;
  22799. this.setNeighborsSignificance(i, j, index);
  22800. processingFlags[index] |= firstMagnitudeBitMask;
  22801. }
  22802. bitsDecoded[index]++;
  22803. }
  22804. }
  22805. }
  22806. }
  22807. checkSegmentationSymbol() {
  22808. const decoder = this.decoder;
  22809. const contexts = this.contexts;
  22810. 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);
  22811. if (symbol !== 0xa) {
  22812. throw new JpxError("Invalid segmentation symbol");
  22813. }
  22814. }
  22815. }
  22816. return BitModel;
  22817. }();
  22818. class Transform {
  22819. constructor() {
  22820. if (this.constructor === Transform) {
  22821. (0, _util.unreachable)("Cannot initialize Transform.");
  22822. }
  22823. }
  22824. calculate(subbands, u0, v0) {
  22825. let ll = subbands[0];
  22826. for (let i = 1, ii = subbands.length; i < ii; i++) {
  22827. ll = this.iterate(ll, subbands[i], u0, v0);
  22828. }
  22829. return ll;
  22830. }
  22831. extend(buffer, offset, size) {
  22832. let i1 = offset - 1,
  22833. j1 = offset + 1;
  22834. let i2 = offset + size - 2,
  22835. j2 = offset + size;
  22836. buffer[i1--] = buffer[j1++];
  22837. buffer[j2++] = buffer[i2--];
  22838. buffer[i1--] = buffer[j1++];
  22839. buffer[j2++] = buffer[i2--];
  22840. buffer[i1--] = buffer[j1++];
  22841. buffer[j2++] = buffer[i2--];
  22842. buffer[i1] = buffer[j1];
  22843. buffer[j2] = buffer[i2];
  22844. }
  22845. filter(x, offset, length) {
  22846. (0, _util.unreachable)("Abstract method `filter` called");
  22847. }
  22848. iterate(ll, hl_lh_hh, u0, v0) {
  22849. const llWidth = ll.width,
  22850. llHeight = ll.height;
  22851. let llItems = ll.items;
  22852. const width = hl_lh_hh.width;
  22853. const height = hl_lh_hh.height;
  22854. const items = hl_lh_hh.items;
  22855. let i, j, k, l, u, v;
  22856. for (k = 0, i = 0; i < llHeight; i++) {
  22857. l = i * 2 * width;
  22858. for (j = 0; j < llWidth; j++, k++, l += 2) {
  22859. items[l] = llItems[k];
  22860. }
  22861. }
  22862. llItems = ll.items = null;
  22863. const bufferPadding = 4;
  22864. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  22865. if (width === 1) {
  22866. if ((u0 & 1) !== 0) {
  22867. for (v = 0, k = 0; v < height; v++, k += width) {
  22868. items[k] *= 0.5;
  22869. }
  22870. }
  22871. } else {
  22872. for (v = 0, k = 0; v < height; v++, k += width) {
  22873. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  22874. this.extend(rowBuffer, bufferPadding, width);
  22875. this.filter(rowBuffer, bufferPadding, width);
  22876. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  22877. }
  22878. }
  22879. let numBuffers = 16;
  22880. const colBuffers = [];
  22881. for (i = 0; i < numBuffers; i++) {
  22882. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  22883. }
  22884. let b,
  22885. currentBuffer = 0;
  22886. ll = bufferPadding + height;
  22887. if (height === 1) {
  22888. if ((v0 & 1) !== 0) {
  22889. for (u = 0; u < width; u++) {
  22890. items[u] *= 0.5;
  22891. }
  22892. }
  22893. } else {
  22894. for (u = 0; u < width; u++) {
  22895. if (currentBuffer === 0) {
  22896. numBuffers = Math.min(width - u, numBuffers);
  22897. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  22898. for (b = 0; b < numBuffers; b++) {
  22899. colBuffers[b][l] = items[k + b];
  22900. }
  22901. }
  22902. currentBuffer = numBuffers;
  22903. }
  22904. currentBuffer--;
  22905. const buffer = colBuffers[currentBuffer];
  22906. this.extend(buffer, bufferPadding, height);
  22907. this.filter(buffer, bufferPadding, height);
  22908. if (currentBuffer === 0) {
  22909. k = u - numBuffers + 1;
  22910. for (l = bufferPadding; l < ll; k += width, l++) {
  22911. for (b = 0; b < numBuffers; b++) {
  22912. items[k + b] = colBuffers[b][l];
  22913. }
  22914. }
  22915. }
  22916. }
  22917. }
  22918. return {
  22919. width,
  22920. height,
  22921. items
  22922. };
  22923. }
  22924. }
  22925. class IrreversibleTransform extends Transform {
  22926. filter(x, offset, length) {
  22927. const len = length >> 1;
  22928. offset |= 0;
  22929. let j, n, current, next;
  22930. const alpha = -1.586134342059924;
  22931. const beta = -0.052980118572961;
  22932. const gamma = 0.882911075530934;
  22933. const delta = 0.443506852043971;
  22934. const K = 1.230174104914001;
  22935. const K_ = 1 / K;
  22936. j = offset - 3;
  22937. for (n = len + 4; n--; j += 2) {
  22938. x[j] *= K_;
  22939. }
  22940. j = offset - 2;
  22941. current = delta * x[j - 1];
  22942. for (n = len + 3; n--; j += 2) {
  22943. next = delta * x[j + 1];
  22944. x[j] = K * x[j] - current - next;
  22945. if (n--) {
  22946. j += 2;
  22947. current = delta * x[j + 1];
  22948. x[j] = K * x[j] - current - next;
  22949. } else {
  22950. break;
  22951. }
  22952. }
  22953. j = offset - 1;
  22954. current = gamma * x[j - 1];
  22955. for (n = len + 2; n--; j += 2) {
  22956. next = gamma * x[j + 1];
  22957. x[j] -= current + next;
  22958. if (n--) {
  22959. j += 2;
  22960. current = gamma * x[j + 1];
  22961. x[j] -= current + next;
  22962. } else {
  22963. break;
  22964. }
  22965. }
  22966. j = offset;
  22967. current = beta * x[j - 1];
  22968. for (n = len + 1; n--; j += 2) {
  22969. next = beta * x[j + 1];
  22970. x[j] -= current + next;
  22971. if (n--) {
  22972. j += 2;
  22973. current = beta * x[j + 1];
  22974. x[j] -= current + next;
  22975. } else {
  22976. break;
  22977. }
  22978. }
  22979. if (len !== 0) {
  22980. j = offset + 1;
  22981. current = alpha * x[j - 1];
  22982. for (n = len; n--; j += 2) {
  22983. next = alpha * x[j + 1];
  22984. x[j] -= current + next;
  22985. if (n--) {
  22986. j += 2;
  22987. current = alpha * x[j + 1];
  22988. x[j] -= current + next;
  22989. } else {
  22990. break;
  22991. }
  22992. }
  22993. }
  22994. }
  22995. }
  22996. class ReversibleTransform extends Transform {
  22997. filter(x, offset, length) {
  22998. const len = length >> 1;
  22999. offset |= 0;
  23000. let j, n;
  23001. for (j = offset, n = len + 1; n--; j += 2) {
  23002. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  23003. }
  23004. for (j = offset + 1, n = len; n--; j += 2) {
  23005. x[j] += x[j - 1] + x[j + 1] >> 1;
  23006. }
  23007. }
  23008. }
  23009. /***/ }),
  23010. /* 160 */
  23011. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23012. "use strict";
  23013. Object.defineProperty(exports, "__esModule", ({
  23014. value: true
  23015. }));
  23016. exports.LZWStream = void 0;
  23017. var _decode_stream = __w_pdfjs_require__(148);
  23018. class LZWStream extends _decode_stream.DecodeStream {
  23019. constructor(str, maybeLength, earlyChange) {
  23020. super(maybeLength);
  23021. this.str = str;
  23022. this.dict = str.dict;
  23023. this.cachedData = 0;
  23024. this.bitsCached = 0;
  23025. const maxLzwDictionarySize = 4096;
  23026. const lzwState = {
  23027. earlyChange,
  23028. codeLength: 9,
  23029. nextCode: 258,
  23030. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  23031. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  23032. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  23033. currentSequence: new Uint8Array(maxLzwDictionarySize),
  23034. currentSequenceLength: 0
  23035. };
  23036. for (let i = 0; i < 256; ++i) {
  23037. lzwState.dictionaryValues[i] = i;
  23038. lzwState.dictionaryLengths[i] = 1;
  23039. }
  23040. this.lzwState = lzwState;
  23041. }
  23042. readBits(n) {
  23043. let bitsCached = this.bitsCached;
  23044. let cachedData = this.cachedData;
  23045. while (bitsCached < n) {
  23046. const c = this.str.getByte();
  23047. if (c === -1) {
  23048. this.eof = true;
  23049. return null;
  23050. }
  23051. cachedData = cachedData << 8 | c;
  23052. bitsCached += 8;
  23053. }
  23054. this.bitsCached = bitsCached -= n;
  23055. this.cachedData = cachedData;
  23056. this.lastCode = null;
  23057. return cachedData >>> bitsCached & (1 << n) - 1;
  23058. }
  23059. readBlock() {
  23060. const blockSize = 512,
  23061. decodedSizeDelta = blockSize;
  23062. let estimatedDecodedSize = blockSize * 2;
  23063. let i, j, q;
  23064. const lzwState = this.lzwState;
  23065. if (!lzwState) {
  23066. return;
  23067. }
  23068. const earlyChange = lzwState.earlyChange;
  23069. let nextCode = lzwState.nextCode;
  23070. const dictionaryValues = lzwState.dictionaryValues;
  23071. const dictionaryLengths = lzwState.dictionaryLengths;
  23072. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  23073. let codeLength = lzwState.codeLength;
  23074. let prevCode = lzwState.prevCode;
  23075. const currentSequence = lzwState.currentSequence;
  23076. let currentSequenceLength = lzwState.currentSequenceLength;
  23077. let decodedLength = 0;
  23078. let currentBufferLength = this.bufferLength;
  23079. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23080. for (i = 0; i < blockSize; i++) {
  23081. const code = this.readBits(codeLength);
  23082. const hasPrev = currentSequenceLength > 0;
  23083. if (code < 256) {
  23084. currentSequence[0] = code;
  23085. currentSequenceLength = 1;
  23086. } else if (code >= 258) {
  23087. if (code < nextCode) {
  23088. currentSequenceLength = dictionaryLengths[code];
  23089. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  23090. currentSequence[j] = dictionaryValues[q];
  23091. q = dictionaryPrevCodes[q];
  23092. }
  23093. } else {
  23094. currentSequence[currentSequenceLength++] = currentSequence[0];
  23095. }
  23096. } else if (code === 256) {
  23097. codeLength = 9;
  23098. nextCode = 258;
  23099. currentSequenceLength = 0;
  23100. continue;
  23101. } else {
  23102. this.eof = true;
  23103. delete this.lzwState;
  23104. break;
  23105. }
  23106. if (hasPrev) {
  23107. dictionaryPrevCodes[nextCode] = prevCode;
  23108. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  23109. dictionaryValues[nextCode] = currentSequence[0];
  23110. nextCode++;
  23111. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  23112. }
  23113. prevCode = code;
  23114. decodedLength += currentSequenceLength;
  23115. if (estimatedDecodedSize < decodedLength) {
  23116. do {
  23117. estimatedDecodedSize += decodedSizeDelta;
  23118. } while (estimatedDecodedSize < decodedLength);
  23119. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  23120. }
  23121. for (j = 0; j < currentSequenceLength; j++) {
  23122. buffer[currentBufferLength++] = currentSequence[j];
  23123. }
  23124. }
  23125. lzwState.nextCode = nextCode;
  23126. lzwState.codeLength = codeLength;
  23127. lzwState.prevCode = prevCode;
  23128. lzwState.currentSequenceLength = currentSequenceLength;
  23129. this.bufferLength = currentBufferLength;
  23130. }
  23131. }
  23132. exports.LZWStream = LZWStream;
  23133. /***/ }),
  23134. /* 161 */
  23135. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23136. "use strict";
  23137. Object.defineProperty(exports, "__esModule", ({
  23138. value: true
  23139. }));
  23140. exports.PredictorStream = void 0;
  23141. var _decode_stream = __w_pdfjs_require__(148);
  23142. var _primitives = __w_pdfjs_require__(134);
  23143. var _util = __w_pdfjs_require__(2);
  23144. class PredictorStream extends _decode_stream.DecodeStream {
  23145. constructor(str, maybeLength, params) {
  23146. super(maybeLength);
  23147. if (!(params instanceof _primitives.Dict)) {
  23148. return str;
  23149. }
  23150. const predictor = this.predictor = params.get("Predictor") || 1;
  23151. if (predictor <= 1) {
  23152. return str;
  23153. }
  23154. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  23155. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23156. }
  23157. if (predictor === 2) {
  23158. this.readBlock = this.readBlockTiff;
  23159. } else {
  23160. this.readBlock = this.readBlockPng;
  23161. }
  23162. this.str = str;
  23163. this.dict = str.dict;
  23164. const colors = this.colors = params.get("Colors") || 1;
  23165. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  23166. const columns = this.columns = params.get("Columns") || 1;
  23167. this.pixBytes = colors * bits + 7 >> 3;
  23168. this.rowBytes = columns * colors * bits + 7 >> 3;
  23169. return this;
  23170. }
  23171. readBlockTiff() {
  23172. const rowBytes = this.rowBytes;
  23173. const bufferLength = this.bufferLength;
  23174. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23175. const bits = this.bits;
  23176. const colors = this.colors;
  23177. const rawBytes = this.str.getBytes(rowBytes);
  23178. this.eof = !rawBytes.length;
  23179. if (this.eof) {
  23180. return;
  23181. }
  23182. let inbuf = 0,
  23183. outbuf = 0;
  23184. let inbits = 0,
  23185. outbits = 0;
  23186. let pos = bufferLength;
  23187. let i;
  23188. if (bits === 1 && colors === 1) {
  23189. for (i = 0; i < rowBytes; ++i) {
  23190. let c = rawBytes[i] ^ inbuf;
  23191. c ^= c >> 1;
  23192. c ^= c >> 2;
  23193. c ^= c >> 4;
  23194. inbuf = (c & 1) << 7;
  23195. buffer[pos++] = c;
  23196. }
  23197. } else if (bits === 8) {
  23198. for (i = 0; i < colors; ++i) {
  23199. buffer[pos++] = rawBytes[i];
  23200. }
  23201. for (; i < rowBytes; ++i) {
  23202. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  23203. pos++;
  23204. }
  23205. } else if (bits === 16) {
  23206. const bytesPerPixel = colors * 2;
  23207. for (i = 0; i < bytesPerPixel; ++i) {
  23208. buffer[pos++] = rawBytes[i];
  23209. }
  23210. for (; i < rowBytes; i += 2) {
  23211. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  23212. buffer[pos++] = sum >> 8 & 0xff;
  23213. buffer[pos++] = sum & 0xff;
  23214. }
  23215. } else {
  23216. const compArray = new Uint8Array(colors + 1);
  23217. const bitMask = (1 << bits) - 1;
  23218. let j = 0,
  23219. k = bufferLength;
  23220. const columns = this.columns;
  23221. for (i = 0; i < columns; ++i) {
  23222. for (let kk = 0; kk < colors; ++kk) {
  23223. if (inbits < bits) {
  23224. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  23225. inbits += 8;
  23226. }
  23227. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  23228. inbits -= bits;
  23229. outbuf = outbuf << bits | compArray[kk];
  23230. outbits += bits;
  23231. if (outbits >= 8) {
  23232. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  23233. outbits -= 8;
  23234. }
  23235. }
  23236. }
  23237. if (outbits > 0) {
  23238. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  23239. }
  23240. }
  23241. this.bufferLength += rowBytes;
  23242. }
  23243. readBlockPng() {
  23244. const rowBytes = this.rowBytes;
  23245. const pixBytes = this.pixBytes;
  23246. const predictor = this.str.getByte();
  23247. const rawBytes = this.str.getBytes(rowBytes);
  23248. this.eof = !rawBytes.length;
  23249. if (this.eof) {
  23250. return;
  23251. }
  23252. const bufferLength = this.bufferLength;
  23253. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  23254. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  23255. if (prevRow.length === 0) {
  23256. prevRow = new Uint8Array(rowBytes);
  23257. }
  23258. let i,
  23259. j = bufferLength,
  23260. up,
  23261. c;
  23262. switch (predictor) {
  23263. case 0:
  23264. for (i = 0; i < rowBytes; ++i) {
  23265. buffer[j++] = rawBytes[i];
  23266. }
  23267. break;
  23268. case 1:
  23269. for (i = 0; i < pixBytes; ++i) {
  23270. buffer[j++] = rawBytes[i];
  23271. }
  23272. for (; i < rowBytes; ++i) {
  23273. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  23274. j++;
  23275. }
  23276. break;
  23277. case 2:
  23278. for (i = 0; i < rowBytes; ++i) {
  23279. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  23280. }
  23281. break;
  23282. case 3:
  23283. for (i = 0; i < pixBytes; ++i) {
  23284. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  23285. }
  23286. for (; i < rowBytes; ++i) {
  23287. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  23288. j++;
  23289. }
  23290. break;
  23291. case 4:
  23292. for (i = 0; i < pixBytes; ++i) {
  23293. up = prevRow[i];
  23294. c = rawBytes[i];
  23295. buffer[j++] = up + c;
  23296. }
  23297. for (; i < rowBytes; ++i) {
  23298. up = prevRow[i];
  23299. const upLeft = prevRow[i - pixBytes];
  23300. const left = buffer[j - pixBytes];
  23301. const p = left + up - upLeft;
  23302. let pa = p - left;
  23303. if (pa < 0) {
  23304. pa = -pa;
  23305. }
  23306. let pb = p - up;
  23307. if (pb < 0) {
  23308. pb = -pb;
  23309. }
  23310. let pc = p - upLeft;
  23311. if (pc < 0) {
  23312. pc = -pc;
  23313. }
  23314. c = rawBytes[i];
  23315. if (pa <= pb && pa <= pc) {
  23316. buffer[j++] = left + c;
  23317. } else if (pb <= pc) {
  23318. buffer[j++] = up + c;
  23319. } else {
  23320. buffer[j++] = upLeft + c;
  23321. }
  23322. }
  23323. break;
  23324. default:
  23325. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  23326. }
  23327. this.bufferLength += rowBytes;
  23328. }
  23329. }
  23330. exports.PredictorStream = PredictorStream;
  23331. /***/ }),
  23332. /* 162 */
  23333. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23334. "use strict";
  23335. Object.defineProperty(exports, "__esModule", ({
  23336. value: true
  23337. }));
  23338. exports.RunLengthStream = void 0;
  23339. var _decode_stream = __w_pdfjs_require__(148);
  23340. class RunLengthStream extends _decode_stream.DecodeStream {
  23341. constructor(str, maybeLength) {
  23342. super(maybeLength);
  23343. this.str = str;
  23344. this.dict = str.dict;
  23345. }
  23346. readBlock() {
  23347. const repeatHeader = this.str.getBytes(2);
  23348. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  23349. this.eof = true;
  23350. return;
  23351. }
  23352. let buffer;
  23353. let bufferLength = this.bufferLength;
  23354. let n = repeatHeader[0];
  23355. if (n < 128) {
  23356. buffer = this.ensureBuffer(bufferLength + n + 1);
  23357. buffer[bufferLength++] = repeatHeader[1];
  23358. if (n > 0) {
  23359. const source = this.str.getBytes(n);
  23360. buffer.set(source, bufferLength);
  23361. bufferLength += n;
  23362. }
  23363. } else {
  23364. n = 257 - n;
  23365. const b = repeatHeader[1];
  23366. buffer = this.ensureBuffer(bufferLength + n + 1);
  23367. for (let i = 0; i < n; i++) {
  23368. buffer[bufferLength++] = b;
  23369. }
  23370. }
  23371. this.bufferLength = bufferLength;
  23372. }
  23373. }
  23374. exports.RunLengthStream = RunLengthStream;
  23375. /***/ }),
  23376. /* 163 */
  23377. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23378. "use strict";
  23379. Object.defineProperty(exports, "__esModule", ({
  23380. value: true
  23381. }));
  23382. exports.Font = exports.ErrorFont = void 0;
  23383. var _util = __w_pdfjs_require__(2);
  23384. var _cff_parser = __w_pdfjs_require__(164);
  23385. var _fonts_utils = __w_pdfjs_require__(167);
  23386. var _unicode = __w_pdfjs_require__(169);
  23387. var _glyphlist = __w_pdfjs_require__(168);
  23388. var _encodings = __w_pdfjs_require__(166);
  23389. var _standard_fonts = __w_pdfjs_require__(170);
  23390. var _to_unicode_map = __w_pdfjs_require__(171);
  23391. var _cff_font = __w_pdfjs_require__(172);
  23392. var _font_renderer = __w_pdfjs_require__(173);
  23393. var _metrics = __w_pdfjs_require__(174);
  23394. var _glyf = __w_pdfjs_require__(175);
  23395. var _cmap = __w_pdfjs_require__(145);
  23396. var _opentype_file_builder = __w_pdfjs_require__(176);
  23397. var _core_utils = __w_pdfjs_require__(135);
  23398. var _stream = __w_pdfjs_require__(139);
  23399. var _type1_font = __w_pdfjs_require__(177);
  23400. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  23401. const PDF_GLYPH_SPACE_UNITS = 1000;
  23402. 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"];
  23403. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  23404. function adjustWidths(properties) {
  23405. if (!properties.fontMatrix) {
  23406. return;
  23407. }
  23408. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  23409. return;
  23410. }
  23411. const scale = 0.001 / properties.fontMatrix[0];
  23412. const glyphsWidths = properties.widths;
  23413. for (const glyph in glyphsWidths) {
  23414. glyphsWidths[glyph] *= scale;
  23415. }
  23416. properties.defaultWidth *= scale;
  23417. }
  23418. function adjustToUnicode(properties, builtInEncoding) {
  23419. if (properties.isInternalFont) {
  23420. return;
  23421. }
  23422. if (properties.hasIncludedToUnicodeMap) {
  23423. return;
  23424. }
  23425. if (builtInEncoding === properties.defaultEncoding) {
  23426. return;
  23427. }
  23428. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23429. return;
  23430. }
  23431. const toUnicode = [],
  23432. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23433. for (const charCode in builtInEncoding) {
  23434. if (properties.hasEncoding) {
  23435. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  23436. continue;
  23437. }
  23438. }
  23439. const glyphName = builtInEncoding[charCode];
  23440. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  23441. if (unicode !== -1) {
  23442. toUnicode[charCode] = String.fromCharCode(unicode);
  23443. }
  23444. }
  23445. if (toUnicode.length > 0) {
  23446. properties.toUnicode.amend(toUnicode);
  23447. }
  23448. }
  23449. function amendFallbackToUnicode(properties) {
  23450. if (!properties.fallbackToUnicode) {
  23451. return;
  23452. }
  23453. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  23454. return;
  23455. }
  23456. const toUnicode = [];
  23457. for (const charCode in properties.fallbackToUnicode) {
  23458. if (properties.toUnicode.has(charCode)) {
  23459. continue;
  23460. }
  23461. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  23462. }
  23463. if (toUnicode.length > 0) {
  23464. properties.toUnicode.amend(toUnicode);
  23465. }
  23466. }
  23467. class Glyph {
  23468. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  23469. this.originalCharCode = originalCharCode;
  23470. this.fontChar = fontChar;
  23471. this.unicode = unicode;
  23472. this.accent = accent;
  23473. this.width = width;
  23474. this.vmetric = vmetric;
  23475. this.operatorListId = operatorListId;
  23476. this.isSpace = isSpace;
  23477. this.isInFont = isInFont;
  23478. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  23479. this.isWhitespace = category.isWhitespace;
  23480. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  23481. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  23482. }
  23483. }
  23484. function int16(b0, b1) {
  23485. return (b0 << 8) + b1;
  23486. }
  23487. function writeSignedInt16(bytes, index, value) {
  23488. bytes[index + 1] = value;
  23489. bytes[index] = value >>> 8;
  23490. }
  23491. function signedInt16(b0, b1) {
  23492. const value = (b0 << 8) + b1;
  23493. return value & 1 << 15 ? value - 0x10000 : value;
  23494. }
  23495. function int32(b0, b1, b2, b3) {
  23496. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  23497. }
  23498. function string16(value) {
  23499. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23500. }
  23501. function safeString16(value) {
  23502. if (value > 0x7fff) {
  23503. value = 0x7fff;
  23504. } else if (value < -0x8000) {
  23505. value = -0x8000;
  23506. }
  23507. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  23508. }
  23509. function isTrueTypeFile(file) {
  23510. const header = file.peekBytes(4);
  23511. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  23512. }
  23513. function isTrueTypeCollectionFile(file) {
  23514. const header = file.peekBytes(4);
  23515. return (0, _util.bytesToString)(header) === "ttcf";
  23516. }
  23517. function isOpenTypeFile(file) {
  23518. const header = file.peekBytes(4);
  23519. return (0, _util.bytesToString)(header) === "OTTO";
  23520. }
  23521. function isType1File(file) {
  23522. const header = file.peekBytes(2);
  23523. if (header[0] === 0x25 && header[1] === 0x21) {
  23524. return true;
  23525. }
  23526. if (header[0] === 0x80 && header[1] === 0x01) {
  23527. return true;
  23528. }
  23529. return false;
  23530. }
  23531. function isCFFFile(file) {
  23532. const header = file.peekBytes(4);
  23533. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  23534. return true;
  23535. }
  23536. return false;
  23537. }
  23538. function getFontFileType(file, _ref) {
  23539. let {
  23540. type,
  23541. subtype,
  23542. composite
  23543. } = _ref;
  23544. let fileType, fileSubtype;
  23545. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  23546. if (composite) {
  23547. fileType = "CIDFontType2";
  23548. } else {
  23549. fileType = "TrueType";
  23550. }
  23551. } else if (isOpenTypeFile(file)) {
  23552. if (composite) {
  23553. fileType = "CIDFontType2";
  23554. } else {
  23555. fileType = "OpenType";
  23556. }
  23557. } else if (isType1File(file)) {
  23558. if (composite) {
  23559. fileType = "CIDFontType0";
  23560. } else {
  23561. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23562. }
  23563. } else if (isCFFFile(file)) {
  23564. if (composite) {
  23565. fileType = "CIDFontType0";
  23566. fileSubtype = "CIDFontType0C";
  23567. } else {
  23568. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23569. fileSubtype = "Type1C";
  23570. }
  23571. } else {
  23572. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  23573. fileType = type;
  23574. fileSubtype = subtype;
  23575. }
  23576. return [fileType, fileSubtype];
  23577. }
  23578. function applyStandardFontGlyphMap(map, glyphMap) {
  23579. for (const charCode in glyphMap) {
  23580. map[+charCode] = glyphMap[charCode];
  23581. }
  23582. }
  23583. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  23584. const toFontChar = [];
  23585. let unicode;
  23586. for (let i = 0, ii = encoding.length; i < ii; i++) {
  23587. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  23588. if (unicode !== -1) {
  23589. toFontChar[i] = unicode;
  23590. }
  23591. }
  23592. for (const charCode in differences) {
  23593. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  23594. if (unicode !== -1) {
  23595. toFontChar[+charCode] = unicode;
  23596. }
  23597. }
  23598. return toFontChar;
  23599. }
  23600. function convertCidString(charCode, cid) {
  23601. let shouldThrow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  23602. switch (cid.length) {
  23603. case 1:
  23604. return cid.charCodeAt(0);
  23605. case 2:
  23606. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  23607. }
  23608. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  23609. if (shouldThrow) {
  23610. throw new _util.FormatError(msg);
  23611. }
  23612. (0, _util.warn)(msg);
  23613. return cid;
  23614. }
  23615. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  23616. const newMap = Object.create(null);
  23617. const toUnicodeExtraMap = new Map();
  23618. const toFontChar = [];
  23619. const usedGlyphIds = new Set();
  23620. let privateUseAreaIndex = 0;
  23621. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  23622. let nextAvailableFontCharCode = privateUseOffetStart;
  23623. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  23624. for (let originalCharCode in charCodeToGlyphId) {
  23625. originalCharCode |= 0;
  23626. let glyphId = charCodeToGlyphId[originalCharCode];
  23627. if (!hasGlyph(glyphId)) {
  23628. continue;
  23629. }
  23630. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  23631. privateUseAreaIndex++;
  23632. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  23633. (0, _util.warn)("Ran out of space in font private use area.");
  23634. break;
  23635. }
  23636. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  23637. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  23638. }
  23639. const fontCharCode = nextAvailableFontCharCode++;
  23640. if (glyphId === 0) {
  23641. glyphId = newGlyphZeroId;
  23642. }
  23643. let unicode = toUnicode.get(originalCharCode);
  23644. if (typeof unicode === "string") {
  23645. unicode = unicode.codePointAt(0);
  23646. }
  23647. if (unicode && unicode < privateUseOffetStart && !usedGlyphIds.has(glyphId)) {
  23648. toUnicodeExtraMap.set(unicode, glyphId);
  23649. usedGlyphIds.add(glyphId);
  23650. }
  23651. newMap[fontCharCode] = glyphId;
  23652. toFontChar[originalCharCode] = fontCharCode;
  23653. }
  23654. return {
  23655. toFontChar,
  23656. charCodeToGlyphId: newMap,
  23657. toUnicodeExtraMap,
  23658. nextAvailableFontCharCode
  23659. };
  23660. }
  23661. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  23662. const codes = [];
  23663. for (const charCode in glyphs) {
  23664. if (glyphs[charCode] >= numGlyphs) {
  23665. continue;
  23666. }
  23667. codes.push({
  23668. fontCharCode: charCode | 0,
  23669. glyphId: glyphs[charCode]
  23670. });
  23671. }
  23672. if (toUnicodeExtraMap) {
  23673. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  23674. if (glyphId >= numGlyphs) {
  23675. continue;
  23676. }
  23677. codes.push({
  23678. fontCharCode: unicode,
  23679. glyphId
  23680. });
  23681. }
  23682. }
  23683. if (codes.length === 0) {
  23684. codes.push({
  23685. fontCharCode: 0,
  23686. glyphId: 0
  23687. });
  23688. }
  23689. codes.sort(function fontGetRangesSort(a, b) {
  23690. return a.fontCharCode - b.fontCharCode;
  23691. });
  23692. const ranges = [];
  23693. const length = codes.length;
  23694. for (let n = 0; n < length;) {
  23695. const start = codes[n].fontCharCode;
  23696. const codeIndices = [codes[n].glyphId];
  23697. ++n;
  23698. let end = start;
  23699. while (n < length && end + 1 === codes[n].fontCharCode) {
  23700. codeIndices.push(codes[n].glyphId);
  23701. ++end;
  23702. ++n;
  23703. if (end === 0xffff) {
  23704. break;
  23705. }
  23706. }
  23707. ranges.push([start, end, codeIndices]);
  23708. }
  23709. return ranges;
  23710. }
  23711. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  23712. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  23713. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  23714. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  23715. let i, ii, j, jj;
  23716. for (i = ranges.length - 1; i >= 0; --i) {
  23717. if (ranges[i][0] <= 0xffff) {
  23718. break;
  23719. }
  23720. }
  23721. const bmpLength = i + 1;
  23722. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  23723. ranges[i][1] = 0xfffe;
  23724. }
  23725. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  23726. const segCount = bmpLength + trailingRangesCount;
  23727. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  23728. let startCount = "";
  23729. let endCount = "";
  23730. let idDeltas = "";
  23731. let idRangeOffsets = "";
  23732. let glyphsIds = "";
  23733. let bias = 0;
  23734. let range, start, end, codes;
  23735. for (i = 0, ii = bmpLength; i < ii; i++) {
  23736. range = ranges[i];
  23737. start = range[0];
  23738. end = range[1];
  23739. startCount += string16(start);
  23740. endCount += string16(end);
  23741. codes = range[2];
  23742. let contiguous = true;
  23743. for (j = 1, jj = codes.length; j < jj; ++j) {
  23744. if (codes[j] !== codes[j - 1] + 1) {
  23745. contiguous = false;
  23746. break;
  23747. }
  23748. }
  23749. if (!contiguous) {
  23750. const offset = (segCount - i) * 2 + bias * 2;
  23751. bias += end - start + 1;
  23752. idDeltas += string16(0);
  23753. idRangeOffsets += string16(offset);
  23754. for (j = 0, jj = codes.length; j < jj; ++j) {
  23755. glyphsIds += string16(codes[j]);
  23756. }
  23757. } else {
  23758. const startCode = codes[0];
  23759. idDeltas += string16(startCode - start & 0xffff);
  23760. idRangeOffsets += string16(0);
  23761. }
  23762. }
  23763. if (trailingRangesCount > 0) {
  23764. endCount += "\xFF\xFF";
  23765. startCount += "\xFF\xFF";
  23766. idDeltas += "\x00\x01";
  23767. idRangeOffsets += "\x00\x00";
  23768. }
  23769. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  23770. let format31012 = "";
  23771. let header31012 = "";
  23772. if (numTables > 1) {
  23773. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  23774. format31012 = "";
  23775. for (i = 0, ii = ranges.length; i < ii; i++) {
  23776. range = ranges[i];
  23777. start = range[0];
  23778. codes = range[2];
  23779. let code = codes[0];
  23780. for (j = 1, jj = codes.length; j < jj; ++j) {
  23781. if (codes[j] !== codes[j - 1] + 1) {
  23782. end = range[0] + j - 1;
  23783. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  23784. start = end + 1;
  23785. code = codes[j];
  23786. }
  23787. }
  23788. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  23789. }
  23790. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  23791. }
  23792. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  23793. }
  23794. function validateOS2Table(os2, file) {
  23795. file.pos = (file.start || 0) + os2.offset;
  23796. const version = file.getUint16();
  23797. file.skip(60);
  23798. const selection = file.getUint16();
  23799. if (version < 4 && selection & 0x0300) {
  23800. return false;
  23801. }
  23802. const firstChar = file.getUint16();
  23803. const lastChar = file.getUint16();
  23804. if (firstChar > lastChar) {
  23805. return false;
  23806. }
  23807. file.skip(6);
  23808. const usWinAscent = file.getUint16();
  23809. if (usWinAscent === 0) {
  23810. return false;
  23811. }
  23812. os2.data[8] = os2.data[9] = 0;
  23813. return true;
  23814. }
  23815. function createOS2Table(properties, charstrings, override) {
  23816. override = override || {
  23817. unitsPerEm: 0,
  23818. yMax: 0,
  23819. yMin: 0,
  23820. ascent: 0,
  23821. descent: 0
  23822. };
  23823. let ulUnicodeRange1 = 0;
  23824. let ulUnicodeRange2 = 0;
  23825. let ulUnicodeRange3 = 0;
  23826. let ulUnicodeRange4 = 0;
  23827. let firstCharIndex = null;
  23828. let lastCharIndex = 0;
  23829. if (charstrings) {
  23830. for (let code in charstrings) {
  23831. code |= 0;
  23832. if (firstCharIndex > code || !firstCharIndex) {
  23833. firstCharIndex = code;
  23834. }
  23835. if (lastCharIndex < code) {
  23836. lastCharIndex = code;
  23837. }
  23838. const position = (0, _unicode.getUnicodeRangeFor)(code);
  23839. if (position < 32) {
  23840. ulUnicodeRange1 |= 1 << position;
  23841. } else if (position < 64) {
  23842. ulUnicodeRange2 |= 1 << position - 32;
  23843. } else if (position < 96) {
  23844. ulUnicodeRange3 |= 1 << position - 64;
  23845. } else if (position < 123) {
  23846. ulUnicodeRange4 |= 1 << position - 96;
  23847. } else {
  23848. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  23849. }
  23850. }
  23851. if (lastCharIndex > 0xffff) {
  23852. lastCharIndex = 0xffff;
  23853. }
  23854. } else {
  23855. firstCharIndex = 0;
  23856. lastCharIndex = 255;
  23857. }
  23858. const bbox = properties.bbox || [0, 0, 0, 0];
  23859. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  23860. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  23861. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  23862. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  23863. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  23864. typoDescent = -typoDescent;
  23865. }
  23866. const winAscent = override.yMax || typoAscent;
  23867. const winDescent = -override.yMin || -typoDescent;
  23868. 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";
  23869. }
  23870. function createPostTable(properties) {
  23871. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  23872. 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";
  23873. }
  23874. function createPostscriptName(name) {
  23875. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  23876. }
  23877. function createNameTable(name, proto) {
  23878. if (!proto) {
  23879. proto = [[], []];
  23880. }
  23881. 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"];
  23882. const stringsUnicode = [];
  23883. let i, ii, j, jj, str;
  23884. for (i = 0, ii = strings.length; i < ii; i++) {
  23885. str = proto[1][i] || strings[i];
  23886. const strBufUnicode = [];
  23887. for (j = 0, jj = str.length; j < jj; j++) {
  23888. strBufUnicode.push(string16(str.charCodeAt(j)));
  23889. }
  23890. stringsUnicode.push(strBufUnicode.join(""));
  23891. }
  23892. const names = [strings, stringsUnicode];
  23893. const platforms = ["\x00\x01", "\x00\x03"];
  23894. const encodings = ["\x00\x00", "\x00\x01"];
  23895. const languages = ["\x00\x00", "\x04\x09"];
  23896. const namesRecordCount = strings.length * platforms.length;
  23897. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  23898. let strOffset = 0;
  23899. for (i = 0, ii = platforms.length; i < ii; i++) {
  23900. const strs = names[i];
  23901. for (j = 0, jj = strs.length; j < jj; j++) {
  23902. str = strs[j];
  23903. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  23904. nameTable += nameRecord;
  23905. strOffset += str.length;
  23906. }
  23907. }
  23908. nameTable += strings.join("") + stringsUnicode.join("");
  23909. return nameTable;
  23910. }
  23911. class Font {
  23912. constructor(name, file, properties) {
  23913. this.name = name;
  23914. this.psName = null;
  23915. this.mimetype = null;
  23916. this.disableFontFace = false;
  23917. this.loadedName = properties.loadedName;
  23918. this.isType3Font = properties.isType3Font;
  23919. this.missingFile = false;
  23920. this.cssFontInfo = properties.cssFontInfo;
  23921. this._charsCache = Object.create(null);
  23922. this._glyphCache = Object.create(null);
  23923. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  23924. if (!isSerifFont && !properties.isSimulatedFlags) {
  23925. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  23926. serifFonts = (0, _standard_fonts.getSerifFonts)();
  23927. for (const namePart of baseName.split("+")) {
  23928. if (serifFonts[namePart]) {
  23929. isSerifFont = true;
  23930. break;
  23931. }
  23932. }
  23933. }
  23934. this.isSerifFont = isSerifFont;
  23935. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  23936. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  23937. let type = properties.type;
  23938. let subtype = properties.subtype;
  23939. this.type = type;
  23940. this.subtype = subtype;
  23941. let fallbackName = "sans-serif";
  23942. if (this.isMonospace) {
  23943. fallbackName = "monospace";
  23944. } else if (this.isSerifFont) {
  23945. fallbackName = "serif";
  23946. }
  23947. this.fallbackName = fallbackName;
  23948. this.differences = properties.differences;
  23949. this.widths = properties.widths;
  23950. this.defaultWidth = properties.defaultWidth;
  23951. this.composite = properties.composite;
  23952. this.cMap = properties.cMap;
  23953. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  23954. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  23955. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  23956. this.lineHeight = this.ascent - this.descent;
  23957. this.fontMatrix = properties.fontMatrix;
  23958. this.bbox = properties.bbox;
  23959. this.defaultEncoding = properties.defaultEncoding;
  23960. this.toUnicode = properties.toUnicode;
  23961. this.toFontChar = [];
  23962. if (properties.type === "Type3") {
  23963. for (let charCode = 0; charCode < 256; charCode++) {
  23964. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  23965. }
  23966. this.fontType = _util.FontType.TYPE3;
  23967. return;
  23968. }
  23969. this.cidEncoding = properties.cidEncoding || "";
  23970. this.vertical = !!properties.vertical;
  23971. if (this.vertical) {
  23972. this.vmetrics = properties.vmetrics;
  23973. this.defaultVMetrics = properties.defaultVMetrics;
  23974. }
  23975. if (!file || file.isEmpty) {
  23976. if (file) {
  23977. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  23978. }
  23979. this.fallbackToSystemFont(properties);
  23980. return;
  23981. }
  23982. [type, subtype] = getFontFileType(file, properties);
  23983. if (type !== this.type || subtype !== this.subtype) {
  23984. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  23985. }
  23986. let data;
  23987. try {
  23988. switch (type) {
  23989. case "MMType1":
  23990. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  23991. case "Type1":
  23992. case "CIDFontType0":
  23993. this.mimetype = "font/opentype";
  23994. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  23995. adjustWidths(properties);
  23996. data = this.convert(name, cff, properties);
  23997. break;
  23998. case "OpenType":
  23999. case "TrueType":
  24000. case "CIDFontType2":
  24001. this.mimetype = "font/opentype";
  24002. data = this.checkAndRepair(name, file, properties);
  24003. if (this.isOpenType) {
  24004. adjustWidths(properties);
  24005. type = "OpenType";
  24006. }
  24007. break;
  24008. default:
  24009. throw new _util.FormatError(`Font ${type} is not supported`);
  24010. }
  24011. } catch (e) {
  24012. (0, _util.warn)(e);
  24013. this.fallbackToSystemFont(properties);
  24014. return;
  24015. }
  24016. amendFallbackToUnicode(properties);
  24017. this.data = data;
  24018. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  24019. this.fontMatrix = properties.fontMatrix;
  24020. this.widths = properties.widths;
  24021. this.defaultWidth = properties.defaultWidth;
  24022. this.toUnicode = properties.toUnicode;
  24023. this.seacMap = properties.seacMap;
  24024. }
  24025. get renderer() {
  24026. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  24027. return (0, _util.shadow)(this, "renderer", renderer);
  24028. }
  24029. exportData() {
  24030. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  24031. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  24032. const data = Object.create(null);
  24033. let property, value;
  24034. for (property of exportDataProperties) {
  24035. value = this[property];
  24036. if (value !== undefined) {
  24037. data[property] = value;
  24038. }
  24039. }
  24040. return data;
  24041. }
  24042. fallbackToSystemFont(properties) {
  24043. this.missingFile = true;
  24044. const name = this.name;
  24045. const type = this.type;
  24046. const subtype = this.subtype;
  24047. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  24048. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  24049. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  24050. const isStandardFont = !!stdFontMap[fontName];
  24051. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  24052. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  24053. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  24054. const metrics = fontBasicMetricsMap[fontName];
  24055. if (metrics) {
  24056. if (isNaN(this.ascent)) {
  24057. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  24058. }
  24059. if (isNaN(this.descent)) {
  24060. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  24061. }
  24062. if (isNaN(this.capHeight)) {
  24063. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  24064. }
  24065. }
  24066. this.bold = /bold/gi.test(fontName);
  24067. this.italic = /oblique|italic/gi.test(fontName);
  24068. this.black = /Black/g.test(name);
  24069. const isNarrow = /Narrow/g.test(name);
  24070. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  24071. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  24072. const cidToGidMap = properties.cidToGidMap;
  24073. const map = [];
  24074. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24075. if (/Arial-?Black/i.test(name)) {
  24076. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  24077. } else if (/Calibri/i.test(name)) {
  24078. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  24079. }
  24080. if (cidToGidMap) {
  24081. for (const charCode in map) {
  24082. const cid = map[charCode];
  24083. if (cidToGidMap[cid] !== undefined) {
  24084. map[+charCode] = cidToGidMap[cid];
  24085. }
  24086. }
  24087. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24088. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24089. const cid = map[charCode];
  24090. if (cidToGidMap[cid] === undefined) {
  24091. map[+charCode] = unicodeCharCode;
  24092. }
  24093. });
  24094. }
  24095. }
  24096. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24097. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24098. map[+charCode] = unicodeCharCode;
  24099. });
  24100. }
  24101. this.toFontChar = map;
  24102. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  24103. } else if (/Symbol/i.test(fontName)) {
  24104. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24105. } else if (/Dingbats/i.test(fontName)) {
  24106. if (/Wingdings/i.test(name)) {
  24107. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  24108. }
  24109. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  24110. } else if (isStandardFont) {
  24111. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  24112. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  24113. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  24114. map[+charCode] = unicodeCharCode;
  24115. });
  24116. }
  24117. this.toFontChar = map;
  24118. } else {
  24119. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24120. const map = [];
  24121. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  24122. if (!this.composite) {
  24123. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  24124. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  24125. if (unicode !== -1) {
  24126. unicodeCharCode = unicode;
  24127. }
  24128. }
  24129. map[+charCode] = unicodeCharCode;
  24130. });
  24131. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  24132. if (/Verdana/i.test(name)) {
  24133. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  24134. }
  24135. }
  24136. this.toFontChar = map;
  24137. }
  24138. amendFallbackToUnicode(properties);
  24139. this.loadedName = fontName.split("-")[0];
  24140. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  24141. }
  24142. checkAndRepair(name, font, properties) {
  24143. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  24144. function readTables(file, numTables) {
  24145. const tables = Object.create(null);
  24146. tables["OS/2"] = null;
  24147. tables.cmap = null;
  24148. tables.head = null;
  24149. tables.hhea = null;
  24150. tables.hmtx = null;
  24151. tables.maxp = null;
  24152. tables.name = null;
  24153. tables.post = null;
  24154. for (let i = 0; i < numTables; i++) {
  24155. const table = readTableEntry(file);
  24156. if (!VALID_TABLES.includes(table.tag)) {
  24157. continue;
  24158. }
  24159. if (table.length === 0) {
  24160. continue;
  24161. }
  24162. tables[table.tag] = table;
  24163. }
  24164. return tables;
  24165. }
  24166. function readTableEntry(file) {
  24167. const tag = file.getString(4);
  24168. const checksum = file.getInt32() >>> 0;
  24169. const offset = file.getInt32() >>> 0;
  24170. const length = file.getInt32() >>> 0;
  24171. const previousPosition = file.pos;
  24172. file.pos = file.start || 0;
  24173. file.skip(offset);
  24174. const data = file.getBytes(length);
  24175. file.pos = previousPosition;
  24176. if (tag === "head") {
  24177. data[8] = data[9] = data[10] = data[11] = 0;
  24178. data[17] |= 0x20;
  24179. }
  24180. return {
  24181. tag,
  24182. checksum,
  24183. length,
  24184. offset,
  24185. data
  24186. };
  24187. }
  24188. function readOpenTypeHeader(ttf) {
  24189. return {
  24190. version: ttf.getString(4),
  24191. numTables: ttf.getUint16(),
  24192. searchRange: ttf.getUint16(),
  24193. entrySelector: ttf.getUint16(),
  24194. rangeShift: ttf.getUint16()
  24195. };
  24196. }
  24197. function readTrueTypeCollectionHeader(ttc) {
  24198. const ttcTag = ttc.getString(4);
  24199. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  24200. const majorVersion = ttc.getUint16();
  24201. const minorVersion = ttc.getUint16();
  24202. const numFonts = ttc.getInt32() >>> 0;
  24203. const offsetTable = [];
  24204. for (let i = 0; i < numFonts; i++) {
  24205. offsetTable.push(ttc.getInt32() >>> 0);
  24206. }
  24207. const header = {
  24208. ttcTag,
  24209. majorVersion,
  24210. minorVersion,
  24211. numFonts,
  24212. offsetTable
  24213. };
  24214. switch (majorVersion) {
  24215. case 1:
  24216. return header;
  24217. case 2:
  24218. header.dsigTag = ttc.getInt32() >>> 0;
  24219. header.dsigLength = ttc.getInt32() >>> 0;
  24220. header.dsigOffset = ttc.getInt32() >>> 0;
  24221. return header;
  24222. }
  24223. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  24224. }
  24225. function readTrueTypeCollectionData(ttc, fontName) {
  24226. const {
  24227. numFonts,
  24228. offsetTable
  24229. } = readTrueTypeCollectionHeader(ttc);
  24230. const fontNameParts = fontName.split("+");
  24231. let fallbackData;
  24232. for (let i = 0; i < numFonts; i++) {
  24233. ttc.pos = (ttc.start || 0) + offsetTable[i];
  24234. const potentialHeader = readOpenTypeHeader(ttc);
  24235. const potentialTables = readTables(ttc, potentialHeader.numTables);
  24236. if (!potentialTables.name) {
  24237. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  24238. }
  24239. const nameTable = readNameTable(potentialTables.name);
  24240. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  24241. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  24242. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  24243. if (!nameEntry) {
  24244. continue;
  24245. }
  24246. if (nameEntry === fontName) {
  24247. return {
  24248. header: potentialHeader,
  24249. tables: potentialTables
  24250. };
  24251. }
  24252. if (fontNameParts.length < 2) {
  24253. continue;
  24254. }
  24255. for (const part of fontNameParts) {
  24256. if (nameEntry === part) {
  24257. fallbackData = {
  24258. name: part,
  24259. header: potentialHeader,
  24260. tables: potentialTables
  24261. };
  24262. }
  24263. }
  24264. }
  24265. }
  24266. }
  24267. if (fallbackData) {
  24268. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  24269. return {
  24270. header: fallbackData.header,
  24271. tables: fallbackData.tables
  24272. };
  24273. }
  24274. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  24275. }
  24276. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  24277. if (!cmap) {
  24278. (0, _util.warn)("No cmap table available.");
  24279. return {
  24280. platformId: -1,
  24281. encodingId: -1,
  24282. mappings: [],
  24283. hasShortCmap: false
  24284. };
  24285. }
  24286. let segment;
  24287. let start = (file.start || 0) + cmap.offset;
  24288. file.pos = start;
  24289. file.skip(2);
  24290. const numTables = file.getUint16();
  24291. let potentialTable;
  24292. let canBreak = false;
  24293. for (let i = 0; i < numTables; i++) {
  24294. const platformId = file.getUint16();
  24295. const encodingId = file.getUint16();
  24296. const offset = file.getInt32() >>> 0;
  24297. let useTable = false;
  24298. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  24299. continue;
  24300. }
  24301. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  24302. useTable = true;
  24303. } else if (platformId === 1 && encodingId === 0) {
  24304. useTable = true;
  24305. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  24306. useTable = true;
  24307. if (!isSymbolicFont) {
  24308. canBreak = true;
  24309. }
  24310. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  24311. useTable = true;
  24312. let correctlySorted = true;
  24313. if (i < numTables - 1) {
  24314. const nextBytes = file.peekBytes(2),
  24315. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  24316. if (nextPlatformId < platformId) {
  24317. correctlySorted = false;
  24318. }
  24319. }
  24320. if (correctlySorted) {
  24321. canBreak = true;
  24322. }
  24323. }
  24324. if (useTable) {
  24325. potentialTable = {
  24326. platformId,
  24327. encodingId,
  24328. offset
  24329. };
  24330. }
  24331. if (canBreak) {
  24332. break;
  24333. }
  24334. }
  24335. if (potentialTable) {
  24336. file.pos = start + potentialTable.offset;
  24337. }
  24338. if (!potentialTable || file.peekByte() === -1) {
  24339. (0, _util.warn)("Could not find a preferred cmap table.");
  24340. return {
  24341. platformId: -1,
  24342. encodingId: -1,
  24343. mappings: [],
  24344. hasShortCmap: false
  24345. };
  24346. }
  24347. const format = file.getUint16();
  24348. let hasShortCmap = false;
  24349. const mappings = [];
  24350. let j, glyphId;
  24351. if (format === 0) {
  24352. file.skip(2 + 2);
  24353. for (j = 0; j < 256; j++) {
  24354. const index = file.getByte();
  24355. if (!index) {
  24356. continue;
  24357. }
  24358. mappings.push({
  24359. charCode: j,
  24360. glyphId: index
  24361. });
  24362. }
  24363. hasShortCmap = true;
  24364. } else if (format === 2) {
  24365. file.skip(2 + 2);
  24366. const subHeaderKeys = [];
  24367. let maxSubHeaderKey = 0;
  24368. for (let i = 0; i < 256; i++) {
  24369. const subHeaderKey = file.getUint16() >> 3;
  24370. subHeaderKeys.push(subHeaderKey);
  24371. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  24372. }
  24373. const subHeaders = [];
  24374. for (let i = 0; i <= maxSubHeaderKey; i++) {
  24375. subHeaders.push({
  24376. firstCode: file.getUint16(),
  24377. entryCount: file.getUint16(),
  24378. idDelta: signedInt16(file.getByte(), file.getByte()),
  24379. idRangePos: file.pos + file.getUint16()
  24380. });
  24381. }
  24382. for (let i = 0; i < 256; i++) {
  24383. if (subHeaderKeys[i] === 0) {
  24384. file.pos = subHeaders[0].idRangePos + 2 * i;
  24385. glyphId = file.getUint16();
  24386. mappings.push({
  24387. charCode: i,
  24388. glyphId
  24389. });
  24390. } else {
  24391. const s = subHeaders[subHeaderKeys[i]];
  24392. for (j = 0; j < s.entryCount; j++) {
  24393. const charCode = (i << 8) + j + s.firstCode;
  24394. file.pos = s.idRangePos + 2 * j;
  24395. glyphId = file.getUint16();
  24396. if (glyphId !== 0) {
  24397. glyphId = (glyphId + s.idDelta) % 65536;
  24398. }
  24399. mappings.push({
  24400. charCode,
  24401. glyphId
  24402. });
  24403. }
  24404. }
  24405. }
  24406. } else if (format === 4) {
  24407. file.skip(2 + 2);
  24408. const segCount = file.getUint16() >> 1;
  24409. file.skip(6);
  24410. const segments = [];
  24411. let segIndex;
  24412. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24413. segments.push({
  24414. end: file.getUint16()
  24415. });
  24416. }
  24417. file.skip(2);
  24418. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24419. segments[segIndex].start = file.getUint16();
  24420. }
  24421. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24422. segments[segIndex].delta = file.getUint16();
  24423. }
  24424. let offsetsCount = 0,
  24425. offsetIndex;
  24426. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24427. segment = segments[segIndex];
  24428. const rangeOffset = file.getUint16();
  24429. if (!rangeOffset) {
  24430. segment.offsetIndex = -1;
  24431. continue;
  24432. }
  24433. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  24434. segment.offsetIndex = offsetIndex;
  24435. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  24436. }
  24437. const offsets = [];
  24438. for (j = 0; j < offsetsCount; j++) {
  24439. offsets.push(file.getUint16());
  24440. }
  24441. for (segIndex = 0; segIndex < segCount; segIndex++) {
  24442. segment = segments[segIndex];
  24443. start = segment.start;
  24444. const end = segment.end;
  24445. const delta = segment.delta;
  24446. offsetIndex = segment.offsetIndex;
  24447. for (j = start; j <= end; j++) {
  24448. if (j === 0xffff) {
  24449. continue;
  24450. }
  24451. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  24452. glyphId = glyphId + delta & 0xffff;
  24453. mappings.push({
  24454. charCode: j,
  24455. glyphId
  24456. });
  24457. }
  24458. }
  24459. } else if (format === 6) {
  24460. file.skip(2 + 2);
  24461. const firstCode = file.getUint16();
  24462. const entryCount = file.getUint16();
  24463. for (j = 0; j < entryCount; j++) {
  24464. glyphId = file.getUint16();
  24465. const charCode = firstCode + j;
  24466. mappings.push({
  24467. charCode,
  24468. glyphId
  24469. });
  24470. }
  24471. } else if (format === 12) {
  24472. file.skip(2 + 4 + 4);
  24473. const nGroups = file.getInt32() >>> 0;
  24474. for (j = 0; j < nGroups; j++) {
  24475. const startCharCode = file.getInt32() >>> 0;
  24476. const endCharCode = file.getInt32() >>> 0;
  24477. let glyphCode = file.getInt32() >>> 0;
  24478. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  24479. mappings.push({
  24480. charCode,
  24481. glyphId: glyphCode++
  24482. });
  24483. }
  24484. }
  24485. } else {
  24486. (0, _util.warn)("cmap table has unsupported format: " + format);
  24487. return {
  24488. platformId: -1,
  24489. encodingId: -1,
  24490. mappings: [],
  24491. hasShortCmap: false
  24492. };
  24493. }
  24494. mappings.sort(function (a, b) {
  24495. return a.charCode - b.charCode;
  24496. });
  24497. for (let i = 1; i < mappings.length; i++) {
  24498. if (mappings[i - 1].charCode === mappings[i].charCode) {
  24499. mappings.splice(i, 1);
  24500. i--;
  24501. }
  24502. }
  24503. return {
  24504. platformId: potentialTable.platformId,
  24505. encodingId: potentialTable.encodingId,
  24506. mappings,
  24507. hasShortCmap
  24508. };
  24509. }
  24510. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  24511. if (!header) {
  24512. if (metrics) {
  24513. metrics.data = null;
  24514. }
  24515. return;
  24516. }
  24517. file.pos = (file.start || 0) + header.offset;
  24518. file.pos += 4;
  24519. file.pos += 2;
  24520. file.pos += 2;
  24521. file.pos += 2;
  24522. file.pos += 2;
  24523. file.pos += 2;
  24524. file.pos += 2;
  24525. file.pos += 2;
  24526. file.pos += 2;
  24527. file.pos += 2;
  24528. const caretOffset = file.getUint16();
  24529. file.pos += 8;
  24530. file.pos += 2;
  24531. let numOfMetrics = file.getUint16();
  24532. if (caretOffset !== 0) {
  24533. const macStyle = int16(headTable.data[44], headTable.data[45]);
  24534. if (!(macStyle & 2)) {
  24535. header.data[22] = 0;
  24536. header.data[23] = 0;
  24537. }
  24538. }
  24539. if (numOfMetrics > numGlyphs) {
  24540. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  24541. numOfMetrics = numGlyphs;
  24542. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  24543. header.data[35] = numOfMetrics & 0x00ff;
  24544. }
  24545. const numOfSidebearings = numGlyphs - numOfMetrics;
  24546. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  24547. if (numMissing > 0) {
  24548. const entries = new Uint8Array(metrics.length + numMissing * 2);
  24549. entries.set(metrics.data);
  24550. if (dupFirstEntry) {
  24551. entries[metrics.length] = metrics.data[2];
  24552. entries[metrics.length + 1] = metrics.data[3];
  24553. }
  24554. metrics.data = entries;
  24555. }
  24556. }
  24557. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  24558. const glyphProfile = {
  24559. length: 0,
  24560. sizeOfInstructions: 0
  24561. };
  24562. if (sourceEnd - sourceStart <= 12) {
  24563. return glyphProfile;
  24564. }
  24565. const glyf = source.subarray(sourceStart, sourceEnd);
  24566. let contoursCount = signedInt16(glyf[0], glyf[1]);
  24567. if (contoursCount < 0) {
  24568. contoursCount = -1;
  24569. writeSignedInt16(glyf, 0, contoursCount);
  24570. dest.set(glyf, destStart);
  24571. glyphProfile.length = glyf.length;
  24572. return glyphProfile;
  24573. }
  24574. let i,
  24575. j = 10,
  24576. flagsCount = 0;
  24577. for (i = 0; i < contoursCount; i++) {
  24578. const endPoint = glyf[j] << 8 | glyf[j + 1];
  24579. flagsCount = endPoint + 1;
  24580. j += 2;
  24581. }
  24582. const instructionsStart = j;
  24583. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  24584. glyphProfile.sizeOfInstructions = instructionsLength;
  24585. j += 2 + instructionsLength;
  24586. const instructionsEnd = j;
  24587. let coordinatesLength = 0;
  24588. for (i = 0; i < flagsCount; i++) {
  24589. const flag = glyf[j++];
  24590. if (flag & 0xc0) {
  24591. glyf[j - 1] = flag & 0x3f;
  24592. }
  24593. let xLength = 2;
  24594. if (flag & 2) {
  24595. xLength = 1;
  24596. } else if (flag & 16) {
  24597. xLength = 0;
  24598. }
  24599. let yLength = 2;
  24600. if (flag & 4) {
  24601. yLength = 1;
  24602. } else if (flag & 32) {
  24603. yLength = 0;
  24604. }
  24605. const xyLength = xLength + yLength;
  24606. coordinatesLength += xyLength;
  24607. if (flag & 8) {
  24608. const repeat = glyf[j++];
  24609. i += repeat;
  24610. coordinatesLength += repeat * xyLength;
  24611. }
  24612. }
  24613. if (coordinatesLength === 0) {
  24614. return glyphProfile;
  24615. }
  24616. let glyphDataLength = j + coordinatesLength;
  24617. if (glyphDataLength > glyf.length) {
  24618. return glyphProfile;
  24619. }
  24620. if (!hintsValid && instructionsLength > 0) {
  24621. dest.set(glyf.subarray(0, instructionsStart), destStart);
  24622. dest.set([0, 0], destStart + instructionsStart);
  24623. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  24624. glyphDataLength -= instructionsLength;
  24625. if (glyf.length - glyphDataLength > 3) {
  24626. glyphDataLength = glyphDataLength + 3 & ~3;
  24627. }
  24628. glyphProfile.length = glyphDataLength;
  24629. return glyphProfile;
  24630. }
  24631. if (glyf.length - glyphDataLength > 3) {
  24632. glyphDataLength = glyphDataLength + 3 & ~3;
  24633. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  24634. glyphProfile.length = glyphDataLength;
  24635. return glyphProfile;
  24636. }
  24637. dest.set(glyf, destStart);
  24638. glyphProfile.length = glyf.length;
  24639. return glyphProfile;
  24640. }
  24641. function sanitizeHead(head, numGlyphs, locaLength) {
  24642. const data = head.data;
  24643. const version = int32(data[0], data[1], data[2], data[3]);
  24644. if (version >> 16 !== 1) {
  24645. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  24646. data[0] = 0;
  24647. data[1] = 1;
  24648. data[2] = 0;
  24649. data[3] = 0;
  24650. }
  24651. const indexToLocFormat = int16(data[50], data[51]);
  24652. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  24653. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  24654. const numGlyphsPlusOne = numGlyphs + 1;
  24655. if (locaLength === numGlyphsPlusOne << 1) {
  24656. data[50] = 0;
  24657. data[51] = 0;
  24658. } else if (locaLength === numGlyphsPlusOne << 2) {
  24659. data[50] = 0;
  24660. data[51] = 1;
  24661. } else {
  24662. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  24663. }
  24664. }
  24665. }
  24666. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  24667. let itemSize, itemDecode, itemEncode;
  24668. if (isGlyphLocationsLong) {
  24669. itemSize = 4;
  24670. itemDecode = function fontItemDecodeLong(data, offset) {
  24671. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  24672. };
  24673. itemEncode = function fontItemEncodeLong(data, offset, value) {
  24674. data[offset] = value >>> 24 & 0xff;
  24675. data[offset + 1] = value >> 16 & 0xff;
  24676. data[offset + 2] = value >> 8 & 0xff;
  24677. data[offset + 3] = value & 0xff;
  24678. };
  24679. } else {
  24680. itemSize = 2;
  24681. itemDecode = function fontItemDecode(data, offset) {
  24682. return data[offset] << 9 | data[offset + 1] << 1;
  24683. };
  24684. itemEncode = function fontItemEncode(data, offset, value) {
  24685. data[offset] = value >> 9 & 0xff;
  24686. data[offset + 1] = value >> 1 & 0xff;
  24687. };
  24688. }
  24689. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  24690. const locaDataSize = itemSize * (1 + numGlyphsOut);
  24691. const locaData = new Uint8Array(locaDataSize);
  24692. locaData.set(loca.data.subarray(0, locaDataSize));
  24693. loca.data = locaData;
  24694. const oldGlyfData = glyf.data;
  24695. const oldGlyfDataLength = oldGlyfData.length;
  24696. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  24697. let i, j;
  24698. const locaEntries = [];
  24699. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  24700. let offset = itemDecode(locaData, j);
  24701. if (offset > oldGlyfDataLength) {
  24702. offset = oldGlyfDataLength;
  24703. }
  24704. locaEntries.push({
  24705. index: i,
  24706. offset,
  24707. endOffset: 0
  24708. });
  24709. }
  24710. locaEntries.sort((a, b) => {
  24711. return a.offset - b.offset;
  24712. });
  24713. for (i = 0; i < numGlyphs; i++) {
  24714. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  24715. }
  24716. locaEntries.sort((a, b) => {
  24717. return a.index - b.index;
  24718. });
  24719. for (i = 0; i < numGlyphs; i++) {
  24720. const {
  24721. offset,
  24722. endOffset
  24723. } = locaEntries[i];
  24724. if (offset !== 0 || endOffset !== 0) {
  24725. break;
  24726. }
  24727. const nextOffset = locaEntries[i + 1].offset;
  24728. if (nextOffset === 0) {
  24729. continue;
  24730. }
  24731. locaEntries[i].endOffset = nextOffset;
  24732. break;
  24733. }
  24734. const missingGlyphs = Object.create(null);
  24735. let writeOffset = 0;
  24736. itemEncode(locaData, 0, writeOffset);
  24737. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  24738. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  24739. const newLength = glyphProfile.length;
  24740. if (newLength === 0) {
  24741. missingGlyphs[i] = true;
  24742. }
  24743. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  24744. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  24745. }
  24746. writeOffset += newLength;
  24747. itemEncode(locaData, j, writeOffset);
  24748. }
  24749. if (writeOffset === 0) {
  24750. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  24751. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  24752. itemEncode(locaData, j, simpleGlyph.length);
  24753. }
  24754. glyf.data = simpleGlyph;
  24755. } else if (dupFirstEntry) {
  24756. const firstEntryLength = itemDecode(locaData, itemSize);
  24757. if (newGlyfData.length > firstEntryLength + writeOffset) {
  24758. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  24759. } else {
  24760. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  24761. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  24762. }
  24763. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  24764. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  24765. } else {
  24766. glyf.data = newGlyfData.subarray(0, writeOffset);
  24767. }
  24768. return {
  24769. missingGlyphs,
  24770. maxSizeOfInstructions
  24771. };
  24772. }
  24773. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  24774. const start = (font.start || 0) + post.offset;
  24775. font.pos = start;
  24776. const length = post.length,
  24777. end = start + length;
  24778. const version = font.getInt32();
  24779. font.skip(28);
  24780. let glyphNames;
  24781. let valid = true;
  24782. let i;
  24783. switch (version) {
  24784. case 0x00010000:
  24785. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  24786. break;
  24787. case 0x00020000:
  24788. const numGlyphs = font.getUint16();
  24789. if (numGlyphs !== maxpNumGlyphs) {
  24790. valid = false;
  24791. break;
  24792. }
  24793. const glyphNameIndexes = [];
  24794. for (i = 0; i < numGlyphs; ++i) {
  24795. const index = font.getUint16();
  24796. if (index >= 32768) {
  24797. valid = false;
  24798. break;
  24799. }
  24800. glyphNameIndexes.push(index);
  24801. }
  24802. if (!valid) {
  24803. break;
  24804. }
  24805. const customNames = [],
  24806. strBuf = [];
  24807. while (font.pos < end) {
  24808. const stringLength = font.getByte();
  24809. strBuf.length = stringLength;
  24810. for (i = 0; i < stringLength; ++i) {
  24811. strBuf[i] = String.fromCharCode(font.getByte());
  24812. }
  24813. customNames.push(strBuf.join(""));
  24814. }
  24815. glyphNames = [];
  24816. for (i = 0; i < numGlyphs; ++i) {
  24817. const j = glyphNameIndexes[i];
  24818. if (j < 258) {
  24819. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  24820. continue;
  24821. }
  24822. glyphNames.push(customNames[j - 258]);
  24823. }
  24824. break;
  24825. case 0x00030000:
  24826. break;
  24827. default:
  24828. (0, _util.warn)("Unknown/unsupported post table version " + version);
  24829. valid = false;
  24830. if (propertiesObj.defaultEncoding) {
  24831. glyphNames = propertiesObj.defaultEncoding;
  24832. }
  24833. break;
  24834. }
  24835. propertiesObj.glyphNames = glyphNames;
  24836. return valid;
  24837. }
  24838. function readNameTable(nameTable) {
  24839. const start = (font.start || 0) + nameTable.offset;
  24840. font.pos = start;
  24841. const names = [[], []];
  24842. const length = nameTable.length,
  24843. end = start + length;
  24844. const format = font.getUint16();
  24845. const FORMAT_0_HEADER_LENGTH = 6;
  24846. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  24847. return names;
  24848. }
  24849. const numRecords = font.getUint16();
  24850. const stringsStart = font.getUint16();
  24851. const records = [];
  24852. const NAME_RECORD_LENGTH = 12;
  24853. let i, ii;
  24854. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  24855. const r = {
  24856. platform: font.getUint16(),
  24857. encoding: font.getUint16(),
  24858. language: font.getUint16(),
  24859. name: font.getUint16(),
  24860. length: font.getUint16(),
  24861. offset: font.getUint16()
  24862. };
  24863. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  24864. records.push(r);
  24865. }
  24866. }
  24867. for (i = 0, ii = records.length; i < ii; i++) {
  24868. const record = records[i];
  24869. if (record.length <= 0) {
  24870. continue;
  24871. }
  24872. const pos = start + stringsStart + record.offset;
  24873. if (pos + record.length > end) {
  24874. continue;
  24875. }
  24876. font.pos = pos;
  24877. const nameIndex = record.name;
  24878. if (record.encoding) {
  24879. let str = "";
  24880. for (let j = 0, jj = record.length; j < jj; j += 2) {
  24881. str += String.fromCharCode(font.getUint16());
  24882. }
  24883. names[1][nameIndex] = str;
  24884. } else {
  24885. names[0][nameIndex] = font.getString(record.length);
  24886. }
  24887. }
  24888. return names;
  24889. }
  24890. 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];
  24891. function sanitizeTTProgram(table, ttContext) {
  24892. let data = table.data;
  24893. let i = 0,
  24894. j,
  24895. n,
  24896. b,
  24897. funcId,
  24898. pc,
  24899. lastEndf = 0,
  24900. lastDeff = 0;
  24901. const stack = [];
  24902. const callstack = [];
  24903. const functionsCalled = [];
  24904. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  24905. let inFDEF = false,
  24906. ifLevel = 0,
  24907. inELSE = 0;
  24908. for (let ii = data.length; i < ii;) {
  24909. const op = data[i++];
  24910. if (op === 0x40) {
  24911. n = data[i++];
  24912. if (inFDEF || inELSE) {
  24913. i += n;
  24914. } else {
  24915. for (j = 0; j < n; j++) {
  24916. stack.push(data[i++]);
  24917. }
  24918. }
  24919. } else if (op === 0x41) {
  24920. n = data[i++];
  24921. if (inFDEF || inELSE) {
  24922. i += n * 2;
  24923. } else {
  24924. for (j = 0; j < n; j++) {
  24925. b = data[i++];
  24926. stack.push(b << 8 | data[i++]);
  24927. }
  24928. }
  24929. } else if ((op & 0xf8) === 0xb0) {
  24930. n = op - 0xb0 + 1;
  24931. if (inFDEF || inELSE) {
  24932. i += n;
  24933. } else {
  24934. for (j = 0; j < n; j++) {
  24935. stack.push(data[i++]);
  24936. }
  24937. }
  24938. } else if ((op & 0xf8) === 0xb8) {
  24939. n = op - 0xb8 + 1;
  24940. if (inFDEF || inELSE) {
  24941. i += n * 2;
  24942. } else {
  24943. for (j = 0; j < n; j++) {
  24944. b = data[i++];
  24945. stack.push(b << 8 | data[i++]);
  24946. }
  24947. }
  24948. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  24949. if (!inFDEF && !inELSE) {
  24950. funcId = stack.at(-1);
  24951. if (isNaN(funcId)) {
  24952. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  24953. } else {
  24954. ttContext.functionsUsed[funcId] = true;
  24955. if (funcId in ttContext.functionsStackDeltas) {
  24956. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  24957. if (newStackLength < 0) {
  24958. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  24959. ttContext.hintsValid = false;
  24960. return;
  24961. }
  24962. stack.length = newStackLength;
  24963. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  24964. callstack.push({
  24965. data,
  24966. i,
  24967. stackTop: stack.length - 1
  24968. });
  24969. functionsCalled.push(funcId);
  24970. pc = ttContext.functionsDefined[funcId];
  24971. if (!pc) {
  24972. (0, _util.warn)("TT: CALL non-existent function");
  24973. ttContext.hintsValid = false;
  24974. return;
  24975. }
  24976. data = pc.data;
  24977. i = pc.i;
  24978. }
  24979. }
  24980. }
  24981. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  24982. if (inFDEF || inELSE) {
  24983. (0, _util.warn)("TT: nested FDEFs not allowed");
  24984. tooComplexToFollowFunctions = true;
  24985. }
  24986. inFDEF = true;
  24987. lastDeff = i;
  24988. funcId = stack.pop();
  24989. ttContext.functionsDefined[funcId] = {
  24990. data,
  24991. i
  24992. };
  24993. } else if (op === 0x2d) {
  24994. if (inFDEF) {
  24995. inFDEF = false;
  24996. lastEndf = i;
  24997. } else {
  24998. pc = callstack.pop();
  24999. if (!pc) {
  25000. (0, _util.warn)("TT: ENDF bad stack");
  25001. ttContext.hintsValid = false;
  25002. return;
  25003. }
  25004. funcId = functionsCalled.pop();
  25005. data = pc.data;
  25006. i = pc.i;
  25007. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  25008. }
  25009. } else if (op === 0x89) {
  25010. if (inFDEF || inELSE) {
  25011. (0, _util.warn)("TT: nested IDEFs not allowed");
  25012. tooComplexToFollowFunctions = true;
  25013. }
  25014. inFDEF = true;
  25015. lastDeff = i;
  25016. } else if (op === 0x58) {
  25017. ++ifLevel;
  25018. } else if (op === 0x1b) {
  25019. inELSE = ifLevel;
  25020. } else if (op === 0x59) {
  25021. if (inELSE === ifLevel) {
  25022. inELSE = 0;
  25023. }
  25024. --ifLevel;
  25025. } else if (op === 0x1c) {
  25026. if (!inFDEF && !inELSE) {
  25027. const offset = stack.at(-1);
  25028. if (offset > 0) {
  25029. i += offset - 1;
  25030. }
  25031. }
  25032. }
  25033. if (!inFDEF && !inELSE) {
  25034. let stackDelta = 0;
  25035. if (op <= 0x8e) {
  25036. stackDelta = TTOpsStackDeltas[op];
  25037. } else if (op >= 0xc0 && op <= 0xdf) {
  25038. stackDelta = -1;
  25039. } else if (op >= 0xe0) {
  25040. stackDelta = -2;
  25041. }
  25042. if (op >= 0x71 && op <= 0x75) {
  25043. n = stack.pop();
  25044. if (!isNaN(n)) {
  25045. stackDelta = -n * 2;
  25046. }
  25047. }
  25048. while (stackDelta < 0 && stack.length > 0) {
  25049. stack.pop();
  25050. stackDelta++;
  25051. }
  25052. while (stackDelta > 0) {
  25053. stack.push(NaN);
  25054. stackDelta--;
  25055. }
  25056. }
  25057. }
  25058. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  25059. const content = [data];
  25060. if (i > data.length) {
  25061. content.push(new Uint8Array(i - data.length));
  25062. }
  25063. if (lastDeff > lastEndf) {
  25064. (0, _util.warn)("TT: complementing a missing function tail");
  25065. content.push(new Uint8Array([0x22, 0x2d]));
  25066. }
  25067. foldTTTable(table, content);
  25068. }
  25069. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  25070. if (ttContext.tooComplexToFollowFunctions) {
  25071. return;
  25072. }
  25073. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  25074. (0, _util.warn)("TT: more functions defined than expected");
  25075. ttContext.hintsValid = false;
  25076. return;
  25077. }
  25078. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  25079. if (j > maxFunctionDefs) {
  25080. (0, _util.warn)("TT: invalid function id: " + j);
  25081. ttContext.hintsValid = false;
  25082. return;
  25083. }
  25084. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  25085. (0, _util.warn)("TT: undefined function: " + j);
  25086. ttContext.hintsValid = false;
  25087. return;
  25088. }
  25089. }
  25090. }
  25091. function foldTTTable(table, content) {
  25092. if (content.length > 1) {
  25093. let newLength = 0;
  25094. let j, jj;
  25095. for (j = 0, jj = content.length; j < jj; j++) {
  25096. newLength += content[j].length;
  25097. }
  25098. newLength = newLength + 3 & ~3;
  25099. const result = new Uint8Array(newLength);
  25100. let pos = 0;
  25101. for (j = 0, jj = content.length; j < jj; j++) {
  25102. result.set(content[j], pos);
  25103. pos += content[j].length;
  25104. }
  25105. table.data = result;
  25106. table.length = newLength;
  25107. }
  25108. }
  25109. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  25110. const ttContext = {
  25111. functionsDefined: [],
  25112. functionsUsed: [],
  25113. functionsStackDeltas: [],
  25114. tooComplexToFollowFunctions: false,
  25115. hintsValid: true
  25116. };
  25117. if (fpgm) {
  25118. sanitizeTTProgram(fpgm, ttContext);
  25119. }
  25120. if (prep) {
  25121. sanitizeTTProgram(prep, ttContext);
  25122. }
  25123. if (fpgm) {
  25124. checkInvalidFunctions(ttContext, maxFunctionDefs);
  25125. }
  25126. if (cvt && cvt.length & 1) {
  25127. const cvtData = new Uint8Array(cvt.length + 1);
  25128. cvtData.set(cvt.data);
  25129. cvt.data = cvtData;
  25130. }
  25131. return ttContext.hintsValid;
  25132. }
  25133. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  25134. let header, tables;
  25135. if (isTrueTypeCollectionFile(font)) {
  25136. const ttcData = readTrueTypeCollectionData(font, this.name);
  25137. header = ttcData.header;
  25138. tables = ttcData.tables;
  25139. } else {
  25140. header = readOpenTypeHeader(font);
  25141. tables = readTables(font, header.numTables);
  25142. }
  25143. let cff, cffFile;
  25144. const isTrueType = !tables["CFF "];
  25145. if (!isTrueType) {
  25146. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  25147. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  25148. cffFile = new _stream.Stream(tables["CFF "].data);
  25149. cff = new _cff_font.CFFFont(cffFile, properties);
  25150. adjustWidths(properties);
  25151. return this.convert(name, cff, properties);
  25152. }
  25153. delete tables.glyf;
  25154. delete tables.loca;
  25155. delete tables.fpgm;
  25156. delete tables.prep;
  25157. delete tables["cvt "];
  25158. this.isOpenType = true;
  25159. } else {
  25160. if (!tables.loca) {
  25161. throw new _util.FormatError('Required "loca" table is not found');
  25162. }
  25163. if (!tables.glyf) {
  25164. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  25165. tables.glyf = {
  25166. tag: "glyf",
  25167. data: new Uint8Array(0)
  25168. };
  25169. }
  25170. this.isOpenType = false;
  25171. }
  25172. if (!tables.maxp) {
  25173. throw new _util.FormatError('Required "maxp" table is not found');
  25174. }
  25175. font.pos = (font.start || 0) + tables.maxp.offset;
  25176. const version = font.getInt32();
  25177. const numGlyphs = font.getUint16();
  25178. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  25179. const {
  25180. scaleFactors
  25181. } = properties;
  25182. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25183. const glyphs = new _glyf.GlyfTable({
  25184. glyfTable: tables.glyf.data,
  25185. isGlyphLocationsLong,
  25186. locaTable: tables.loca.data,
  25187. numGlyphs
  25188. });
  25189. glyphs.scale(scaleFactors);
  25190. const {
  25191. glyf,
  25192. loca,
  25193. isLocationLong
  25194. } = glyphs.write();
  25195. tables.glyf.data = glyf;
  25196. tables.loca.data = loca;
  25197. if (isLocationLong !== !!isGlyphLocationsLong) {
  25198. tables.head.data[50] = 0;
  25199. tables.head.data[51] = isLocationLong ? 1 : 0;
  25200. }
  25201. const metrics = tables.hmtx.data;
  25202. for (let i = 0; i < numGlyphs; i++) {
  25203. const j = 4 * i;
  25204. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  25205. metrics[j] = advanceWidth >> 8 & 0xff;
  25206. metrics[j + 1] = advanceWidth & 0xff;
  25207. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  25208. writeSignedInt16(metrics, j + 2, lsb);
  25209. }
  25210. }
  25211. let numGlyphsOut = numGlyphs + 1;
  25212. let dupFirstEntry = true;
  25213. if (numGlyphsOut > 0xffff) {
  25214. dupFirstEntry = false;
  25215. numGlyphsOut = numGlyphs;
  25216. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  25217. }
  25218. let maxFunctionDefs = 0;
  25219. let maxSizeOfInstructions = 0;
  25220. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25221. font.pos += 8;
  25222. const maxZones = font.getUint16();
  25223. if (maxZones > 2) {
  25224. tables.maxp.data[14] = 0;
  25225. tables.maxp.data[15] = 2;
  25226. }
  25227. font.pos += 4;
  25228. maxFunctionDefs = font.getUint16();
  25229. font.pos += 4;
  25230. maxSizeOfInstructions = font.getUint16();
  25231. }
  25232. tables.maxp.data[4] = numGlyphsOut >> 8;
  25233. tables.maxp.data[5] = numGlyphsOut & 255;
  25234. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  25235. if (!hintsValid) {
  25236. delete tables.fpgm;
  25237. delete tables.prep;
  25238. delete tables["cvt "];
  25239. }
  25240. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  25241. if (!tables.head) {
  25242. throw new _util.FormatError('Required "head" table is not found');
  25243. }
  25244. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  25245. let missingGlyphs = Object.create(null);
  25246. if (isTrueType) {
  25247. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  25248. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  25249. missingGlyphs = glyphsInfo.missingGlyphs;
  25250. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  25251. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  25252. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  25253. }
  25254. }
  25255. if (!tables.hhea) {
  25256. throw new _util.FormatError('Required "hhea" table is not found');
  25257. }
  25258. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  25259. tables.hhea.data[10] = 0xff;
  25260. tables.hhea.data[11] = 0xff;
  25261. }
  25262. const metricsOverride = {
  25263. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  25264. yMax: int16(tables.head.data[42], tables.head.data[43]),
  25265. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  25266. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  25267. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  25268. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  25269. };
  25270. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  25271. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  25272. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  25273. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  25274. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  25275. this.lineGap = this.cssFontInfo.metrics.lineGap;
  25276. } else {
  25277. this.lineHeight = this.ascent - this.descent + this.lineGap;
  25278. }
  25279. if (tables.post) {
  25280. readPostScriptTable(tables.post, properties, numGlyphs);
  25281. }
  25282. tables.post = {
  25283. tag: "post",
  25284. data: createPostTable(properties)
  25285. };
  25286. const charCodeToGlyphId = [];
  25287. function hasGlyph(glyphId) {
  25288. return !missingGlyphs[glyphId];
  25289. }
  25290. if (properties.composite) {
  25291. const cidToGidMap = properties.cidToGidMap || [];
  25292. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  25293. properties.cMap.forEach(function (charCode, cid) {
  25294. if (typeof cid === "string") {
  25295. cid = convertCidString(charCode, cid, true);
  25296. }
  25297. if (cid > 0xffff) {
  25298. throw new _util.FormatError("Max size of CID is 65,535");
  25299. }
  25300. let glyphId = -1;
  25301. if (isCidToGidMapEmpty) {
  25302. glyphId = cid;
  25303. } else if (cidToGidMap[cid] !== undefined) {
  25304. glyphId = cidToGidMap[cid];
  25305. }
  25306. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  25307. charCodeToGlyphId[charCode] = glyphId;
  25308. }
  25309. });
  25310. } else {
  25311. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  25312. const cmapPlatformId = cmapTable.platformId;
  25313. const cmapEncodingId = cmapTable.encodingId;
  25314. const cmapMappings = cmapTable.mappings;
  25315. let baseEncoding = [],
  25316. forcePostTable = false;
  25317. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  25318. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  25319. }
  25320. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  25321. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25322. for (let charCode = 0; charCode < 256; charCode++) {
  25323. let glyphName;
  25324. if (this.differences[charCode] !== undefined) {
  25325. glyphName = this.differences[charCode];
  25326. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  25327. glyphName = baseEncoding[charCode];
  25328. } else {
  25329. glyphName = _encodings.StandardEncoding[charCode];
  25330. }
  25331. if (!glyphName) {
  25332. continue;
  25333. }
  25334. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  25335. let unicodeOrCharCode;
  25336. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  25337. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  25338. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  25339. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  25340. }
  25341. if (unicodeOrCharCode === undefined) {
  25342. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  25343. const unicode = this.toUnicode.get(charCode);
  25344. if (unicode) {
  25345. unicodeOrCharCode = unicode.codePointAt(0);
  25346. }
  25347. }
  25348. if (unicodeOrCharCode === undefined) {
  25349. continue;
  25350. }
  25351. }
  25352. for (const mapping of cmapMappings) {
  25353. if (mapping.charCode !== unicodeOrCharCode) {
  25354. continue;
  25355. }
  25356. charCodeToGlyphId[charCode] = mapping.glyphId;
  25357. break;
  25358. }
  25359. }
  25360. } else if (cmapPlatformId === 0) {
  25361. for (const mapping of cmapMappings) {
  25362. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  25363. }
  25364. forcePostTable = true;
  25365. } else {
  25366. for (const mapping of cmapMappings) {
  25367. let charCode = mapping.charCode;
  25368. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  25369. charCode &= 0xff;
  25370. }
  25371. charCodeToGlyphId[charCode] = mapping.glyphId;
  25372. }
  25373. }
  25374. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  25375. for (let i = 0; i < 256; ++i) {
  25376. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  25377. continue;
  25378. }
  25379. const glyphName = this.differences[i] || baseEncoding[i];
  25380. if (!glyphName) {
  25381. continue;
  25382. }
  25383. const glyphId = properties.glyphNames.indexOf(glyphName);
  25384. if (glyphId > 0 && hasGlyph(glyphId)) {
  25385. charCodeToGlyphId[i] = glyphId;
  25386. }
  25387. }
  25388. }
  25389. }
  25390. if (charCodeToGlyphId.length === 0) {
  25391. charCodeToGlyphId[0] = 0;
  25392. }
  25393. let glyphZeroId = numGlyphsOut - 1;
  25394. if (!dupFirstEntry) {
  25395. glyphZeroId = 0;
  25396. }
  25397. if (!properties.cssFontInfo) {
  25398. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  25399. this.toFontChar = newMapping.toFontChar;
  25400. tables.cmap = {
  25401. tag: "cmap",
  25402. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  25403. };
  25404. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  25405. tables["OS/2"] = {
  25406. tag: "OS/2",
  25407. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  25408. };
  25409. }
  25410. }
  25411. if (!isTrueType) {
  25412. try {
  25413. cffFile = new _stream.Stream(tables["CFF "].data);
  25414. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  25415. cff = parser.parse();
  25416. cff.duplicateFirstGlyph();
  25417. const compiler = new _cff_parser.CFFCompiler(cff);
  25418. tables["CFF "].data = compiler.compile();
  25419. } catch (e) {
  25420. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  25421. }
  25422. }
  25423. if (!tables.name) {
  25424. tables.name = {
  25425. tag: "name",
  25426. data: createNameTable(this.name)
  25427. };
  25428. } else {
  25429. const namePrototype = readNameTable(tables.name);
  25430. tables.name.data = createNameTable(name, namePrototype);
  25431. this.psName = namePrototype[0][6] || null;
  25432. }
  25433. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  25434. for (const tableTag in tables) {
  25435. builder.addTable(tableTag, tables[tableTag].data);
  25436. }
  25437. return builder.toArray();
  25438. }
  25439. convert(fontName, font, properties) {
  25440. properties.fixedPitch = false;
  25441. if (properties.builtInEncoding) {
  25442. adjustToUnicode(properties, properties.builtInEncoding);
  25443. }
  25444. let glyphZeroId = 1;
  25445. if (font instanceof _cff_font.CFFFont) {
  25446. glyphZeroId = font.numGlyphs - 1;
  25447. }
  25448. const mapping = font.getGlyphMapping(properties);
  25449. let newMapping = null;
  25450. let newCharCodeToGlyphId = mapping;
  25451. let toUnicodeExtraMap = null;
  25452. if (!properties.cssFontInfo) {
  25453. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  25454. this.toFontChar = newMapping.toFontChar;
  25455. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  25456. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  25457. }
  25458. const numGlyphs = font.numGlyphs;
  25459. function getCharCodes(charCodeToGlyphId, glyphId) {
  25460. let charCodes = null;
  25461. for (const charCode in charCodeToGlyphId) {
  25462. if (glyphId === charCodeToGlyphId[charCode]) {
  25463. if (!charCodes) {
  25464. charCodes = [];
  25465. }
  25466. charCodes.push(charCode | 0);
  25467. }
  25468. }
  25469. return charCodes;
  25470. }
  25471. function createCharCode(charCodeToGlyphId, glyphId) {
  25472. for (const charCode in charCodeToGlyphId) {
  25473. if (glyphId === charCodeToGlyphId[charCode]) {
  25474. return charCode | 0;
  25475. }
  25476. }
  25477. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  25478. return newMapping.nextAvailableFontCharCode++;
  25479. }
  25480. const seacs = font.seacs;
  25481. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  25482. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  25483. const charset = font.getCharset();
  25484. const seacMap = Object.create(null);
  25485. for (let glyphId in seacs) {
  25486. glyphId |= 0;
  25487. const seac = seacs[glyphId];
  25488. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  25489. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  25490. const baseGlyphId = charset.indexOf(baseGlyphName);
  25491. const accentGlyphId = charset.indexOf(accentGlyphName);
  25492. if (baseGlyphId < 0 || accentGlyphId < 0) {
  25493. continue;
  25494. }
  25495. const accentOffset = {
  25496. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  25497. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  25498. };
  25499. const charCodes = getCharCodes(mapping, glyphId);
  25500. if (!charCodes) {
  25501. continue;
  25502. }
  25503. for (const charCode of charCodes) {
  25504. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  25505. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  25506. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  25507. seacMap[charCode] = {
  25508. baseFontCharCode,
  25509. accentFontCharCode,
  25510. accentOffset
  25511. };
  25512. }
  25513. }
  25514. properties.seacMap = seacMap;
  25515. }
  25516. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  25517. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  25518. builder.addTable("CFF ", font.data);
  25519. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  25520. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  25521. 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");
  25522. 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));
  25523. builder.addTable("hmtx", function fontFieldsHmtx() {
  25524. const charstrings = font.charstrings;
  25525. const cffWidths = font.cff ? font.cff.widths : null;
  25526. let hmtx = "\x00\x00\x00\x00";
  25527. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  25528. let width = 0;
  25529. if (charstrings) {
  25530. const charstring = charstrings[i - 1];
  25531. width = "width" in charstring ? charstring.width : 0;
  25532. } else if (cffWidths) {
  25533. width = Math.ceil(cffWidths[i] || 0);
  25534. }
  25535. hmtx += string16(width) + string16(0);
  25536. }
  25537. return hmtx;
  25538. }());
  25539. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  25540. builder.addTable("name", createNameTable(fontName));
  25541. builder.addTable("post", createPostTable(properties));
  25542. return builder.toArray();
  25543. }
  25544. get spaceWidth() {
  25545. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  25546. let width;
  25547. for (const glyphName of possibleSpaceReplacements) {
  25548. if (glyphName in this.widths) {
  25549. width = this.widths[glyphName];
  25550. break;
  25551. }
  25552. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  25553. const glyphUnicode = glyphsUnicodeMap[glyphName];
  25554. let charcode = 0;
  25555. if (this.composite && this.cMap.contains(glyphUnicode)) {
  25556. charcode = this.cMap.lookup(glyphUnicode);
  25557. if (typeof charcode === "string") {
  25558. charcode = convertCidString(glyphUnicode, charcode);
  25559. }
  25560. }
  25561. if (!charcode && this.toUnicode) {
  25562. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  25563. }
  25564. if (charcode <= 0) {
  25565. charcode = glyphUnicode;
  25566. }
  25567. width = this.widths[charcode];
  25568. if (width) {
  25569. break;
  25570. }
  25571. }
  25572. width = width || this.defaultWidth;
  25573. return (0, _util.shadow)(this, "spaceWidth", width);
  25574. }
  25575. _charToGlyph(charcode) {
  25576. let isSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  25577. let glyph = this._glyphCache[charcode];
  25578. if (glyph && glyph.isSpace === isSpace) {
  25579. return glyph;
  25580. }
  25581. let fontCharCode, width, operatorListId;
  25582. let widthCode = charcode;
  25583. if (this.cMap && this.cMap.contains(charcode)) {
  25584. widthCode = this.cMap.lookup(charcode);
  25585. if (typeof widthCode === "string") {
  25586. widthCode = convertCidString(charcode, widthCode);
  25587. }
  25588. }
  25589. width = this.widths[widthCode];
  25590. if (typeof width !== "number") {
  25591. width = this.defaultWidth;
  25592. }
  25593. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  25594. let unicode = this.toUnicode.get(charcode) || charcode;
  25595. if (typeof unicode === "number") {
  25596. unicode = String.fromCharCode(unicode);
  25597. }
  25598. let isInFont = this.toFontChar[charcode] !== undefined;
  25599. fontCharCode = this.toFontChar[charcode] || charcode;
  25600. if (this.missingFile) {
  25601. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  25602. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  25603. fontCharCode = 0x20;
  25604. }
  25605. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  25606. }
  25607. if (this.isType3Font) {
  25608. operatorListId = fontCharCode;
  25609. }
  25610. let accent = null;
  25611. if (this.seacMap && this.seacMap[charcode]) {
  25612. isInFont = true;
  25613. const seac = this.seacMap[charcode];
  25614. fontCharCode = seac.baseFontCharCode;
  25615. accent = {
  25616. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  25617. offset: seac.accentOffset
  25618. };
  25619. }
  25620. let fontChar = "";
  25621. if (typeof fontCharCode === "number") {
  25622. if (fontCharCode <= 0x10ffff) {
  25623. fontChar = String.fromCodePoint(fontCharCode);
  25624. } else {
  25625. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  25626. }
  25627. }
  25628. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  25629. return this._glyphCache[charcode] = glyph;
  25630. }
  25631. charsToGlyphs(chars) {
  25632. let glyphs = this._charsCache[chars];
  25633. if (glyphs) {
  25634. return glyphs;
  25635. }
  25636. glyphs = [];
  25637. if (this.cMap) {
  25638. const c = Object.create(null),
  25639. ii = chars.length;
  25640. let i = 0;
  25641. while (i < ii) {
  25642. this.cMap.readCharCode(chars, i, c);
  25643. const {
  25644. charcode,
  25645. length
  25646. } = c;
  25647. i += length;
  25648. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  25649. glyphs.push(glyph);
  25650. }
  25651. } else {
  25652. for (let i = 0, ii = chars.length; i < ii; ++i) {
  25653. const charcode = chars.charCodeAt(i);
  25654. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  25655. glyphs.push(glyph);
  25656. }
  25657. }
  25658. return this._charsCache[chars] = glyphs;
  25659. }
  25660. getCharPositions(chars) {
  25661. const positions = [];
  25662. if (this.cMap) {
  25663. const c = Object.create(null);
  25664. let i = 0;
  25665. while (i < chars.length) {
  25666. this.cMap.readCharCode(chars, i, c);
  25667. const length = c.length;
  25668. positions.push([i, i + length]);
  25669. i += length;
  25670. }
  25671. } else {
  25672. for (let i = 0, ii = chars.length; i < ii; ++i) {
  25673. positions.push([i, i + 1]);
  25674. }
  25675. }
  25676. return positions;
  25677. }
  25678. get glyphCacheValues() {
  25679. return Object.values(this._glyphCache);
  25680. }
  25681. encodeString(str) {
  25682. const buffers = [];
  25683. const currentBuf = [];
  25684. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  25685. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  25686. for (let i = 0, ii = str.length; i < ii; i++) {
  25687. const unicode = str.codePointAt(i);
  25688. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  25689. i++;
  25690. }
  25691. if (this.toUnicode) {
  25692. const charCode = getCharCode(unicode);
  25693. if (charCode !== -1) {
  25694. if (hasCurrentBufErrors()) {
  25695. buffers.push(currentBuf.join(""));
  25696. currentBuf.length = 0;
  25697. }
  25698. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  25699. for (let j = charCodeLength - 1; j >= 0; j--) {
  25700. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  25701. }
  25702. continue;
  25703. }
  25704. }
  25705. if (!hasCurrentBufErrors()) {
  25706. buffers.push(currentBuf.join(""));
  25707. currentBuf.length = 0;
  25708. }
  25709. currentBuf.push(String.fromCodePoint(unicode));
  25710. }
  25711. buffers.push(currentBuf.join(""));
  25712. return buffers;
  25713. }
  25714. }
  25715. exports.Font = Font;
  25716. class ErrorFont {
  25717. constructor(error) {
  25718. this.error = error;
  25719. this.loadedName = "g_font_error";
  25720. this.missingFile = true;
  25721. }
  25722. charsToGlyphs() {
  25723. return [];
  25724. }
  25725. encodeString(chars) {
  25726. return [chars];
  25727. }
  25728. exportData() {
  25729. let extraProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  25730. return {
  25731. error: this.error
  25732. };
  25733. }
  25734. }
  25735. exports.ErrorFont = ErrorFont;
  25736. /***/ }),
  25737. /* 164 */
  25738. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25739. "use strict";
  25740. Object.defineProperty(exports, "__esModule", ({
  25741. value: true
  25742. }));
  25743. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  25744. var _util = __w_pdfjs_require__(2);
  25745. var _charsets = __w_pdfjs_require__(165);
  25746. var _encodings = __w_pdfjs_require__(166);
  25747. const MAX_SUBR_NESTING = 10;
  25748. 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"];
  25749. exports.CFFStandardStrings = CFFStandardStrings;
  25750. const NUM_STANDARD_CFF_STRINGS = 391;
  25751. const CharstringValidationData = [null, {
  25752. id: "hstem",
  25753. min: 2,
  25754. stackClearing: true,
  25755. stem: true
  25756. }, null, {
  25757. id: "vstem",
  25758. min: 2,
  25759. stackClearing: true,
  25760. stem: true
  25761. }, {
  25762. id: "vmoveto",
  25763. min: 1,
  25764. stackClearing: true
  25765. }, {
  25766. id: "rlineto",
  25767. min: 2,
  25768. resetStack: true
  25769. }, {
  25770. id: "hlineto",
  25771. min: 1,
  25772. resetStack: true
  25773. }, {
  25774. id: "vlineto",
  25775. min: 1,
  25776. resetStack: true
  25777. }, {
  25778. id: "rrcurveto",
  25779. min: 6,
  25780. resetStack: true
  25781. }, null, {
  25782. id: "callsubr",
  25783. min: 1,
  25784. undefStack: true
  25785. }, {
  25786. id: "return",
  25787. min: 0,
  25788. undefStack: true
  25789. }, null, null, {
  25790. id: "endchar",
  25791. min: 0,
  25792. stackClearing: true
  25793. }, null, null, null, {
  25794. id: "hstemhm",
  25795. min: 2,
  25796. stackClearing: true,
  25797. stem: true
  25798. }, {
  25799. id: "hintmask",
  25800. min: 0,
  25801. stackClearing: true
  25802. }, {
  25803. id: "cntrmask",
  25804. min: 0,
  25805. stackClearing: true
  25806. }, {
  25807. id: "rmoveto",
  25808. min: 2,
  25809. stackClearing: true
  25810. }, {
  25811. id: "hmoveto",
  25812. min: 1,
  25813. stackClearing: true
  25814. }, {
  25815. id: "vstemhm",
  25816. min: 2,
  25817. stackClearing: true,
  25818. stem: true
  25819. }, {
  25820. id: "rcurveline",
  25821. min: 8,
  25822. resetStack: true
  25823. }, {
  25824. id: "rlinecurve",
  25825. min: 8,
  25826. resetStack: true
  25827. }, {
  25828. id: "vvcurveto",
  25829. min: 4,
  25830. resetStack: true
  25831. }, {
  25832. id: "hhcurveto",
  25833. min: 4,
  25834. resetStack: true
  25835. }, null, {
  25836. id: "callgsubr",
  25837. min: 1,
  25838. undefStack: true
  25839. }, {
  25840. id: "vhcurveto",
  25841. min: 4,
  25842. resetStack: true
  25843. }, {
  25844. id: "hvcurveto",
  25845. min: 4,
  25846. resetStack: true
  25847. }];
  25848. const CharstringValidationData12 = [null, null, null, {
  25849. id: "and",
  25850. min: 2,
  25851. stackDelta: -1
  25852. }, {
  25853. id: "or",
  25854. min: 2,
  25855. stackDelta: -1
  25856. }, {
  25857. id: "not",
  25858. min: 1,
  25859. stackDelta: 0
  25860. }, null, null, null, {
  25861. id: "abs",
  25862. min: 1,
  25863. stackDelta: 0
  25864. }, {
  25865. id: "add",
  25866. min: 2,
  25867. stackDelta: -1,
  25868. stackFn(stack, index) {
  25869. stack[index - 2] = stack[index - 2] + stack[index - 1];
  25870. }
  25871. }, {
  25872. id: "sub",
  25873. min: 2,
  25874. stackDelta: -1,
  25875. stackFn(stack, index) {
  25876. stack[index - 2] = stack[index - 2] - stack[index - 1];
  25877. }
  25878. }, {
  25879. id: "div",
  25880. min: 2,
  25881. stackDelta: -1,
  25882. stackFn(stack, index) {
  25883. stack[index - 2] = stack[index - 2] / stack[index - 1];
  25884. }
  25885. }, null, {
  25886. id: "neg",
  25887. min: 1,
  25888. stackDelta: 0,
  25889. stackFn(stack, index) {
  25890. stack[index - 1] = -stack[index - 1];
  25891. }
  25892. }, {
  25893. id: "eq",
  25894. min: 2,
  25895. stackDelta: -1
  25896. }, null, null, {
  25897. id: "drop",
  25898. min: 1,
  25899. stackDelta: -1
  25900. }, null, {
  25901. id: "put",
  25902. min: 2,
  25903. stackDelta: -2
  25904. }, {
  25905. id: "get",
  25906. min: 1,
  25907. stackDelta: 0
  25908. }, {
  25909. id: "ifelse",
  25910. min: 4,
  25911. stackDelta: -3
  25912. }, {
  25913. id: "random",
  25914. min: 0,
  25915. stackDelta: 1
  25916. }, {
  25917. id: "mul",
  25918. min: 2,
  25919. stackDelta: -1,
  25920. stackFn(stack, index) {
  25921. stack[index - 2] = stack[index - 2] * stack[index - 1];
  25922. }
  25923. }, null, {
  25924. id: "sqrt",
  25925. min: 1,
  25926. stackDelta: 0
  25927. }, {
  25928. id: "dup",
  25929. min: 1,
  25930. stackDelta: 1
  25931. }, {
  25932. id: "exch",
  25933. min: 2,
  25934. stackDelta: 0
  25935. }, {
  25936. id: "index",
  25937. min: 2,
  25938. stackDelta: 0
  25939. }, {
  25940. id: "roll",
  25941. min: 3,
  25942. stackDelta: -2
  25943. }, null, null, null, {
  25944. id: "hflex",
  25945. min: 7,
  25946. resetStack: true
  25947. }, {
  25948. id: "flex",
  25949. min: 13,
  25950. resetStack: true
  25951. }, {
  25952. id: "hflex1",
  25953. min: 9,
  25954. resetStack: true
  25955. }, {
  25956. id: "flex1",
  25957. min: 11,
  25958. resetStack: true
  25959. }];
  25960. class CFFParser {
  25961. constructor(file, properties, seacAnalysisEnabled) {
  25962. this.bytes = file.getBytes();
  25963. this.properties = properties;
  25964. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  25965. }
  25966. parse() {
  25967. const properties = this.properties;
  25968. const cff = new CFF();
  25969. this.cff = cff;
  25970. const header = this.parseHeader();
  25971. const nameIndex = this.parseIndex(header.endPos);
  25972. const topDictIndex = this.parseIndex(nameIndex.endPos);
  25973. const stringIndex = this.parseIndex(topDictIndex.endPos);
  25974. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  25975. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  25976. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  25977. cff.header = header.obj;
  25978. cff.names = this.parseNameIndex(nameIndex.obj);
  25979. cff.strings = this.parseStringIndex(stringIndex.obj);
  25980. cff.topDict = topDict;
  25981. cff.globalSubrIndex = globalSubrIndex.obj;
  25982. this.parsePrivateDict(cff.topDict);
  25983. cff.isCIDFont = topDict.hasName("ROS");
  25984. const charStringOffset = topDict.getByName("CharStrings");
  25985. const charStringIndex = this.parseIndex(charStringOffset).obj;
  25986. const fontMatrix = topDict.getByName("FontMatrix");
  25987. if (fontMatrix) {
  25988. properties.fontMatrix = fontMatrix;
  25989. }
  25990. const fontBBox = topDict.getByName("FontBBox");
  25991. if (fontBBox) {
  25992. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  25993. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  25994. properties.ascentScaled = true;
  25995. }
  25996. let charset, encoding;
  25997. if (cff.isCIDFont) {
  25998. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  25999. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  26000. const dictRaw = fdArrayIndex.get(i);
  26001. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  26002. this.parsePrivateDict(fontDict);
  26003. cff.fdArray.push(fontDict);
  26004. }
  26005. encoding = null;
  26006. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  26007. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  26008. } else {
  26009. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  26010. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  26011. }
  26012. cff.charset = charset;
  26013. cff.encoding = encoding;
  26014. const charStringsAndSeacs = this.parseCharStrings({
  26015. charStrings: charStringIndex,
  26016. localSubrIndex: topDict.privateDict.subrsIndex,
  26017. globalSubrIndex: globalSubrIndex.obj,
  26018. fdSelect: cff.fdSelect,
  26019. fdArray: cff.fdArray,
  26020. privateDict: topDict.privateDict
  26021. });
  26022. cff.charStrings = charStringsAndSeacs.charStrings;
  26023. cff.seacs = charStringsAndSeacs.seacs;
  26024. cff.widths = charStringsAndSeacs.widths;
  26025. return cff;
  26026. }
  26027. parseHeader() {
  26028. let bytes = this.bytes;
  26029. const bytesLength = bytes.length;
  26030. let offset = 0;
  26031. while (offset < bytesLength && bytes[offset] !== 1) {
  26032. ++offset;
  26033. }
  26034. if (offset >= bytesLength) {
  26035. throw new _util.FormatError("Invalid CFF header");
  26036. }
  26037. if (offset !== 0) {
  26038. (0, _util.info)("cff data is shifted");
  26039. bytes = bytes.subarray(offset);
  26040. this.bytes = bytes;
  26041. }
  26042. const major = bytes[0];
  26043. const minor = bytes[1];
  26044. const hdrSize = bytes[2];
  26045. const offSize = bytes[3];
  26046. const header = new CFFHeader(major, minor, hdrSize, offSize);
  26047. return {
  26048. obj: header,
  26049. endPos: hdrSize
  26050. };
  26051. }
  26052. parseDict(dict) {
  26053. let pos = 0;
  26054. function parseOperand() {
  26055. let value = dict[pos++];
  26056. if (value === 30) {
  26057. return parseFloatOperand();
  26058. } else if (value === 28) {
  26059. value = dict[pos++];
  26060. value = (value << 24 | dict[pos++] << 16) >> 16;
  26061. return value;
  26062. } else if (value === 29) {
  26063. value = dict[pos++];
  26064. value = value << 8 | dict[pos++];
  26065. value = value << 8 | dict[pos++];
  26066. value = value << 8 | dict[pos++];
  26067. return value;
  26068. } else if (value >= 32 && value <= 246) {
  26069. return value - 139;
  26070. } else if (value >= 247 && value <= 250) {
  26071. return (value - 247) * 256 + dict[pos++] + 108;
  26072. } else if (value >= 251 && value <= 254) {
  26073. return -((value - 251) * 256) - dict[pos++] - 108;
  26074. }
  26075. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  26076. return NaN;
  26077. }
  26078. function parseFloatOperand() {
  26079. let str = "";
  26080. const eof = 15;
  26081. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  26082. const length = dict.length;
  26083. while (pos < length) {
  26084. const b = dict[pos++];
  26085. const b1 = b >> 4;
  26086. const b2 = b & 15;
  26087. if (b1 === eof) {
  26088. break;
  26089. }
  26090. str += lookup[b1];
  26091. if (b2 === eof) {
  26092. break;
  26093. }
  26094. str += lookup[b2];
  26095. }
  26096. return parseFloat(str);
  26097. }
  26098. let operands = [];
  26099. const entries = [];
  26100. pos = 0;
  26101. const end = dict.length;
  26102. while (pos < end) {
  26103. let b = dict[pos];
  26104. if (b <= 21) {
  26105. if (b === 12) {
  26106. b = b << 8 | dict[++pos];
  26107. }
  26108. entries.push([b, operands]);
  26109. operands = [];
  26110. ++pos;
  26111. } else {
  26112. operands.push(parseOperand());
  26113. }
  26114. }
  26115. return entries;
  26116. }
  26117. parseIndex(pos) {
  26118. const cffIndex = new CFFIndex();
  26119. const bytes = this.bytes;
  26120. const count = bytes[pos++] << 8 | bytes[pos++];
  26121. const offsets = [];
  26122. let end = pos;
  26123. let i, ii;
  26124. if (count !== 0) {
  26125. const offsetSize = bytes[pos++];
  26126. const startPos = pos + (count + 1) * offsetSize - 1;
  26127. for (i = 0, ii = count + 1; i < ii; ++i) {
  26128. let offset = 0;
  26129. for (let j = 0; j < offsetSize; ++j) {
  26130. offset <<= 8;
  26131. offset += bytes[pos++];
  26132. }
  26133. offsets.push(startPos + offset);
  26134. }
  26135. end = offsets[count];
  26136. }
  26137. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  26138. const offsetStart = offsets[i];
  26139. const offsetEnd = offsets[i + 1];
  26140. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  26141. }
  26142. return {
  26143. obj: cffIndex,
  26144. endPos: end
  26145. };
  26146. }
  26147. parseNameIndex(index) {
  26148. const names = [];
  26149. for (let i = 0, ii = index.count; i < ii; ++i) {
  26150. const name = index.get(i);
  26151. names.push((0, _util.bytesToString)(name));
  26152. }
  26153. return names;
  26154. }
  26155. parseStringIndex(index) {
  26156. const strings = new CFFStrings();
  26157. for (let i = 0, ii = index.count; i < ii; ++i) {
  26158. const data = index.get(i);
  26159. strings.add((0, _util.bytesToString)(data));
  26160. }
  26161. return strings;
  26162. }
  26163. createDict(Type, dict, strings) {
  26164. const cffDict = new Type(strings);
  26165. for (const [key, value] of dict) {
  26166. cffDict.setByKey(key, value);
  26167. }
  26168. return cffDict;
  26169. }
  26170. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  26171. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  26172. return false;
  26173. }
  26174. let stackSize = state.stackSize;
  26175. const stack = state.stack;
  26176. const length = data.length;
  26177. for (let j = 0; j < length;) {
  26178. const value = data[j++];
  26179. let validationCommand = null;
  26180. if (value === 12) {
  26181. const q = data[j++];
  26182. if (q === 0) {
  26183. data[j - 2] = 139;
  26184. data[j - 1] = 22;
  26185. stackSize = 0;
  26186. } else {
  26187. validationCommand = CharstringValidationData12[q];
  26188. }
  26189. } else if (value === 28) {
  26190. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  26191. j += 2;
  26192. stackSize++;
  26193. } else if (value === 14) {
  26194. if (stackSize >= 4) {
  26195. stackSize -= 4;
  26196. if (this.seacAnalysisEnabled) {
  26197. state.seac = stack.slice(stackSize, stackSize + 4);
  26198. return false;
  26199. }
  26200. }
  26201. validationCommand = CharstringValidationData[value];
  26202. } else if (value >= 32 && value <= 246) {
  26203. stack[stackSize] = value - 139;
  26204. stackSize++;
  26205. } else if (value >= 247 && value <= 254) {
  26206. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  26207. j++;
  26208. stackSize++;
  26209. } else if (value === 255) {
  26210. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  26211. j += 4;
  26212. stackSize++;
  26213. } else if (value === 19 || value === 20) {
  26214. state.hints += stackSize >> 1;
  26215. j += state.hints + 7 >> 3;
  26216. stackSize %= 2;
  26217. validationCommand = CharstringValidationData[value];
  26218. } else if (value === 10 || value === 29) {
  26219. let subrsIndex;
  26220. if (value === 10) {
  26221. subrsIndex = localSubrIndex;
  26222. } else {
  26223. subrsIndex = globalSubrIndex;
  26224. }
  26225. if (!subrsIndex) {
  26226. validationCommand = CharstringValidationData[value];
  26227. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  26228. return false;
  26229. }
  26230. let bias = 32768;
  26231. if (subrsIndex.count < 1240) {
  26232. bias = 107;
  26233. } else if (subrsIndex.count < 33900) {
  26234. bias = 1131;
  26235. }
  26236. const subrNumber = stack[--stackSize] + bias;
  26237. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  26238. validationCommand = CharstringValidationData[value];
  26239. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  26240. return false;
  26241. }
  26242. state.stackSize = stackSize;
  26243. state.callDepth++;
  26244. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  26245. if (!valid) {
  26246. return false;
  26247. }
  26248. state.callDepth--;
  26249. stackSize = state.stackSize;
  26250. continue;
  26251. } else if (value === 11) {
  26252. state.stackSize = stackSize;
  26253. return true;
  26254. } else if (value === 0 && j === data.length) {
  26255. data[j - 1] = 14;
  26256. validationCommand = CharstringValidationData[14];
  26257. } else {
  26258. validationCommand = CharstringValidationData[value];
  26259. }
  26260. if (validationCommand) {
  26261. if (validationCommand.stem) {
  26262. state.hints += stackSize >> 1;
  26263. if (value === 3 || value === 23) {
  26264. state.hasVStems = true;
  26265. } else if (state.hasVStems && (value === 1 || value === 18)) {
  26266. (0, _util.warn)("CFF stem hints are in wrong order");
  26267. data[j - 1] = value === 1 ? 3 : 23;
  26268. }
  26269. }
  26270. if ("min" in validationCommand) {
  26271. if (!state.undefStack && stackSize < validationCommand.min) {
  26272. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  26273. if (stackSize === 0) {
  26274. data[j - 1] = 14;
  26275. return true;
  26276. }
  26277. return false;
  26278. }
  26279. }
  26280. if (state.firstStackClearing && validationCommand.stackClearing) {
  26281. state.firstStackClearing = false;
  26282. stackSize -= validationCommand.min;
  26283. if (stackSize >= 2 && validationCommand.stem) {
  26284. stackSize %= 2;
  26285. } else if (stackSize > 1) {
  26286. (0, _util.warn)("Found too many parameters for stack-clearing command");
  26287. }
  26288. if (stackSize > 0) {
  26289. state.width = stack[stackSize - 1];
  26290. }
  26291. }
  26292. if ("stackDelta" in validationCommand) {
  26293. if ("stackFn" in validationCommand) {
  26294. validationCommand.stackFn(stack, stackSize);
  26295. }
  26296. stackSize += validationCommand.stackDelta;
  26297. } else if (validationCommand.stackClearing) {
  26298. stackSize = 0;
  26299. } else if (validationCommand.resetStack) {
  26300. stackSize = 0;
  26301. state.undefStack = false;
  26302. } else if (validationCommand.undefStack) {
  26303. stackSize = 0;
  26304. state.undefStack = true;
  26305. state.firstStackClearing = false;
  26306. }
  26307. }
  26308. }
  26309. state.stackSize = stackSize;
  26310. return true;
  26311. }
  26312. parseCharStrings(_ref) {
  26313. let {
  26314. charStrings,
  26315. localSubrIndex,
  26316. globalSubrIndex,
  26317. fdSelect,
  26318. fdArray,
  26319. privateDict
  26320. } = _ref;
  26321. const seacs = [];
  26322. const widths = [];
  26323. const count = charStrings.count;
  26324. for (let i = 0; i < count; i++) {
  26325. const charstring = charStrings.get(i);
  26326. const state = {
  26327. callDepth: 0,
  26328. stackSize: 0,
  26329. stack: [],
  26330. undefStack: true,
  26331. hints: 0,
  26332. firstStackClearing: true,
  26333. seac: null,
  26334. width: null,
  26335. hasVStems: false
  26336. };
  26337. let valid = true;
  26338. let localSubrToUse = null;
  26339. let privateDictToUse = privateDict;
  26340. if (fdSelect && fdArray.length) {
  26341. const fdIndex = fdSelect.getFDIndex(i);
  26342. if (fdIndex === -1) {
  26343. (0, _util.warn)("Glyph index is not in fd select.");
  26344. valid = false;
  26345. }
  26346. if (fdIndex >= fdArray.length) {
  26347. (0, _util.warn)("Invalid fd index for glyph index.");
  26348. valid = false;
  26349. }
  26350. if (valid) {
  26351. privateDictToUse = fdArray[fdIndex].privateDict;
  26352. localSubrToUse = privateDictToUse.subrsIndex;
  26353. }
  26354. } else if (localSubrIndex) {
  26355. localSubrToUse = localSubrIndex;
  26356. }
  26357. if (valid) {
  26358. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  26359. }
  26360. if (state.width !== null) {
  26361. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  26362. widths[i] = nominalWidth + state.width;
  26363. } else {
  26364. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  26365. widths[i] = defaultWidth;
  26366. }
  26367. if (state.seac !== null) {
  26368. seacs[i] = state.seac;
  26369. }
  26370. if (!valid) {
  26371. charStrings.set(i, new Uint8Array([14]));
  26372. }
  26373. }
  26374. return {
  26375. charStrings,
  26376. seacs,
  26377. widths
  26378. };
  26379. }
  26380. emptyPrivateDictionary(parentDict) {
  26381. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  26382. parentDict.setByKey(18, [0, 0]);
  26383. parentDict.privateDict = privateDict;
  26384. }
  26385. parsePrivateDict(parentDict) {
  26386. if (!parentDict.hasName("Private")) {
  26387. this.emptyPrivateDictionary(parentDict);
  26388. return;
  26389. }
  26390. const privateOffset = parentDict.getByName("Private");
  26391. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  26392. parentDict.removeByName("Private");
  26393. return;
  26394. }
  26395. const size = privateOffset[0];
  26396. const offset = privateOffset[1];
  26397. if (size === 0 || offset >= this.bytes.length) {
  26398. this.emptyPrivateDictionary(parentDict);
  26399. return;
  26400. }
  26401. const privateDictEnd = offset + size;
  26402. const dictData = this.bytes.subarray(offset, privateDictEnd);
  26403. const dict = this.parseDict(dictData);
  26404. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  26405. parentDict.privateDict = privateDict;
  26406. if (!privateDict.getByName("Subrs")) {
  26407. return;
  26408. }
  26409. const subrsOffset = privateDict.getByName("Subrs");
  26410. const relativeOffset = offset + subrsOffset;
  26411. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  26412. this.emptyPrivateDictionary(parentDict);
  26413. return;
  26414. }
  26415. const subrsIndex = this.parseIndex(relativeOffset);
  26416. privateDict.subrsIndex = subrsIndex.obj;
  26417. }
  26418. parseCharsets(pos, length, strings, cid) {
  26419. if (pos === 0) {
  26420. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  26421. } else if (pos === 1) {
  26422. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  26423. } else if (pos === 2) {
  26424. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  26425. }
  26426. const bytes = this.bytes;
  26427. const start = pos;
  26428. const format = bytes[pos++];
  26429. const charset = [cid ? 0 : ".notdef"];
  26430. let id, count, i;
  26431. length -= 1;
  26432. switch (format) {
  26433. case 0:
  26434. for (i = 0; i < length; i++) {
  26435. id = bytes[pos++] << 8 | bytes[pos++];
  26436. charset.push(cid ? id : strings.get(id));
  26437. }
  26438. break;
  26439. case 1:
  26440. while (charset.length <= length) {
  26441. id = bytes[pos++] << 8 | bytes[pos++];
  26442. count = bytes[pos++];
  26443. for (i = 0; i <= count; i++) {
  26444. charset.push(cid ? id++ : strings.get(id++));
  26445. }
  26446. }
  26447. break;
  26448. case 2:
  26449. while (charset.length <= length) {
  26450. id = bytes[pos++] << 8 | bytes[pos++];
  26451. count = bytes[pos++] << 8 | bytes[pos++];
  26452. for (i = 0; i <= count; i++) {
  26453. charset.push(cid ? id++ : strings.get(id++));
  26454. }
  26455. }
  26456. break;
  26457. default:
  26458. throw new _util.FormatError("Unknown charset format");
  26459. }
  26460. const end = pos;
  26461. const raw = bytes.subarray(start, end);
  26462. return new CFFCharset(false, format, charset, raw);
  26463. }
  26464. parseEncoding(pos, properties, strings, charset) {
  26465. const encoding = Object.create(null);
  26466. const bytes = this.bytes;
  26467. let predefined = false;
  26468. let format, i, ii;
  26469. let raw = null;
  26470. function readSupplement() {
  26471. const supplementsCount = bytes[pos++];
  26472. for (i = 0; i < supplementsCount; i++) {
  26473. const code = bytes[pos++];
  26474. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  26475. encoding[code] = charset.indexOf(strings.get(sid));
  26476. }
  26477. }
  26478. if (pos === 0 || pos === 1) {
  26479. predefined = true;
  26480. format = pos;
  26481. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  26482. for (i = 0, ii = charset.length; i < ii; i++) {
  26483. const index = baseEncoding.indexOf(charset[i]);
  26484. if (index !== -1) {
  26485. encoding[index] = i;
  26486. }
  26487. }
  26488. } else {
  26489. const dataStart = pos;
  26490. format = bytes[pos++];
  26491. switch (format & 0x7f) {
  26492. case 0:
  26493. const glyphsCount = bytes[pos++];
  26494. for (i = 1; i <= glyphsCount; i++) {
  26495. encoding[bytes[pos++]] = i;
  26496. }
  26497. break;
  26498. case 1:
  26499. const rangesCount = bytes[pos++];
  26500. let gid = 1;
  26501. for (i = 0; i < rangesCount; i++) {
  26502. const start = bytes[pos++];
  26503. const left = bytes[pos++];
  26504. for (let j = start; j <= start + left; j++) {
  26505. encoding[j] = gid++;
  26506. }
  26507. }
  26508. break;
  26509. default:
  26510. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  26511. }
  26512. const dataEnd = pos;
  26513. if (format & 0x80) {
  26514. bytes[dataStart] &= 0x7f;
  26515. readSupplement();
  26516. }
  26517. raw = bytes.subarray(dataStart, dataEnd);
  26518. }
  26519. format &= 0x7f;
  26520. return new CFFEncoding(predefined, format, encoding, raw);
  26521. }
  26522. parseFDSelect(pos, length) {
  26523. const bytes = this.bytes;
  26524. const format = bytes[pos++];
  26525. const fdSelect = [];
  26526. let i;
  26527. switch (format) {
  26528. case 0:
  26529. for (i = 0; i < length; ++i) {
  26530. const id = bytes[pos++];
  26531. fdSelect.push(id);
  26532. }
  26533. break;
  26534. case 3:
  26535. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  26536. for (i = 0; i < rangesCount; ++i) {
  26537. let first = bytes[pos++] << 8 | bytes[pos++];
  26538. if (i === 0 && first !== 0) {
  26539. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  26540. first = 0;
  26541. }
  26542. const fdIndex = bytes[pos++];
  26543. const next = bytes[pos] << 8 | bytes[pos + 1];
  26544. for (let j = first; j < next; ++j) {
  26545. fdSelect.push(fdIndex);
  26546. }
  26547. }
  26548. pos += 2;
  26549. break;
  26550. default:
  26551. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  26552. }
  26553. if (fdSelect.length !== length) {
  26554. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  26555. }
  26556. return new CFFFDSelect(format, fdSelect);
  26557. }
  26558. }
  26559. exports.CFFParser = CFFParser;
  26560. class CFF {
  26561. constructor() {
  26562. this.header = null;
  26563. this.names = [];
  26564. this.topDict = null;
  26565. this.strings = new CFFStrings();
  26566. this.globalSubrIndex = null;
  26567. this.encoding = null;
  26568. this.charset = null;
  26569. this.charStrings = null;
  26570. this.fdArray = [];
  26571. this.fdSelect = null;
  26572. this.isCIDFont = false;
  26573. }
  26574. duplicateFirstGlyph() {
  26575. if (this.charStrings.count >= 65535) {
  26576. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  26577. return;
  26578. }
  26579. const glyphZero = this.charStrings.get(0);
  26580. this.charStrings.add(glyphZero);
  26581. if (this.isCIDFont) {
  26582. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  26583. }
  26584. }
  26585. hasGlyphId(id) {
  26586. if (id < 0 || id >= this.charStrings.count) {
  26587. return false;
  26588. }
  26589. const glyph = this.charStrings.get(id);
  26590. return glyph.length > 0;
  26591. }
  26592. }
  26593. exports.CFF = CFF;
  26594. class CFFHeader {
  26595. constructor(major, minor, hdrSize, offSize) {
  26596. this.major = major;
  26597. this.minor = minor;
  26598. this.hdrSize = hdrSize;
  26599. this.offSize = offSize;
  26600. }
  26601. }
  26602. exports.CFFHeader = CFFHeader;
  26603. class CFFStrings {
  26604. constructor() {
  26605. this.strings = [];
  26606. }
  26607. get(index) {
  26608. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  26609. return CFFStandardStrings[index];
  26610. }
  26611. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  26612. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  26613. }
  26614. return CFFStandardStrings[0];
  26615. }
  26616. getSID(str) {
  26617. let index = CFFStandardStrings.indexOf(str);
  26618. if (index !== -1) {
  26619. return index;
  26620. }
  26621. index = this.strings.indexOf(str);
  26622. if (index !== -1) {
  26623. return index + NUM_STANDARD_CFF_STRINGS;
  26624. }
  26625. return -1;
  26626. }
  26627. add(value) {
  26628. this.strings.push(value);
  26629. }
  26630. get count() {
  26631. return this.strings.length;
  26632. }
  26633. }
  26634. exports.CFFStrings = CFFStrings;
  26635. class CFFIndex {
  26636. constructor() {
  26637. this.objects = [];
  26638. this.length = 0;
  26639. }
  26640. add(data) {
  26641. this.length += data.length;
  26642. this.objects.push(data);
  26643. }
  26644. set(index, data) {
  26645. this.length += data.length - this.objects[index].length;
  26646. this.objects[index] = data;
  26647. }
  26648. get(index) {
  26649. return this.objects[index];
  26650. }
  26651. get count() {
  26652. return this.objects.length;
  26653. }
  26654. }
  26655. exports.CFFIndex = CFFIndex;
  26656. class CFFDict {
  26657. constructor(tables, strings) {
  26658. this.keyToNameMap = tables.keyToNameMap;
  26659. this.nameToKeyMap = tables.nameToKeyMap;
  26660. this.defaults = tables.defaults;
  26661. this.types = tables.types;
  26662. this.opcodes = tables.opcodes;
  26663. this.order = tables.order;
  26664. this.strings = strings;
  26665. this.values = Object.create(null);
  26666. }
  26667. setByKey(key, value) {
  26668. if (!(key in this.keyToNameMap)) {
  26669. return false;
  26670. }
  26671. if (value.length === 0) {
  26672. return true;
  26673. }
  26674. for (const val of value) {
  26675. if (isNaN(val)) {
  26676. (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
  26677. return true;
  26678. }
  26679. }
  26680. const type = this.types[key];
  26681. if (type === "num" || type === "sid" || type === "offset") {
  26682. value = value[0];
  26683. }
  26684. this.values[key] = value;
  26685. return true;
  26686. }
  26687. setByName(name, value) {
  26688. if (!(name in this.nameToKeyMap)) {
  26689. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  26690. }
  26691. this.values[this.nameToKeyMap[name]] = value;
  26692. }
  26693. hasName(name) {
  26694. return this.nameToKeyMap[name] in this.values;
  26695. }
  26696. getByName(name) {
  26697. if (!(name in this.nameToKeyMap)) {
  26698. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  26699. }
  26700. const key = this.nameToKeyMap[name];
  26701. if (!(key in this.values)) {
  26702. return this.defaults[key];
  26703. }
  26704. return this.values[key];
  26705. }
  26706. removeByName(name) {
  26707. delete this.values[this.nameToKeyMap[name]];
  26708. }
  26709. static createTables(layout) {
  26710. const tables = {
  26711. keyToNameMap: {},
  26712. nameToKeyMap: {},
  26713. defaults: {},
  26714. types: {},
  26715. opcodes: {},
  26716. order: []
  26717. };
  26718. for (const entry of layout) {
  26719. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  26720. tables.keyToNameMap[key] = entry[1];
  26721. tables.nameToKeyMap[entry[1]] = key;
  26722. tables.types[key] = entry[2];
  26723. tables.defaults[key] = entry[3];
  26724. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  26725. tables.order.push(key);
  26726. }
  26727. return tables;
  26728. }
  26729. }
  26730. 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]];
  26731. class CFFTopDict extends CFFDict {
  26732. static get tables() {
  26733. return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
  26734. }
  26735. constructor(strings) {
  26736. super(CFFTopDict.tables, strings);
  26737. this.privateDict = null;
  26738. }
  26739. }
  26740. exports.CFFTopDict = CFFTopDict;
  26741. 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]];
  26742. class CFFPrivateDict extends CFFDict {
  26743. static get tables() {
  26744. return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
  26745. }
  26746. constructor(strings) {
  26747. super(CFFPrivateDict.tables, strings);
  26748. this.subrsIndex = null;
  26749. }
  26750. }
  26751. exports.CFFPrivateDict = CFFPrivateDict;
  26752. const CFFCharsetPredefinedTypes = {
  26753. ISO_ADOBE: 0,
  26754. EXPERT: 1,
  26755. EXPERT_SUBSET: 2
  26756. };
  26757. class CFFCharset {
  26758. constructor(predefined, format, charset, raw) {
  26759. this.predefined = predefined;
  26760. this.format = format;
  26761. this.charset = charset;
  26762. this.raw = raw;
  26763. }
  26764. }
  26765. exports.CFFCharset = CFFCharset;
  26766. class CFFEncoding {
  26767. constructor(predefined, format, encoding, raw) {
  26768. this.predefined = predefined;
  26769. this.format = format;
  26770. this.encoding = encoding;
  26771. this.raw = raw;
  26772. }
  26773. }
  26774. class CFFFDSelect {
  26775. constructor(format, fdSelect) {
  26776. this.format = format;
  26777. this.fdSelect = fdSelect;
  26778. }
  26779. getFDIndex(glyphIndex) {
  26780. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  26781. return -1;
  26782. }
  26783. return this.fdSelect[glyphIndex];
  26784. }
  26785. }
  26786. exports.CFFFDSelect = CFFFDSelect;
  26787. class CFFOffsetTracker {
  26788. constructor() {
  26789. this.offsets = Object.create(null);
  26790. }
  26791. isTracking(key) {
  26792. return key in this.offsets;
  26793. }
  26794. track(key, location) {
  26795. if (key in this.offsets) {
  26796. throw new _util.FormatError(`Already tracking location of ${key}`);
  26797. }
  26798. this.offsets[key] = location;
  26799. }
  26800. offset(value) {
  26801. for (const key in this.offsets) {
  26802. this.offsets[key] += value;
  26803. }
  26804. }
  26805. setEntryLocation(key, values, output) {
  26806. if (!(key in this.offsets)) {
  26807. throw new _util.FormatError(`Not tracking location of ${key}`);
  26808. }
  26809. const data = output.data;
  26810. const dataOffset = this.offsets[key];
  26811. const size = 5;
  26812. for (let i = 0, ii = values.length; i < ii; ++i) {
  26813. const offset0 = i * size + dataOffset;
  26814. const offset1 = offset0 + 1;
  26815. const offset2 = offset0 + 2;
  26816. const offset3 = offset0 + 3;
  26817. const offset4 = offset0 + 4;
  26818. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  26819. throw new _util.FormatError("writing to an offset that is not empty");
  26820. }
  26821. const value = values[i];
  26822. data[offset0] = 0x1d;
  26823. data[offset1] = value >> 24 & 0xff;
  26824. data[offset2] = value >> 16 & 0xff;
  26825. data[offset3] = value >> 8 & 0xff;
  26826. data[offset4] = value & 0xff;
  26827. }
  26828. }
  26829. }
  26830. class CFFCompiler {
  26831. constructor(cff) {
  26832. this.cff = cff;
  26833. }
  26834. compile() {
  26835. const cff = this.cff;
  26836. const output = {
  26837. data: [],
  26838. length: 0,
  26839. add(data) {
  26840. this.data = this.data.concat(data);
  26841. this.length = this.data.length;
  26842. }
  26843. };
  26844. const header = this.compileHeader(cff.header);
  26845. output.add(header);
  26846. const nameIndex = this.compileNameIndex(cff.names);
  26847. output.add(nameIndex);
  26848. if (cff.isCIDFont) {
  26849. if (cff.topDict.hasName("FontMatrix")) {
  26850. const base = cff.topDict.getByName("FontMatrix");
  26851. cff.topDict.removeByName("FontMatrix");
  26852. for (const subDict of cff.fdArray) {
  26853. let matrix = base.slice(0);
  26854. if (subDict.hasName("FontMatrix")) {
  26855. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  26856. }
  26857. subDict.setByName("FontMatrix", matrix);
  26858. }
  26859. }
  26860. }
  26861. const xuid = cff.topDict.getByName("XUID");
  26862. if (xuid && xuid.length > 16) {
  26863. cff.topDict.removeByName("XUID");
  26864. }
  26865. cff.topDict.setByName("charset", 0);
  26866. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  26867. output.add(compiled.output);
  26868. const topDictTracker = compiled.trackers[0];
  26869. const stringIndex = this.compileStringIndex(cff.strings.strings);
  26870. output.add(stringIndex);
  26871. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  26872. output.add(globalSubrIndex);
  26873. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  26874. if (cff.encoding.predefined) {
  26875. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  26876. } else {
  26877. const encoding = this.compileEncoding(cff.encoding);
  26878. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  26879. output.add(encoding);
  26880. }
  26881. }
  26882. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  26883. topDictTracker.setEntryLocation("charset", [output.length], output);
  26884. output.add(charset);
  26885. const charStrings = this.compileCharStrings(cff.charStrings);
  26886. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  26887. output.add(charStrings);
  26888. if (cff.isCIDFont) {
  26889. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  26890. const fdSelect = this.compileFDSelect(cff.fdSelect);
  26891. output.add(fdSelect);
  26892. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  26893. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  26894. output.add(compiled.output);
  26895. const fontDictTrackers = compiled.trackers;
  26896. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  26897. }
  26898. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  26899. output.add([0]);
  26900. return output.data;
  26901. }
  26902. encodeNumber(value) {
  26903. if (Number.isInteger(value)) {
  26904. return this.encodeInteger(value);
  26905. }
  26906. return this.encodeFloat(value);
  26907. }
  26908. static get EncodeFloatRegExp() {
  26909. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  26910. }
  26911. encodeFloat(num) {
  26912. let value = num.toString();
  26913. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  26914. if (m) {
  26915. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  26916. value = (Math.round(num * epsilon) / epsilon).toString();
  26917. }
  26918. let nibbles = "";
  26919. let i, ii;
  26920. for (i = 0, ii = value.length; i < ii; ++i) {
  26921. const a = value[i];
  26922. if (a === "e") {
  26923. nibbles += value[++i] === "-" ? "c" : "b";
  26924. } else if (a === ".") {
  26925. nibbles += "a";
  26926. } else if (a === "-") {
  26927. nibbles += "e";
  26928. } else {
  26929. nibbles += a;
  26930. }
  26931. }
  26932. nibbles += nibbles.length & 1 ? "f" : "ff";
  26933. const out = [30];
  26934. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  26935. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  26936. }
  26937. return out;
  26938. }
  26939. encodeInteger(value) {
  26940. let code;
  26941. if (value >= -107 && value <= 107) {
  26942. code = [value + 139];
  26943. } else if (value >= 108 && value <= 1131) {
  26944. value -= 108;
  26945. code = [(value >> 8) + 247, value & 0xff];
  26946. } else if (value >= -1131 && value <= -108) {
  26947. value = -value - 108;
  26948. code = [(value >> 8) + 251, value & 0xff];
  26949. } else if (value >= -32768 && value <= 32767) {
  26950. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  26951. } else {
  26952. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  26953. }
  26954. return code;
  26955. }
  26956. compileHeader(header) {
  26957. return [header.major, header.minor, 4, header.offSize];
  26958. }
  26959. compileNameIndex(names) {
  26960. const nameIndex = new CFFIndex();
  26961. for (const name of names) {
  26962. const length = Math.min(name.length, 127);
  26963. let sanitizedName = new Array(length);
  26964. for (let j = 0; j < length; j++) {
  26965. let char = name[j];
  26966. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  26967. char = "_";
  26968. }
  26969. sanitizedName[j] = char;
  26970. }
  26971. sanitizedName = sanitizedName.join("");
  26972. if (sanitizedName === "") {
  26973. sanitizedName = "Bad_Font_Name";
  26974. }
  26975. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  26976. }
  26977. return this.compileIndex(nameIndex);
  26978. }
  26979. compileTopDicts(dicts, length, removeCidKeys) {
  26980. const fontDictTrackers = [];
  26981. let fdArrayIndex = new CFFIndex();
  26982. for (const fontDict of dicts) {
  26983. if (removeCidKeys) {
  26984. fontDict.removeByName("CIDFontVersion");
  26985. fontDict.removeByName("CIDFontRevision");
  26986. fontDict.removeByName("CIDFontType");
  26987. fontDict.removeByName("CIDCount");
  26988. fontDict.removeByName("UIDBase");
  26989. }
  26990. const fontDictTracker = new CFFOffsetTracker();
  26991. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  26992. fontDictTrackers.push(fontDictTracker);
  26993. fdArrayIndex.add(fontDictData);
  26994. fontDictTracker.offset(length);
  26995. }
  26996. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  26997. return {
  26998. trackers: fontDictTrackers,
  26999. output: fdArrayIndex
  27000. };
  27001. }
  27002. compilePrivateDicts(dicts, trackers, output) {
  27003. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  27004. const fontDict = dicts[i];
  27005. const privateDict = fontDict.privateDict;
  27006. if (!privateDict || !fontDict.hasName("Private")) {
  27007. throw new _util.FormatError("There must be a private dictionary.");
  27008. }
  27009. const privateDictTracker = new CFFOffsetTracker();
  27010. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  27011. let outputLength = output.length;
  27012. privateDictTracker.offset(outputLength);
  27013. if (!privateDictData.length) {
  27014. outputLength = 0;
  27015. }
  27016. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  27017. output.add(privateDictData);
  27018. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  27019. const subrs = this.compileIndex(privateDict.subrsIndex);
  27020. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  27021. output.add(subrs);
  27022. }
  27023. }
  27024. }
  27025. compileDict(dict, offsetTracker) {
  27026. const out = [];
  27027. for (const key of dict.order) {
  27028. if (!(key in dict.values)) {
  27029. continue;
  27030. }
  27031. let values = dict.values[key];
  27032. let types = dict.types[key];
  27033. if (!Array.isArray(types)) {
  27034. types = [types];
  27035. }
  27036. if (!Array.isArray(values)) {
  27037. values = [values];
  27038. }
  27039. if (values.length === 0) {
  27040. continue;
  27041. }
  27042. for (let j = 0, jj = types.length; j < jj; ++j) {
  27043. const type = types[j];
  27044. const value = values[j];
  27045. switch (type) {
  27046. case "num":
  27047. case "sid":
  27048. out.push(...this.encodeNumber(value));
  27049. break;
  27050. case "offset":
  27051. const name = dict.keyToNameMap[key];
  27052. if (!offsetTracker.isTracking(name)) {
  27053. offsetTracker.track(name, out.length);
  27054. }
  27055. out.push(0x1d, 0, 0, 0, 0);
  27056. break;
  27057. case "array":
  27058. case "delta":
  27059. out.push(...this.encodeNumber(value));
  27060. for (let k = 1, kk = values.length; k < kk; ++k) {
  27061. out.push(...this.encodeNumber(values[k]));
  27062. }
  27063. break;
  27064. default:
  27065. throw new _util.FormatError(`Unknown data type of ${type}`);
  27066. }
  27067. }
  27068. out.push(...dict.opcodes[key]);
  27069. }
  27070. return out;
  27071. }
  27072. compileStringIndex(strings) {
  27073. const stringIndex = new CFFIndex();
  27074. for (const string of strings) {
  27075. stringIndex.add((0, _util.stringToBytes)(string));
  27076. }
  27077. return this.compileIndex(stringIndex);
  27078. }
  27079. compileGlobalSubrIndex() {
  27080. const globalSubrIndex = this.cff.globalSubrIndex;
  27081. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  27082. }
  27083. compileCharStrings(charStrings) {
  27084. const charStringsIndex = new CFFIndex();
  27085. for (let i = 0; i < charStrings.count; i++) {
  27086. const glyph = charStrings.get(i);
  27087. if (glyph.length === 0) {
  27088. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  27089. continue;
  27090. }
  27091. charStringsIndex.add(glyph);
  27092. }
  27093. return this.compileIndex(charStringsIndex);
  27094. }
  27095. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  27096. let out;
  27097. const numGlyphsLessNotDef = numGlyphs - 1;
  27098. if (isCIDFont) {
  27099. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  27100. } else {
  27101. const length = 1 + numGlyphsLessNotDef * 2;
  27102. out = new Uint8Array(length);
  27103. out[0] = 0;
  27104. let charsetIndex = 0;
  27105. const numCharsets = charset.charset.length;
  27106. let warned = false;
  27107. for (let i = 1; i < out.length; i += 2) {
  27108. let sid = 0;
  27109. if (charsetIndex < numCharsets) {
  27110. const name = charset.charset[charsetIndex++];
  27111. sid = strings.getSID(name);
  27112. if (sid === -1) {
  27113. sid = 0;
  27114. if (!warned) {
  27115. warned = true;
  27116. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  27117. }
  27118. }
  27119. }
  27120. out[i] = sid >> 8 & 0xff;
  27121. out[i + 1] = sid & 0xff;
  27122. }
  27123. }
  27124. return this.compileTypedArray(out);
  27125. }
  27126. compileEncoding(encoding) {
  27127. return this.compileTypedArray(encoding.raw);
  27128. }
  27129. compileFDSelect(fdSelect) {
  27130. const format = fdSelect.format;
  27131. let out, i;
  27132. switch (format) {
  27133. case 0:
  27134. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  27135. out[0] = format;
  27136. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  27137. out[i + 1] = fdSelect.fdSelect[i];
  27138. }
  27139. break;
  27140. case 3:
  27141. const start = 0;
  27142. let lastFD = fdSelect.fdSelect[0];
  27143. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  27144. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  27145. const currentFD = fdSelect.fdSelect[i];
  27146. if (currentFD !== lastFD) {
  27147. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  27148. lastFD = currentFD;
  27149. }
  27150. }
  27151. const numRanges = (ranges.length - 3) / 3;
  27152. ranges[1] = numRanges >> 8 & 0xff;
  27153. ranges[2] = numRanges & 0xff;
  27154. ranges.push(i >> 8 & 0xff, i & 0xff);
  27155. out = new Uint8Array(ranges);
  27156. break;
  27157. }
  27158. return this.compileTypedArray(out);
  27159. }
  27160. compileTypedArray(data) {
  27161. const out = [];
  27162. for (let i = 0, ii = data.length; i < ii; ++i) {
  27163. out[i] = data[i];
  27164. }
  27165. return out;
  27166. }
  27167. compileIndex(index) {
  27168. let trackers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  27169. const objects = index.objects;
  27170. const count = objects.length;
  27171. if (count === 0) {
  27172. return [0, 0];
  27173. }
  27174. const data = [count >> 8 & 0xff, count & 0xff];
  27175. let lastOffset = 1,
  27176. i;
  27177. for (i = 0; i < count; ++i) {
  27178. lastOffset += objects[i].length;
  27179. }
  27180. let offsetSize;
  27181. if (lastOffset < 0x100) {
  27182. offsetSize = 1;
  27183. } else if (lastOffset < 0x10000) {
  27184. offsetSize = 2;
  27185. } else if (lastOffset < 0x1000000) {
  27186. offsetSize = 3;
  27187. } else {
  27188. offsetSize = 4;
  27189. }
  27190. data.push(offsetSize);
  27191. let relativeOffset = 1;
  27192. for (i = 0; i < count + 1; i++) {
  27193. if (offsetSize === 1) {
  27194. data.push(relativeOffset & 0xff);
  27195. } else if (offsetSize === 2) {
  27196. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27197. } else if (offsetSize === 3) {
  27198. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27199. } else {
  27200. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  27201. }
  27202. if (objects[i]) {
  27203. relativeOffset += objects[i].length;
  27204. }
  27205. }
  27206. for (i = 0; i < count; i++) {
  27207. if (trackers[i]) {
  27208. trackers[i].offset(data.length);
  27209. }
  27210. data.push(...objects[i]);
  27211. }
  27212. return data;
  27213. }
  27214. }
  27215. exports.CFFCompiler = CFFCompiler;
  27216. /***/ }),
  27217. /* 165 */
  27218. /***/ ((__unused_webpack_module, exports) => {
  27219. "use strict";
  27220. Object.defineProperty(exports, "__esModule", ({
  27221. value: true
  27222. }));
  27223. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  27224. 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"];
  27225. exports.ISOAdobeCharset = ISOAdobeCharset;
  27226. 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"];
  27227. exports.ExpertCharset = ExpertCharset;
  27228. 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"];
  27229. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  27230. /***/ }),
  27231. /* 166 */
  27232. /***/ ((__unused_webpack_module, exports) => {
  27233. "use strict";
  27234. Object.defineProperty(exports, "__esModule", ({
  27235. value: true
  27236. }));
  27237. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  27238. exports.getEncoding = getEncoding;
  27239. 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"];
  27240. exports.ExpertEncoding = ExpertEncoding;
  27241. 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", "", "", "", ""];
  27242. 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"];
  27243. exports.MacRomanEncoding = MacRomanEncoding;
  27244. 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", "", "", "", ""];
  27245. exports.StandardEncoding = StandardEncoding;
  27246. 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"];
  27247. exports.WinAnsiEncoding = WinAnsiEncoding;
  27248. 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", ""];
  27249. exports.SymbolSetEncoding = SymbolSetEncoding;
  27250. 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", ""];
  27251. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  27252. function getEncoding(encodingName) {
  27253. switch (encodingName) {
  27254. case "WinAnsiEncoding":
  27255. return WinAnsiEncoding;
  27256. case "StandardEncoding":
  27257. return StandardEncoding;
  27258. case "MacRomanEncoding":
  27259. return MacRomanEncoding;
  27260. case "SymbolSetEncoding":
  27261. return SymbolSetEncoding;
  27262. case "ZapfDingbatsEncoding":
  27263. return ZapfDingbatsEncoding;
  27264. case "ExpertEncoding":
  27265. return ExpertEncoding;
  27266. case "MacExpertEncoding":
  27267. return MacExpertEncoding;
  27268. default:
  27269. return null;
  27270. }
  27271. }
  27272. /***/ }),
  27273. /* 167 */
  27274. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  27275. "use strict";
  27276. Object.defineProperty(exports, "__esModule", ({
  27277. value: true
  27278. }));
  27279. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  27280. exports.getFontType = getFontType;
  27281. exports.normalizeFontName = normalizeFontName;
  27282. exports.recoverGlyphName = recoverGlyphName;
  27283. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  27284. var _util = __w_pdfjs_require__(2);
  27285. var _encodings = __w_pdfjs_require__(166);
  27286. var _glyphlist = __w_pdfjs_require__(168);
  27287. var _unicode = __w_pdfjs_require__(169);
  27288. const SEAC_ANALYSIS_ENABLED = true;
  27289. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  27290. const FontFlags = {
  27291. FixedPitch: 1,
  27292. Serif: 2,
  27293. Symbolic: 4,
  27294. Script: 8,
  27295. Nonsymbolic: 32,
  27296. Italic: 64,
  27297. AllCap: 65536,
  27298. SmallCap: 131072,
  27299. ForceBold: 262144
  27300. };
  27301. exports.FontFlags = FontFlags;
  27302. 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"];
  27303. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  27304. function getFontType(type, subtype) {
  27305. let isStandardFont = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  27306. switch (type) {
  27307. case "Type1":
  27308. if (isStandardFont) {
  27309. return _util.FontType.TYPE1STANDARD;
  27310. }
  27311. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  27312. case "CIDFontType0":
  27313. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  27314. case "OpenType":
  27315. return _util.FontType.OPENTYPE;
  27316. case "TrueType":
  27317. return _util.FontType.TRUETYPE;
  27318. case "CIDFontType2":
  27319. return _util.FontType.CIDFONTTYPE2;
  27320. case "MMType1":
  27321. return _util.FontType.MMTYPE1;
  27322. case "Type0":
  27323. return _util.FontType.TYPE0;
  27324. default:
  27325. return _util.FontType.UNKNOWN;
  27326. }
  27327. }
  27328. function recoverGlyphName(name, glyphsUnicodeMap) {
  27329. if (glyphsUnicodeMap[name] !== undefined) {
  27330. return name;
  27331. }
  27332. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  27333. if (unicode !== -1) {
  27334. for (const key in glyphsUnicodeMap) {
  27335. if (glyphsUnicodeMap[key] === unicode) {
  27336. return key;
  27337. }
  27338. }
  27339. }
  27340. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  27341. return name;
  27342. }
  27343. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  27344. const charCodeToGlyphId = Object.create(null);
  27345. let glyphId, charCode, baseEncoding;
  27346. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27347. if (properties.isInternalFont) {
  27348. baseEncoding = builtInEncoding;
  27349. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27350. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27351. if (glyphId >= 0) {
  27352. charCodeToGlyphId[charCode] = glyphId;
  27353. } else {
  27354. charCodeToGlyphId[charCode] = 0;
  27355. }
  27356. }
  27357. } else if (properties.baseEncodingName) {
  27358. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  27359. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27360. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27361. if (glyphId >= 0) {
  27362. charCodeToGlyphId[charCode] = glyphId;
  27363. } else {
  27364. charCodeToGlyphId[charCode] = 0;
  27365. }
  27366. }
  27367. } else if (isSymbolicFont) {
  27368. for (charCode in builtInEncoding) {
  27369. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  27370. }
  27371. } else {
  27372. baseEncoding = _encodings.StandardEncoding;
  27373. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  27374. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  27375. if (glyphId >= 0) {
  27376. charCodeToGlyphId[charCode] = glyphId;
  27377. } else {
  27378. charCodeToGlyphId[charCode] = 0;
  27379. }
  27380. }
  27381. }
  27382. const differences = properties.differences;
  27383. let glyphsUnicodeMap;
  27384. if (differences) {
  27385. for (charCode in differences) {
  27386. const glyphName = differences[charCode];
  27387. glyphId = glyphNames.indexOf(glyphName);
  27388. if (glyphId === -1) {
  27389. if (!glyphsUnicodeMap) {
  27390. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  27391. }
  27392. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  27393. if (standardGlyphName !== glyphName) {
  27394. glyphId = glyphNames.indexOf(standardGlyphName);
  27395. }
  27396. }
  27397. if (glyphId >= 0) {
  27398. charCodeToGlyphId[charCode] = glyphId;
  27399. } else {
  27400. charCodeToGlyphId[charCode] = 0;
  27401. }
  27402. }
  27403. }
  27404. return charCodeToGlyphId;
  27405. }
  27406. function normalizeFontName(name) {
  27407. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  27408. }
  27409. /***/ }),
  27410. /* 168 */
  27411. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  27412. "use strict";
  27413. __w_pdfjs_require__.r(__webpack_exports__);
  27414. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  27415. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  27416. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  27417. /* harmony export */ });
  27418. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(135);
  27419. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  27420. return [
  27421. "A",
  27422. 0x0041,
  27423. "AE",
  27424. 0x00c6,
  27425. "AEacute",
  27426. 0x01fc,
  27427. "AEmacron",
  27428. 0x01e2,
  27429. "AEsmall",
  27430. 0xf7e6,
  27431. "Aacute",
  27432. 0x00c1,
  27433. "Aacutesmall",
  27434. 0xf7e1,
  27435. "Abreve",
  27436. 0x0102,
  27437. "Abreveacute",
  27438. 0x1eae,
  27439. "Abrevecyrillic",
  27440. 0x04d0,
  27441. "Abrevedotbelow",
  27442. 0x1eb6,
  27443. "Abrevegrave",
  27444. 0x1eb0,
  27445. "Abrevehookabove",
  27446. 0x1eb2,
  27447. "Abrevetilde",
  27448. 0x1eb4,
  27449. "Acaron",
  27450. 0x01cd,
  27451. "Acircle",
  27452. 0x24b6,
  27453. "Acircumflex",
  27454. 0x00c2,
  27455. "Acircumflexacute",
  27456. 0x1ea4,
  27457. "Acircumflexdotbelow",
  27458. 0x1eac,
  27459. "Acircumflexgrave",
  27460. 0x1ea6,
  27461. "Acircumflexhookabove",
  27462. 0x1ea8,
  27463. "Acircumflexsmall",
  27464. 0xf7e2,
  27465. "Acircumflextilde",
  27466. 0x1eaa,
  27467. "Acute",
  27468. 0xf6c9,
  27469. "Acutesmall",
  27470. 0xf7b4,
  27471. "Acyrillic",
  27472. 0x0410,
  27473. "Adblgrave",
  27474. 0x0200,
  27475. "Adieresis",
  27476. 0x00c4,
  27477. "Adieresiscyrillic",
  27478. 0x04d2,
  27479. "Adieresismacron",
  27480. 0x01de,
  27481. "Adieresissmall",
  27482. 0xf7e4,
  27483. "Adotbelow",
  27484. 0x1ea0,
  27485. "Adotmacron",
  27486. 0x01e0,
  27487. "Agrave",
  27488. 0x00c0,
  27489. "Agravesmall",
  27490. 0xf7e0,
  27491. "Ahookabove",
  27492. 0x1ea2,
  27493. "Aiecyrillic",
  27494. 0x04d4,
  27495. "Ainvertedbreve",
  27496. 0x0202,
  27497. "Alpha",
  27498. 0x0391,
  27499. "Alphatonos",
  27500. 0x0386,
  27501. "Amacron",
  27502. 0x0100,
  27503. "Amonospace",
  27504. 0xff21,
  27505. "Aogonek",
  27506. 0x0104,
  27507. "Aring",
  27508. 0x00c5,
  27509. "Aringacute",
  27510. 0x01fa,
  27511. "Aringbelow",
  27512. 0x1e00,
  27513. "Aringsmall",
  27514. 0xf7e5,
  27515. "Asmall",
  27516. 0xf761,
  27517. "Atilde",
  27518. 0x00c3,
  27519. "Atildesmall",
  27520. 0xf7e3,
  27521. "Aybarmenian",
  27522. 0x0531,
  27523. "B",
  27524. 0x0042,
  27525. "Bcircle",
  27526. 0x24b7,
  27527. "Bdotaccent",
  27528. 0x1e02,
  27529. "Bdotbelow",
  27530. 0x1e04,
  27531. "Becyrillic",
  27532. 0x0411,
  27533. "Benarmenian",
  27534. 0x0532,
  27535. "Beta",
  27536. 0x0392,
  27537. "Bhook",
  27538. 0x0181,
  27539. "Blinebelow",
  27540. 0x1e06,
  27541. "Bmonospace",
  27542. 0xff22,
  27543. "Brevesmall",
  27544. 0xf6f4,
  27545. "Bsmall",
  27546. 0xf762,
  27547. "Btopbar",
  27548. 0x0182,
  27549. "C",
  27550. 0x0043,
  27551. "Caarmenian",
  27552. 0x053e,
  27553. "Cacute",
  27554. 0x0106,
  27555. "Caron",
  27556. 0xf6ca,
  27557. "Caronsmall",
  27558. 0xf6f5,
  27559. "Ccaron",
  27560. 0x010c,
  27561. "Ccedilla",
  27562. 0x00c7,
  27563. "Ccedillaacute",
  27564. 0x1e08,
  27565. "Ccedillasmall",
  27566. 0xf7e7,
  27567. "Ccircle",
  27568. 0x24b8,
  27569. "Ccircumflex",
  27570. 0x0108,
  27571. "Cdot",
  27572. 0x010a,
  27573. "Cdotaccent",
  27574. 0x010a,
  27575. "Cedillasmall",
  27576. 0xf7b8,
  27577. "Chaarmenian",
  27578. 0x0549,
  27579. "Cheabkhasiancyrillic",
  27580. 0x04bc,
  27581. "Checyrillic",
  27582. 0x0427,
  27583. "Chedescenderabkhasiancyrillic",
  27584. 0x04be,
  27585. "Chedescendercyrillic",
  27586. 0x04b6,
  27587. "Chedieresiscyrillic",
  27588. 0x04f4,
  27589. "Cheharmenian",
  27590. 0x0543,
  27591. "Chekhakassiancyrillic",
  27592. 0x04cb,
  27593. "Cheverticalstrokecyrillic",
  27594. 0x04b8,
  27595. "Chi",
  27596. 0x03a7,
  27597. "Chook",
  27598. 0x0187,
  27599. "Circumflexsmall",
  27600. 0xf6f6,
  27601. "Cmonospace",
  27602. 0xff23,
  27603. "Coarmenian",
  27604. 0x0551,
  27605. "Csmall",
  27606. 0xf763,
  27607. "D",
  27608. 0x0044,
  27609. "DZ",
  27610. 0x01f1,
  27611. "DZcaron",
  27612. 0x01c4,
  27613. "Daarmenian",
  27614. 0x0534,
  27615. "Dafrican",
  27616. 0x0189,
  27617. "Dcaron",
  27618. 0x010e,
  27619. "Dcedilla",
  27620. 0x1e10,
  27621. "Dcircle",
  27622. 0x24b9,
  27623. "Dcircumflexbelow",
  27624. 0x1e12,
  27625. "Dcroat",
  27626. 0x0110,
  27627. "Ddotaccent",
  27628. 0x1e0a,
  27629. "Ddotbelow",
  27630. 0x1e0c,
  27631. "Decyrillic",
  27632. 0x0414,
  27633. "Deicoptic",
  27634. 0x03ee,
  27635. "Delta",
  27636. 0x2206,
  27637. "Deltagreek",
  27638. 0x0394,
  27639. "Dhook",
  27640. 0x018a,
  27641. "Dieresis",
  27642. 0xf6cb,
  27643. "DieresisAcute",
  27644. 0xf6cc,
  27645. "DieresisGrave",
  27646. 0xf6cd,
  27647. "Dieresissmall",
  27648. 0xf7a8,
  27649. "Digammagreek",
  27650. 0x03dc,
  27651. "Djecyrillic",
  27652. 0x0402,
  27653. "Dlinebelow",
  27654. 0x1e0e,
  27655. "Dmonospace",
  27656. 0xff24,
  27657. "Dotaccentsmall",
  27658. 0xf6f7,
  27659. "Dslash",
  27660. 0x0110,
  27661. "Dsmall",
  27662. 0xf764,
  27663. "Dtopbar",
  27664. 0x018b,
  27665. "Dz",
  27666. 0x01f2,
  27667. "Dzcaron",
  27668. 0x01c5,
  27669. "Dzeabkhasiancyrillic",
  27670. 0x04e0,
  27671. "Dzecyrillic",
  27672. 0x0405,
  27673. "Dzhecyrillic",
  27674. 0x040f,
  27675. "E",
  27676. 0x0045,
  27677. "Eacute",
  27678. 0x00c9,
  27679. "Eacutesmall",
  27680. 0xf7e9,
  27681. "Ebreve",
  27682. 0x0114,
  27683. "Ecaron",
  27684. 0x011a,
  27685. "Ecedillabreve",
  27686. 0x1e1c,
  27687. "Echarmenian",
  27688. 0x0535,
  27689. "Ecircle",
  27690. 0x24ba,
  27691. "Ecircumflex",
  27692. 0x00ca,
  27693. "Ecircumflexacute",
  27694. 0x1ebe,
  27695. "Ecircumflexbelow",
  27696. 0x1e18,
  27697. "Ecircumflexdotbelow",
  27698. 0x1ec6,
  27699. "Ecircumflexgrave",
  27700. 0x1ec0,
  27701. "Ecircumflexhookabove",
  27702. 0x1ec2,
  27703. "Ecircumflexsmall",
  27704. 0xf7ea,
  27705. "Ecircumflextilde",
  27706. 0x1ec4,
  27707. "Ecyrillic",
  27708. 0x0404,
  27709. "Edblgrave",
  27710. 0x0204,
  27711. "Edieresis",
  27712. 0x00cb,
  27713. "Edieresissmall",
  27714. 0xf7eb,
  27715. "Edot",
  27716. 0x0116,
  27717. "Edotaccent",
  27718. 0x0116,
  27719. "Edotbelow",
  27720. 0x1eb8,
  27721. "Efcyrillic",
  27722. 0x0424,
  27723. "Egrave",
  27724. 0x00c8,
  27725. "Egravesmall",
  27726. 0xf7e8,
  27727. "Eharmenian",
  27728. 0x0537,
  27729. "Ehookabove",
  27730. 0x1eba,
  27731. "Eightroman",
  27732. 0x2167,
  27733. "Einvertedbreve",
  27734. 0x0206,
  27735. "Eiotifiedcyrillic",
  27736. 0x0464,
  27737. "Elcyrillic",
  27738. 0x041b,
  27739. "Elevenroman",
  27740. 0x216a,
  27741. "Emacron",
  27742. 0x0112,
  27743. "Emacronacute",
  27744. 0x1e16,
  27745. "Emacrongrave",
  27746. 0x1e14,
  27747. "Emcyrillic",
  27748. 0x041c,
  27749. "Emonospace",
  27750. 0xff25,
  27751. "Encyrillic",
  27752. 0x041d,
  27753. "Endescendercyrillic",
  27754. 0x04a2,
  27755. "Eng",
  27756. 0x014a,
  27757. "Enghecyrillic",
  27758. 0x04a4,
  27759. "Enhookcyrillic",
  27760. 0x04c7,
  27761. "Eogonek",
  27762. 0x0118,
  27763. "Eopen",
  27764. 0x0190,
  27765. "Epsilon",
  27766. 0x0395,
  27767. "Epsilontonos",
  27768. 0x0388,
  27769. "Ercyrillic",
  27770. 0x0420,
  27771. "Ereversed",
  27772. 0x018e,
  27773. "Ereversedcyrillic",
  27774. 0x042d,
  27775. "Escyrillic",
  27776. 0x0421,
  27777. "Esdescendercyrillic",
  27778. 0x04aa,
  27779. "Esh",
  27780. 0x01a9,
  27781. "Esmall",
  27782. 0xf765,
  27783. "Eta",
  27784. 0x0397,
  27785. "Etarmenian",
  27786. 0x0538,
  27787. "Etatonos",
  27788. 0x0389,
  27789. "Eth",
  27790. 0x00d0,
  27791. "Ethsmall",
  27792. 0xf7f0,
  27793. "Etilde",
  27794. 0x1ebc,
  27795. "Etildebelow",
  27796. 0x1e1a,
  27797. "Euro",
  27798. 0x20ac,
  27799. "Ezh",
  27800. 0x01b7,
  27801. "Ezhcaron",
  27802. 0x01ee,
  27803. "Ezhreversed",
  27804. 0x01b8,
  27805. "F",
  27806. 0x0046,
  27807. "Fcircle",
  27808. 0x24bb,
  27809. "Fdotaccent",
  27810. 0x1e1e,
  27811. "Feharmenian",
  27812. 0x0556,
  27813. "Feicoptic",
  27814. 0x03e4,
  27815. "Fhook",
  27816. 0x0191,
  27817. "Fitacyrillic",
  27818. 0x0472,
  27819. "Fiveroman",
  27820. 0x2164,
  27821. "Fmonospace",
  27822. 0xff26,
  27823. "Fourroman",
  27824. 0x2163,
  27825. "Fsmall",
  27826. 0xf766,
  27827. "G",
  27828. 0x0047,
  27829. "GBsquare",
  27830. 0x3387,
  27831. "Gacute",
  27832. 0x01f4,
  27833. "Gamma",
  27834. 0x0393,
  27835. "Gammaafrican",
  27836. 0x0194,
  27837. "Gangiacoptic",
  27838. 0x03ea,
  27839. "Gbreve",
  27840. 0x011e,
  27841. "Gcaron",
  27842. 0x01e6,
  27843. "Gcedilla",
  27844. 0x0122,
  27845. "Gcircle",
  27846. 0x24bc,
  27847. "Gcircumflex",
  27848. 0x011c,
  27849. "Gcommaaccent",
  27850. 0x0122,
  27851. "Gdot",
  27852. 0x0120,
  27853. "Gdotaccent",
  27854. 0x0120,
  27855. "Gecyrillic",
  27856. 0x0413,
  27857. "Ghadarmenian",
  27858. 0x0542,
  27859. "Ghemiddlehookcyrillic",
  27860. 0x0494,
  27861. "Ghestrokecyrillic",
  27862. 0x0492,
  27863. "Gheupturncyrillic",
  27864. 0x0490,
  27865. "Ghook",
  27866. 0x0193,
  27867. "Gimarmenian",
  27868. 0x0533,
  27869. "Gjecyrillic",
  27870. 0x0403,
  27871. "Gmacron",
  27872. 0x1e20,
  27873. "Gmonospace",
  27874. 0xff27,
  27875. "Grave",
  27876. 0xf6ce,
  27877. "Gravesmall",
  27878. 0xf760,
  27879. "Gsmall",
  27880. 0xf767,
  27881. "Gsmallhook",
  27882. 0x029b,
  27883. "Gstroke",
  27884. 0x01e4,
  27885. "H",
  27886. 0x0048,
  27887. "H18533",
  27888. 0x25cf,
  27889. "H18543",
  27890. 0x25aa,
  27891. "H18551",
  27892. 0x25ab,
  27893. "H22073",
  27894. 0x25a1,
  27895. "HPsquare",
  27896. 0x33cb,
  27897. "Haabkhasiancyrillic",
  27898. 0x04a8,
  27899. "Hadescendercyrillic",
  27900. 0x04b2,
  27901. "Hardsigncyrillic",
  27902. 0x042a,
  27903. "Hbar",
  27904. 0x0126,
  27905. "Hbrevebelow",
  27906. 0x1e2a,
  27907. "Hcedilla",
  27908. 0x1e28,
  27909. "Hcircle",
  27910. 0x24bd,
  27911. "Hcircumflex",
  27912. 0x0124,
  27913. "Hdieresis",
  27914. 0x1e26,
  27915. "Hdotaccent",
  27916. 0x1e22,
  27917. "Hdotbelow",
  27918. 0x1e24,
  27919. "Hmonospace",
  27920. 0xff28,
  27921. "Hoarmenian",
  27922. 0x0540,
  27923. "Horicoptic",
  27924. 0x03e8,
  27925. "Hsmall",
  27926. 0xf768,
  27927. "Hungarumlaut",
  27928. 0xf6cf,
  27929. "Hungarumlautsmall",
  27930. 0xf6f8,
  27931. "Hzsquare",
  27932. 0x3390,
  27933. "I",
  27934. 0x0049,
  27935. "IAcyrillic",
  27936. 0x042f,
  27937. "IJ",
  27938. 0x0132,
  27939. "IUcyrillic",
  27940. 0x042e,
  27941. "Iacute",
  27942. 0x00cd,
  27943. "Iacutesmall",
  27944. 0xf7ed,
  27945. "Ibreve",
  27946. 0x012c,
  27947. "Icaron",
  27948. 0x01cf,
  27949. "Icircle",
  27950. 0x24be,
  27951. "Icircumflex",
  27952. 0x00ce,
  27953. "Icircumflexsmall",
  27954. 0xf7ee,
  27955. "Icyrillic",
  27956. 0x0406,
  27957. "Idblgrave",
  27958. 0x0208,
  27959. "Idieresis",
  27960. 0x00cf,
  27961. "Idieresisacute",
  27962. 0x1e2e,
  27963. "Idieresiscyrillic",
  27964. 0x04e4,
  27965. "Idieresissmall",
  27966. 0xf7ef,
  27967. "Idot",
  27968. 0x0130,
  27969. "Idotaccent",
  27970. 0x0130,
  27971. "Idotbelow",
  27972. 0x1eca,
  27973. "Iebrevecyrillic",
  27974. 0x04d6,
  27975. "Iecyrillic",
  27976. 0x0415,
  27977. "Ifraktur",
  27978. 0x2111,
  27979. "Igrave",
  27980. 0x00cc,
  27981. "Igravesmall",
  27982. 0xf7ec,
  27983. "Ihookabove",
  27984. 0x1ec8,
  27985. "Iicyrillic",
  27986. 0x0418,
  27987. "Iinvertedbreve",
  27988. 0x020a,
  27989. "Iishortcyrillic",
  27990. 0x0419,
  27991. "Imacron",
  27992. 0x012a,
  27993. "Imacroncyrillic",
  27994. 0x04e2,
  27995. "Imonospace",
  27996. 0xff29,
  27997. "Iniarmenian",
  27998. 0x053b,
  27999. "Iocyrillic",
  28000. 0x0401,
  28001. "Iogonek",
  28002. 0x012e,
  28003. "Iota",
  28004. 0x0399,
  28005. "Iotaafrican",
  28006. 0x0196,
  28007. "Iotadieresis",
  28008. 0x03aa,
  28009. "Iotatonos",
  28010. 0x038a,
  28011. "Ismall",
  28012. 0xf769,
  28013. "Istroke",
  28014. 0x0197,
  28015. "Itilde",
  28016. 0x0128,
  28017. "Itildebelow",
  28018. 0x1e2c,
  28019. "Izhitsacyrillic",
  28020. 0x0474,
  28021. "Izhitsadblgravecyrillic",
  28022. 0x0476,
  28023. "J",
  28024. 0x004a,
  28025. "Jaarmenian",
  28026. 0x0541,
  28027. "Jcircle",
  28028. 0x24bf,
  28029. "Jcircumflex",
  28030. 0x0134,
  28031. "Jecyrillic",
  28032. 0x0408,
  28033. "Jheharmenian",
  28034. 0x054b,
  28035. "Jmonospace",
  28036. 0xff2a,
  28037. "Jsmall",
  28038. 0xf76a,
  28039. "K",
  28040. 0x004b,
  28041. "KBsquare",
  28042. 0x3385,
  28043. "KKsquare",
  28044. 0x33cd,
  28045. "Kabashkircyrillic",
  28046. 0x04a0,
  28047. "Kacute",
  28048. 0x1e30,
  28049. "Kacyrillic",
  28050. 0x041a,
  28051. "Kadescendercyrillic",
  28052. 0x049a,
  28053. "Kahookcyrillic",
  28054. 0x04c3,
  28055. "Kappa",
  28056. 0x039a,
  28057. "Kastrokecyrillic",
  28058. 0x049e,
  28059. "Kaverticalstrokecyrillic",
  28060. 0x049c,
  28061. "Kcaron",
  28062. 0x01e8,
  28063. "Kcedilla",
  28064. 0x0136,
  28065. "Kcircle",
  28066. 0x24c0,
  28067. "Kcommaaccent",
  28068. 0x0136,
  28069. "Kdotbelow",
  28070. 0x1e32,
  28071. "Keharmenian",
  28072. 0x0554,
  28073. "Kenarmenian",
  28074. 0x053f,
  28075. "Khacyrillic",
  28076. 0x0425,
  28077. "Kheicoptic",
  28078. 0x03e6,
  28079. "Khook",
  28080. 0x0198,
  28081. "Kjecyrillic",
  28082. 0x040c,
  28083. "Klinebelow",
  28084. 0x1e34,
  28085. "Kmonospace",
  28086. 0xff2b,
  28087. "Koppacyrillic",
  28088. 0x0480,
  28089. "Koppagreek",
  28090. 0x03de,
  28091. "Ksicyrillic",
  28092. 0x046e,
  28093. "Ksmall",
  28094. 0xf76b,
  28095. "L",
  28096. 0x004c,
  28097. "LJ",
  28098. 0x01c7,
  28099. "LL",
  28100. 0xf6bf,
  28101. "Lacute",
  28102. 0x0139,
  28103. "Lambda",
  28104. 0x039b,
  28105. "Lcaron",
  28106. 0x013d,
  28107. "Lcedilla",
  28108. 0x013b,
  28109. "Lcircle",
  28110. 0x24c1,
  28111. "Lcircumflexbelow",
  28112. 0x1e3c,
  28113. "Lcommaaccent",
  28114. 0x013b,
  28115. "Ldot",
  28116. 0x013f,
  28117. "Ldotaccent",
  28118. 0x013f,
  28119. "Ldotbelow",
  28120. 0x1e36,
  28121. "Ldotbelowmacron",
  28122. 0x1e38,
  28123. "Liwnarmenian",
  28124. 0x053c,
  28125. "Lj",
  28126. 0x01c8,
  28127. "Ljecyrillic",
  28128. 0x0409,
  28129. "Llinebelow",
  28130. 0x1e3a,
  28131. "Lmonospace",
  28132. 0xff2c,
  28133. "Lslash",
  28134. 0x0141,
  28135. "Lslashsmall",
  28136. 0xf6f9,
  28137. "Lsmall",
  28138. 0xf76c,
  28139. "M",
  28140. 0x004d,
  28141. "MBsquare",
  28142. 0x3386,
  28143. "Macron",
  28144. 0xf6d0,
  28145. "Macronsmall",
  28146. 0xf7af,
  28147. "Macute",
  28148. 0x1e3e,
  28149. "Mcircle",
  28150. 0x24c2,
  28151. "Mdotaccent",
  28152. 0x1e40,
  28153. "Mdotbelow",
  28154. 0x1e42,
  28155. "Menarmenian",
  28156. 0x0544,
  28157. "Mmonospace",
  28158. 0xff2d,
  28159. "Msmall",
  28160. 0xf76d,
  28161. "Mturned",
  28162. 0x019c,
  28163. "Mu",
  28164. 0x039c,
  28165. "N",
  28166. 0x004e,
  28167. "NJ",
  28168. 0x01ca,
  28169. "Nacute",
  28170. 0x0143,
  28171. "Ncaron",
  28172. 0x0147,
  28173. "Ncedilla",
  28174. 0x0145,
  28175. "Ncircle",
  28176. 0x24c3,
  28177. "Ncircumflexbelow",
  28178. 0x1e4a,
  28179. "Ncommaaccent",
  28180. 0x0145,
  28181. "Ndotaccent",
  28182. 0x1e44,
  28183. "Ndotbelow",
  28184. 0x1e46,
  28185. "Nhookleft",
  28186. 0x019d,
  28187. "Nineroman",
  28188. 0x2168,
  28189. "Nj",
  28190. 0x01cb,
  28191. "Njecyrillic",
  28192. 0x040a,
  28193. "Nlinebelow",
  28194. 0x1e48,
  28195. "Nmonospace",
  28196. 0xff2e,
  28197. "Nowarmenian",
  28198. 0x0546,
  28199. "Nsmall",
  28200. 0xf76e,
  28201. "Ntilde",
  28202. 0x00d1,
  28203. "Ntildesmall",
  28204. 0xf7f1,
  28205. "Nu",
  28206. 0x039d,
  28207. "O",
  28208. 0x004f,
  28209. "OE",
  28210. 0x0152,
  28211. "OEsmall",
  28212. 0xf6fa,
  28213. "Oacute",
  28214. 0x00d3,
  28215. "Oacutesmall",
  28216. 0xf7f3,
  28217. "Obarredcyrillic",
  28218. 0x04e8,
  28219. "Obarreddieresiscyrillic",
  28220. 0x04ea,
  28221. "Obreve",
  28222. 0x014e,
  28223. "Ocaron",
  28224. 0x01d1,
  28225. "Ocenteredtilde",
  28226. 0x019f,
  28227. "Ocircle",
  28228. 0x24c4,
  28229. "Ocircumflex",
  28230. 0x00d4,
  28231. "Ocircumflexacute",
  28232. 0x1ed0,
  28233. "Ocircumflexdotbelow",
  28234. 0x1ed8,
  28235. "Ocircumflexgrave",
  28236. 0x1ed2,
  28237. "Ocircumflexhookabove",
  28238. 0x1ed4,
  28239. "Ocircumflexsmall",
  28240. 0xf7f4,
  28241. "Ocircumflextilde",
  28242. 0x1ed6,
  28243. "Ocyrillic",
  28244. 0x041e,
  28245. "Odblacute",
  28246. 0x0150,
  28247. "Odblgrave",
  28248. 0x020c,
  28249. "Odieresis",
  28250. 0x00d6,
  28251. "Odieresiscyrillic",
  28252. 0x04e6,
  28253. "Odieresissmall",
  28254. 0xf7f6,
  28255. "Odotbelow",
  28256. 0x1ecc,
  28257. "Ogoneksmall",
  28258. 0xf6fb,
  28259. "Ograve",
  28260. 0x00d2,
  28261. "Ogravesmall",
  28262. 0xf7f2,
  28263. "Oharmenian",
  28264. 0x0555,
  28265. "Ohm",
  28266. 0x2126,
  28267. "Ohookabove",
  28268. 0x1ece,
  28269. "Ohorn",
  28270. 0x01a0,
  28271. "Ohornacute",
  28272. 0x1eda,
  28273. "Ohorndotbelow",
  28274. 0x1ee2,
  28275. "Ohorngrave",
  28276. 0x1edc,
  28277. "Ohornhookabove",
  28278. 0x1ede,
  28279. "Ohorntilde",
  28280. 0x1ee0,
  28281. "Ohungarumlaut",
  28282. 0x0150,
  28283. "Oi",
  28284. 0x01a2,
  28285. "Oinvertedbreve",
  28286. 0x020e,
  28287. "Omacron",
  28288. 0x014c,
  28289. "Omacronacute",
  28290. 0x1e52,
  28291. "Omacrongrave",
  28292. 0x1e50,
  28293. "Omega",
  28294. 0x2126,
  28295. "Omegacyrillic",
  28296. 0x0460,
  28297. "Omegagreek",
  28298. 0x03a9,
  28299. "Omegaroundcyrillic",
  28300. 0x047a,
  28301. "Omegatitlocyrillic",
  28302. 0x047c,
  28303. "Omegatonos",
  28304. 0x038f,
  28305. "Omicron",
  28306. 0x039f,
  28307. "Omicrontonos",
  28308. 0x038c,
  28309. "Omonospace",
  28310. 0xff2f,
  28311. "Oneroman",
  28312. 0x2160,
  28313. "Oogonek",
  28314. 0x01ea,
  28315. "Oogonekmacron",
  28316. 0x01ec,
  28317. "Oopen",
  28318. 0x0186,
  28319. "Oslash",
  28320. 0x00d8,
  28321. "Oslashacute",
  28322. 0x01fe,
  28323. "Oslashsmall",
  28324. 0xf7f8,
  28325. "Osmall",
  28326. 0xf76f,
  28327. "Ostrokeacute",
  28328. 0x01fe,
  28329. "Otcyrillic",
  28330. 0x047e,
  28331. "Otilde",
  28332. 0x00d5,
  28333. "Otildeacute",
  28334. 0x1e4c,
  28335. "Otildedieresis",
  28336. 0x1e4e,
  28337. "Otildesmall",
  28338. 0xf7f5,
  28339. "P",
  28340. 0x0050,
  28341. "Pacute",
  28342. 0x1e54,
  28343. "Pcircle",
  28344. 0x24c5,
  28345. "Pdotaccent",
  28346. 0x1e56,
  28347. "Pecyrillic",
  28348. 0x041f,
  28349. "Peharmenian",
  28350. 0x054a,
  28351. "Pemiddlehookcyrillic",
  28352. 0x04a6,
  28353. "Phi",
  28354. 0x03a6,
  28355. "Phook",
  28356. 0x01a4,
  28357. "Pi",
  28358. 0x03a0,
  28359. "Piwrarmenian",
  28360. 0x0553,
  28361. "Pmonospace",
  28362. 0xff30,
  28363. "Psi",
  28364. 0x03a8,
  28365. "Psicyrillic",
  28366. 0x0470,
  28367. "Psmall",
  28368. 0xf770,
  28369. "Q",
  28370. 0x0051,
  28371. "Qcircle",
  28372. 0x24c6,
  28373. "Qmonospace",
  28374. 0xff31,
  28375. "Qsmall",
  28376. 0xf771,
  28377. "R",
  28378. 0x0052,
  28379. "Raarmenian",
  28380. 0x054c,
  28381. "Racute",
  28382. 0x0154,
  28383. "Rcaron",
  28384. 0x0158,
  28385. "Rcedilla",
  28386. 0x0156,
  28387. "Rcircle",
  28388. 0x24c7,
  28389. "Rcommaaccent",
  28390. 0x0156,
  28391. "Rdblgrave",
  28392. 0x0210,
  28393. "Rdotaccent",
  28394. 0x1e58,
  28395. "Rdotbelow",
  28396. 0x1e5a,
  28397. "Rdotbelowmacron",
  28398. 0x1e5c,
  28399. "Reharmenian",
  28400. 0x0550,
  28401. "Rfraktur",
  28402. 0x211c,
  28403. "Rho",
  28404. 0x03a1,
  28405. "Ringsmall",
  28406. 0xf6fc,
  28407. "Rinvertedbreve",
  28408. 0x0212,
  28409. "Rlinebelow",
  28410. 0x1e5e,
  28411. "Rmonospace",
  28412. 0xff32,
  28413. "Rsmall",
  28414. 0xf772,
  28415. "Rsmallinverted",
  28416. 0x0281,
  28417. "Rsmallinvertedsuperior",
  28418. 0x02b6,
  28419. "S",
  28420. 0x0053,
  28421. "SF010000",
  28422. 0x250c,
  28423. "SF020000",
  28424. 0x2514,
  28425. "SF030000",
  28426. 0x2510,
  28427. "SF040000",
  28428. 0x2518,
  28429. "SF050000",
  28430. 0x253c,
  28431. "SF060000",
  28432. 0x252c,
  28433. "SF070000",
  28434. 0x2534,
  28435. "SF080000",
  28436. 0x251c,
  28437. "SF090000",
  28438. 0x2524,
  28439. "SF100000",
  28440. 0x2500,
  28441. "SF110000",
  28442. 0x2502,
  28443. "SF190000",
  28444. 0x2561,
  28445. "SF200000",
  28446. 0x2562,
  28447. "SF210000",
  28448. 0x2556,
  28449. "SF220000",
  28450. 0x2555,
  28451. "SF230000",
  28452. 0x2563,
  28453. "SF240000",
  28454. 0x2551,
  28455. "SF250000",
  28456. 0x2557,
  28457. "SF260000",
  28458. 0x255d,
  28459. "SF270000",
  28460. 0x255c,
  28461. "SF280000",
  28462. 0x255b,
  28463. "SF360000",
  28464. 0x255e,
  28465. "SF370000",
  28466. 0x255f,
  28467. "SF380000",
  28468. 0x255a,
  28469. "SF390000",
  28470. 0x2554,
  28471. "SF400000",
  28472. 0x2569,
  28473. "SF410000",
  28474. 0x2566,
  28475. "SF420000",
  28476. 0x2560,
  28477. "SF430000",
  28478. 0x2550,
  28479. "SF440000",
  28480. 0x256c,
  28481. "SF450000",
  28482. 0x2567,
  28483. "SF460000",
  28484. 0x2568,
  28485. "SF470000",
  28486. 0x2564,
  28487. "SF480000",
  28488. 0x2565,
  28489. "SF490000",
  28490. 0x2559,
  28491. "SF500000",
  28492. 0x2558,
  28493. "SF510000",
  28494. 0x2552,
  28495. "SF520000",
  28496. 0x2553,
  28497. "SF530000",
  28498. 0x256b,
  28499. "SF540000",
  28500. 0x256a,
  28501. "Sacute",
  28502. 0x015a,
  28503. "Sacutedotaccent",
  28504. 0x1e64,
  28505. "Sampigreek",
  28506. 0x03e0,
  28507. "Scaron",
  28508. 0x0160,
  28509. "Scarondotaccent",
  28510. 0x1e66,
  28511. "Scaronsmall",
  28512. 0xf6fd,
  28513. "Scedilla",
  28514. 0x015e,
  28515. "Schwa",
  28516. 0x018f,
  28517. "Schwacyrillic",
  28518. 0x04d8,
  28519. "Schwadieresiscyrillic",
  28520. 0x04da,
  28521. "Scircle",
  28522. 0x24c8,
  28523. "Scircumflex",
  28524. 0x015c,
  28525. "Scommaaccent",
  28526. 0x0218,
  28527. "Sdotaccent",
  28528. 0x1e60,
  28529. "Sdotbelow",
  28530. 0x1e62,
  28531. "Sdotbelowdotaccent",
  28532. 0x1e68,
  28533. "Seharmenian",
  28534. 0x054d,
  28535. "Sevenroman",
  28536. 0x2166,
  28537. "Shaarmenian",
  28538. 0x0547,
  28539. "Shacyrillic",
  28540. 0x0428,
  28541. "Shchacyrillic",
  28542. 0x0429,
  28543. "Sheicoptic",
  28544. 0x03e2,
  28545. "Shhacyrillic",
  28546. 0x04ba,
  28547. "Shimacoptic",
  28548. 0x03ec,
  28549. "Sigma",
  28550. 0x03a3,
  28551. "Sixroman",
  28552. 0x2165,
  28553. "Smonospace",
  28554. 0xff33,
  28555. "Softsigncyrillic",
  28556. 0x042c,
  28557. "Ssmall",
  28558. 0xf773,
  28559. "Stigmagreek",
  28560. 0x03da,
  28561. "T",
  28562. 0x0054,
  28563. "Tau",
  28564. 0x03a4,
  28565. "Tbar",
  28566. 0x0166,
  28567. "Tcaron",
  28568. 0x0164,
  28569. "Tcedilla",
  28570. 0x0162,
  28571. "Tcircle",
  28572. 0x24c9,
  28573. "Tcircumflexbelow",
  28574. 0x1e70,
  28575. "Tcommaaccent",
  28576. 0x0162,
  28577. "Tdotaccent",
  28578. 0x1e6a,
  28579. "Tdotbelow",
  28580. 0x1e6c,
  28581. "Tecyrillic",
  28582. 0x0422,
  28583. "Tedescendercyrillic",
  28584. 0x04ac,
  28585. "Tenroman",
  28586. 0x2169,
  28587. "Tetsecyrillic",
  28588. 0x04b4,
  28589. "Theta",
  28590. 0x0398,
  28591. "Thook",
  28592. 0x01ac,
  28593. "Thorn",
  28594. 0x00de,
  28595. "Thornsmall",
  28596. 0xf7fe,
  28597. "Threeroman",
  28598. 0x2162,
  28599. "Tildesmall",
  28600. 0xf6fe,
  28601. "Tiwnarmenian",
  28602. 0x054f,
  28603. "Tlinebelow",
  28604. 0x1e6e,
  28605. "Tmonospace",
  28606. 0xff34,
  28607. "Toarmenian",
  28608. 0x0539,
  28609. "Tonefive",
  28610. 0x01bc,
  28611. "Tonesix",
  28612. 0x0184,
  28613. "Tonetwo",
  28614. 0x01a7,
  28615. "Tretroflexhook",
  28616. 0x01ae,
  28617. "Tsecyrillic",
  28618. 0x0426,
  28619. "Tshecyrillic",
  28620. 0x040b,
  28621. "Tsmall",
  28622. 0xf774,
  28623. "Twelveroman",
  28624. 0x216b,
  28625. "Tworoman",
  28626. 0x2161,
  28627. "U",
  28628. 0x0055,
  28629. "Uacute",
  28630. 0x00da,
  28631. "Uacutesmall",
  28632. 0xf7fa,
  28633. "Ubreve",
  28634. 0x016c,
  28635. "Ucaron",
  28636. 0x01d3,
  28637. "Ucircle",
  28638. 0x24ca,
  28639. "Ucircumflex",
  28640. 0x00db,
  28641. "Ucircumflexbelow",
  28642. 0x1e76,
  28643. "Ucircumflexsmall",
  28644. 0xf7fb,
  28645. "Ucyrillic",
  28646. 0x0423,
  28647. "Udblacute",
  28648. 0x0170,
  28649. "Udblgrave",
  28650. 0x0214,
  28651. "Udieresis",
  28652. 0x00dc,
  28653. "Udieresisacute",
  28654. 0x01d7,
  28655. "Udieresisbelow",
  28656. 0x1e72,
  28657. "Udieresiscaron",
  28658. 0x01d9,
  28659. "Udieresiscyrillic",
  28660. 0x04f0,
  28661. "Udieresisgrave",
  28662. 0x01db,
  28663. "Udieresismacron",
  28664. 0x01d5,
  28665. "Udieresissmall",
  28666. 0xf7fc,
  28667. "Udotbelow",
  28668. 0x1ee4,
  28669. "Ugrave",
  28670. 0x00d9,
  28671. "Ugravesmall",
  28672. 0xf7f9,
  28673. "Uhookabove",
  28674. 0x1ee6,
  28675. "Uhorn",
  28676. 0x01af,
  28677. "Uhornacute",
  28678. 0x1ee8,
  28679. "Uhorndotbelow",
  28680. 0x1ef0,
  28681. "Uhorngrave",
  28682. 0x1eea,
  28683. "Uhornhookabove",
  28684. 0x1eec,
  28685. "Uhorntilde",
  28686. 0x1eee,
  28687. "Uhungarumlaut",
  28688. 0x0170,
  28689. "Uhungarumlautcyrillic",
  28690. 0x04f2,
  28691. "Uinvertedbreve",
  28692. 0x0216,
  28693. "Ukcyrillic",
  28694. 0x0478,
  28695. "Umacron",
  28696. 0x016a,
  28697. "Umacroncyrillic",
  28698. 0x04ee,
  28699. "Umacrondieresis",
  28700. 0x1e7a,
  28701. "Umonospace",
  28702. 0xff35,
  28703. "Uogonek",
  28704. 0x0172,
  28705. "Upsilon",
  28706. 0x03a5,
  28707. "Upsilon1",
  28708. 0x03d2,
  28709. "Upsilonacutehooksymbolgreek",
  28710. 0x03d3,
  28711. "Upsilonafrican",
  28712. 0x01b1,
  28713. "Upsilondieresis",
  28714. 0x03ab,
  28715. "Upsilondieresishooksymbolgreek",
  28716. 0x03d4,
  28717. "Upsilonhooksymbol",
  28718. 0x03d2,
  28719. "Upsilontonos",
  28720. 0x038e,
  28721. "Uring",
  28722. 0x016e,
  28723. "Ushortcyrillic",
  28724. 0x040e,
  28725. "Usmall",
  28726. 0xf775,
  28727. "Ustraightcyrillic",
  28728. 0x04ae,
  28729. "Ustraightstrokecyrillic",
  28730. 0x04b0,
  28731. "Utilde",
  28732. 0x0168,
  28733. "Utildeacute",
  28734. 0x1e78,
  28735. "Utildebelow",
  28736. 0x1e74,
  28737. "V",
  28738. 0x0056,
  28739. "Vcircle",
  28740. 0x24cb,
  28741. "Vdotbelow",
  28742. 0x1e7e,
  28743. "Vecyrillic",
  28744. 0x0412,
  28745. "Vewarmenian",
  28746. 0x054e,
  28747. "Vhook",
  28748. 0x01b2,
  28749. "Vmonospace",
  28750. 0xff36,
  28751. "Voarmenian",
  28752. 0x0548,
  28753. "Vsmall",
  28754. 0xf776,
  28755. "Vtilde",
  28756. 0x1e7c,
  28757. "W",
  28758. 0x0057,
  28759. "Wacute",
  28760. 0x1e82,
  28761. "Wcircle",
  28762. 0x24cc,
  28763. "Wcircumflex",
  28764. 0x0174,
  28765. "Wdieresis",
  28766. 0x1e84,
  28767. "Wdotaccent",
  28768. 0x1e86,
  28769. "Wdotbelow",
  28770. 0x1e88,
  28771. "Wgrave",
  28772. 0x1e80,
  28773. "Wmonospace",
  28774. 0xff37,
  28775. "Wsmall",
  28776. 0xf777,
  28777. "X",
  28778. 0x0058,
  28779. "Xcircle",
  28780. 0x24cd,
  28781. "Xdieresis",
  28782. 0x1e8c,
  28783. "Xdotaccent",
  28784. 0x1e8a,
  28785. "Xeharmenian",
  28786. 0x053d,
  28787. "Xi",
  28788. 0x039e,
  28789. "Xmonospace",
  28790. 0xff38,
  28791. "Xsmall",
  28792. 0xf778,
  28793. "Y",
  28794. 0x0059,
  28795. "Yacute",
  28796. 0x00dd,
  28797. "Yacutesmall",
  28798. 0xf7fd,
  28799. "Yatcyrillic",
  28800. 0x0462,
  28801. "Ycircle",
  28802. 0x24ce,
  28803. "Ycircumflex",
  28804. 0x0176,
  28805. "Ydieresis",
  28806. 0x0178,
  28807. "Ydieresissmall",
  28808. 0xf7ff,
  28809. "Ydotaccent",
  28810. 0x1e8e,
  28811. "Ydotbelow",
  28812. 0x1ef4,
  28813. "Yericyrillic",
  28814. 0x042b,
  28815. "Yerudieresiscyrillic",
  28816. 0x04f8,
  28817. "Ygrave",
  28818. 0x1ef2,
  28819. "Yhook",
  28820. 0x01b3,
  28821. "Yhookabove",
  28822. 0x1ef6,
  28823. "Yiarmenian",
  28824. 0x0545,
  28825. "Yicyrillic",
  28826. 0x0407,
  28827. "Yiwnarmenian",
  28828. 0x0552,
  28829. "Ymonospace",
  28830. 0xff39,
  28831. "Ysmall",
  28832. 0xf779,
  28833. "Ytilde",
  28834. 0x1ef8,
  28835. "Yusbigcyrillic",
  28836. 0x046a,
  28837. "Yusbigiotifiedcyrillic",
  28838. 0x046c,
  28839. "Yuslittlecyrillic",
  28840. 0x0466,
  28841. "Yuslittleiotifiedcyrillic",
  28842. 0x0468,
  28843. "Z",
  28844. 0x005a,
  28845. "Zaarmenian",
  28846. 0x0536,
  28847. "Zacute",
  28848. 0x0179,
  28849. "Zcaron",
  28850. 0x017d,
  28851. "Zcaronsmall",
  28852. 0xf6ff,
  28853. "Zcircle",
  28854. 0x24cf,
  28855. "Zcircumflex",
  28856. 0x1e90,
  28857. "Zdot",
  28858. 0x017b,
  28859. "Zdotaccent",
  28860. 0x017b,
  28861. "Zdotbelow",
  28862. 0x1e92,
  28863. "Zecyrillic",
  28864. 0x0417,
  28865. "Zedescendercyrillic",
  28866. 0x0498,
  28867. "Zedieresiscyrillic",
  28868. 0x04de,
  28869. "Zeta",
  28870. 0x0396,
  28871. "Zhearmenian",
  28872. 0x053a,
  28873. "Zhebrevecyrillic",
  28874. 0x04c1,
  28875. "Zhecyrillic",
  28876. 0x0416,
  28877. "Zhedescendercyrillic",
  28878. 0x0496,
  28879. "Zhedieresiscyrillic",
  28880. 0x04dc,
  28881. "Zlinebelow",
  28882. 0x1e94,
  28883. "Zmonospace",
  28884. 0xff3a,
  28885. "Zsmall",
  28886. 0xf77a,
  28887. "Zstroke",
  28888. 0x01b5,
  28889. "a",
  28890. 0x0061,
  28891. "aabengali",
  28892. 0x0986,
  28893. "aacute",
  28894. 0x00e1,
  28895. "aadeva",
  28896. 0x0906,
  28897. "aagujarati",
  28898. 0x0a86,
  28899. "aagurmukhi",
  28900. 0x0a06,
  28901. "aamatragurmukhi",
  28902. 0x0a3e,
  28903. "aarusquare",
  28904. 0x3303,
  28905. "aavowelsignbengali",
  28906. 0x09be,
  28907. "aavowelsigndeva",
  28908. 0x093e,
  28909. "aavowelsigngujarati",
  28910. 0x0abe,
  28911. "abbreviationmarkarmenian",
  28912. 0x055f,
  28913. "abbreviationsigndeva",
  28914. 0x0970,
  28915. "abengali",
  28916. 0x0985,
  28917. "abopomofo",
  28918. 0x311a,
  28919. "abreve",
  28920. 0x0103,
  28921. "abreveacute",
  28922. 0x1eaf,
  28923. "abrevecyrillic",
  28924. 0x04d1,
  28925. "abrevedotbelow",
  28926. 0x1eb7,
  28927. "abrevegrave",
  28928. 0x1eb1,
  28929. "abrevehookabove",
  28930. 0x1eb3,
  28931. "abrevetilde",
  28932. 0x1eb5,
  28933. "acaron",
  28934. 0x01ce,
  28935. "acircle",
  28936. 0x24d0,
  28937. "acircumflex",
  28938. 0x00e2,
  28939. "acircumflexacute",
  28940. 0x1ea5,
  28941. "acircumflexdotbelow",
  28942. 0x1ead,
  28943. "acircumflexgrave",
  28944. 0x1ea7,
  28945. "acircumflexhookabove",
  28946. 0x1ea9,
  28947. "acircumflextilde",
  28948. 0x1eab,
  28949. "acute",
  28950. 0x00b4,
  28951. "acutebelowcmb",
  28952. 0x0317,
  28953. "acutecmb",
  28954. 0x0301,
  28955. "acutecomb",
  28956. 0x0301,
  28957. "acutedeva",
  28958. 0x0954,
  28959. "acutelowmod",
  28960. 0x02cf,
  28961. "acutetonecmb",
  28962. 0x0341,
  28963. "acyrillic",
  28964. 0x0430,
  28965. "adblgrave",
  28966. 0x0201,
  28967. "addakgurmukhi",
  28968. 0x0a71,
  28969. "adeva",
  28970. 0x0905,
  28971. "adieresis",
  28972. 0x00e4,
  28973. "adieresiscyrillic",
  28974. 0x04d3,
  28975. "adieresismacron",
  28976. 0x01df,
  28977. "adotbelow",
  28978. 0x1ea1,
  28979. "adotmacron",
  28980. 0x01e1,
  28981. "ae",
  28982. 0x00e6,
  28983. "aeacute",
  28984. 0x01fd,
  28985. "aekorean",
  28986. 0x3150,
  28987. "aemacron",
  28988. 0x01e3,
  28989. "afii00208",
  28990. 0x2015,
  28991. "afii08941",
  28992. 0x20a4,
  28993. "afii10017",
  28994. 0x0410,
  28995. "afii10018",
  28996. 0x0411,
  28997. "afii10019",
  28998. 0x0412,
  28999. "afii10020",
  29000. 0x0413,
  29001. "afii10021",
  29002. 0x0414,
  29003. "afii10022",
  29004. 0x0415,
  29005. "afii10023",
  29006. 0x0401,
  29007. "afii10024",
  29008. 0x0416,
  29009. "afii10025",
  29010. 0x0417,
  29011. "afii10026",
  29012. 0x0418,
  29013. "afii10027",
  29014. 0x0419,
  29015. "afii10028",
  29016. 0x041a,
  29017. "afii10029",
  29018. 0x041b,
  29019. "afii10030",
  29020. 0x041c,
  29021. "afii10031",
  29022. 0x041d,
  29023. "afii10032",
  29024. 0x041e,
  29025. "afii10033",
  29026. 0x041f,
  29027. "afii10034",
  29028. 0x0420,
  29029. "afii10035",
  29030. 0x0421,
  29031. "afii10036",
  29032. 0x0422,
  29033. "afii10037",
  29034. 0x0423,
  29035. "afii10038",
  29036. 0x0424,
  29037. "afii10039",
  29038. 0x0425,
  29039. "afii10040",
  29040. 0x0426,
  29041. "afii10041",
  29042. 0x0427,
  29043. "afii10042",
  29044. 0x0428,
  29045. "afii10043",
  29046. 0x0429,
  29047. "afii10044",
  29048. 0x042a,
  29049. "afii10045",
  29050. 0x042b,
  29051. "afii10046",
  29052. 0x042c,
  29053. "afii10047",
  29054. 0x042d,
  29055. "afii10048",
  29056. 0x042e,
  29057. "afii10049",
  29058. 0x042f,
  29059. "afii10050",
  29060. 0x0490,
  29061. "afii10051",
  29062. 0x0402,
  29063. "afii10052",
  29064. 0x0403,
  29065. "afii10053",
  29066. 0x0404,
  29067. "afii10054",
  29068. 0x0405,
  29069. "afii10055",
  29070. 0x0406,
  29071. "afii10056",
  29072. 0x0407,
  29073. "afii10057",
  29074. 0x0408,
  29075. "afii10058",
  29076. 0x0409,
  29077. "afii10059",
  29078. 0x040a,
  29079. "afii10060",
  29080. 0x040b,
  29081. "afii10061",
  29082. 0x040c,
  29083. "afii10062",
  29084. 0x040e,
  29085. "afii10063",
  29086. 0xf6c4,
  29087. "afii10064",
  29088. 0xf6c5,
  29089. "afii10065",
  29090. 0x0430,
  29091. "afii10066",
  29092. 0x0431,
  29093. "afii10067",
  29094. 0x0432,
  29095. "afii10068",
  29096. 0x0433,
  29097. "afii10069",
  29098. 0x0434,
  29099. "afii10070",
  29100. 0x0435,
  29101. "afii10071",
  29102. 0x0451,
  29103. "afii10072",
  29104. 0x0436,
  29105. "afii10073",
  29106. 0x0437,
  29107. "afii10074",
  29108. 0x0438,
  29109. "afii10075",
  29110. 0x0439,
  29111. "afii10076",
  29112. 0x043a,
  29113. "afii10077",
  29114. 0x043b,
  29115. "afii10078",
  29116. 0x043c,
  29117. "afii10079",
  29118. 0x043d,
  29119. "afii10080",
  29120. 0x043e,
  29121. "afii10081",
  29122. 0x043f,
  29123. "afii10082",
  29124. 0x0440,
  29125. "afii10083",
  29126. 0x0441,
  29127. "afii10084",
  29128. 0x0442,
  29129. "afii10085",
  29130. 0x0443,
  29131. "afii10086",
  29132. 0x0444,
  29133. "afii10087",
  29134. 0x0445,
  29135. "afii10088",
  29136. 0x0446,
  29137. "afii10089",
  29138. 0x0447,
  29139. "afii10090",
  29140. 0x0448,
  29141. "afii10091",
  29142. 0x0449,
  29143. "afii10092",
  29144. 0x044a,
  29145. "afii10093",
  29146. 0x044b,
  29147. "afii10094",
  29148. 0x044c,
  29149. "afii10095",
  29150. 0x044d,
  29151. "afii10096",
  29152. 0x044e,
  29153. "afii10097",
  29154. 0x044f,
  29155. "afii10098",
  29156. 0x0491,
  29157. "afii10099",
  29158. 0x0452,
  29159. "afii10100",
  29160. 0x0453,
  29161. "afii10101",
  29162. 0x0454,
  29163. "afii10102",
  29164. 0x0455,
  29165. "afii10103",
  29166. 0x0456,
  29167. "afii10104",
  29168. 0x0457,
  29169. "afii10105",
  29170. 0x0458,
  29171. "afii10106",
  29172. 0x0459,
  29173. "afii10107",
  29174. 0x045a,
  29175. "afii10108",
  29176. 0x045b,
  29177. "afii10109",
  29178. 0x045c,
  29179. "afii10110",
  29180. 0x045e,
  29181. "afii10145",
  29182. 0x040f,
  29183. "afii10146",
  29184. 0x0462,
  29185. "afii10147",
  29186. 0x0472,
  29187. "afii10148",
  29188. 0x0474,
  29189. "afii10192",
  29190. 0xf6c6,
  29191. "afii10193",
  29192. 0x045f,
  29193. "afii10194",
  29194. 0x0463,
  29195. "afii10195",
  29196. 0x0473,
  29197. "afii10196",
  29198. 0x0475,
  29199. "afii10831",
  29200. 0xf6c7,
  29201. "afii10832",
  29202. 0xf6c8,
  29203. "afii10846",
  29204. 0x04d9,
  29205. "afii299",
  29206. 0x200e,
  29207. "afii300",
  29208. 0x200f,
  29209. "afii301",
  29210. 0x200d,
  29211. "afii57381",
  29212. 0x066a,
  29213. "afii57388",
  29214. 0x060c,
  29215. "afii57392",
  29216. 0x0660,
  29217. "afii57393",
  29218. 0x0661,
  29219. "afii57394",
  29220. 0x0662,
  29221. "afii57395",
  29222. 0x0663,
  29223. "afii57396",
  29224. 0x0664,
  29225. "afii57397",
  29226. 0x0665,
  29227. "afii57398",
  29228. 0x0666,
  29229. "afii57399",
  29230. 0x0667,
  29231. "afii57400",
  29232. 0x0668,
  29233. "afii57401",
  29234. 0x0669,
  29235. "afii57403",
  29236. 0x061b,
  29237. "afii57407",
  29238. 0x061f,
  29239. "afii57409",
  29240. 0x0621,
  29241. "afii57410",
  29242. 0x0622,
  29243. "afii57411",
  29244. 0x0623,
  29245. "afii57412",
  29246. 0x0624,
  29247. "afii57413",
  29248. 0x0625,
  29249. "afii57414",
  29250. 0x0626,
  29251. "afii57415",
  29252. 0x0627,
  29253. "afii57416",
  29254. 0x0628,
  29255. "afii57417",
  29256. 0x0629,
  29257. "afii57418",
  29258. 0x062a,
  29259. "afii57419",
  29260. 0x062b,
  29261. "afii57420",
  29262. 0x062c,
  29263. "afii57421",
  29264. 0x062d,
  29265. "afii57422",
  29266. 0x062e,
  29267. "afii57423",
  29268. 0x062f,
  29269. "afii57424",
  29270. 0x0630,
  29271. "afii57425",
  29272. 0x0631,
  29273. "afii57426",
  29274. 0x0632,
  29275. "afii57427",
  29276. 0x0633,
  29277. "afii57428",
  29278. 0x0634,
  29279. "afii57429",
  29280. 0x0635,
  29281. "afii57430",
  29282. 0x0636,
  29283. "afii57431",
  29284. 0x0637,
  29285. "afii57432",
  29286. 0x0638,
  29287. "afii57433",
  29288. 0x0639,
  29289. "afii57434",
  29290. 0x063a,
  29291. "afii57440",
  29292. 0x0640,
  29293. "afii57441",
  29294. 0x0641,
  29295. "afii57442",
  29296. 0x0642,
  29297. "afii57443",
  29298. 0x0643,
  29299. "afii57444",
  29300. 0x0644,
  29301. "afii57445",
  29302. 0x0645,
  29303. "afii57446",
  29304. 0x0646,
  29305. "afii57448",
  29306. 0x0648,
  29307. "afii57449",
  29308. 0x0649,
  29309. "afii57450",
  29310. 0x064a,
  29311. "afii57451",
  29312. 0x064b,
  29313. "afii57452",
  29314. 0x064c,
  29315. "afii57453",
  29316. 0x064d,
  29317. "afii57454",
  29318. 0x064e,
  29319. "afii57455",
  29320. 0x064f,
  29321. "afii57456",
  29322. 0x0650,
  29323. "afii57457",
  29324. 0x0651,
  29325. "afii57458",
  29326. 0x0652,
  29327. "afii57470",
  29328. 0x0647,
  29329. "afii57505",
  29330. 0x06a4,
  29331. "afii57506",
  29332. 0x067e,
  29333. "afii57507",
  29334. 0x0686,
  29335. "afii57508",
  29336. 0x0698,
  29337. "afii57509",
  29338. 0x06af,
  29339. "afii57511",
  29340. 0x0679,
  29341. "afii57512",
  29342. 0x0688,
  29343. "afii57513",
  29344. 0x0691,
  29345. "afii57514",
  29346. 0x06ba,
  29347. "afii57519",
  29348. 0x06d2,
  29349. "afii57534",
  29350. 0x06d5,
  29351. "afii57636",
  29352. 0x20aa,
  29353. "afii57645",
  29354. 0x05be,
  29355. "afii57658",
  29356. 0x05c3,
  29357. "afii57664",
  29358. 0x05d0,
  29359. "afii57665",
  29360. 0x05d1,
  29361. "afii57666",
  29362. 0x05d2,
  29363. "afii57667",
  29364. 0x05d3,
  29365. "afii57668",
  29366. 0x05d4,
  29367. "afii57669",
  29368. 0x05d5,
  29369. "afii57670",
  29370. 0x05d6,
  29371. "afii57671",
  29372. 0x05d7,
  29373. "afii57672",
  29374. 0x05d8,
  29375. "afii57673",
  29376. 0x05d9,
  29377. "afii57674",
  29378. 0x05da,
  29379. "afii57675",
  29380. 0x05db,
  29381. "afii57676",
  29382. 0x05dc,
  29383. "afii57677",
  29384. 0x05dd,
  29385. "afii57678",
  29386. 0x05de,
  29387. "afii57679",
  29388. 0x05df,
  29389. "afii57680",
  29390. 0x05e0,
  29391. "afii57681",
  29392. 0x05e1,
  29393. "afii57682",
  29394. 0x05e2,
  29395. "afii57683",
  29396. 0x05e3,
  29397. "afii57684",
  29398. 0x05e4,
  29399. "afii57685",
  29400. 0x05e5,
  29401. "afii57686",
  29402. 0x05e6,
  29403. "afii57687",
  29404. 0x05e7,
  29405. "afii57688",
  29406. 0x05e8,
  29407. "afii57689",
  29408. 0x05e9,
  29409. "afii57690",
  29410. 0x05ea,
  29411. "afii57694",
  29412. 0xfb2a,
  29413. "afii57695",
  29414. 0xfb2b,
  29415. "afii57700",
  29416. 0xfb4b,
  29417. "afii57705",
  29418. 0xfb1f,
  29419. "afii57716",
  29420. 0x05f0,
  29421. "afii57717",
  29422. 0x05f1,
  29423. "afii57718",
  29424. 0x05f2,
  29425. "afii57723",
  29426. 0xfb35,
  29427. "afii57793",
  29428. 0x05b4,
  29429. "afii57794",
  29430. 0x05b5,
  29431. "afii57795",
  29432. 0x05b6,
  29433. "afii57796",
  29434. 0x05bb,
  29435. "afii57797",
  29436. 0x05b8,
  29437. "afii57798",
  29438. 0x05b7,
  29439. "afii57799",
  29440. 0x05b0,
  29441. "afii57800",
  29442. 0x05b2,
  29443. "afii57801",
  29444. 0x05b1,
  29445. "afii57802",
  29446. 0x05b3,
  29447. "afii57803",
  29448. 0x05c2,
  29449. "afii57804",
  29450. 0x05c1,
  29451. "afii57806",
  29452. 0x05b9,
  29453. "afii57807",
  29454. 0x05bc,
  29455. "afii57839",
  29456. 0x05bd,
  29457. "afii57841",
  29458. 0x05bf,
  29459. "afii57842",
  29460. 0x05c0,
  29461. "afii57929",
  29462. 0x02bc,
  29463. "afii61248",
  29464. 0x2105,
  29465. "afii61289",
  29466. 0x2113,
  29467. "afii61352",
  29468. 0x2116,
  29469. "afii61573",
  29470. 0x202c,
  29471. "afii61574",
  29472. 0x202d,
  29473. "afii61575",
  29474. 0x202e,
  29475. "afii61664",
  29476. 0x200c,
  29477. "afii63167",
  29478. 0x066d,
  29479. "afii64937",
  29480. 0x02bd,
  29481. "agrave",
  29482. 0x00e0,
  29483. "agujarati",
  29484. 0x0a85,
  29485. "agurmukhi",
  29486. 0x0a05,
  29487. "ahiragana",
  29488. 0x3042,
  29489. "ahookabove",
  29490. 0x1ea3,
  29491. "aibengali",
  29492. 0x0990,
  29493. "aibopomofo",
  29494. 0x311e,
  29495. "aideva",
  29496. 0x0910,
  29497. "aiecyrillic",
  29498. 0x04d5,
  29499. "aigujarati",
  29500. 0x0a90,
  29501. "aigurmukhi",
  29502. 0x0a10,
  29503. "aimatragurmukhi",
  29504. 0x0a48,
  29505. "ainarabic",
  29506. 0x0639,
  29507. "ainfinalarabic",
  29508. 0xfeca,
  29509. "aininitialarabic",
  29510. 0xfecb,
  29511. "ainmedialarabic",
  29512. 0xfecc,
  29513. "ainvertedbreve",
  29514. 0x0203,
  29515. "aivowelsignbengali",
  29516. 0x09c8,
  29517. "aivowelsigndeva",
  29518. 0x0948,
  29519. "aivowelsigngujarati",
  29520. 0x0ac8,
  29521. "akatakana",
  29522. 0x30a2,
  29523. "akatakanahalfwidth",
  29524. 0xff71,
  29525. "akorean",
  29526. 0x314f,
  29527. "alef",
  29528. 0x05d0,
  29529. "alefarabic",
  29530. 0x0627,
  29531. "alefdageshhebrew",
  29532. 0xfb30,
  29533. "aleffinalarabic",
  29534. 0xfe8e,
  29535. "alefhamzaabovearabic",
  29536. 0x0623,
  29537. "alefhamzaabovefinalarabic",
  29538. 0xfe84,
  29539. "alefhamzabelowarabic",
  29540. 0x0625,
  29541. "alefhamzabelowfinalarabic",
  29542. 0xfe88,
  29543. "alefhebrew",
  29544. 0x05d0,
  29545. "aleflamedhebrew",
  29546. 0xfb4f,
  29547. "alefmaddaabovearabic",
  29548. 0x0622,
  29549. "alefmaddaabovefinalarabic",
  29550. 0xfe82,
  29551. "alefmaksuraarabic",
  29552. 0x0649,
  29553. "alefmaksurafinalarabic",
  29554. 0xfef0,
  29555. "alefmaksurainitialarabic",
  29556. 0xfef3,
  29557. "alefmaksuramedialarabic",
  29558. 0xfef4,
  29559. "alefpatahhebrew",
  29560. 0xfb2e,
  29561. "alefqamatshebrew",
  29562. 0xfb2f,
  29563. "aleph",
  29564. 0x2135,
  29565. "allequal",
  29566. 0x224c,
  29567. "alpha",
  29568. 0x03b1,
  29569. "alphatonos",
  29570. 0x03ac,
  29571. "amacron",
  29572. 0x0101,
  29573. "amonospace",
  29574. 0xff41,
  29575. "ampersand",
  29576. 0x0026,
  29577. "ampersandmonospace",
  29578. 0xff06,
  29579. "ampersandsmall",
  29580. 0xf726,
  29581. "amsquare",
  29582. 0x33c2,
  29583. "anbopomofo",
  29584. 0x3122,
  29585. "angbopomofo",
  29586. 0x3124,
  29587. "angbracketleft",
  29588. 0x3008,
  29589. "angbracketright",
  29590. 0x3009,
  29591. "angkhankhuthai",
  29592. 0x0e5a,
  29593. "angle",
  29594. 0x2220,
  29595. "anglebracketleft",
  29596. 0x3008,
  29597. "anglebracketleftvertical",
  29598. 0xfe3f,
  29599. "anglebracketright",
  29600. 0x3009,
  29601. "anglebracketrightvertical",
  29602. 0xfe40,
  29603. "angleleft",
  29604. 0x2329,
  29605. "angleright",
  29606. 0x232a,
  29607. "angstrom",
  29608. 0x212b,
  29609. "anoteleia",
  29610. 0x0387,
  29611. "anudattadeva",
  29612. 0x0952,
  29613. "anusvarabengali",
  29614. 0x0982,
  29615. "anusvaradeva",
  29616. 0x0902,
  29617. "anusvaragujarati",
  29618. 0x0a82,
  29619. "aogonek",
  29620. 0x0105,
  29621. "apaatosquare",
  29622. 0x3300,
  29623. "aparen",
  29624. 0x249c,
  29625. "apostrophearmenian",
  29626. 0x055a,
  29627. "apostrophemod",
  29628. 0x02bc,
  29629. "apple",
  29630. 0xf8ff,
  29631. "approaches",
  29632. 0x2250,
  29633. "approxequal",
  29634. 0x2248,
  29635. "approxequalorimage",
  29636. 0x2252,
  29637. "approximatelyequal",
  29638. 0x2245,
  29639. "araeaekorean",
  29640. 0x318e,
  29641. "araeakorean",
  29642. 0x318d,
  29643. "arc",
  29644. 0x2312,
  29645. "arighthalfring",
  29646. 0x1e9a,
  29647. "aring",
  29648. 0x00e5,
  29649. "aringacute",
  29650. 0x01fb,
  29651. "aringbelow",
  29652. 0x1e01,
  29653. "arrowboth",
  29654. 0x2194,
  29655. "arrowdashdown",
  29656. 0x21e3,
  29657. "arrowdashleft",
  29658. 0x21e0,
  29659. "arrowdashright",
  29660. 0x21e2,
  29661. "arrowdashup",
  29662. 0x21e1,
  29663. "arrowdblboth",
  29664. 0x21d4,
  29665. "arrowdbldown",
  29666. 0x21d3,
  29667. "arrowdblleft",
  29668. 0x21d0,
  29669. "arrowdblright",
  29670. 0x21d2,
  29671. "arrowdblup",
  29672. 0x21d1,
  29673. "arrowdown",
  29674. 0x2193,
  29675. "arrowdownleft",
  29676. 0x2199,
  29677. "arrowdownright",
  29678. 0x2198,
  29679. "arrowdownwhite",
  29680. 0x21e9,
  29681. "arrowheaddownmod",
  29682. 0x02c5,
  29683. "arrowheadleftmod",
  29684. 0x02c2,
  29685. "arrowheadrightmod",
  29686. 0x02c3,
  29687. "arrowheadupmod",
  29688. 0x02c4,
  29689. "arrowhorizex",
  29690. 0xf8e7,
  29691. "arrowleft",
  29692. 0x2190,
  29693. "arrowleftdbl",
  29694. 0x21d0,
  29695. "arrowleftdblstroke",
  29696. 0x21cd,
  29697. "arrowleftoverright",
  29698. 0x21c6,
  29699. "arrowleftwhite",
  29700. 0x21e6,
  29701. "arrowright",
  29702. 0x2192,
  29703. "arrowrightdblstroke",
  29704. 0x21cf,
  29705. "arrowrightheavy",
  29706. 0x279e,
  29707. "arrowrightoverleft",
  29708. 0x21c4,
  29709. "arrowrightwhite",
  29710. 0x21e8,
  29711. "arrowtableft",
  29712. 0x21e4,
  29713. "arrowtabright",
  29714. 0x21e5,
  29715. "arrowup",
  29716. 0x2191,
  29717. "arrowupdn",
  29718. 0x2195,
  29719. "arrowupdnbse",
  29720. 0x21a8,
  29721. "arrowupdownbase",
  29722. 0x21a8,
  29723. "arrowupleft",
  29724. 0x2196,
  29725. "arrowupleftofdown",
  29726. 0x21c5,
  29727. "arrowupright",
  29728. 0x2197,
  29729. "arrowupwhite",
  29730. 0x21e7,
  29731. "arrowvertex",
  29732. 0xf8e6,
  29733. "asciicircum",
  29734. 0x005e,
  29735. "asciicircummonospace",
  29736. 0xff3e,
  29737. "asciitilde",
  29738. 0x007e,
  29739. "asciitildemonospace",
  29740. 0xff5e,
  29741. "ascript",
  29742. 0x0251,
  29743. "ascriptturned",
  29744. 0x0252,
  29745. "asmallhiragana",
  29746. 0x3041,
  29747. "asmallkatakana",
  29748. 0x30a1,
  29749. "asmallkatakanahalfwidth",
  29750. 0xff67,
  29751. "asterisk",
  29752. 0x002a,
  29753. "asteriskaltonearabic",
  29754. 0x066d,
  29755. "asteriskarabic",
  29756. 0x066d,
  29757. "asteriskmath",
  29758. 0x2217,
  29759. "asteriskmonospace",
  29760. 0xff0a,
  29761. "asterisksmall",
  29762. 0xfe61,
  29763. "asterism",
  29764. 0x2042,
  29765. "asuperior",
  29766. 0xf6e9,
  29767. "asymptoticallyequal",
  29768. 0x2243,
  29769. "at",
  29770. 0x0040,
  29771. "atilde",
  29772. 0x00e3,
  29773. "atmonospace",
  29774. 0xff20,
  29775. "atsmall",
  29776. 0xfe6b,
  29777. "aturned",
  29778. 0x0250,
  29779. "aubengali",
  29780. 0x0994,
  29781. "aubopomofo",
  29782. 0x3120,
  29783. "audeva",
  29784. 0x0914,
  29785. "augujarati",
  29786. 0x0a94,
  29787. "augurmukhi",
  29788. 0x0a14,
  29789. "aulengthmarkbengali",
  29790. 0x09d7,
  29791. "aumatragurmukhi",
  29792. 0x0a4c,
  29793. "auvowelsignbengali",
  29794. 0x09cc,
  29795. "auvowelsigndeva",
  29796. 0x094c,
  29797. "auvowelsigngujarati",
  29798. 0x0acc,
  29799. "avagrahadeva",
  29800. 0x093d,
  29801. "aybarmenian",
  29802. 0x0561,
  29803. "ayin",
  29804. 0x05e2,
  29805. "ayinaltonehebrew",
  29806. 0xfb20,
  29807. "ayinhebrew",
  29808. 0x05e2,
  29809. "b",
  29810. 0x0062,
  29811. "babengali",
  29812. 0x09ac,
  29813. "backslash",
  29814. 0x005c,
  29815. "backslashmonospace",
  29816. 0xff3c,
  29817. "badeva",
  29818. 0x092c,
  29819. "bagujarati",
  29820. 0x0aac,
  29821. "bagurmukhi",
  29822. 0x0a2c,
  29823. "bahiragana",
  29824. 0x3070,
  29825. "bahtthai",
  29826. 0x0e3f,
  29827. "bakatakana",
  29828. 0x30d0,
  29829. "bar",
  29830. 0x007c,
  29831. "barmonospace",
  29832. 0xff5c,
  29833. "bbopomofo",
  29834. 0x3105,
  29835. "bcircle",
  29836. 0x24d1,
  29837. "bdotaccent",
  29838. 0x1e03,
  29839. "bdotbelow",
  29840. 0x1e05,
  29841. "beamedsixteenthnotes",
  29842. 0x266c,
  29843. "because",
  29844. 0x2235,
  29845. "becyrillic",
  29846. 0x0431,
  29847. "beharabic",
  29848. 0x0628,
  29849. "behfinalarabic",
  29850. 0xfe90,
  29851. "behinitialarabic",
  29852. 0xfe91,
  29853. "behiragana",
  29854. 0x3079,
  29855. "behmedialarabic",
  29856. 0xfe92,
  29857. "behmeeminitialarabic",
  29858. 0xfc9f,
  29859. "behmeemisolatedarabic",
  29860. 0xfc08,
  29861. "behnoonfinalarabic",
  29862. 0xfc6d,
  29863. "bekatakana",
  29864. 0x30d9,
  29865. "benarmenian",
  29866. 0x0562,
  29867. "bet",
  29868. 0x05d1,
  29869. "beta",
  29870. 0x03b2,
  29871. "betasymbolgreek",
  29872. 0x03d0,
  29873. "betdagesh",
  29874. 0xfb31,
  29875. "betdageshhebrew",
  29876. 0xfb31,
  29877. "bethebrew",
  29878. 0x05d1,
  29879. "betrafehebrew",
  29880. 0xfb4c,
  29881. "bhabengali",
  29882. 0x09ad,
  29883. "bhadeva",
  29884. 0x092d,
  29885. "bhagujarati",
  29886. 0x0aad,
  29887. "bhagurmukhi",
  29888. 0x0a2d,
  29889. "bhook",
  29890. 0x0253,
  29891. "bihiragana",
  29892. 0x3073,
  29893. "bikatakana",
  29894. 0x30d3,
  29895. "bilabialclick",
  29896. 0x0298,
  29897. "bindigurmukhi",
  29898. 0x0a02,
  29899. "birusquare",
  29900. 0x3331,
  29901. "blackcircle",
  29902. 0x25cf,
  29903. "blackdiamond",
  29904. 0x25c6,
  29905. "blackdownpointingtriangle",
  29906. 0x25bc,
  29907. "blackleftpointingpointer",
  29908. 0x25c4,
  29909. "blackleftpointingtriangle",
  29910. 0x25c0,
  29911. "blacklenticularbracketleft",
  29912. 0x3010,
  29913. "blacklenticularbracketleftvertical",
  29914. 0xfe3b,
  29915. "blacklenticularbracketright",
  29916. 0x3011,
  29917. "blacklenticularbracketrightvertical",
  29918. 0xfe3c,
  29919. "blacklowerlefttriangle",
  29920. 0x25e3,
  29921. "blacklowerrighttriangle",
  29922. 0x25e2,
  29923. "blackrectangle",
  29924. 0x25ac,
  29925. "blackrightpointingpointer",
  29926. 0x25ba,
  29927. "blackrightpointingtriangle",
  29928. 0x25b6,
  29929. "blacksmallsquare",
  29930. 0x25aa,
  29931. "blacksmilingface",
  29932. 0x263b,
  29933. "blacksquare",
  29934. 0x25a0,
  29935. "blackstar",
  29936. 0x2605,
  29937. "blackupperlefttriangle",
  29938. 0x25e4,
  29939. "blackupperrighttriangle",
  29940. 0x25e5,
  29941. "blackuppointingsmalltriangle",
  29942. 0x25b4,
  29943. "blackuppointingtriangle",
  29944. 0x25b2,
  29945. "blank",
  29946. 0x2423,
  29947. "blinebelow",
  29948. 0x1e07,
  29949. "block",
  29950. 0x2588,
  29951. "bmonospace",
  29952. 0xff42,
  29953. "bobaimaithai",
  29954. 0x0e1a,
  29955. "bohiragana",
  29956. 0x307c,
  29957. "bokatakana",
  29958. 0x30dc,
  29959. "bparen",
  29960. 0x249d,
  29961. "bqsquare",
  29962. 0x33c3,
  29963. "braceex",
  29964. 0xf8f4,
  29965. "braceleft",
  29966. 0x007b,
  29967. "braceleftbt",
  29968. 0xf8f3,
  29969. "braceleftmid",
  29970. 0xf8f2,
  29971. "braceleftmonospace",
  29972. 0xff5b,
  29973. "braceleftsmall",
  29974. 0xfe5b,
  29975. "bracelefttp",
  29976. 0xf8f1,
  29977. "braceleftvertical",
  29978. 0xfe37,
  29979. "braceright",
  29980. 0x007d,
  29981. "bracerightbt",
  29982. 0xf8fe,
  29983. "bracerightmid",
  29984. 0xf8fd,
  29985. "bracerightmonospace",
  29986. 0xff5d,
  29987. "bracerightsmall",
  29988. 0xfe5c,
  29989. "bracerighttp",
  29990. 0xf8fc,
  29991. "bracerightvertical",
  29992. 0xfe38,
  29993. "bracketleft",
  29994. 0x005b,
  29995. "bracketleftbt",
  29996. 0xf8f0,
  29997. "bracketleftex",
  29998. 0xf8ef,
  29999. "bracketleftmonospace",
  30000. 0xff3b,
  30001. "bracketlefttp",
  30002. 0xf8ee,
  30003. "bracketright",
  30004. 0x005d,
  30005. "bracketrightbt",
  30006. 0xf8fb,
  30007. "bracketrightex",
  30008. 0xf8fa,
  30009. "bracketrightmonospace",
  30010. 0xff3d,
  30011. "bracketrighttp",
  30012. 0xf8f9,
  30013. "breve",
  30014. 0x02d8,
  30015. "brevebelowcmb",
  30016. 0x032e,
  30017. "brevecmb",
  30018. 0x0306,
  30019. "breveinvertedbelowcmb",
  30020. 0x032f,
  30021. "breveinvertedcmb",
  30022. 0x0311,
  30023. "breveinverteddoublecmb",
  30024. 0x0361,
  30025. "bridgebelowcmb",
  30026. 0x032a,
  30027. "bridgeinvertedbelowcmb",
  30028. 0x033a,
  30029. "brokenbar",
  30030. 0x00a6,
  30031. "bstroke",
  30032. 0x0180,
  30033. "bsuperior",
  30034. 0xf6ea,
  30035. "btopbar",
  30036. 0x0183,
  30037. "buhiragana",
  30038. 0x3076,
  30039. "bukatakana",
  30040. 0x30d6,
  30041. "bullet",
  30042. 0x2022,
  30043. "bulletinverse",
  30044. 0x25d8,
  30045. "bulletoperator",
  30046. 0x2219,
  30047. "bullseye",
  30048. 0x25ce,
  30049. "c",
  30050. 0x0063,
  30051. "caarmenian",
  30052. 0x056e,
  30053. "cabengali",
  30054. 0x099a,
  30055. "cacute",
  30056. 0x0107,
  30057. "cadeva",
  30058. 0x091a,
  30059. "cagujarati",
  30060. 0x0a9a,
  30061. "cagurmukhi",
  30062. 0x0a1a,
  30063. "calsquare",
  30064. 0x3388,
  30065. "candrabindubengali",
  30066. 0x0981,
  30067. "candrabinducmb",
  30068. 0x0310,
  30069. "candrabindudeva",
  30070. 0x0901,
  30071. "candrabindugujarati",
  30072. 0x0a81,
  30073. "capslock",
  30074. 0x21ea,
  30075. "careof",
  30076. 0x2105,
  30077. "caron",
  30078. 0x02c7,
  30079. "caronbelowcmb",
  30080. 0x032c,
  30081. "caroncmb",
  30082. 0x030c,
  30083. "carriagereturn",
  30084. 0x21b5,
  30085. "cbopomofo",
  30086. 0x3118,
  30087. "ccaron",
  30088. 0x010d,
  30089. "ccedilla",
  30090. 0x00e7,
  30091. "ccedillaacute",
  30092. 0x1e09,
  30093. "ccircle",
  30094. 0x24d2,
  30095. "ccircumflex",
  30096. 0x0109,
  30097. "ccurl",
  30098. 0x0255,
  30099. "cdot",
  30100. 0x010b,
  30101. "cdotaccent",
  30102. 0x010b,
  30103. "cdsquare",
  30104. 0x33c5,
  30105. "cedilla",
  30106. 0x00b8,
  30107. "cedillacmb",
  30108. 0x0327,
  30109. "cent",
  30110. 0x00a2,
  30111. "centigrade",
  30112. 0x2103,
  30113. "centinferior",
  30114. 0xf6df,
  30115. "centmonospace",
  30116. 0xffe0,
  30117. "centoldstyle",
  30118. 0xf7a2,
  30119. "centsuperior",
  30120. 0xf6e0,
  30121. "chaarmenian",
  30122. 0x0579,
  30123. "chabengali",
  30124. 0x099b,
  30125. "chadeva",
  30126. 0x091b,
  30127. "chagujarati",
  30128. 0x0a9b,
  30129. "chagurmukhi",
  30130. 0x0a1b,
  30131. "chbopomofo",
  30132. 0x3114,
  30133. "cheabkhasiancyrillic",
  30134. 0x04bd,
  30135. "checkmark",
  30136. 0x2713,
  30137. "checyrillic",
  30138. 0x0447,
  30139. "chedescenderabkhasiancyrillic",
  30140. 0x04bf,
  30141. "chedescendercyrillic",
  30142. 0x04b7,
  30143. "chedieresiscyrillic",
  30144. 0x04f5,
  30145. "cheharmenian",
  30146. 0x0573,
  30147. "chekhakassiancyrillic",
  30148. 0x04cc,
  30149. "cheverticalstrokecyrillic",
  30150. 0x04b9,
  30151. "chi",
  30152. 0x03c7,
  30153. "chieuchacirclekorean",
  30154. 0x3277,
  30155. "chieuchaparenkorean",
  30156. 0x3217,
  30157. "chieuchcirclekorean",
  30158. 0x3269,
  30159. "chieuchkorean",
  30160. 0x314a,
  30161. "chieuchparenkorean",
  30162. 0x3209,
  30163. "chochangthai",
  30164. 0x0e0a,
  30165. "chochanthai",
  30166. 0x0e08,
  30167. "chochingthai",
  30168. 0x0e09,
  30169. "chochoethai",
  30170. 0x0e0c,
  30171. "chook",
  30172. 0x0188,
  30173. "cieucacirclekorean",
  30174. 0x3276,
  30175. "cieucaparenkorean",
  30176. 0x3216,
  30177. "cieuccirclekorean",
  30178. 0x3268,
  30179. "cieuckorean",
  30180. 0x3148,
  30181. "cieucparenkorean",
  30182. 0x3208,
  30183. "cieucuparenkorean",
  30184. 0x321c,
  30185. "circle",
  30186. 0x25cb,
  30187. "circlecopyrt",
  30188. 0x00a9,
  30189. "circlemultiply",
  30190. 0x2297,
  30191. "circleot",
  30192. 0x2299,
  30193. "circleplus",
  30194. 0x2295,
  30195. "circlepostalmark",
  30196. 0x3036,
  30197. "circlewithlefthalfblack",
  30198. 0x25d0,
  30199. "circlewithrighthalfblack",
  30200. 0x25d1,
  30201. "circumflex",
  30202. 0x02c6,
  30203. "circumflexbelowcmb",
  30204. 0x032d,
  30205. "circumflexcmb",
  30206. 0x0302,
  30207. "clear",
  30208. 0x2327,
  30209. "clickalveolar",
  30210. 0x01c2,
  30211. "clickdental",
  30212. 0x01c0,
  30213. "clicklateral",
  30214. 0x01c1,
  30215. "clickretroflex",
  30216. 0x01c3,
  30217. "club",
  30218. 0x2663,
  30219. "clubsuitblack",
  30220. 0x2663,
  30221. "clubsuitwhite",
  30222. 0x2667,
  30223. "cmcubedsquare",
  30224. 0x33a4,
  30225. "cmonospace",
  30226. 0xff43,
  30227. "cmsquaredsquare",
  30228. 0x33a0,
  30229. "coarmenian",
  30230. 0x0581,
  30231. "colon",
  30232. 0x003a,
  30233. "colonmonetary",
  30234. 0x20a1,
  30235. "colonmonospace",
  30236. 0xff1a,
  30237. "colonsign",
  30238. 0x20a1,
  30239. "colonsmall",
  30240. 0xfe55,
  30241. "colontriangularhalfmod",
  30242. 0x02d1,
  30243. "colontriangularmod",
  30244. 0x02d0,
  30245. "comma",
  30246. 0x002c,
  30247. "commaabovecmb",
  30248. 0x0313,
  30249. "commaaboverightcmb",
  30250. 0x0315,
  30251. "commaaccent",
  30252. 0xf6c3,
  30253. "commaarabic",
  30254. 0x060c,
  30255. "commaarmenian",
  30256. 0x055d,
  30257. "commainferior",
  30258. 0xf6e1,
  30259. "commamonospace",
  30260. 0xff0c,
  30261. "commareversedabovecmb",
  30262. 0x0314,
  30263. "commareversedmod",
  30264. 0x02bd,
  30265. "commasmall",
  30266. 0xfe50,
  30267. "commasuperior",
  30268. 0xf6e2,
  30269. "commaturnedabovecmb",
  30270. 0x0312,
  30271. "commaturnedmod",
  30272. 0x02bb,
  30273. "compass",
  30274. 0x263c,
  30275. "congruent",
  30276. 0x2245,
  30277. "contourintegral",
  30278. 0x222e,
  30279. "control",
  30280. 0x2303,
  30281. "controlACK",
  30282. 0x0006,
  30283. "controlBEL",
  30284. 0x0007,
  30285. "controlBS",
  30286. 0x0008,
  30287. "controlCAN",
  30288. 0x0018,
  30289. "controlCR",
  30290. 0x000d,
  30291. "controlDC1",
  30292. 0x0011,
  30293. "controlDC2",
  30294. 0x0012,
  30295. "controlDC3",
  30296. 0x0013,
  30297. "controlDC4",
  30298. 0x0014,
  30299. "controlDEL",
  30300. 0x007f,
  30301. "controlDLE",
  30302. 0x0010,
  30303. "controlEM",
  30304. 0x0019,
  30305. "controlENQ",
  30306. 0x0005,
  30307. "controlEOT",
  30308. 0x0004,
  30309. "controlESC",
  30310. 0x001b,
  30311. "controlETB",
  30312. 0x0017,
  30313. "controlETX",
  30314. 0x0003,
  30315. "controlFF",
  30316. 0x000c,
  30317. "controlFS",
  30318. 0x001c,
  30319. "controlGS",
  30320. 0x001d,
  30321. "controlHT",
  30322. 0x0009,
  30323. "controlLF",
  30324. 0x000a,
  30325. "controlNAK",
  30326. 0x0015,
  30327. "controlNULL",
  30328. 0x0000,
  30329. "controlRS",
  30330. 0x001e,
  30331. "controlSI",
  30332. 0x000f,
  30333. "controlSO",
  30334. 0x000e,
  30335. "controlSOT",
  30336. 0x0002,
  30337. "controlSTX",
  30338. 0x0001,
  30339. "controlSUB",
  30340. 0x001a,
  30341. "controlSYN",
  30342. 0x0016,
  30343. "controlUS",
  30344. 0x001f,
  30345. "controlVT",
  30346. 0x000b,
  30347. "copyright",
  30348. 0x00a9,
  30349. "copyrightsans",
  30350. 0xf8e9,
  30351. "copyrightserif",
  30352. 0xf6d9,
  30353. "cornerbracketleft",
  30354. 0x300c,
  30355. "cornerbracketlefthalfwidth",
  30356. 0xff62,
  30357. "cornerbracketleftvertical",
  30358. 0xfe41,
  30359. "cornerbracketright",
  30360. 0x300d,
  30361. "cornerbracketrighthalfwidth",
  30362. 0xff63,
  30363. "cornerbracketrightvertical",
  30364. 0xfe42,
  30365. "corporationsquare",
  30366. 0x337f,
  30367. "cosquare",
  30368. 0x33c7,
  30369. "coverkgsquare",
  30370. 0x33c6,
  30371. "cparen",
  30372. 0x249e,
  30373. "cruzeiro",
  30374. 0x20a2,
  30375. "cstretched",
  30376. 0x0297,
  30377. "curlyand",
  30378. 0x22cf,
  30379. "curlyor",
  30380. 0x22ce,
  30381. "currency",
  30382. 0x00a4,
  30383. "cyrBreve",
  30384. 0xf6d1,
  30385. "cyrFlex",
  30386. 0xf6d2,
  30387. "cyrbreve",
  30388. 0xf6d4,
  30389. "cyrflex",
  30390. 0xf6d5,
  30391. "d",
  30392. 0x0064,
  30393. "daarmenian",
  30394. 0x0564,
  30395. "dabengali",
  30396. 0x09a6,
  30397. "dadarabic",
  30398. 0x0636,
  30399. "dadeva",
  30400. 0x0926,
  30401. "dadfinalarabic",
  30402. 0xfebe,
  30403. "dadinitialarabic",
  30404. 0xfebf,
  30405. "dadmedialarabic",
  30406. 0xfec0,
  30407. "dagesh",
  30408. 0x05bc,
  30409. "dageshhebrew",
  30410. 0x05bc,
  30411. "dagger",
  30412. 0x2020,
  30413. "daggerdbl",
  30414. 0x2021,
  30415. "dagujarati",
  30416. 0x0aa6,
  30417. "dagurmukhi",
  30418. 0x0a26,
  30419. "dahiragana",
  30420. 0x3060,
  30421. "dakatakana",
  30422. 0x30c0,
  30423. "dalarabic",
  30424. 0x062f,
  30425. "dalet",
  30426. 0x05d3,
  30427. "daletdagesh",
  30428. 0xfb33,
  30429. "daletdageshhebrew",
  30430. 0xfb33,
  30431. "dalethebrew",
  30432. 0x05d3,
  30433. "dalfinalarabic",
  30434. 0xfeaa,
  30435. "dammaarabic",
  30436. 0x064f,
  30437. "dammalowarabic",
  30438. 0x064f,
  30439. "dammatanaltonearabic",
  30440. 0x064c,
  30441. "dammatanarabic",
  30442. 0x064c,
  30443. "danda",
  30444. 0x0964,
  30445. "dargahebrew",
  30446. 0x05a7,
  30447. "dargalefthebrew",
  30448. 0x05a7,
  30449. "dasiapneumatacyrilliccmb",
  30450. 0x0485,
  30451. "dblGrave",
  30452. 0xf6d3,
  30453. "dblanglebracketleft",
  30454. 0x300a,
  30455. "dblanglebracketleftvertical",
  30456. 0xfe3d,
  30457. "dblanglebracketright",
  30458. 0x300b,
  30459. "dblanglebracketrightvertical",
  30460. 0xfe3e,
  30461. "dblarchinvertedbelowcmb",
  30462. 0x032b,
  30463. "dblarrowleft",
  30464. 0x21d4,
  30465. "dblarrowright",
  30466. 0x21d2,
  30467. "dbldanda",
  30468. 0x0965,
  30469. "dblgrave",
  30470. 0xf6d6,
  30471. "dblgravecmb",
  30472. 0x030f,
  30473. "dblintegral",
  30474. 0x222c,
  30475. "dbllowline",
  30476. 0x2017,
  30477. "dbllowlinecmb",
  30478. 0x0333,
  30479. "dbloverlinecmb",
  30480. 0x033f,
  30481. "dblprimemod",
  30482. 0x02ba,
  30483. "dblverticalbar",
  30484. 0x2016,
  30485. "dblverticallineabovecmb",
  30486. 0x030e,
  30487. "dbopomofo",
  30488. 0x3109,
  30489. "dbsquare",
  30490. 0x33c8,
  30491. "dcaron",
  30492. 0x010f,
  30493. "dcedilla",
  30494. 0x1e11,
  30495. "dcircle",
  30496. 0x24d3,
  30497. "dcircumflexbelow",
  30498. 0x1e13,
  30499. "dcroat",
  30500. 0x0111,
  30501. "ddabengali",
  30502. 0x09a1,
  30503. "ddadeva",
  30504. 0x0921,
  30505. "ddagujarati",
  30506. 0x0aa1,
  30507. "ddagurmukhi",
  30508. 0x0a21,
  30509. "ddalarabic",
  30510. 0x0688,
  30511. "ddalfinalarabic",
  30512. 0xfb89,
  30513. "dddhadeva",
  30514. 0x095c,
  30515. "ddhabengali",
  30516. 0x09a2,
  30517. "ddhadeva",
  30518. 0x0922,
  30519. "ddhagujarati",
  30520. 0x0aa2,
  30521. "ddhagurmukhi",
  30522. 0x0a22,
  30523. "ddotaccent",
  30524. 0x1e0b,
  30525. "ddotbelow",
  30526. 0x1e0d,
  30527. "decimalseparatorarabic",
  30528. 0x066b,
  30529. "decimalseparatorpersian",
  30530. 0x066b,
  30531. "decyrillic",
  30532. 0x0434,
  30533. "degree",
  30534. 0x00b0,
  30535. "dehihebrew",
  30536. 0x05ad,
  30537. "dehiragana",
  30538. 0x3067,
  30539. "deicoptic",
  30540. 0x03ef,
  30541. "dekatakana",
  30542. 0x30c7,
  30543. "deleteleft",
  30544. 0x232b,
  30545. "deleteright",
  30546. 0x2326,
  30547. "delta",
  30548. 0x03b4,
  30549. "deltaturned",
  30550. 0x018d,
  30551. "denominatorminusonenumeratorbengali",
  30552. 0x09f8,
  30553. "dezh",
  30554. 0x02a4,
  30555. "dhabengali",
  30556. 0x09a7,
  30557. "dhadeva",
  30558. 0x0927,
  30559. "dhagujarati",
  30560. 0x0aa7,
  30561. "dhagurmukhi",
  30562. 0x0a27,
  30563. "dhook",
  30564. 0x0257,
  30565. "dialytikatonos",
  30566. 0x0385,
  30567. "dialytikatonoscmb",
  30568. 0x0344,
  30569. "diamond",
  30570. 0x2666,
  30571. "diamondsuitwhite",
  30572. 0x2662,
  30573. "dieresis",
  30574. 0x00a8,
  30575. "dieresisacute",
  30576. 0xf6d7,
  30577. "dieresisbelowcmb",
  30578. 0x0324,
  30579. "dieresiscmb",
  30580. 0x0308,
  30581. "dieresisgrave",
  30582. 0xf6d8,
  30583. "dieresistonos",
  30584. 0x0385,
  30585. "dihiragana",
  30586. 0x3062,
  30587. "dikatakana",
  30588. 0x30c2,
  30589. "dittomark",
  30590. 0x3003,
  30591. "divide",
  30592. 0x00f7,
  30593. "divides",
  30594. 0x2223,
  30595. "divisionslash",
  30596. 0x2215,
  30597. "djecyrillic",
  30598. 0x0452,
  30599. "dkshade",
  30600. 0x2593,
  30601. "dlinebelow",
  30602. 0x1e0f,
  30603. "dlsquare",
  30604. 0x3397,
  30605. "dmacron",
  30606. 0x0111,
  30607. "dmonospace",
  30608. 0xff44,
  30609. "dnblock",
  30610. 0x2584,
  30611. "dochadathai",
  30612. 0x0e0e,
  30613. "dodekthai",
  30614. 0x0e14,
  30615. "dohiragana",
  30616. 0x3069,
  30617. "dokatakana",
  30618. 0x30c9,
  30619. "dollar",
  30620. 0x0024,
  30621. "dollarinferior",
  30622. 0xf6e3,
  30623. "dollarmonospace",
  30624. 0xff04,
  30625. "dollaroldstyle",
  30626. 0xf724,
  30627. "dollarsmall",
  30628. 0xfe69,
  30629. "dollarsuperior",
  30630. 0xf6e4,
  30631. "dong",
  30632. 0x20ab,
  30633. "dorusquare",
  30634. 0x3326,
  30635. "dotaccent",
  30636. 0x02d9,
  30637. "dotaccentcmb",
  30638. 0x0307,
  30639. "dotbelowcmb",
  30640. 0x0323,
  30641. "dotbelowcomb",
  30642. 0x0323,
  30643. "dotkatakana",
  30644. 0x30fb,
  30645. "dotlessi",
  30646. 0x0131,
  30647. "dotlessj",
  30648. 0xf6be,
  30649. "dotlessjstrokehook",
  30650. 0x0284,
  30651. "dotmath",
  30652. 0x22c5,
  30653. "dottedcircle",
  30654. 0x25cc,
  30655. "doubleyodpatah",
  30656. 0xfb1f,
  30657. "doubleyodpatahhebrew",
  30658. 0xfb1f,
  30659. "downtackbelowcmb",
  30660. 0x031e,
  30661. "downtackmod",
  30662. 0x02d5,
  30663. "dparen",
  30664. 0x249f,
  30665. "dsuperior",
  30666. 0xf6eb,
  30667. "dtail",
  30668. 0x0256,
  30669. "dtopbar",
  30670. 0x018c,
  30671. "duhiragana",
  30672. 0x3065,
  30673. "dukatakana",
  30674. 0x30c5,
  30675. "dz",
  30676. 0x01f3,
  30677. "dzaltone",
  30678. 0x02a3,
  30679. "dzcaron",
  30680. 0x01c6,
  30681. "dzcurl",
  30682. 0x02a5,
  30683. "dzeabkhasiancyrillic",
  30684. 0x04e1,
  30685. "dzecyrillic",
  30686. 0x0455,
  30687. "dzhecyrillic",
  30688. 0x045f,
  30689. "e",
  30690. 0x0065,
  30691. "eacute",
  30692. 0x00e9,
  30693. "earth",
  30694. 0x2641,
  30695. "ebengali",
  30696. 0x098f,
  30697. "ebopomofo",
  30698. 0x311c,
  30699. "ebreve",
  30700. 0x0115,
  30701. "ecandradeva",
  30702. 0x090d,
  30703. "ecandragujarati",
  30704. 0x0a8d,
  30705. "ecandravowelsigndeva",
  30706. 0x0945,
  30707. "ecandravowelsigngujarati",
  30708. 0x0ac5,
  30709. "ecaron",
  30710. 0x011b,
  30711. "ecedillabreve",
  30712. 0x1e1d,
  30713. "echarmenian",
  30714. 0x0565,
  30715. "echyiwnarmenian",
  30716. 0x0587,
  30717. "ecircle",
  30718. 0x24d4,
  30719. "ecircumflex",
  30720. 0x00ea,
  30721. "ecircumflexacute",
  30722. 0x1ebf,
  30723. "ecircumflexbelow",
  30724. 0x1e19,
  30725. "ecircumflexdotbelow",
  30726. 0x1ec7,
  30727. "ecircumflexgrave",
  30728. 0x1ec1,
  30729. "ecircumflexhookabove",
  30730. 0x1ec3,
  30731. "ecircumflextilde",
  30732. 0x1ec5,
  30733. "ecyrillic",
  30734. 0x0454,
  30735. "edblgrave",
  30736. 0x0205,
  30737. "edeva",
  30738. 0x090f,
  30739. "edieresis",
  30740. 0x00eb,
  30741. "edot",
  30742. 0x0117,
  30743. "edotaccent",
  30744. 0x0117,
  30745. "edotbelow",
  30746. 0x1eb9,
  30747. "eegurmukhi",
  30748. 0x0a0f,
  30749. "eematragurmukhi",
  30750. 0x0a47,
  30751. "efcyrillic",
  30752. 0x0444,
  30753. "egrave",
  30754. 0x00e8,
  30755. "egujarati",
  30756. 0x0a8f,
  30757. "eharmenian",
  30758. 0x0567,
  30759. "ehbopomofo",
  30760. 0x311d,
  30761. "ehiragana",
  30762. 0x3048,
  30763. "ehookabove",
  30764. 0x1ebb,
  30765. "eibopomofo",
  30766. 0x311f,
  30767. "eight",
  30768. 0x0038,
  30769. "eightarabic",
  30770. 0x0668,
  30771. "eightbengali",
  30772. 0x09ee,
  30773. "eightcircle",
  30774. 0x2467,
  30775. "eightcircleinversesansserif",
  30776. 0x2791,
  30777. "eightdeva",
  30778. 0x096e,
  30779. "eighteencircle",
  30780. 0x2471,
  30781. "eighteenparen",
  30782. 0x2485,
  30783. "eighteenperiod",
  30784. 0x2499,
  30785. "eightgujarati",
  30786. 0x0aee,
  30787. "eightgurmukhi",
  30788. 0x0a6e,
  30789. "eighthackarabic",
  30790. 0x0668,
  30791. "eighthangzhou",
  30792. 0x3028,
  30793. "eighthnotebeamed",
  30794. 0x266b,
  30795. "eightideographicparen",
  30796. 0x3227,
  30797. "eightinferior",
  30798. 0x2088,
  30799. "eightmonospace",
  30800. 0xff18,
  30801. "eightoldstyle",
  30802. 0xf738,
  30803. "eightparen",
  30804. 0x247b,
  30805. "eightperiod",
  30806. 0x248f,
  30807. "eightpersian",
  30808. 0x06f8,
  30809. "eightroman",
  30810. 0x2177,
  30811. "eightsuperior",
  30812. 0x2078,
  30813. "eightthai",
  30814. 0x0e58,
  30815. "einvertedbreve",
  30816. 0x0207,
  30817. "eiotifiedcyrillic",
  30818. 0x0465,
  30819. "ekatakana",
  30820. 0x30a8,
  30821. "ekatakanahalfwidth",
  30822. 0xff74,
  30823. "ekonkargurmukhi",
  30824. 0x0a74,
  30825. "ekorean",
  30826. 0x3154,
  30827. "elcyrillic",
  30828. 0x043b,
  30829. "element",
  30830. 0x2208,
  30831. "elevencircle",
  30832. 0x246a,
  30833. "elevenparen",
  30834. 0x247e,
  30835. "elevenperiod",
  30836. 0x2492,
  30837. "elevenroman",
  30838. 0x217a,
  30839. "ellipsis",
  30840. 0x2026,
  30841. "ellipsisvertical",
  30842. 0x22ee,
  30843. "emacron",
  30844. 0x0113,
  30845. "emacronacute",
  30846. 0x1e17,
  30847. "emacrongrave",
  30848. 0x1e15,
  30849. "emcyrillic",
  30850. 0x043c,
  30851. "emdash",
  30852. 0x2014,
  30853. "emdashvertical",
  30854. 0xfe31,
  30855. "emonospace",
  30856. 0xff45,
  30857. "emphasismarkarmenian",
  30858. 0x055b,
  30859. "emptyset",
  30860. 0x2205,
  30861. "enbopomofo",
  30862. 0x3123,
  30863. "encyrillic",
  30864. 0x043d,
  30865. "endash",
  30866. 0x2013,
  30867. "endashvertical",
  30868. 0xfe32,
  30869. "endescendercyrillic",
  30870. 0x04a3,
  30871. "eng",
  30872. 0x014b,
  30873. "engbopomofo",
  30874. 0x3125,
  30875. "enghecyrillic",
  30876. 0x04a5,
  30877. "enhookcyrillic",
  30878. 0x04c8,
  30879. "enspace",
  30880. 0x2002,
  30881. "eogonek",
  30882. 0x0119,
  30883. "eokorean",
  30884. 0x3153,
  30885. "eopen",
  30886. 0x025b,
  30887. "eopenclosed",
  30888. 0x029a,
  30889. "eopenreversed",
  30890. 0x025c,
  30891. "eopenreversedclosed",
  30892. 0x025e,
  30893. "eopenreversedhook",
  30894. 0x025d,
  30895. "eparen",
  30896. 0x24a0,
  30897. "epsilon",
  30898. 0x03b5,
  30899. "epsilontonos",
  30900. 0x03ad,
  30901. "equal",
  30902. 0x003d,
  30903. "equalmonospace",
  30904. 0xff1d,
  30905. "equalsmall",
  30906. 0xfe66,
  30907. "equalsuperior",
  30908. 0x207c,
  30909. "equivalence",
  30910. 0x2261,
  30911. "erbopomofo",
  30912. 0x3126,
  30913. "ercyrillic",
  30914. 0x0440,
  30915. "ereversed",
  30916. 0x0258,
  30917. "ereversedcyrillic",
  30918. 0x044d,
  30919. "escyrillic",
  30920. 0x0441,
  30921. "esdescendercyrillic",
  30922. 0x04ab,
  30923. "esh",
  30924. 0x0283,
  30925. "eshcurl",
  30926. 0x0286,
  30927. "eshortdeva",
  30928. 0x090e,
  30929. "eshortvowelsigndeva",
  30930. 0x0946,
  30931. "eshreversedloop",
  30932. 0x01aa,
  30933. "eshsquatreversed",
  30934. 0x0285,
  30935. "esmallhiragana",
  30936. 0x3047,
  30937. "esmallkatakana",
  30938. 0x30a7,
  30939. "esmallkatakanahalfwidth",
  30940. 0xff6a,
  30941. "estimated",
  30942. 0x212e,
  30943. "esuperior",
  30944. 0xf6ec,
  30945. "eta",
  30946. 0x03b7,
  30947. "etarmenian",
  30948. 0x0568,
  30949. "etatonos",
  30950. 0x03ae,
  30951. "eth",
  30952. 0x00f0,
  30953. "etilde",
  30954. 0x1ebd,
  30955. "etildebelow",
  30956. 0x1e1b,
  30957. "etnahtafoukhhebrew",
  30958. 0x0591,
  30959. "etnahtafoukhlefthebrew",
  30960. 0x0591,
  30961. "etnahtahebrew",
  30962. 0x0591,
  30963. "etnahtalefthebrew",
  30964. 0x0591,
  30965. "eturned",
  30966. 0x01dd,
  30967. "eukorean",
  30968. 0x3161,
  30969. "euro",
  30970. 0x20ac,
  30971. "evowelsignbengali",
  30972. 0x09c7,
  30973. "evowelsigndeva",
  30974. 0x0947,
  30975. "evowelsigngujarati",
  30976. 0x0ac7,
  30977. "exclam",
  30978. 0x0021,
  30979. "exclamarmenian",
  30980. 0x055c,
  30981. "exclamdbl",
  30982. 0x203c,
  30983. "exclamdown",
  30984. 0x00a1,
  30985. "exclamdownsmall",
  30986. 0xf7a1,
  30987. "exclammonospace",
  30988. 0xff01,
  30989. "exclamsmall",
  30990. 0xf721,
  30991. "existential",
  30992. 0x2203,
  30993. "ezh",
  30994. 0x0292,
  30995. "ezhcaron",
  30996. 0x01ef,
  30997. "ezhcurl",
  30998. 0x0293,
  30999. "ezhreversed",
  31000. 0x01b9,
  31001. "ezhtail",
  31002. 0x01ba,
  31003. "f",
  31004. 0x0066,
  31005. "fadeva",
  31006. 0x095e,
  31007. "fagurmukhi",
  31008. 0x0a5e,
  31009. "fahrenheit",
  31010. 0x2109,
  31011. "fathaarabic",
  31012. 0x064e,
  31013. "fathalowarabic",
  31014. 0x064e,
  31015. "fathatanarabic",
  31016. 0x064b,
  31017. "fbopomofo",
  31018. 0x3108,
  31019. "fcircle",
  31020. 0x24d5,
  31021. "fdotaccent",
  31022. 0x1e1f,
  31023. "feharabic",
  31024. 0x0641,
  31025. "feharmenian",
  31026. 0x0586,
  31027. "fehfinalarabic",
  31028. 0xfed2,
  31029. "fehinitialarabic",
  31030. 0xfed3,
  31031. "fehmedialarabic",
  31032. 0xfed4,
  31033. "feicoptic",
  31034. 0x03e5,
  31035. "female",
  31036. 0x2640,
  31037. "ff",
  31038. 0xfb00,
  31039. "f_f",
  31040. 0xfb00,
  31041. "ffi",
  31042. 0xfb03,
  31043. "f_f_i",
  31044. 0xfb03,
  31045. "ffl",
  31046. 0xfb04,
  31047. "f_f_l",
  31048. 0xfb04,
  31049. "fi",
  31050. 0xfb01,
  31051. "f_i",
  31052. 0xfb01,
  31053. "fifteencircle",
  31054. 0x246e,
  31055. "fifteenparen",
  31056. 0x2482,
  31057. "fifteenperiod",
  31058. 0x2496,
  31059. "figuredash",
  31060. 0x2012,
  31061. "filledbox",
  31062. 0x25a0,
  31063. "filledrect",
  31064. 0x25ac,
  31065. "finalkaf",
  31066. 0x05da,
  31067. "finalkafdagesh",
  31068. 0xfb3a,
  31069. "finalkafdageshhebrew",
  31070. 0xfb3a,
  31071. "finalkafhebrew",
  31072. 0x05da,
  31073. "finalmem",
  31074. 0x05dd,
  31075. "finalmemhebrew",
  31076. 0x05dd,
  31077. "finalnun",
  31078. 0x05df,
  31079. "finalnunhebrew",
  31080. 0x05df,
  31081. "finalpe",
  31082. 0x05e3,
  31083. "finalpehebrew",
  31084. 0x05e3,
  31085. "finaltsadi",
  31086. 0x05e5,
  31087. "finaltsadihebrew",
  31088. 0x05e5,
  31089. "firsttonechinese",
  31090. 0x02c9,
  31091. "fisheye",
  31092. 0x25c9,
  31093. "fitacyrillic",
  31094. 0x0473,
  31095. "five",
  31096. 0x0035,
  31097. "fivearabic",
  31098. 0x0665,
  31099. "fivebengali",
  31100. 0x09eb,
  31101. "fivecircle",
  31102. 0x2464,
  31103. "fivecircleinversesansserif",
  31104. 0x278e,
  31105. "fivedeva",
  31106. 0x096b,
  31107. "fiveeighths",
  31108. 0x215d,
  31109. "fivegujarati",
  31110. 0x0aeb,
  31111. "fivegurmukhi",
  31112. 0x0a6b,
  31113. "fivehackarabic",
  31114. 0x0665,
  31115. "fivehangzhou",
  31116. 0x3025,
  31117. "fiveideographicparen",
  31118. 0x3224,
  31119. "fiveinferior",
  31120. 0x2085,
  31121. "fivemonospace",
  31122. 0xff15,
  31123. "fiveoldstyle",
  31124. 0xf735,
  31125. "fiveparen",
  31126. 0x2478,
  31127. "fiveperiod",
  31128. 0x248c,
  31129. "fivepersian",
  31130. 0x06f5,
  31131. "fiveroman",
  31132. 0x2174,
  31133. "fivesuperior",
  31134. 0x2075,
  31135. "fivethai",
  31136. 0x0e55,
  31137. "fl",
  31138. 0xfb02,
  31139. "f_l",
  31140. 0xfb02,
  31141. "florin",
  31142. 0x0192,
  31143. "fmonospace",
  31144. 0xff46,
  31145. "fmsquare",
  31146. 0x3399,
  31147. "fofanthai",
  31148. 0x0e1f,
  31149. "fofathai",
  31150. 0x0e1d,
  31151. "fongmanthai",
  31152. 0x0e4f,
  31153. "forall",
  31154. 0x2200,
  31155. "four",
  31156. 0x0034,
  31157. "fourarabic",
  31158. 0x0664,
  31159. "fourbengali",
  31160. 0x09ea,
  31161. "fourcircle",
  31162. 0x2463,
  31163. "fourcircleinversesansserif",
  31164. 0x278d,
  31165. "fourdeva",
  31166. 0x096a,
  31167. "fourgujarati",
  31168. 0x0aea,
  31169. "fourgurmukhi",
  31170. 0x0a6a,
  31171. "fourhackarabic",
  31172. 0x0664,
  31173. "fourhangzhou",
  31174. 0x3024,
  31175. "fourideographicparen",
  31176. 0x3223,
  31177. "fourinferior",
  31178. 0x2084,
  31179. "fourmonospace",
  31180. 0xff14,
  31181. "fournumeratorbengali",
  31182. 0x09f7,
  31183. "fouroldstyle",
  31184. 0xf734,
  31185. "fourparen",
  31186. 0x2477,
  31187. "fourperiod",
  31188. 0x248b,
  31189. "fourpersian",
  31190. 0x06f4,
  31191. "fourroman",
  31192. 0x2173,
  31193. "foursuperior",
  31194. 0x2074,
  31195. "fourteencircle",
  31196. 0x246d,
  31197. "fourteenparen",
  31198. 0x2481,
  31199. "fourteenperiod",
  31200. 0x2495,
  31201. "fourthai",
  31202. 0x0e54,
  31203. "fourthtonechinese",
  31204. 0x02cb,
  31205. "fparen",
  31206. 0x24a1,
  31207. "fraction",
  31208. 0x2044,
  31209. "franc",
  31210. 0x20a3,
  31211. "g",
  31212. 0x0067,
  31213. "gabengali",
  31214. 0x0997,
  31215. "gacute",
  31216. 0x01f5,
  31217. "gadeva",
  31218. 0x0917,
  31219. "gafarabic",
  31220. 0x06af,
  31221. "gaffinalarabic",
  31222. 0xfb93,
  31223. "gafinitialarabic",
  31224. 0xfb94,
  31225. "gafmedialarabic",
  31226. 0xfb95,
  31227. "gagujarati",
  31228. 0x0a97,
  31229. "gagurmukhi",
  31230. 0x0a17,
  31231. "gahiragana",
  31232. 0x304c,
  31233. "gakatakana",
  31234. 0x30ac,
  31235. "gamma",
  31236. 0x03b3,
  31237. "gammalatinsmall",
  31238. 0x0263,
  31239. "gammasuperior",
  31240. 0x02e0,
  31241. "gangiacoptic",
  31242. 0x03eb,
  31243. "gbopomofo",
  31244. 0x310d,
  31245. "gbreve",
  31246. 0x011f,
  31247. "gcaron",
  31248. 0x01e7,
  31249. "gcedilla",
  31250. 0x0123,
  31251. "gcircle",
  31252. 0x24d6,
  31253. "gcircumflex",
  31254. 0x011d,
  31255. "gcommaaccent",
  31256. 0x0123,
  31257. "gdot",
  31258. 0x0121,
  31259. "gdotaccent",
  31260. 0x0121,
  31261. "gecyrillic",
  31262. 0x0433,
  31263. "gehiragana",
  31264. 0x3052,
  31265. "gekatakana",
  31266. 0x30b2,
  31267. "geometricallyequal",
  31268. 0x2251,
  31269. "gereshaccenthebrew",
  31270. 0x059c,
  31271. "gereshhebrew",
  31272. 0x05f3,
  31273. "gereshmuqdamhebrew",
  31274. 0x059d,
  31275. "germandbls",
  31276. 0x00df,
  31277. "gershayimaccenthebrew",
  31278. 0x059e,
  31279. "gershayimhebrew",
  31280. 0x05f4,
  31281. "getamark",
  31282. 0x3013,
  31283. "ghabengali",
  31284. 0x0998,
  31285. "ghadarmenian",
  31286. 0x0572,
  31287. "ghadeva",
  31288. 0x0918,
  31289. "ghagujarati",
  31290. 0x0a98,
  31291. "ghagurmukhi",
  31292. 0x0a18,
  31293. "ghainarabic",
  31294. 0x063a,
  31295. "ghainfinalarabic",
  31296. 0xfece,
  31297. "ghaininitialarabic",
  31298. 0xfecf,
  31299. "ghainmedialarabic",
  31300. 0xfed0,
  31301. "ghemiddlehookcyrillic",
  31302. 0x0495,
  31303. "ghestrokecyrillic",
  31304. 0x0493,
  31305. "gheupturncyrillic",
  31306. 0x0491,
  31307. "ghhadeva",
  31308. 0x095a,
  31309. "ghhagurmukhi",
  31310. 0x0a5a,
  31311. "ghook",
  31312. 0x0260,
  31313. "ghzsquare",
  31314. 0x3393,
  31315. "gihiragana",
  31316. 0x304e,
  31317. "gikatakana",
  31318. 0x30ae,
  31319. "gimarmenian",
  31320. 0x0563,
  31321. "gimel",
  31322. 0x05d2,
  31323. "gimeldagesh",
  31324. 0xfb32,
  31325. "gimeldageshhebrew",
  31326. 0xfb32,
  31327. "gimelhebrew",
  31328. 0x05d2,
  31329. "gjecyrillic",
  31330. 0x0453,
  31331. "glottalinvertedstroke",
  31332. 0x01be,
  31333. "glottalstop",
  31334. 0x0294,
  31335. "glottalstopinverted",
  31336. 0x0296,
  31337. "glottalstopmod",
  31338. 0x02c0,
  31339. "glottalstopreversed",
  31340. 0x0295,
  31341. "glottalstopreversedmod",
  31342. 0x02c1,
  31343. "glottalstopreversedsuperior",
  31344. 0x02e4,
  31345. "glottalstopstroke",
  31346. 0x02a1,
  31347. "glottalstopstrokereversed",
  31348. 0x02a2,
  31349. "gmacron",
  31350. 0x1e21,
  31351. "gmonospace",
  31352. 0xff47,
  31353. "gohiragana",
  31354. 0x3054,
  31355. "gokatakana",
  31356. 0x30b4,
  31357. "gparen",
  31358. 0x24a2,
  31359. "gpasquare",
  31360. 0x33ac,
  31361. "gradient",
  31362. 0x2207,
  31363. "grave",
  31364. 0x0060,
  31365. "gravebelowcmb",
  31366. 0x0316,
  31367. "gravecmb",
  31368. 0x0300,
  31369. "gravecomb",
  31370. 0x0300,
  31371. "gravedeva",
  31372. 0x0953,
  31373. "gravelowmod",
  31374. 0x02ce,
  31375. "gravemonospace",
  31376. 0xff40,
  31377. "gravetonecmb",
  31378. 0x0340,
  31379. "greater",
  31380. 0x003e,
  31381. "greaterequal",
  31382. 0x2265,
  31383. "greaterequalorless",
  31384. 0x22db,
  31385. "greatermonospace",
  31386. 0xff1e,
  31387. "greaterorequivalent",
  31388. 0x2273,
  31389. "greaterorless",
  31390. 0x2277,
  31391. "greateroverequal",
  31392. 0x2267,
  31393. "greatersmall",
  31394. 0xfe65,
  31395. "gscript",
  31396. 0x0261,
  31397. "gstroke",
  31398. 0x01e5,
  31399. "guhiragana",
  31400. 0x3050,
  31401. "guillemotleft",
  31402. 0x00ab,
  31403. "guillemotright",
  31404. 0x00bb,
  31405. "guilsinglleft",
  31406. 0x2039,
  31407. "guilsinglright",
  31408. 0x203a,
  31409. "gukatakana",
  31410. 0x30b0,
  31411. "guramusquare",
  31412. 0x3318,
  31413. "gysquare",
  31414. 0x33c9,
  31415. "h",
  31416. 0x0068,
  31417. "haabkhasiancyrillic",
  31418. 0x04a9,
  31419. "haaltonearabic",
  31420. 0x06c1,
  31421. "habengali",
  31422. 0x09b9,
  31423. "hadescendercyrillic",
  31424. 0x04b3,
  31425. "hadeva",
  31426. 0x0939,
  31427. "hagujarati",
  31428. 0x0ab9,
  31429. "hagurmukhi",
  31430. 0x0a39,
  31431. "haharabic",
  31432. 0x062d,
  31433. "hahfinalarabic",
  31434. 0xfea2,
  31435. "hahinitialarabic",
  31436. 0xfea3,
  31437. "hahiragana",
  31438. 0x306f,
  31439. "hahmedialarabic",
  31440. 0xfea4,
  31441. "haitusquare",
  31442. 0x332a,
  31443. "hakatakana",
  31444. 0x30cf,
  31445. "hakatakanahalfwidth",
  31446. 0xff8a,
  31447. "halantgurmukhi",
  31448. 0x0a4d,
  31449. "hamzaarabic",
  31450. 0x0621,
  31451. "hamzalowarabic",
  31452. 0x0621,
  31453. "hangulfiller",
  31454. 0x3164,
  31455. "hardsigncyrillic",
  31456. 0x044a,
  31457. "harpoonleftbarbup",
  31458. 0x21bc,
  31459. "harpoonrightbarbup",
  31460. 0x21c0,
  31461. "hasquare",
  31462. 0x33ca,
  31463. "hatafpatah",
  31464. 0x05b2,
  31465. "hatafpatah16",
  31466. 0x05b2,
  31467. "hatafpatah23",
  31468. 0x05b2,
  31469. "hatafpatah2f",
  31470. 0x05b2,
  31471. "hatafpatahhebrew",
  31472. 0x05b2,
  31473. "hatafpatahnarrowhebrew",
  31474. 0x05b2,
  31475. "hatafpatahquarterhebrew",
  31476. 0x05b2,
  31477. "hatafpatahwidehebrew",
  31478. 0x05b2,
  31479. "hatafqamats",
  31480. 0x05b3,
  31481. "hatafqamats1b",
  31482. 0x05b3,
  31483. "hatafqamats28",
  31484. 0x05b3,
  31485. "hatafqamats34",
  31486. 0x05b3,
  31487. "hatafqamatshebrew",
  31488. 0x05b3,
  31489. "hatafqamatsnarrowhebrew",
  31490. 0x05b3,
  31491. "hatafqamatsquarterhebrew",
  31492. 0x05b3,
  31493. "hatafqamatswidehebrew",
  31494. 0x05b3,
  31495. "hatafsegol",
  31496. 0x05b1,
  31497. "hatafsegol17",
  31498. 0x05b1,
  31499. "hatafsegol24",
  31500. 0x05b1,
  31501. "hatafsegol30",
  31502. 0x05b1,
  31503. "hatafsegolhebrew",
  31504. 0x05b1,
  31505. "hatafsegolnarrowhebrew",
  31506. 0x05b1,
  31507. "hatafsegolquarterhebrew",
  31508. 0x05b1,
  31509. "hatafsegolwidehebrew",
  31510. 0x05b1,
  31511. "hbar",
  31512. 0x0127,
  31513. "hbopomofo",
  31514. 0x310f,
  31515. "hbrevebelow",
  31516. 0x1e2b,
  31517. "hcedilla",
  31518. 0x1e29,
  31519. "hcircle",
  31520. 0x24d7,
  31521. "hcircumflex",
  31522. 0x0125,
  31523. "hdieresis",
  31524. 0x1e27,
  31525. "hdotaccent",
  31526. 0x1e23,
  31527. "hdotbelow",
  31528. 0x1e25,
  31529. "he",
  31530. 0x05d4,
  31531. "heart",
  31532. 0x2665,
  31533. "heartsuitblack",
  31534. 0x2665,
  31535. "heartsuitwhite",
  31536. 0x2661,
  31537. "hedagesh",
  31538. 0xfb34,
  31539. "hedageshhebrew",
  31540. 0xfb34,
  31541. "hehaltonearabic",
  31542. 0x06c1,
  31543. "heharabic",
  31544. 0x0647,
  31545. "hehebrew",
  31546. 0x05d4,
  31547. "hehfinalaltonearabic",
  31548. 0xfba7,
  31549. "hehfinalalttwoarabic",
  31550. 0xfeea,
  31551. "hehfinalarabic",
  31552. 0xfeea,
  31553. "hehhamzaabovefinalarabic",
  31554. 0xfba5,
  31555. "hehhamzaaboveisolatedarabic",
  31556. 0xfba4,
  31557. "hehinitialaltonearabic",
  31558. 0xfba8,
  31559. "hehinitialarabic",
  31560. 0xfeeb,
  31561. "hehiragana",
  31562. 0x3078,
  31563. "hehmedialaltonearabic",
  31564. 0xfba9,
  31565. "hehmedialarabic",
  31566. 0xfeec,
  31567. "heiseierasquare",
  31568. 0x337b,
  31569. "hekatakana",
  31570. 0x30d8,
  31571. "hekatakanahalfwidth",
  31572. 0xff8d,
  31573. "hekutaarusquare",
  31574. 0x3336,
  31575. "henghook",
  31576. 0x0267,
  31577. "herutusquare",
  31578. 0x3339,
  31579. "het",
  31580. 0x05d7,
  31581. "hethebrew",
  31582. 0x05d7,
  31583. "hhook",
  31584. 0x0266,
  31585. "hhooksuperior",
  31586. 0x02b1,
  31587. "hieuhacirclekorean",
  31588. 0x327b,
  31589. "hieuhaparenkorean",
  31590. 0x321b,
  31591. "hieuhcirclekorean",
  31592. 0x326d,
  31593. "hieuhkorean",
  31594. 0x314e,
  31595. "hieuhparenkorean",
  31596. 0x320d,
  31597. "hihiragana",
  31598. 0x3072,
  31599. "hikatakana",
  31600. 0x30d2,
  31601. "hikatakanahalfwidth",
  31602. 0xff8b,
  31603. "hiriq",
  31604. 0x05b4,
  31605. "hiriq14",
  31606. 0x05b4,
  31607. "hiriq21",
  31608. 0x05b4,
  31609. "hiriq2d",
  31610. 0x05b4,
  31611. "hiriqhebrew",
  31612. 0x05b4,
  31613. "hiriqnarrowhebrew",
  31614. 0x05b4,
  31615. "hiriqquarterhebrew",
  31616. 0x05b4,
  31617. "hiriqwidehebrew",
  31618. 0x05b4,
  31619. "hlinebelow",
  31620. 0x1e96,
  31621. "hmonospace",
  31622. 0xff48,
  31623. "hoarmenian",
  31624. 0x0570,
  31625. "hohipthai",
  31626. 0x0e2b,
  31627. "hohiragana",
  31628. 0x307b,
  31629. "hokatakana",
  31630. 0x30db,
  31631. "hokatakanahalfwidth",
  31632. 0xff8e,
  31633. "holam",
  31634. 0x05b9,
  31635. "holam19",
  31636. 0x05b9,
  31637. "holam26",
  31638. 0x05b9,
  31639. "holam32",
  31640. 0x05b9,
  31641. "holamhebrew",
  31642. 0x05b9,
  31643. "holamnarrowhebrew",
  31644. 0x05b9,
  31645. "holamquarterhebrew",
  31646. 0x05b9,
  31647. "holamwidehebrew",
  31648. 0x05b9,
  31649. "honokhukthai",
  31650. 0x0e2e,
  31651. "hookabovecomb",
  31652. 0x0309,
  31653. "hookcmb",
  31654. 0x0309,
  31655. "hookpalatalizedbelowcmb",
  31656. 0x0321,
  31657. "hookretroflexbelowcmb",
  31658. 0x0322,
  31659. "hoonsquare",
  31660. 0x3342,
  31661. "horicoptic",
  31662. 0x03e9,
  31663. "horizontalbar",
  31664. 0x2015,
  31665. "horncmb",
  31666. 0x031b,
  31667. "hotsprings",
  31668. 0x2668,
  31669. "house",
  31670. 0x2302,
  31671. "hparen",
  31672. 0x24a3,
  31673. "hsuperior",
  31674. 0x02b0,
  31675. "hturned",
  31676. 0x0265,
  31677. "huhiragana",
  31678. 0x3075,
  31679. "huiitosquare",
  31680. 0x3333,
  31681. "hukatakana",
  31682. 0x30d5,
  31683. "hukatakanahalfwidth",
  31684. 0xff8c,
  31685. "hungarumlaut",
  31686. 0x02dd,
  31687. "hungarumlautcmb",
  31688. 0x030b,
  31689. "hv",
  31690. 0x0195,
  31691. "hyphen",
  31692. 0x002d,
  31693. "hypheninferior",
  31694. 0xf6e5,
  31695. "hyphenmonospace",
  31696. 0xff0d,
  31697. "hyphensmall",
  31698. 0xfe63,
  31699. "hyphensuperior",
  31700. 0xf6e6,
  31701. "hyphentwo",
  31702. 0x2010,
  31703. "i",
  31704. 0x0069,
  31705. "iacute",
  31706. 0x00ed,
  31707. "iacyrillic",
  31708. 0x044f,
  31709. "ibengali",
  31710. 0x0987,
  31711. "ibopomofo",
  31712. 0x3127,
  31713. "ibreve",
  31714. 0x012d,
  31715. "icaron",
  31716. 0x01d0,
  31717. "icircle",
  31718. 0x24d8,
  31719. "icircumflex",
  31720. 0x00ee,
  31721. "icyrillic",
  31722. 0x0456,
  31723. "idblgrave",
  31724. 0x0209,
  31725. "ideographearthcircle",
  31726. 0x328f,
  31727. "ideographfirecircle",
  31728. 0x328b,
  31729. "ideographicallianceparen",
  31730. 0x323f,
  31731. "ideographiccallparen",
  31732. 0x323a,
  31733. "ideographiccentrecircle",
  31734. 0x32a5,
  31735. "ideographicclose",
  31736. 0x3006,
  31737. "ideographiccomma",
  31738. 0x3001,
  31739. "ideographiccommaleft",
  31740. 0xff64,
  31741. "ideographiccongratulationparen",
  31742. 0x3237,
  31743. "ideographiccorrectcircle",
  31744. 0x32a3,
  31745. "ideographicearthparen",
  31746. 0x322f,
  31747. "ideographicenterpriseparen",
  31748. 0x323d,
  31749. "ideographicexcellentcircle",
  31750. 0x329d,
  31751. "ideographicfestivalparen",
  31752. 0x3240,
  31753. "ideographicfinancialcircle",
  31754. 0x3296,
  31755. "ideographicfinancialparen",
  31756. 0x3236,
  31757. "ideographicfireparen",
  31758. 0x322b,
  31759. "ideographichaveparen",
  31760. 0x3232,
  31761. "ideographichighcircle",
  31762. 0x32a4,
  31763. "ideographiciterationmark",
  31764. 0x3005,
  31765. "ideographiclaborcircle",
  31766. 0x3298,
  31767. "ideographiclaborparen",
  31768. 0x3238,
  31769. "ideographicleftcircle",
  31770. 0x32a7,
  31771. "ideographiclowcircle",
  31772. 0x32a6,
  31773. "ideographicmedicinecircle",
  31774. 0x32a9,
  31775. "ideographicmetalparen",
  31776. 0x322e,
  31777. "ideographicmoonparen",
  31778. 0x322a,
  31779. "ideographicnameparen",
  31780. 0x3234,
  31781. "ideographicperiod",
  31782. 0x3002,
  31783. "ideographicprintcircle",
  31784. 0x329e,
  31785. "ideographicreachparen",
  31786. 0x3243,
  31787. "ideographicrepresentparen",
  31788. 0x3239,
  31789. "ideographicresourceparen",
  31790. 0x323e,
  31791. "ideographicrightcircle",
  31792. 0x32a8,
  31793. "ideographicsecretcircle",
  31794. 0x3299,
  31795. "ideographicselfparen",
  31796. 0x3242,
  31797. "ideographicsocietyparen",
  31798. 0x3233,
  31799. "ideographicspace",
  31800. 0x3000,
  31801. "ideographicspecialparen",
  31802. 0x3235,
  31803. "ideographicstockparen",
  31804. 0x3231,
  31805. "ideographicstudyparen",
  31806. 0x323b,
  31807. "ideographicsunparen",
  31808. 0x3230,
  31809. "ideographicsuperviseparen",
  31810. 0x323c,
  31811. "ideographicwaterparen",
  31812. 0x322c,
  31813. "ideographicwoodparen",
  31814. 0x322d,
  31815. "ideographiczero",
  31816. 0x3007,
  31817. "ideographmetalcircle",
  31818. 0x328e,
  31819. "ideographmooncircle",
  31820. 0x328a,
  31821. "ideographnamecircle",
  31822. 0x3294,
  31823. "ideographsuncircle",
  31824. 0x3290,
  31825. "ideographwatercircle",
  31826. 0x328c,
  31827. "ideographwoodcircle",
  31828. 0x328d,
  31829. "ideva",
  31830. 0x0907,
  31831. "idieresis",
  31832. 0x00ef,
  31833. "idieresisacute",
  31834. 0x1e2f,
  31835. "idieresiscyrillic",
  31836. 0x04e5,
  31837. "idotbelow",
  31838. 0x1ecb,
  31839. "iebrevecyrillic",
  31840. 0x04d7,
  31841. "iecyrillic",
  31842. 0x0435,
  31843. "ieungacirclekorean",
  31844. 0x3275,
  31845. "ieungaparenkorean",
  31846. 0x3215,
  31847. "ieungcirclekorean",
  31848. 0x3267,
  31849. "ieungkorean",
  31850. 0x3147,
  31851. "ieungparenkorean",
  31852. 0x3207,
  31853. "igrave",
  31854. 0x00ec,
  31855. "igujarati",
  31856. 0x0a87,
  31857. "igurmukhi",
  31858. 0x0a07,
  31859. "ihiragana",
  31860. 0x3044,
  31861. "ihookabove",
  31862. 0x1ec9,
  31863. "iibengali",
  31864. 0x0988,
  31865. "iicyrillic",
  31866. 0x0438,
  31867. "iideva",
  31868. 0x0908,
  31869. "iigujarati",
  31870. 0x0a88,
  31871. "iigurmukhi",
  31872. 0x0a08,
  31873. "iimatragurmukhi",
  31874. 0x0a40,
  31875. "iinvertedbreve",
  31876. 0x020b,
  31877. "iishortcyrillic",
  31878. 0x0439,
  31879. "iivowelsignbengali",
  31880. 0x09c0,
  31881. "iivowelsigndeva",
  31882. 0x0940,
  31883. "iivowelsigngujarati",
  31884. 0x0ac0,
  31885. "ij",
  31886. 0x0133,
  31887. "ikatakana",
  31888. 0x30a4,
  31889. "ikatakanahalfwidth",
  31890. 0xff72,
  31891. "ikorean",
  31892. 0x3163,
  31893. "ilde",
  31894. 0x02dc,
  31895. "iluyhebrew",
  31896. 0x05ac,
  31897. "imacron",
  31898. 0x012b,
  31899. "imacroncyrillic",
  31900. 0x04e3,
  31901. "imageorapproximatelyequal",
  31902. 0x2253,
  31903. "imatragurmukhi",
  31904. 0x0a3f,
  31905. "imonospace",
  31906. 0xff49,
  31907. "increment",
  31908. 0x2206,
  31909. "infinity",
  31910. 0x221e,
  31911. "iniarmenian",
  31912. 0x056b,
  31913. "integral",
  31914. 0x222b,
  31915. "integralbottom",
  31916. 0x2321,
  31917. "integralbt",
  31918. 0x2321,
  31919. "integralex",
  31920. 0xf8f5,
  31921. "integraltop",
  31922. 0x2320,
  31923. "integraltp",
  31924. 0x2320,
  31925. "intersection",
  31926. 0x2229,
  31927. "intisquare",
  31928. 0x3305,
  31929. "invbullet",
  31930. 0x25d8,
  31931. "invcircle",
  31932. 0x25d9,
  31933. "invsmileface",
  31934. 0x263b,
  31935. "iocyrillic",
  31936. 0x0451,
  31937. "iogonek",
  31938. 0x012f,
  31939. "iota",
  31940. 0x03b9,
  31941. "iotadieresis",
  31942. 0x03ca,
  31943. "iotadieresistonos",
  31944. 0x0390,
  31945. "iotalatin",
  31946. 0x0269,
  31947. "iotatonos",
  31948. 0x03af,
  31949. "iparen",
  31950. 0x24a4,
  31951. "irigurmukhi",
  31952. 0x0a72,
  31953. "ismallhiragana",
  31954. 0x3043,
  31955. "ismallkatakana",
  31956. 0x30a3,
  31957. "ismallkatakanahalfwidth",
  31958. 0xff68,
  31959. "issharbengali",
  31960. 0x09fa,
  31961. "istroke",
  31962. 0x0268,
  31963. "isuperior",
  31964. 0xf6ed,
  31965. "iterationhiragana",
  31966. 0x309d,
  31967. "iterationkatakana",
  31968. 0x30fd,
  31969. "itilde",
  31970. 0x0129,
  31971. "itildebelow",
  31972. 0x1e2d,
  31973. "iubopomofo",
  31974. 0x3129,
  31975. "iucyrillic",
  31976. 0x044e,
  31977. "ivowelsignbengali",
  31978. 0x09bf,
  31979. "ivowelsigndeva",
  31980. 0x093f,
  31981. "ivowelsigngujarati",
  31982. 0x0abf,
  31983. "izhitsacyrillic",
  31984. 0x0475,
  31985. "izhitsadblgravecyrillic",
  31986. 0x0477,
  31987. "j",
  31988. 0x006a,
  31989. "jaarmenian",
  31990. 0x0571,
  31991. "jabengali",
  31992. 0x099c,
  31993. "jadeva",
  31994. 0x091c,
  31995. "jagujarati",
  31996. 0x0a9c,
  31997. "jagurmukhi",
  31998. 0x0a1c,
  31999. "jbopomofo",
  32000. 0x3110,
  32001. "jcaron",
  32002. 0x01f0,
  32003. "jcircle",
  32004. 0x24d9,
  32005. "jcircumflex",
  32006. 0x0135,
  32007. "jcrossedtail",
  32008. 0x029d,
  32009. "jdotlessstroke",
  32010. 0x025f,
  32011. "jecyrillic",
  32012. 0x0458,
  32013. "jeemarabic",
  32014. 0x062c,
  32015. "jeemfinalarabic",
  32016. 0xfe9e,
  32017. "jeeminitialarabic",
  32018. 0xfe9f,
  32019. "jeemmedialarabic",
  32020. 0xfea0,
  32021. "jeharabic",
  32022. 0x0698,
  32023. "jehfinalarabic",
  32024. 0xfb8b,
  32025. "jhabengali",
  32026. 0x099d,
  32027. "jhadeva",
  32028. 0x091d,
  32029. "jhagujarati",
  32030. 0x0a9d,
  32031. "jhagurmukhi",
  32032. 0x0a1d,
  32033. "jheharmenian",
  32034. 0x057b,
  32035. "jis",
  32036. 0x3004,
  32037. "jmonospace",
  32038. 0xff4a,
  32039. "jparen",
  32040. 0x24a5,
  32041. "jsuperior",
  32042. 0x02b2,
  32043. "k",
  32044. 0x006b,
  32045. "kabashkircyrillic",
  32046. 0x04a1,
  32047. "kabengali",
  32048. 0x0995,
  32049. "kacute",
  32050. 0x1e31,
  32051. "kacyrillic",
  32052. 0x043a,
  32053. "kadescendercyrillic",
  32054. 0x049b,
  32055. "kadeva",
  32056. 0x0915,
  32057. "kaf",
  32058. 0x05db,
  32059. "kafarabic",
  32060. 0x0643,
  32061. "kafdagesh",
  32062. 0xfb3b,
  32063. "kafdageshhebrew",
  32064. 0xfb3b,
  32065. "kaffinalarabic",
  32066. 0xfeda,
  32067. "kafhebrew",
  32068. 0x05db,
  32069. "kafinitialarabic",
  32070. 0xfedb,
  32071. "kafmedialarabic",
  32072. 0xfedc,
  32073. "kafrafehebrew",
  32074. 0xfb4d,
  32075. "kagujarati",
  32076. 0x0a95,
  32077. "kagurmukhi",
  32078. 0x0a15,
  32079. "kahiragana",
  32080. 0x304b,
  32081. "kahookcyrillic",
  32082. 0x04c4,
  32083. "kakatakana",
  32084. 0x30ab,
  32085. "kakatakanahalfwidth",
  32086. 0xff76,
  32087. "kappa",
  32088. 0x03ba,
  32089. "kappasymbolgreek",
  32090. 0x03f0,
  32091. "kapyeounmieumkorean",
  32092. 0x3171,
  32093. "kapyeounphieuphkorean",
  32094. 0x3184,
  32095. "kapyeounpieupkorean",
  32096. 0x3178,
  32097. "kapyeounssangpieupkorean",
  32098. 0x3179,
  32099. "karoriisquare",
  32100. 0x330d,
  32101. "kashidaautoarabic",
  32102. 0x0640,
  32103. "kashidaautonosidebearingarabic",
  32104. 0x0640,
  32105. "kasmallkatakana",
  32106. 0x30f5,
  32107. "kasquare",
  32108. 0x3384,
  32109. "kasraarabic",
  32110. 0x0650,
  32111. "kasratanarabic",
  32112. 0x064d,
  32113. "kastrokecyrillic",
  32114. 0x049f,
  32115. "katahiraprolongmarkhalfwidth",
  32116. 0xff70,
  32117. "kaverticalstrokecyrillic",
  32118. 0x049d,
  32119. "kbopomofo",
  32120. 0x310e,
  32121. "kcalsquare",
  32122. 0x3389,
  32123. "kcaron",
  32124. 0x01e9,
  32125. "kcedilla",
  32126. 0x0137,
  32127. "kcircle",
  32128. 0x24da,
  32129. "kcommaaccent",
  32130. 0x0137,
  32131. "kdotbelow",
  32132. 0x1e33,
  32133. "keharmenian",
  32134. 0x0584,
  32135. "kehiragana",
  32136. 0x3051,
  32137. "kekatakana",
  32138. 0x30b1,
  32139. "kekatakanahalfwidth",
  32140. 0xff79,
  32141. "kenarmenian",
  32142. 0x056f,
  32143. "kesmallkatakana",
  32144. 0x30f6,
  32145. "kgreenlandic",
  32146. 0x0138,
  32147. "khabengali",
  32148. 0x0996,
  32149. "khacyrillic",
  32150. 0x0445,
  32151. "khadeva",
  32152. 0x0916,
  32153. "khagujarati",
  32154. 0x0a96,
  32155. "khagurmukhi",
  32156. 0x0a16,
  32157. "khaharabic",
  32158. 0x062e,
  32159. "khahfinalarabic",
  32160. 0xfea6,
  32161. "khahinitialarabic",
  32162. 0xfea7,
  32163. "khahmedialarabic",
  32164. 0xfea8,
  32165. "kheicoptic",
  32166. 0x03e7,
  32167. "khhadeva",
  32168. 0x0959,
  32169. "khhagurmukhi",
  32170. 0x0a59,
  32171. "khieukhacirclekorean",
  32172. 0x3278,
  32173. "khieukhaparenkorean",
  32174. 0x3218,
  32175. "khieukhcirclekorean",
  32176. 0x326a,
  32177. "khieukhkorean",
  32178. 0x314b,
  32179. "khieukhparenkorean",
  32180. 0x320a,
  32181. "khokhaithai",
  32182. 0x0e02,
  32183. "khokhonthai",
  32184. 0x0e05,
  32185. "khokhuatthai",
  32186. 0x0e03,
  32187. "khokhwaithai",
  32188. 0x0e04,
  32189. "khomutthai",
  32190. 0x0e5b,
  32191. "khook",
  32192. 0x0199,
  32193. "khorakhangthai",
  32194. 0x0e06,
  32195. "khzsquare",
  32196. 0x3391,
  32197. "kihiragana",
  32198. 0x304d,
  32199. "kikatakana",
  32200. 0x30ad,
  32201. "kikatakanahalfwidth",
  32202. 0xff77,
  32203. "kiroguramusquare",
  32204. 0x3315,
  32205. "kiromeetorusquare",
  32206. 0x3316,
  32207. "kirosquare",
  32208. 0x3314,
  32209. "kiyeokacirclekorean",
  32210. 0x326e,
  32211. "kiyeokaparenkorean",
  32212. 0x320e,
  32213. "kiyeokcirclekorean",
  32214. 0x3260,
  32215. "kiyeokkorean",
  32216. 0x3131,
  32217. "kiyeokparenkorean",
  32218. 0x3200,
  32219. "kiyeoksioskorean",
  32220. 0x3133,
  32221. "kjecyrillic",
  32222. 0x045c,
  32223. "klinebelow",
  32224. 0x1e35,
  32225. "klsquare",
  32226. 0x3398,
  32227. "kmcubedsquare",
  32228. 0x33a6,
  32229. "kmonospace",
  32230. 0xff4b,
  32231. "kmsquaredsquare",
  32232. 0x33a2,
  32233. "kohiragana",
  32234. 0x3053,
  32235. "kohmsquare",
  32236. 0x33c0,
  32237. "kokaithai",
  32238. 0x0e01,
  32239. "kokatakana",
  32240. 0x30b3,
  32241. "kokatakanahalfwidth",
  32242. 0xff7a,
  32243. "kooposquare",
  32244. 0x331e,
  32245. "koppacyrillic",
  32246. 0x0481,
  32247. "koreanstandardsymbol",
  32248. 0x327f,
  32249. "koroniscmb",
  32250. 0x0343,
  32251. "kparen",
  32252. 0x24a6,
  32253. "kpasquare",
  32254. 0x33aa,
  32255. "ksicyrillic",
  32256. 0x046f,
  32257. "ktsquare",
  32258. 0x33cf,
  32259. "kturned",
  32260. 0x029e,
  32261. "kuhiragana",
  32262. 0x304f,
  32263. "kukatakana",
  32264. 0x30af,
  32265. "kukatakanahalfwidth",
  32266. 0xff78,
  32267. "kvsquare",
  32268. 0x33b8,
  32269. "kwsquare",
  32270. 0x33be,
  32271. "l",
  32272. 0x006c,
  32273. "labengali",
  32274. 0x09b2,
  32275. "lacute",
  32276. 0x013a,
  32277. "ladeva",
  32278. 0x0932,
  32279. "lagujarati",
  32280. 0x0ab2,
  32281. "lagurmukhi",
  32282. 0x0a32,
  32283. "lakkhangyaothai",
  32284. 0x0e45,
  32285. "lamaleffinalarabic",
  32286. 0xfefc,
  32287. "lamalefhamzaabovefinalarabic",
  32288. 0xfef8,
  32289. "lamalefhamzaaboveisolatedarabic",
  32290. 0xfef7,
  32291. "lamalefhamzabelowfinalarabic",
  32292. 0xfefa,
  32293. "lamalefhamzabelowisolatedarabic",
  32294. 0xfef9,
  32295. "lamalefisolatedarabic",
  32296. 0xfefb,
  32297. "lamalefmaddaabovefinalarabic",
  32298. 0xfef6,
  32299. "lamalefmaddaaboveisolatedarabic",
  32300. 0xfef5,
  32301. "lamarabic",
  32302. 0x0644,
  32303. "lambda",
  32304. 0x03bb,
  32305. "lambdastroke",
  32306. 0x019b,
  32307. "lamed",
  32308. 0x05dc,
  32309. "lameddagesh",
  32310. 0xfb3c,
  32311. "lameddageshhebrew",
  32312. 0xfb3c,
  32313. "lamedhebrew",
  32314. 0x05dc,
  32315. "lamfinalarabic",
  32316. 0xfede,
  32317. "lamhahinitialarabic",
  32318. 0xfcca,
  32319. "laminitialarabic",
  32320. 0xfedf,
  32321. "lamjeeminitialarabic",
  32322. 0xfcc9,
  32323. "lamkhahinitialarabic",
  32324. 0xfccb,
  32325. "lamlamhehisolatedarabic",
  32326. 0xfdf2,
  32327. "lammedialarabic",
  32328. 0xfee0,
  32329. "lammeemhahinitialarabic",
  32330. 0xfd88,
  32331. "lammeeminitialarabic",
  32332. 0xfccc,
  32333. "largecircle",
  32334. 0x25ef,
  32335. "lbar",
  32336. 0x019a,
  32337. "lbelt",
  32338. 0x026c,
  32339. "lbopomofo",
  32340. 0x310c,
  32341. "lcaron",
  32342. 0x013e,
  32343. "lcedilla",
  32344. 0x013c,
  32345. "lcircle",
  32346. 0x24db,
  32347. "lcircumflexbelow",
  32348. 0x1e3d,
  32349. "lcommaaccent",
  32350. 0x013c,
  32351. "ldot",
  32352. 0x0140,
  32353. "ldotaccent",
  32354. 0x0140,
  32355. "ldotbelow",
  32356. 0x1e37,
  32357. "ldotbelowmacron",
  32358. 0x1e39,
  32359. "leftangleabovecmb",
  32360. 0x031a,
  32361. "lefttackbelowcmb",
  32362. 0x0318,
  32363. "less",
  32364. 0x003c,
  32365. "lessequal",
  32366. 0x2264,
  32367. "lessequalorgreater",
  32368. 0x22da,
  32369. "lessmonospace",
  32370. 0xff1c,
  32371. "lessorequivalent",
  32372. 0x2272,
  32373. "lessorgreater",
  32374. 0x2276,
  32375. "lessoverequal",
  32376. 0x2266,
  32377. "lesssmall",
  32378. 0xfe64,
  32379. "lezh",
  32380. 0x026e,
  32381. "lfblock",
  32382. 0x258c,
  32383. "lhookretroflex",
  32384. 0x026d,
  32385. "lira",
  32386. 0x20a4,
  32387. "liwnarmenian",
  32388. 0x056c,
  32389. "lj",
  32390. 0x01c9,
  32391. "ljecyrillic",
  32392. 0x0459,
  32393. "ll",
  32394. 0xf6c0,
  32395. "lladeva",
  32396. 0x0933,
  32397. "llagujarati",
  32398. 0x0ab3,
  32399. "llinebelow",
  32400. 0x1e3b,
  32401. "llladeva",
  32402. 0x0934,
  32403. "llvocalicbengali",
  32404. 0x09e1,
  32405. "llvocalicdeva",
  32406. 0x0961,
  32407. "llvocalicvowelsignbengali",
  32408. 0x09e3,
  32409. "llvocalicvowelsigndeva",
  32410. 0x0963,
  32411. "lmiddletilde",
  32412. 0x026b,
  32413. "lmonospace",
  32414. 0xff4c,
  32415. "lmsquare",
  32416. 0x33d0,
  32417. "lochulathai",
  32418. 0x0e2c,
  32419. "logicaland",
  32420. 0x2227,
  32421. "logicalnot",
  32422. 0x00ac,
  32423. "logicalnotreversed",
  32424. 0x2310,
  32425. "logicalor",
  32426. 0x2228,
  32427. "lolingthai",
  32428. 0x0e25,
  32429. "longs",
  32430. 0x017f,
  32431. "lowlinecenterline",
  32432. 0xfe4e,
  32433. "lowlinecmb",
  32434. 0x0332,
  32435. "lowlinedashed",
  32436. 0xfe4d,
  32437. "lozenge",
  32438. 0x25ca,
  32439. "lparen",
  32440. 0x24a7,
  32441. "lslash",
  32442. 0x0142,
  32443. "lsquare",
  32444. 0x2113,
  32445. "lsuperior",
  32446. 0xf6ee,
  32447. "ltshade",
  32448. 0x2591,
  32449. "luthai",
  32450. 0x0e26,
  32451. "lvocalicbengali",
  32452. 0x098c,
  32453. "lvocalicdeva",
  32454. 0x090c,
  32455. "lvocalicvowelsignbengali",
  32456. 0x09e2,
  32457. "lvocalicvowelsigndeva",
  32458. 0x0962,
  32459. "lxsquare",
  32460. 0x33d3,
  32461. "m",
  32462. 0x006d,
  32463. "mabengali",
  32464. 0x09ae,
  32465. "macron",
  32466. 0x00af,
  32467. "macronbelowcmb",
  32468. 0x0331,
  32469. "macroncmb",
  32470. 0x0304,
  32471. "macronlowmod",
  32472. 0x02cd,
  32473. "macronmonospace",
  32474. 0xffe3,
  32475. "macute",
  32476. 0x1e3f,
  32477. "madeva",
  32478. 0x092e,
  32479. "magujarati",
  32480. 0x0aae,
  32481. "magurmukhi",
  32482. 0x0a2e,
  32483. "mahapakhhebrew",
  32484. 0x05a4,
  32485. "mahapakhlefthebrew",
  32486. 0x05a4,
  32487. "mahiragana",
  32488. 0x307e,
  32489. "maichattawalowleftthai",
  32490. 0xf895,
  32491. "maichattawalowrightthai",
  32492. 0xf894,
  32493. "maichattawathai",
  32494. 0x0e4b,
  32495. "maichattawaupperleftthai",
  32496. 0xf893,
  32497. "maieklowleftthai",
  32498. 0xf88c,
  32499. "maieklowrightthai",
  32500. 0xf88b,
  32501. "maiekthai",
  32502. 0x0e48,
  32503. "maiekupperleftthai",
  32504. 0xf88a,
  32505. "maihanakatleftthai",
  32506. 0xf884,
  32507. "maihanakatthai",
  32508. 0x0e31,
  32509. "maitaikhuleftthai",
  32510. 0xf889,
  32511. "maitaikhuthai",
  32512. 0x0e47,
  32513. "maitholowleftthai",
  32514. 0xf88f,
  32515. "maitholowrightthai",
  32516. 0xf88e,
  32517. "maithothai",
  32518. 0x0e49,
  32519. "maithoupperleftthai",
  32520. 0xf88d,
  32521. "maitrilowleftthai",
  32522. 0xf892,
  32523. "maitrilowrightthai",
  32524. 0xf891,
  32525. "maitrithai",
  32526. 0x0e4a,
  32527. "maitriupperleftthai",
  32528. 0xf890,
  32529. "maiyamokthai",
  32530. 0x0e46,
  32531. "makatakana",
  32532. 0x30de,
  32533. "makatakanahalfwidth",
  32534. 0xff8f,
  32535. "male",
  32536. 0x2642,
  32537. "mansyonsquare",
  32538. 0x3347,
  32539. "maqafhebrew",
  32540. 0x05be,
  32541. "mars",
  32542. 0x2642,
  32543. "masoracirclehebrew",
  32544. 0x05af,
  32545. "masquare",
  32546. 0x3383,
  32547. "mbopomofo",
  32548. 0x3107,
  32549. "mbsquare",
  32550. 0x33d4,
  32551. "mcircle",
  32552. 0x24dc,
  32553. "mcubedsquare",
  32554. 0x33a5,
  32555. "mdotaccent",
  32556. 0x1e41,
  32557. "mdotbelow",
  32558. 0x1e43,
  32559. "meemarabic",
  32560. 0x0645,
  32561. "meemfinalarabic",
  32562. 0xfee2,
  32563. "meeminitialarabic",
  32564. 0xfee3,
  32565. "meemmedialarabic",
  32566. 0xfee4,
  32567. "meemmeeminitialarabic",
  32568. 0xfcd1,
  32569. "meemmeemisolatedarabic",
  32570. 0xfc48,
  32571. "meetorusquare",
  32572. 0x334d,
  32573. "mehiragana",
  32574. 0x3081,
  32575. "meizierasquare",
  32576. 0x337e,
  32577. "mekatakana",
  32578. 0x30e1,
  32579. "mekatakanahalfwidth",
  32580. 0xff92,
  32581. "mem",
  32582. 0x05de,
  32583. "memdagesh",
  32584. 0xfb3e,
  32585. "memdageshhebrew",
  32586. 0xfb3e,
  32587. "memhebrew",
  32588. 0x05de,
  32589. "menarmenian",
  32590. 0x0574,
  32591. "merkhahebrew",
  32592. 0x05a5,
  32593. "merkhakefulahebrew",
  32594. 0x05a6,
  32595. "merkhakefulalefthebrew",
  32596. 0x05a6,
  32597. "merkhalefthebrew",
  32598. 0x05a5,
  32599. "mhook",
  32600. 0x0271,
  32601. "mhzsquare",
  32602. 0x3392,
  32603. "middledotkatakanahalfwidth",
  32604. 0xff65,
  32605. "middot",
  32606. 0x00b7,
  32607. "mieumacirclekorean",
  32608. 0x3272,
  32609. "mieumaparenkorean",
  32610. 0x3212,
  32611. "mieumcirclekorean",
  32612. 0x3264,
  32613. "mieumkorean",
  32614. 0x3141,
  32615. "mieumpansioskorean",
  32616. 0x3170,
  32617. "mieumparenkorean",
  32618. 0x3204,
  32619. "mieumpieupkorean",
  32620. 0x316e,
  32621. "mieumsioskorean",
  32622. 0x316f,
  32623. "mihiragana",
  32624. 0x307f,
  32625. "mikatakana",
  32626. 0x30df,
  32627. "mikatakanahalfwidth",
  32628. 0xff90,
  32629. "minus",
  32630. 0x2212,
  32631. "minusbelowcmb",
  32632. 0x0320,
  32633. "minuscircle",
  32634. 0x2296,
  32635. "minusmod",
  32636. 0x02d7,
  32637. "minusplus",
  32638. 0x2213,
  32639. "minute",
  32640. 0x2032,
  32641. "miribaarusquare",
  32642. 0x334a,
  32643. "mirisquare",
  32644. 0x3349,
  32645. "mlonglegturned",
  32646. 0x0270,
  32647. "mlsquare",
  32648. 0x3396,
  32649. "mmcubedsquare",
  32650. 0x33a3,
  32651. "mmonospace",
  32652. 0xff4d,
  32653. "mmsquaredsquare",
  32654. 0x339f,
  32655. "mohiragana",
  32656. 0x3082,
  32657. "mohmsquare",
  32658. 0x33c1,
  32659. "mokatakana",
  32660. 0x30e2,
  32661. "mokatakanahalfwidth",
  32662. 0xff93,
  32663. "molsquare",
  32664. 0x33d6,
  32665. "momathai",
  32666. 0x0e21,
  32667. "moverssquare",
  32668. 0x33a7,
  32669. "moverssquaredsquare",
  32670. 0x33a8,
  32671. "mparen",
  32672. 0x24a8,
  32673. "mpasquare",
  32674. 0x33ab,
  32675. "mssquare",
  32676. 0x33b3,
  32677. "msuperior",
  32678. 0xf6ef,
  32679. "mturned",
  32680. 0x026f,
  32681. "mu",
  32682. 0x00b5,
  32683. "mu1",
  32684. 0x00b5,
  32685. "muasquare",
  32686. 0x3382,
  32687. "muchgreater",
  32688. 0x226b,
  32689. "muchless",
  32690. 0x226a,
  32691. "mufsquare",
  32692. 0x338c,
  32693. "mugreek",
  32694. 0x03bc,
  32695. "mugsquare",
  32696. 0x338d,
  32697. "muhiragana",
  32698. 0x3080,
  32699. "mukatakana",
  32700. 0x30e0,
  32701. "mukatakanahalfwidth",
  32702. 0xff91,
  32703. "mulsquare",
  32704. 0x3395,
  32705. "multiply",
  32706. 0x00d7,
  32707. "mumsquare",
  32708. 0x339b,
  32709. "munahhebrew",
  32710. 0x05a3,
  32711. "munahlefthebrew",
  32712. 0x05a3,
  32713. "musicalnote",
  32714. 0x266a,
  32715. "musicalnotedbl",
  32716. 0x266b,
  32717. "musicflatsign",
  32718. 0x266d,
  32719. "musicsharpsign",
  32720. 0x266f,
  32721. "mussquare",
  32722. 0x33b2,
  32723. "muvsquare",
  32724. 0x33b6,
  32725. "muwsquare",
  32726. 0x33bc,
  32727. "mvmegasquare",
  32728. 0x33b9,
  32729. "mvsquare",
  32730. 0x33b7,
  32731. "mwmegasquare",
  32732. 0x33bf,
  32733. "mwsquare",
  32734. 0x33bd,
  32735. "n",
  32736. 0x006e,
  32737. "nabengali",
  32738. 0x09a8,
  32739. "nabla",
  32740. 0x2207,
  32741. "nacute",
  32742. 0x0144,
  32743. "nadeva",
  32744. 0x0928,
  32745. "nagujarati",
  32746. 0x0aa8,
  32747. "nagurmukhi",
  32748. 0x0a28,
  32749. "nahiragana",
  32750. 0x306a,
  32751. "nakatakana",
  32752. 0x30ca,
  32753. "nakatakanahalfwidth",
  32754. 0xff85,
  32755. "napostrophe",
  32756. 0x0149,
  32757. "nasquare",
  32758. 0x3381,
  32759. "nbopomofo",
  32760. 0x310b,
  32761. "nbspace",
  32762. 0x00a0,
  32763. "ncaron",
  32764. 0x0148,
  32765. "ncedilla",
  32766. 0x0146,
  32767. "ncircle",
  32768. 0x24dd,
  32769. "ncircumflexbelow",
  32770. 0x1e4b,
  32771. "ncommaaccent",
  32772. 0x0146,
  32773. "ndotaccent",
  32774. 0x1e45,
  32775. "ndotbelow",
  32776. 0x1e47,
  32777. "nehiragana",
  32778. 0x306d,
  32779. "nekatakana",
  32780. 0x30cd,
  32781. "nekatakanahalfwidth",
  32782. 0xff88,
  32783. "newsheqelsign",
  32784. 0x20aa,
  32785. "nfsquare",
  32786. 0x338b,
  32787. "ngabengali",
  32788. 0x0999,
  32789. "ngadeva",
  32790. 0x0919,
  32791. "ngagujarati",
  32792. 0x0a99,
  32793. "ngagurmukhi",
  32794. 0x0a19,
  32795. "ngonguthai",
  32796. 0x0e07,
  32797. "nhiragana",
  32798. 0x3093,
  32799. "nhookleft",
  32800. 0x0272,
  32801. "nhookretroflex",
  32802. 0x0273,
  32803. "nieunacirclekorean",
  32804. 0x326f,
  32805. "nieunaparenkorean",
  32806. 0x320f,
  32807. "nieuncieuckorean",
  32808. 0x3135,
  32809. "nieuncirclekorean",
  32810. 0x3261,
  32811. "nieunhieuhkorean",
  32812. 0x3136,
  32813. "nieunkorean",
  32814. 0x3134,
  32815. "nieunpansioskorean",
  32816. 0x3168,
  32817. "nieunparenkorean",
  32818. 0x3201,
  32819. "nieunsioskorean",
  32820. 0x3167,
  32821. "nieuntikeutkorean",
  32822. 0x3166,
  32823. "nihiragana",
  32824. 0x306b,
  32825. "nikatakana",
  32826. 0x30cb,
  32827. "nikatakanahalfwidth",
  32828. 0xff86,
  32829. "nikhahitleftthai",
  32830. 0xf899,
  32831. "nikhahitthai",
  32832. 0x0e4d,
  32833. "nine",
  32834. 0x0039,
  32835. "ninearabic",
  32836. 0x0669,
  32837. "ninebengali",
  32838. 0x09ef,
  32839. "ninecircle",
  32840. 0x2468,
  32841. "ninecircleinversesansserif",
  32842. 0x2792,
  32843. "ninedeva",
  32844. 0x096f,
  32845. "ninegujarati",
  32846. 0x0aef,
  32847. "ninegurmukhi",
  32848. 0x0a6f,
  32849. "ninehackarabic",
  32850. 0x0669,
  32851. "ninehangzhou",
  32852. 0x3029,
  32853. "nineideographicparen",
  32854. 0x3228,
  32855. "nineinferior",
  32856. 0x2089,
  32857. "ninemonospace",
  32858. 0xff19,
  32859. "nineoldstyle",
  32860. 0xf739,
  32861. "nineparen",
  32862. 0x247c,
  32863. "nineperiod",
  32864. 0x2490,
  32865. "ninepersian",
  32866. 0x06f9,
  32867. "nineroman",
  32868. 0x2178,
  32869. "ninesuperior",
  32870. 0x2079,
  32871. "nineteencircle",
  32872. 0x2472,
  32873. "nineteenparen",
  32874. 0x2486,
  32875. "nineteenperiod",
  32876. 0x249a,
  32877. "ninethai",
  32878. 0x0e59,
  32879. "nj",
  32880. 0x01cc,
  32881. "njecyrillic",
  32882. 0x045a,
  32883. "nkatakana",
  32884. 0x30f3,
  32885. "nkatakanahalfwidth",
  32886. 0xff9d,
  32887. "nlegrightlong",
  32888. 0x019e,
  32889. "nlinebelow",
  32890. 0x1e49,
  32891. "nmonospace",
  32892. 0xff4e,
  32893. "nmsquare",
  32894. 0x339a,
  32895. "nnabengali",
  32896. 0x09a3,
  32897. "nnadeva",
  32898. 0x0923,
  32899. "nnagujarati",
  32900. 0x0aa3,
  32901. "nnagurmukhi",
  32902. 0x0a23,
  32903. "nnnadeva",
  32904. 0x0929,
  32905. "nohiragana",
  32906. 0x306e,
  32907. "nokatakana",
  32908. 0x30ce,
  32909. "nokatakanahalfwidth",
  32910. 0xff89,
  32911. "nonbreakingspace",
  32912. 0x00a0,
  32913. "nonenthai",
  32914. 0x0e13,
  32915. "nonuthai",
  32916. 0x0e19,
  32917. "noonarabic",
  32918. 0x0646,
  32919. "noonfinalarabic",
  32920. 0xfee6,
  32921. "noonghunnaarabic",
  32922. 0x06ba,
  32923. "noonghunnafinalarabic",
  32924. 0xfb9f,
  32925. "nooninitialarabic",
  32926. 0xfee7,
  32927. "noonjeeminitialarabic",
  32928. 0xfcd2,
  32929. "noonjeemisolatedarabic",
  32930. 0xfc4b,
  32931. "noonmedialarabic",
  32932. 0xfee8,
  32933. "noonmeeminitialarabic",
  32934. 0xfcd5,
  32935. "noonmeemisolatedarabic",
  32936. 0xfc4e,
  32937. "noonnoonfinalarabic",
  32938. 0xfc8d,
  32939. "notcontains",
  32940. 0x220c,
  32941. "notelement",
  32942. 0x2209,
  32943. "notelementof",
  32944. 0x2209,
  32945. "notequal",
  32946. 0x2260,
  32947. "notgreater",
  32948. 0x226f,
  32949. "notgreaternorequal",
  32950. 0x2271,
  32951. "notgreaternorless",
  32952. 0x2279,
  32953. "notidentical",
  32954. 0x2262,
  32955. "notless",
  32956. 0x226e,
  32957. "notlessnorequal",
  32958. 0x2270,
  32959. "notparallel",
  32960. 0x2226,
  32961. "notprecedes",
  32962. 0x2280,
  32963. "notsubset",
  32964. 0x2284,
  32965. "notsucceeds",
  32966. 0x2281,
  32967. "notsuperset",
  32968. 0x2285,
  32969. "nowarmenian",
  32970. 0x0576,
  32971. "nparen",
  32972. 0x24a9,
  32973. "nssquare",
  32974. 0x33b1,
  32975. "nsuperior",
  32976. 0x207f,
  32977. "ntilde",
  32978. 0x00f1,
  32979. "nu",
  32980. 0x03bd,
  32981. "nuhiragana",
  32982. 0x306c,
  32983. "nukatakana",
  32984. 0x30cc,
  32985. "nukatakanahalfwidth",
  32986. 0xff87,
  32987. "nuktabengali",
  32988. 0x09bc,
  32989. "nuktadeva",
  32990. 0x093c,
  32991. "nuktagujarati",
  32992. 0x0abc,
  32993. "nuktagurmukhi",
  32994. 0x0a3c,
  32995. "numbersign",
  32996. 0x0023,
  32997. "numbersignmonospace",
  32998. 0xff03,
  32999. "numbersignsmall",
  33000. 0xfe5f,
  33001. "numeralsigngreek",
  33002. 0x0374,
  33003. "numeralsignlowergreek",
  33004. 0x0375,
  33005. "numero",
  33006. 0x2116,
  33007. "nun",
  33008. 0x05e0,
  33009. "nundagesh",
  33010. 0xfb40,
  33011. "nundageshhebrew",
  33012. 0xfb40,
  33013. "nunhebrew",
  33014. 0x05e0,
  33015. "nvsquare",
  33016. 0x33b5,
  33017. "nwsquare",
  33018. 0x33bb,
  33019. "nyabengali",
  33020. 0x099e,
  33021. "nyadeva",
  33022. 0x091e,
  33023. "nyagujarati",
  33024. 0x0a9e,
  33025. "nyagurmukhi",
  33026. 0x0a1e,
  33027. "o",
  33028. 0x006f,
  33029. "oacute",
  33030. 0x00f3,
  33031. "oangthai",
  33032. 0x0e2d,
  33033. "obarred",
  33034. 0x0275,
  33035. "obarredcyrillic",
  33036. 0x04e9,
  33037. "obarreddieresiscyrillic",
  33038. 0x04eb,
  33039. "obengali",
  33040. 0x0993,
  33041. "obopomofo",
  33042. 0x311b,
  33043. "obreve",
  33044. 0x014f,
  33045. "ocandradeva",
  33046. 0x0911,
  33047. "ocandragujarati",
  33048. 0x0a91,
  33049. "ocandravowelsigndeva",
  33050. 0x0949,
  33051. "ocandravowelsigngujarati",
  33052. 0x0ac9,
  33053. "ocaron",
  33054. 0x01d2,
  33055. "ocircle",
  33056. 0x24de,
  33057. "ocircumflex",
  33058. 0x00f4,
  33059. "ocircumflexacute",
  33060. 0x1ed1,
  33061. "ocircumflexdotbelow",
  33062. 0x1ed9,
  33063. "ocircumflexgrave",
  33064. 0x1ed3,
  33065. "ocircumflexhookabove",
  33066. 0x1ed5,
  33067. "ocircumflextilde",
  33068. 0x1ed7,
  33069. "ocyrillic",
  33070. 0x043e,
  33071. "odblacute",
  33072. 0x0151,
  33073. "odblgrave",
  33074. 0x020d,
  33075. "odeva",
  33076. 0x0913,
  33077. "odieresis",
  33078. 0x00f6,
  33079. "odieresiscyrillic",
  33080. 0x04e7,
  33081. "odotbelow",
  33082. 0x1ecd,
  33083. "oe",
  33084. 0x0153,
  33085. "oekorean",
  33086. 0x315a,
  33087. "ogonek",
  33088. 0x02db,
  33089. "ogonekcmb",
  33090. 0x0328,
  33091. "ograve",
  33092. 0x00f2,
  33093. "ogujarati",
  33094. 0x0a93,
  33095. "oharmenian",
  33096. 0x0585,
  33097. "ohiragana",
  33098. 0x304a,
  33099. "ohookabove",
  33100. 0x1ecf,
  33101. "ohorn",
  33102. 0x01a1,
  33103. "ohornacute",
  33104. 0x1edb,
  33105. "ohorndotbelow",
  33106. 0x1ee3,
  33107. "ohorngrave",
  33108. 0x1edd,
  33109. "ohornhookabove",
  33110. 0x1edf,
  33111. "ohorntilde",
  33112. 0x1ee1,
  33113. "ohungarumlaut",
  33114. 0x0151,
  33115. "oi",
  33116. 0x01a3,
  33117. "oinvertedbreve",
  33118. 0x020f,
  33119. "okatakana",
  33120. 0x30aa,
  33121. "okatakanahalfwidth",
  33122. 0xff75,
  33123. "okorean",
  33124. 0x3157,
  33125. "olehebrew",
  33126. 0x05ab,
  33127. "omacron",
  33128. 0x014d,
  33129. "omacronacute",
  33130. 0x1e53,
  33131. "omacrongrave",
  33132. 0x1e51,
  33133. "omdeva",
  33134. 0x0950,
  33135. "omega",
  33136. 0x03c9,
  33137. "omega1",
  33138. 0x03d6,
  33139. "omegacyrillic",
  33140. 0x0461,
  33141. "omegalatinclosed",
  33142. 0x0277,
  33143. "omegaroundcyrillic",
  33144. 0x047b,
  33145. "omegatitlocyrillic",
  33146. 0x047d,
  33147. "omegatonos",
  33148. 0x03ce,
  33149. "omgujarati",
  33150. 0x0ad0,
  33151. "omicron",
  33152. 0x03bf,
  33153. "omicrontonos",
  33154. 0x03cc,
  33155. "omonospace",
  33156. 0xff4f,
  33157. "one",
  33158. 0x0031,
  33159. "onearabic",
  33160. 0x0661,
  33161. "onebengali",
  33162. 0x09e7,
  33163. "onecircle",
  33164. 0x2460,
  33165. "onecircleinversesansserif",
  33166. 0x278a,
  33167. "onedeva",
  33168. 0x0967,
  33169. "onedotenleader",
  33170. 0x2024,
  33171. "oneeighth",
  33172. 0x215b,
  33173. "onefitted",
  33174. 0xf6dc,
  33175. "onegujarati",
  33176. 0x0ae7,
  33177. "onegurmukhi",
  33178. 0x0a67,
  33179. "onehackarabic",
  33180. 0x0661,
  33181. "onehalf",
  33182. 0x00bd,
  33183. "onehangzhou",
  33184. 0x3021,
  33185. "oneideographicparen",
  33186. 0x3220,
  33187. "oneinferior",
  33188. 0x2081,
  33189. "onemonospace",
  33190. 0xff11,
  33191. "onenumeratorbengali",
  33192. 0x09f4,
  33193. "oneoldstyle",
  33194. 0xf731,
  33195. "oneparen",
  33196. 0x2474,
  33197. "oneperiod",
  33198. 0x2488,
  33199. "onepersian",
  33200. 0x06f1,
  33201. "onequarter",
  33202. 0x00bc,
  33203. "oneroman",
  33204. 0x2170,
  33205. "onesuperior",
  33206. 0x00b9,
  33207. "onethai",
  33208. 0x0e51,
  33209. "onethird",
  33210. 0x2153,
  33211. "oogonek",
  33212. 0x01eb,
  33213. "oogonekmacron",
  33214. 0x01ed,
  33215. "oogurmukhi",
  33216. 0x0a13,
  33217. "oomatragurmukhi",
  33218. 0x0a4b,
  33219. "oopen",
  33220. 0x0254,
  33221. "oparen",
  33222. 0x24aa,
  33223. "openbullet",
  33224. 0x25e6,
  33225. "option",
  33226. 0x2325,
  33227. "ordfeminine",
  33228. 0x00aa,
  33229. "ordmasculine",
  33230. 0x00ba,
  33231. "orthogonal",
  33232. 0x221f,
  33233. "oshortdeva",
  33234. 0x0912,
  33235. "oshortvowelsigndeva",
  33236. 0x094a,
  33237. "oslash",
  33238. 0x00f8,
  33239. "oslashacute",
  33240. 0x01ff,
  33241. "osmallhiragana",
  33242. 0x3049,
  33243. "osmallkatakana",
  33244. 0x30a9,
  33245. "osmallkatakanahalfwidth",
  33246. 0xff6b,
  33247. "ostrokeacute",
  33248. 0x01ff,
  33249. "osuperior",
  33250. 0xf6f0,
  33251. "otcyrillic",
  33252. 0x047f,
  33253. "otilde",
  33254. 0x00f5,
  33255. "otildeacute",
  33256. 0x1e4d,
  33257. "otildedieresis",
  33258. 0x1e4f,
  33259. "oubopomofo",
  33260. 0x3121,
  33261. "overline",
  33262. 0x203e,
  33263. "overlinecenterline",
  33264. 0xfe4a,
  33265. "overlinecmb",
  33266. 0x0305,
  33267. "overlinedashed",
  33268. 0xfe49,
  33269. "overlinedblwavy",
  33270. 0xfe4c,
  33271. "overlinewavy",
  33272. 0xfe4b,
  33273. "overscore",
  33274. 0x00af,
  33275. "ovowelsignbengali",
  33276. 0x09cb,
  33277. "ovowelsigndeva",
  33278. 0x094b,
  33279. "ovowelsigngujarati",
  33280. 0x0acb,
  33281. "p",
  33282. 0x0070,
  33283. "paampssquare",
  33284. 0x3380,
  33285. "paasentosquare",
  33286. 0x332b,
  33287. "pabengali",
  33288. 0x09aa,
  33289. "pacute",
  33290. 0x1e55,
  33291. "padeva",
  33292. 0x092a,
  33293. "pagedown",
  33294. 0x21df,
  33295. "pageup",
  33296. 0x21de,
  33297. "pagujarati",
  33298. 0x0aaa,
  33299. "pagurmukhi",
  33300. 0x0a2a,
  33301. "pahiragana",
  33302. 0x3071,
  33303. "paiyannoithai",
  33304. 0x0e2f,
  33305. "pakatakana",
  33306. 0x30d1,
  33307. "palatalizationcyrilliccmb",
  33308. 0x0484,
  33309. "palochkacyrillic",
  33310. 0x04c0,
  33311. "pansioskorean",
  33312. 0x317f,
  33313. "paragraph",
  33314. 0x00b6,
  33315. "parallel",
  33316. 0x2225,
  33317. "parenleft",
  33318. 0x0028,
  33319. "parenleftaltonearabic",
  33320. 0xfd3e,
  33321. "parenleftbt",
  33322. 0xf8ed,
  33323. "parenleftex",
  33324. 0xf8ec,
  33325. "parenleftinferior",
  33326. 0x208d,
  33327. "parenleftmonospace",
  33328. 0xff08,
  33329. "parenleftsmall",
  33330. 0xfe59,
  33331. "parenleftsuperior",
  33332. 0x207d,
  33333. "parenlefttp",
  33334. 0xf8eb,
  33335. "parenleftvertical",
  33336. 0xfe35,
  33337. "parenright",
  33338. 0x0029,
  33339. "parenrightaltonearabic",
  33340. 0xfd3f,
  33341. "parenrightbt",
  33342. 0xf8f8,
  33343. "parenrightex",
  33344. 0xf8f7,
  33345. "parenrightinferior",
  33346. 0x208e,
  33347. "parenrightmonospace",
  33348. 0xff09,
  33349. "parenrightsmall",
  33350. 0xfe5a,
  33351. "parenrightsuperior",
  33352. 0x207e,
  33353. "parenrighttp",
  33354. 0xf8f6,
  33355. "parenrightvertical",
  33356. 0xfe36,
  33357. "partialdiff",
  33358. 0x2202,
  33359. "paseqhebrew",
  33360. 0x05c0,
  33361. "pashtahebrew",
  33362. 0x0599,
  33363. "pasquare",
  33364. 0x33a9,
  33365. "patah",
  33366. 0x05b7,
  33367. "patah11",
  33368. 0x05b7,
  33369. "patah1d",
  33370. 0x05b7,
  33371. "patah2a",
  33372. 0x05b7,
  33373. "patahhebrew",
  33374. 0x05b7,
  33375. "patahnarrowhebrew",
  33376. 0x05b7,
  33377. "patahquarterhebrew",
  33378. 0x05b7,
  33379. "patahwidehebrew",
  33380. 0x05b7,
  33381. "pazerhebrew",
  33382. 0x05a1,
  33383. "pbopomofo",
  33384. 0x3106,
  33385. "pcircle",
  33386. 0x24df,
  33387. "pdotaccent",
  33388. 0x1e57,
  33389. "pe",
  33390. 0x05e4,
  33391. "pecyrillic",
  33392. 0x043f,
  33393. "pedagesh",
  33394. 0xfb44,
  33395. "pedageshhebrew",
  33396. 0xfb44,
  33397. "peezisquare",
  33398. 0x333b,
  33399. "pefinaldageshhebrew",
  33400. 0xfb43,
  33401. "peharabic",
  33402. 0x067e,
  33403. "peharmenian",
  33404. 0x057a,
  33405. "pehebrew",
  33406. 0x05e4,
  33407. "pehfinalarabic",
  33408. 0xfb57,
  33409. "pehinitialarabic",
  33410. 0xfb58,
  33411. "pehiragana",
  33412. 0x307a,
  33413. "pehmedialarabic",
  33414. 0xfb59,
  33415. "pekatakana",
  33416. 0x30da,
  33417. "pemiddlehookcyrillic",
  33418. 0x04a7,
  33419. "perafehebrew",
  33420. 0xfb4e,
  33421. "percent",
  33422. 0x0025,
  33423. "percentarabic",
  33424. 0x066a,
  33425. "percentmonospace",
  33426. 0xff05,
  33427. "percentsmall",
  33428. 0xfe6a,
  33429. "period",
  33430. 0x002e,
  33431. "periodarmenian",
  33432. 0x0589,
  33433. "periodcentered",
  33434. 0x00b7,
  33435. "periodhalfwidth",
  33436. 0xff61,
  33437. "periodinferior",
  33438. 0xf6e7,
  33439. "periodmonospace",
  33440. 0xff0e,
  33441. "periodsmall",
  33442. 0xfe52,
  33443. "periodsuperior",
  33444. 0xf6e8,
  33445. "perispomenigreekcmb",
  33446. 0x0342,
  33447. "perpendicular",
  33448. 0x22a5,
  33449. "perthousand",
  33450. 0x2030,
  33451. "peseta",
  33452. 0x20a7,
  33453. "pfsquare",
  33454. 0x338a,
  33455. "phabengali",
  33456. 0x09ab,
  33457. "phadeva",
  33458. 0x092b,
  33459. "phagujarati",
  33460. 0x0aab,
  33461. "phagurmukhi",
  33462. 0x0a2b,
  33463. "phi",
  33464. 0x03c6,
  33465. "phi1",
  33466. 0x03d5,
  33467. "phieuphacirclekorean",
  33468. 0x327a,
  33469. "phieuphaparenkorean",
  33470. 0x321a,
  33471. "phieuphcirclekorean",
  33472. 0x326c,
  33473. "phieuphkorean",
  33474. 0x314d,
  33475. "phieuphparenkorean",
  33476. 0x320c,
  33477. "philatin",
  33478. 0x0278,
  33479. "phinthuthai",
  33480. 0x0e3a,
  33481. "phisymbolgreek",
  33482. 0x03d5,
  33483. "phook",
  33484. 0x01a5,
  33485. "phophanthai",
  33486. 0x0e1e,
  33487. "phophungthai",
  33488. 0x0e1c,
  33489. "phosamphaothai",
  33490. 0x0e20,
  33491. "pi",
  33492. 0x03c0,
  33493. "pieupacirclekorean",
  33494. 0x3273,
  33495. "pieupaparenkorean",
  33496. 0x3213,
  33497. "pieupcieuckorean",
  33498. 0x3176,
  33499. "pieupcirclekorean",
  33500. 0x3265,
  33501. "pieupkiyeokkorean",
  33502. 0x3172,
  33503. "pieupkorean",
  33504. 0x3142,
  33505. "pieupparenkorean",
  33506. 0x3205,
  33507. "pieupsioskiyeokkorean",
  33508. 0x3174,
  33509. "pieupsioskorean",
  33510. 0x3144,
  33511. "pieupsiostikeutkorean",
  33512. 0x3175,
  33513. "pieupthieuthkorean",
  33514. 0x3177,
  33515. "pieuptikeutkorean",
  33516. 0x3173,
  33517. "pihiragana",
  33518. 0x3074,
  33519. "pikatakana",
  33520. 0x30d4,
  33521. "pisymbolgreek",
  33522. 0x03d6,
  33523. "piwrarmenian",
  33524. 0x0583,
  33525. "plus",
  33526. 0x002b,
  33527. "plusbelowcmb",
  33528. 0x031f,
  33529. "pluscircle",
  33530. 0x2295,
  33531. "plusminus",
  33532. 0x00b1,
  33533. "plusmod",
  33534. 0x02d6,
  33535. "plusmonospace",
  33536. 0xff0b,
  33537. "plussmall",
  33538. 0xfe62,
  33539. "plussuperior",
  33540. 0x207a,
  33541. "pmonospace",
  33542. 0xff50,
  33543. "pmsquare",
  33544. 0x33d8,
  33545. "pohiragana",
  33546. 0x307d,
  33547. "pointingindexdownwhite",
  33548. 0x261f,
  33549. "pointingindexleftwhite",
  33550. 0x261c,
  33551. "pointingindexrightwhite",
  33552. 0x261e,
  33553. "pointingindexupwhite",
  33554. 0x261d,
  33555. "pokatakana",
  33556. 0x30dd,
  33557. "poplathai",
  33558. 0x0e1b,
  33559. "postalmark",
  33560. 0x3012,
  33561. "postalmarkface",
  33562. 0x3020,
  33563. "pparen",
  33564. 0x24ab,
  33565. "precedes",
  33566. 0x227a,
  33567. "prescription",
  33568. 0x211e,
  33569. "primemod",
  33570. 0x02b9,
  33571. "primereversed",
  33572. 0x2035,
  33573. "product",
  33574. 0x220f,
  33575. "projective",
  33576. 0x2305,
  33577. "prolongedkana",
  33578. 0x30fc,
  33579. "propellor",
  33580. 0x2318,
  33581. "propersubset",
  33582. 0x2282,
  33583. "propersuperset",
  33584. 0x2283,
  33585. "proportion",
  33586. 0x2237,
  33587. "proportional",
  33588. 0x221d,
  33589. "psi",
  33590. 0x03c8,
  33591. "psicyrillic",
  33592. 0x0471,
  33593. "psilipneumatacyrilliccmb",
  33594. 0x0486,
  33595. "pssquare",
  33596. 0x33b0,
  33597. "puhiragana",
  33598. 0x3077,
  33599. "pukatakana",
  33600. 0x30d7,
  33601. "pvsquare",
  33602. 0x33b4,
  33603. "pwsquare",
  33604. 0x33ba,
  33605. "q",
  33606. 0x0071,
  33607. "qadeva",
  33608. 0x0958,
  33609. "qadmahebrew",
  33610. 0x05a8,
  33611. "qafarabic",
  33612. 0x0642,
  33613. "qaffinalarabic",
  33614. 0xfed6,
  33615. "qafinitialarabic",
  33616. 0xfed7,
  33617. "qafmedialarabic",
  33618. 0xfed8,
  33619. "qamats",
  33620. 0x05b8,
  33621. "qamats10",
  33622. 0x05b8,
  33623. "qamats1a",
  33624. 0x05b8,
  33625. "qamats1c",
  33626. 0x05b8,
  33627. "qamats27",
  33628. 0x05b8,
  33629. "qamats29",
  33630. 0x05b8,
  33631. "qamats33",
  33632. 0x05b8,
  33633. "qamatsde",
  33634. 0x05b8,
  33635. "qamatshebrew",
  33636. 0x05b8,
  33637. "qamatsnarrowhebrew",
  33638. 0x05b8,
  33639. "qamatsqatanhebrew",
  33640. 0x05b8,
  33641. "qamatsqatannarrowhebrew",
  33642. 0x05b8,
  33643. "qamatsqatanquarterhebrew",
  33644. 0x05b8,
  33645. "qamatsqatanwidehebrew",
  33646. 0x05b8,
  33647. "qamatsquarterhebrew",
  33648. 0x05b8,
  33649. "qamatswidehebrew",
  33650. 0x05b8,
  33651. "qarneyparahebrew",
  33652. 0x059f,
  33653. "qbopomofo",
  33654. 0x3111,
  33655. "qcircle",
  33656. 0x24e0,
  33657. "qhook",
  33658. 0x02a0,
  33659. "qmonospace",
  33660. 0xff51,
  33661. "qof",
  33662. 0x05e7,
  33663. "qofdagesh",
  33664. 0xfb47,
  33665. "qofdageshhebrew",
  33666. 0xfb47,
  33667. "qofhebrew",
  33668. 0x05e7,
  33669. "qparen",
  33670. 0x24ac,
  33671. "quarternote",
  33672. 0x2669,
  33673. "qubuts",
  33674. 0x05bb,
  33675. "qubuts18",
  33676. 0x05bb,
  33677. "qubuts25",
  33678. 0x05bb,
  33679. "qubuts31",
  33680. 0x05bb,
  33681. "qubutshebrew",
  33682. 0x05bb,
  33683. "qubutsnarrowhebrew",
  33684. 0x05bb,
  33685. "qubutsquarterhebrew",
  33686. 0x05bb,
  33687. "qubutswidehebrew",
  33688. 0x05bb,
  33689. "question",
  33690. 0x003f,
  33691. "questionarabic",
  33692. 0x061f,
  33693. "questionarmenian",
  33694. 0x055e,
  33695. "questiondown",
  33696. 0x00bf,
  33697. "questiondownsmall",
  33698. 0xf7bf,
  33699. "questiongreek",
  33700. 0x037e,
  33701. "questionmonospace",
  33702. 0xff1f,
  33703. "questionsmall",
  33704. 0xf73f,
  33705. "quotedbl",
  33706. 0x0022,
  33707. "quotedblbase",
  33708. 0x201e,
  33709. "quotedblleft",
  33710. 0x201c,
  33711. "quotedblmonospace",
  33712. 0xff02,
  33713. "quotedblprime",
  33714. 0x301e,
  33715. "quotedblprimereversed",
  33716. 0x301d,
  33717. "quotedblright",
  33718. 0x201d,
  33719. "quoteleft",
  33720. 0x2018,
  33721. "quoteleftreversed",
  33722. 0x201b,
  33723. "quotereversed",
  33724. 0x201b,
  33725. "quoteright",
  33726. 0x2019,
  33727. "quoterightn",
  33728. 0x0149,
  33729. "quotesinglbase",
  33730. 0x201a,
  33731. "quotesingle",
  33732. 0x0027,
  33733. "quotesinglemonospace",
  33734. 0xff07,
  33735. "r",
  33736. 0x0072,
  33737. "raarmenian",
  33738. 0x057c,
  33739. "rabengali",
  33740. 0x09b0,
  33741. "racute",
  33742. 0x0155,
  33743. "radeva",
  33744. 0x0930,
  33745. "radical",
  33746. 0x221a,
  33747. "radicalex",
  33748. 0xf8e5,
  33749. "radoverssquare",
  33750. 0x33ae,
  33751. "radoverssquaredsquare",
  33752. 0x33af,
  33753. "radsquare",
  33754. 0x33ad,
  33755. "rafe",
  33756. 0x05bf,
  33757. "rafehebrew",
  33758. 0x05bf,
  33759. "ragujarati",
  33760. 0x0ab0,
  33761. "ragurmukhi",
  33762. 0x0a30,
  33763. "rahiragana",
  33764. 0x3089,
  33765. "rakatakana",
  33766. 0x30e9,
  33767. "rakatakanahalfwidth",
  33768. 0xff97,
  33769. "ralowerdiagonalbengali",
  33770. 0x09f1,
  33771. "ramiddlediagonalbengali",
  33772. 0x09f0,
  33773. "ramshorn",
  33774. 0x0264,
  33775. "ratio",
  33776. 0x2236,
  33777. "rbopomofo",
  33778. 0x3116,
  33779. "rcaron",
  33780. 0x0159,
  33781. "rcedilla",
  33782. 0x0157,
  33783. "rcircle",
  33784. 0x24e1,
  33785. "rcommaaccent",
  33786. 0x0157,
  33787. "rdblgrave",
  33788. 0x0211,
  33789. "rdotaccent",
  33790. 0x1e59,
  33791. "rdotbelow",
  33792. 0x1e5b,
  33793. "rdotbelowmacron",
  33794. 0x1e5d,
  33795. "referencemark",
  33796. 0x203b,
  33797. "reflexsubset",
  33798. 0x2286,
  33799. "reflexsuperset",
  33800. 0x2287,
  33801. "registered",
  33802. 0x00ae,
  33803. "registersans",
  33804. 0xf8e8,
  33805. "registerserif",
  33806. 0xf6da,
  33807. "reharabic",
  33808. 0x0631,
  33809. "reharmenian",
  33810. 0x0580,
  33811. "rehfinalarabic",
  33812. 0xfeae,
  33813. "rehiragana",
  33814. 0x308c,
  33815. "rekatakana",
  33816. 0x30ec,
  33817. "rekatakanahalfwidth",
  33818. 0xff9a,
  33819. "resh",
  33820. 0x05e8,
  33821. "reshdageshhebrew",
  33822. 0xfb48,
  33823. "reshhebrew",
  33824. 0x05e8,
  33825. "reversedtilde",
  33826. 0x223d,
  33827. "reviahebrew",
  33828. 0x0597,
  33829. "reviamugrashhebrew",
  33830. 0x0597,
  33831. "revlogicalnot",
  33832. 0x2310,
  33833. "rfishhook",
  33834. 0x027e,
  33835. "rfishhookreversed",
  33836. 0x027f,
  33837. "rhabengali",
  33838. 0x09dd,
  33839. "rhadeva",
  33840. 0x095d,
  33841. "rho",
  33842. 0x03c1,
  33843. "rhook",
  33844. 0x027d,
  33845. "rhookturned",
  33846. 0x027b,
  33847. "rhookturnedsuperior",
  33848. 0x02b5,
  33849. "rhosymbolgreek",
  33850. 0x03f1,
  33851. "rhotichookmod",
  33852. 0x02de,
  33853. "rieulacirclekorean",
  33854. 0x3271,
  33855. "rieulaparenkorean",
  33856. 0x3211,
  33857. "rieulcirclekorean",
  33858. 0x3263,
  33859. "rieulhieuhkorean",
  33860. 0x3140,
  33861. "rieulkiyeokkorean",
  33862. 0x313a,
  33863. "rieulkiyeoksioskorean",
  33864. 0x3169,
  33865. "rieulkorean",
  33866. 0x3139,
  33867. "rieulmieumkorean",
  33868. 0x313b,
  33869. "rieulpansioskorean",
  33870. 0x316c,
  33871. "rieulparenkorean",
  33872. 0x3203,
  33873. "rieulphieuphkorean",
  33874. 0x313f,
  33875. "rieulpieupkorean",
  33876. 0x313c,
  33877. "rieulpieupsioskorean",
  33878. 0x316b,
  33879. "rieulsioskorean",
  33880. 0x313d,
  33881. "rieulthieuthkorean",
  33882. 0x313e,
  33883. "rieultikeutkorean",
  33884. 0x316a,
  33885. "rieulyeorinhieuhkorean",
  33886. 0x316d,
  33887. "rightangle",
  33888. 0x221f,
  33889. "righttackbelowcmb",
  33890. 0x0319,
  33891. "righttriangle",
  33892. 0x22bf,
  33893. "rihiragana",
  33894. 0x308a,
  33895. "rikatakana",
  33896. 0x30ea,
  33897. "rikatakanahalfwidth",
  33898. 0xff98,
  33899. "ring",
  33900. 0x02da,
  33901. "ringbelowcmb",
  33902. 0x0325,
  33903. "ringcmb",
  33904. 0x030a,
  33905. "ringhalfleft",
  33906. 0x02bf,
  33907. "ringhalfleftarmenian",
  33908. 0x0559,
  33909. "ringhalfleftbelowcmb",
  33910. 0x031c,
  33911. "ringhalfleftcentered",
  33912. 0x02d3,
  33913. "ringhalfright",
  33914. 0x02be,
  33915. "ringhalfrightbelowcmb",
  33916. 0x0339,
  33917. "ringhalfrightcentered",
  33918. 0x02d2,
  33919. "rinvertedbreve",
  33920. 0x0213,
  33921. "rittorusquare",
  33922. 0x3351,
  33923. "rlinebelow",
  33924. 0x1e5f,
  33925. "rlongleg",
  33926. 0x027c,
  33927. "rlonglegturned",
  33928. 0x027a,
  33929. "rmonospace",
  33930. 0xff52,
  33931. "rohiragana",
  33932. 0x308d,
  33933. "rokatakana",
  33934. 0x30ed,
  33935. "rokatakanahalfwidth",
  33936. 0xff9b,
  33937. "roruathai",
  33938. 0x0e23,
  33939. "rparen",
  33940. 0x24ad,
  33941. "rrabengali",
  33942. 0x09dc,
  33943. "rradeva",
  33944. 0x0931,
  33945. "rragurmukhi",
  33946. 0x0a5c,
  33947. "rreharabic",
  33948. 0x0691,
  33949. "rrehfinalarabic",
  33950. 0xfb8d,
  33951. "rrvocalicbengali",
  33952. 0x09e0,
  33953. "rrvocalicdeva",
  33954. 0x0960,
  33955. "rrvocalicgujarati",
  33956. 0x0ae0,
  33957. "rrvocalicvowelsignbengali",
  33958. 0x09c4,
  33959. "rrvocalicvowelsigndeva",
  33960. 0x0944,
  33961. "rrvocalicvowelsigngujarati",
  33962. 0x0ac4,
  33963. "rsuperior",
  33964. 0xf6f1,
  33965. "rtblock",
  33966. 0x2590,
  33967. "rturned",
  33968. 0x0279,
  33969. "rturnedsuperior",
  33970. 0x02b4,
  33971. "ruhiragana",
  33972. 0x308b,
  33973. "rukatakana",
  33974. 0x30eb,
  33975. "rukatakanahalfwidth",
  33976. 0xff99,
  33977. "rupeemarkbengali",
  33978. 0x09f2,
  33979. "rupeesignbengali",
  33980. 0x09f3,
  33981. "rupiah",
  33982. 0xf6dd,
  33983. "ruthai",
  33984. 0x0e24,
  33985. "rvocalicbengali",
  33986. 0x098b,
  33987. "rvocalicdeva",
  33988. 0x090b,
  33989. "rvocalicgujarati",
  33990. 0x0a8b,
  33991. "rvocalicvowelsignbengali",
  33992. 0x09c3,
  33993. "rvocalicvowelsigndeva",
  33994. 0x0943,
  33995. "rvocalicvowelsigngujarati",
  33996. 0x0ac3,
  33997. "s",
  33998. 0x0073,
  33999. "sabengali",
  34000. 0x09b8,
  34001. "sacute",
  34002. 0x015b,
  34003. "sacutedotaccent",
  34004. 0x1e65,
  34005. "sadarabic",
  34006. 0x0635,
  34007. "sadeva",
  34008. 0x0938,
  34009. "sadfinalarabic",
  34010. 0xfeba,
  34011. "sadinitialarabic",
  34012. 0xfebb,
  34013. "sadmedialarabic",
  34014. 0xfebc,
  34015. "sagujarati",
  34016. 0x0ab8,
  34017. "sagurmukhi",
  34018. 0x0a38,
  34019. "sahiragana",
  34020. 0x3055,
  34021. "sakatakana",
  34022. 0x30b5,
  34023. "sakatakanahalfwidth",
  34024. 0xff7b,
  34025. "sallallahoualayhewasallamarabic",
  34026. 0xfdfa,
  34027. "samekh",
  34028. 0x05e1,
  34029. "samekhdagesh",
  34030. 0xfb41,
  34031. "samekhdageshhebrew",
  34032. 0xfb41,
  34033. "samekhhebrew",
  34034. 0x05e1,
  34035. "saraaathai",
  34036. 0x0e32,
  34037. "saraaethai",
  34038. 0x0e41,
  34039. "saraaimaimalaithai",
  34040. 0x0e44,
  34041. "saraaimaimuanthai",
  34042. 0x0e43,
  34043. "saraamthai",
  34044. 0x0e33,
  34045. "saraathai",
  34046. 0x0e30,
  34047. "saraethai",
  34048. 0x0e40,
  34049. "saraiileftthai",
  34050. 0xf886,
  34051. "saraiithai",
  34052. 0x0e35,
  34053. "saraileftthai",
  34054. 0xf885,
  34055. "saraithai",
  34056. 0x0e34,
  34057. "saraothai",
  34058. 0x0e42,
  34059. "saraueeleftthai",
  34060. 0xf888,
  34061. "saraueethai",
  34062. 0x0e37,
  34063. "saraueleftthai",
  34064. 0xf887,
  34065. "sarauethai",
  34066. 0x0e36,
  34067. "sarauthai",
  34068. 0x0e38,
  34069. "sarauuthai",
  34070. 0x0e39,
  34071. "sbopomofo",
  34072. 0x3119,
  34073. "scaron",
  34074. 0x0161,
  34075. "scarondotaccent",
  34076. 0x1e67,
  34077. "scedilla",
  34078. 0x015f,
  34079. "schwa",
  34080. 0x0259,
  34081. "schwacyrillic",
  34082. 0x04d9,
  34083. "schwadieresiscyrillic",
  34084. 0x04db,
  34085. "schwahook",
  34086. 0x025a,
  34087. "scircle",
  34088. 0x24e2,
  34089. "scircumflex",
  34090. 0x015d,
  34091. "scommaaccent",
  34092. 0x0219,
  34093. "sdotaccent",
  34094. 0x1e61,
  34095. "sdotbelow",
  34096. 0x1e63,
  34097. "sdotbelowdotaccent",
  34098. 0x1e69,
  34099. "seagullbelowcmb",
  34100. 0x033c,
  34101. "second",
  34102. 0x2033,
  34103. "secondtonechinese",
  34104. 0x02ca,
  34105. "section",
  34106. 0x00a7,
  34107. "seenarabic",
  34108. 0x0633,
  34109. "seenfinalarabic",
  34110. 0xfeb2,
  34111. "seeninitialarabic",
  34112. 0xfeb3,
  34113. "seenmedialarabic",
  34114. 0xfeb4,
  34115. "segol",
  34116. 0x05b6,
  34117. "segol13",
  34118. 0x05b6,
  34119. "segol1f",
  34120. 0x05b6,
  34121. "segol2c",
  34122. 0x05b6,
  34123. "segolhebrew",
  34124. 0x05b6,
  34125. "segolnarrowhebrew",
  34126. 0x05b6,
  34127. "segolquarterhebrew",
  34128. 0x05b6,
  34129. "segoltahebrew",
  34130. 0x0592,
  34131. "segolwidehebrew",
  34132. 0x05b6,
  34133. "seharmenian",
  34134. 0x057d,
  34135. "sehiragana",
  34136. 0x305b,
  34137. "sekatakana",
  34138. 0x30bb,
  34139. "sekatakanahalfwidth",
  34140. 0xff7e,
  34141. "semicolon",
  34142. 0x003b,
  34143. "semicolonarabic",
  34144. 0x061b,
  34145. "semicolonmonospace",
  34146. 0xff1b,
  34147. "semicolonsmall",
  34148. 0xfe54,
  34149. "semivoicedmarkkana",
  34150. 0x309c,
  34151. "semivoicedmarkkanahalfwidth",
  34152. 0xff9f,
  34153. "sentisquare",
  34154. 0x3322,
  34155. "sentosquare",
  34156. 0x3323,
  34157. "seven",
  34158. 0x0037,
  34159. "sevenarabic",
  34160. 0x0667,
  34161. "sevenbengali",
  34162. 0x09ed,
  34163. "sevencircle",
  34164. 0x2466,
  34165. "sevencircleinversesansserif",
  34166. 0x2790,
  34167. "sevendeva",
  34168. 0x096d,
  34169. "seveneighths",
  34170. 0x215e,
  34171. "sevengujarati",
  34172. 0x0aed,
  34173. "sevengurmukhi",
  34174. 0x0a6d,
  34175. "sevenhackarabic",
  34176. 0x0667,
  34177. "sevenhangzhou",
  34178. 0x3027,
  34179. "sevenideographicparen",
  34180. 0x3226,
  34181. "seveninferior",
  34182. 0x2087,
  34183. "sevenmonospace",
  34184. 0xff17,
  34185. "sevenoldstyle",
  34186. 0xf737,
  34187. "sevenparen",
  34188. 0x247a,
  34189. "sevenperiod",
  34190. 0x248e,
  34191. "sevenpersian",
  34192. 0x06f7,
  34193. "sevenroman",
  34194. 0x2176,
  34195. "sevensuperior",
  34196. 0x2077,
  34197. "seventeencircle",
  34198. 0x2470,
  34199. "seventeenparen",
  34200. 0x2484,
  34201. "seventeenperiod",
  34202. 0x2498,
  34203. "seventhai",
  34204. 0x0e57,
  34205. "sfthyphen",
  34206. 0x00ad,
  34207. "shaarmenian",
  34208. 0x0577,
  34209. "shabengali",
  34210. 0x09b6,
  34211. "shacyrillic",
  34212. 0x0448,
  34213. "shaddaarabic",
  34214. 0x0651,
  34215. "shaddadammaarabic",
  34216. 0xfc61,
  34217. "shaddadammatanarabic",
  34218. 0xfc5e,
  34219. "shaddafathaarabic",
  34220. 0xfc60,
  34221. "shaddakasraarabic",
  34222. 0xfc62,
  34223. "shaddakasratanarabic",
  34224. 0xfc5f,
  34225. "shade",
  34226. 0x2592,
  34227. "shadedark",
  34228. 0x2593,
  34229. "shadelight",
  34230. 0x2591,
  34231. "shademedium",
  34232. 0x2592,
  34233. "shadeva",
  34234. 0x0936,
  34235. "shagujarati",
  34236. 0x0ab6,
  34237. "shagurmukhi",
  34238. 0x0a36,
  34239. "shalshelethebrew",
  34240. 0x0593,
  34241. "shbopomofo",
  34242. 0x3115,
  34243. "shchacyrillic",
  34244. 0x0449,
  34245. "sheenarabic",
  34246. 0x0634,
  34247. "sheenfinalarabic",
  34248. 0xfeb6,
  34249. "sheeninitialarabic",
  34250. 0xfeb7,
  34251. "sheenmedialarabic",
  34252. 0xfeb8,
  34253. "sheicoptic",
  34254. 0x03e3,
  34255. "sheqel",
  34256. 0x20aa,
  34257. "sheqelhebrew",
  34258. 0x20aa,
  34259. "sheva",
  34260. 0x05b0,
  34261. "sheva115",
  34262. 0x05b0,
  34263. "sheva15",
  34264. 0x05b0,
  34265. "sheva22",
  34266. 0x05b0,
  34267. "sheva2e",
  34268. 0x05b0,
  34269. "shevahebrew",
  34270. 0x05b0,
  34271. "shevanarrowhebrew",
  34272. 0x05b0,
  34273. "shevaquarterhebrew",
  34274. 0x05b0,
  34275. "shevawidehebrew",
  34276. 0x05b0,
  34277. "shhacyrillic",
  34278. 0x04bb,
  34279. "shimacoptic",
  34280. 0x03ed,
  34281. "shin",
  34282. 0x05e9,
  34283. "shindagesh",
  34284. 0xfb49,
  34285. "shindageshhebrew",
  34286. 0xfb49,
  34287. "shindageshshindot",
  34288. 0xfb2c,
  34289. "shindageshshindothebrew",
  34290. 0xfb2c,
  34291. "shindageshsindot",
  34292. 0xfb2d,
  34293. "shindageshsindothebrew",
  34294. 0xfb2d,
  34295. "shindothebrew",
  34296. 0x05c1,
  34297. "shinhebrew",
  34298. 0x05e9,
  34299. "shinshindot",
  34300. 0xfb2a,
  34301. "shinshindothebrew",
  34302. 0xfb2a,
  34303. "shinsindot",
  34304. 0xfb2b,
  34305. "shinsindothebrew",
  34306. 0xfb2b,
  34307. "shook",
  34308. 0x0282,
  34309. "sigma",
  34310. 0x03c3,
  34311. "sigma1",
  34312. 0x03c2,
  34313. "sigmafinal",
  34314. 0x03c2,
  34315. "sigmalunatesymbolgreek",
  34316. 0x03f2,
  34317. "sihiragana",
  34318. 0x3057,
  34319. "sikatakana",
  34320. 0x30b7,
  34321. "sikatakanahalfwidth",
  34322. 0xff7c,
  34323. "siluqhebrew",
  34324. 0x05bd,
  34325. "siluqlefthebrew",
  34326. 0x05bd,
  34327. "similar",
  34328. 0x223c,
  34329. "sindothebrew",
  34330. 0x05c2,
  34331. "siosacirclekorean",
  34332. 0x3274,
  34333. "siosaparenkorean",
  34334. 0x3214,
  34335. "sioscieuckorean",
  34336. 0x317e,
  34337. "sioscirclekorean",
  34338. 0x3266,
  34339. "sioskiyeokkorean",
  34340. 0x317a,
  34341. "sioskorean",
  34342. 0x3145,
  34343. "siosnieunkorean",
  34344. 0x317b,
  34345. "siosparenkorean",
  34346. 0x3206,
  34347. "siospieupkorean",
  34348. 0x317d,
  34349. "siostikeutkorean",
  34350. 0x317c,
  34351. "six",
  34352. 0x0036,
  34353. "sixarabic",
  34354. 0x0666,
  34355. "sixbengali",
  34356. 0x09ec,
  34357. "sixcircle",
  34358. 0x2465,
  34359. "sixcircleinversesansserif",
  34360. 0x278f,
  34361. "sixdeva",
  34362. 0x096c,
  34363. "sixgujarati",
  34364. 0x0aec,
  34365. "sixgurmukhi",
  34366. 0x0a6c,
  34367. "sixhackarabic",
  34368. 0x0666,
  34369. "sixhangzhou",
  34370. 0x3026,
  34371. "sixideographicparen",
  34372. 0x3225,
  34373. "sixinferior",
  34374. 0x2086,
  34375. "sixmonospace",
  34376. 0xff16,
  34377. "sixoldstyle",
  34378. 0xf736,
  34379. "sixparen",
  34380. 0x2479,
  34381. "sixperiod",
  34382. 0x248d,
  34383. "sixpersian",
  34384. 0x06f6,
  34385. "sixroman",
  34386. 0x2175,
  34387. "sixsuperior",
  34388. 0x2076,
  34389. "sixteencircle",
  34390. 0x246f,
  34391. "sixteencurrencydenominatorbengali",
  34392. 0x09f9,
  34393. "sixteenparen",
  34394. 0x2483,
  34395. "sixteenperiod",
  34396. 0x2497,
  34397. "sixthai",
  34398. 0x0e56,
  34399. "slash",
  34400. 0x002f,
  34401. "slashmonospace",
  34402. 0xff0f,
  34403. "slong",
  34404. 0x017f,
  34405. "slongdotaccent",
  34406. 0x1e9b,
  34407. "smileface",
  34408. 0x263a,
  34409. "smonospace",
  34410. 0xff53,
  34411. "sofpasuqhebrew",
  34412. 0x05c3,
  34413. "softhyphen",
  34414. 0x00ad,
  34415. "softsigncyrillic",
  34416. 0x044c,
  34417. "sohiragana",
  34418. 0x305d,
  34419. "sokatakana",
  34420. 0x30bd,
  34421. "sokatakanahalfwidth",
  34422. 0xff7f,
  34423. "soliduslongoverlaycmb",
  34424. 0x0338,
  34425. "solidusshortoverlaycmb",
  34426. 0x0337,
  34427. "sorusithai",
  34428. 0x0e29,
  34429. "sosalathai",
  34430. 0x0e28,
  34431. "sosothai",
  34432. 0x0e0b,
  34433. "sosuathai",
  34434. 0x0e2a,
  34435. "space",
  34436. 0x0020,
  34437. "spacehackarabic",
  34438. 0x0020,
  34439. "spade",
  34440. 0x2660,
  34441. "spadesuitblack",
  34442. 0x2660,
  34443. "spadesuitwhite",
  34444. 0x2664,
  34445. "sparen",
  34446. 0x24ae,
  34447. "squarebelowcmb",
  34448. 0x033b,
  34449. "squarecc",
  34450. 0x33c4,
  34451. "squarecm",
  34452. 0x339d,
  34453. "squarediagonalcrosshatchfill",
  34454. 0x25a9,
  34455. "squarehorizontalfill",
  34456. 0x25a4,
  34457. "squarekg",
  34458. 0x338f,
  34459. "squarekm",
  34460. 0x339e,
  34461. "squarekmcapital",
  34462. 0x33ce,
  34463. "squareln",
  34464. 0x33d1,
  34465. "squarelog",
  34466. 0x33d2,
  34467. "squaremg",
  34468. 0x338e,
  34469. "squaremil",
  34470. 0x33d5,
  34471. "squaremm",
  34472. 0x339c,
  34473. "squaremsquared",
  34474. 0x33a1,
  34475. "squareorthogonalcrosshatchfill",
  34476. 0x25a6,
  34477. "squareupperlefttolowerrightfill",
  34478. 0x25a7,
  34479. "squareupperrighttolowerleftfill",
  34480. 0x25a8,
  34481. "squareverticalfill",
  34482. 0x25a5,
  34483. "squarewhitewithsmallblack",
  34484. 0x25a3,
  34485. "srsquare",
  34486. 0x33db,
  34487. "ssabengali",
  34488. 0x09b7,
  34489. "ssadeva",
  34490. 0x0937,
  34491. "ssagujarati",
  34492. 0x0ab7,
  34493. "ssangcieuckorean",
  34494. 0x3149,
  34495. "ssanghieuhkorean",
  34496. 0x3185,
  34497. "ssangieungkorean",
  34498. 0x3180,
  34499. "ssangkiyeokkorean",
  34500. 0x3132,
  34501. "ssangnieunkorean",
  34502. 0x3165,
  34503. "ssangpieupkorean",
  34504. 0x3143,
  34505. "ssangsioskorean",
  34506. 0x3146,
  34507. "ssangtikeutkorean",
  34508. 0x3138,
  34509. "ssuperior",
  34510. 0xf6f2,
  34511. "sterling",
  34512. 0x00a3,
  34513. "sterlingmonospace",
  34514. 0xffe1,
  34515. "strokelongoverlaycmb",
  34516. 0x0336,
  34517. "strokeshortoverlaycmb",
  34518. 0x0335,
  34519. "subset",
  34520. 0x2282,
  34521. "subsetnotequal",
  34522. 0x228a,
  34523. "subsetorequal",
  34524. 0x2286,
  34525. "succeeds",
  34526. 0x227b,
  34527. "suchthat",
  34528. 0x220b,
  34529. "suhiragana",
  34530. 0x3059,
  34531. "sukatakana",
  34532. 0x30b9,
  34533. "sukatakanahalfwidth",
  34534. 0xff7d,
  34535. "sukunarabic",
  34536. 0x0652,
  34537. "summation",
  34538. 0x2211,
  34539. "sun",
  34540. 0x263c,
  34541. "superset",
  34542. 0x2283,
  34543. "supersetnotequal",
  34544. 0x228b,
  34545. "supersetorequal",
  34546. 0x2287,
  34547. "svsquare",
  34548. 0x33dc,
  34549. "syouwaerasquare",
  34550. 0x337c,
  34551. "t",
  34552. 0x0074,
  34553. "tabengali",
  34554. 0x09a4,
  34555. "tackdown",
  34556. 0x22a4,
  34557. "tackleft",
  34558. 0x22a3,
  34559. "tadeva",
  34560. 0x0924,
  34561. "tagujarati",
  34562. 0x0aa4,
  34563. "tagurmukhi",
  34564. 0x0a24,
  34565. "taharabic",
  34566. 0x0637,
  34567. "tahfinalarabic",
  34568. 0xfec2,
  34569. "tahinitialarabic",
  34570. 0xfec3,
  34571. "tahiragana",
  34572. 0x305f,
  34573. "tahmedialarabic",
  34574. 0xfec4,
  34575. "taisyouerasquare",
  34576. 0x337d,
  34577. "takatakana",
  34578. 0x30bf,
  34579. "takatakanahalfwidth",
  34580. 0xff80,
  34581. "tatweelarabic",
  34582. 0x0640,
  34583. "tau",
  34584. 0x03c4,
  34585. "tav",
  34586. 0x05ea,
  34587. "tavdages",
  34588. 0xfb4a,
  34589. "tavdagesh",
  34590. 0xfb4a,
  34591. "tavdageshhebrew",
  34592. 0xfb4a,
  34593. "tavhebrew",
  34594. 0x05ea,
  34595. "tbar",
  34596. 0x0167,
  34597. "tbopomofo",
  34598. 0x310a,
  34599. "tcaron",
  34600. 0x0165,
  34601. "tccurl",
  34602. 0x02a8,
  34603. "tcedilla",
  34604. 0x0163,
  34605. "tcheharabic",
  34606. 0x0686,
  34607. "tchehfinalarabic",
  34608. 0xfb7b,
  34609. "tchehinitialarabic",
  34610. 0xfb7c,
  34611. "tchehmedialarabic",
  34612. 0xfb7d,
  34613. "tcircle",
  34614. 0x24e3,
  34615. "tcircumflexbelow",
  34616. 0x1e71,
  34617. "tcommaaccent",
  34618. 0x0163,
  34619. "tdieresis",
  34620. 0x1e97,
  34621. "tdotaccent",
  34622. 0x1e6b,
  34623. "tdotbelow",
  34624. 0x1e6d,
  34625. "tecyrillic",
  34626. 0x0442,
  34627. "tedescendercyrillic",
  34628. 0x04ad,
  34629. "teharabic",
  34630. 0x062a,
  34631. "tehfinalarabic",
  34632. 0xfe96,
  34633. "tehhahinitialarabic",
  34634. 0xfca2,
  34635. "tehhahisolatedarabic",
  34636. 0xfc0c,
  34637. "tehinitialarabic",
  34638. 0xfe97,
  34639. "tehiragana",
  34640. 0x3066,
  34641. "tehjeeminitialarabic",
  34642. 0xfca1,
  34643. "tehjeemisolatedarabic",
  34644. 0xfc0b,
  34645. "tehmarbutaarabic",
  34646. 0x0629,
  34647. "tehmarbutafinalarabic",
  34648. 0xfe94,
  34649. "tehmedialarabic",
  34650. 0xfe98,
  34651. "tehmeeminitialarabic",
  34652. 0xfca4,
  34653. "tehmeemisolatedarabic",
  34654. 0xfc0e,
  34655. "tehnoonfinalarabic",
  34656. 0xfc73,
  34657. "tekatakana",
  34658. 0x30c6,
  34659. "tekatakanahalfwidth",
  34660. 0xff83,
  34661. "telephone",
  34662. 0x2121,
  34663. "telephoneblack",
  34664. 0x260e,
  34665. "telishagedolahebrew",
  34666. 0x05a0,
  34667. "telishaqetanahebrew",
  34668. 0x05a9,
  34669. "tencircle",
  34670. 0x2469,
  34671. "tenideographicparen",
  34672. 0x3229,
  34673. "tenparen",
  34674. 0x247d,
  34675. "tenperiod",
  34676. 0x2491,
  34677. "tenroman",
  34678. 0x2179,
  34679. "tesh",
  34680. 0x02a7,
  34681. "tet",
  34682. 0x05d8,
  34683. "tetdagesh",
  34684. 0xfb38,
  34685. "tetdageshhebrew",
  34686. 0xfb38,
  34687. "tethebrew",
  34688. 0x05d8,
  34689. "tetsecyrillic",
  34690. 0x04b5,
  34691. "tevirhebrew",
  34692. 0x059b,
  34693. "tevirlefthebrew",
  34694. 0x059b,
  34695. "thabengali",
  34696. 0x09a5,
  34697. "thadeva",
  34698. 0x0925,
  34699. "thagujarati",
  34700. 0x0aa5,
  34701. "thagurmukhi",
  34702. 0x0a25,
  34703. "thalarabic",
  34704. 0x0630,
  34705. "thalfinalarabic",
  34706. 0xfeac,
  34707. "thanthakhatlowleftthai",
  34708. 0xf898,
  34709. "thanthakhatlowrightthai",
  34710. 0xf897,
  34711. "thanthakhatthai",
  34712. 0x0e4c,
  34713. "thanthakhatupperleftthai",
  34714. 0xf896,
  34715. "theharabic",
  34716. 0x062b,
  34717. "thehfinalarabic",
  34718. 0xfe9a,
  34719. "thehinitialarabic",
  34720. 0xfe9b,
  34721. "thehmedialarabic",
  34722. 0xfe9c,
  34723. "thereexists",
  34724. 0x2203,
  34725. "therefore",
  34726. 0x2234,
  34727. "theta",
  34728. 0x03b8,
  34729. "theta1",
  34730. 0x03d1,
  34731. "thetasymbolgreek",
  34732. 0x03d1,
  34733. "thieuthacirclekorean",
  34734. 0x3279,
  34735. "thieuthaparenkorean",
  34736. 0x3219,
  34737. "thieuthcirclekorean",
  34738. 0x326b,
  34739. "thieuthkorean",
  34740. 0x314c,
  34741. "thieuthparenkorean",
  34742. 0x320b,
  34743. "thirteencircle",
  34744. 0x246c,
  34745. "thirteenparen",
  34746. 0x2480,
  34747. "thirteenperiod",
  34748. 0x2494,
  34749. "thonangmonthothai",
  34750. 0x0e11,
  34751. "thook",
  34752. 0x01ad,
  34753. "thophuthaothai",
  34754. 0x0e12,
  34755. "thorn",
  34756. 0x00fe,
  34757. "thothahanthai",
  34758. 0x0e17,
  34759. "thothanthai",
  34760. 0x0e10,
  34761. "thothongthai",
  34762. 0x0e18,
  34763. "thothungthai",
  34764. 0x0e16,
  34765. "thousandcyrillic",
  34766. 0x0482,
  34767. "thousandsseparatorarabic",
  34768. 0x066c,
  34769. "thousandsseparatorpersian",
  34770. 0x066c,
  34771. "three",
  34772. 0x0033,
  34773. "threearabic",
  34774. 0x0663,
  34775. "threebengali",
  34776. 0x09e9,
  34777. "threecircle",
  34778. 0x2462,
  34779. "threecircleinversesansserif",
  34780. 0x278c,
  34781. "threedeva",
  34782. 0x0969,
  34783. "threeeighths",
  34784. 0x215c,
  34785. "threegujarati",
  34786. 0x0ae9,
  34787. "threegurmukhi",
  34788. 0x0a69,
  34789. "threehackarabic",
  34790. 0x0663,
  34791. "threehangzhou",
  34792. 0x3023,
  34793. "threeideographicparen",
  34794. 0x3222,
  34795. "threeinferior",
  34796. 0x2083,
  34797. "threemonospace",
  34798. 0xff13,
  34799. "threenumeratorbengali",
  34800. 0x09f6,
  34801. "threeoldstyle",
  34802. 0xf733,
  34803. "threeparen",
  34804. 0x2476,
  34805. "threeperiod",
  34806. 0x248a,
  34807. "threepersian",
  34808. 0x06f3,
  34809. "threequarters",
  34810. 0x00be,
  34811. "threequartersemdash",
  34812. 0xf6de,
  34813. "threeroman",
  34814. 0x2172,
  34815. "threesuperior",
  34816. 0x00b3,
  34817. "threethai",
  34818. 0x0e53,
  34819. "thzsquare",
  34820. 0x3394,
  34821. "tihiragana",
  34822. 0x3061,
  34823. "tikatakana",
  34824. 0x30c1,
  34825. "tikatakanahalfwidth",
  34826. 0xff81,
  34827. "tikeutacirclekorean",
  34828. 0x3270,
  34829. "tikeutaparenkorean",
  34830. 0x3210,
  34831. "tikeutcirclekorean",
  34832. 0x3262,
  34833. "tikeutkorean",
  34834. 0x3137,
  34835. "tikeutparenkorean",
  34836. 0x3202,
  34837. "tilde",
  34838. 0x02dc,
  34839. "tildebelowcmb",
  34840. 0x0330,
  34841. "tildecmb",
  34842. 0x0303,
  34843. "tildecomb",
  34844. 0x0303,
  34845. "tildedoublecmb",
  34846. 0x0360,
  34847. "tildeoperator",
  34848. 0x223c,
  34849. "tildeoverlaycmb",
  34850. 0x0334,
  34851. "tildeverticalcmb",
  34852. 0x033e,
  34853. "timescircle",
  34854. 0x2297,
  34855. "tipehahebrew",
  34856. 0x0596,
  34857. "tipehalefthebrew",
  34858. 0x0596,
  34859. "tippigurmukhi",
  34860. 0x0a70,
  34861. "titlocyrilliccmb",
  34862. 0x0483,
  34863. "tiwnarmenian",
  34864. 0x057f,
  34865. "tlinebelow",
  34866. 0x1e6f,
  34867. "tmonospace",
  34868. 0xff54,
  34869. "toarmenian",
  34870. 0x0569,
  34871. "tohiragana",
  34872. 0x3068,
  34873. "tokatakana",
  34874. 0x30c8,
  34875. "tokatakanahalfwidth",
  34876. 0xff84,
  34877. "tonebarextrahighmod",
  34878. 0x02e5,
  34879. "tonebarextralowmod",
  34880. 0x02e9,
  34881. "tonebarhighmod",
  34882. 0x02e6,
  34883. "tonebarlowmod",
  34884. 0x02e8,
  34885. "tonebarmidmod",
  34886. 0x02e7,
  34887. "tonefive",
  34888. 0x01bd,
  34889. "tonesix",
  34890. 0x0185,
  34891. "tonetwo",
  34892. 0x01a8,
  34893. "tonos",
  34894. 0x0384,
  34895. "tonsquare",
  34896. 0x3327,
  34897. "topatakthai",
  34898. 0x0e0f,
  34899. "tortoiseshellbracketleft",
  34900. 0x3014,
  34901. "tortoiseshellbracketleftsmall",
  34902. 0xfe5d,
  34903. "tortoiseshellbracketleftvertical",
  34904. 0xfe39,
  34905. "tortoiseshellbracketright",
  34906. 0x3015,
  34907. "tortoiseshellbracketrightsmall",
  34908. 0xfe5e,
  34909. "tortoiseshellbracketrightvertical",
  34910. 0xfe3a,
  34911. "totaothai",
  34912. 0x0e15,
  34913. "tpalatalhook",
  34914. 0x01ab,
  34915. "tparen",
  34916. 0x24af,
  34917. "trademark",
  34918. 0x2122,
  34919. "trademarksans",
  34920. 0xf8ea,
  34921. "trademarkserif",
  34922. 0xf6db,
  34923. "tretroflexhook",
  34924. 0x0288,
  34925. "triagdn",
  34926. 0x25bc,
  34927. "triaglf",
  34928. 0x25c4,
  34929. "triagrt",
  34930. 0x25ba,
  34931. "triagup",
  34932. 0x25b2,
  34933. "ts",
  34934. 0x02a6,
  34935. "tsadi",
  34936. 0x05e6,
  34937. "tsadidagesh",
  34938. 0xfb46,
  34939. "tsadidageshhebrew",
  34940. 0xfb46,
  34941. "tsadihebrew",
  34942. 0x05e6,
  34943. "tsecyrillic",
  34944. 0x0446,
  34945. "tsere",
  34946. 0x05b5,
  34947. "tsere12",
  34948. 0x05b5,
  34949. "tsere1e",
  34950. 0x05b5,
  34951. "tsere2b",
  34952. 0x05b5,
  34953. "tserehebrew",
  34954. 0x05b5,
  34955. "tserenarrowhebrew",
  34956. 0x05b5,
  34957. "tserequarterhebrew",
  34958. 0x05b5,
  34959. "tserewidehebrew",
  34960. 0x05b5,
  34961. "tshecyrillic",
  34962. 0x045b,
  34963. "tsuperior",
  34964. 0xf6f3,
  34965. "ttabengali",
  34966. 0x099f,
  34967. "ttadeva",
  34968. 0x091f,
  34969. "ttagujarati",
  34970. 0x0a9f,
  34971. "ttagurmukhi",
  34972. 0x0a1f,
  34973. "tteharabic",
  34974. 0x0679,
  34975. "ttehfinalarabic",
  34976. 0xfb67,
  34977. "ttehinitialarabic",
  34978. 0xfb68,
  34979. "ttehmedialarabic",
  34980. 0xfb69,
  34981. "tthabengali",
  34982. 0x09a0,
  34983. "tthadeva",
  34984. 0x0920,
  34985. "tthagujarati",
  34986. 0x0aa0,
  34987. "tthagurmukhi",
  34988. 0x0a20,
  34989. "tturned",
  34990. 0x0287,
  34991. "tuhiragana",
  34992. 0x3064,
  34993. "tukatakana",
  34994. 0x30c4,
  34995. "tukatakanahalfwidth",
  34996. 0xff82,
  34997. "tusmallhiragana",
  34998. 0x3063,
  34999. "tusmallkatakana",
  35000. 0x30c3,
  35001. "tusmallkatakanahalfwidth",
  35002. 0xff6f,
  35003. "twelvecircle",
  35004. 0x246b,
  35005. "twelveparen",
  35006. 0x247f,
  35007. "twelveperiod",
  35008. 0x2493,
  35009. "twelveroman",
  35010. 0x217b,
  35011. "twentycircle",
  35012. 0x2473,
  35013. "twentyhangzhou",
  35014. 0x5344,
  35015. "twentyparen",
  35016. 0x2487,
  35017. "twentyperiod",
  35018. 0x249b,
  35019. "two",
  35020. 0x0032,
  35021. "twoarabic",
  35022. 0x0662,
  35023. "twobengali",
  35024. 0x09e8,
  35025. "twocircle",
  35026. 0x2461,
  35027. "twocircleinversesansserif",
  35028. 0x278b,
  35029. "twodeva",
  35030. 0x0968,
  35031. "twodotenleader",
  35032. 0x2025,
  35033. "twodotleader",
  35034. 0x2025,
  35035. "twodotleadervertical",
  35036. 0xfe30,
  35037. "twogujarati",
  35038. 0x0ae8,
  35039. "twogurmukhi",
  35040. 0x0a68,
  35041. "twohackarabic",
  35042. 0x0662,
  35043. "twohangzhou",
  35044. 0x3022,
  35045. "twoideographicparen",
  35046. 0x3221,
  35047. "twoinferior",
  35048. 0x2082,
  35049. "twomonospace",
  35050. 0xff12,
  35051. "twonumeratorbengali",
  35052. 0x09f5,
  35053. "twooldstyle",
  35054. 0xf732,
  35055. "twoparen",
  35056. 0x2475,
  35057. "twoperiod",
  35058. 0x2489,
  35059. "twopersian",
  35060. 0x06f2,
  35061. "tworoman",
  35062. 0x2171,
  35063. "twostroke",
  35064. 0x01bb,
  35065. "twosuperior",
  35066. 0x00b2,
  35067. "twothai",
  35068. 0x0e52,
  35069. "twothirds",
  35070. 0x2154,
  35071. "u",
  35072. 0x0075,
  35073. "uacute",
  35074. 0x00fa,
  35075. "ubar",
  35076. 0x0289,
  35077. "ubengali",
  35078. 0x0989,
  35079. "ubopomofo",
  35080. 0x3128,
  35081. "ubreve",
  35082. 0x016d,
  35083. "ucaron",
  35084. 0x01d4,
  35085. "ucircle",
  35086. 0x24e4,
  35087. "ucircumflex",
  35088. 0x00fb,
  35089. "ucircumflexbelow",
  35090. 0x1e77,
  35091. "ucyrillic",
  35092. 0x0443,
  35093. "udattadeva",
  35094. 0x0951,
  35095. "udblacute",
  35096. 0x0171,
  35097. "udblgrave",
  35098. 0x0215,
  35099. "udeva",
  35100. 0x0909,
  35101. "udieresis",
  35102. 0x00fc,
  35103. "udieresisacute",
  35104. 0x01d8,
  35105. "udieresisbelow",
  35106. 0x1e73,
  35107. "udieresiscaron",
  35108. 0x01da,
  35109. "udieresiscyrillic",
  35110. 0x04f1,
  35111. "udieresisgrave",
  35112. 0x01dc,
  35113. "udieresismacron",
  35114. 0x01d6,
  35115. "udotbelow",
  35116. 0x1ee5,
  35117. "ugrave",
  35118. 0x00f9,
  35119. "ugujarati",
  35120. 0x0a89,
  35121. "ugurmukhi",
  35122. 0x0a09,
  35123. "uhiragana",
  35124. 0x3046,
  35125. "uhookabove",
  35126. 0x1ee7,
  35127. "uhorn",
  35128. 0x01b0,
  35129. "uhornacute",
  35130. 0x1ee9,
  35131. "uhorndotbelow",
  35132. 0x1ef1,
  35133. "uhorngrave",
  35134. 0x1eeb,
  35135. "uhornhookabove",
  35136. 0x1eed,
  35137. "uhorntilde",
  35138. 0x1eef,
  35139. "uhungarumlaut",
  35140. 0x0171,
  35141. "uhungarumlautcyrillic",
  35142. 0x04f3,
  35143. "uinvertedbreve",
  35144. 0x0217,
  35145. "ukatakana",
  35146. 0x30a6,
  35147. "ukatakanahalfwidth",
  35148. 0xff73,
  35149. "ukcyrillic",
  35150. 0x0479,
  35151. "ukorean",
  35152. 0x315c,
  35153. "umacron",
  35154. 0x016b,
  35155. "umacroncyrillic",
  35156. 0x04ef,
  35157. "umacrondieresis",
  35158. 0x1e7b,
  35159. "umatragurmukhi",
  35160. 0x0a41,
  35161. "umonospace",
  35162. 0xff55,
  35163. "underscore",
  35164. 0x005f,
  35165. "underscoredbl",
  35166. 0x2017,
  35167. "underscoremonospace",
  35168. 0xff3f,
  35169. "underscorevertical",
  35170. 0xfe33,
  35171. "underscorewavy",
  35172. 0xfe4f,
  35173. "union",
  35174. 0x222a,
  35175. "universal",
  35176. 0x2200,
  35177. "uogonek",
  35178. 0x0173,
  35179. "uparen",
  35180. 0x24b0,
  35181. "upblock",
  35182. 0x2580,
  35183. "upperdothebrew",
  35184. 0x05c4,
  35185. "upsilon",
  35186. 0x03c5,
  35187. "upsilondieresis",
  35188. 0x03cb,
  35189. "upsilondieresistonos",
  35190. 0x03b0,
  35191. "upsilonlatin",
  35192. 0x028a,
  35193. "upsilontonos",
  35194. 0x03cd,
  35195. "uptackbelowcmb",
  35196. 0x031d,
  35197. "uptackmod",
  35198. 0x02d4,
  35199. "uragurmukhi",
  35200. 0x0a73,
  35201. "uring",
  35202. 0x016f,
  35203. "ushortcyrillic",
  35204. 0x045e,
  35205. "usmallhiragana",
  35206. 0x3045,
  35207. "usmallkatakana",
  35208. 0x30a5,
  35209. "usmallkatakanahalfwidth",
  35210. 0xff69,
  35211. "ustraightcyrillic",
  35212. 0x04af,
  35213. "ustraightstrokecyrillic",
  35214. 0x04b1,
  35215. "utilde",
  35216. 0x0169,
  35217. "utildeacute",
  35218. 0x1e79,
  35219. "utildebelow",
  35220. 0x1e75,
  35221. "uubengali",
  35222. 0x098a,
  35223. "uudeva",
  35224. 0x090a,
  35225. "uugujarati",
  35226. 0x0a8a,
  35227. "uugurmukhi",
  35228. 0x0a0a,
  35229. "uumatragurmukhi",
  35230. 0x0a42,
  35231. "uuvowelsignbengali",
  35232. 0x09c2,
  35233. "uuvowelsigndeva",
  35234. 0x0942,
  35235. "uuvowelsigngujarati",
  35236. 0x0ac2,
  35237. "uvowelsignbengali",
  35238. 0x09c1,
  35239. "uvowelsigndeva",
  35240. 0x0941,
  35241. "uvowelsigngujarati",
  35242. 0x0ac1,
  35243. "v",
  35244. 0x0076,
  35245. "vadeva",
  35246. 0x0935,
  35247. "vagujarati",
  35248. 0x0ab5,
  35249. "vagurmukhi",
  35250. 0x0a35,
  35251. "vakatakana",
  35252. 0x30f7,
  35253. "vav",
  35254. 0x05d5,
  35255. "vavdagesh",
  35256. 0xfb35,
  35257. "vavdagesh65",
  35258. 0xfb35,
  35259. "vavdageshhebrew",
  35260. 0xfb35,
  35261. "vavhebrew",
  35262. 0x05d5,
  35263. "vavholam",
  35264. 0xfb4b,
  35265. "vavholamhebrew",
  35266. 0xfb4b,
  35267. "vavvavhebrew",
  35268. 0x05f0,
  35269. "vavyodhebrew",
  35270. 0x05f1,
  35271. "vcircle",
  35272. 0x24e5,
  35273. "vdotbelow",
  35274. 0x1e7f,
  35275. "vecyrillic",
  35276. 0x0432,
  35277. "veharabic",
  35278. 0x06a4,
  35279. "vehfinalarabic",
  35280. 0xfb6b,
  35281. "vehinitialarabic",
  35282. 0xfb6c,
  35283. "vehmedialarabic",
  35284. 0xfb6d,
  35285. "vekatakana",
  35286. 0x30f9,
  35287. "venus",
  35288. 0x2640,
  35289. "verticalbar",
  35290. 0x007c,
  35291. "verticallineabovecmb",
  35292. 0x030d,
  35293. "verticallinebelowcmb",
  35294. 0x0329,
  35295. "verticallinelowmod",
  35296. 0x02cc,
  35297. "verticallinemod",
  35298. 0x02c8,
  35299. "vewarmenian",
  35300. 0x057e,
  35301. "vhook",
  35302. 0x028b,
  35303. "vikatakana",
  35304. 0x30f8,
  35305. "viramabengali",
  35306. 0x09cd,
  35307. "viramadeva",
  35308. 0x094d,
  35309. "viramagujarati",
  35310. 0x0acd,
  35311. "visargabengali",
  35312. 0x0983,
  35313. "visargadeva",
  35314. 0x0903,
  35315. "visargagujarati",
  35316. 0x0a83,
  35317. "vmonospace",
  35318. 0xff56,
  35319. "voarmenian",
  35320. 0x0578,
  35321. "voicediterationhiragana",
  35322. 0x309e,
  35323. "voicediterationkatakana",
  35324. 0x30fe,
  35325. "voicedmarkkana",
  35326. 0x309b,
  35327. "voicedmarkkanahalfwidth",
  35328. 0xff9e,
  35329. "vokatakana",
  35330. 0x30fa,
  35331. "vparen",
  35332. 0x24b1,
  35333. "vtilde",
  35334. 0x1e7d,
  35335. "vturned",
  35336. 0x028c,
  35337. "vuhiragana",
  35338. 0x3094,
  35339. "vukatakana",
  35340. 0x30f4,
  35341. "w",
  35342. 0x0077,
  35343. "wacute",
  35344. 0x1e83,
  35345. "waekorean",
  35346. 0x3159,
  35347. "wahiragana",
  35348. 0x308f,
  35349. "wakatakana",
  35350. 0x30ef,
  35351. "wakatakanahalfwidth",
  35352. 0xff9c,
  35353. "wakorean",
  35354. 0x3158,
  35355. "wasmallhiragana",
  35356. 0x308e,
  35357. "wasmallkatakana",
  35358. 0x30ee,
  35359. "wattosquare",
  35360. 0x3357,
  35361. "wavedash",
  35362. 0x301c,
  35363. "wavyunderscorevertical",
  35364. 0xfe34,
  35365. "wawarabic",
  35366. 0x0648,
  35367. "wawfinalarabic",
  35368. 0xfeee,
  35369. "wawhamzaabovearabic",
  35370. 0x0624,
  35371. "wawhamzaabovefinalarabic",
  35372. 0xfe86,
  35373. "wbsquare",
  35374. 0x33dd,
  35375. "wcircle",
  35376. 0x24e6,
  35377. "wcircumflex",
  35378. 0x0175,
  35379. "wdieresis",
  35380. 0x1e85,
  35381. "wdotaccent",
  35382. 0x1e87,
  35383. "wdotbelow",
  35384. 0x1e89,
  35385. "wehiragana",
  35386. 0x3091,
  35387. "weierstrass",
  35388. 0x2118,
  35389. "wekatakana",
  35390. 0x30f1,
  35391. "wekorean",
  35392. 0x315e,
  35393. "weokorean",
  35394. 0x315d,
  35395. "wgrave",
  35396. 0x1e81,
  35397. "whitebullet",
  35398. 0x25e6,
  35399. "whitecircle",
  35400. 0x25cb,
  35401. "whitecircleinverse",
  35402. 0x25d9,
  35403. "whitecornerbracketleft",
  35404. 0x300e,
  35405. "whitecornerbracketleftvertical",
  35406. 0xfe43,
  35407. "whitecornerbracketright",
  35408. 0x300f,
  35409. "whitecornerbracketrightvertical",
  35410. 0xfe44,
  35411. "whitediamond",
  35412. 0x25c7,
  35413. "whitediamondcontainingblacksmalldiamond",
  35414. 0x25c8,
  35415. "whitedownpointingsmalltriangle",
  35416. 0x25bf,
  35417. "whitedownpointingtriangle",
  35418. 0x25bd,
  35419. "whiteleftpointingsmalltriangle",
  35420. 0x25c3,
  35421. "whiteleftpointingtriangle",
  35422. 0x25c1,
  35423. "whitelenticularbracketleft",
  35424. 0x3016,
  35425. "whitelenticularbracketright",
  35426. 0x3017,
  35427. "whiterightpointingsmalltriangle",
  35428. 0x25b9,
  35429. "whiterightpointingtriangle",
  35430. 0x25b7,
  35431. "whitesmallsquare",
  35432. 0x25ab,
  35433. "whitesmilingface",
  35434. 0x263a,
  35435. "whitesquare",
  35436. 0x25a1,
  35437. "whitestar",
  35438. 0x2606,
  35439. "whitetelephone",
  35440. 0x260f,
  35441. "whitetortoiseshellbracketleft",
  35442. 0x3018,
  35443. "whitetortoiseshellbracketright",
  35444. 0x3019,
  35445. "whiteuppointingsmalltriangle",
  35446. 0x25b5,
  35447. "whiteuppointingtriangle",
  35448. 0x25b3,
  35449. "wihiragana",
  35450. 0x3090,
  35451. "wikatakana",
  35452. 0x30f0,
  35453. "wikorean",
  35454. 0x315f,
  35455. "wmonospace",
  35456. 0xff57,
  35457. "wohiragana",
  35458. 0x3092,
  35459. "wokatakana",
  35460. 0x30f2,
  35461. "wokatakanahalfwidth",
  35462. 0xff66,
  35463. "won",
  35464. 0x20a9,
  35465. "wonmonospace",
  35466. 0xffe6,
  35467. "wowaenthai",
  35468. 0x0e27,
  35469. "wparen",
  35470. 0x24b2,
  35471. "wring",
  35472. 0x1e98,
  35473. "wsuperior",
  35474. 0x02b7,
  35475. "wturned",
  35476. 0x028d,
  35477. "wynn",
  35478. 0x01bf,
  35479. "x",
  35480. 0x0078,
  35481. "xabovecmb",
  35482. 0x033d,
  35483. "xbopomofo",
  35484. 0x3112,
  35485. "xcircle",
  35486. 0x24e7,
  35487. "xdieresis",
  35488. 0x1e8d,
  35489. "xdotaccent",
  35490. 0x1e8b,
  35491. "xeharmenian",
  35492. 0x056d,
  35493. "xi",
  35494. 0x03be,
  35495. "xmonospace",
  35496. 0xff58,
  35497. "xparen",
  35498. 0x24b3,
  35499. "xsuperior",
  35500. 0x02e3,
  35501. "y",
  35502. 0x0079,
  35503. "yaadosquare",
  35504. 0x334e,
  35505. "yabengali",
  35506. 0x09af,
  35507. "yacute",
  35508. 0x00fd,
  35509. "yadeva",
  35510. 0x092f,
  35511. "yaekorean",
  35512. 0x3152,
  35513. "yagujarati",
  35514. 0x0aaf,
  35515. "yagurmukhi",
  35516. 0x0a2f,
  35517. "yahiragana",
  35518. 0x3084,
  35519. "yakatakana",
  35520. 0x30e4,
  35521. "yakatakanahalfwidth",
  35522. 0xff94,
  35523. "yakorean",
  35524. 0x3151,
  35525. "yamakkanthai",
  35526. 0x0e4e,
  35527. "yasmallhiragana",
  35528. 0x3083,
  35529. "yasmallkatakana",
  35530. 0x30e3,
  35531. "yasmallkatakanahalfwidth",
  35532. 0xff6c,
  35533. "yatcyrillic",
  35534. 0x0463,
  35535. "ycircle",
  35536. 0x24e8,
  35537. "ycircumflex",
  35538. 0x0177,
  35539. "ydieresis",
  35540. 0x00ff,
  35541. "ydotaccent",
  35542. 0x1e8f,
  35543. "ydotbelow",
  35544. 0x1ef5,
  35545. "yeharabic",
  35546. 0x064a,
  35547. "yehbarreearabic",
  35548. 0x06d2,
  35549. "yehbarreefinalarabic",
  35550. 0xfbaf,
  35551. "yehfinalarabic",
  35552. 0xfef2,
  35553. "yehhamzaabovearabic",
  35554. 0x0626,
  35555. "yehhamzaabovefinalarabic",
  35556. 0xfe8a,
  35557. "yehhamzaaboveinitialarabic",
  35558. 0xfe8b,
  35559. "yehhamzaabovemedialarabic",
  35560. 0xfe8c,
  35561. "yehinitialarabic",
  35562. 0xfef3,
  35563. "yehmedialarabic",
  35564. 0xfef4,
  35565. "yehmeeminitialarabic",
  35566. 0xfcdd,
  35567. "yehmeemisolatedarabic",
  35568. 0xfc58,
  35569. "yehnoonfinalarabic",
  35570. 0xfc94,
  35571. "yehthreedotsbelowarabic",
  35572. 0x06d1,
  35573. "yekorean",
  35574. 0x3156,
  35575. "yen",
  35576. 0x00a5,
  35577. "yenmonospace",
  35578. 0xffe5,
  35579. "yeokorean",
  35580. 0x3155,
  35581. "yeorinhieuhkorean",
  35582. 0x3186,
  35583. "yerahbenyomohebrew",
  35584. 0x05aa,
  35585. "yerahbenyomolefthebrew",
  35586. 0x05aa,
  35587. "yericyrillic",
  35588. 0x044b,
  35589. "yerudieresiscyrillic",
  35590. 0x04f9,
  35591. "yesieungkorean",
  35592. 0x3181,
  35593. "yesieungpansioskorean",
  35594. 0x3183,
  35595. "yesieungsioskorean",
  35596. 0x3182,
  35597. "yetivhebrew",
  35598. 0x059a,
  35599. "ygrave",
  35600. 0x1ef3,
  35601. "yhook",
  35602. 0x01b4,
  35603. "yhookabove",
  35604. 0x1ef7,
  35605. "yiarmenian",
  35606. 0x0575,
  35607. "yicyrillic",
  35608. 0x0457,
  35609. "yikorean",
  35610. 0x3162,
  35611. "yinyang",
  35612. 0x262f,
  35613. "yiwnarmenian",
  35614. 0x0582,
  35615. "ymonospace",
  35616. 0xff59,
  35617. "yod",
  35618. 0x05d9,
  35619. "yoddagesh",
  35620. 0xfb39,
  35621. "yoddageshhebrew",
  35622. 0xfb39,
  35623. "yodhebrew",
  35624. 0x05d9,
  35625. "yodyodhebrew",
  35626. 0x05f2,
  35627. "yodyodpatahhebrew",
  35628. 0xfb1f,
  35629. "yohiragana",
  35630. 0x3088,
  35631. "yoikorean",
  35632. 0x3189,
  35633. "yokatakana",
  35634. 0x30e8,
  35635. "yokatakanahalfwidth",
  35636. 0xff96,
  35637. "yokorean",
  35638. 0x315b,
  35639. "yosmallhiragana",
  35640. 0x3087,
  35641. "yosmallkatakana",
  35642. 0x30e7,
  35643. "yosmallkatakanahalfwidth",
  35644. 0xff6e,
  35645. "yotgreek",
  35646. 0x03f3,
  35647. "yoyaekorean",
  35648. 0x3188,
  35649. "yoyakorean",
  35650. 0x3187,
  35651. "yoyakthai",
  35652. 0x0e22,
  35653. "yoyingthai",
  35654. 0x0e0d,
  35655. "yparen",
  35656. 0x24b4,
  35657. "ypogegrammeni",
  35658. 0x037a,
  35659. "ypogegrammenigreekcmb",
  35660. 0x0345,
  35661. "yr",
  35662. 0x01a6,
  35663. "yring",
  35664. 0x1e99,
  35665. "ysuperior",
  35666. 0x02b8,
  35667. "ytilde",
  35668. 0x1ef9,
  35669. "yturned",
  35670. 0x028e,
  35671. "yuhiragana",
  35672. 0x3086,
  35673. "yuikorean",
  35674. 0x318c,
  35675. "yukatakana",
  35676. 0x30e6,
  35677. "yukatakanahalfwidth",
  35678. 0xff95,
  35679. "yukorean",
  35680. 0x3160,
  35681. "yusbigcyrillic",
  35682. 0x046b,
  35683. "yusbigiotifiedcyrillic",
  35684. 0x046d,
  35685. "yuslittlecyrillic",
  35686. 0x0467,
  35687. "yuslittleiotifiedcyrillic",
  35688. 0x0469,
  35689. "yusmallhiragana",
  35690. 0x3085,
  35691. "yusmallkatakana",
  35692. 0x30e5,
  35693. "yusmallkatakanahalfwidth",
  35694. 0xff6d,
  35695. "yuyekorean",
  35696. 0x318b,
  35697. "yuyeokorean",
  35698. 0x318a,
  35699. "yyabengali",
  35700. 0x09df,
  35701. "yyadeva",
  35702. 0x095f,
  35703. "z",
  35704. 0x007a,
  35705. "zaarmenian",
  35706. 0x0566,
  35707. "zacute",
  35708. 0x017a,
  35709. "zadeva",
  35710. 0x095b,
  35711. "zagurmukhi",
  35712. 0x0a5b,
  35713. "zaharabic",
  35714. 0x0638,
  35715. "zahfinalarabic",
  35716. 0xfec6,
  35717. "zahinitialarabic",
  35718. 0xfec7,
  35719. "zahiragana",
  35720. 0x3056,
  35721. "zahmedialarabic",
  35722. 0xfec8,
  35723. "zainarabic",
  35724. 0x0632,
  35725. "zainfinalarabic",
  35726. 0xfeb0,
  35727. "zakatakana",
  35728. 0x30b6,
  35729. "zaqefgadolhebrew",
  35730. 0x0595,
  35731. "zaqefqatanhebrew",
  35732. 0x0594,
  35733. "zarqahebrew",
  35734. 0x0598,
  35735. "zayin",
  35736. 0x05d6,
  35737. "zayindagesh",
  35738. 0xfb36,
  35739. "zayindageshhebrew",
  35740. 0xfb36,
  35741. "zayinhebrew",
  35742. 0x05d6,
  35743. "zbopomofo",
  35744. 0x3117,
  35745. "zcaron",
  35746. 0x017e,
  35747. "zcircle",
  35748. 0x24e9,
  35749. "zcircumflex",
  35750. 0x1e91,
  35751. "zcurl",
  35752. 0x0291,
  35753. "zdot",
  35754. 0x017c,
  35755. "zdotaccent",
  35756. 0x017c,
  35757. "zdotbelow",
  35758. 0x1e93,
  35759. "zecyrillic",
  35760. 0x0437,
  35761. "zedescendercyrillic",
  35762. 0x0499,
  35763. "zedieresiscyrillic",
  35764. 0x04df,
  35765. "zehiragana",
  35766. 0x305c,
  35767. "zekatakana",
  35768. 0x30bc,
  35769. "zero",
  35770. 0x0030,
  35771. "zeroarabic",
  35772. 0x0660,
  35773. "zerobengali",
  35774. 0x09e6,
  35775. "zerodeva",
  35776. 0x0966,
  35777. "zerogujarati",
  35778. 0x0ae6,
  35779. "zerogurmukhi",
  35780. 0x0a66,
  35781. "zerohackarabic",
  35782. 0x0660,
  35783. "zeroinferior",
  35784. 0x2080,
  35785. "zeromonospace",
  35786. 0xff10,
  35787. "zerooldstyle",
  35788. 0xf730,
  35789. "zeropersian",
  35790. 0x06f0,
  35791. "zerosuperior",
  35792. 0x2070,
  35793. "zerothai",
  35794. 0x0e50,
  35795. "zerowidthjoiner",
  35796. 0xfeff,
  35797. "zerowidthnonjoiner",
  35798. 0x200c,
  35799. "zerowidthspace",
  35800. 0x200b,
  35801. "zeta",
  35802. 0x03b6,
  35803. "zhbopomofo",
  35804. 0x3113,
  35805. "zhearmenian",
  35806. 0x056a,
  35807. "zhebrevecyrillic",
  35808. 0x04c2,
  35809. "zhecyrillic",
  35810. 0x0436,
  35811. "zhedescendercyrillic",
  35812. 0x0497,
  35813. "zhedieresiscyrillic",
  35814. 0x04dd,
  35815. "zihiragana",
  35816. 0x3058,
  35817. "zikatakana",
  35818. 0x30b8,
  35819. "zinorhebrew",
  35820. 0x05ae,
  35821. "zlinebelow",
  35822. 0x1e95,
  35823. "zmonospace",
  35824. 0xff5a,
  35825. "zohiragana",
  35826. 0x305e,
  35827. "zokatakana",
  35828. 0x30be,
  35829. "zparen",
  35830. 0x24b5,
  35831. "zretroflexhook",
  35832. 0x0290,
  35833. "zstroke",
  35834. 0x01b6,
  35835. "zuhiragana",
  35836. 0x305a,
  35837. "zukatakana",
  35838. 0x30ba,
  35839. ".notdef",
  35840. 0x0000,
  35841. "angbracketleftbig",
  35842. 0x2329,
  35843. "angbracketleftBig",
  35844. 0x2329,
  35845. "angbracketleftbigg",
  35846. 0x2329,
  35847. "angbracketleftBigg",
  35848. 0x2329,
  35849. "angbracketrightBig",
  35850. 0x232a,
  35851. "angbracketrightbig",
  35852. 0x232a,
  35853. "angbracketrightBigg",
  35854. 0x232a,
  35855. "angbracketrightbigg",
  35856. 0x232a,
  35857. "arrowhookleft",
  35858. 0x21aa,
  35859. "arrowhookright",
  35860. 0x21a9,
  35861. "arrowlefttophalf",
  35862. 0x21bc,
  35863. "arrowleftbothalf",
  35864. 0x21bd,
  35865. "arrownortheast",
  35866. 0x2197,
  35867. "arrownorthwest",
  35868. 0x2196,
  35869. "arrowrighttophalf",
  35870. 0x21c0,
  35871. "arrowrightbothalf",
  35872. 0x21c1,
  35873. "arrowsoutheast",
  35874. 0x2198,
  35875. "arrowsouthwest",
  35876. 0x2199,
  35877. "backslashbig",
  35878. 0x2216,
  35879. "backslashBig",
  35880. 0x2216,
  35881. "backslashBigg",
  35882. 0x2216,
  35883. "backslashbigg",
  35884. 0x2216,
  35885. "bardbl",
  35886. 0x2016,
  35887. "bracehtipdownleft",
  35888. 0xfe37,
  35889. "bracehtipdownright",
  35890. 0xfe37,
  35891. "bracehtipupleft",
  35892. 0xfe38,
  35893. "bracehtipupright",
  35894. 0xfe38,
  35895. "braceleftBig",
  35896. 0x007b,
  35897. "braceleftbig",
  35898. 0x007b,
  35899. "braceleftbigg",
  35900. 0x007b,
  35901. "braceleftBigg",
  35902. 0x007b,
  35903. "bracerightBig",
  35904. 0x007d,
  35905. "bracerightbig",
  35906. 0x007d,
  35907. "bracerightbigg",
  35908. 0x007d,
  35909. "bracerightBigg",
  35910. 0x007d,
  35911. "bracketleftbig",
  35912. 0x005b,
  35913. "bracketleftBig",
  35914. 0x005b,
  35915. "bracketleftbigg",
  35916. 0x005b,
  35917. "bracketleftBigg",
  35918. 0x005b,
  35919. "bracketrightBig",
  35920. 0x005d,
  35921. "bracketrightbig",
  35922. 0x005d,
  35923. "bracketrightbigg",
  35924. 0x005d,
  35925. "bracketrightBigg",
  35926. 0x005d,
  35927. "ceilingleftbig",
  35928. 0x2308,
  35929. "ceilingleftBig",
  35930. 0x2308,
  35931. "ceilingleftBigg",
  35932. 0x2308,
  35933. "ceilingleftbigg",
  35934. 0x2308,
  35935. "ceilingrightbig",
  35936. 0x2309,
  35937. "ceilingrightBig",
  35938. 0x2309,
  35939. "ceilingrightbigg",
  35940. 0x2309,
  35941. "ceilingrightBigg",
  35942. 0x2309,
  35943. "circledotdisplay",
  35944. 0x2299,
  35945. "circledottext",
  35946. 0x2299,
  35947. "circlemultiplydisplay",
  35948. 0x2297,
  35949. "circlemultiplytext",
  35950. 0x2297,
  35951. "circleplusdisplay",
  35952. 0x2295,
  35953. "circleplustext",
  35954. 0x2295,
  35955. "contintegraldisplay",
  35956. 0x222e,
  35957. "contintegraltext",
  35958. 0x222e,
  35959. "coproductdisplay",
  35960. 0x2210,
  35961. "coproducttext",
  35962. 0x2210,
  35963. "floorleftBig",
  35964. 0x230a,
  35965. "floorleftbig",
  35966. 0x230a,
  35967. "floorleftbigg",
  35968. 0x230a,
  35969. "floorleftBigg",
  35970. 0x230a,
  35971. "floorrightbig",
  35972. 0x230b,
  35973. "floorrightBig",
  35974. 0x230b,
  35975. "floorrightBigg",
  35976. 0x230b,
  35977. "floorrightbigg",
  35978. 0x230b,
  35979. "hatwide",
  35980. 0x0302,
  35981. "hatwider",
  35982. 0x0302,
  35983. "hatwidest",
  35984. 0x0302,
  35985. "intercal",
  35986. 0x1d40,
  35987. "integraldisplay",
  35988. 0x222b,
  35989. "integraltext",
  35990. 0x222b,
  35991. "intersectiondisplay",
  35992. 0x22c2,
  35993. "intersectiontext",
  35994. 0x22c2,
  35995. "logicalanddisplay",
  35996. 0x2227,
  35997. "logicalandtext",
  35998. 0x2227,
  35999. "logicalordisplay",
  36000. 0x2228,
  36001. "logicalortext",
  36002. 0x2228,
  36003. "parenleftBig",
  36004. 0x0028,
  36005. "parenleftbig",
  36006. 0x0028,
  36007. "parenleftBigg",
  36008. 0x0028,
  36009. "parenleftbigg",
  36010. 0x0028,
  36011. "parenrightBig",
  36012. 0x0029,
  36013. "parenrightbig",
  36014. 0x0029,
  36015. "parenrightBigg",
  36016. 0x0029,
  36017. "parenrightbigg",
  36018. 0x0029,
  36019. "prime",
  36020. 0x2032,
  36021. "productdisplay",
  36022. 0x220f,
  36023. "producttext",
  36024. 0x220f,
  36025. "radicalbig",
  36026. 0x221a,
  36027. "radicalBig",
  36028. 0x221a,
  36029. "radicalBigg",
  36030. 0x221a,
  36031. "radicalbigg",
  36032. 0x221a,
  36033. "radicalbt",
  36034. 0x221a,
  36035. "radicaltp",
  36036. 0x221a,
  36037. "radicalvertex",
  36038. 0x221a,
  36039. "slashbig",
  36040. 0x002f,
  36041. "slashBig",
  36042. 0x002f,
  36043. "slashBigg",
  36044. 0x002f,
  36045. "slashbigg",
  36046. 0x002f,
  36047. "summationdisplay",
  36048. 0x2211,
  36049. "summationtext",
  36050. 0x2211,
  36051. "tildewide",
  36052. 0x02dc,
  36053. "tildewider",
  36054. 0x02dc,
  36055. "tildewidest",
  36056. 0x02dc,
  36057. "uniondisplay",
  36058. 0x22c3,
  36059. "unionmultidisplay",
  36060. 0x228e,
  36061. "unionmultitext",
  36062. 0x228e,
  36063. "unionsqdisplay",
  36064. 0x2294,
  36065. "unionsqtext",
  36066. 0x2294,
  36067. "uniontext",
  36068. 0x22c3,
  36069. "vextenddouble",
  36070. 0x2225,
  36071. "vextendsingle",
  36072. 0x2223
  36073. ];
  36074. });
  36075. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  36076. return [
  36077. "space",
  36078. 0x0020,
  36079. "a1",
  36080. 0x2701,
  36081. "a2",
  36082. 0x2702,
  36083. "a202",
  36084. 0x2703,
  36085. "a3",
  36086. 0x2704,
  36087. "a4",
  36088. 0x260e,
  36089. "a5",
  36090. 0x2706,
  36091. "a119",
  36092. 0x2707,
  36093. "a118",
  36094. 0x2708,
  36095. "a117",
  36096. 0x2709,
  36097. "a11",
  36098. 0x261b,
  36099. "a12",
  36100. 0x261e,
  36101. "a13",
  36102. 0x270c,
  36103. "a14",
  36104. 0x270d,
  36105. "a15",
  36106. 0x270e,
  36107. "a16",
  36108. 0x270f,
  36109. "a105",
  36110. 0x2710,
  36111. "a17",
  36112. 0x2711,
  36113. "a18",
  36114. 0x2712,
  36115. "a19",
  36116. 0x2713,
  36117. "a20",
  36118. 0x2714,
  36119. "a21",
  36120. 0x2715,
  36121. "a22",
  36122. 0x2716,
  36123. "a23",
  36124. 0x2717,
  36125. "a24",
  36126. 0x2718,
  36127. "a25",
  36128. 0x2719,
  36129. "a26",
  36130. 0x271a,
  36131. "a27",
  36132. 0x271b,
  36133. "a28",
  36134. 0x271c,
  36135. "a6",
  36136. 0x271d,
  36137. "a7",
  36138. 0x271e,
  36139. "a8",
  36140. 0x271f,
  36141. "a9",
  36142. 0x2720,
  36143. "a10",
  36144. 0x2721,
  36145. "a29",
  36146. 0x2722,
  36147. "a30",
  36148. 0x2723,
  36149. "a31",
  36150. 0x2724,
  36151. "a32",
  36152. 0x2725,
  36153. "a33",
  36154. 0x2726,
  36155. "a34",
  36156. 0x2727,
  36157. "a35",
  36158. 0x2605,
  36159. "a36",
  36160. 0x2729,
  36161. "a37",
  36162. 0x272a,
  36163. "a38",
  36164. 0x272b,
  36165. "a39",
  36166. 0x272c,
  36167. "a40",
  36168. 0x272d,
  36169. "a41",
  36170. 0x272e,
  36171. "a42",
  36172. 0x272f,
  36173. "a43",
  36174. 0x2730,
  36175. "a44",
  36176. 0x2731,
  36177. "a45",
  36178. 0x2732,
  36179. "a46",
  36180. 0x2733,
  36181. "a47",
  36182. 0x2734,
  36183. "a48",
  36184. 0x2735,
  36185. "a49",
  36186. 0x2736,
  36187. "a50",
  36188. 0x2737,
  36189. "a51",
  36190. 0x2738,
  36191. "a52",
  36192. 0x2739,
  36193. "a53",
  36194. 0x273a,
  36195. "a54",
  36196. 0x273b,
  36197. "a55",
  36198. 0x273c,
  36199. "a56",
  36200. 0x273d,
  36201. "a57",
  36202. 0x273e,
  36203. "a58",
  36204. 0x273f,
  36205. "a59",
  36206. 0x2740,
  36207. "a60",
  36208. 0x2741,
  36209. "a61",
  36210. 0x2742,
  36211. "a62",
  36212. 0x2743,
  36213. "a63",
  36214. 0x2744,
  36215. "a64",
  36216. 0x2745,
  36217. "a65",
  36218. 0x2746,
  36219. "a66",
  36220. 0x2747,
  36221. "a67",
  36222. 0x2748,
  36223. "a68",
  36224. 0x2749,
  36225. "a69",
  36226. 0x274a,
  36227. "a70",
  36228. 0x274b,
  36229. "a71",
  36230. 0x25cf,
  36231. "a72",
  36232. 0x274d,
  36233. "a73",
  36234. 0x25a0,
  36235. "a74",
  36236. 0x274f,
  36237. "a203",
  36238. 0x2750,
  36239. "a75",
  36240. 0x2751,
  36241. "a204",
  36242. 0x2752,
  36243. "a76",
  36244. 0x25b2,
  36245. "a77",
  36246. 0x25bc,
  36247. "a78",
  36248. 0x25c6,
  36249. "a79",
  36250. 0x2756,
  36251. "a81",
  36252. 0x25d7,
  36253. "a82",
  36254. 0x2758,
  36255. "a83",
  36256. 0x2759,
  36257. "a84",
  36258. 0x275a,
  36259. "a97",
  36260. 0x275b,
  36261. "a98",
  36262. 0x275c,
  36263. "a99",
  36264. 0x275d,
  36265. "a100",
  36266. 0x275e,
  36267. "a101",
  36268. 0x2761,
  36269. "a102",
  36270. 0x2762,
  36271. "a103",
  36272. 0x2763,
  36273. "a104",
  36274. 0x2764,
  36275. "a106",
  36276. 0x2765,
  36277. "a107",
  36278. 0x2766,
  36279. "a108",
  36280. 0x2767,
  36281. "a112",
  36282. 0x2663,
  36283. "a111",
  36284. 0x2666,
  36285. "a110",
  36286. 0x2665,
  36287. "a109",
  36288. 0x2660,
  36289. "a120",
  36290. 0x2460,
  36291. "a121",
  36292. 0x2461,
  36293. "a122",
  36294. 0x2462,
  36295. "a123",
  36296. 0x2463,
  36297. "a124",
  36298. 0x2464,
  36299. "a125",
  36300. 0x2465,
  36301. "a126",
  36302. 0x2466,
  36303. "a127",
  36304. 0x2467,
  36305. "a128",
  36306. 0x2468,
  36307. "a129",
  36308. 0x2469,
  36309. "a130",
  36310. 0x2776,
  36311. "a131",
  36312. 0x2777,
  36313. "a132",
  36314. 0x2778,
  36315. "a133",
  36316. 0x2779,
  36317. "a134",
  36318. 0x277a,
  36319. "a135",
  36320. 0x277b,
  36321. "a136",
  36322. 0x277c,
  36323. "a137",
  36324. 0x277d,
  36325. "a138",
  36326. 0x277e,
  36327. "a139",
  36328. 0x277f,
  36329. "a140",
  36330. 0x2780,
  36331. "a141",
  36332. 0x2781,
  36333. "a142",
  36334. 0x2782,
  36335. "a143",
  36336. 0x2783,
  36337. "a144",
  36338. 0x2784,
  36339. "a145",
  36340. 0x2785,
  36341. "a146",
  36342. 0x2786,
  36343. "a147",
  36344. 0x2787,
  36345. "a148",
  36346. 0x2788,
  36347. "a149",
  36348. 0x2789,
  36349. "a150",
  36350. 0x278a,
  36351. "a151",
  36352. 0x278b,
  36353. "a152",
  36354. 0x278c,
  36355. "a153",
  36356. 0x278d,
  36357. "a154",
  36358. 0x278e,
  36359. "a155",
  36360. 0x278f,
  36361. "a156",
  36362. 0x2790,
  36363. "a157",
  36364. 0x2791,
  36365. "a158",
  36366. 0x2792,
  36367. "a159",
  36368. 0x2793,
  36369. "a160",
  36370. 0x2794,
  36371. "a161",
  36372. 0x2192,
  36373. "a163",
  36374. 0x2194,
  36375. "a164",
  36376. 0x2195,
  36377. "a196",
  36378. 0x2798,
  36379. "a165",
  36380. 0x2799,
  36381. "a192",
  36382. 0x279a,
  36383. "a166",
  36384. 0x279b,
  36385. "a167",
  36386. 0x279c,
  36387. "a168",
  36388. 0x279d,
  36389. "a169",
  36390. 0x279e,
  36391. "a170",
  36392. 0x279f,
  36393. "a171",
  36394. 0x27a0,
  36395. "a172",
  36396. 0x27a1,
  36397. "a173",
  36398. 0x27a2,
  36399. "a162",
  36400. 0x27a3,
  36401. "a174",
  36402. 0x27a4,
  36403. "a175",
  36404. 0x27a5,
  36405. "a176",
  36406. 0x27a6,
  36407. "a177",
  36408. 0x27a7,
  36409. "a178",
  36410. 0x27a8,
  36411. "a179",
  36412. 0x27a9,
  36413. "a193",
  36414. 0x27aa,
  36415. "a180",
  36416. 0x27ab,
  36417. "a199",
  36418. 0x27ac,
  36419. "a181",
  36420. 0x27ad,
  36421. "a200",
  36422. 0x27ae,
  36423. "a182",
  36424. 0x27af,
  36425. "a201",
  36426. 0x27b1,
  36427. "a183",
  36428. 0x27b2,
  36429. "a184",
  36430. 0x27b3,
  36431. "a197",
  36432. 0x27b4,
  36433. "a185",
  36434. 0x27b5,
  36435. "a194",
  36436. 0x27b6,
  36437. "a198",
  36438. 0x27b7,
  36439. "a186",
  36440. 0x27b8,
  36441. "a195",
  36442. 0x27b9,
  36443. "a187",
  36444. 0x27ba,
  36445. "a188",
  36446. 0x27bb,
  36447. "a189",
  36448. 0x27bc,
  36449. "a190",
  36450. 0x27bd,
  36451. "a191",
  36452. 0x27be,
  36453. "a89",
  36454. 0x2768,
  36455. "a90",
  36456. 0x2769,
  36457. "a93",
  36458. 0x276a,
  36459. "a94",
  36460. 0x276b,
  36461. "a91",
  36462. 0x276c,
  36463. "a92",
  36464. 0x276d,
  36465. "a205",
  36466. 0x276e,
  36467. "a85",
  36468. 0x276f,
  36469. "a206",
  36470. 0x2770,
  36471. "a86",
  36472. 0x2771,
  36473. "a87",
  36474. 0x2772,
  36475. "a88",
  36476. 0x2773,
  36477. "a95",
  36478. 0x2774,
  36479. "a96",
  36480. 0x2775,
  36481. ".notdef",
  36482. 0x0000
  36483. ];
  36484. });
  36485. /***/ }),
  36486. /* 169 */
  36487. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  36488. "use strict";
  36489. __w_pdfjs_require__.r(__webpack_exports__);
  36490. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  36491. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  36492. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  36493. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  36494. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  36495. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  36496. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  36497. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  36498. /* harmony export */ });
  36499. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(135);
  36500. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  36501. t[63721] = 0x00a9;
  36502. t[63193] = 0x00a9;
  36503. t[63720] = 0x00ae;
  36504. t[63194] = 0x00ae;
  36505. t[63722] = 0x2122;
  36506. t[63195] = 0x2122;
  36507. t[63729] = 0x23a7;
  36508. t[63730] = 0x23a8;
  36509. t[63731] = 0x23a9;
  36510. t[63740] = 0x23ab;
  36511. t[63741] = 0x23ac;
  36512. t[63742] = 0x23ad;
  36513. t[63726] = 0x23a1;
  36514. t[63727] = 0x23a2;
  36515. t[63728] = 0x23a3;
  36516. t[63737] = 0x23a4;
  36517. t[63738] = 0x23a5;
  36518. t[63739] = 0x23a6;
  36519. t[63723] = 0x239b;
  36520. t[63724] = 0x239c;
  36521. t[63725] = 0x239d;
  36522. t[63734] = 0x239e;
  36523. t[63735] = 0x239f;
  36524. t[63736] = 0x23a0;
  36525. });
  36526. function mapSpecialUnicodeValues(code) {
  36527. if (code >= 0xfff0 && code <= 0xffff) {
  36528. return 0;
  36529. } else if (code >= 0xf600 && code <= 0xf8ff) {
  36530. return getSpecialPUASymbols()[code] || code;
  36531. } else if (code === 0x00ad) {
  36532. return 0x002d;
  36533. }
  36534. return code;
  36535. }
  36536. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  36537. let unicode = glyphsUnicodeMap[name];
  36538. if (unicode !== undefined) {
  36539. return unicode;
  36540. }
  36541. if (!name) {
  36542. return -1;
  36543. }
  36544. if (name[0] === "u") {
  36545. const nameLen = name.length;
  36546. let hexStr;
  36547. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  36548. hexStr = name.substring(3);
  36549. } else if (nameLen >= 5 && nameLen <= 7) {
  36550. hexStr = name.substring(1);
  36551. } else {
  36552. return -1;
  36553. }
  36554. if (hexStr === hexStr.toUpperCase()) {
  36555. unicode = parseInt(hexStr, 16);
  36556. if (unicode >= 0) {
  36557. return unicode;
  36558. }
  36559. }
  36560. }
  36561. return -1;
  36562. }
  36563. const UnicodeRanges = [
  36564. {
  36565. begin: 0x0000,
  36566. end: 0x007f
  36567. },
  36568. {
  36569. begin: 0x0080,
  36570. end: 0x00ff
  36571. },
  36572. {
  36573. begin: 0x0100,
  36574. end: 0x017f
  36575. },
  36576. {
  36577. begin: 0x0180,
  36578. end: 0x024f
  36579. },
  36580. {
  36581. begin: 0x0250,
  36582. end: 0x02af
  36583. },
  36584. {
  36585. begin: 0x02b0,
  36586. end: 0x02ff
  36587. },
  36588. {
  36589. begin: 0x0300,
  36590. end: 0x036f
  36591. },
  36592. {
  36593. begin: 0x0370,
  36594. end: 0x03ff
  36595. },
  36596. {
  36597. begin: 0x2c80,
  36598. end: 0x2cff
  36599. },
  36600. {
  36601. begin: 0x0400,
  36602. end: 0x04ff
  36603. },
  36604. {
  36605. begin: 0x0530,
  36606. end: 0x058f
  36607. },
  36608. {
  36609. begin: 0x0590,
  36610. end: 0x05ff
  36611. },
  36612. {
  36613. begin: 0xa500,
  36614. end: 0xa63f
  36615. },
  36616. {
  36617. begin: 0x0600,
  36618. end: 0x06ff
  36619. },
  36620. {
  36621. begin: 0x07c0,
  36622. end: 0x07ff
  36623. },
  36624. {
  36625. begin: 0x0900,
  36626. end: 0x097f
  36627. },
  36628. {
  36629. begin: 0x0980,
  36630. end: 0x09ff
  36631. },
  36632. {
  36633. begin: 0x0a00,
  36634. end: 0x0a7f
  36635. },
  36636. {
  36637. begin: 0x0a80,
  36638. end: 0x0aff
  36639. },
  36640. {
  36641. begin: 0x0b00,
  36642. end: 0x0b7f
  36643. },
  36644. {
  36645. begin: 0x0b80,
  36646. end: 0x0bff
  36647. },
  36648. {
  36649. begin: 0x0c00,
  36650. end: 0x0c7f
  36651. },
  36652. {
  36653. begin: 0x0c80,
  36654. end: 0x0cff
  36655. },
  36656. {
  36657. begin: 0x0d00,
  36658. end: 0x0d7f
  36659. },
  36660. {
  36661. begin: 0x0e00,
  36662. end: 0x0e7f
  36663. },
  36664. {
  36665. begin: 0x0e80,
  36666. end: 0x0eff
  36667. },
  36668. {
  36669. begin: 0x10a0,
  36670. end: 0x10ff
  36671. },
  36672. {
  36673. begin: 0x1b00,
  36674. end: 0x1b7f
  36675. },
  36676. {
  36677. begin: 0x1100,
  36678. end: 0x11ff
  36679. },
  36680. {
  36681. begin: 0x1e00,
  36682. end: 0x1eff
  36683. },
  36684. {
  36685. begin: 0x1f00,
  36686. end: 0x1fff
  36687. },
  36688. {
  36689. begin: 0x2000,
  36690. end: 0x206f
  36691. },
  36692. {
  36693. begin: 0x2070,
  36694. end: 0x209f
  36695. },
  36696. {
  36697. begin: 0x20a0,
  36698. end: 0x20cf
  36699. },
  36700. {
  36701. begin: 0x20d0,
  36702. end: 0x20ff
  36703. },
  36704. {
  36705. begin: 0x2100,
  36706. end: 0x214f
  36707. },
  36708. {
  36709. begin: 0x2150,
  36710. end: 0x218f
  36711. },
  36712. {
  36713. begin: 0x2190,
  36714. end: 0x21ff
  36715. },
  36716. {
  36717. begin: 0x2200,
  36718. end: 0x22ff
  36719. },
  36720. {
  36721. begin: 0x2300,
  36722. end: 0x23ff
  36723. },
  36724. {
  36725. begin: 0x2400,
  36726. end: 0x243f
  36727. },
  36728. {
  36729. begin: 0x2440,
  36730. end: 0x245f
  36731. },
  36732. {
  36733. begin: 0x2460,
  36734. end: 0x24ff
  36735. },
  36736. {
  36737. begin: 0x2500,
  36738. end: 0x257f
  36739. },
  36740. {
  36741. begin: 0x2580,
  36742. end: 0x259f
  36743. },
  36744. {
  36745. begin: 0x25a0,
  36746. end: 0x25ff
  36747. },
  36748. {
  36749. begin: 0x2600,
  36750. end: 0x26ff
  36751. },
  36752. {
  36753. begin: 0x2700,
  36754. end: 0x27bf
  36755. },
  36756. {
  36757. begin: 0x3000,
  36758. end: 0x303f
  36759. },
  36760. {
  36761. begin: 0x3040,
  36762. end: 0x309f
  36763. },
  36764. {
  36765. begin: 0x30a0,
  36766. end: 0x30ff
  36767. },
  36768. {
  36769. begin: 0x3100,
  36770. end: 0x312f
  36771. },
  36772. {
  36773. begin: 0x3130,
  36774. end: 0x318f
  36775. },
  36776. {
  36777. begin: 0xa840,
  36778. end: 0xa87f
  36779. },
  36780. {
  36781. begin: 0x3200,
  36782. end: 0x32ff
  36783. },
  36784. {
  36785. begin: 0x3300,
  36786. end: 0x33ff
  36787. },
  36788. {
  36789. begin: 0xac00,
  36790. end: 0xd7af
  36791. },
  36792. {
  36793. begin: 0xd800,
  36794. end: 0xdfff
  36795. },
  36796. {
  36797. begin: 0x10900,
  36798. end: 0x1091f
  36799. },
  36800. {
  36801. begin: 0x4e00,
  36802. end: 0x9fff
  36803. },
  36804. {
  36805. begin: 0xe000,
  36806. end: 0xf8ff
  36807. },
  36808. {
  36809. begin: 0x31c0,
  36810. end: 0x31ef
  36811. },
  36812. {
  36813. begin: 0xfb00,
  36814. end: 0xfb4f
  36815. },
  36816. {
  36817. begin: 0xfb50,
  36818. end: 0xfdff
  36819. },
  36820. {
  36821. begin: 0xfe20,
  36822. end: 0xfe2f
  36823. },
  36824. {
  36825. begin: 0xfe10,
  36826. end: 0xfe1f
  36827. },
  36828. {
  36829. begin: 0xfe50,
  36830. end: 0xfe6f
  36831. },
  36832. {
  36833. begin: 0xfe70,
  36834. end: 0xfeff
  36835. },
  36836. {
  36837. begin: 0xff00,
  36838. end: 0xffef
  36839. },
  36840. {
  36841. begin: 0xfff0,
  36842. end: 0xffff
  36843. },
  36844. {
  36845. begin: 0x0f00,
  36846. end: 0x0fff
  36847. },
  36848. {
  36849. begin: 0x0700,
  36850. end: 0x074f
  36851. },
  36852. {
  36853. begin: 0x0780,
  36854. end: 0x07bf
  36855. },
  36856. {
  36857. begin: 0x0d80,
  36858. end: 0x0dff
  36859. },
  36860. {
  36861. begin: 0x1000,
  36862. end: 0x109f
  36863. },
  36864. {
  36865. begin: 0x1200,
  36866. end: 0x137f
  36867. },
  36868. {
  36869. begin: 0x13a0,
  36870. end: 0x13ff
  36871. },
  36872. {
  36873. begin: 0x1400,
  36874. end: 0x167f
  36875. },
  36876. {
  36877. begin: 0x1680,
  36878. end: 0x169f
  36879. },
  36880. {
  36881. begin: 0x16a0,
  36882. end: 0x16ff
  36883. },
  36884. {
  36885. begin: 0x1780,
  36886. end: 0x17ff
  36887. },
  36888. {
  36889. begin: 0x1800,
  36890. end: 0x18af
  36891. },
  36892. {
  36893. begin: 0x2800,
  36894. end: 0x28ff
  36895. },
  36896. {
  36897. begin: 0xa000,
  36898. end: 0xa48f
  36899. },
  36900. {
  36901. begin: 0x1700,
  36902. end: 0x171f
  36903. },
  36904. {
  36905. begin: 0x10300,
  36906. end: 0x1032f
  36907. },
  36908. {
  36909. begin: 0x10330,
  36910. end: 0x1034f
  36911. },
  36912. {
  36913. begin: 0x10400,
  36914. end: 0x1044f
  36915. },
  36916. {
  36917. begin: 0x1d000,
  36918. end: 0x1d0ff
  36919. },
  36920. {
  36921. begin: 0x1d400,
  36922. end: 0x1d7ff
  36923. },
  36924. {
  36925. begin: 0xff000,
  36926. end: 0xffffd
  36927. },
  36928. {
  36929. begin: 0xfe00,
  36930. end: 0xfe0f
  36931. },
  36932. {
  36933. begin: 0xe0000,
  36934. end: 0xe007f
  36935. },
  36936. {
  36937. begin: 0x1900,
  36938. end: 0x194f
  36939. },
  36940. {
  36941. begin: 0x1950,
  36942. end: 0x197f
  36943. },
  36944. {
  36945. begin: 0x1980,
  36946. end: 0x19df
  36947. },
  36948. {
  36949. begin: 0x1a00,
  36950. end: 0x1a1f
  36951. },
  36952. {
  36953. begin: 0x2c00,
  36954. end: 0x2c5f
  36955. },
  36956. {
  36957. begin: 0x2d30,
  36958. end: 0x2d7f
  36959. },
  36960. {
  36961. begin: 0x4dc0,
  36962. end: 0x4dff
  36963. },
  36964. {
  36965. begin: 0xa800,
  36966. end: 0xa82f
  36967. },
  36968. {
  36969. begin: 0x10000,
  36970. end: 0x1007f
  36971. },
  36972. {
  36973. begin: 0x10140,
  36974. end: 0x1018f
  36975. },
  36976. {
  36977. begin: 0x10380,
  36978. end: 0x1039f
  36979. },
  36980. {
  36981. begin: 0x103a0,
  36982. end: 0x103df
  36983. },
  36984. {
  36985. begin: 0x10450,
  36986. end: 0x1047f
  36987. },
  36988. {
  36989. begin: 0x10480,
  36990. end: 0x104af
  36991. },
  36992. {
  36993. begin: 0x10800,
  36994. end: 0x1083f
  36995. },
  36996. {
  36997. begin: 0x10a00,
  36998. end: 0x10a5f
  36999. },
  37000. {
  37001. begin: 0x1d300,
  37002. end: 0x1d35f
  37003. },
  37004. {
  37005. begin: 0x12000,
  37006. end: 0x123ff
  37007. },
  37008. {
  37009. begin: 0x1d360,
  37010. end: 0x1d37f
  37011. },
  37012. {
  37013. begin: 0x1b80,
  37014. end: 0x1bbf
  37015. },
  37016. {
  37017. begin: 0x1c00,
  37018. end: 0x1c4f
  37019. },
  37020. {
  37021. begin: 0x1c50,
  37022. end: 0x1c7f
  37023. },
  37024. {
  37025. begin: 0xa880,
  37026. end: 0xa8df
  37027. },
  37028. {
  37029. begin: 0xa900,
  37030. end: 0xa92f
  37031. },
  37032. {
  37033. begin: 0xa930,
  37034. end: 0xa95f
  37035. },
  37036. {
  37037. begin: 0xaa00,
  37038. end: 0xaa5f
  37039. },
  37040. {
  37041. begin: 0x10190,
  37042. end: 0x101cf
  37043. },
  37044. {
  37045. begin: 0x101d0,
  37046. end: 0x101ff
  37047. },
  37048. {
  37049. begin: 0x102a0,
  37050. end: 0x102df
  37051. },
  37052. {
  37053. begin: 0x1f030,
  37054. end: 0x1f09f
  37055. }
  37056. ];
  37057. function getUnicodeRangeFor(value) {
  37058. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  37059. const range = UnicodeRanges[i];
  37060. if (value >= range.begin && value < range.end) {
  37061. return i;
  37062. }
  37063. }
  37064. return -1;
  37065. }
  37066. function isRTLRangeFor(value) {
  37067. let range = UnicodeRanges[13];
  37068. if (value >= range.begin && value < range.end) {
  37069. return true;
  37070. }
  37071. range = UnicodeRanges[11];
  37072. if (value >= range.begin && value < range.end) {
  37073. return true;
  37074. }
  37075. return false;
  37076. }
  37077. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  37078. return [
  37079. "\u00A8",
  37080. "\u0020\u0308",
  37081. "\u00AF",
  37082. "\u0020\u0304",
  37083. "\u00B4",
  37084. "\u0020\u0301",
  37085. "\u00B5",
  37086. "\u03BC",
  37087. "\u00B8",
  37088. "\u0020\u0327",
  37089. "\u0132",
  37090. "\u0049\u004A",
  37091. "\u0133",
  37092. "\u0069\u006A",
  37093. "\u013F",
  37094. "\u004C\u00B7",
  37095. "\u0140",
  37096. "\u006C\u00B7",
  37097. "\u0149",
  37098. "\u02BC\u006E",
  37099. "\u017F",
  37100. "\u0073",
  37101. "\u01C4",
  37102. "\u0044\u017D",
  37103. "\u01C5",
  37104. "\u0044\u017E",
  37105. "\u01C6",
  37106. "\u0064\u017E",
  37107. "\u01C7",
  37108. "\u004C\u004A",
  37109. "\u01C8",
  37110. "\u004C\u006A",
  37111. "\u01C9",
  37112. "\u006C\u006A",
  37113. "\u01CA",
  37114. "\u004E\u004A",
  37115. "\u01CB",
  37116. "\u004E\u006A",
  37117. "\u01CC",
  37118. "\u006E\u006A",
  37119. "\u01F1",
  37120. "\u0044\u005A",
  37121. "\u01F2",
  37122. "\u0044\u007A",
  37123. "\u01F3",
  37124. "\u0064\u007A",
  37125. "\u02D8",
  37126. "\u0020\u0306",
  37127. "\u02D9",
  37128. "\u0020\u0307",
  37129. "\u02DA",
  37130. "\u0020\u030A",
  37131. "\u02DB",
  37132. "\u0020\u0328",
  37133. "\u02DC",
  37134. "\u0020\u0303",
  37135. "\u02DD",
  37136. "\u0020\u030B",
  37137. "\u037A",
  37138. "\u0020\u0345",
  37139. "\u0384",
  37140. "\u0020\u0301",
  37141. "\u03D0",
  37142. "\u03B2",
  37143. "\u03D1",
  37144. "\u03B8",
  37145. "\u03D2",
  37146. "\u03A5",
  37147. "\u03D5",
  37148. "\u03C6",
  37149. "\u03D6",
  37150. "\u03C0",
  37151. "\u03F0",
  37152. "\u03BA",
  37153. "\u03F1",
  37154. "\u03C1",
  37155. "\u03F2",
  37156. "\u03C2",
  37157. "\u03F4",
  37158. "\u0398",
  37159. "\u03F5",
  37160. "\u03B5",
  37161. "\u03F9",
  37162. "\u03A3",
  37163. "\u0587",
  37164. "\u0565\u0582",
  37165. "\u0675",
  37166. "\u0627\u0674",
  37167. "\u0676",
  37168. "\u0648\u0674",
  37169. "\u0677",
  37170. "\u06C7\u0674",
  37171. "\u0678",
  37172. "\u064A\u0674",
  37173. "\u0E33",
  37174. "\u0E4D\u0E32",
  37175. "\u0EB3",
  37176. "\u0ECD\u0EB2",
  37177. "\u0EDC",
  37178. "\u0EAB\u0E99",
  37179. "\u0EDD",
  37180. "\u0EAB\u0EA1",
  37181. "\u0F77",
  37182. "\u0FB2\u0F81",
  37183. "\u0F79",
  37184. "\u0FB3\u0F81",
  37185. "\u1E9A",
  37186. "\u0061\u02BE",
  37187. "\u1FBD",
  37188. "\u0020\u0313",
  37189. "\u1FBF",
  37190. "\u0020\u0313",
  37191. "\u1FC0",
  37192. "\u0020\u0342",
  37193. "\u1FFE",
  37194. "\u0020\u0314",
  37195. "\u2002",
  37196. "\u0020",
  37197. "\u2003",
  37198. "\u0020",
  37199. "\u2004",
  37200. "\u0020",
  37201. "\u2005",
  37202. "\u0020",
  37203. "\u2006",
  37204. "\u0020",
  37205. "\u2008",
  37206. "\u0020",
  37207. "\u2009",
  37208. "\u0020",
  37209. "\u200A",
  37210. "\u0020",
  37211. "\u2017",
  37212. "\u0020\u0333",
  37213. "\u2024",
  37214. "\u002E",
  37215. "\u2025",
  37216. "\u002E\u002E",
  37217. "\u2026",
  37218. "\u002E\u002E\u002E",
  37219. "\u2033",
  37220. "\u2032\u2032",
  37221. "\u2034",
  37222. "\u2032\u2032\u2032",
  37223. "\u2036",
  37224. "\u2035\u2035",
  37225. "\u2037",
  37226. "\u2035\u2035\u2035",
  37227. "\u203C",
  37228. "\u0021\u0021",
  37229. "\u203E",
  37230. "\u0020\u0305",
  37231. "\u2047",
  37232. "\u003F\u003F",
  37233. "\u2048",
  37234. "\u003F\u0021",
  37235. "\u2049",
  37236. "\u0021\u003F",
  37237. "\u2057",
  37238. "\u2032\u2032\u2032\u2032",
  37239. "\u205F",
  37240. "\u0020",
  37241. "\u20A8",
  37242. "\u0052\u0073",
  37243. "\u2100",
  37244. "\u0061\u002F\u0063",
  37245. "\u2101",
  37246. "\u0061\u002F\u0073",
  37247. "\u2103",
  37248. "\u00B0\u0043",
  37249. "\u2105",
  37250. "\u0063\u002F\u006F",
  37251. "\u2106",
  37252. "\u0063\u002F\u0075",
  37253. "\u2107",
  37254. "\u0190",
  37255. "\u2109",
  37256. "\u00B0\u0046",
  37257. "\u2116",
  37258. "\u004E\u006F",
  37259. "\u2121",
  37260. "\u0054\u0045\u004C",
  37261. "\u2135",
  37262. "\u05D0",
  37263. "\u2136",
  37264. "\u05D1",
  37265. "\u2137",
  37266. "\u05D2",
  37267. "\u2138",
  37268. "\u05D3",
  37269. "\u213B",
  37270. "\u0046\u0041\u0058",
  37271. "\u2160",
  37272. "\u0049",
  37273. "\u2161",
  37274. "\u0049\u0049",
  37275. "\u2162",
  37276. "\u0049\u0049\u0049",
  37277. "\u2163",
  37278. "\u0049\u0056",
  37279. "\u2164",
  37280. "\u0056",
  37281. "\u2165",
  37282. "\u0056\u0049",
  37283. "\u2166",
  37284. "\u0056\u0049\u0049",
  37285. "\u2167",
  37286. "\u0056\u0049\u0049\u0049",
  37287. "\u2168",
  37288. "\u0049\u0058",
  37289. "\u2169",
  37290. "\u0058",
  37291. "\u216A",
  37292. "\u0058\u0049",
  37293. "\u216B",
  37294. "\u0058\u0049\u0049",
  37295. "\u216C",
  37296. "\u004C",
  37297. "\u216D",
  37298. "\u0043",
  37299. "\u216E",
  37300. "\u0044",
  37301. "\u216F",
  37302. "\u004D",
  37303. "\u2170",
  37304. "\u0069",
  37305. "\u2171",
  37306. "\u0069\u0069",
  37307. "\u2172",
  37308. "\u0069\u0069\u0069",
  37309. "\u2173",
  37310. "\u0069\u0076",
  37311. "\u2174",
  37312. "\u0076",
  37313. "\u2175",
  37314. "\u0076\u0069",
  37315. "\u2176",
  37316. "\u0076\u0069\u0069",
  37317. "\u2177",
  37318. "\u0076\u0069\u0069\u0069",
  37319. "\u2178",
  37320. "\u0069\u0078",
  37321. "\u2179",
  37322. "\u0078",
  37323. "\u217A",
  37324. "\u0078\u0069",
  37325. "\u217B",
  37326. "\u0078\u0069\u0069",
  37327. "\u217C",
  37328. "\u006C",
  37329. "\u217D",
  37330. "\u0063",
  37331. "\u217E",
  37332. "\u0064",
  37333. "\u217F",
  37334. "\u006D",
  37335. "\u222C",
  37336. "\u222B\u222B",
  37337. "\u222D",
  37338. "\u222B\u222B\u222B",
  37339. "\u222F",
  37340. "\u222E\u222E",
  37341. "\u2230",
  37342. "\u222E\u222E\u222E",
  37343. "\u2474",
  37344. "\u0028\u0031\u0029",
  37345. "\u2475",
  37346. "\u0028\u0032\u0029",
  37347. "\u2476",
  37348. "\u0028\u0033\u0029",
  37349. "\u2477",
  37350. "\u0028\u0034\u0029",
  37351. "\u2478",
  37352. "\u0028\u0035\u0029",
  37353. "\u2479",
  37354. "\u0028\u0036\u0029",
  37355. "\u247A",
  37356. "\u0028\u0037\u0029",
  37357. "\u247B",
  37358. "\u0028\u0038\u0029",
  37359. "\u247C",
  37360. "\u0028\u0039\u0029",
  37361. "\u247D",
  37362. "\u0028\u0031\u0030\u0029",
  37363. "\u247E",
  37364. "\u0028\u0031\u0031\u0029",
  37365. "\u247F",
  37366. "\u0028\u0031\u0032\u0029",
  37367. "\u2480",
  37368. "\u0028\u0031\u0033\u0029",
  37369. "\u2481",
  37370. "\u0028\u0031\u0034\u0029",
  37371. "\u2482",
  37372. "\u0028\u0031\u0035\u0029",
  37373. "\u2483",
  37374. "\u0028\u0031\u0036\u0029",
  37375. "\u2484",
  37376. "\u0028\u0031\u0037\u0029",
  37377. "\u2485",
  37378. "\u0028\u0031\u0038\u0029",
  37379. "\u2486",
  37380. "\u0028\u0031\u0039\u0029",
  37381. "\u2487",
  37382. "\u0028\u0032\u0030\u0029",
  37383. "\u2488",
  37384. "\u0031\u002E",
  37385. "\u2489",
  37386. "\u0032\u002E",
  37387. "\u248A",
  37388. "\u0033\u002E",
  37389. "\u248B",
  37390. "\u0034\u002E",
  37391. "\u248C",
  37392. "\u0035\u002E",
  37393. "\u248D",
  37394. "\u0036\u002E",
  37395. "\u248E",
  37396. "\u0037\u002E",
  37397. "\u248F",
  37398. "\u0038\u002E",
  37399. "\u2490",
  37400. "\u0039\u002E",
  37401. "\u2491",
  37402. "\u0031\u0030\u002E",
  37403. "\u2492",
  37404. "\u0031\u0031\u002E",
  37405. "\u2493",
  37406. "\u0031\u0032\u002E",
  37407. "\u2494",
  37408. "\u0031\u0033\u002E",
  37409. "\u2495",
  37410. "\u0031\u0034\u002E",
  37411. "\u2496",
  37412. "\u0031\u0035\u002E",
  37413. "\u2497",
  37414. "\u0031\u0036\u002E",
  37415. "\u2498",
  37416. "\u0031\u0037\u002E",
  37417. "\u2499",
  37418. "\u0031\u0038\u002E",
  37419. "\u249A",
  37420. "\u0031\u0039\u002E",
  37421. "\u249B",
  37422. "\u0032\u0030\u002E",
  37423. "\u249C",
  37424. "\u0028\u0061\u0029",
  37425. "\u249D",
  37426. "\u0028\u0062\u0029",
  37427. "\u249E",
  37428. "\u0028\u0063\u0029",
  37429. "\u249F",
  37430. "\u0028\u0064\u0029",
  37431. "\u24A0",
  37432. "\u0028\u0065\u0029",
  37433. "\u24A1",
  37434. "\u0028\u0066\u0029",
  37435. "\u24A2",
  37436. "\u0028\u0067\u0029",
  37437. "\u24A3",
  37438. "\u0028\u0068\u0029",
  37439. "\u24A4",
  37440. "\u0028\u0069\u0029",
  37441. "\u24A5",
  37442. "\u0028\u006A\u0029",
  37443. "\u24A6",
  37444. "\u0028\u006B\u0029",
  37445. "\u24A7",
  37446. "\u0028\u006C\u0029",
  37447. "\u24A8",
  37448. "\u0028\u006D\u0029",
  37449. "\u24A9",
  37450. "\u0028\u006E\u0029",
  37451. "\u24AA",
  37452. "\u0028\u006F\u0029",
  37453. "\u24AB",
  37454. "\u0028\u0070\u0029",
  37455. "\u24AC",
  37456. "\u0028\u0071\u0029",
  37457. "\u24AD",
  37458. "\u0028\u0072\u0029",
  37459. "\u24AE",
  37460. "\u0028\u0073\u0029",
  37461. "\u24AF",
  37462. "\u0028\u0074\u0029",
  37463. "\u24B0",
  37464. "\u0028\u0075\u0029",
  37465. "\u24B1",
  37466. "\u0028\u0076\u0029",
  37467. "\u24B2",
  37468. "\u0028\u0077\u0029",
  37469. "\u24B3",
  37470. "\u0028\u0078\u0029",
  37471. "\u24B4",
  37472. "\u0028\u0079\u0029",
  37473. "\u24B5",
  37474. "\u0028\u007A\u0029",
  37475. "\u2A0C",
  37476. "\u222B\u222B\u222B\u222B",
  37477. "\u2A74",
  37478. "\u003A\u003A\u003D",
  37479. "\u2A75",
  37480. "\u003D\u003D",
  37481. "\u2A76",
  37482. "\u003D\u003D\u003D",
  37483. "\u2E9F",
  37484. "\u6BCD",
  37485. "\u2EF3",
  37486. "\u9F9F",
  37487. "\u2F00",
  37488. "\u4E00",
  37489. "\u2F01",
  37490. "\u4E28",
  37491. "\u2F02",
  37492. "\u4E36",
  37493. "\u2F03",
  37494. "\u4E3F",
  37495. "\u2F04",
  37496. "\u4E59",
  37497. "\u2F05",
  37498. "\u4E85",
  37499. "\u2F06",
  37500. "\u4E8C",
  37501. "\u2F07",
  37502. "\u4EA0",
  37503. "\u2F08",
  37504. "\u4EBA",
  37505. "\u2F09",
  37506. "\u513F",
  37507. "\u2F0A",
  37508. "\u5165",
  37509. "\u2F0B",
  37510. "\u516B",
  37511. "\u2F0C",
  37512. "\u5182",
  37513. "\u2F0D",
  37514. "\u5196",
  37515. "\u2F0E",
  37516. "\u51AB",
  37517. "\u2F0F",
  37518. "\u51E0",
  37519. "\u2F10",
  37520. "\u51F5",
  37521. "\u2F11",
  37522. "\u5200",
  37523. "\u2F12",
  37524. "\u529B",
  37525. "\u2F13",
  37526. "\u52F9",
  37527. "\u2F14",
  37528. "\u5315",
  37529. "\u2F15",
  37530. "\u531A",
  37531. "\u2F16",
  37532. "\u5338",
  37533. "\u2F17",
  37534. "\u5341",
  37535. "\u2F18",
  37536. "\u535C",
  37537. "\u2F19",
  37538. "\u5369",
  37539. "\u2F1A",
  37540. "\u5382",
  37541. "\u2F1B",
  37542. "\u53B6",
  37543. "\u2F1C",
  37544. "\u53C8",
  37545. "\u2F1D",
  37546. "\u53E3",
  37547. "\u2F1E",
  37548. "\u56D7",
  37549. "\u2F1F",
  37550. "\u571F",
  37551. "\u2F20",
  37552. "\u58EB",
  37553. "\u2F21",
  37554. "\u5902",
  37555. "\u2F22",
  37556. "\u590A",
  37557. "\u2F23",
  37558. "\u5915",
  37559. "\u2F24",
  37560. "\u5927",
  37561. "\u2F25",
  37562. "\u5973",
  37563. "\u2F26",
  37564. "\u5B50",
  37565. "\u2F27",
  37566. "\u5B80",
  37567. "\u2F28",
  37568. "\u5BF8",
  37569. "\u2F29",
  37570. "\u5C0F",
  37571. "\u2F2A",
  37572. "\u5C22",
  37573. "\u2F2B",
  37574. "\u5C38",
  37575. "\u2F2C",
  37576. "\u5C6E",
  37577. "\u2F2D",
  37578. "\u5C71",
  37579. "\u2F2E",
  37580. "\u5DDB",
  37581. "\u2F2F",
  37582. "\u5DE5",
  37583. "\u2F30",
  37584. "\u5DF1",
  37585. "\u2F31",
  37586. "\u5DFE",
  37587. "\u2F32",
  37588. "\u5E72",
  37589. "\u2F33",
  37590. "\u5E7A",
  37591. "\u2F34",
  37592. "\u5E7F",
  37593. "\u2F35",
  37594. "\u5EF4",
  37595. "\u2F36",
  37596. "\u5EFE",
  37597. "\u2F37",
  37598. "\u5F0B",
  37599. "\u2F38",
  37600. "\u5F13",
  37601. "\u2F39",
  37602. "\u5F50",
  37603. "\u2F3A",
  37604. "\u5F61",
  37605. "\u2F3B",
  37606. "\u5F73",
  37607. "\u2F3C",
  37608. "\u5FC3",
  37609. "\u2F3D",
  37610. "\u6208",
  37611. "\u2F3E",
  37612. "\u6236",
  37613. "\u2F3F",
  37614. "\u624B",
  37615. "\u2F40",
  37616. "\u652F",
  37617. "\u2F41",
  37618. "\u6534",
  37619. "\u2F42",
  37620. "\u6587",
  37621. "\u2F43",
  37622. "\u6597",
  37623. "\u2F44",
  37624. "\u65A4",
  37625. "\u2F45",
  37626. "\u65B9",
  37627. "\u2F46",
  37628. "\u65E0",
  37629. "\u2F47",
  37630. "\u65E5",
  37631. "\u2F48",
  37632. "\u66F0",
  37633. "\u2F49",
  37634. "\u6708",
  37635. "\u2F4A",
  37636. "\u6728",
  37637. "\u2F4B",
  37638. "\u6B20",
  37639. "\u2F4C",
  37640. "\u6B62",
  37641. "\u2F4D",
  37642. "\u6B79",
  37643. "\u2F4E",
  37644. "\u6BB3",
  37645. "\u2F4F",
  37646. "\u6BCB",
  37647. "\u2F50",
  37648. "\u6BD4",
  37649. "\u2F51",
  37650. "\u6BDB",
  37651. "\u2F52",
  37652. "\u6C0F",
  37653. "\u2F53",
  37654. "\u6C14",
  37655. "\u2F54",
  37656. "\u6C34",
  37657. "\u2F55",
  37658. "\u706B",
  37659. "\u2F56",
  37660. "\u722A",
  37661. "\u2F57",
  37662. "\u7236",
  37663. "\u2F58",
  37664. "\u723B",
  37665. "\u2F59",
  37666. "\u723F",
  37667. "\u2F5A",
  37668. "\u7247",
  37669. "\u2F5B",
  37670. "\u7259",
  37671. "\u2F5C",
  37672. "\u725B",
  37673. "\u2F5D",
  37674. "\u72AC",
  37675. "\u2F5E",
  37676. "\u7384",
  37677. "\u2F5F",
  37678. "\u7389",
  37679. "\u2F60",
  37680. "\u74DC",
  37681. "\u2F61",
  37682. "\u74E6",
  37683. "\u2F62",
  37684. "\u7518",
  37685. "\u2F63",
  37686. "\u751F",
  37687. "\u2F64",
  37688. "\u7528",
  37689. "\u2F65",
  37690. "\u7530",
  37691. "\u2F66",
  37692. "\u758B",
  37693. "\u2F67",
  37694. "\u7592",
  37695. "\u2F68",
  37696. "\u7676",
  37697. "\u2F69",
  37698. "\u767D",
  37699. "\u2F6A",
  37700. "\u76AE",
  37701. "\u2F6B",
  37702. "\u76BF",
  37703. "\u2F6C",
  37704. "\u76EE",
  37705. "\u2F6D",
  37706. "\u77DB",
  37707. "\u2F6E",
  37708. "\u77E2",
  37709. "\u2F6F",
  37710. "\u77F3",
  37711. "\u2F70",
  37712. "\u793A",
  37713. "\u2F71",
  37714. "\u79B8",
  37715. "\u2F72",
  37716. "\u79BE",
  37717. "\u2F73",
  37718. "\u7A74",
  37719. "\u2F74",
  37720. "\u7ACB",
  37721. "\u2F75",
  37722. "\u7AF9",
  37723. "\u2F76",
  37724. "\u7C73",
  37725. "\u2F77",
  37726. "\u7CF8",
  37727. "\u2F78",
  37728. "\u7F36",
  37729. "\u2F79",
  37730. "\u7F51",
  37731. "\u2F7A",
  37732. "\u7F8A",
  37733. "\u2F7B",
  37734. "\u7FBD",
  37735. "\u2F7C",
  37736. "\u8001",
  37737. "\u2F7D",
  37738. "\u800C",
  37739. "\u2F7E",
  37740. "\u8012",
  37741. "\u2F7F",
  37742. "\u8033",
  37743. "\u2F80",
  37744. "\u807F",
  37745. "\u2F81",
  37746. "\u8089",
  37747. "\u2F82",
  37748. "\u81E3",
  37749. "\u2F83",
  37750. "\u81EA",
  37751. "\u2F84",
  37752. "\u81F3",
  37753. "\u2F85",
  37754. "\u81FC",
  37755. "\u2F86",
  37756. "\u820C",
  37757. "\u2F87",
  37758. "\u821B",
  37759. "\u2F88",
  37760. "\u821F",
  37761. "\u2F89",
  37762. "\u826E",
  37763. "\u2F8A",
  37764. "\u8272",
  37765. "\u2F8B",
  37766. "\u8278",
  37767. "\u2F8C",
  37768. "\u864D",
  37769. "\u2F8D",
  37770. "\u866B",
  37771. "\u2F8E",
  37772. "\u8840",
  37773. "\u2F8F",
  37774. "\u884C",
  37775. "\u2F90",
  37776. "\u8863",
  37777. "\u2F91",
  37778. "\u897E",
  37779. "\u2F92",
  37780. "\u898B",
  37781. "\u2F93",
  37782. "\u89D2",
  37783. "\u2F94",
  37784. "\u8A00",
  37785. "\u2F95",
  37786. "\u8C37",
  37787. "\u2F96",
  37788. "\u8C46",
  37789. "\u2F97",
  37790. "\u8C55",
  37791. "\u2F98",
  37792. "\u8C78",
  37793. "\u2F99",
  37794. "\u8C9D",
  37795. "\u2F9A",
  37796. "\u8D64",
  37797. "\u2F9B",
  37798. "\u8D70",
  37799. "\u2F9C",
  37800. "\u8DB3",
  37801. "\u2F9D",
  37802. "\u8EAB",
  37803. "\u2F9E",
  37804. "\u8ECA",
  37805. "\u2F9F",
  37806. "\u8F9B",
  37807. "\u2FA0",
  37808. "\u8FB0",
  37809. "\u2FA1",
  37810. "\u8FB5",
  37811. "\u2FA2",
  37812. "\u9091",
  37813. "\u2FA3",
  37814. "\u9149",
  37815. "\u2FA4",
  37816. "\u91C6",
  37817. "\u2FA5",
  37818. "\u91CC",
  37819. "\u2FA6",
  37820. "\u91D1",
  37821. "\u2FA7",
  37822. "\u9577",
  37823. "\u2FA8",
  37824. "\u9580",
  37825. "\u2FA9",
  37826. "\u961C",
  37827. "\u2FAA",
  37828. "\u96B6",
  37829. "\u2FAB",
  37830. "\u96B9",
  37831. "\u2FAC",
  37832. "\u96E8",
  37833. "\u2FAD",
  37834. "\u9751",
  37835. "\u2FAE",
  37836. "\u975E",
  37837. "\u2FAF",
  37838. "\u9762",
  37839. "\u2FB0",
  37840. "\u9769",
  37841. "\u2FB1",
  37842. "\u97CB",
  37843. "\u2FB2",
  37844. "\u97ED",
  37845. "\u2FB3",
  37846. "\u97F3",
  37847. "\u2FB4",
  37848. "\u9801",
  37849. "\u2FB5",
  37850. "\u98A8",
  37851. "\u2FB6",
  37852. "\u98DB",
  37853. "\u2FB7",
  37854. "\u98DF",
  37855. "\u2FB8",
  37856. "\u9996",
  37857. "\u2FB9",
  37858. "\u9999",
  37859. "\u2FBA",
  37860. "\u99AC",
  37861. "\u2FBB",
  37862. "\u9AA8",
  37863. "\u2FBC",
  37864. "\u9AD8",
  37865. "\u2FBD",
  37866. "\u9ADF",
  37867. "\u2FBE",
  37868. "\u9B25",
  37869. "\u2FBF",
  37870. "\u9B2F",
  37871. "\u2FC0",
  37872. "\u9B32",
  37873. "\u2FC1",
  37874. "\u9B3C",
  37875. "\u2FC2",
  37876. "\u9B5A",
  37877. "\u2FC3",
  37878. "\u9CE5",
  37879. "\u2FC4",
  37880. "\u9E75",
  37881. "\u2FC5",
  37882. "\u9E7F",
  37883. "\u2FC6",
  37884. "\u9EA5",
  37885. "\u2FC7",
  37886. "\u9EBB",
  37887. "\u2FC8",
  37888. "\u9EC3",
  37889. "\u2FC9",
  37890. "\u9ECD",
  37891. "\u2FCA",
  37892. "\u9ED1",
  37893. "\u2FCB",
  37894. "\u9EF9",
  37895. "\u2FCC",
  37896. "\u9EFD",
  37897. "\u2FCD",
  37898. "\u9F0E",
  37899. "\u2FCE",
  37900. "\u9F13",
  37901. "\u2FCF",
  37902. "\u9F20",
  37903. "\u2FD0",
  37904. "\u9F3B",
  37905. "\u2FD1",
  37906. "\u9F4A",
  37907. "\u2FD2",
  37908. "\u9F52",
  37909. "\u2FD3",
  37910. "\u9F8D",
  37911. "\u2FD4",
  37912. "\u9F9C",
  37913. "\u2FD5",
  37914. "\u9FA0",
  37915. "\u3036",
  37916. "\u3012",
  37917. "\u3038",
  37918. "\u5341",
  37919. "\u3039",
  37920. "\u5344",
  37921. "\u303A",
  37922. "\u5345",
  37923. "\u309B",
  37924. "\u0020\u3099",
  37925. "\u309C",
  37926. "\u0020\u309A",
  37927. "\u3131",
  37928. "\u1100",
  37929. "\u3132",
  37930. "\u1101",
  37931. "\u3133",
  37932. "\u11AA",
  37933. "\u3134",
  37934. "\u1102",
  37935. "\u3135",
  37936. "\u11AC",
  37937. "\u3136",
  37938. "\u11AD",
  37939. "\u3137",
  37940. "\u1103",
  37941. "\u3138",
  37942. "\u1104",
  37943. "\u3139",
  37944. "\u1105",
  37945. "\u313A",
  37946. "\u11B0",
  37947. "\u313B",
  37948. "\u11B1",
  37949. "\u313C",
  37950. "\u11B2",
  37951. "\u313D",
  37952. "\u11B3",
  37953. "\u313E",
  37954. "\u11B4",
  37955. "\u313F",
  37956. "\u11B5",
  37957. "\u3140",
  37958. "\u111A",
  37959. "\u3141",
  37960. "\u1106",
  37961. "\u3142",
  37962. "\u1107",
  37963. "\u3143",
  37964. "\u1108",
  37965. "\u3144",
  37966. "\u1121",
  37967. "\u3145",
  37968. "\u1109",
  37969. "\u3146",
  37970. "\u110A",
  37971. "\u3147",
  37972. "\u110B",
  37973. "\u3148",
  37974. "\u110C",
  37975. "\u3149",
  37976. "\u110D",
  37977. "\u314A",
  37978. "\u110E",
  37979. "\u314B",
  37980. "\u110F",
  37981. "\u314C",
  37982. "\u1110",
  37983. "\u314D",
  37984. "\u1111",
  37985. "\u314E",
  37986. "\u1112",
  37987. "\u314F",
  37988. "\u1161",
  37989. "\u3150",
  37990. "\u1162",
  37991. "\u3151",
  37992. "\u1163",
  37993. "\u3152",
  37994. "\u1164",
  37995. "\u3153",
  37996. "\u1165",
  37997. "\u3154",
  37998. "\u1166",
  37999. "\u3155",
  38000. "\u1167",
  38001. "\u3156",
  38002. "\u1168",
  38003. "\u3157",
  38004. "\u1169",
  38005. "\u3158",
  38006. "\u116A",
  38007. "\u3159",
  38008. "\u116B",
  38009. "\u315A",
  38010. "\u116C",
  38011. "\u315B",
  38012. "\u116D",
  38013. "\u315C",
  38014. "\u116E",
  38015. "\u315D",
  38016. "\u116F",
  38017. "\u315E",
  38018. "\u1170",
  38019. "\u315F",
  38020. "\u1171",
  38021. "\u3160",
  38022. "\u1172",
  38023. "\u3161",
  38024. "\u1173",
  38025. "\u3162",
  38026. "\u1174",
  38027. "\u3163",
  38028. "\u1175",
  38029. "\u3164",
  38030. "\u1160",
  38031. "\u3165",
  38032. "\u1114",
  38033. "\u3166",
  38034. "\u1115",
  38035. "\u3167",
  38036. "\u11C7",
  38037. "\u3168",
  38038. "\u11C8",
  38039. "\u3169",
  38040. "\u11CC",
  38041. "\u316A",
  38042. "\u11CE",
  38043. "\u316B",
  38044. "\u11D3",
  38045. "\u316C",
  38046. "\u11D7",
  38047. "\u316D",
  38048. "\u11D9",
  38049. "\u316E",
  38050. "\u111C",
  38051. "\u316F",
  38052. "\u11DD",
  38053. "\u3170",
  38054. "\u11DF",
  38055. "\u3171",
  38056. "\u111D",
  38057. "\u3172",
  38058. "\u111E",
  38059. "\u3173",
  38060. "\u1120",
  38061. "\u3174",
  38062. "\u1122",
  38063. "\u3175",
  38064. "\u1123",
  38065. "\u3176",
  38066. "\u1127",
  38067. "\u3177",
  38068. "\u1129",
  38069. "\u3178",
  38070. "\u112B",
  38071. "\u3179",
  38072. "\u112C",
  38073. "\u317A",
  38074. "\u112D",
  38075. "\u317B",
  38076. "\u112E",
  38077. "\u317C",
  38078. "\u112F",
  38079. "\u317D",
  38080. "\u1132",
  38081. "\u317E",
  38082. "\u1136",
  38083. "\u317F",
  38084. "\u1140",
  38085. "\u3180",
  38086. "\u1147",
  38087. "\u3181",
  38088. "\u114C",
  38089. "\u3182",
  38090. "\u11F1",
  38091. "\u3183",
  38092. "\u11F2",
  38093. "\u3184",
  38094. "\u1157",
  38095. "\u3185",
  38096. "\u1158",
  38097. "\u3186",
  38098. "\u1159",
  38099. "\u3187",
  38100. "\u1184",
  38101. "\u3188",
  38102. "\u1185",
  38103. "\u3189",
  38104. "\u1188",
  38105. "\u318A",
  38106. "\u1191",
  38107. "\u318B",
  38108. "\u1192",
  38109. "\u318C",
  38110. "\u1194",
  38111. "\u318D",
  38112. "\u119E",
  38113. "\u318E",
  38114. "\u11A1",
  38115. "\u3200",
  38116. "\u0028\u1100\u0029",
  38117. "\u3201",
  38118. "\u0028\u1102\u0029",
  38119. "\u3202",
  38120. "\u0028\u1103\u0029",
  38121. "\u3203",
  38122. "\u0028\u1105\u0029",
  38123. "\u3204",
  38124. "\u0028\u1106\u0029",
  38125. "\u3205",
  38126. "\u0028\u1107\u0029",
  38127. "\u3206",
  38128. "\u0028\u1109\u0029",
  38129. "\u3207",
  38130. "\u0028\u110B\u0029",
  38131. "\u3208",
  38132. "\u0028\u110C\u0029",
  38133. "\u3209",
  38134. "\u0028\u110E\u0029",
  38135. "\u320A",
  38136. "\u0028\u110F\u0029",
  38137. "\u320B",
  38138. "\u0028\u1110\u0029",
  38139. "\u320C",
  38140. "\u0028\u1111\u0029",
  38141. "\u320D",
  38142. "\u0028\u1112\u0029",
  38143. "\u320E",
  38144. "\u0028\u1100\u1161\u0029",
  38145. "\u320F",
  38146. "\u0028\u1102\u1161\u0029",
  38147. "\u3210",
  38148. "\u0028\u1103\u1161\u0029",
  38149. "\u3211",
  38150. "\u0028\u1105\u1161\u0029",
  38151. "\u3212",
  38152. "\u0028\u1106\u1161\u0029",
  38153. "\u3213",
  38154. "\u0028\u1107\u1161\u0029",
  38155. "\u3214",
  38156. "\u0028\u1109\u1161\u0029",
  38157. "\u3215",
  38158. "\u0028\u110B\u1161\u0029",
  38159. "\u3216",
  38160. "\u0028\u110C\u1161\u0029",
  38161. "\u3217",
  38162. "\u0028\u110E\u1161\u0029",
  38163. "\u3218",
  38164. "\u0028\u110F\u1161\u0029",
  38165. "\u3219",
  38166. "\u0028\u1110\u1161\u0029",
  38167. "\u321A",
  38168. "\u0028\u1111\u1161\u0029",
  38169. "\u321B",
  38170. "\u0028\u1112\u1161\u0029",
  38171. "\u321C",
  38172. "\u0028\u110C\u116E\u0029",
  38173. "\u321D",
  38174. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  38175. "\u321E",
  38176. "\u0028\u110B\u1169\u1112\u116E\u0029",
  38177. "\u3220",
  38178. "\u0028\u4E00\u0029",
  38179. "\u3221",
  38180. "\u0028\u4E8C\u0029",
  38181. "\u3222",
  38182. "\u0028\u4E09\u0029",
  38183. "\u3223",
  38184. "\u0028\u56DB\u0029",
  38185. "\u3224",
  38186. "\u0028\u4E94\u0029",
  38187. "\u3225",
  38188. "\u0028\u516D\u0029",
  38189. "\u3226",
  38190. "\u0028\u4E03\u0029",
  38191. "\u3227",
  38192. "\u0028\u516B\u0029",
  38193. "\u3228",
  38194. "\u0028\u4E5D\u0029",
  38195. "\u3229",
  38196. "\u0028\u5341\u0029",
  38197. "\u322A",
  38198. "\u0028\u6708\u0029",
  38199. "\u322B",
  38200. "\u0028\u706B\u0029",
  38201. "\u322C",
  38202. "\u0028\u6C34\u0029",
  38203. "\u322D",
  38204. "\u0028\u6728\u0029",
  38205. "\u322E",
  38206. "\u0028\u91D1\u0029",
  38207. "\u322F",
  38208. "\u0028\u571F\u0029",
  38209. "\u3230",
  38210. "\u0028\u65E5\u0029",
  38211. "\u3231",
  38212. "\u0028\u682A\u0029",
  38213. "\u3232",
  38214. "\u0028\u6709\u0029",
  38215. "\u3233",
  38216. "\u0028\u793E\u0029",
  38217. "\u3234",
  38218. "\u0028\u540D\u0029",
  38219. "\u3235",
  38220. "\u0028\u7279\u0029",
  38221. "\u3236",
  38222. "\u0028\u8CA1\u0029",
  38223. "\u3237",
  38224. "\u0028\u795D\u0029",
  38225. "\u3238",
  38226. "\u0028\u52B4\u0029",
  38227. "\u3239",
  38228. "\u0028\u4EE3\u0029",
  38229. "\u323A",
  38230. "\u0028\u547C\u0029",
  38231. "\u323B",
  38232. "\u0028\u5B66\u0029",
  38233. "\u323C",
  38234. "\u0028\u76E3\u0029",
  38235. "\u323D",
  38236. "\u0028\u4F01\u0029",
  38237. "\u323E",
  38238. "\u0028\u8CC7\u0029",
  38239. "\u323F",
  38240. "\u0028\u5354\u0029",
  38241. "\u3240",
  38242. "\u0028\u796D\u0029",
  38243. "\u3241",
  38244. "\u0028\u4F11\u0029",
  38245. "\u3242",
  38246. "\u0028\u81EA\u0029",
  38247. "\u3243",
  38248. "\u0028\u81F3\u0029",
  38249. "\u32C0",
  38250. "\u0031\u6708",
  38251. "\u32C1",
  38252. "\u0032\u6708",
  38253. "\u32C2",
  38254. "\u0033\u6708",
  38255. "\u32C3",
  38256. "\u0034\u6708",
  38257. "\u32C4",
  38258. "\u0035\u6708",
  38259. "\u32C5",
  38260. "\u0036\u6708",
  38261. "\u32C6",
  38262. "\u0037\u6708",
  38263. "\u32C7",
  38264. "\u0038\u6708",
  38265. "\u32C8",
  38266. "\u0039\u6708",
  38267. "\u32C9",
  38268. "\u0031\u0030\u6708",
  38269. "\u32CA",
  38270. "\u0031\u0031\u6708",
  38271. "\u32CB",
  38272. "\u0031\u0032\u6708",
  38273. "\u3358",
  38274. "\u0030\u70B9",
  38275. "\u3359",
  38276. "\u0031\u70B9",
  38277. "\u335A",
  38278. "\u0032\u70B9",
  38279. "\u335B",
  38280. "\u0033\u70B9",
  38281. "\u335C",
  38282. "\u0034\u70B9",
  38283. "\u335D",
  38284. "\u0035\u70B9",
  38285. "\u335E",
  38286. "\u0036\u70B9",
  38287. "\u335F",
  38288. "\u0037\u70B9",
  38289. "\u3360",
  38290. "\u0038\u70B9",
  38291. "\u3361",
  38292. "\u0039\u70B9",
  38293. "\u3362",
  38294. "\u0031\u0030\u70B9",
  38295. "\u3363",
  38296. "\u0031\u0031\u70B9",
  38297. "\u3364",
  38298. "\u0031\u0032\u70B9",
  38299. "\u3365",
  38300. "\u0031\u0033\u70B9",
  38301. "\u3366",
  38302. "\u0031\u0034\u70B9",
  38303. "\u3367",
  38304. "\u0031\u0035\u70B9",
  38305. "\u3368",
  38306. "\u0031\u0036\u70B9",
  38307. "\u3369",
  38308. "\u0031\u0037\u70B9",
  38309. "\u336A",
  38310. "\u0031\u0038\u70B9",
  38311. "\u336B",
  38312. "\u0031\u0039\u70B9",
  38313. "\u336C",
  38314. "\u0032\u0030\u70B9",
  38315. "\u336D",
  38316. "\u0032\u0031\u70B9",
  38317. "\u336E",
  38318. "\u0032\u0032\u70B9",
  38319. "\u336F",
  38320. "\u0032\u0033\u70B9",
  38321. "\u3370",
  38322. "\u0032\u0034\u70B9",
  38323. "\u33E0",
  38324. "\u0031\u65E5",
  38325. "\u33E1",
  38326. "\u0032\u65E5",
  38327. "\u33E2",
  38328. "\u0033\u65E5",
  38329. "\u33E3",
  38330. "\u0034\u65E5",
  38331. "\u33E4",
  38332. "\u0035\u65E5",
  38333. "\u33E5",
  38334. "\u0036\u65E5",
  38335. "\u33E6",
  38336. "\u0037\u65E5",
  38337. "\u33E7",
  38338. "\u0038\u65E5",
  38339. "\u33E8",
  38340. "\u0039\u65E5",
  38341. "\u33E9",
  38342. "\u0031\u0030\u65E5",
  38343. "\u33EA",
  38344. "\u0031\u0031\u65E5",
  38345. "\u33EB",
  38346. "\u0031\u0032\u65E5",
  38347. "\u33EC",
  38348. "\u0031\u0033\u65E5",
  38349. "\u33ED",
  38350. "\u0031\u0034\u65E5",
  38351. "\u33EE",
  38352. "\u0031\u0035\u65E5",
  38353. "\u33EF",
  38354. "\u0031\u0036\u65E5",
  38355. "\u33F0",
  38356. "\u0031\u0037\u65E5",
  38357. "\u33F1",
  38358. "\u0031\u0038\u65E5",
  38359. "\u33F2",
  38360. "\u0031\u0039\u65E5",
  38361. "\u33F3",
  38362. "\u0032\u0030\u65E5",
  38363. "\u33F4",
  38364. "\u0032\u0031\u65E5",
  38365. "\u33F5",
  38366. "\u0032\u0032\u65E5",
  38367. "\u33F6",
  38368. "\u0032\u0033\u65E5",
  38369. "\u33F7",
  38370. "\u0032\u0034\u65E5",
  38371. "\u33F8",
  38372. "\u0032\u0035\u65E5",
  38373. "\u33F9",
  38374. "\u0032\u0036\u65E5",
  38375. "\u33FA",
  38376. "\u0032\u0037\u65E5",
  38377. "\u33FB",
  38378. "\u0032\u0038\u65E5",
  38379. "\u33FC",
  38380. "\u0032\u0039\u65E5",
  38381. "\u33FD",
  38382. "\u0033\u0030\u65E5",
  38383. "\u33FE",
  38384. "\u0033\u0031\u65E5",
  38385. "\uFB00",
  38386. "\u0066\u0066",
  38387. "\uFB01",
  38388. "\u0066\u0069",
  38389. "\uFB02",
  38390. "\u0066\u006C",
  38391. "\uFB03",
  38392. "\u0066\u0066\u0069",
  38393. "\uFB04",
  38394. "\u0066\u0066\u006C",
  38395. "\uFB05",
  38396. "\u017F\u0074",
  38397. "\uFB06",
  38398. "\u0073\u0074",
  38399. "\uFB13",
  38400. "\u0574\u0576",
  38401. "\uFB14",
  38402. "\u0574\u0565",
  38403. "\uFB15",
  38404. "\u0574\u056B",
  38405. "\uFB16",
  38406. "\u057E\u0576",
  38407. "\uFB17",
  38408. "\u0574\u056D",
  38409. "\uFB4F",
  38410. "\u05D0\u05DC",
  38411. "\uFB50",
  38412. "\u0671",
  38413. "\uFB51",
  38414. "\u0671",
  38415. "\uFB52",
  38416. "\u067B",
  38417. "\uFB53",
  38418. "\u067B",
  38419. "\uFB54",
  38420. "\u067B",
  38421. "\uFB55",
  38422. "\u067B",
  38423. "\uFB56",
  38424. "\u067E",
  38425. "\uFB57",
  38426. "\u067E",
  38427. "\uFB58",
  38428. "\u067E",
  38429. "\uFB59",
  38430. "\u067E",
  38431. "\uFB5A",
  38432. "\u0680",
  38433. "\uFB5B",
  38434. "\u0680",
  38435. "\uFB5C",
  38436. "\u0680",
  38437. "\uFB5D",
  38438. "\u0680",
  38439. "\uFB5E",
  38440. "\u067A",
  38441. "\uFB5F",
  38442. "\u067A",
  38443. "\uFB60",
  38444. "\u067A",
  38445. "\uFB61",
  38446. "\u067A",
  38447. "\uFB62",
  38448. "\u067F",
  38449. "\uFB63",
  38450. "\u067F",
  38451. "\uFB64",
  38452. "\u067F",
  38453. "\uFB65",
  38454. "\u067F",
  38455. "\uFB66",
  38456. "\u0679",
  38457. "\uFB67",
  38458. "\u0679",
  38459. "\uFB68",
  38460. "\u0679",
  38461. "\uFB69",
  38462. "\u0679",
  38463. "\uFB6A",
  38464. "\u06A4",
  38465. "\uFB6B",
  38466. "\u06A4",
  38467. "\uFB6C",
  38468. "\u06A4",
  38469. "\uFB6D",
  38470. "\u06A4",
  38471. "\uFB6E",
  38472. "\u06A6",
  38473. "\uFB6F",
  38474. "\u06A6",
  38475. "\uFB70",
  38476. "\u06A6",
  38477. "\uFB71",
  38478. "\u06A6",
  38479. "\uFB72",
  38480. "\u0684",
  38481. "\uFB73",
  38482. "\u0684",
  38483. "\uFB74",
  38484. "\u0684",
  38485. "\uFB75",
  38486. "\u0684",
  38487. "\uFB76",
  38488. "\u0683",
  38489. "\uFB77",
  38490. "\u0683",
  38491. "\uFB78",
  38492. "\u0683",
  38493. "\uFB79",
  38494. "\u0683",
  38495. "\uFB7A",
  38496. "\u0686",
  38497. "\uFB7B",
  38498. "\u0686",
  38499. "\uFB7C",
  38500. "\u0686",
  38501. "\uFB7D",
  38502. "\u0686",
  38503. "\uFB7E",
  38504. "\u0687",
  38505. "\uFB7F",
  38506. "\u0687",
  38507. "\uFB80",
  38508. "\u0687",
  38509. "\uFB81",
  38510. "\u0687",
  38511. "\uFB82",
  38512. "\u068D",
  38513. "\uFB83",
  38514. "\u068D",
  38515. "\uFB84",
  38516. "\u068C",
  38517. "\uFB85",
  38518. "\u068C",
  38519. "\uFB86",
  38520. "\u068E",
  38521. "\uFB87",
  38522. "\u068E",
  38523. "\uFB88",
  38524. "\u0688",
  38525. "\uFB89",
  38526. "\u0688",
  38527. "\uFB8A",
  38528. "\u0698",
  38529. "\uFB8B",
  38530. "\u0698",
  38531. "\uFB8C",
  38532. "\u0691",
  38533. "\uFB8D",
  38534. "\u0691",
  38535. "\uFB8E",
  38536. "\u06A9",
  38537. "\uFB8F",
  38538. "\u06A9",
  38539. "\uFB90",
  38540. "\u06A9",
  38541. "\uFB91",
  38542. "\u06A9",
  38543. "\uFB92",
  38544. "\u06AF",
  38545. "\uFB93",
  38546. "\u06AF",
  38547. "\uFB94",
  38548. "\u06AF",
  38549. "\uFB95",
  38550. "\u06AF",
  38551. "\uFB96",
  38552. "\u06B3",
  38553. "\uFB97",
  38554. "\u06B3",
  38555. "\uFB98",
  38556. "\u06B3",
  38557. "\uFB99",
  38558. "\u06B3",
  38559. "\uFB9A",
  38560. "\u06B1",
  38561. "\uFB9B",
  38562. "\u06B1",
  38563. "\uFB9C",
  38564. "\u06B1",
  38565. "\uFB9D",
  38566. "\u06B1",
  38567. "\uFB9E",
  38568. "\u06BA",
  38569. "\uFB9F",
  38570. "\u06BA",
  38571. "\uFBA0",
  38572. "\u06BB",
  38573. "\uFBA1",
  38574. "\u06BB",
  38575. "\uFBA2",
  38576. "\u06BB",
  38577. "\uFBA3",
  38578. "\u06BB",
  38579. "\uFBA4",
  38580. "\u06C0",
  38581. "\uFBA5",
  38582. "\u06C0",
  38583. "\uFBA6",
  38584. "\u06C1",
  38585. "\uFBA7",
  38586. "\u06C1",
  38587. "\uFBA8",
  38588. "\u06C1",
  38589. "\uFBA9",
  38590. "\u06C1",
  38591. "\uFBAA",
  38592. "\u06BE",
  38593. "\uFBAB",
  38594. "\u06BE",
  38595. "\uFBAC",
  38596. "\u06BE",
  38597. "\uFBAD",
  38598. "\u06BE",
  38599. "\uFBAE",
  38600. "\u06D2",
  38601. "\uFBAF",
  38602. "\u06D2",
  38603. "\uFBB0",
  38604. "\u06D3",
  38605. "\uFBB1",
  38606. "\u06D3",
  38607. "\uFBD3",
  38608. "\u06AD",
  38609. "\uFBD4",
  38610. "\u06AD",
  38611. "\uFBD5",
  38612. "\u06AD",
  38613. "\uFBD6",
  38614. "\u06AD",
  38615. "\uFBD7",
  38616. "\u06C7",
  38617. "\uFBD8",
  38618. "\u06C7",
  38619. "\uFBD9",
  38620. "\u06C6",
  38621. "\uFBDA",
  38622. "\u06C6",
  38623. "\uFBDB",
  38624. "\u06C8",
  38625. "\uFBDC",
  38626. "\u06C8",
  38627. "\uFBDD",
  38628. "\u0677",
  38629. "\uFBDE",
  38630. "\u06CB",
  38631. "\uFBDF",
  38632. "\u06CB",
  38633. "\uFBE0",
  38634. "\u06C5",
  38635. "\uFBE1",
  38636. "\u06C5",
  38637. "\uFBE2",
  38638. "\u06C9",
  38639. "\uFBE3",
  38640. "\u06C9",
  38641. "\uFBE4",
  38642. "\u06D0",
  38643. "\uFBE5",
  38644. "\u06D0",
  38645. "\uFBE6",
  38646. "\u06D0",
  38647. "\uFBE7",
  38648. "\u06D0",
  38649. "\uFBE8",
  38650. "\u0649",
  38651. "\uFBE9",
  38652. "\u0649",
  38653. "\uFBEA",
  38654. "\u0626\u0627",
  38655. "\uFBEB",
  38656. "\u0626\u0627",
  38657. "\uFBEC",
  38658. "\u0626\u06D5",
  38659. "\uFBED",
  38660. "\u0626\u06D5",
  38661. "\uFBEE",
  38662. "\u0626\u0648",
  38663. "\uFBEF",
  38664. "\u0626\u0648",
  38665. "\uFBF0",
  38666. "\u0626\u06C7",
  38667. "\uFBF1",
  38668. "\u0626\u06C7",
  38669. "\uFBF2",
  38670. "\u0626\u06C6",
  38671. "\uFBF3",
  38672. "\u0626\u06C6",
  38673. "\uFBF4",
  38674. "\u0626\u06C8",
  38675. "\uFBF5",
  38676. "\u0626\u06C8",
  38677. "\uFBF6",
  38678. "\u0626\u06D0",
  38679. "\uFBF7",
  38680. "\u0626\u06D0",
  38681. "\uFBF8",
  38682. "\u0626\u06D0",
  38683. "\uFBF9",
  38684. "\u0626\u0649",
  38685. "\uFBFA",
  38686. "\u0626\u0649",
  38687. "\uFBFB",
  38688. "\u0626\u0649",
  38689. "\uFBFC",
  38690. "\u06CC",
  38691. "\uFBFD",
  38692. "\u06CC",
  38693. "\uFBFE",
  38694. "\u06CC",
  38695. "\uFBFF",
  38696. "\u06CC",
  38697. "\uFC00",
  38698. "\u0626\u062C",
  38699. "\uFC01",
  38700. "\u0626\u062D",
  38701. "\uFC02",
  38702. "\u0626\u0645",
  38703. "\uFC03",
  38704. "\u0626\u0649",
  38705. "\uFC04",
  38706. "\u0626\u064A",
  38707. "\uFC05",
  38708. "\u0628\u062C",
  38709. "\uFC06",
  38710. "\u0628\u062D",
  38711. "\uFC07",
  38712. "\u0628\u062E",
  38713. "\uFC08",
  38714. "\u0628\u0645",
  38715. "\uFC09",
  38716. "\u0628\u0649",
  38717. "\uFC0A",
  38718. "\u0628\u064A",
  38719. "\uFC0B",
  38720. "\u062A\u062C",
  38721. "\uFC0C",
  38722. "\u062A\u062D",
  38723. "\uFC0D",
  38724. "\u062A\u062E",
  38725. "\uFC0E",
  38726. "\u062A\u0645",
  38727. "\uFC0F",
  38728. "\u062A\u0649",
  38729. "\uFC10",
  38730. "\u062A\u064A",
  38731. "\uFC11",
  38732. "\u062B\u062C",
  38733. "\uFC12",
  38734. "\u062B\u0645",
  38735. "\uFC13",
  38736. "\u062B\u0649",
  38737. "\uFC14",
  38738. "\u062B\u064A",
  38739. "\uFC15",
  38740. "\u062C\u062D",
  38741. "\uFC16",
  38742. "\u062C\u0645",
  38743. "\uFC17",
  38744. "\u062D\u062C",
  38745. "\uFC18",
  38746. "\u062D\u0645",
  38747. "\uFC19",
  38748. "\u062E\u062C",
  38749. "\uFC1A",
  38750. "\u062E\u062D",
  38751. "\uFC1B",
  38752. "\u062E\u0645",
  38753. "\uFC1C",
  38754. "\u0633\u062C",
  38755. "\uFC1D",
  38756. "\u0633\u062D",
  38757. "\uFC1E",
  38758. "\u0633\u062E",
  38759. "\uFC1F",
  38760. "\u0633\u0645",
  38761. "\uFC20",
  38762. "\u0635\u062D",
  38763. "\uFC21",
  38764. "\u0635\u0645",
  38765. "\uFC22",
  38766. "\u0636\u062C",
  38767. "\uFC23",
  38768. "\u0636\u062D",
  38769. "\uFC24",
  38770. "\u0636\u062E",
  38771. "\uFC25",
  38772. "\u0636\u0645",
  38773. "\uFC26",
  38774. "\u0637\u062D",
  38775. "\uFC27",
  38776. "\u0637\u0645",
  38777. "\uFC28",
  38778. "\u0638\u0645",
  38779. "\uFC29",
  38780. "\u0639\u062C",
  38781. "\uFC2A",
  38782. "\u0639\u0645",
  38783. "\uFC2B",
  38784. "\u063A\u062C",
  38785. "\uFC2C",
  38786. "\u063A\u0645",
  38787. "\uFC2D",
  38788. "\u0641\u062C",
  38789. "\uFC2E",
  38790. "\u0641\u062D",
  38791. "\uFC2F",
  38792. "\u0641\u062E",
  38793. "\uFC30",
  38794. "\u0641\u0645",
  38795. "\uFC31",
  38796. "\u0641\u0649",
  38797. "\uFC32",
  38798. "\u0641\u064A",
  38799. "\uFC33",
  38800. "\u0642\u062D",
  38801. "\uFC34",
  38802. "\u0642\u0645",
  38803. "\uFC35",
  38804. "\u0642\u0649",
  38805. "\uFC36",
  38806. "\u0642\u064A",
  38807. "\uFC37",
  38808. "\u0643\u0627",
  38809. "\uFC38",
  38810. "\u0643\u062C",
  38811. "\uFC39",
  38812. "\u0643\u062D",
  38813. "\uFC3A",
  38814. "\u0643\u062E",
  38815. "\uFC3B",
  38816. "\u0643\u0644",
  38817. "\uFC3C",
  38818. "\u0643\u0645",
  38819. "\uFC3D",
  38820. "\u0643\u0649",
  38821. "\uFC3E",
  38822. "\u0643\u064A",
  38823. "\uFC3F",
  38824. "\u0644\u062C",
  38825. "\uFC40",
  38826. "\u0644\u062D",
  38827. "\uFC41",
  38828. "\u0644\u062E",
  38829. "\uFC42",
  38830. "\u0644\u0645",
  38831. "\uFC43",
  38832. "\u0644\u0649",
  38833. "\uFC44",
  38834. "\u0644\u064A",
  38835. "\uFC45",
  38836. "\u0645\u062C",
  38837. "\uFC46",
  38838. "\u0645\u062D",
  38839. "\uFC47",
  38840. "\u0645\u062E",
  38841. "\uFC48",
  38842. "\u0645\u0645",
  38843. "\uFC49",
  38844. "\u0645\u0649",
  38845. "\uFC4A",
  38846. "\u0645\u064A",
  38847. "\uFC4B",
  38848. "\u0646\u062C",
  38849. "\uFC4C",
  38850. "\u0646\u062D",
  38851. "\uFC4D",
  38852. "\u0646\u062E",
  38853. "\uFC4E",
  38854. "\u0646\u0645",
  38855. "\uFC4F",
  38856. "\u0646\u0649",
  38857. "\uFC50",
  38858. "\u0646\u064A",
  38859. "\uFC51",
  38860. "\u0647\u062C",
  38861. "\uFC52",
  38862. "\u0647\u0645",
  38863. "\uFC53",
  38864. "\u0647\u0649",
  38865. "\uFC54",
  38866. "\u0647\u064A",
  38867. "\uFC55",
  38868. "\u064A\u062C",
  38869. "\uFC56",
  38870. "\u064A\u062D",
  38871. "\uFC57",
  38872. "\u064A\u062E",
  38873. "\uFC58",
  38874. "\u064A\u0645",
  38875. "\uFC59",
  38876. "\u064A\u0649",
  38877. "\uFC5A",
  38878. "\u064A\u064A",
  38879. "\uFC5B",
  38880. "\u0630\u0670",
  38881. "\uFC5C",
  38882. "\u0631\u0670",
  38883. "\uFC5D",
  38884. "\u0649\u0670",
  38885. "\uFC5E",
  38886. "\u0020\u064C\u0651",
  38887. "\uFC5F",
  38888. "\u0020\u064D\u0651",
  38889. "\uFC60",
  38890. "\u0020\u064E\u0651",
  38891. "\uFC61",
  38892. "\u0020\u064F\u0651",
  38893. "\uFC62",
  38894. "\u0020\u0650\u0651",
  38895. "\uFC63",
  38896. "\u0020\u0651\u0670",
  38897. "\uFC64",
  38898. "\u0626\u0631",
  38899. "\uFC65",
  38900. "\u0626\u0632",
  38901. "\uFC66",
  38902. "\u0626\u0645",
  38903. "\uFC67",
  38904. "\u0626\u0646",
  38905. "\uFC68",
  38906. "\u0626\u0649",
  38907. "\uFC69",
  38908. "\u0626\u064A",
  38909. "\uFC6A",
  38910. "\u0628\u0631",
  38911. "\uFC6B",
  38912. "\u0628\u0632",
  38913. "\uFC6C",
  38914. "\u0628\u0645",
  38915. "\uFC6D",
  38916. "\u0628\u0646",
  38917. "\uFC6E",
  38918. "\u0628\u0649",
  38919. "\uFC6F",
  38920. "\u0628\u064A",
  38921. "\uFC70",
  38922. "\u062A\u0631",
  38923. "\uFC71",
  38924. "\u062A\u0632",
  38925. "\uFC72",
  38926. "\u062A\u0645",
  38927. "\uFC73",
  38928. "\u062A\u0646",
  38929. "\uFC74",
  38930. "\u062A\u0649",
  38931. "\uFC75",
  38932. "\u062A\u064A",
  38933. "\uFC76",
  38934. "\u062B\u0631",
  38935. "\uFC77",
  38936. "\u062B\u0632",
  38937. "\uFC78",
  38938. "\u062B\u0645",
  38939. "\uFC79",
  38940. "\u062B\u0646",
  38941. "\uFC7A",
  38942. "\u062B\u0649",
  38943. "\uFC7B",
  38944. "\u062B\u064A",
  38945. "\uFC7C",
  38946. "\u0641\u0649",
  38947. "\uFC7D",
  38948. "\u0641\u064A",
  38949. "\uFC7E",
  38950. "\u0642\u0649",
  38951. "\uFC7F",
  38952. "\u0642\u064A",
  38953. "\uFC80",
  38954. "\u0643\u0627",
  38955. "\uFC81",
  38956. "\u0643\u0644",
  38957. "\uFC82",
  38958. "\u0643\u0645",
  38959. "\uFC83",
  38960. "\u0643\u0649",
  38961. "\uFC84",
  38962. "\u0643\u064A",
  38963. "\uFC85",
  38964. "\u0644\u0645",
  38965. "\uFC86",
  38966. "\u0644\u0649",
  38967. "\uFC87",
  38968. "\u0644\u064A",
  38969. "\uFC88",
  38970. "\u0645\u0627",
  38971. "\uFC89",
  38972. "\u0645\u0645",
  38973. "\uFC8A",
  38974. "\u0646\u0631",
  38975. "\uFC8B",
  38976. "\u0646\u0632",
  38977. "\uFC8C",
  38978. "\u0646\u0645",
  38979. "\uFC8D",
  38980. "\u0646\u0646",
  38981. "\uFC8E",
  38982. "\u0646\u0649",
  38983. "\uFC8F",
  38984. "\u0646\u064A",
  38985. "\uFC90",
  38986. "\u0649\u0670",
  38987. "\uFC91",
  38988. "\u064A\u0631",
  38989. "\uFC92",
  38990. "\u064A\u0632",
  38991. "\uFC93",
  38992. "\u064A\u0645",
  38993. "\uFC94",
  38994. "\u064A\u0646",
  38995. "\uFC95",
  38996. "\u064A\u0649",
  38997. "\uFC96",
  38998. "\u064A\u064A",
  38999. "\uFC97",
  39000. "\u0626\u062C",
  39001. "\uFC98",
  39002. "\u0626\u062D",
  39003. "\uFC99",
  39004. "\u0626\u062E",
  39005. "\uFC9A",
  39006. "\u0626\u0645",
  39007. "\uFC9B",
  39008. "\u0626\u0647",
  39009. "\uFC9C",
  39010. "\u0628\u062C",
  39011. "\uFC9D",
  39012. "\u0628\u062D",
  39013. "\uFC9E",
  39014. "\u0628\u062E",
  39015. "\uFC9F",
  39016. "\u0628\u0645",
  39017. "\uFCA0",
  39018. "\u0628\u0647",
  39019. "\uFCA1",
  39020. "\u062A\u062C",
  39021. "\uFCA2",
  39022. "\u062A\u062D",
  39023. "\uFCA3",
  39024. "\u062A\u062E",
  39025. "\uFCA4",
  39026. "\u062A\u0645",
  39027. "\uFCA5",
  39028. "\u062A\u0647",
  39029. "\uFCA6",
  39030. "\u062B\u0645",
  39031. "\uFCA7",
  39032. "\u062C\u062D",
  39033. "\uFCA8",
  39034. "\u062C\u0645",
  39035. "\uFCA9",
  39036. "\u062D\u062C",
  39037. "\uFCAA",
  39038. "\u062D\u0645",
  39039. "\uFCAB",
  39040. "\u062E\u062C",
  39041. "\uFCAC",
  39042. "\u062E\u0645",
  39043. "\uFCAD",
  39044. "\u0633\u062C",
  39045. "\uFCAE",
  39046. "\u0633\u062D",
  39047. "\uFCAF",
  39048. "\u0633\u062E",
  39049. "\uFCB0",
  39050. "\u0633\u0645",
  39051. "\uFCB1",
  39052. "\u0635\u062D",
  39053. "\uFCB2",
  39054. "\u0635\u062E",
  39055. "\uFCB3",
  39056. "\u0635\u0645",
  39057. "\uFCB4",
  39058. "\u0636\u062C",
  39059. "\uFCB5",
  39060. "\u0636\u062D",
  39061. "\uFCB6",
  39062. "\u0636\u062E",
  39063. "\uFCB7",
  39064. "\u0636\u0645",
  39065. "\uFCB8",
  39066. "\u0637\u062D",
  39067. "\uFCB9",
  39068. "\u0638\u0645",
  39069. "\uFCBA",
  39070. "\u0639\u062C",
  39071. "\uFCBB",
  39072. "\u0639\u0645",
  39073. "\uFCBC",
  39074. "\u063A\u062C",
  39075. "\uFCBD",
  39076. "\u063A\u0645",
  39077. "\uFCBE",
  39078. "\u0641\u062C",
  39079. "\uFCBF",
  39080. "\u0641\u062D",
  39081. "\uFCC0",
  39082. "\u0641\u062E",
  39083. "\uFCC1",
  39084. "\u0641\u0645",
  39085. "\uFCC2",
  39086. "\u0642\u062D",
  39087. "\uFCC3",
  39088. "\u0642\u0645",
  39089. "\uFCC4",
  39090. "\u0643\u062C",
  39091. "\uFCC5",
  39092. "\u0643\u062D",
  39093. "\uFCC6",
  39094. "\u0643\u062E",
  39095. "\uFCC7",
  39096. "\u0643\u0644",
  39097. "\uFCC8",
  39098. "\u0643\u0645",
  39099. "\uFCC9",
  39100. "\u0644\u062C",
  39101. "\uFCCA",
  39102. "\u0644\u062D",
  39103. "\uFCCB",
  39104. "\u0644\u062E",
  39105. "\uFCCC",
  39106. "\u0644\u0645",
  39107. "\uFCCD",
  39108. "\u0644\u0647",
  39109. "\uFCCE",
  39110. "\u0645\u062C",
  39111. "\uFCCF",
  39112. "\u0645\u062D",
  39113. "\uFCD0",
  39114. "\u0645\u062E",
  39115. "\uFCD1",
  39116. "\u0645\u0645",
  39117. "\uFCD2",
  39118. "\u0646\u062C",
  39119. "\uFCD3",
  39120. "\u0646\u062D",
  39121. "\uFCD4",
  39122. "\u0646\u062E",
  39123. "\uFCD5",
  39124. "\u0646\u0645",
  39125. "\uFCD6",
  39126. "\u0646\u0647",
  39127. "\uFCD7",
  39128. "\u0647\u062C",
  39129. "\uFCD8",
  39130. "\u0647\u0645",
  39131. "\uFCD9",
  39132. "\u0647\u0670",
  39133. "\uFCDA",
  39134. "\u064A\u062C",
  39135. "\uFCDB",
  39136. "\u064A\u062D",
  39137. "\uFCDC",
  39138. "\u064A\u062E",
  39139. "\uFCDD",
  39140. "\u064A\u0645",
  39141. "\uFCDE",
  39142. "\u064A\u0647",
  39143. "\uFCDF",
  39144. "\u0626\u0645",
  39145. "\uFCE0",
  39146. "\u0626\u0647",
  39147. "\uFCE1",
  39148. "\u0628\u0645",
  39149. "\uFCE2",
  39150. "\u0628\u0647",
  39151. "\uFCE3",
  39152. "\u062A\u0645",
  39153. "\uFCE4",
  39154. "\u062A\u0647",
  39155. "\uFCE5",
  39156. "\u062B\u0645",
  39157. "\uFCE6",
  39158. "\u062B\u0647",
  39159. "\uFCE7",
  39160. "\u0633\u0645",
  39161. "\uFCE8",
  39162. "\u0633\u0647",
  39163. "\uFCE9",
  39164. "\u0634\u0645",
  39165. "\uFCEA",
  39166. "\u0634\u0647",
  39167. "\uFCEB",
  39168. "\u0643\u0644",
  39169. "\uFCEC",
  39170. "\u0643\u0645",
  39171. "\uFCED",
  39172. "\u0644\u0645",
  39173. "\uFCEE",
  39174. "\u0646\u0645",
  39175. "\uFCEF",
  39176. "\u0646\u0647",
  39177. "\uFCF0",
  39178. "\u064A\u0645",
  39179. "\uFCF1",
  39180. "\u064A\u0647",
  39181. "\uFCF2",
  39182. "\u0640\u064E\u0651",
  39183. "\uFCF3",
  39184. "\u0640\u064F\u0651",
  39185. "\uFCF4",
  39186. "\u0640\u0650\u0651",
  39187. "\uFCF5",
  39188. "\u0637\u0649",
  39189. "\uFCF6",
  39190. "\u0637\u064A",
  39191. "\uFCF7",
  39192. "\u0639\u0649",
  39193. "\uFCF8",
  39194. "\u0639\u064A",
  39195. "\uFCF9",
  39196. "\u063A\u0649",
  39197. "\uFCFA",
  39198. "\u063A\u064A",
  39199. "\uFCFB",
  39200. "\u0633\u0649",
  39201. "\uFCFC",
  39202. "\u0633\u064A",
  39203. "\uFCFD",
  39204. "\u0634\u0649",
  39205. "\uFCFE",
  39206. "\u0634\u064A",
  39207. "\uFCFF",
  39208. "\u062D\u0649",
  39209. "\uFD00",
  39210. "\u062D\u064A",
  39211. "\uFD01",
  39212. "\u062C\u0649",
  39213. "\uFD02",
  39214. "\u062C\u064A",
  39215. "\uFD03",
  39216. "\u062E\u0649",
  39217. "\uFD04",
  39218. "\u062E\u064A",
  39219. "\uFD05",
  39220. "\u0635\u0649",
  39221. "\uFD06",
  39222. "\u0635\u064A",
  39223. "\uFD07",
  39224. "\u0636\u0649",
  39225. "\uFD08",
  39226. "\u0636\u064A",
  39227. "\uFD09",
  39228. "\u0634\u062C",
  39229. "\uFD0A",
  39230. "\u0634\u062D",
  39231. "\uFD0B",
  39232. "\u0634\u062E",
  39233. "\uFD0C",
  39234. "\u0634\u0645",
  39235. "\uFD0D",
  39236. "\u0634\u0631",
  39237. "\uFD0E",
  39238. "\u0633\u0631",
  39239. "\uFD0F",
  39240. "\u0635\u0631",
  39241. "\uFD10",
  39242. "\u0636\u0631",
  39243. "\uFD11",
  39244. "\u0637\u0649",
  39245. "\uFD12",
  39246. "\u0637\u064A",
  39247. "\uFD13",
  39248. "\u0639\u0649",
  39249. "\uFD14",
  39250. "\u0639\u064A",
  39251. "\uFD15",
  39252. "\u063A\u0649",
  39253. "\uFD16",
  39254. "\u063A\u064A",
  39255. "\uFD17",
  39256. "\u0633\u0649",
  39257. "\uFD18",
  39258. "\u0633\u064A",
  39259. "\uFD19",
  39260. "\u0634\u0649",
  39261. "\uFD1A",
  39262. "\u0634\u064A",
  39263. "\uFD1B",
  39264. "\u062D\u0649",
  39265. "\uFD1C",
  39266. "\u062D\u064A",
  39267. "\uFD1D",
  39268. "\u062C\u0649",
  39269. "\uFD1E",
  39270. "\u062C\u064A",
  39271. "\uFD1F",
  39272. "\u062E\u0649",
  39273. "\uFD20",
  39274. "\u062E\u064A",
  39275. "\uFD21",
  39276. "\u0635\u0649",
  39277. "\uFD22",
  39278. "\u0635\u064A",
  39279. "\uFD23",
  39280. "\u0636\u0649",
  39281. "\uFD24",
  39282. "\u0636\u064A",
  39283. "\uFD25",
  39284. "\u0634\u062C",
  39285. "\uFD26",
  39286. "\u0634\u062D",
  39287. "\uFD27",
  39288. "\u0634\u062E",
  39289. "\uFD28",
  39290. "\u0634\u0645",
  39291. "\uFD29",
  39292. "\u0634\u0631",
  39293. "\uFD2A",
  39294. "\u0633\u0631",
  39295. "\uFD2B",
  39296. "\u0635\u0631",
  39297. "\uFD2C",
  39298. "\u0636\u0631",
  39299. "\uFD2D",
  39300. "\u0634\u062C",
  39301. "\uFD2E",
  39302. "\u0634\u062D",
  39303. "\uFD2F",
  39304. "\u0634\u062E",
  39305. "\uFD30",
  39306. "\u0634\u0645",
  39307. "\uFD31",
  39308. "\u0633\u0647",
  39309. "\uFD32",
  39310. "\u0634\u0647",
  39311. "\uFD33",
  39312. "\u0637\u0645",
  39313. "\uFD34",
  39314. "\u0633\u062C",
  39315. "\uFD35",
  39316. "\u0633\u062D",
  39317. "\uFD36",
  39318. "\u0633\u062E",
  39319. "\uFD37",
  39320. "\u0634\u062C",
  39321. "\uFD38",
  39322. "\u0634\u062D",
  39323. "\uFD39",
  39324. "\u0634\u062E",
  39325. "\uFD3A",
  39326. "\u0637\u0645",
  39327. "\uFD3B",
  39328. "\u0638\u0645",
  39329. "\uFD3C",
  39330. "\u0627\u064B",
  39331. "\uFD3D",
  39332. "\u0627\u064B",
  39333. "\uFD50",
  39334. "\u062A\u062C\u0645",
  39335. "\uFD51",
  39336. "\u062A\u062D\u062C",
  39337. "\uFD52",
  39338. "\u062A\u062D\u062C",
  39339. "\uFD53",
  39340. "\u062A\u062D\u0645",
  39341. "\uFD54",
  39342. "\u062A\u062E\u0645",
  39343. "\uFD55",
  39344. "\u062A\u0645\u062C",
  39345. "\uFD56",
  39346. "\u062A\u0645\u062D",
  39347. "\uFD57",
  39348. "\u062A\u0645\u062E",
  39349. "\uFD58",
  39350. "\u062C\u0645\u062D",
  39351. "\uFD59",
  39352. "\u062C\u0645\u062D",
  39353. "\uFD5A",
  39354. "\u062D\u0645\u064A",
  39355. "\uFD5B",
  39356. "\u062D\u0645\u0649",
  39357. "\uFD5C",
  39358. "\u0633\u062D\u062C",
  39359. "\uFD5D",
  39360. "\u0633\u062C\u062D",
  39361. "\uFD5E",
  39362. "\u0633\u062C\u0649",
  39363. "\uFD5F",
  39364. "\u0633\u0645\u062D",
  39365. "\uFD60",
  39366. "\u0633\u0645\u062D",
  39367. "\uFD61",
  39368. "\u0633\u0645\u062C",
  39369. "\uFD62",
  39370. "\u0633\u0645\u0645",
  39371. "\uFD63",
  39372. "\u0633\u0645\u0645",
  39373. "\uFD64",
  39374. "\u0635\u062D\u062D",
  39375. "\uFD65",
  39376. "\u0635\u062D\u062D",
  39377. "\uFD66",
  39378. "\u0635\u0645\u0645",
  39379. "\uFD67",
  39380. "\u0634\u062D\u0645",
  39381. "\uFD68",
  39382. "\u0634\u062D\u0645",
  39383. "\uFD69",
  39384. "\u0634\u062C\u064A",
  39385. "\uFD6A",
  39386. "\u0634\u0645\u062E",
  39387. "\uFD6B",
  39388. "\u0634\u0645\u062E",
  39389. "\uFD6C",
  39390. "\u0634\u0645\u0645",
  39391. "\uFD6D",
  39392. "\u0634\u0645\u0645",
  39393. "\uFD6E",
  39394. "\u0636\u062D\u0649",
  39395. "\uFD6F",
  39396. "\u0636\u062E\u0645",
  39397. "\uFD70",
  39398. "\u0636\u062E\u0645",
  39399. "\uFD71",
  39400. "\u0637\u0645\u062D",
  39401. "\uFD72",
  39402. "\u0637\u0645\u062D",
  39403. "\uFD73",
  39404. "\u0637\u0645\u0645",
  39405. "\uFD74",
  39406. "\u0637\u0645\u064A",
  39407. "\uFD75",
  39408. "\u0639\u062C\u0645",
  39409. "\uFD76",
  39410. "\u0639\u0645\u0645",
  39411. "\uFD77",
  39412. "\u0639\u0645\u0645",
  39413. "\uFD78",
  39414. "\u0639\u0645\u0649",
  39415. "\uFD79",
  39416. "\u063A\u0645\u0645",
  39417. "\uFD7A",
  39418. "\u063A\u0645\u064A",
  39419. "\uFD7B",
  39420. "\u063A\u0645\u0649",
  39421. "\uFD7C",
  39422. "\u0641\u062E\u0645",
  39423. "\uFD7D",
  39424. "\u0641\u062E\u0645",
  39425. "\uFD7E",
  39426. "\u0642\u0645\u062D",
  39427. "\uFD7F",
  39428. "\u0642\u0645\u0645",
  39429. "\uFD80",
  39430. "\u0644\u062D\u0645",
  39431. "\uFD81",
  39432. "\u0644\u062D\u064A",
  39433. "\uFD82",
  39434. "\u0644\u062D\u0649",
  39435. "\uFD83",
  39436. "\u0644\u062C\u062C",
  39437. "\uFD84",
  39438. "\u0644\u062C\u062C",
  39439. "\uFD85",
  39440. "\u0644\u062E\u0645",
  39441. "\uFD86",
  39442. "\u0644\u062E\u0645",
  39443. "\uFD87",
  39444. "\u0644\u0645\u062D",
  39445. "\uFD88",
  39446. "\u0644\u0645\u062D",
  39447. "\uFD89",
  39448. "\u0645\u062D\u062C",
  39449. "\uFD8A",
  39450. "\u0645\u062D\u0645",
  39451. "\uFD8B",
  39452. "\u0645\u062D\u064A",
  39453. "\uFD8C",
  39454. "\u0645\u062C\u062D",
  39455. "\uFD8D",
  39456. "\u0645\u062C\u0645",
  39457. "\uFD8E",
  39458. "\u0645\u062E\u062C",
  39459. "\uFD8F",
  39460. "\u0645\u062E\u0645",
  39461. "\uFD92",
  39462. "\u0645\u062C\u062E",
  39463. "\uFD93",
  39464. "\u0647\u0645\u062C",
  39465. "\uFD94",
  39466. "\u0647\u0645\u0645",
  39467. "\uFD95",
  39468. "\u0646\u062D\u0645",
  39469. "\uFD96",
  39470. "\u0646\u062D\u0649",
  39471. "\uFD97",
  39472. "\u0646\u062C\u0645",
  39473. "\uFD98",
  39474. "\u0646\u062C\u0645",
  39475. "\uFD99",
  39476. "\u0646\u062C\u0649",
  39477. "\uFD9A",
  39478. "\u0646\u0645\u064A",
  39479. "\uFD9B",
  39480. "\u0646\u0645\u0649",
  39481. "\uFD9C",
  39482. "\u064A\u0645\u0645",
  39483. "\uFD9D",
  39484. "\u064A\u0645\u0645",
  39485. "\uFD9E",
  39486. "\u0628\u062E\u064A",
  39487. "\uFD9F",
  39488. "\u062A\u062C\u064A",
  39489. "\uFDA0",
  39490. "\u062A\u062C\u0649",
  39491. "\uFDA1",
  39492. "\u062A\u062E\u064A",
  39493. "\uFDA2",
  39494. "\u062A\u062E\u0649",
  39495. "\uFDA3",
  39496. "\u062A\u0645\u064A",
  39497. "\uFDA4",
  39498. "\u062A\u0645\u0649",
  39499. "\uFDA5",
  39500. "\u062C\u0645\u064A",
  39501. "\uFDA6",
  39502. "\u062C\u062D\u0649",
  39503. "\uFDA7",
  39504. "\u062C\u0645\u0649",
  39505. "\uFDA8",
  39506. "\u0633\u062E\u0649",
  39507. "\uFDA9",
  39508. "\u0635\u062D\u064A",
  39509. "\uFDAA",
  39510. "\u0634\u062D\u064A",
  39511. "\uFDAB",
  39512. "\u0636\u062D\u064A",
  39513. "\uFDAC",
  39514. "\u0644\u062C\u064A",
  39515. "\uFDAD",
  39516. "\u0644\u0645\u064A",
  39517. "\uFDAE",
  39518. "\u064A\u062D\u064A",
  39519. "\uFDAF",
  39520. "\u064A\u062C\u064A",
  39521. "\uFDB0",
  39522. "\u064A\u0645\u064A",
  39523. "\uFDB1",
  39524. "\u0645\u0645\u064A",
  39525. "\uFDB2",
  39526. "\u0642\u0645\u064A",
  39527. "\uFDB3",
  39528. "\u0646\u062D\u064A",
  39529. "\uFDB4",
  39530. "\u0642\u0645\u062D",
  39531. "\uFDB5",
  39532. "\u0644\u062D\u0645",
  39533. "\uFDB6",
  39534. "\u0639\u0645\u064A",
  39535. "\uFDB7",
  39536. "\u0643\u0645\u064A",
  39537. "\uFDB8",
  39538. "\u0646\u062C\u062D",
  39539. "\uFDB9",
  39540. "\u0645\u062E\u064A",
  39541. "\uFDBA",
  39542. "\u0644\u062C\u0645",
  39543. "\uFDBB",
  39544. "\u0643\u0645\u0645",
  39545. "\uFDBC",
  39546. "\u0644\u062C\u0645",
  39547. "\uFDBD",
  39548. "\u0646\u062C\u062D",
  39549. "\uFDBE",
  39550. "\u062C\u062D\u064A",
  39551. "\uFDBF",
  39552. "\u062D\u062C\u064A",
  39553. "\uFDC0",
  39554. "\u0645\u062C\u064A",
  39555. "\uFDC1",
  39556. "\u0641\u0645\u064A",
  39557. "\uFDC2",
  39558. "\u0628\u062D\u064A",
  39559. "\uFDC3",
  39560. "\u0643\u0645\u0645",
  39561. "\uFDC4",
  39562. "\u0639\u062C\u0645",
  39563. "\uFDC5",
  39564. "\u0635\u0645\u0645",
  39565. "\uFDC6",
  39566. "\u0633\u062E\u064A",
  39567. "\uFDC7",
  39568. "\u0646\u062C\u064A",
  39569. "\uFE49",
  39570. "\u203E",
  39571. "\uFE4A",
  39572. "\u203E",
  39573. "\uFE4B",
  39574. "\u203E",
  39575. "\uFE4C",
  39576. "\u203E",
  39577. "\uFE4D",
  39578. "\u005F",
  39579. "\uFE4E",
  39580. "\u005F",
  39581. "\uFE4F",
  39582. "\u005F",
  39583. "\uFE80",
  39584. "\u0621",
  39585. "\uFE81",
  39586. "\u0622",
  39587. "\uFE82",
  39588. "\u0622",
  39589. "\uFE83",
  39590. "\u0623",
  39591. "\uFE84",
  39592. "\u0623",
  39593. "\uFE85",
  39594. "\u0624",
  39595. "\uFE86",
  39596. "\u0624",
  39597. "\uFE87",
  39598. "\u0625",
  39599. "\uFE88",
  39600. "\u0625",
  39601. "\uFE89",
  39602. "\u0626",
  39603. "\uFE8A",
  39604. "\u0626",
  39605. "\uFE8B",
  39606. "\u0626",
  39607. "\uFE8C",
  39608. "\u0626",
  39609. "\uFE8D",
  39610. "\u0627",
  39611. "\uFE8E",
  39612. "\u0627",
  39613. "\uFE8F",
  39614. "\u0628",
  39615. "\uFE90",
  39616. "\u0628",
  39617. "\uFE91",
  39618. "\u0628",
  39619. "\uFE92",
  39620. "\u0628",
  39621. "\uFE93",
  39622. "\u0629",
  39623. "\uFE94",
  39624. "\u0629",
  39625. "\uFE95",
  39626. "\u062A",
  39627. "\uFE96",
  39628. "\u062A",
  39629. "\uFE97",
  39630. "\u062A",
  39631. "\uFE98",
  39632. "\u062A",
  39633. "\uFE99",
  39634. "\u062B",
  39635. "\uFE9A",
  39636. "\u062B",
  39637. "\uFE9B",
  39638. "\u062B",
  39639. "\uFE9C",
  39640. "\u062B",
  39641. "\uFE9D",
  39642. "\u062C",
  39643. "\uFE9E",
  39644. "\u062C",
  39645. "\uFE9F",
  39646. "\u062C",
  39647. "\uFEA0",
  39648. "\u062C",
  39649. "\uFEA1",
  39650. "\u062D",
  39651. "\uFEA2",
  39652. "\u062D",
  39653. "\uFEA3",
  39654. "\u062D",
  39655. "\uFEA4",
  39656. "\u062D",
  39657. "\uFEA5",
  39658. "\u062E",
  39659. "\uFEA6",
  39660. "\u062E",
  39661. "\uFEA7",
  39662. "\u062E",
  39663. "\uFEA8",
  39664. "\u062E",
  39665. "\uFEA9",
  39666. "\u062F",
  39667. "\uFEAA",
  39668. "\u062F",
  39669. "\uFEAB",
  39670. "\u0630",
  39671. "\uFEAC",
  39672. "\u0630",
  39673. "\uFEAD",
  39674. "\u0631",
  39675. "\uFEAE",
  39676. "\u0631",
  39677. "\uFEAF",
  39678. "\u0632",
  39679. "\uFEB0",
  39680. "\u0632",
  39681. "\uFEB1",
  39682. "\u0633",
  39683. "\uFEB2",
  39684. "\u0633",
  39685. "\uFEB3",
  39686. "\u0633",
  39687. "\uFEB4",
  39688. "\u0633",
  39689. "\uFEB5",
  39690. "\u0634",
  39691. "\uFEB6",
  39692. "\u0634",
  39693. "\uFEB7",
  39694. "\u0634",
  39695. "\uFEB8",
  39696. "\u0634",
  39697. "\uFEB9",
  39698. "\u0635",
  39699. "\uFEBA",
  39700. "\u0635",
  39701. "\uFEBB",
  39702. "\u0635",
  39703. "\uFEBC",
  39704. "\u0635",
  39705. "\uFEBD",
  39706. "\u0636",
  39707. "\uFEBE",
  39708. "\u0636",
  39709. "\uFEBF",
  39710. "\u0636",
  39711. "\uFEC0",
  39712. "\u0636",
  39713. "\uFEC1",
  39714. "\u0637",
  39715. "\uFEC2",
  39716. "\u0637",
  39717. "\uFEC3",
  39718. "\u0637",
  39719. "\uFEC4",
  39720. "\u0637",
  39721. "\uFEC5",
  39722. "\u0638",
  39723. "\uFEC6",
  39724. "\u0638",
  39725. "\uFEC7",
  39726. "\u0638",
  39727. "\uFEC8",
  39728. "\u0638",
  39729. "\uFEC9",
  39730. "\u0639",
  39731. "\uFECA",
  39732. "\u0639",
  39733. "\uFECB",
  39734. "\u0639",
  39735. "\uFECC",
  39736. "\u0639",
  39737. "\uFECD",
  39738. "\u063A",
  39739. "\uFECE",
  39740. "\u063A",
  39741. "\uFECF",
  39742. "\u063A",
  39743. "\uFED0",
  39744. "\u063A",
  39745. "\uFED1",
  39746. "\u0641",
  39747. "\uFED2",
  39748. "\u0641",
  39749. "\uFED3",
  39750. "\u0641",
  39751. "\uFED4",
  39752. "\u0641",
  39753. "\uFED5",
  39754. "\u0642",
  39755. "\uFED6",
  39756. "\u0642",
  39757. "\uFED7",
  39758. "\u0642",
  39759. "\uFED8",
  39760. "\u0642",
  39761. "\uFED9",
  39762. "\u0643",
  39763. "\uFEDA",
  39764. "\u0643",
  39765. "\uFEDB",
  39766. "\u0643",
  39767. "\uFEDC",
  39768. "\u0643",
  39769. "\uFEDD",
  39770. "\u0644",
  39771. "\uFEDE",
  39772. "\u0644",
  39773. "\uFEDF",
  39774. "\u0644",
  39775. "\uFEE0",
  39776. "\u0644",
  39777. "\uFEE1",
  39778. "\u0645",
  39779. "\uFEE2",
  39780. "\u0645",
  39781. "\uFEE3",
  39782. "\u0645",
  39783. "\uFEE4",
  39784. "\u0645",
  39785. "\uFEE5",
  39786. "\u0646",
  39787. "\uFEE6",
  39788. "\u0646",
  39789. "\uFEE7",
  39790. "\u0646",
  39791. "\uFEE8",
  39792. "\u0646",
  39793. "\uFEE9",
  39794. "\u0647",
  39795. "\uFEEA",
  39796. "\u0647",
  39797. "\uFEEB",
  39798. "\u0647",
  39799. "\uFEEC",
  39800. "\u0647",
  39801. "\uFEED",
  39802. "\u0648",
  39803. "\uFEEE",
  39804. "\u0648",
  39805. "\uFEEF",
  39806. "\u0649",
  39807. "\uFEF0",
  39808. "\u0649",
  39809. "\uFEF1",
  39810. "\u064A",
  39811. "\uFEF2",
  39812. "\u064A",
  39813. "\uFEF3",
  39814. "\u064A",
  39815. "\uFEF4",
  39816. "\u064A",
  39817. "\uFEF5",
  39818. "\u0644\u0622",
  39819. "\uFEF6",
  39820. "\u0644\u0622",
  39821. "\uFEF7",
  39822. "\u0644\u0623",
  39823. "\uFEF8",
  39824. "\u0644\u0623",
  39825. "\uFEF9",
  39826. "\u0644\u0625",
  39827. "\uFEFA",
  39828. "\u0644\u0625",
  39829. "\uFEFB",
  39830. "\u0644\u0627",
  39831. "\uFEFC",
  39832. "\u0644\u0627"
  39833. ];
  39834. });
  39835. function reverseIfRtl(chars) {
  39836. const charsLength = chars.length;
  39837. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  39838. return chars;
  39839. }
  39840. const buf = [];
  39841. for (let ii = charsLength - 1; ii >= 0; ii--) {
  39842. buf.push(chars[ii]);
  39843. }
  39844. return buf.join("");
  39845. }
  39846. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  39847. const CategoryCache = new Map();
  39848. function getCharUnicodeCategory(char) {
  39849. const cachedCategory = CategoryCache.get(char);
  39850. if (cachedCategory) {
  39851. return cachedCategory;
  39852. }
  39853. const groups = char.match(SpecialCharRegExp);
  39854. const category = {
  39855. isWhitespace: !!(groups && groups[1]),
  39856. isZeroWidthDiacritic: !!(groups && groups[2]),
  39857. isInvisibleFormatMark: !!(groups && groups[3])
  39858. };
  39859. CategoryCache.set(char, category);
  39860. return category;
  39861. }
  39862. function clearUnicodeCaches() {
  39863. CategoryCache.clear();
  39864. }
  39865. /***/ }),
  39866. /* 170 */
  39867. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39868. "use strict";
  39869. Object.defineProperty(exports, "__esModule", ({
  39870. value: true
  39871. }));
  39872. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  39873. exports.getStandardFontName = getStandardFontName;
  39874. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  39875. var _core_utils = __w_pdfjs_require__(135);
  39876. var _fonts_utils = __w_pdfjs_require__(167);
  39877. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  39878. t["Times-Roman"] = "Times-Roman";
  39879. t.Helvetica = "Helvetica";
  39880. t.Courier = "Courier";
  39881. t.Symbol = "Symbol";
  39882. t["Times-Bold"] = "Times-Bold";
  39883. t["Helvetica-Bold"] = "Helvetica-Bold";
  39884. t["Courier-Bold"] = "Courier-Bold";
  39885. t.ZapfDingbats = "ZapfDingbats";
  39886. t["Times-Italic"] = "Times-Italic";
  39887. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  39888. t["Courier-Oblique"] = "Courier-Oblique";
  39889. t["Times-BoldItalic"] = "Times-BoldItalic";
  39890. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  39891. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  39892. t.ArialNarrow = "Helvetica";
  39893. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  39894. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  39895. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  39896. t.ArialBlack = "Helvetica";
  39897. t["ArialBlack-Bold"] = "Helvetica-Bold";
  39898. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  39899. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  39900. t["Arial-Black"] = "Helvetica";
  39901. t["Arial-Black-Bold"] = "Helvetica-Bold";
  39902. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  39903. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  39904. t.Arial = "Helvetica";
  39905. t["Arial-Bold"] = "Helvetica-Bold";
  39906. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  39907. t["Arial-Italic"] = "Helvetica-Oblique";
  39908. t.ArialMT = "Helvetica";
  39909. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  39910. t["Arial-BoldMT"] = "Helvetica-Bold";
  39911. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  39912. t.ArialUnicodeMS = "Helvetica";
  39913. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  39914. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  39915. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  39916. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  39917. t["Courier-Italic"] = "Courier-Oblique";
  39918. t.CourierNew = "Courier";
  39919. t["CourierNew-Bold"] = "Courier-Bold";
  39920. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  39921. t["CourierNew-Italic"] = "Courier-Oblique";
  39922. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  39923. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  39924. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  39925. t.CourierNewPSMT = "Courier";
  39926. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  39927. t["Helvetica-Italic"] = "Helvetica-Oblique";
  39928. t["Symbol-Bold"] = "Symbol";
  39929. t["Symbol-BoldItalic"] = "Symbol";
  39930. t["Symbol-Italic"] = "Symbol";
  39931. t.TimesNewRoman = "Times-Roman";
  39932. t["TimesNewRoman-Bold"] = "Times-Bold";
  39933. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  39934. t["TimesNewRoman-Italic"] = "Times-Italic";
  39935. t.TimesNewRomanPS = "Times-Roman";
  39936. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  39937. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  39938. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  39939. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  39940. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  39941. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  39942. t.TimesNewRomanPSMT = "Times-Roman";
  39943. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  39944. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  39945. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  39946. });
  39947. exports.getStdFontMap = getStdFontMap;
  39948. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  39949. t.Courier = "FoxitFixed.pfb";
  39950. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  39951. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  39952. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  39953. t.Helvetica = "FoxitSans.pfb";
  39954. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  39955. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  39956. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  39957. t["Times-Roman"] = "FoxitSerif.pfb";
  39958. t["Times-Bold"] = "FoxitSerifBold.pfb";
  39959. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  39960. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  39961. t.Symbol = "FoxitSymbol.pfb";
  39962. t.ZapfDingbats = "FoxitDingbats.pfb";
  39963. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  39964. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  39965. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  39966. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  39967. });
  39968. exports.getFontNameToFileMap = getFontNameToFileMap;
  39969. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  39970. t.Calibri = "Helvetica";
  39971. t["Calibri-Bold"] = "Helvetica-Bold";
  39972. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  39973. t["Calibri-Italic"] = "Helvetica-Oblique";
  39974. t.CenturyGothic = "Helvetica";
  39975. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  39976. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  39977. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  39978. t.ComicSansMS = "Comic Sans MS";
  39979. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  39980. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  39981. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  39982. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  39983. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  39984. t["ItcSymbol-Book"] = "Helvetica";
  39985. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  39986. t["ItcSymbol-Medium"] = "Helvetica";
  39987. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  39988. t.LucidaConsole = "Courier";
  39989. t["LucidaConsole-Bold"] = "Courier-Bold";
  39990. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  39991. t["LucidaConsole-Italic"] = "Courier-Oblique";
  39992. t["LucidaSans-Demi"] = "Helvetica-Bold";
  39993. t["MS-Gothic"] = "MS Gothic";
  39994. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  39995. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  39996. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  39997. t["MS-Mincho"] = "MS Mincho";
  39998. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  39999. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  40000. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  40001. t["MS-PGothic"] = "MS PGothic";
  40002. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  40003. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  40004. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  40005. t["MS-PMincho"] = "MS PMincho";
  40006. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  40007. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  40008. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  40009. t.NuptialScript = "Times-Italic";
  40010. t.SegoeUISymbol = "Helvetica";
  40011. t.Wingdings = "ZapfDingbats";
  40012. t["Wingdings-Regular"] = "ZapfDingbats";
  40013. });
  40014. exports.getNonStdFontMap = getNonStdFontMap;
  40015. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40016. t["Adobe Jenson"] = true;
  40017. t["Adobe Text"] = true;
  40018. t.Albertus = true;
  40019. t.Aldus = true;
  40020. t.Alexandria = true;
  40021. t.Algerian = true;
  40022. t["American Typewriter"] = true;
  40023. t.Antiqua = true;
  40024. t.Apex = true;
  40025. t.Arno = true;
  40026. t.Aster = true;
  40027. t.Aurora = true;
  40028. t.Baskerville = true;
  40029. t.Bell = true;
  40030. t.Bembo = true;
  40031. t["Bembo Schoolbook"] = true;
  40032. t.Benguiat = true;
  40033. t["Berkeley Old Style"] = true;
  40034. t["Bernhard Modern"] = true;
  40035. t["Berthold City"] = true;
  40036. t.Bodoni = true;
  40037. t["Bauer Bodoni"] = true;
  40038. t["Book Antiqua"] = true;
  40039. t.Bookman = true;
  40040. t["Bordeaux Roman"] = true;
  40041. t["Californian FB"] = true;
  40042. t.Calisto = true;
  40043. t.Calvert = true;
  40044. t.Capitals = true;
  40045. t.Cambria = true;
  40046. t.Cartier = true;
  40047. t.Caslon = true;
  40048. t.Catull = true;
  40049. t.Centaur = true;
  40050. t["Century Old Style"] = true;
  40051. t["Century Schoolbook"] = true;
  40052. t.Chaparral = true;
  40053. t["Charis SIL"] = true;
  40054. t.Cheltenham = true;
  40055. t["Cholla Slab"] = true;
  40056. t.Clarendon = true;
  40057. t.Clearface = true;
  40058. t.Cochin = true;
  40059. t.Colonna = true;
  40060. t["Computer Modern"] = true;
  40061. t["Concrete Roman"] = true;
  40062. t.Constantia = true;
  40063. t["Cooper Black"] = true;
  40064. t.Corona = true;
  40065. t.Ecotype = true;
  40066. t.Egyptienne = true;
  40067. t.Elephant = true;
  40068. t.Excelsior = true;
  40069. t.Fairfield = true;
  40070. t["FF Scala"] = true;
  40071. t.Folkard = true;
  40072. t.Footlight = true;
  40073. t.FreeSerif = true;
  40074. t["Friz Quadrata"] = true;
  40075. t.Garamond = true;
  40076. t.Gentium = true;
  40077. t.Georgia = true;
  40078. t.Gloucester = true;
  40079. t["Goudy Old Style"] = true;
  40080. t["Goudy Schoolbook"] = true;
  40081. t["Goudy Pro Font"] = true;
  40082. t.Granjon = true;
  40083. t["Guardian Egyptian"] = true;
  40084. t.Heather = true;
  40085. t.Hercules = true;
  40086. t["High Tower Text"] = true;
  40087. t.Hiroshige = true;
  40088. t["Hoefler Text"] = true;
  40089. t["Humana Serif"] = true;
  40090. t.Imprint = true;
  40091. t["Ionic No. 5"] = true;
  40092. t.Janson = true;
  40093. t.Joanna = true;
  40094. t.Korinna = true;
  40095. t.Lexicon = true;
  40096. t.LiberationSerif = true;
  40097. t["Liberation Serif"] = true;
  40098. t["Linux Libertine"] = true;
  40099. t.Literaturnaya = true;
  40100. t.Lucida = true;
  40101. t["Lucida Bright"] = true;
  40102. t.Melior = true;
  40103. t.Memphis = true;
  40104. t.Miller = true;
  40105. t.Minion = true;
  40106. t.Modern = true;
  40107. t["Mona Lisa"] = true;
  40108. t["Mrs Eaves"] = true;
  40109. t["MS Serif"] = true;
  40110. t["Museo Slab"] = true;
  40111. t["New York"] = true;
  40112. t["Nimbus Roman"] = true;
  40113. t["NPS Rawlinson Roadway"] = true;
  40114. t.NuptialScript = true;
  40115. t.Palatino = true;
  40116. t.Perpetua = true;
  40117. t.Plantin = true;
  40118. t["Plantin Schoolbook"] = true;
  40119. t.Playbill = true;
  40120. t["Poor Richard"] = true;
  40121. t["Rawlinson Roadway"] = true;
  40122. t.Renault = true;
  40123. t.Requiem = true;
  40124. t.Rockwell = true;
  40125. t.Roman = true;
  40126. t["Rotis Serif"] = true;
  40127. t.Sabon = true;
  40128. t.Scala = true;
  40129. t.Seagull = true;
  40130. t.Sistina = true;
  40131. t.Souvenir = true;
  40132. t.STIX = true;
  40133. t["Stone Informal"] = true;
  40134. t["Stone Serif"] = true;
  40135. t.Sylfaen = true;
  40136. t.Times = true;
  40137. t.Trajan = true;
  40138. t["Trinité"] = true;
  40139. t["Trump Mediaeval"] = true;
  40140. t.Utopia = true;
  40141. t["Vale Type"] = true;
  40142. t["Bitstream Vera"] = true;
  40143. t["Vera Serif"] = true;
  40144. t.Versailles = true;
  40145. t.Wanted = true;
  40146. t.Weiss = true;
  40147. t["Wide Latin"] = true;
  40148. t.Windsor = true;
  40149. t.XITS = true;
  40150. });
  40151. exports.getSerifFonts = getSerifFonts;
  40152. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40153. t.Dingbats = true;
  40154. t.Symbol = true;
  40155. t.ZapfDingbats = true;
  40156. });
  40157. exports.getSymbolsFonts = getSymbolsFonts;
  40158. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  40159. t[2] = 10;
  40160. t[3] = 32;
  40161. t[4] = 33;
  40162. t[5] = 34;
  40163. t[6] = 35;
  40164. t[7] = 36;
  40165. t[8] = 37;
  40166. t[9] = 38;
  40167. t[10] = 39;
  40168. t[11] = 40;
  40169. t[12] = 41;
  40170. t[13] = 42;
  40171. t[14] = 43;
  40172. t[15] = 44;
  40173. t[16] = 45;
  40174. t[17] = 46;
  40175. t[18] = 47;
  40176. t[19] = 48;
  40177. t[20] = 49;
  40178. t[21] = 50;
  40179. t[22] = 51;
  40180. t[23] = 52;
  40181. t[24] = 53;
  40182. t[25] = 54;
  40183. t[26] = 55;
  40184. t[27] = 56;
  40185. t[28] = 57;
  40186. t[29] = 58;
  40187. t[30] = 894;
  40188. t[31] = 60;
  40189. t[32] = 61;
  40190. t[33] = 62;
  40191. t[34] = 63;
  40192. t[35] = 64;
  40193. t[36] = 65;
  40194. t[37] = 66;
  40195. t[38] = 67;
  40196. t[39] = 68;
  40197. t[40] = 69;
  40198. t[41] = 70;
  40199. t[42] = 71;
  40200. t[43] = 72;
  40201. t[44] = 73;
  40202. t[45] = 74;
  40203. t[46] = 75;
  40204. t[47] = 76;
  40205. t[48] = 77;
  40206. t[49] = 78;
  40207. t[50] = 79;
  40208. t[51] = 80;
  40209. t[52] = 81;
  40210. t[53] = 82;
  40211. t[54] = 83;
  40212. t[55] = 84;
  40213. t[56] = 85;
  40214. t[57] = 86;
  40215. t[58] = 87;
  40216. t[59] = 88;
  40217. t[60] = 89;
  40218. t[61] = 90;
  40219. t[62] = 91;
  40220. t[63] = 92;
  40221. t[64] = 93;
  40222. t[65] = 94;
  40223. t[66] = 95;
  40224. t[67] = 96;
  40225. t[68] = 97;
  40226. t[69] = 98;
  40227. t[70] = 99;
  40228. t[71] = 100;
  40229. t[72] = 101;
  40230. t[73] = 102;
  40231. t[74] = 103;
  40232. t[75] = 104;
  40233. t[76] = 105;
  40234. t[77] = 106;
  40235. t[78] = 107;
  40236. t[79] = 108;
  40237. t[80] = 109;
  40238. t[81] = 110;
  40239. t[82] = 111;
  40240. t[83] = 112;
  40241. t[84] = 113;
  40242. t[85] = 114;
  40243. t[86] = 115;
  40244. t[87] = 116;
  40245. t[88] = 117;
  40246. t[89] = 118;
  40247. t[90] = 119;
  40248. t[91] = 120;
  40249. t[92] = 121;
  40250. t[93] = 122;
  40251. t[94] = 123;
  40252. t[95] = 124;
  40253. t[96] = 125;
  40254. t[97] = 126;
  40255. t[98] = 196;
  40256. t[99] = 197;
  40257. t[100] = 199;
  40258. t[101] = 201;
  40259. t[102] = 209;
  40260. t[103] = 214;
  40261. t[104] = 220;
  40262. t[105] = 225;
  40263. t[106] = 224;
  40264. t[107] = 226;
  40265. t[108] = 228;
  40266. t[109] = 227;
  40267. t[110] = 229;
  40268. t[111] = 231;
  40269. t[112] = 233;
  40270. t[113] = 232;
  40271. t[114] = 234;
  40272. t[115] = 235;
  40273. t[116] = 237;
  40274. t[117] = 236;
  40275. t[118] = 238;
  40276. t[119] = 239;
  40277. t[120] = 241;
  40278. t[121] = 243;
  40279. t[122] = 242;
  40280. t[123] = 244;
  40281. t[124] = 246;
  40282. t[125] = 245;
  40283. t[126] = 250;
  40284. t[127] = 249;
  40285. t[128] = 251;
  40286. t[129] = 252;
  40287. t[130] = 8224;
  40288. t[131] = 176;
  40289. t[132] = 162;
  40290. t[133] = 163;
  40291. t[134] = 167;
  40292. t[135] = 8226;
  40293. t[136] = 182;
  40294. t[137] = 223;
  40295. t[138] = 174;
  40296. t[139] = 169;
  40297. t[140] = 8482;
  40298. t[141] = 180;
  40299. t[142] = 168;
  40300. t[143] = 8800;
  40301. t[144] = 198;
  40302. t[145] = 216;
  40303. t[146] = 8734;
  40304. t[147] = 177;
  40305. t[148] = 8804;
  40306. t[149] = 8805;
  40307. t[150] = 165;
  40308. t[151] = 181;
  40309. t[152] = 8706;
  40310. t[153] = 8721;
  40311. t[154] = 8719;
  40312. t[156] = 8747;
  40313. t[157] = 170;
  40314. t[158] = 186;
  40315. t[159] = 8486;
  40316. t[160] = 230;
  40317. t[161] = 248;
  40318. t[162] = 191;
  40319. t[163] = 161;
  40320. t[164] = 172;
  40321. t[165] = 8730;
  40322. t[166] = 402;
  40323. t[167] = 8776;
  40324. t[168] = 8710;
  40325. t[169] = 171;
  40326. t[170] = 187;
  40327. t[171] = 8230;
  40328. t[179] = 8220;
  40329. t[180] = 8221;
  40330. t[181] = 8216;
  40331. t[182] = 8217;
  40332. t[200] = 193;
  40333. t[203] = 205;
  40334. t[210] = 218;
  40335. t[223] = 711;
  40336. t[224] = 321;
  40337. t[225] = 322;
  40338. t[226] = 352;
  40339. t[227] = 353;
  40340. t[228] = 381;
  40341. t[229] = 382;
  40342. t[233] = 221;
  40343. t[234] = 253;
  40344. t[252] = 263;
  40345. t[253] = 268;
  40346. t[254] = 269;
  40347. t[258] = 258;
  40348. t[260] = 260;
  40349. t[261] = 261;
  40350. t[265] = 280;
  40351. t[266] = 281;
  40352. t[267] = 282;
  40353. t[268] = 283;
  40354. t[269] = 313;
  40355. t[275] = 323;
  40356. t[276] = 324;
  40357. t[278] = 328;
  40358. t[283] = 344;
  40359. t[284] = 345;
  40360. t[285] = 346;
  40361. t[286] = 347;
  40362. t[292] = 367;
  40363. t[295] = 377;
  40364. t[296] = 378;
  40365. t[298] = 380;
  40366. t[305] = 963;
  40367. t[306] = 964;
  40368. t[307] = 966;
  40369. t[308] = 8215;
  40370. t[309] = 8252;
  40371. t[310] = 8319;
  40372. t[311] = 8359;
  40373. t[312] = 8592;
  40374. t[313] = 8593;
  40375. t[337] = 9552;
  40376. t[493] = 1039;
  40377. t[494] = 1040;
  40378. t[672] = 1488;
  40379. t[673] = 1489;
  40380. t[674] = 1490;
  40381. t[675] = 1491;
  40382. t[676] = 1492;
  40383. t[677] = 1493;
  40384. t[678] = 1494;
  40385. t[679] = 1495;
  40386. t[680] = 1496;
  40387. t[681] = 1497;
  40388. t[682] = 1498;
  40389. t[683] = 1499;
  40390. t[684] = 1500;
  40391. t[685] = 1501;
  40392. t[686] = 1502;
  40393. t[687] = 1503;
  40394. t[688] = 1504;
  40395. t[689] = 1505;
  40396. t[690] = 1506;
  40397. t[691] = 1507;
  40398. t[692] = 1508;
  40399. t[693] = 1509;
  40400. t[694] = 1510;
  40401. t[695] = 1511;
  40402. t[696] = 1512;
  40403. t[697] = 1513;
  40404. t[698] = 1514;
  40405. t[705] = 1524;
  40406. t[706] = 8362;
  40407. t[710] = 64288;
  40408. t[711] = 64298;
  40409. t[759] = 1617;
  40410. t[761] = 1776;
  40411. t[763] = 1778;
  40412. t[775] = 1652;
  40413. t[777] = 1764;
  40414. t[778] = 1780;
  40415. t[779] = 1781;
  40416. t[780] = 1782;
  40417. t[782] = 771;
  40418. t[783] = 64726;
  40419. t[786] = 8363;
  40420. t[788] = 8532;
  40421. t[790] = 768;
  40422. t[791] = 769;
  40423. t[792] = 768;
  40424. t[795] = 803;
  40425. t[797] = 64336;
  40426. t[798] = 64337;
  40427. t[799] = 64342;
  40428. t[800] = 64343;
  40429. t[801] = 64344;
  40430. t[802] = 64345;
  40431. t[803] = 64362;
  40432. t[804] = 64363;
  40433. t[805] = 64364;
  40434. t[2424] = 7821;
  40435. t[2425] = 7822;
  40436. t[2426] = 7823;
  40437. t[2427] = 7824;
  40438. t[2428] = 7825;
  40439. t[2429] = 7826;
  40440. t[2430] = 7827;
  40441. t[2433] = 7682;
  40442. t[2678] = 8045;
  40443. t[2679] = 8046;
  40444. t[2830] = 1552;
  40445. t[2838] = 686;
  40446. t[2840] = 751;
  40447. t[2842] = 753;
  40448. t[2843] = 754;
  40449. t[2844] = 755;
  40450. t[2846] = 757;
  40451. t[2856] = 767;
  40452. t[2857] = 848;
  40453. t[2858] = 849;
  40454. t[2862] = 853;
  40455. t[2863] = 854;
  40456. t[2864] = 855;
  40457. t[2865] = 861;
  40458. t[2866] = 862;
  40459. t[2906] = 7460;
  40460. t[2908] = 7462;
  40461. t[2909] = 7463;
  40462. t[2910] = 7464;
  40463. t[2912] = 7466;
  40464. t[2913] = 7467;
  40465. t[2914] = 7468;
  40466. t[2916] = 7470;
  40467. t[2917] = 7471;
  40468. t[2918] = 7472;
  40469. t[2920] = 7474;
  40470. t[2921] = 7475;
  40471. t[2922] = 7476;
  40472. t[2924] = 7478;
  40473. t[2925] = 7479;
  40474. t[2926] = 7480;
  40475. t[2928] = 7482;
  40476. t[2929] = 7483;
  40477. t[2930] = 7484;
  40478. t[2932] = 7486;
  40479. t[2933] = 7487;
  40480. t[2934] = 7488;
  40481. t[2936] = 7490;
  40482. t[2937] = 7491;
  40483. t[2938] = 7492;
  40484. t[2940] = 7494;
  40485. t[2941] = 7495;
  40486. t[2942] = 7496;
  40487. t[2944] = 7498;
  40488. t[2946] = 7500;
  40489. t[2948] = 7502;
  40490. t[2950] = 7504;
  40491. t[2951] = 7505;
  40492. t[2952] = 7506;
  40493. t[2954] = 7508;
  40494. t[2955] = 7509;
  40495. t[2956] = 7510;
  40496. t[2958] = 7512;
  40497. t[2959] = 7513;
  40498. t[2960] = 7514;
  40499. t[2962] = 7516;
  40500. t[2963] = 7517;
  40501. t[2964] = 7518;
  40502. t[2966] = 7520;
  40503. t[2967] = 7521;
  40504. t[2968] = 7522;
  40505. t[2970] = 7524;
  40506. t[2971] = 7525;
  40507. t[2972] = 7526;
  40508. t[2974] = 7528;
  40509. t[2975] = 7529;
  40510. t[2976] = 7530;
  40511. t[2978] = 1537;
  40512. t[2979] = 1538;
  40513. t[2980] = 1539;
  40514. t[2982] = 1549;
  40515. t[2983] = 1551;
  40516. t[2984] = 1552;
  40517. t[2986] = 1554;
  40518. t[2987] = 1555;
  40519. t[2988] = 1556;
  40520. t[2990] = 1623;
  40521. t[2991] = 1624;
  40522. t[2995] = 1775;
  40523. t[2999] = 1791;
  40524. t[3002] = 64290;
  40525. t[3003] = 64291;
  40526. t[3004] = 64292;
  40527. t[3006] = 64294;
  40528. t[3007] = 64295;
  40529. t[3008] = 64296;
  40530. t[3011] = 1900;
  40531. t[3014] = 8223;
  40532. t[3015] = 8244;
  40533. t[3017] = 7532;
  40534. t[3018] = 7533;
  40535. t[3019] = 7534;
  40536. t[3075] = 7590;
  40537. t[3076] = 7591;
  40538. t[3079] = 7594;
  40539. t[3080] = 7595;
  40540. t[3083] = 7598;
  40541. t[3084] = 7599;
  40542. t[3087] = 7602;
  40543. t[3088] = 7603;
  40544. t[3091] = 7606;
  40545. t[3092] = 7607;
  40546. t[3095] = 7610;
  40547. t[3096] = 7611;
  40548. t[3099] = 7614;
  40549. t[3100] = 7615;
  40550. t[3103] = 7618;
  40551. t[3104] = 7619;
  40552. t[3107] = 8337;
  40553. t[3108] = 8338;
  40554. t[3116] = 1884;
  40555. t[3119] = 1885;
  40556. t[3120] = 1885;
  40557. t[3123] = 1886;
  40558. t[3124] = 1886;
  40559. t[3127] = 1887;
  40560. t[3128] = 1887;
  40561. t[3131] = 1888;
  40562. t[3132] = 1888;
  40563. t[3135] = 1889;
  40564. t[3136] = 1889;
  40565. t[3139] = 1890;
  40566. t[3140] = 1890;
  40567. t[3143] = 1891;
  40568. t[3144] = 1891;
  40569. t[3147] = 1892;
  40570. t[3148] = 1892;
  40571. t[3153] = 580;
  40572. t[3154] = 581;
  40573. t[3157] = 584;
  40574. t[3158] = 585;
  40575. t[3161] = 588;
  40576. t[3162] = 589;
  40577. t[3165] = 891;
  40578. t[3166] = 892;
  40579. t[3169] = 1274;
  40580. t[3170] = 1275;
  40581. t[3173] = 1278;
  40582. t[3174] = 1279;
  40583. t[3181] = 7622;
  40584. t[3182] = 7623;
  40585. t[3282] = 11799;
  40586. t[3316] = 578;
  40587. t[3379] = 42785;
  40588. t[3393] = 1159;
  40589. t[3416] = 8377;
  40590. });
  40591. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  40592. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  40593. t[227] = 322;
  40594. t[264] = 261;
  40595. t[291] = 346;
  40596. });
  40597. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  40598. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  40599. t[1] = 32;
  40600. t[4] = 65;
  40601. t[5] = 192;
  40602. t[6] = 193;
  40603. t[9] = 196;
  40604. t[17] = 66;
  40605. t[18] = 67;
  40606. t[21] = 268;
  40607. t[24] = 68;
  40608. t[28] = 69;
  40609. t[29] = 200;
  40610. t[30] = 201;
  40611. t[32] = 282;
  40612. t[38] = 70;
  40613. t[39] = 71;
  40614. t[44] = 72;
  40615. t[47] = 73;
  40616. t[48] = 204;
  40617. t[49] = 205;
  40618. t[58] = 74;
  40619. t[60] = 75;
  40620. t[62] = 76;
  40621. t[68] = 77;
  40622. t[69] = 78;
  40623. t[75] = 79;
  40624. t[76] = 210;
  40625. t[80] = 214;
  40626. t[87] = 80;
  40627. t[89] = 81;
  40628. t[90] = 82;
  40629. t[92] = 344;
  40630. t[94] = 83;
  40631. t[97] = 352;
  40632. t[100] = 84;
  40633. t[104] = 85;
  40634. t[109] = 220;
  40635. t[115] = 86;
  40636. t[116] = 87;
  40637. t[121] = 88;
  40638. t[122] = 89;
  40639. t[124] = 221;
  40640. t[127] = 90;
  40641. t[129] = 381;
  40642. t[258] = 97;
  40643. t[259] = 224;
  40644. t[260] = 225;
  40645. t[263] = 228;
  40646. t[268] = 261;
  40647. t[271] = 98;
  40648. t[272] = 99;
  40649. t[273] = 263;
  40650. t[275] = 269;
  40651. t[282] = 100;
  40652. t[286] = 101;
  40653. t[287] = 232;
  40654. t[288] = 233;
  40655. t[290] = 283;
  40656. t[295] = 281;
  40657. t[296] = 102;
  40658. t[336] = 103;
  40659. t[346] = 104;
  40660. t[349] = 105;
  40661. t[350] = 236;
  40662. t[351] = 237;
  40663. t[361] = 106;
  40664. t[364] = 107;
  40665. t[367] = 108;
  40666. t[371] = 322;
  40667. t[373] = 109;
  40668. t[374] = 110;
  40669. t[381] = 111;
  40670. t[382] = 242;
  40671. t[383] = 243;
  40672. t[386] = 246;
  40673. t[393] = 112;
  40674. t[395] = 113;
  40675. t[396] = 114;
  40676. t[398] = 345;
  40677. t[400] = 115;
  40678. t[401] = 347;
  40679. t[403] = 353;
  40680. t[410] = 116;
  40681. t[437] = 117;
  40682. t[442] = 252;
  40683. t[448] = 118;
  40684. t[449] = 119;
  40685. t[454] = 120;
  40686. t[455] = 121;
  40687. t[457] = 253;
  40688. t[460] = 122;
  40689. t[462] = 382;
  40690. t[463] = 380;
  40691. t[853] = 44;
  40692. t[855] = 58;
  40693. t[856] = 46;
  40694. t[876] = 47;
  40695. t[878] = 45;
  40696. t[882] = 45;
  40697. t[894] = 40;
  40698. t[895] = 41;
  40699. t[896] = 91;
  40700. t[897] = 93;
  40701. t[923] = 64;
  40702. t[1004] = 48;
  40703. t[1005] = 49;
  40704. t[1006] = 50;
  40705. t[1007] = 51;
  40706. t[1008] = 52;
  40707. t[1009] = 53;
  40708. t[1010] = 54;
  40709. t[1011] = 55;
  40710. t[1012] = 56;
  40711. t[1013] = 57;
  40712. t[1081] = 37;
  40713. t[1085] = 43;
  40714. t[1086] = 45;
  40715. });
  40716. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  40717. function getStandardFontName(name) {
  40718. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  40719. const stdFontMap = getStdFontMap();
  40720. return stdFontMap[fontName];
  40721. }
  40722. /***/ }),
  40723. /* 171 */
  40724. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40725. "use strict";
  40726. Object.defineProperty(exports, "__esModule", ({
  40727. value: true
  40728. }));
  40729. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  40730. var _util = __w_pdfjs_require__(2);
  40731. class ToUnicodeMap {
  40732. constructor() {
  40733. let cmap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  40734. this._map = cmap;
  40735. }
  40736. get length() {
  40737. return this._map.length;
  40738. }
  40739. forEach(callback) {
  40740. for (const charCode in this._map) {
  40741. callback(charCode, this._map[charCode].charCodeAt(0));
  40742. }
  40743. }
  40744. has(i) {
  40745. return this._map[i] !== undefined;
  40746. }
  40747. get(i) {
  40748. return this._map[i];
  40749. }
  40750. charCodeOf(value) {
  40751. const map = this._map;
  40752. if (map.length <= 0x10000) {
  40753. return map.indexOf(value);
  40754. }
  40755. for (const charCode in map) {
  40756. if (map[charCode] === value) {
  40757. return charCode | 0;
  40758. }
  40759. }
  40760. return -1;
  40761. }
  40762. amend(map) {
  40763. for (const charCode in map) {
  40764. this._map[charCode] = map[charCode];
  40765. }
  40766. }
  40767. }
  40768. exports.ToUnicodeMap = ToUnicodeMap;
  40769. class IdentityToUnicodeMap {
  40770. constructor(firstChar, lastChar) {
  40771. this.firstChar = firstChar;
  40772. this.lastChar = lastChar;
  40773. }
  40774. get length() {
  40775. return this.lastChar + 1 - this.firstChar;
  40776. }
  40777. forEach(callback) {
  40778. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  40779. callback(i, i);
  40780. }
  40781. }
  40782. has(i) {
  40783. return this.firstChar <= i && i <= this.lastChar;
  40784. }
  40785. get(i) {
  40786. if (this.firstChar <= i && i <= this.lastChar) {
  40787. return String.fromCharCode(i);
  40788. }
  40789. return undefined;
  40790. }
  40791. charCodeOf(v) {
  40792. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  40793. }
  40794. amend(map) {
  40795. (0, _util.unreachable)("Should not call amend()");
  40796. }
  40797. }
  40798. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  40799. /***/ }),
  40800. /* 172 */
  40801. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40802. "use strict";
  40803. Object.defineProperty(exports, "__esModule", ({
  40804. value: true
  40805. }));
  40806. exports.CFFFont = void 0;
  40807. var _cff_parser = __w_pdfjs_require__(164);
  40808. var _fonts_utils = __w_pdfjs_require__(167);
  40809. var _util = __w_pdfjs_require__(2);
  40810. class CFFFont {
  40811. constructor(file, properties) {
  40812. this.properties = properties;
  40813. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  40814. this.cff = parser.parse();
  40815. this.cff.duplicateFirstGlyph();
  40816. const compiler = new _cff_parser.CFFCompiler(this.cff);
  40817. this.seacs = this.cff.seacs;
  40818. try {
  40819. this.data = compiler.compile();
  40820. } catch (e) {
  40821. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  40822. this.data = file;
  40823. }
  40824. this._createBuiltInEncoding();
  40825. }
  40826. get numGlyphs() {
  40827. return this.cff.charStrings.count;
  40828. }
  40829. getCharset() {
  40830. return this.cff.charset.charset;
  40831. }
  40832. getGlyphMapping() {
  40833. const cff = this.cff;
  40834. const properties = this.properties;
  40835. const {
  40836. cidToGidMap,
  40837. cMap
  40838. } = properties;
  40839. const charsets = cff.charset.charset;
  40840. let charCodeToGlyphId;
  40841. let glyphId;
  40842. if (properties.composite) {
  40843. let invCidToGidMap;
  40844. if (cidToGidMap && cidToGidMap.length > 0) {
  40845. invCidToGidMap = Object.create(null);
  40846. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  40847. const gid = cidToGidMap[i];
  40848. if (gid !== undefined) {
  40849. invCidToGidMap[gid] = i;
  40850. }
  40851. }
  40852. }
  40853. charCodeToGlyphId = Object.create(null);
  40854. let charCode;
  40855. if (cff.isCIDFont) {
  40856. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  40857. const cid = charsets[glyphId];
  40858. charCode = cMap.charCodeOf(cid);
  40859. if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
  40860. charCode = invCidToGidMap[charCode];
  40861. }
  40862. charCodeToGlyphId[charCode] = glyphId;
  40863. }
  40864. } else {
  40865. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  40866. charCode = cMap.charCodeOf(glyphId);
  40867. charCodeToGlyphId[charCode] = glyphId;
  40868. }
  40869. }
  40870. return charCodeToGlyphId;
  40871. }
  40872. let encoding = cff.encoding ? cff.encoding.encoding : null;
  40873. if (properties.isInternalFont) {
  40874. encoding = properties.defaultEncoding;
  40875. }
  40876. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  40877. return charCodeToGlyphId;
  40878. }
  40879. hasGlyphId(id) {
  40880. return this.cff.hasGlyphId(id);
  40881. }
  40882. _createBuiltInEncoding() {
  40883. const {
  40884. charset,
  40885. encoding
  40886. } = this.cff;
  40887. if (!charset || !encoding) {
  40888. return;
  40889. }
  40890. const charsets = charset.charset,
  40891. encodings = encoding.encoding;
  40892. const map = [];
  40893. for (const charCode in encodings) {
  40894. const glyphId = encodings[charCode];
  40895. if (glyphId >= 0) {
  40896. const glyphName = charsets[glyphId];
  40897. if (glyphName) {
  40898. map[charCode] = glyphName;
  40899. }
  40900. }
  40901. }
  40902. if (map.length > 0) {
  40903. this.properties.builtInEncoding = map;
  40904. }
  40905. }
  40906. }
  40907. exports.CFFFont = CFFFont;
  40908. /***/ }),
  40909. /* 173 */
  40910. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40911. "use strict";
  40912. Object.defineProperty(exports, "__esModule", ({
  40913. value: true
  40914. }));
  40915. exports.FontRendererFactory = void 0;
  40916. var _util = __w_pdfjs_require__(2);
  40917. var _cff_parser = __w_pdfjs_require__(164);
  40918. var _glyphlist = __w_pdfjs_require__(168);
  40919. var _encodings = __w_pdfjs_require__(166);
  40920. var _stream = __w_pdfjs_require__(139);
  40921. function getUint32(data, offset) {
  40922. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  40923. }
  40924. function getUint16(data, offset) {
  40925. return data[offset] << 8 | data[offset + 1];
  40926. }
  40927. function getInt16(data, offset) {
  40928. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  40929. }
  40930. function getInt8(data, offset) {
  40931. return data[offset] << 24 >> 24;
  40932. }
  40933. function getFloat214(data, offset) {
  40934. return getInt16(data, offset) / 16384;
  40935. }
  40936. function getSubroutineBias(subrs) {
  40937. const numSubrs = subrs.length;
  40938. let bias = 32768;
  40939. if (numSubrs < 1240) {
  40940. bias = 107;
  40941. } else if (numSubrs < 33900) {
  40942. bias = 1131;
  40943. }
  40944. return bias;
  40945. }
  40946. function parseCmap(data, start, end) {
  40947. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  40948. const format = getUint16(data, start + offset);
  40949. let ranges, p, i;
  40950. if (format === 4) {
  40951. getUint16(data, start + offset + 2);
  40952. const segCount = getUint16(data, start + offset + 6) >> 1;
  40953. p = start + offset + 14;
  40954. ranges = [];
  40955. for (i = 0; i < segCount; i++, p += 2) {
  40956. ranges[i] = {
  40957. end: getUint16(data, p)
  40958. };
  40959. }
  40960. p += 2;
  40961. for (i = 0; i < segCount; i++, p += 2) {
  40962. ranges[i].start = getUint16(data, p);
  40963. }
  40964. for (i = 0; i < segCount; i++, p += 2) {
  40965. ranges[i].idDelta = getUint16(data, p);
  40966. }
  40967. for (i = 0; i < segCount; i++, p += 2) {
  40968. let idOffset = getUint16(data, p);
  40969. if (idOffset === 0) {
  40970. continue;
  40971. }
  40972. ranges[i].ids = [];
  40973. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  40974. ranges[i].ids[j] = getUint16(data, p + idOffset);
  40975. idOffset += 2;
  40976. }
  40977. }
  40978. return ranges;
  40979. } else if (format === 12) {
  40980. const groups = getUint32(data, start + offset + 12);
  40981. p = start + offset + 16;
  40982. ranges = [];
  40983. for (i = 0; i < groups; i++) {
  40984. start = getUint32(data, p);
  40985. ranges.push({
  40986. start,
  40987. end: getUint32(data, p + 4),
  40988. idDelta: getUint32(data, p + 8) - start
  40989. });
  40990. p += 12;
  40991. }
  40992. return ranges;
  40993. }
  40994. throw new _util.FormatError(`unsupported cmap: ${format}`);
  40995. }
  40996. function parseCff(data, start, end, seacAnalysisEnabled) {
  40997. const properties = {};
  40998. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  40999. const cff = parser.parse();
  41000. return {
  41001. glyphs: cff.charStrings.objects,
  41002. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  41003. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  41004. isCFFCIDFont: cff.isCIDFont,
  41005. fdSelect: cff.fdSelect,
  41006. fdArray: cff.fdArray
  41007. };
  41008. }
  41009. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  41010. let itemSize, itemDecode;
  41011. if (isGlyphLocationsLong) {
  41012. itemSize = 4;
  41013. itemDecode = getUint32;
  41014. } else {
  41015. itemSize = 2;
  41016. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  41017. }
  41018. const glyphs = [];
  41019. let startOffset = itemDecode(loca, 0);
  41020. for (let j = itemSize; j < loca.length; j += itemSize) {
  41021. const endOffset = itemDecode(loca, j);
  41022. glyphs.push(glyf.subarray(startOffset, endOffset));
  41023. startOffset = endOffset;
  41024. }
  41025. return glyphs;
  41026. }
  41027. function lookupCmap(ranges, unicode) {
  41028. const code = unicode.codePointAt(0);
  41029. let gid = 0,
  41030. l = 0,
  41031. r = ranges.length - 1;
  41032. while (l < r) {
  41033. const c = l + r + 1 >> 1;
  41034. if (code < ranges[c].start) {
  41035. r = c - 1;
  41036. } else {
  41037. l = c;
  41038. }
  41039. }
  41040. if (ranges[l].start <= code && code <= ranges[l].end) {
  41041. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  41042. }
  41043. return {
  41044. charCode: code,
  41045. glyphId: gid
  41046. };
  41047. }
  41048. function compileGlyf(code, cmds, font) {
  41049. function moveTo(x, y) {
  41050. cmds.push({
  41051. cmd: "moveTo",
  41052. args: [x, y]
  41053. });
  41054. }
  41055. function lineTo(x, y) {
  41056. cmds.push({
  41057. cmd: "lineTo",
  41058. args: [x, y]
  41059. });
  41060. }
  41061. function quadraticCurveTo(xa, ya, x, y) {
  41062. cmds.push({
  41063. cmd: "quadraticCurveTo",
  41064. args: [xa, ya, x, y]
  41065. });
  41066. }
  41067. let i = 0;
  41068. const numberOfContours = getInt16(code, i);
  41069. let flags;
  41070. let x = 0,
  41071. y = 0;
  41072. i += 10;
  41073. if (numberOfContours < 0) {
  41074. do {
  41075. flags = getUint16(code, i);
  41076. const glyphIndex = getUint16(code, i + 2);
  41077. i += 4;
  41078. let arg1, arg2;
  41079. if (flags & 0x01) {
  41080. if (flags & 0x02) {
  41081. arg1 = getInt16(code, i);
  41082. arg2 = getInt16(code, i + 2);
  41083. } else {
  41084. arg1 = getUint16(code, i);
  41085. arg2 = getUint16(code, i + 2);
  41086. }
  41087. i += 4;
  41088. } else {
  41089. if (flags & 0x02) {
  41090. arg1 = getInt8(code, i++);
  41091. arg2 = getInt8(code, i++);
  41092. } else {
  41093. arg1 = code[i++];
  41094. arg2 = code[i++];
  41095. }
  41096. }
  41097. if (flags & 0x02) {
  41098. x = arg1;
  41099. y = arg2;
  41100. } else {
  41101. x = 0;
  41102. y = 0;
  41103. }
  41104. let scaleX = 1,
  41105. scaleY = 1,
  41106. scale01 = 0,
  41107. scale10 = 0;
  41108. if (flags & 0x08) {
  41109. scaleX = scaleY = getFloat214(code, i);
  41110. i += 2;
  41111. } else if (flags & 0x40) {
  41112. scaleX = getFloat214(code, i);
  41113. scaleY = getFloat214(code, i + 2);
  41114. i += 4;
  41115. } else if (flags & 0x80) {
  41116. scaleX = getFloat214(code, i);
  41117. scale01 = getFloat214(code, i + 2);
  41118. scale10 = getFloat214(code, i + 4);
  41119. scaleY = getFloat214(code, i + 6);
  41120. i += 8;
  41121. }
  41122. const subglyph = font.glyphs[glyphIndex];
  41123. if (subglyph) {
  41124. cmds.push({
  41125. cmd: "save"
  41126. }, {
  41127. cmd: "transform",
  41128. args: [scaleX, scale01, scale10, scaleY, x, y]
  41129. });
  41130. if (!(flags & 0x02)) {}
  41131. compileGlyf(subglyph, cmds, font);
  41132. cmds.push({
  41133. cmd: "restore"
  41134. });
  41135. }
  41136. } while (flags & 0x20);
  41137. } else {
  41138. const endPtsOfContours = [];
  41139. let j, jj;
  41140. for (j = 0; j < numberOfContours; j++) {
  41141. endPtsOfContours.push(getUint16(code, i));
  41142. i += 2;
  41143. }
  41144. const instructionLength = getUint16(code, i);
  41145. i += 2 + instructionLength;
  41146. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  41147. const points = [];
  41148. while (points.length < numberOfPoints) {
  41149. flags = code[i++];
  41150. let repeat = 1;
  41151. if (flags & 0x08) {
  41152. repeat += code[i++];
  41153. }
  41154. while (repeat-- > 0) {
  41155. points.push({
  41156. flags
  41157. });
  41158. }
  41159. }
  41160. for (j = 0; j < numberOfPoints; j++) {
  41161. switch (points[j].flags & 0x12) {
  41162. case 0x00:
  41163. x += getInt16(code, i);
  41164. i += 2;
  41165. break;
  41166. case 0x02:
  41167. x -= code[i++];
  41168. break;
  41169. case 0x12:
  41170. x += code[i++];
  41171. break;
  41172. }
  41173. points[j].x = x;
  41174. }
  41175. for (j = 0; j < numberOfPoints; j++) {
  41176. switch (points[j].flags & 0x24) {
  41177. case 0x00:
  41178. y += getInt16(code, i);
  41179. i += 2;
  41180. break;
  41181. case 0x04:
  41182. y -= code[i++];
  41183. break;
  41184. case 0x24:
  41185. y += code[i++];
  41186. break;
  41187. }
  41188. points[j].y = y;
  41189. }
  41190. let startPoint = 0;
  41191. for (i = 0; i < numberOfContours; i++) {
  41192. const endPoint = endPtsOfContours[i];
  41193. const contour = points.slice(startPoint, endPoint + 1);
  41194. if (contour[0].flags & 1) {
  41195. contour.push(contour[0]);
  41196. } else if (contour.at(-1).flags & 1) {
  41197. contour.unshift(contour.at(-1));
  41198. } else {
  41199. const p = {
  41200. flags: 1,
  41201. x: (contour[0].x + contour.at(-1).x) / 2,
  41202. y: (contour[0].y + contour.at(-1).y) / 2
  41203. };
  41204. contour.unshift(p);
  41205. contour.push(p);
  41206. }
  41207. moveTo(contour[0].x, contour[0].y);
  41208. for (j = 1, jj = contour.length; j < jj; j++) {
  41209. if (contour[j].flags & 1) {
  41210. lineTo(contour[j].x, contour[j].y);
  41211. } else if (contour[j + 1].flags & 1) {
  41212. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  41213. j++;
  41214. } else {
  41215. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  41216. }
  41217. }
  41218. startPoint = endPoint + 1;
  41219. }
  41220. }
  41221. }
  41222. function compileCharString(charStringCode, cmds, font, glyphId) {
  41223. function moveTo(x, y) {
  41224. cmds.push({
  41225. cmd: "moveTo",
  41226. args: [x, y]
  41227. });
  41228. }
  41229. function lineTo(x, y) {
  41230. cmds.push({
  41231. cmd: "lineTo",
  41232. args: [x, y]
  41233. });
  41234. }
  41235. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  41236. cmds.push({
  41237. cmd: "bezierCurveTo",
  41238. args: [x1, y1, x2, y2, x, y]
  41239. });
  41240. }
  41241. const stack = [];
  41242. let x = 0,
  41243. y = 0;
  41244. let stems = 0;
  41245. function parse(code) {
  41246. let i = 0;
  41247. while (i < code.length) {
  41248. let stackClean = false;
  41249. let v = code[i++];
  41250. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  41251. switch (v) {
  41252. case 1:
  41253. stems += stack.length >> 1;
  41254. stackClean = true;
  41255. break;
  41256. case 3:
  41257. stems += stack.length >> 1;
  41258. stackClean = true;
  41259. break;
  41260. case 4:
  41261. y += stack.pop();
  41262. moveTo(x, y);
  41263. stackClean = true;
  41264. break;
  41265. case 5:
  41266. while (stack.length > 0) {
  41267. x += stack.shift();
  41268. y += stack.shift();
  41269. lineTo(x, y);
  41270. }
  41271. break;
  41272. case 6:
  41273. while (stack.length > 0) {
  41274. x += stack.shift();
  41275. lineTo(x, y);
  41276. if (stack.length === 0) {
  41277. break;
  41278. }
  41279. y += stack.shift();
  41280. lineTo(x, y);
  41281. }
  41282. break;
  41283. case 7:
  41284. while (stack.length > 0) {
  41285. y += stack.shift();
  41286. lineTo(x, y);
  41287. if (stack.length === 0) {
  41288. break;
  41289. }
  41290. x += stack.shift();
  41291. lineTo(x, y);
  41292. }
  41293. break;
  41294. case 8:
  41295. while (stack.length > 0) {
  41296. xa = x + stack.shift();
  41297. ya = y + stack.shift();
  41298. xb = xa + stack.shift();
  41299. yb = ya + stack.shift();
  41300. x = xb + stack.shift();
  41301. y = yb + stack.shift();
  41302. bezierCurveTo(xa, ya, xb, yb, x, y);
  41303. }
  41304. break;
  41305. case 10:
  41306. n = stack.pop();
  41307. subrCode = null;
  41308. if (font.isCFFCIDFont) {
  41309. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  41310. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  41311. const fontDict = font.fdArray[fdIndex];
  41312. let subrs;
  41313. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  41314. subrs = fontDict.privateDict.subrsIndex.objects;
  41315. }
  41316. if (subrs) {
  41317. n += getSubroutineBias(subrs);
  41318. subrCode = subrs[n];
  41319. }
  41320. } else {
  41321. (0, _util.warn)("Invalid fd index for glyph index.");
  41322. }
  41323. } else {
  41324. subrCode = font.subrs[n + font.subrsBias];
  41325. }
  41326. if (subrCode) {
  41327. parse(subrCode);
  41328. }
  41329. break;
  41330. case 11:
  41331. return;
  41332. case 12:
  41333. v = code[i++];
  41334. switch (v) {
  41335. case 34:
  41336. xa = x + stack.shift();
  41337. xb = xa + stack.shift();
  41338. y1 = y + stack.shift();
  41339. x = xb + stack.shift();
  41340. bezierCurveTo(xa, y, xb, y1, x, y1);
  41341. xa = x + stack.shift();
  41342. xb = xa + stack.shift();
  41343. x = xb + stack.shift();
  41344. bezierCurveTo(xa, y1, xb, y, x, y);
  41345. break;
  41346. case 35:
  41347. xa = x + stack.shift();
  41348. ya = y + stack.shift();
  41349. xb = xa + stack.shift();
  41350. yb = ya + stack.shift();
  41351. x = xb + stack.shift();
  41352. y = yb + stack.shift();
  41353. bezierCurveTo(xa, ya, xb, yb, x, y);
  41354. xa = x + stack.shift();
  41355. ya = y + stack.shift();
  41356. xb = xa + stack.shift();
  41357. yb = ya + stack.shift();
  41358. x = xb + stack.shift();
  41359. y = yb + stack.shift();
  41360. bezierCurveTo(xa, ya, xb, yb, x, y);
  41361. stack.pop();
  41362. break;
  41363. case 36:
  41364. xa = x + stack.shift();
  41365. y1 = y + stack.shift();
  41366. xb = xa + stack.shift();
  41367. y2 = y1 + stack.shift();
  41368. x = xb + stack.shift();
  41369. bezierCurveTo(xa, y1, xb, y2, x, y2);
  41370. xa = x + stack.shift();
  41371. xb = xa + stack.shift();
  41372. y3 = y2 + stack.shift();
  41373. x = xb + stack.shift();
  41374. bezierCurveTo(xa, y2, xb, y3, x, y);
  41375. break;
  41376. case 37:
  41377. const x0 = x,
  41378. y0 = y;
  41379. xa = x + stack.shift();
  41380. ya = y + stack.shift();
  41381. xb = xa + stack.shift();
  41382. yb = ya + stack.shift();
  41383. x = xb + stack.shift();
  41384. y = yb + stack.shift();
  41385. bezierCurveTo(xa, ya, xb, yb, x, y);
  41386. xa = x + stack.shift();
  41387. ya = y + stack.shift();
  41388. xb = xa + stack.shift();
  41389. yb = ya + stack.shift();
  41390. x = xb;
  41391. y = yb;
  41392. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  41393. x += stack.shift();
  41394. } else {
  41395. y += stack.shift();
  41396. }
  41397. bezierCurveTo(xa, ya, xb, yb, x, y);
  41398. break;
  41399. default:
  41400. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  41401. }
  41402. break;
  41403. case 14:
  41404. if (stack.length >= 4) {
  41405. const achar = stack.pop();
  41406. const bchar = stack.pop();
  41407. y = stack.pop();
  41408. x = stack.pop();
  41409. cmds.push({
  41410. cmd: "save"
  41411. }, {
  41412. cmd: "translate",
  41413. args: [x, y]
  41414. });
  41415. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  41416. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41417. cmds.push({
  41418. cmd: "restore"
  41419. });
  41420. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  41421. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  41422. }
  41423. return;
  41424. case 18:
  41425. stems += stack.length >> 1;
  41426. stackClean = true;
  41427. break;
  41428. case 19:
  41429. stems += stack.length >> 1;
  41430. i += stems + 7 >> 3;
  41431. stackClean = true;
  41432. break;
  41433. case 20:
  41434. stems += stack.length >> 1;
  41435. i += stems + 7 >> 3;
  41436. stackClean = true;
  41437. break;
  41438. case 21:
  41439. y += stack.pop();
  41440. x += stack.pop();
  41441. moveTo(x, y);
  41442. stackClean = true;
  41443. break;
  41444. case 22:
  41445. x += stack.pop();
  41446. moveTo(x, y);
  41447. stackClean = true;
  41448. break;
  41449. case 23:
  41450. stems += stack.length >> 1;
  41451. stackClean = true;
  41452. break;
  41453. case 24:
  41454. while (stack.length > 2) {
  41455. xa = x + stack.shift();
  41456. ya = y + stack.shift();
  41457. xb = xa + stack.shift();
  41458. yb = ya + stack.shift();
  41459. x = xb + stack.shift();
  41460. y = yb + stack.shift();
  41461. bezierCurveTo(xa, ya, xb, yb, x, y);
  41462. }
  41463. x += stack.shift();
  41464. y += stack.shift();
  41465. lineTo(x, y);
  41466. break;
  41467. case 25:
  41468. while (stack.length > 6) {
  41469. x += stack.shift();
  41470. y += stack.shift();
  41471. lineTo(x, y);
  41472. }
  41473. xa = x + stack.shift();
  41474. ya = y + stack.shift();
  41475. xb = xa + stack.shift();
  41476. yb = ya + stack.shift();
  41477. x = xb + stack.shift();
  41478. y = yb + stack.shift();
  41479. bezierCurveTo(xa, ya, xb, yb, x, y);
  41480. break;
  41481. case 26:
  41482. if (stack.length % 2) {
  41483. x += stack.shift();
  41484. }
  41485. while (stack.length > 0) {
  41486. xa = x;
  41487. ya = y + stack.shift();
  41488. xb = xa + stack.shift();
  41489. yb = ya + stack.shift();
  41490. x = xb;
  41491. y = yb + stack.shift();
  41492. bezierCurveTo(xa, ya, xb, yb, x, y);
  41493. }
  41494. break;
  41495. case 27:
  41496. if (stack.length % 2) {
  41497. y += stack.shift();
  41498. }
  41499. while (stack.length > 0) {
  41500. xa = x + stack.shift();
  41501. ya = y;
  41502. xb = xa + stack.shift();
  41503. yb = ya + stack.shift();
  41504. x = xb + stack.shift();
  41505. y = yb;
  41506. bezierCurveTo(xa, ya, xb, yb, x, y);
  41507. }
  41508. break;
  41509. case 28:
  41510. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  41511. i += 2;
  41512. break;
  41513. case 29:
  41514. n = stack.pop() + font.gsubrsBias;
  41515. subrCode = font.gsubrs[n];
  41516. if (subrCode) {
  41517. parse(subrCode);
  41518. }
  41519. break;
  41520. case 30:
  41521. while (stack.length > 0) {
  41522. xa = x;
  41523. ya = y + stack.shift();
  41524. xb = xa + stack.shift();
  41525. yb = ya + stack.shift();
  41526. x = xb + stack.shift();
  41527. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41528. bezierCurveTo(xa, ya, xb, yb, x, y);
  41529. if (stack.length === 0) {
  41530. break;
  41531. }
  41532. xa = x + stack.shift();
  41533. ya = y;
  41534. xb = xa + stack.shift();
  41535. yb = ya + stack.shift();
  41536. y = yb + stack.shift();
  41537. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41538. bezierCurveTo(xa, ya, xb, yb, x, y);
  41539. }
  41540. break;
  41541. case 31:
  41542. while (stack.length > 0) {
  41543. xa = x + stack.shift();
  41544. ya = y;
  41545. xb = xa + stack.shift();
  41546. yb = ya + stack.shift();
  41547. y = yb + stack.shift();
  41548. x = xb + (stack.length === 1 ? stack.shift() : 0);
  41549. bezierCurveTo(xa, ya, xb, yb, x, y);
  41550. if (stack.length === 0) {
  41551. break;
  41552. }
  41553. xa = x;
  41554. ya = y + stack.shift();
  41555. xb = xa + stack.shift();
  41556. yb = ya + stack.shift();
  41557. x = xb + stack.shift();
  41558. y = yb + (stack.length === 1 ? stack.shift() : 0);
  41559. bezierCurveTo(xa, ya, xb, yb, x, y);
  41560. }
  41561. break;
  41562. default:
  41563. if (v < 32) {
  41564. throw new _util.FormatError(`unknown operator: ${v}`);
  41565. }
  41566. if (v < 247) {
  41567. stack.push(v - 139);
  41568. } else if (v < 251) {
  41569. stack.push((v - 247) * 256 + code[i++] + 108);
  41570. } else if (v < 255) {
  41571. stack.push(-(v - 251) * 256 - code[i++] - 108);
  41572. } else {
  41573. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  41574. i += 4;
  41575. }
  41576. break;
  41577. }
  41578. if (stackClean) {
  41579. stack.length = 0;
  41580. }
  41581. }
  41582. }
  41583. parse(charStringCode);
  41584. }
  41585. const NOOP = [];
  41586. class CompiledFont {
  41587. constructor(fontMatrix) {
  41588. if (this.constructor === CompiledFont) {
  41589. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  41590. }
  41591. this.fontMatrix = fontMatrix;
  41592. this.compiledGlyphs = Object.create(null);
  41593. this.compiledCharCodeToGlyphId = Object.create(null);
  41594. }
  41595. getPathJs(unicode) {
  41596. const {
  41597. charCode,
  41598. glyphId
  41599. } = lookupCmap(this.cmap, unicode);
  41600. let fn = this.compiledGlyphs[glyphId];
  41601. if (!fn) {
  41602. try {
  41603. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  41604. this.compiledGlyphs[glyphId] = fn;
  41605. } catch (ex) {
  41606. this.compiledGlyphs[glyphId] = NOOP;
  41607. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  41608. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  41609. }
  41610. throw ex;
  41611. }
  41612. }
  41613. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  41614. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  41615. }
  41616. return fn;
  41617. }
  41618. compileGlyph(code, glyphId) {
  41619. if (!code || code.length === 0 || code[0] === 14) {
  41620. return NOOP;
  41621. }
  41622. let fontMatrix = this.fontMatrix;
  41623. if (this.isCFFCIDFont) {
  41624. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  41625. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  41626. const fontDict = this.fdArray[fdIndex];
  41627. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  41628. } else {
  41629. (0, _util.warn)("Invalid fd index for glyph index.");
  41630. }
  41631. }
  41632. const cmds = [{
  41633. cmd: "save"
  41634. }, {
  41635. cmd: "transform",
  41636. args: fontMatrix.slice()
  41637. }, {
  41638. cmd: "scale",
  41639. args: ["size", "-size"]
  41640. }];
  41641. this.compileGlyphImpl(code, cmds, glyphId);
  41642. cmds.push({
  41643. cmd: "restore"
  41644. });
  41645. return cmds;
  41646. }
  41647. compileGlyphImpl() {
  41648. (0, _util.unreachable)("Children classes should implement this.");
  41649. }
  41650. hasBuiltPath(unicode) {
  41651. const {
  41652. charCode,
  41653. glyphId
  41654. } = lookupCmap(this.cmap, unicode);
  41655. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  41656. }
  41657. }
  41658. class TrueTypeCompiled extends CompiledFont {
  41659. constructor(glyphs, cmap, fontMatrix) {
  41660. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  41661. this.glyphs = glyphs;
  41662. this.cmap = cmap;
  41663. }
  41664. compileGlyphImpl(code, cmds) {
  41665. compileGlyf(code, cmds, this);
  41666. }
  41667. }
  41668. class Type2Compiled extends CompiledFont {
  41669. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  41670. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  41671. this.glyphs = cffInfo.glyphs;
  41672. this.gsubrs = cffInfo.gsubrs || [];
  41673. this.subrs = cffInfo.subrs || [];
  41674. this.cmap = cmap;
  41675. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  41676. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  41677. this.subrsBias = getSubroutineBias(this.subrs);
  41678. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  41679. this.fdSelect = cffInfo.fdSelect;
  41680. this.fdArray = cffInfo.fdArray;
  41681. }
  41682. compileGlyphImpl(code, cmds, glyphId) {
  41683. compileCharString(code, cmds, this, glyphId);
  41684. }
  41685. }
  41686. class FontRendererFactory {
  41687. static create(font, seacAnalysisEnabled) {
  41688. const data = new Uint8Array(font.data);
  41689. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  41690. const numTables = getUint16(data, 4);
  41691. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  41692. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  41693. const offset = getUint32(data, p + 8);
  41694. const length = getUint32(data, p + 12);
  41695. switch (tag) {
  41696. case "cmap":
  41697. cmap = parseCmap(data, offset, offset + length);
  41698. break;
  41699. case "glyf":
  41700. glyf = data.subarray(offset, offset + length);
  41701. break;
  41702. case "loca":
  41703. loca = data.subarray(offset, offset + length);
  41704. break;
  41705. case "head":
  41706. unitsPerEm = getUint16(data, offset + 18);
  41707. indexToLocFormat = getUint16(data, offset + 50);
  41708. break;
  41709. case "CFF ":
  41710. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  41711. break;
  41712. }
  41713. }
  41714. if (glyf) {
  41715. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  41716. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  41717. }
  41718. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  41719. }
  41720. }
  41721. exports.FontRendererFactory = FontRendererFactory;
  41722. /***/ }),
  41723. /* 174 */
  41724. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41725. "use strict";
  41726. Object.defineProperty(exports, "__esModule", ({
  41727. value: true
  41728. }));
  41729. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  41730. var _core_utils = __w_pdfjs_require__(135);
  41731. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41732. t.Courier = 600;
  41733. t["Courier-Bold"] = 600;
  41734. t["Courier-BoldOblique"] = 600;
  41735. t["Courier-Oblique"] = 600;
  41736. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  41737. t.space = 278;
  41738. t.exclam = 278;
  41739. t.quotedbl = 355;
  41740. t.numbersign = 556;
  41741. t.dollar = 556;
  41742. t.percent = 889;
  41743. t.ampersand = 667;
  41744. t.quoteright = 222;
  41745. t.parenleft = 333;
  41746. t.parenright = 333;
  41747. t.asterisk = 389;
  41748. t.plus = 584;
  41749. t.comma = 278;
  41750. t.hyphen = 333;
  41751. t.period = 278;
  41752. t.slash = 278;
  41753. t.zero = 556;
  41754. t.one = 556;
  41755. t.two = 556;
  41756. t.three = 556;
  41757. t.four = 556;
  41758. t.five = 556;
  41759. t.six = 556;
  41760. t.seven = 556;
  41761. t.eight = 556;
  41762. t.nine = 556;
  41763. t.colon = 278;
  41764. t.semicolon = 278;
  41765. t.less = 584;
  41766. t.equal = 584;
  41767. t.greater = 584;
  41768. t.question = 556;
  41769. t.at = 1015;
  41770. t.A = 667;
  41771. t.B = 667;
  41772. t.C = 722;
  41773. t.D = 722;
  41774. t.E = 667;
  41775. t.F = 611;
  41776. t.G = 778;
  41777. t.H = 722;
  41778. t.I = 278;
  41779. t.J = 500;
  41780. t.K = 667;
  41781. t.L = 556;
  41782. t.M = 833;
  41783. t.N = 722;
  41784. t.O = 778;
  41785. t.P = 667;
  41786. t.Q = 778;
  41787. t.R = 722;
  41788. t.S = 667;
  41789. t.T = 611;
  41790. t.U = 722;
  41791. t.V = 667;
  41792. t.W = 944;
  41793. t.X = 667;
  41794. t.Y = 667;
  41795. t.Z = 611;
  41796. t.bracketleft = 278;
  41797. t.backslash = 278;
  41798. t.bracketright = 278;
  41799. t.asciicircum = 469;
  41800. t.underscore = 556;
  41801. t.quoteleft = 222;
  41802. t.a = 556;
  41803. t.b = 556;
  41804. t.c = 500;
  41805. t.d = 556;
  41806. t.e = 556;
  41807. t.f = 278;
  41808. t.g = 556;
  41809. t.h = 556;
  41810. t.i = 222;
  41811. t.j = 222;
  41812. t.k = 500;
  41813. t.l = 222;
  41814. t.m = 833;
  41815. t.n = 556;
  41816. t.o = 556;
  41817. t.p = 556;
  41818. t.q = 556;
  41819. t.r = 333;
  41820. t.s = 500;
  41821. t.t = 278;
  41822. t.u = 556;
  41823. t.v = 500;
  41824. t.w = 722;
  41825. t.x = 500;
  41826. t.y = 500;
  41827. t.z = 500;
  41828. t.braceleft = 334;
  41829. t.bar = 260;
  41830. t.braceright = 334;
  41831. t.asciitilde = 584;
  41832. t.exclamdown = 333;
  41833. t.cent = 556;
  41834. t.sterling = 556;
  41835. t.fraction = 167;
  41836. t.yen = 556;
  41837. t.florin = 556;
  41838. t.section = 556;
  41839. t.currency = 556;
  41840. t.quotesingle = 191;
  41841. t.quotedblleft = 333;
  41842. t.guillemotleft = 556;
  41843. t.guilsinglleft = 333;
  41844. t.guilsinglright = 333;
  41845. t.fi = 500;
  41846. t.fl = 500;
  41847. t.endash = 556;
  41848. t.dagger = 556;
  41849. t.daggerdbl = 556;
  41850. t.periodcentered = 278;
  41851. t.paragraph = 537;
  41852. t.bullet = 350;
  41853. t.quotesinglbase = 222;
  41854. t.quotedblbase = 333;
  41855. t.quotedblright = 333;
  41856. t.guillemotright = 556;
  41857. t.ellipsis = 1000;
  41858. t.perthousand = 1000;
  41859. t.questiondown = 611;
  41860. t.grave = 333;
  41861. t.acute = 333;
  41862. t.circumflex = 333;
  41863. t.tilde = 333;
  41864. t.macron = 333;
  41865. t.breve = 333;
  41866. t.dotaccent = 333;
  41867. t.dieresis = 333;
  41868. t.ring = 333;
  41869. t.cedilla = 333;
  41870. t.hungarumlaut = 333;
  41871. t.ogonek = 333;
  41872. t.caron = 333;
  41873. t.emdash = 1000;
  41874. t.AE = 1000;
  41875. t.ordfeminine = 370;
  41876. t.Lslash = 556;
  41877. t.Oslash = 778;
  41878. t.OE = 1000;
  41879. t.ordmasculine = 365;
  41880. t.ae = 889;
  41881. t.dotlessi = 278;
  41882. t.lslash = 222;
  41883. t.oslash = 611;
  41884. t.oe = 944;
  41885. t.germandbls = 611;
  41886. t.Idieresis = 278;
  41887. t.eacute = 556;
  41888. t.abreve = 556;
  41889. t.uhungarumlaut = 556;
  41890. t.ecaron = 556;
  41891. t.Ydieresis = 667;
  41892. t.divide = 584;
  41893. t.Yacute = 667;
  41894. t.Acircumflex = 667;
  41895. t.aacute = 556;
  41896. t.Ucircumflex = 722;
  41897. t.yacute = 500;
  41898. t.scommaaccent = 500;
  41899. t.ecircumflex = 556;
  41900. t.Uring = 722;
  41901. t.Udieresis = 722;
  41902. t.aogonek = 556;
  41903. t.Uacute = 722;
  41904. t.uogonek = 556;
  41905. t.Edieresis = 667;
  41906. t.Dcroat = 722;
  41907. t.commaaccent = 250;
  41908. t.copyright = 737;
  41909. t.Emacron = 667;
  41910. t.ccaron = 500;
  41911. t.aring = 556;
  41912. t.Ncommaaccent = 722;
  41913. t.lacute = 222;
  41914. t.agrave = 556;
  41915. t.Tcommaaccent = 611;
  41916. t.Cacute = 722;
  41917. t.atilde = 556;
  41918. t.Edotaccent = 667;
  41919. t.scaron = 500;
  41920. t.scedilla = 500;
  41921. t.iacute = 278;
  41922. t.lozenge = 471;
  41923. t.Rcaron = 722;
  41924. t.Gcommaaccent = 778;
  41925. t.ucircumflex = 556;
  41926. t.acircumflex = 556;
  41927. t.Amacron = 667;
  41928. t.rcaron = 333;
  41929. t.ccedilla = 500;
  41930. t.Zdotaccent = 611;
  41931. t.Thorn = 667;
  41932. t.Omacron = 778;
  41933. t.Racute = 722;
  41934. t.Sacute = 667;
  41935. t.dcaron = 643;
  41936. t.Umacron = 722;
  41937. t.uring = 556;
  41938. t.threesuperior = 333;
  41939. t.Ograve = 778;
  41940. t.Agrave = 667;
  41941. t.Abreve = 667;
  41942. t.multiply = 584;
  41943. t.uacute = 556;
  41944. t.Tcaron = 611;
  41945. t.partialdiff = 476;
  41946. t.ydieresis = 500;
  41947. t.Nacute = 722;
  41948. t.icircumflex = 278;
  41949. t.Ecircumflex = 667;
  41950. t.adieresis = 556;
  41951. t.edieresis = 556;
  41952. t.cacute = 500;
  41953. t.nacute = 556;
  41954. t.umacron = 556;
  41955. t.Ncaron = 722;
  41956. t.Iacute = 278;
  41957. t.plusminus = 584;
  41958. t.brokenbar = 260;
  41959. t.registered = 737;
  41960. t.Gbreve = 778;
  41961. t.Idotaccent = 278;
  41962. t.summation = 600;
  41963. t.Egrave = 667;
  41964. t.racute = 333;
  41965. t.omacron = 556;
  41966. t.Zacute = 611;
  41967. t.Zcaron = 611;
  41968. t.greaterequal = 549;
  41969. t.Eth = 722;
  41970. t.Ccedilla = 722;
  41971. t.lcommaaccent = 222;
  41972. t.tcaron = 317;
  41973. t.eogonek = 556;
  41974. t.Uogonek = 722;
  41975. t.Aacute = 667;
  41976. t.Adieresis = 667;
  41977. t.egrave = 556;
  41978. t.zacute = 500;
  41979. t.iogonek = 222;
  41980. t.Oacute = 778;
  41981. t.oacute = 556;
  41982. t.amacron = 556;
  41983. t.sacute = 500;
  41984. t.idieresis = 278;
  41985. t.Ocircumflex = 778;
  41986. t.Ugrave = 722;
  41987. t.Delta = 612;
  41988. t.thorn = 556;
  41989. t.twosuperior = 333;
  41990. t.Odieresis = 778;
  41991. t.mu = 556;
  41992. t.igrave = 278;
  41993. t.ohungarumlaut = 556;
  41994. t.Eogonek = 667;
  41995. t.dcroat = 556;
  41996. t.threequarters = 834;
  41997. t.Scedilla = 667;
  41998. t.lcaron = 299;
  41999. t.Kcommaaccent = 667;
  42000. t.Lacute = 556;
  42001. t.trademark = 1000;
  42002. t.edotaccent = 556;
  42003. t.Igrave = 278;
  42004. t.Imacron = 278;
  42005. t.Lcaron = 556;
  42006. t.onehalf = 834;
  42007. t.lessequal = 549;
  42008. t.ocircumflex = 556;
  42009. t.ntilde = 556;
  42010. t.Uhungarumlaut = 722;
  42011. t.Eacute = 667;
  42012. t.emacron = 556;
  42013. t.gbreve = 556;
  42014. t.onequarter = 834;
  42015. t.Scaron = 667;
  42016. t.Scommaaccent = 667;
  42017. t.Ohungarumlaut = 778;
  42018. t.degree = 400;
  42019. t.ograve = 556;
  42020. t.Ccaron = 722;
  42021. t.ugrave = 556;
  42022. t.radical = 453;
  42023. t.Dcaron = 722;
  42024. t.rcommaaccent = 333;
  42025. t.Ntilde = 722;
  42026. t.otilde = 556;
  42027. t.Rcommaaccent = 722;
  42028. t.Lcommaaccent = 556;
  42029. t.Atilde = 667;
  42030. t.Aogonek = 667;
  42031. t.Aring = 667;
  42032. t.Otilde = 778;
  42033. t.zdotaccent = 500;
  42034. t.Ecaron = 667;
  42035. t.Iogonek = 278;
  42036. t.kcommaaccent = 500;
  42037. t.minus = 584;
  42038. t.Icircumflex = 278;
  42039. t.ncaron = 556;
  42040. t.tcommaaccent = 278;
  42041. t.logicalnot = 584;
  42042. t.odieresis = 556;
  42043. t.udieresis = 556;
  42044. t.notequal = 549;
  42045. t.gcommaaccent = 556;
  42046. t.eth = 556;
  42047. t.zcaron = 500;
  42048. t.ncommaaccent = 556;
  42049. t.onesuperior = 333;
  42050. t.imacron = 278;
  42051. t.Euro = 556;
  42052. });
  42053. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42054. t.space = 278;
  42055. t.exclam = 333;
  42056. t.quotedbl = 474;
  42057. t.numbersign = 556;
  42058. t.dollar = 556;
  42059. t.percent = 889;
  42060. t.ampersand = 722;
  42061. t.quoteright = 278;
  42062. t.parenleft = 333;
  42063. t.parenright = 333;
  42064. t.asterisk = 389;
  42065. t.plus = 584;
  42066. t.comma = 278;
  42067. t.hyphen = 333;
  42068. t.period = 278;
  42069. t.slash = 278;
  42070. t.zero = 556;
  42071. t.one = 556;
  42072. t.two = 556;
  42073. t.three = 556;
  42074. t.four = 556;
  42075. t.five = 556;
  42076. t.six = 556;
  42077. t.seven = 556;
  42078. t.eight = 556;
  42079. t.nine = 556;
  42080. t.colon = 333;
  42081. t.semicolon = 333;
  42082. t.less = 584;
  42083. t.equal = 584;
  42084. t.greater = 584;
  42085. t.question = 611;
  42086. t.at = 975;
  42087. t.A = 722;
  42088. t.B = 722;
  42089. t.C = 722;
  42090. t.D = 722;
  42091. t.E = 667;
  42092. t.F = 611;
  42093. t.G = 778;
  42094. t.H = 722;
  42095. t.I = 278;
  42096. t.J = 556;
  42097. t.K = 722;
  42098. t.L = 611;
  42099. t.M = 833;
  42100. t.N = 722;
  42101. t.O = 778;
  42102. t.P = 667;
  42103. t.Q = 778;
  42104. t.R = 722;
  42105. t.S = 667;
  42106. t.T = 611;
  42107. t.U = 722;
  42108. t.V = 667;
  42109. t.W = 944;
  42110. t.X = 667;
  42111. t.Y = 667;
  42112. t.Z = 611;
  42113. t.bracketleft = 333;
  42114. t.backslash = 278;
  42115. t.bracketright = 333;
  42116. t.asciicircum = 584;
  42117. t.underscore = 556;
  42118. t.quoteleft = 278;
  42119. t.a = 556;
  42120. t.b = 611;
  42121. t.c = 556;
  42122. t.d = 611;
  42123. t.e = 556;
  42124. t.f = 333;
  42125. t.g = 611;
  42126. t.h = 611;
  42127. t.i = 278;
  42128. t.j = 278;
  42129. t.k = 556;
  42130. t.l = 278;
  42131. t.m = 889;
  42132. t.n = 611;
  42133. t.o = 611;
  42134. t.p = 611;
  42135. t.q = 611;
  42136. t.r = 389;
  42137. t.s = 556;
  42138. t.t = 333;
  42139. t.u = 611;
  42140. t.v = 556;
  42141. t.w = 778;
  42142. t.x = 556;
  42143. t.y = 556;
  42144. t.z = 500;
  42145. t.braceleft = 389;
  42146. t.bar = 280;
  42147. t.braceright = 389;
  42148. t.asciitilde = 584;
  42149. t.exclamdown = 333;
  42150. t.cent = 556;
  42151. t.sterling = 556;
  42152. t.fraction = 167;
  42153. t.yen = 556;
  42154. t.florin = 556;
  42155. t.section = 556;
  42156. t.currency = 556;
  42157. t.quotesingle = 238;
  42158. t.quotedblleft = 500;
  42159. t.guillemotleft = 556;
  42160. t.guilsinglleft = 333;
  42161. t.guilsinglright = 333;
  42162. t.fi = 611;
  42163. t.fl = 611;
  42164. t.endash = 556;
  42165. t.dagger = 556;
  42166. t.daggerdbl = 556;
  42167. t.periodcentered = 278;
  42168. t.paragraph = 556;
  42169. t.bullet = 350;
  42170. t.quotesinglbase = 278;
  42171. t.quotedblbase = 500;
  42172. t.quotedblright = 500;
  42173. t.guillemotright = 556;
  42174. t.ellipsis = 1000;
  42175. t.perthousand = 1000;
  42176. t.questiondown = 611;
  42177. t.grave = 333;
  42178. t.acute = 333;
  42179. t.circumflex = 333;
  42180. t.tilde = 333;
  42181. t.macron = 333;
  42182. t.breve = 333;
  42183. t.dotaccent = 333;
  42184. t.dieresis = 333;
  42185. t.ring = 333;
  42186. t.cedilla = 333;
  42187. t.hungarumlaut = 333;
  42188. t.ogonek = 333;
  42189. t.caron = 333;
  42190. t.emdash = 1000;
  42191. t.AE = 1000;
  42192. t.ordfeminine = 370;
  42193. t.Lslash = 611;
  42194. t.Oslash = 778;
  42195. t.OE = 1000;
  42196. t.ordmasculine = 365;
  42197. t.ae = 889;
  42198. t.dotlessi = 278;
  42199. t.lslash = 278;
  42200. t.oslash = 611;
  42201. t.oe = 944;
  42202. t.germandbls = 611;
  42203. t.Idieresis = 278;
  42204. t.eacute = 556;
  42205. t.abreve = 556;
  42206. t.uhungarumlaut = 611;
  42207. t.ecaron = 556;
  42208. t.Ydieresis = 667;
  42209. t.divide = 584;
  42210. t.Yacute = 667;
  42211. t.Acircumflex = 722;
  42212. t.aacute = 556;
  42213. t.Ucircumflex = 722;
  42214. t.yacute = 556;
  42215. t.scommaaccent = 556;
  42216. t.ecircumflex = 556;
  42217. t.Uring = 722;
  42218. t.Udieresis = 722;
  42219. t.aogonek = 556;
  42220. t.Uacute = 722;
  42221. t.uogonek = 611;
  42222. t.Edieresis = 667;
  42223. t.Dcroat = 722;
  42224. t.commaaccent = 250;
  42225. t.copyright = 737;
  42226. t.Emacron = 667;
  42227. t.ccaron = 556;
  42228. t.aring = 556;
  42229. t.Ncommaaccent = 722;
  42230. t.lacute = 278;
  42231. t.agrave = 556;
  42232. t.Tcommaaccent = 611;
  42233. t.Cacute = 722;
  42234. t.atilde = 556;
  42235. t.Edotaccent = 667;
  42236. t.scaron = 556;
  42237. t.scedilla = 556;
  42238. t.iacute = 278;
  42239. t.lozenge = 494;
  42240. t.Rcaron = 722;
  42241. t.Gcommaaccent = 778;
  42242. t.ucircumflex = 611;
  42243. t.acircumflex = 556;
  42244. t.Amacron = 722;
  42245. t.rcaron = 389;
  42246. t.ccedilla = 556;
  42247. t.Zdotaccent = 611;
  42248. t.Thorn = 667;
  42249. t.Omacron = 778;
  42250. t.Racute = 722;
  42251. t.Sacute = 667;
  42252. t.dcaron = 743;
  42253. t.Umacron = 722;
  42254. t.uring = 611;
  42255. t.threesuperior = 333;
  42256. t.Ograve = 778;
  42257. t.Agrave = 722;
  42258. t.Abreve = 722;
  42259. t.multiply = 584;
  42260. t.uacute = 611;
  42261. t.Tcaron = 611;
  42262. t.partialdiff = 494;
  42263. t.ydieresis = 556;
  42264. t.Nacute = 722;
  42265. t.icircumflex = 278;
  42266. t.Ecircumflex = 667;
  42267. t.adieresis = 556;
  42268. t.edieresis = 556;
  42269. t.cacute = 556;
  42270. t.nacute = 611;
  42271. t.umacron = 611;
  42272. t.Ncaron = 722;
  42273. t.Iacute = 278;
  42274. t.plusminus = 584;
  42275. t.brokenbar = 280;
  42276. t.registered = 737;
  42277. t.Gbreve = 778;
  42278. t.Idotaccent = 278;
  42279. t.summation = 600;
  42280. t.Egrave = 667;
  42281. t.racute = 389;
  42282. t.omacron = 611;
  42283. t.Zacute = 611;
  42284. t.Zcaron = 611;
  42285. t.greaterequal = 549;
  42286. t.Eth = 722;
  42287. t.Ccedilla = 722;
  42288. t.lcommaaccent = 278;
  42289. t.tcaron = 389;
  42290. t.eogonek = 556;
  42291. t.Uogonek = 722;
  42292. t.Aacute = 722;
  42293. t.Adieresis = 722;
  42294. t.egrave = 556;
  42295. t.zacute = 500;
  42296. t.iogonek = 278;
  42297. t.Oacute = 778;
  42298. t.oacute = 611;
  42299. t.amacron = 556;
  42300. t.sacute = 556;
  42301. t.idieresis = 278;
  42302. t.Ocircumflex = 778;
  42303. t.Ugrave = 722;
  42304. t.Delta = 612;
  42305. t.thorn = 611;
  42306. t.twosuperior = 333;
  42307. t.Odieresis = 778;
  42308. t.mu = 611;
  42309. t.igrave = 278;
  42310. t.ohungarumlaut = 611;
  42311. t.Eogonek = 667;
  42312. t.dcroat = 611;
  42313. t.threequarters = 834;
  42314. t.Scedilla = 667;
  42315. t.lcaron = 400;
  42316. t.Kcommaaccent = 722;
  42317. t.Lacute = 611;
  42318. t.trademark = 1000;
  42319. t.edotaccent = 556;
  42320. t.Igrave = 278;
  42321. t.Imacron = 278;
  42322. t.Lcaron = 611;
  42323. t.onehalf = 834;
  42324. t.lessequal = 549;
  42325. t.ocircumflex = 611;
  42326. t.ntilde = 611;
  42327. t.Uhungarumlaut = 722;
  42328. t.Eacute = 667;
  42329. t.emacron = 556;
  42330. t.gbreve = 611;
  42331. t.onequarter = 834;
  42332. t.Scaron = 667;
  42333. t.Scommaaccent = 667;
  42334. t.Ohungarumlaut = 778;
  42335. t.degree = 400;
  42336. t.ograve = 611;
  42337. t.Ccaron = 722;
  42338. t.ugrave = 611;
  42339. t.radical = 549;
  42340. t.Dcaron = 722;
  42341. t.rcommaaccent = 389;
  42342. t.Ntilde = 722;
  42343. t.otilde = 611;
  42344. t.Rcommaaccent = 722;
  42345. t.Lcommaaccent = 611;
  42346. t.Atilde = 722;
  42347. t.Aogonek = 722;
  42348. t.Aring = 722;
  42349. t.Otilde = 778;
  42350. t.zdotaccent = 500;
  42351. t.Ecaron = 667;
  42352. t.Iogonek = 278;
  42353. t.kcommaaccent = 556;
  42354. t.minus = 584;
  42355. t.Icircumflex = 278;
  42356. t.ncaron = 611;
  42357. t.tcommaaccent = 333;
  42358. t.logicalnot = 584;
  42359. t.odieresis = 611;
  42360. t.udieresis = 611;
  42361. t.notequal = 549;
  42362. t.gcommaaccent = 611;
  42363. t.eth = 611;
  42364. t.zcaron = 500;
  42365. t.ncommaaccent = 611;
  42366. t.onesuperior = 333;
  42367. t.imacron = 278;
  42368. t.Euro = 556;
  42369. });
  42370. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42371. t.space = 278;
  42372. t.exclam = 333;
  42373. t.quotedbl = 474;
  42374. t.numbersign = 556;
  42375. t.dollar = 556;
  42376. t.percent = 889;
  42377. t.ampersand = 722;
  42378. t.quoteright = 278;
  42379. t.parenleft = 333;
  42380. t.parenright = 333;
  42381. t.asterisk = 389;
  42382. t.plus = 584;
  42383. t.comma = 278;
  42384. t.hyphen = 333;
  42385. t.period = 278;
  42386. t.slash = 278;
  42387. t.zero = 556;
  42388. t.one = 556;
  42389. t.two = 556;
  42390. t.three = 556;
  42391. t.four = 556;
  42392. t.five = 556;
  42393. t.six = 556;
  42394. t.seven = 556;
  42395. t.eight = 556;
  42396. t.nine = 556;
  42397. t.colon = 333;
  42398. t.semicolon = 333;
  42399. t.less = 584;
  42400. t.equal = 584;
  42401. t.greater = 584;
  42402. t.question = 611;
  42403. t.at = 975;
  42404. t.A = 722;
  42405. t.B = 722;
  42406. t.C = 722;
  42407. t.D = 722;
  42408. t.E = 667;
  42409. t.F = 611;
  42410. t.G = 778;
  42411. t.H = 722;
  42412. t.I = 278;
  42413. t.J = 556;
  42414. t.K = 722;
  42415. t.L = 611;
  42416. t.M = 833;
  42417. t.N = 722;
  42418. t.O = 778;
  42419. t.P = 667;
  42420. t.Q = 778;
  42421. t.R = 722;
  42422. t.S = 667;
  42423. t.T = 611;
  42424. t.U = 722;
  42425. t.V = 667;
  42426. t.W = 944;
  42427. t.X = 667;
  42428. t.Y = 667;
  42429. t.Z = 611;
  42430. t.bracketleft = 333;
  42431. t.backslash = 278;
  42432. t.bracketright = 333;
  42433. t.asciicircum = 584;
  42434. t.underscore = 556;
  42435. t.quoteleft = 278;
  42436. t.a = 556;
  42437. t.b = 611;
  42438. t.c = 556;
  42439. t.d = 611;
  42440. t.e = 556;
  42441. t.f = 333;
  42442. t.g = 611;
  42443. t.h = 611;
  42444. t.i = 278;
  42445. t.j = 278;
  42446. t.k = 556;
  42447. t.l = 278;
  42448. t.m = 889;
  42449. t.n = 611;
  42450. t.o = 611;
  42451. t.p = 611;
  42452. t.q = 611;
  42453. t.r = 389;
  42454. t.s = 556;
  42455. t.t = 333;
  42456. t.u = 611;
  42457. t.v = 556;
  42458. t.w = 778;
  42459. t.x = 556;
  42460. t.y = 556;
  42461. t.z = 500;
  42462. t.braceleft = 389;
  42463. t.bar = 280;
  42464. t.braceright = 389;
  42465. t.asciitilde = 584;
  42466. t.exclamdown = 333;
  42467. t.cent = 556;
  42468. t.sterling = 556;
  42469. t.fraction = 167;
  42470. t.yen = 556;
  42471. t.florin = 556;
  42472. t.section = 556;
  42473. t.currency = 556;
  42474. t.quotesingle = 238;
  42475. t.quotedblleft = 500;
  42476. t.guillemotleft = 556;
  42477. t.guilsinglleft = 333;
  42478. t.guilsinglright = 333;
  42479. t.fi = 611;
  42480. t.fl = 611;
  42481. t.endash = 556;
  42482. t.dagger = 556;
  42483. t.daggerdbl = 556;
  42484. t.periodcentered = 278;
  42485. t.paragraph = 556;
  42486. t.bullet = 350;
  42487. t.quotesinglbase = 278;
  42488. t.quotedblbase = 500;
  42489. t.quotedblright = 500;
  42490. t.guillemotright = 556;
  42491. t.ellipsis = 1000;
  42492. t.perthousand = 1000;
  42493. t.questiondown = 611;
  42494. t.grave = 333;
  42495. t.acute = 333;
  42496. t.circumflex = 333;
  42497. t.tilde = 333;
  42498. t.macron = 333;
  42499. t.breve = 333;
  42500. t.dotaccent = 333;
  42501. t.dieresis = 333;
  42502. t.ring = 333;
  42503. t.cedilla = 333;
  42504. t.hungarumlaut = 333;
  42505. t.ogonek = 333;
  42506. t.caron = 333;
  42507. t.emdash = 1000;
  42508. t.AE = 1000;
  42509. t.ordfeminine = 370;
  42510. t.Lslash = 611;
  42511. t.Oslash = 778;
  42512. t.OE = 1000;
  42513. t.ordmasculine = 365;
  42514. t.ae = 889;
  42515. t.dotlessi = 278;
  42516. t.lslash = 278;
  42517. t.oslash = 611;
  42518. t.oe = 944;
  42519. t.germandbls = 611;
  42520. t.Idieresis = 278;
  42521. t.eacute = 556;
  42522. t.abreve = 556;
  42523. t.uhungarumlaut = 611;
  42524. t.ecaron = 556;
  42525. t.Ydieresis = 667;
  42526. t.divide = 584;
  42527. t.Yacute = 667;
  42528. t.Acircumflex = 722;
  42529. t.aacute = 556;
  42530. t.Ucircumflex = 722;
  42531. t.yacute = 556;
  42532. t.scommaaccent = 556;
  42533. t.ecircumflex = 556;
  42534. t.Uring = 722;
  42535. t.Udieresis = 722;
  42536. t.aogonek = 556;
  42537. t.Uacute = 722;
  42538. t.uogonek = 611;
  42539. t.Edieresis = 667;
  42540. t.Dcroat = 722;
  42541. t.commaaccent = 250;
  42542. t.copyright = 737;
  42543. t.Emacron = 667;
  42544. t.ccaron = 556;
  42545. t.aring = 556;
  42546. t.Ncommaaccent = 722;
  42547. t.lacute = 278;
  42548. t.agrave = 556;
  42549. t.Tcommaaccent = 611;
  42550. t.Cacute = 722;
  42551. t.atilde = 556;
  42552. t.Edotaccent = 667;
  42553. t.scaron = 556;
  42554. t.scedilla = 556;
  42555. t.iacute = 278;
  42556. t.lozenge = 494;
  42557. t.Rcaron = 722;
  42558. t.Gcommaaccent = 778;
  42559. t.ucircumflex = 611;
  42560. t.acircumflex = 556;
  42561. t.Amacron = 722;
  42562. t.rcaron = 389;
  42563. t.ccedilla = 556;
  42564. t.Zdotaccent = 611;
  42565. t.Thorn = 667;
  42566. t.Omacron = 778;
  42567. t.Racute = 722;
  42568. t.Sacute = 667;
  42569. t.dcaron = 743;
  42570. t.Umacron = 722;
  42571. t.uring = 611;
  42572. t.threesuperior = 333;
  42573. t.Ograve = 778;
  42574. t.Agrave = 722;
  42575. t.Abreve = 722;
  42576. t.multiply = 584;
  42577. t.uacute = 611;
  42578. t.Tcaron = 611;
  42579. t.partialdiff = 494;
  42580. t.ydieresis = 556;
  42581. t.Nacute = 722;
  42582. t.icircumflex = 278;
  42583. t.Ecircumflex = 667;
  42584. t.adieresis = 556;
  42585. t.edieresis = 556;
  42586. t.cacute = 556;
  42587. t.nacute = 611;
  42588. t.umacron = 611;
  42589. t.Ncaron = 722;
  42590. t.Iacute = 278;
  42591. t.plusminus = 584;
  42592. t.brokenbar = 280;
  42593. t.registered = 737;
  42594. t.Gbreve = 778;
  42595. t.Idotaccent = 278;
  42596. t.summation = 600;
  42597. t.Egrave = 667;
  42598. t.racute = 389;
  42599. t.omacron = 611;
  42600. t.Zacute = 611;
  42601. t.Zcaron = 611;
  42602. t.greaterequal = 549;
  42603. t.Eth = 722;
  42604. t.Ccedilla = 722;
  42605. t.lcommaaccent = 278;
  42606. t.tcaron = 389;
  42607. t.eogonek = 556;
  42608. t.Uogonek = 722;
  42609. t.Aacute = 722;
  42610. t.Adieresis = 722;
  42611. t.egrave = 556;
  42612. t.zacute = 500;
  42613. t.iogonek = 278;
  42614. t.Oacute = 778;
  42615. t.oacute = 611;
  42616. t.amacron = 556;
  42617. t.sacute = 556;
  42618. t.idieresis = 278;
  42619. t.Ocircumflex = 778;
  42620. t.Ugrave = 722;
  42621. t.Delta = 612;
  42622. t.thorn = 611;
  42623. t.twosuperior = 333;
  42624. t.Odieresis = 778;
  42625. t.mu = 611;
  42626. t.igrave = 278;
  42627. t.ohungarumlaut = 611;
  42628. t.Eogonek = 667;
  42629. t.dcroat = 611;
  42630. t.threequarters = 834;
  42631. t.Scedilla = 667;
  42632. t.lcaron = 400;
  42633. t.Kcommaaccent = 722;
  42634. t.Lacute = 611;
  42635. t.trademark = 1000;
  42636. t.edotaccent = 556;
  42637. t.Igrave = 278;
  42638. t.Imacron = 278;
  42639. t.Lcaron = 611;
  42640. t.onehalf = 834;
  42641. t.lessequal = 549;
  42642. t.ocircumflex = 611;
  42643. t.ntilde = 611;
  42644. t.Uhungarumlaut = 722;
  42645. t.Eacute = 667;
  42646. t.emacron = 556;
  42647. t.gbreve = 611;
  42648. t.onequarter = 834;
  42649. t.Scaron = 667;
  42650. t.Scommaaccent = 667;
  42651. t.Ohungarumlaut = 778;
  42652. t.degree = 400;
  42653. t.ograve = 611;
  42654. t.Ccaron = 722;
  42655. t.ugrave = 611;
  42656. t.radical = 549;
  42657. t.Dcaron = 722;
  42658. t.rcommaaccent = 389;
  42659. t.Ntilde = 722;
  42660. t.otilde = 611;
  42661. t.Rcommaaccent = 722;
  42662. t.Lcommaaccent = 611;
  42663. t.Atilde = 722;
  42664. t.Aogonek = 722;
  42665. t.Aring = 722;
  42666. t.Otilde = 778;
  42667. t.zdotaccent = 500;
  42668. t.Ecaron = 667;
  42669. t.Iogonek = 278;
  42670. t.kcommaaccent = 556;
  42671. t.minus = 584;
  42672. t.Icircumflex = 278;
  42673. t.ncaron = 611;
  42674. t.tcommaaccent = 333;
  42675. t.logicalnot = 584;
  42676. t.odieresis = 611;
  42677. t.udieresis = 611;
  42678. t.notequal = 549;
  42679. t.gcommaaccent = 611;
  42680. t.eth = 611;
  42681. t.zcaron = 500;
  42682. t.ncommaaccent = 611;
  42683. t.onesuperior = 333;
  42684. t.imacron = 278;
  42685. t.Euro = 556;
  42686. });
  42687. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42688. t.space = 278;
  42689. t.exclam = 278;
  42690. t.quotedbl = 355;
  42691. t.numbersign = 556;
  42692. t.dollar = 556;
  42693. t.percent = 889;
  42694. t.ampersand = 667;
  42695. t.quoteright = 222;
  42696. t.parenleft = 333;
  42697. t.parenright = 333;
  42698. t.asterisk = 389;
  42699. t.plus = 584;
  42700. t.comma = 278;
  42701. t.hyphen = 333;
  42702. t.period = 278;
  42703. t.slash = 278;
  42704. t.zero = 556;
  42705. t.one = 556;
  42706. t.two = 556;
  42707. t.three = 556;
  42708. t.four = 556;
  42709. t.five = 556;
  42710. t.six = 556;
  42711. t.seven = 556;
  42712. t.eight = 556;
  42713. t.nine = 556;
  42714. t.colon = 278;
  42715. t.semicolon = 278;
  42716. t.less = 584;
  42717. t.equal = 584;
  42718. t.greater = 584;
  42719. t.question = 556;
  42720. t.at = 1015;
  42721. t.A = 667;
  42722. t.B = 667;
  42723. t.C = 722;
  42724. t.D = 722;
  42725. t.E = 667;
  42726. t.F = 611;
  42727. t.G = 778;
  42728. t.H = 722;
  42729. t.I = 278;
  42730. t.J = 500;
  42731. t.K = 667;
  42732. t.L = 556;
  42733. t.M = 833;
  42734. t.N = 722;
  42735. t.O = 778;
  42736. t.P = 667;
  42737. t.Q = 778;
  42738. t.R = 722;
  42739. t.S = 667;
  42740. t.T = 611;
  42741. t.U = 722;
  42742. t.V = 667;
  42743. t.W = 944;
  42744. t.X = 667;
  42745. t.Y = 667;
  42746. t.Z = 611;
  42747. t.bracketleft = 278;
  42748. t.backslash = 278;
  42749. t.bracketright = 278;
  42750. t.asciicircum = 469;
  42751. t.underscore = 556;
  42752. t.quoteleft = 222;
  42753. t.a = 556;
  42754. t.b = 556;
  42755. t.c = 500;
  42756. t.d = 556;
  42757. t.e = 556;
  42758. t.f = 278;
  42759. t.g = 556;
  42760. t.h = 556;
  42761. t.i = 222;
  42762. t.j = 222;
  42763. t.k = 500;
  42764. t.l = 222;
  42765. t.m = 833;
  42766. t.n = 556;
  42767. t.o = 556;
  42768. t.p = 556;
  42769. t.q = 556;
  42770. t.r = 333;
  42771. t.s = 500;
  42772. t.t = 278;
  42773. t.u = 556;
  42774. t.v = 500;
  42775. t.w = 722;
  42776. t.x = 500;
  42777. t.y = 500;
  42778. t.z = 500;
  42779. t.braceleft = 334;
  42780. t.bar = 260;
  42781. t.braceright = 334;
  42782. t.asciitilde = 584;
  42783. t.exclamdown = 333;
  42784. t.cent = 556;
  42785. t.sterling = 556;
  42786. t.fraction = 167;
  42787. t.yen = 556;
  42788. t.florin = 556;
  42789. t.section = 556;
  42790. t.currency = 556;
  42791. t.quotesingle = 191;
  42792. t.quotedblleft = 333;
  42793. t.guillemotleft = 556;
  42794. t.guilsinglleft = 333;
  42795. t.guilsinglright = 333;
  42796. t.fi = 500;
  42797. t.fl = 500;
  42798. t.endash = 556;
  42799. t.dagger = 556;
  42800. t.daggerdbl = 556;
  42801. t.periodcentered = 278;
  42802. t.paragraph = 537;
  42803. t.bullet = 350;
  42804. t.quotesinglbase = 222;
  42805. t.quotedblbase = 333;
  42806. t.quotedblright = 333;
  42807. t.guillemotright = 556;
  42808. t.ellipsis = 1000;
  42809. t.perthousand = 1000;
  42810. t.questiondown = 611;
  42811. t.grave = 333;
  42812. t.acute = 333;
  42813. t.circumflex = 333;
  42814. t.tilde = 333;
  42815. t.macron = 333;
  42816. t.breve = 333;
  42817. t.dotaccent = 333;
  42818. t.dieresis = 333;
  42819. t.ring = 333;
  42820. t.cedilla = 333;
  42821. t.hungarumlaut = 333;
  42822. t.ogonek = 333;
  42823. t.caron = 333;
  42824. t.emdash = 1000;
  42825. t.AE = 1000;
  42826. t.ordfeminine = 370;
  42827. t.Lslash = 556;
  42828. t.Oslash = 778;
  42829. t.OE = 1000;
  42830. t.ordmasculine = 365;
  42831. t.ae = 889;
  42832. t.dotlessi = 278;
  42833. t.lslash = 222;
  42834. t.oslash = 611;
  42835. t.oe = 944;
  42836. t.germandbls = 611;
  42837. t.Idieresis = 278;
  42838. t.eacute = 556;
  42839. t.abreve = 556;
  42840. t.uhungarumlaut = 556;
  42841. t.ecaron = 556;
  42842. t.Ydieresis = 667;
  42843. t.divide = 584;
  42844. t.Yacute = 667;
  42845. t.Acircumflex = 667;
  42846. t.aacute = 556;
  42847. t.Ucircumflex = 722;
  42848. t.yacute = 500;
  42849. t.scommaaccent = 500;
  42850. t.ecircumflex = 556;
  42851. t.Uring = 722;
  42852. t.Udieresis = 722;
  42853. t.aogonek = 556;
  42854. t.Uacute = 722;
  42855. t.uogonek = 556;
  42856. t.Edieresis = 667;
  42857. t.Dcroat = 722;
  42858. t.commaaccent = 250;
  42859. t.copyright = 737;
  42860. t.Emacron = 667;
  42861. t.ccaron = 500;
  42862. t.aring = 556;
  42863. t.Ncommaaccent = 722;
  42864. t.lacute = 222;
  42865. t.agrave = 556;
  42866. t.Tcommaaccent = 611;
  42867. t.Cacute = 722;
  42868. t.atilde = 556;
  42869. t.Edotaccent = 667;
  42870. t.scaron = 500;
  42871. t.scedilla = 500;
  42872. t.iacute = 278;
  42873. t.lozenge = 471;
  42874. t.Rcaron = 722;
  42875. t.Gcommaaccent = 778;
  42876. t.ucircumflex = 556;
  42877. t.acircumflex = 556;
  42878. t.Amacron = 667;
  42879. t.rcaron = 333;
  42880. t.ccedilla = 500;
  42881. t.Zdotaccent = 611;
  42882. t.Thorn = 667;
  42883. t.Omacron = 778;
  42884. t.Racute = 722;
  42885. t.Sacute = 667;
  42886. t.dcaron = 643;
  42887. t.Umacron = 722;
  42888. t.uring = 556;
  42889. t.threesuperior = 333;
  42890. t.Ograve = 778;
  42891. t.Agrave = 667;
  42892. t.Abreve = 667;
  42893. t.multiply = 584;
  42894. t.uacute = 556;
  42895. t.Tcaron = 611;
  42896. t.partialdiff = 476;
  42897. t.ydieresis = 500;
  42898. t.Nacute = 722;
  42899. t.icircumflex = 278;
  42900. t.Ecircumflex = 667;
  42901. t.adieresis = 556;
  42902. t.edieresis = 556;
  42903. t.cacute = 500;
  42904. t.nacute = 556;
  42905. t.umacron = 556;
  42906. t.Ncaron = 722;
  42907. t.Iacute = 278;
  42908. t.plusminus = 584;
  42909. t.brokenbar = 260;
  42910. t.registered = 737;
  42911. t.Gbreve = 778;
  42912. t.Idotaccent = 278;
  42913. t.summation = 600;
  42914. t.Egrave = 667;
  42915. t.racute = 333;
  42916. t.omacron = 556;
  42917. t.Zacute = 611;
  42918. t.Zcaron = 611;
  42919. t.greaterequal = 549;
  42920. t.Eth = 722;
  42921. t.Ccedilla = 722;
  42922. t.lcommaaccent = 222;
  42923. t.tcaron = 317;
  42924. t.eogonek = 556;
  42925. t.Uogonek = 722;
  42926. t.Aacute = 667;
  42927. t.Adieresis = 667;
  42928. t.egrave = 556;
  42929. t.zacute = 500;
  42930. t.iogonek = 222;
  42931. t.Oacute = 778;
  42932. t.oacute = 556;
  42933. t.amacron = 556;
  42934. t.sacute = 500;
  42935. t.idieresis = 278;
  42936. t.Ocircumflex = 778;
  42937. t.Ugrave = 722;
  42938. t.Delta = 612;
  42939. t.thorn = 556;
  42940. t.twosuperior = 333;
  42941. t.Odieresis = 778;
  42942. t.mu = 556;
  42943. t.igrave = 278;
  42944. t.ohungarumlaut = 556;
  42945. t.Eogonek = 667;
  42946. t.dcroat = 556;
  42947. t.threequarters = 834;
  42948. t.Scedilla = 667;
  42949. t.lcaron = 299;
  42950. t.Kcommaaccent = 667;
  42951. t.Lacute = 556;
  42952. t.trademark = 1000;
  42953. t.edotaccent = 556;
  42954. t.Igrave = 278;
  42955. t.Imacron = 278;
  42956. t.Lcaron = 556;
  42957. t.onehalf = 834;
  42958. t.lessequal = 549;
  42959. t.ocircumflex = 556;
  42960. t.ntilde = 556;
  42961. t.Uhungarumlaut = 722;
  42962. t.Eacute = 667;
  42963. t.emacron = 556;
  42964. t.gbreve = 556;
  42965. t.onequarter = 834;
  42966. t.Scaron = 667;
  42967. t.Scommaaccent = 667;
  42968. t.Ohungarumlaut = 778;
  42969. t.degree = 400;
  42970. t.ograve = 556;
  42971. t.Ccaron = 722;
  42972. t.ugrave = 556;
  42973. t.radical = 453;
  42974. t.Dcaron = 722;
  42975. t.rcommaaccent = 333;
  42976. t.Ntilde = 722;
  42977. t.otilde = 556;
  42978. t.Rcommaaccent = 722;
  42979. t.Lcommaaccent = 556;
  42980. t.Atilde = 667;
  42981. t.Aogonek = 667;
  42982. t.Aring = 667;
  42983. t.Otilde = 778;
  42984. t.zdotaccent = 500;
  42985. t.Ecaron = 667;
  42986. t.Iogonek = 278;
  42987. t.kcommaaccent = 500;
  42988. t.minus = 584;
  42989. t.Icircumflex = 278;
  42990. t.ncaron = 556;
  42991. t.tcommaaccent = 278;
  42992. t.logicalnot = 584;
  42993. t.odieresis = 556;
  42994. t.udieresis = 556;
  42995. t.notequal = 549;
  42996. t.gcommaaccent = 556;
  42997. t.eth = 556;
  42998. t.zcaron = 500;
  42999. t.ncommaaccent = 556;
  43000. t.onesuperior = 333;
  43001. t.imacron = 278;
  43002. t.Euro = 556;
  43003. });
  43004. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  43005. t.space = 250;
  43006. t.exclam = 333;
  43007. t.universal = 713;
  43008. t.numbersign = 500;
  43009. t.existential = 549;
  43010. t.percent = 833;
  43011. t.ampersand = 778;
  43012. t.suchthat = 439;
  43013. t.parenleft = 333;
  43014. t.parenright = 333;
  43015. t.asteriskmath = 500;
  43016. t.plus = 549;
  43017. t.comma = 250;
  43018. t.minus = 549;
  43019. t.period = 250;
  43020. t.slash = 278;
  43021. t.zero = 500;
  43022. t.one = 500;
  43023. t.two = 500;
  43024. t.three = 500;
  43025. t.four = 500;
  43026. t.five = 500;
  43027. t.six = 500;
  43028. t.seven = 500;
  43029. t.eight = 500;
  43030. t.nine = 500;
  43031. t.colon = 278;
  43032. t.semicolon = 278;
  43033. t.less = 549;
  43034. t.equal = 549;
  43035. t.greater = 549;
  43036. t.question = 444;
  43037. t.congruent = 549;
  43038. t.Alpha = 722;
  43039. t.Beta = 667;
  43040. t.Chi = 722;
  43041. t.Delta = 612;
  43042. t.Epsilon = 611;
  43043. t.Phi = 763;
  43044. t.Gamma = 603;
  43045. t.Eta = 722;
  43046. t.Iota = 333;
  43047. t.theta1 = 631;
  43048. t.Kappa = 722;
  43049. t.Lambda = 686;
  43050. t.Mu = 889;
  43051. t.Nu = 722;
  43052. t.Omicron = 722;
  43053. t.Pi = 768;
  43054. t.Theta = 741;
  43055. t.Rho = 556;
  43056. t.Sigma = 592;
  43057. t.Tau = 611;
  43058. t.Upsilon = 690;
  43059. t.sigma1 = 439;
  43060. t.Omega = 768;
  43061. t.Xi = 645;
  43062. t.Psi = 795;
  43063. t.Zeta = 611;
  43064. t.bracketleft = 333;
  43065. t.therefore = 863;
  43066. t.bracketright = 333;
  43067. t.perpendicular = 658;
  43068. t.underscore = 500;
  43069. t.radicalex = 500;
  43070. t.alpha = 631;
  43071. t.beta = 549;
  43072. t.chi = 549;
  43073. t.delta = 494;
  43074. t.epsilon = 439;
  43075. t.phi = 521;
  43076. t.gamma = 411;
  43077. t.eta = 603;
  43078. t.iota = 329;
  43079. t.phi1 = 603;
  43080. t.kappa = 549;
  43081. t.lambda = 549;
  43082. t.mu = 576;
  43083. t.nu = 521;
  43084. t.omicron = 549;
  43085. t.pi = 549;
  43086. t.theta = 521;
  43087. t.rho = 549;
  43088. t.sigma = 603;
  43089. t.tau = 439;
  43090. t.upsilon = 576;
  43091. t.omega1 = 713;
  43092. t.omega = 686;
  43093. t.xi = 493;
  43094. t.psi = 686;
  43095. t.zeta = 494;
  43096. t.braceleft = 480;
  43097. t.bar = 200;
  43098. t.braceright = 480;
  43099. t.similar = 549;
  43100. t.Euro = 750;
  43101. t.Upsilon1 = 620;
  43102. t.minute = 247;
  43103. t.lessequal = 549;
  43104. t.fraction = 167;
  43105. t.infinity = 713;
  43106. t.florin = 500;
  43107. t.club = 753;
  43108. t.diamond = 753;
  43109. t.heart = 753;
  43110. t.spade = 753;
  43111. t.arrowboth = 1042;
  43112. t.arrowleft = 987;
  43113. t.arrowup = 603;
  43114. t.arrowright = 987;
  43115. t.arrowdown = 603;
  43116. t.degree = 400;
  43117. t.plusminus = 549;
  43118. t.second = 411;
  43119. t.greaterequal = 549;
  43120. t.multiply = 549;
  43121. t.proportional = 713;
  43122. t.partialdiff = 494;
  43123. t.bullet = 460;
  43124. t.divide = 549;
  43125. t.notequal = 549;
  43126. t.equivalence = 549;
  43127. t.approxequal = 549;
  43128. t.ellipsis = 1000;
  43129. t.arrowvertex = 603;
  43130. t.arrowhorizex = 1000;
  43131. t.carriagereturn = 658;
  43132. t.aleph = 823;
  43133. t.Ifraktur = 686;
  43134. t.Rfraktur = 795;
  43135. t.weierstrass = 987;
  43136. t.circlemultiply = 768;
  43137. t.circleplus = 768;
  43138. t.emptyset = 823;
  43139. t.intersection = 768;
  43140. t.union = 768;
  43141. t.propersuperset = 713;
  43142. t.reflexsuperset = 713;
  43143. t.notsubset = 713;
  43144. t.propersubset = 713;
  43145. t.reflexsubset = 713;
  43146. t.element = 713;
  43147. t.notelement = 713;
  43148. t.angle = 768;
  43149. t.gradient = 713;
  43150. t.registerserif = 790;
  43151. t.copyrightserif = 790;
  43152. t.trademarkserif = 890;
  43153. t.product = 823;
  43154. t.radical = 549;
  43155. t.dotmath = 250;
  43156. t.logicalnot = 713;
  43157. t.logicaland = 603;
  43158. t.logicalor = 603;
  43159. t.arrowdblboth = 1042;
  43160. t.arrowdblleft = 987;
  43161. t.arrowdblup = 603;
  43162. t.arrowdblright = 987;
  43163. t.arrowdbldown = 603;
  43164. t.lozenge = 494;
  43165. t.angleleft = 329;
  43166. t.registersans = 790;
  43167. t.copyrightsans = 790;
  43168. t.trademarksans = 786;
  43169. t.summation = 713;
  43170. t.parenlefttp = 384;
  43171. t.parenleftex = 384;
  43172. t.parenleftbt = 384;
  43173. t.bracketlefttp = 384;
  43174. t.bracketleftex = 384;
  43175. t.bracketleftbt = 384;
  43176. t.bracelefttp = 494;
  43177. t.braceleftmid = 494;
  43178. t.braceleftbt = 494;
  43179. t.braceex = 494;
  43180. t.angleright = 329;
  43181. t.integral = 274;
  43182. t.integraltp = 686;
  43183. t.integralex = 686;
  43184. t.integralbt = 686;
  43185. t.parenrighttp = 384;
  43186. t.parenrightex = 384;
  43187. t.parenrightbt = 384;
  43188. t.bracketrighttp = 384;
  43189. t.bracketrightex = 384;
  43190. t.bracketrightbt = 384;
  43191. t.bracerighttp = 494;
  43192. t.bracerightmid = 494;
  43193. t.bracerightbt = 494;
  43194. t.apple = 790;
  43195. });
  43196. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43197. t.space = 250;
  43198. t.exclam = 333;
  43199. t.quotedbl = 408;
  43200. t.numbersign = 500;
  43201. t.dollar = 500;
  43202. t.percent = 833;
  43203. t.ampersand = 778;
  43204. t.quoteright = 333;
  43205. t.parenleft = 333;
  43206. t.parenright = 333;
  43207. t.asterisk = 500;
  43208. t.plus = 564;
  43209. t.comma = 250;
  43210. t.hyphen = 333;
  43211. t.period = 250;
  43212. t.slash = 278;
  43213. t.zero = 500;
  43214. t.one = 500;
  43215. t.two = 500;
  43216. t.three = 500;
  43217. t.four = 500;
  43218. t.five = 500;
  43219. t.six = 500;
  43220. t.seven = 500;
  43221. t.eight = 500;
  43222. t.nine = 500;
  43223. t.colon = 278;
  43224. t.semicolon = 278;
  43225. t.less = 564;
  43226. t.equal = 564;
  43227. t.greater = 564;
  43228. t.question = 444;
  43229. t.at = 921;
  43230. t.A = 722;
  43231. t.B = 667;
  43232. t.C = 667;
  43233. t.D = 722;
  43234. t.E = 611;
  43235. t.F = 556;
  43236. t.G = 722;
  43237. t.H = 722;
  43238. t.I = 333;
  43239. t.J = 389;
  43240. t.K = 722;
  43241. t.L = 611;
  43242. t.M = 889;
  43243. t.N = 722;
  43244. t.O = 722;
  43245. t.P = 556;
  43246. t.Q = 722;
  43247. t.R = 667;
  43248. t.S = 556;
  43249. t.T = 611;
  43250. t.U = 722;
  43251. t.V = 722;
  43252. t.W = 944;
  43253. t.X = 722;
  43254. t.Y = 722;
  43255. t.Z = 611;
  43256. t.bracketleft = 333;
  43257. t.backslash = 278;
  43258. t.bracketright = 333;
  43259. t.asciicircum = 469;
  43260. t.underscore = 500;
  43261. t.quoteleft = 333;
  43262. t.a = 444;
  43263. t.b = 500;
  43264. t.c = 444;
  43265. t.d = 500;
  43266. t.e = 444;
  43267. t.f = 333;
  43268. t.g = 500;
  43269. t.h = 500;
  43270. t.i = 278;
  43271. t.j = 278;
  43272. t.k = 500;
  43273. t.l = 278;
  43274. t.m = 778;
  43275. t.n = 500;
  43276. t.o = 500;
  43277. t.p = 500;
  43278. t.q = 500;
  43279. t.r = 333;
  43280. t.s = 389;
  43281. t.t = 278;
  43282. t.u = 500;
  43283. t.v = 500;
  43284. t.w = 722;
  43285. t.x = 500;
  43286. t.y = 500;
  43287. t.z = 444;
  43288. t.braceleft = 480;
  43289. t.bar = 200;
  43290. t.braceright = 480;
  43291. t.asciitilde = 541;
  43292. t.exclamdown = 333;
  43293. t.cent = 500;
  43294. t.sterling = 500;
  43295. t.fraction = 167;
  43296. t.yen = 500;
  43297. t.florin = 500;
  43298. t.section = 500;
  43299. t.currency = 500;
  43300. t.quotesingle = 180;
  43301. t.quotedblleft = 444;
  43302. t.guillemotleft = 500;
  43303. t.guilsinglleft = 333;
  43304. t.guilsinglright = 333;
  43305. t.fi = 556;
  43306. t.fl = 556;
  43307. t.endash = 500;
  43308. t.dagger = 500;
  43309. t.daggerdbl = 500;
  43310. t.periodcentered = 250;
  43311. t.paragraph = 453;
  43312. t.bullet = 350;
  43313. t.quotesinglbase = 333;
  43314. t.quotedblbase = 444;
  43315. t.quotedblright = 444;
  43316. t.guillemotright = 500;
  43317. t.ellipsis = 1000;
  43318. t.perthousand = 1000;
  43319. t.questiondown = 444;
  43320. t.grave = 333;
  43321. t.acute = 333;
  43322. t.circumflex = 333;
  43323. t.tilde = 333;
  43324. t.macron = 333;
  43325. t.breve = 333;
  43326. t.dotaccent = 333;
  43327. t.dieresis = 333;
  43328. t.ring = 333;
  43329. t.cedilla = 333;
  43330. t.hungarumlaut = 333;
  43331. t.ogonek = 333;
  43332. t.caron = 333;
  43333. t.emdash = 1000;
  43334. t.AE = 889;
  43335. t.ordfeminine = 276;
  43336. t.Lslash = 611;
  43337. t.Oslash = 722;
  43338. t.OE = 889;
  43339. t.ordmasculine = 310;
  43340. t.ae = 667;
  43341. t.dotlessi = 278;
  43342. t.lslash = 278;
  43343. t.oslash = 500;
  43344. t.oe = 722;
  43345. t.germandbls = 500;
  43346. t.Idieresis = 333;
  43347. t.eacute = 444;
  43348. t.abreve = 444;
  43349. t.uhungarumlaut = 500;
  43350. t.ecaron = 444;
  43351. t.Ydieresis = 722;
  43352. t.divide = 564;
  43353. t.Yacute = 722;
  43354. t.Acircumflex = 722;
  43355. t.aacute = 444;
  43356. t.Ucircumflex = 722;
  43357. t.yacute = 500;
  43358. t.scommaaccent = 389;
  43359. t.ecircumflex = 444;
  43360. t.Uring = 722;
  43361. t.Udieresis = 722;
  43362. t.aogonek = 444;
  43363. t.Uacute = 722;
  43364. t.uogonek = 500;
  43365. t.Edieresis = 611;
  43366. t.Dcroat = 722;
  43367. t.commaaccent = 250;
  43368. t.copyright = 760;
  43369. t.Emacron = 611;
  43370. t.ccaron = 444;
  43371. t.aring = 444;
  43372. t.Ncommaaccent = 722;
  43373. t.lacute = 278;
  43374. t.agrave = 444;
  43375. t.Tcommaaccent = 611;
  43376. t.Cacute = 667;
  43377. t.atilde = 444;
  43378. t.Edotaccent = 611;
  43379. t.scaron = 389;
  43380. t.scedilla = 389;
  43381. t.iacute = 278;
  43382. t.lozenge = 471;
  43383. t.Rcaron = 667;
  43384. t.Gcommaaccent = 722;
  43385. t.ucircumflex = 500;
  43386. t.acircumflex = 444;
  43387. t.Amacron = 722;
  43388. t.rcaron = 333;
  43389. t.ccedilla = 444;
  43390. t.Zdotaccent = 611;
  43391. t.Thorn = 556;
  43392. t.Omacron = 722;
  43393. t.Racute = 667;
  43394. t.Sacute = 556;
  43395. t.dcaron = 588;
  43396. t.Umacron = 722;
  43397. t.uring = 500;
  43398. t.threesuperior = 300;
  43399. t.Ograve = 722;
  43400. t.Agrave = 722;
  43401. t.Abreve = 722;
  43402. t.multiply = 564;
  43403. t.uacute = 500;
  43404. t.Tcaron = 611;
  43405. t.partialdiff = 476;
  43406. t.ydieresis = 500;
  43407. t.Nacute = 722;
  43408. t.icircumflex = 278;
  43409. t.Ecircumflex = 611;
  43410. t.adieresis = 444;
  43411. t.edieresis = 444;
  43412. t.cacute = 444;
  43413. t.nacute = 500;
  43414. t.umacron = 500;
  43415. t.Ncaron = 722;
  43416. t.Iacute = 333;
  43417. t.plusminus = 564;
  43418. t.brokenbar = 200;
  43419. t.registered = 760;
  43420. t.Gbreve = 722;
  43421. t.Idotaccent = 333;
  43422. t.summation = 600;
  43423. t.Egrave = 611;
  43424. t.racute = 333;
  43425. t.omacron = 500;
  43426. t.Zacute = 611;
  43427. t.Zcaron = 611;
  43428. t.greaterequal = 549;
  43429. t.Eth = 722;
  43430. t.Ccedilla = 667;
  43431. t.lcommaaccent = 278;
  43432. t.tcaron = 326;
  43433. t.eogonek = 444;
  43434. t.Uogonek = 722;
  43435. t.Aacute = 722;
  43436. t.Adieresis = 722;
  43437. t.egrave = 444;
  43438. t.zacute = 444;
  43439. t.iogonek = 278;
  43440. t.Oacute = 722;
  43441. t.oacute = 500;
  43442. t.amacron = 444;
  43443. t.sacute = 389;
  43444. t.idieresis = 278;
  43445. t.Ocircumflex = 722;
  43446. t.Ugrave = 722;
  43447. t.Delta = 612;
  43448. t.thorn = 500;
  43449. t.twosuperior = 300;
  43450. t.Odieresis = 722;
  43451. t.mu = 500;
  43452. t.igrave = 278;
  43453. t.ohungarumlaut = 500;
  43454. t.Eogonek = 611;
  43455. t.dcroat = 500;
  43456. t.threequarters = 750;
  43457. t.Scedilla = 556;
  43458. t.lcaron = 344;
  43459. t.Kcommaaccent = 722;
  43460. t.Lacute = 611;
  43461. t.trademark = 980;
  43462. t.edotaccent = 444;
  43463. t.Igrave = 333;
  43464. t.Imacron = 333;
  43465. t.Lcaron = 611;
  43466. t.onehalf = 750;
  43467. t.lessequal = 549;
  43468. t.ocircumflex = 500;
  43469. t.ntilde = 500;
  43470. t.Uhungarumlaut = 722;
  43471. t.Eacute = 611;
  43472. t.emacron = 444;
  43473. t.gbreve = 500;
  43474. t.onequarter = 750;
  43475. t.Scaron = 556;
  43476. t.Scommaaccent = 556;
  43477. t.Ohungarumlaut = 722;
  43478. t.degree = 400;
  43479. t.ograve = 500;
  43480. t.Ccaron = 667;
  43481. t.ugrave = 500;
  43482. t.radical = 453;
  43483. t.Dcaron = 722;
  43484. t.rcommaaccent = 333;
  43485. t.Ntilde = 722;
  43486. t.otilde = 500;
  43487. t.Rcommaaccent = 667;
  43488. t.Lcommaaccent = 611;
  43489. t.Atilde = 722;
  43490. t.Aogonek = 722;
  43491. t.Aring = 722;
  43492. t.Otilde = 722;
  43493. t.zdotaccent = 444;
  43494. t.Ecaron = 611;
  43495. t.Iogonek = 333;
  43496. t.kcommaaccent = 500;
  43497. t.minus = 564;
  43498. t.Icircumflex = 333;
  43499. t.ncaron = 500;
  43500. t.tcommaaccent = 278;
  43501. t.logicalnot = 564;
  43502. t.odieresis = 500;
  43503. t.udieresis = 500;
  43504. t.notequal = 549;
  43505. t.gcommaaccent = 500;
  43506. t.eth = 500;
  43507. t.zcaron = 444;
  43508. t.ncommaaccent = 500;
  43509. t.onesuperior = 300;
  43510. t.imacron = 278;
  43511. t.Euro = 500;
  43512. });
  43513. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43514. t.space = 250;
  43515. t.exclam = 333;
  43516. t.quotedbl = 555;
  43517. t.numbersign = 500;
  43518. t.dollar = 500;
  43519. t.percent = 1000;
  43520. t.ampersand = 833;
  43521. t.quoteright = 333;
  43522. t.parenleft = 333;
  43523. t.parenright = 333;
  43524. t.asterisk = 500;
  43525. t.plus = 570;
  43526. t.comma = 250;
  43527. t.hyphen = 333;
  43528. t.period = 250;
  43529. t.slash = 278;
  43530. t.zero = 500;
  43531. t.one = 500;
  43532. t.two = 500;
  43533. t.three = 500;
  43534. t.four = 500;
  43535. t.five = 500;
  43536. t.six = 500;
  43537. t.seven = 500;
  43538. t.eight = 500;
  43539. t.nine = 500;
  43540. t.colon = 333;
  43541. t.semicolon = 333;
  43542. t.less = 570;
  43543. t.equal = 570;
  43544. t.greater = 570;
  43545. t.question = 500;
  43546. t.at = 930;
  43547. t.A = 722;
  43548. t.B = 667;
  43549. t.C = 722;
  43550. t.D = 722;
  43551. t.E = 667;
  43552. t.F = 611;
  43553. t.G = 778;
  43554. t.H = 778;
  43555. t.I = 389;
  43556. t.J = 500;
  43557. t.K = 778;
  43558. t.L = 667;
  43559. t.M = 944;
  43560. t.N = 722;
  43561. t.O = 778;
  43562. t.P = 611;
  43563. t.Q = 778;
  43564. t.R = 722;
  43565. t.S = 556;
  43566. t.T = 667;
  43567. t.U = 722;
  43568. t.V = 722;
  43569. t.W = 1000;
  43570. t.X = 722;
  43571. t.Y = 722;
  43572. t.Z = 667;
  43573. t.bracketleft = 333;
  43574. t.backslash = 278;
  43575. t.bracketright = 333;
  43576. t.asciicircum = 581;
  43577. t.underscore = 500;
  43578. t.quoteleft = 333;
  43579. t.a = 500;
  43580. t.b = 556;
  43581. t.c = 444;
  43582. t.d = 556;
  43583. t.e = 444;
  43584. t.f = 333;
  43585. t.g = 500;
  43586. t.h = 556;
  43587. t.i = 278;
  43588. t.j = 333;
  43589. t.k = 556;
  43590. t.l = 278;
  43591. t.m = 833;
  43592. t.n = 556;
  43593. t.o = 500;
  43594. t.p = 556;
  43595. t.q = 556;
  43596. t.r = 444;
  43597. t.s = 389;
  43598. t.t = 333;
  43599. t.u = 556;
  43600. t.v = 500;
  43601. t.w = 722;
  43602. t.x = 500;
  43603. t.y = 500;
  43604. t.z = 444;
  43605. t.braceleft = 394;
  43606. t.bar = 220;
  43607. t.braceright = 394;
  43608. t.asciitilde = 520;
  43609. t.exclamdown = 333;
  43610. t.cent = 500;
  43611. t.sterling = 500;
  43612. t.fraction = 167;
  43613. t.yen = 500;
  43614. t.florin = 500;
  43615. t.section = 500;
  43616. t.currency = 500;
  43617. t.quotesingle = 278;
  43618. t.quotedblleft = 500;
  43619. t.guillemotleft = 500;
  43620. t.guilsinglleft = 333;
  43621. t.guilsinglright = 333;
  43622. t.fi = 556;
  43623. t.fl = 556;
  43624. t.endash = 500;
  43625. t.dagger = 500;
  43626. t.daggerdbl = 500;
  43627. t.periodcentered = 250;
  43628. t.paragraph = 540;
  43629. t.bullet = 350;
  43630. t.quotesinglbase = 333;
  43631. t.quotedblbase = 500;
  43632. t.quotedblright = 500;
  43633. t.guillemotright = 500;
  43634. t.ellipsis = 1000;
  43635. t.perthousand = 1000;
  43636. t.questiondown = 500;
  43637. t.grave = 333;
  43638. t.acute = 333;
  43639. t.circumflex = 333;
  43640. t.tilde = 333;
  43641. t.macron = 333;
  43642. t.breve = 333;
  43643. t.dotaccent = 333;
  43644. t.dieresis = 333;
  43645. t.ring = 333;
  43646. t.cedilla = 333;
  43647. t.hungarumlaut = 333;
  43648. t.ogonek = 333;
  43649. t.caron = 333;
  43650. t.emdash = 1000;
  43651. t.AE = 1000;
  43652. t.ordfeminine = 300;
  43653. t.Lslash = 667;
  43654. t.Oslash = 778;
  43655. t.OE = 1000;
  43656. t.ordmasculine = 330;
  43657. t.ae = 722;
  43658. t.dotlessi = 278;
  43659. t.lslash = 278;
  43660. t.oslash = 500;
  43661. t.oe = 722;
  43662. t.germandbls = 556;
  43663. t.Idieresis = 389;
  43664. t.eacute = 444;
  43665. t.abreve = 500;
  43666. t.uhungarumlaut = 556;
  43667. t.ecaron = 444;
  43668. t.Ydieresis = 722;
  43669. t.divide = 570;
  43670. t.Yacute = 722;
  43671. t.Acircumflex = 722;
  43672. t.aacute = 500;
  43673. t.Ucircumflex = 722;
  43674. t.yacute = 500;
  43675. t.scommaaccent = 389;
  43676. t.ecircumflex = 444;
  43677. t.Uring = 722;
  43678. t.Udieresis = 722;
  43679. t.aogonek = 500;
  43680. t.Uacute = 722;
  43681. t.uogonek = 556;
  43682. t.Edieresis = 667;
  43683. t.Dcroat = 722;
  43684. t.commaaccent = 250;
  43685. t.copyright = 747;
  43686. t.Emacron = 667;
  43687. t.ccaron = 444;
  43688. t.aring = 500;
  43689. t.Ncommaaccent = 722;
  43690. t.lacute = 278;
  43691. t.agrave = 500;
  43692. t.Tcommaaccent = 667;
  43693. t.Cacute = 722;
  43694. t.atilde = 500;
  43695. t.Edotaccent = 667;
  43696. t.scaron = 389;
  43697. t.scedilla = 389;
  43698. t.iacute = 278;
  43699. t.lozenge = 494;
  43700. t.Rcaron = 722;
  43701. t.Gcommaaccent = 778;
  43702. t.ucircumflex = 556;
  43703. t.acircumflex = 500;
  43704. t.Amacron = 722;
  43705. t.rcaron = 444;
  43706. t.ccedilla = 444;
  43707. t.Zdotaccent = 667;
  43708. t.Thorn = 611;
  43709. t.Omacron = 778;
  43710. t.Racute = 722;
  43711. t.Sacute = 556;
  43712. t.dcaron = 672;
  43713. t.Umacron = 722;
  43714. t.uring = 556;
  43715. t.threesuperior = 300;
  43716. t.Ograve = 778;
  43717. t.Agrave = 722;
  43718. t.Abreve = 722;
  43719. t.multiply = 570;
  43720. t.uacute = 556;
  43721. t.Tcaron = 667;
  43722. t.partialdiff = 494;
  43723. t.ydieresis = 500;
  43724. t.Nacute = 722;
  43725. t.icircumflex = 278;
  43726. t.Ecircumflex = 667;
  43727. t.adieresis = 500;
  43728. t.edieresis = 444;
  43729. t.cacute = 444;
  43730. t.nacute = 556;
  43731. t.umacron = 556;
  43732. t.Ncaron = 722;
  43733. t.Iacute = 389;
  43734. t.plusminus = 570;
  43735. t.brokenbar = 220;
  43736. t.registered = 747;
  43737. t.Gbreve = 778;
  43738. t.Idotaccent = 389;
  43739. t.summation = 600;
  43740. t.Egrave = 667;
  43741. t.racute = 444;
  43742. t.omacron = 500;
  43743. t.Zacute = 667;
  43744. t.Zcaron = 667;
  43745. t.greaterequal = 549;
  43746. t.Eth = 722;
  43747. t.Ccedilla = 722;
  43748. t.lcommaaccent = 278;
  43749. t.tcaron = 416;
  43750. t.eogonek = 444;
  43751. t.Uogonek = 722;
  43752. t.Aacute = 722;
  43753. t.Adieresis = 722;
  43754. t.egrave = 444;
  43755. t.zacute = 444;
  43756. t.iogonek = 278;
  43757. t.Oacute = 778;
  43758. t.oacute = 500;
  43759. t.amacron = 500;
  43760. t.sacute = 389;
  43761. t.idieresis = 278;
  43762. t.Ocircumflex = 778;
  43763. t.Ugrave = 722;
  43764. t.Delta = 612;
  43765. t.thorn = 556;
  43766. t.twosuperior = 300;
  43767. t.Odieresis = 778;
  43768. t.mu = 556;
  43769. t.igrave = 278;
  43770. t.ohungarumlaut = 500;
  43771. t.Eogonek = 667;
  43772. t.dcroat = 556;
  43773. t.threequarters = 750;
  43774. t.Scedilla = 556;
  43775. t.lcaron = 394;
  43776. t.Kcommaaccent = 778;
  43777. t.Lacute = 667;
  43778. t.trademark = 1000;
  43779. t.edotaccent = 444;
  43780. t.Igrave = 389;
  43781. t.Imacron = 389;
  43782. t.Lcaron = 667;
  43783. t.onehalf = 750;
  43784. t.lessequal = 549;
  43785. t.ocircumflex = 500;
  43786. t.ntilde = 556;
  43787. t.Uhungarumlaut = 722;
  43788. t.Eacute = 667;
  43789. t.emacron = 444;
  43790. t.gbreve = 500;
  43791. t.onequarter = 750;
  43792. t.Scaron = 556;
  43793. t.Scommaaccent = 556;
  43794. t.Ohungarumlaut = 778;
  43795. t.degree = 400;
  43796. t.ograve = 500;
  43797. t.Ccaron = 722;
  43798. t.ugrave = 556;
  43799. t.radical = 549;
  43800. t.Dcaron = 722;
  43801. t.rcommaaccent = 444;
  43802. t.Ntilde = 722;
  43803. t.otilde = 500;
  43804. t.Rcommaaccent = 722;
  43805. t.Lcommaaccent = 667;
  43806. t.Atilde = 722;
  43807. t.Aogonek = 722;
  43808. t.Aring = 722;
  43809. t.Otilde = 778;
  43810. t.zdotaccent = 444;
  43811. t.Ecaron = 667;
  43812. t.Iogonek = 389;
  43813. t.kcommaaccent = 556;
  43814. t.minus = 570;
  43815. t.Icircumflex = 389;
  43816. t.ncaron = 556;
  43817. t.tcommaaccent = 333;
  43818. t.logicalnot = 570;
  43819. t.odieresis = 500;
  43820. t.udieresis = 556;
  43821. t.notequal = 549;
  43822. t.gcommaaccent = 500;
  43823. t.eth = 500;
  43824. t.zcaron = 444;
  43825. t.ncommaaccent = 556;
  43826. t.onesuperior = 300;
  43827. t.imacron = 278;
  43828. t.Euro = 500;
  43829. });
  43830. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43831. t.space = 250;
  43832. t.exclam = 389;
  43833. t.quotedbl = 555;
  43834. t.numbersign = 500;
  43835. t.dollar = 500;
  43836. t.percent = 833;
  43837. t.ampersand = 778;
  43838. t.quoteright = 333;
  43839. t.parenleft = 333;
  43840. t.parenright = 333;
  43841. t.asterisk = 500;
  43842. t.plus = 570;
  43843. t.comma = 250;
  43844. t.hyphen = 333;
  43845. t.period = 250;
  43846. t.slash = 278;
  43847. t.zero = 500;
  43848. t.one = 500;
  43849. t.two = 500;
  43850. t.three = 500;
  43851. t.four = 500;
  43852. t.five = 500;
  43853. t.six = 500;
  43854. t.seven = 500;
  43855. t.eight = 500;
  43856. t.nine = 500;
  43857. t.colon = 333;
  43858. t.semicolon = 333;
  43859. t.less = 570;
  43860. t.equal = 570;
  43861. t.greater = 570;
  43862. t.question = 500;
  43863. t.at = 832;
  43864. t.A = 667;
  43865. t.B = 667;
  43866. t.C = 667;
  43867. t.D = 722;
  43868. t.E = 667;
  43869. t.F = 667;
  43870. t.G = 722;
  43871. t.H = 778;
  43872. t.I = 389;
  43873. t.J = 500;
  43874. t.K = 667;
  43875. t.L = 611;
  43876. t.M = 889;
  43877. t.N = 722;
  43878. t.O = 722;
  43879. t.P = 611;
  43880. t.Q = 722;
  43881. t.R = 667;
  43882. t.S = 556;
  43883. t.T = 611;
  43884. t.U = 722;
  43885. t.V = 667;
  43886. t.W = 889;
  43887. t.X = 667;
  43888. t.Y = 611;
  43889. t.Z = 611;
  43890. t.bracketleft = 333;
  43891. t.backslash = 278;
  43892. t.bracketright = 333;
  43893. t.asciicircum = 570;
  43894. t.underscore = 500;
  43895. t.quoteleft = 333;
  43896. t.a = 500;
  43897. t.b = 500;
  43898. t.c = 444;
  43899. t.d = 500;
  43900. t.e = 444;
  43901. t.f = 333;
  43902. t.g = 500;
  43903. t.h = 556;
  43904. t.i = 278;
  43905. t.j = 278;
  43906. t.k = 500;
  43907. t.l = 278;
  43908. t.m = 778;
  43909. t.n = 556;
  43910. t.o = 500;
  43911. t.p = 500;
  43912. t.q = 500;
  43913. t.r = 389;
  43914. t.s = 389;
  43915. t.t = 278;
  43916. t.u = 556;
  43917. t.v = 444;
  43918. t.w = 667;
  43919. t.x = 500;
  43920. t.y = 444;
  43921. t.z = 389;
  43922. t.braceleft = 348;
  43923. t.bar = 220;
  43924. t.braceright = 348;
  43925. t.asciitilde = 570;
  43926. t.exclamdown = 389;
  43927. t.cent = 500;
  43928. t.sterling = 500;
  43929. t.fraction = 167;
  43930. t.yen = 500;
  43931. t.florin = 500;
  43932. t.section = 500;
  43933. t.currency = 500;
  43934. t.quotesingle = 278;
  43935. t.quotedblleft = 500;
  43936. t.guillemotleft = 500;
  43937. t.guilsinglleft = 333;
  43938. t.guilsinglright = 333;
  43939. t.fi = 556;
  43940. t.fl = 556;
  43941. t.endash = 500;
  43942. t.dagger = 500;
  43943. t.daggerdbl = 500;
  43944. t.periodcentered = 250;
  43945. t.paragraph = 500;
  43946. t.bullet = 350;
  43947. t.quotesinglbase = 333;
  43948. t.quotedblbase = 500;
  43949. t.quotedblright = 500;
  43950. t.guillemotright = 500;
  43951. t.ellipsis = 1000;
  43952. t.perthousand = 1000;
  43953. t.questiondown = 500;
  43954. t.grave = 333;
  43955. t.acute = 333;
  43956. t.circumflex = 333;
  43957. t.tilde = 333;
  43958. t.macron = 333;
  43959. t.breve = 333;
  43960. t.dotaccent = 333;
  43961. t.dieresis = 333;
  43962. t.ring = 333;
  43963. t.cedilla = 333;
  43964. t.hungarumlaut = 333;
  43965. t.ogonek = 333;
  43966. t.caron = 333;
  43967. t.emdash = 1000;
  43968. t.AE = 944;
  43969. t.ordfeminine = 266;
  43970. t.Lslash = 611;
  43971. t.Oslash = 722;
  43972. t.OE = 944;
  43973. t.ordmasculine = 300;
  43974. t.ae = 722;
  43975. t.dotlessi = 278;
  43976. t.lslash = 278;
  43977. t.oslash = 500;
  43978. t.oe = 722;
  43979. t.germandbls = 500;
  43980. t.Idieresis = 389;
  43981. t.eacute = 444;
  43982. t.abreve = 500;
  43983. t.uhungarumlaut = 556;
  43984. t.ecaron = 444;
  43985. t.Ydieresis = 611;
  43986. t.divide = 570;
  43987. t.Yacute = 611;
  43988. t.Acircumflex = 667;
  43989. t.aacute = 500;
  43990. t.Ucircumflex = 722;
  43991. t.yacute = 444;
  43992. t.scommaaccent = 389;
  43993. t.ecircumflex = 444;
  43994. t.Uring = 722;
  43995. t.Udieresis = 722;
  43996. t.aogonek = 500;
  43997. t.Uacute = 722;
  43998. t.uogonek = 556;
  43999. t.Edieresis = 667;
  44000. t.Dcroat = 722;
  44001. t.commaaccent = 250;
  44002. t.copyright = 747;
  44003. t.Emacron = 667;
  44004. t.ccaron = 444;
  44005. t.aring = 500;
  44006. t.Ncommaaccent = 722;
  44007. t.lacute = 278;
  44008. t.agrave = 500;
  44009. t.Tcommaaccent = 611;
  44010. t.Cacute = 667;
  44011. t.atilde = 500;
  44012. t.Edotaccent = 667;
  44013. t.scaron = 389;
  44014. t.scedilla = 389;
  44015. t.iacute = 278;
  44016. t.lozenge = 494;
  44017. t.Rcaron = 667;
  44018. t.Gcommaaccent = 722;
  44019. t.ucircumflex = 556;
  44020. t.acircumflex = 500;
  44021. t.Amacron = 667;
  44022. t.rcaron = 389;
  44023. t.ccedilla = 444;
  44024. t.Zdotaccent = 611;
  44025. t.Thorn = 611;
  44026. t.Omacron = 722;
  44027. t.Racute = 667;
  44028. t.Sacute = 556;
  44029. t.dcaron = 608;
  44030. t.Umacron = 722;
  44031. t.uring = 556;
  44032. t.threesuperior = 300;
  44033. t.Ograve = 722;
  44034. t.Agrave = 667;
  44035. t.Abreve = 667;
  44036. t.multiply = 570;
  44037. t.uacute = 556;
  44038. t.Tcaron = 611;
  44039. t.partialdiff = 494;
  44040. t.ydieresis = 444;
  44041. t.Nacute = 722;
  44042. t.icircumflex = 278;
  44043. t.Ecircumflex = 667;
  44044. t.adieresis = 500;
  44045. t.edieresis = 444;
  44046. t.cacute = 444;
  44047. t.nacute = 556;
  44048. t.umacron = 556;
  44049. t.Ncaron = 722;
  44050. t.Iacute = 389;
  44051. t.plusminus = 570;
  44052. t.brokenbar = 220;
  44053. t.registered = 747;
  44054. t.Gbreve = 722;
  44055. t.Idotaccent = 389;
  44056. t.summation = 600;
  44057. t.Egrave = 667;
  44058. t.racute = 389;
  44059. t.omacron = 500;
  44060. t.Zacute = 611;
  44061. t.Zcaron = 611;
  44062. t.greaterequal = 549;
  44063. t.Eth = 722;
  44064. t.Ccedilla = 667;
  44065. t.lcommaaccent = 278;
  44066. t.tcaron = 366;
  44067. t.eogonek = 444;
  44068. t.Uogonek = 722;
  44069. t.Aacute = 667;
  44070. t.Adieresis = 667;
  44071. t.egrave = 444;
  44072. t.zacute = 389;
  44073. t.iogonek = 278;
  44074. t.Oacute = 722;
  44075. t.oacute = 500;
  44076. t.amacron = 500;
  44077. t.sacute = 389;
  44078. t.idieresis = 278;
  44079. t.Ocircumflex = 722;
  44080. t.Ugrave = 722;
  44081. t.Delta = 612;
  44082. t.thorn = 500;
  44083. t.twosuperior = 300;
  44084. t.Odieresis = 722;
  44085. t.mu = 576;
  44086. t.igrave = 278;
  44087. t.ohungarumlaut = 500;
  44088. t.Eogonek = 667;
  44089. t.dcroat = 500;
  44090. t.threequarters = 750;
  44091. t.Scedilla = 556;
  44092. t.lcaron = 382;
  44093. t.Kcommaaccent = 667;
  44094. t.Lacute = 611;
  44095. t.trademark = 1000;
  44096. t.edotaccent = 444;
  44097. t.Igrave = 389;
  44098. t.Imacron = 389;
  44099. t.Lcaron = 611;
  44100. t.onehalf = 750;
  44101. t.lessequal = 549;
  44102. t.ocircumflex = 500;
  44103. t.ntilde = 556;
  44104. t.Uhungarumlaut = 722;
  44105. t.Eacute = 667;
  44106. t.emacron = 444;
  44107. t.gbreve = 500;
  44108. t.onequarter = 750;
  44109. t.Scaron = 556;
  44110. t.Scommaaccent = 556;
  44111. t.Ohungarumlaut = 722;
  44112. t.degree = 400;
  44113. t.ograve = 500;
  44114. t.Ccaron = 667;
  44115. t.ugrave = 556;
  44116. t.radical = 549;
  44117. t.Dcaron = 722;
  44118. t.rcommaaccent = 389;
  44119. t.Ntilde = 722;
  44120. t.otilde = 500;
  44121. t.Rcommaaccent = 667;
  44122. t.Lcommaaccent = 611;
  44123. t.Atilde = 667;
  44124. t.Aogonek = 667;
  44125. t.Aring = 667;
  44126. t.Otilde = 722;
  44127. t.zdotaccent = 389;
  44128. t.Ecaron = 667;
  44129. t.Iogonek = 389;
  44130. t.kcommaaccent = 500;
  44131. t.minus = 606;
  44132. t.Icircumflex = 389;
  44133. t.ncaron = 556;
  44134. t.tcommaaccent = 278;
  44135. t.logicalnot = 606;
  44136. t.odieresis = 500;
  44137. t.udieresis = 556;
  44138. t.notequal = 549;
  44139. t.gcommaaccent = 500;
  44140. t.eth = 500;
  44141. t.zcaron = 389;
  44142. t.ncommaaccent = 556;
  44143. t.onesuperior = 300;
  44144. t.imacron = 278;
  44145. t.Euro = 500;
  44146. });
  44147. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44148. t.space = 250;
  44149. t.exclam = 333;
  44150. t.quotedbl = 420;
  44151. t.numbersign = 500;
  44152. t.dollar = 500;
  44153. t.percent = 833;
  44154. t.ampersand = 778;
  44155. t.quoteright = 333;
  44156. t.parenleft = 333;
  44157. t.parenright = 333;
  44158. t.asterisk = 500;
  44159. t.plus = 675;
  44160. t.comma = 250;
  44161. t.hyphen = 333;
  44162. t.period = 250;
  44163. t.slash = 278;
  44164. t.zero = 500;
  44165. t.one = 500;
  44166. t.two = 500;
  44167. t.three = 500;
  44168. t.four = 500;
  44169. t.five = 500;
  44170. t.six = 500;
  44171. t.seven = 500;
  44172. t.eight = 500;
  44173. t.nine = 500;
  44174. t.colon = 333;
  44175. t.semicolon = 333;
  44176. t.less = 675;
  44177. t.equal = 675;
  44178. t.greater = 675;
  44179. t.question = 500;
  44180. t.at = 920;
  44181. t.A = 611;
  44182. t.B = 611;
  44183. t.C = 667;
  44184. t.D = 722;
  44185. t.E = 611;
  44186. t.F = 611;
  44187. t.G = 722;
  44188. t.H = 722;
  44189. t.I = 333;
  44190. t.J = 444;
  44191. t.K = 667;
  44192. t.L = 556;
  44193. t.M = 833;
  44194. t.N = 667;
  44195. t.O = 722;
  44196. t.P = 611;
  44197. t.Q = 722;
  44198. t.R = 611;
  44199. t.S = 500;
  44200. t.T = 556;
  44201. t.U = 722;
  44202. t.V = 611;
  44203. t.W = 833;
  44204. t.X = 611;
  44205. t.Y = 556;
  44206. t.Z = 556;
  44207. t.bracketleft = 389;
  44208. t.backslash = 278;
  44209. t.bracketright = 389;
  44210. t.asciicircum = 422;
  44211. t.underscore = 500;
  44212. t.quoteleft = 333;
  44213. t.a = 500;
  44214. t.b = 500;
  44215. t.c = 444;
  44216. t.d = 500;
  44217. t.e = 444;
  44218. t.f = 278;
  44219. t.g = 500;
  44220. t.h = 500;
  44221. t.i = 278;
  44222. t.j = 278;
  44223. t.k = 444;
  44224. t.l = 278;
  44225. t.m = 722;
  44226. t.n = 500;
  44227. t.o = 500;
  44228. t.p = 500;
  44229. t.q = 500;
  44230. t.r = 389;
  44231. t.s = 389;
  44232. t.t = 278;
  44233. t.u = 500;
  44234. t.v = 444;
  44235. t.w = 667;
  44236. t.x = 444;
  44237. t.y = 444;
  44238. t.z = 389;
  44239. t.braceleft = 400;
  44240. t.bar = 275;
  44241. t.braceright = 400;
  44242. t.asciitilde = 541;
  44243. t.exclamdown = 389;
  44244. t.cent = 500;
  44245. t.sterling = 500;
  44246. t.fraction = 167;
  44247. t.yen = 500;
  44248. t.florin = 500;
  44249. t.section = 500;
  44250. t.currency = 500;
  44251. t.quotesingle = 214;
  44252. t.quotedblleft = 556;
  44253. t.guillemotleft = 500;
  44254. t.guilsinglleft = 333;
  44255. t.guilsinglright = 333;
  44256. t.fi = 500;
  44257. t.fl = 500;
  44258. t.endash = 500;
  44259. t.dagger = 500;
  44260. t.daggerdbl = 500;
  44261. t.periodcentered = 250;
  44262. t.paragraph = 523;
  44263. t.bullet = 350;
  44264. t.quotesinglbase = 333;
  44265. t.quotedblbase = 556;
  44266. t.quotedblright = 556;
  44267. t.guillemotright = 500;
  44268. t.ellipsis = 889;
  44269. t.perthousand = 1000;
  44270. t.questiondown = 500;
  44271. t.grave = 333;
  44272. t.acute = 333;
  44273. t.circumflex = 333;
  44274. t.tilde = 333;
  44275. t.macron = 333;
  44276. t.breve = 333;
  44277. t.dotaccent = 333;
  44278. t.dieresis = 333;
  44279. t.ring = 333;
  44280. t.cedilla = 333;
  44281. t.hungarumlaut = 333;
  44282. t.ogonek = 333;
  44283. t.caron = 333;
  44284. t.emdash = 889;
  44285. t.AE = 889;
  44286. t.ordfeminine = 276;
  44287. t.Lslash = 556;
  44288. t.Oslash = 722;
  44289. t.OE = 944;
  44290. t.ordmasculine = 310;
  44291. t.ae = 667;
  44292. t.dotlessi = 278;
  44293. t.lslash = 278;
  44294. t.oslash = 500;
  44295. t.oe = 667;
  44296. t.germandbls = 500;
  44297. t.Idieresis = 333;
  44298. t.eacute = 444;
  44299. t.abreve = 500;
  44300. t.uhungarumlaut = 500;
  44301. t.ecaron = 444;
  44302. t.Ydieresis = 556;
  44303. t.divide = 675;
  44304. t.Yacute = 556;
  44305. t.Acircumflex = 611;
  44306. t.aacute = 500;
  44307. t.Ucircumflex = 722;
  44308. t.yacute = 444;
  44309. t.scommaaccent = 389;
  44310. t.ecircumflex = 444;
  44311. t.Uring = 722;
  44312. t.Udieresis = 722;
  44313. t.aogonek = 500;
  44314. t.Uacute = 722;
  44315. t.uogonek = 500;
  44316. t.Edieresis = 611;
  44317. t.Dcroat = 722;
  44318. t.commaaccent = 250;
  44319. t.copyright = 760;
  44320. t.Emacron = 611;
  44321. t.ccaron = 444;
  44322. t.aring = 500;
  44323. t.Ncommaaccent = 667;
  44324. t.lacute = 278;
  44325. t.agrave = 500;
  44326. t.Tcommaaccent = 556;
  44327. t.Cacute = 667;
  44328. t.atilde = 500;
  44329. t.Edotaccent = 611;
  44330. t.scaron = 389;
  44331. t.scedilla = 389;
  44332. t.iacute = 278;
  44333. t.lozenge = 471;
  44334. t.Rcaron = 611;
  44335. t.Gcommaaccent = 722;
  44336. t.ucircumflex = 500;
  44337. t.acircumflex = 500;
  44338. t.Amacron = 611;
  44339. t.rcaron = 389;
  44340. t.ccedilla = 444;
  44341. t.Zdotaccent = 556;
  44342. t.Thorn = 611;
  44343. t.Omacron = 722;
  44344. t.Racute = 611;
  44345. t.Sacute = 500;
  44346. t.dcaron = 544;
  44347. t.Umacron = 722;
  44348. t.uring = 500;
  44349. t.threesuperior = 300;
  44350. t.Ograve = 722;
  44351. t.Agrave = 611;
  44352. t.Abreve = 611;
  44353. t.multiply = 675;
  44354. t.uacute = 500;
  44355. t.Tcaron = 556;
  44356. t.partialdiff = 476;
  44357. t.ydieresis = 444;
  44358. t.Nacute = 667;
  44359. t.icircumflex = 278;
  44360. t.Ecircumflex = 611;
  44361. t.adieresis = 500;
  44362. t.edieresis = 444;
  44363. t.cacute = 444;
  44364. t.nacute = 500;
  44365. t.umacron = 500;
  44366. t.Ncaron = 667;
  44367. t.Iacute = 333;
  44368. t.plusminus = 675;
  44369. t.brokenbar = 275;
  44370. t.registered = 760;
  44371. t.Gbreve = 722;
  44372. t.Idotaccent = 333;
  44373. t.summation = 600;
  44374. t.Egrave = 611;
  44375. t.racute = 389;
  44376. t.omacron = 500;
  44377. t.Zacute = 556;
  44378. t.Zcaron = 556;
  44379. t.greaterequal = 549;
  44380. t.Eth = 722;
  44381. t.Ccedilla = 667;
  44382. t.lcommaaccent = 278;
  44383. t.tcaron = 300;
  44384. t.eogonek = 444;
  44385. t.Uogonek = 722;
  44386. t.Aacute = 611;
  44387. t.Adieresis = 611;
  44388. t.egrave = 444;
  44389. t.zacute = 389;
  44390. t.iogonek = 278;
  44391. t.Oacute = 722;
  44392. t.oacute = 500;
  44393. t.amacron = 500;
  44394. t.sacute = 389;
  44395. t.idieresis = 278;
  44396. t.Ocircumflex = 722;
  44397. t.Ugrave = 722;
  44398. t.Delta = 612;
  44399. t.thorn = 500;
  44400. t.twosuperior = 300;
  44401. t.Odieresis = 722;
  44402. t.mu = 500;
  44403. t.igrave = 278;
  44404. t.ohungarumlaut = 500;
  44405. t.Eogonek = 611;
  44406. t.dcroat = 500;
  44407. t.threequarters = 750;
  44408. t.Scedilla = 500;
  44409. t.lcaron = 300;
  44410. t.Kcommaaccent = 667;
  44411. t.Lacute = 556;
  44412. t.trademark = 980;
  44413. t.edotaccent = 444;
  44414. t.Igrave = 333;
  44415. t.Imacron = 333;
  44416. t.Lcaron = 611;
  44417. t.onehalf = 750;
  44418. t.lessequal = 549;
  44419. t.ocircumflex = 500;
  44420. t.ntilde = 500;
  44421. t.Uhungarumlaut = 722;
  44422. t.Eacute = 611;
  44423. t.emacron = 444;
  44424. t.gbreve = 500;
  44425. t.onequarter = 750;
  44426. t.Scaron = 500;
  44427. t.Scommaaccent = 500;
  44428. t.Ohungarumlaut = 722;
  44429. t.degree = 400;
  44430. t.ograve = 500;
  44431. t.Ccaron = 667;
  44432. t.ugrave = 500;
  44433. t.radical = 453;
  44434. t.Dcaron = 722;
  44435. t.rcommaaccent = 389;
  44436. t.Ntilde = 667;
  44437. t.otilde = 500;
  44438. t.Rcommaaccent = 611;
  44439. t.Lcommaaccent = 556;
  44440. t.Atilde = 611;
  44441. t.Aogonek = 611;
  44442. t.Aring = 611;
  44443. t.Otilde = 722;
  44444. t.zdotaccent = 389;
  44445. t.Ecaron = 611;
  44446. t.Iogonek = 333;
  44447. t.kcommaaccent = 444;
  44448. t.minus = 675;
  44449. t.Icircumflex = 333;
  44450. t.ncaron = 500;
  44451. t.tcommaaccent = 278;
  44452. t.logicalnot = 675;
  44453. t.odieresis = 500;
  44454. t.udieresis = 500;
  44455. t.notequal = 549;
  44456. t.gcommaaccent = 500;
  44457. t.eth = 500;
  44458. t.zcaron = 389;
  44459. t.ncommaaccent = 500;
  44460. t.onesuperior = 300;
  44461. t.imacron = 278;
  44462. t.Euro = 500;
  44463. });
  44464. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  44465. t.space = 278;
  44466. t.a1 = 974;
  44467. t.a2 = 961;
  44468. t.a202 = 974;
  44469. t.a3 = 980;
  44470. t.a4 = 719;
  44471. t.a5 = 789;
  44472. t.a119 = 790;
  44473. t.a118 = 791;
  44474. t.a117 = 690;
  44475. t.a11 = 960;
  44476. t.a12 = 939;
  44477. t.a13 = 549;
  44478. t.a14 = 855;
  44479. t.a15 = 911;
  44480. t.a16 = 933;
  44481. t.a105 = 911;
  44482. t.a17 = 945;
  44483. t.a18 = 974;
  44484. t.a19 = 755;
  44485. t.a20 = 846;
  44486. t.a21 = 762;
  44487. t.a22 = 761;
  44488. t.a23 = 571;
  44489. t.a24 = 677;
  44490. t.a25 = 763;
  44491. t.a26 = 760;
  44492. t.a27 = 759;
  44493. t.a28 = 754;
  44494. t.a6 = 494;
  44495. t.a7 = 552;
  44496. t.a8 = 537;
  44497. t.a9 = 577;
  44498. t.a10 = 692;
  44499. t.a29 = 786;
  44500. t.a30 = 788;
  44501. t.a31 = 788;
  44502. t.a32 = 790;
  44503. t.a33 = 793;
  44504. t.a34 = 794;
  44505. t.a35 = 816;
  44506. t.a36 = 823;
  44507. t.a37 = 789;
  44508. t.a38 = 841;
  44509. t.a39 = 823;
  44510. t.a40 = 833;
  44511. t.a41 = 816;
  44512. t.a42 = 831;
  44513. t.a43 = 923;
  44514. t.a44 = 744;
  44515. t.a45 = 723;
  44516. t.a46 = 749;
  44517. t.a47 = 790;
  44518. t.a48 = 792;
  44519. t.a49 = 695;
  44520. t.a50 = 776;
  44521. t.a51 = 768;
  44522. t.a52 = 792;
  44523. t.a53 = 759;
  44524. t.a54 = 707;
  44525. t.a55 = 708;
  44526. t.a56 = 682;
  44527. t.a57 = 701;
  44528. t.a58 = 826;
  44529. t.a59 = 815;
  44530. t.a60 = 789;
  44531. t.a61 = 789;
  44532. t.a62 = 707;
  44533. t.a63 = 687;
  44534. t.a64 = 696;
  44535. t.a65 = 689;
  44536. t.a66 = 786;
  44537. t.a67 = 787;
  44538. t.a68 = 713;
  44539. t.a69 = 791;
  44540. t.a70 = 785;
  44541. t.a71 = 791;
  44542. t.a72 = 873;
  44543. t.a73 = 761;
  44544. t.a74 = 762;
  44545. t.a203 = 762;
  44546. t.a75 = 759;
  44547. t.a204 = 759;
  44548. t.a76 = 892;
  44549. t.a77 = 892;
  44550. t.a78 = 788;
  44551. t.a79 = 784;
  44552. t.a81 = 438;
  44553. t.a82 = 138;
  44554. t.a83 = 277;
  44555. t.a84 = 415;
  44556. t.a97 = 392;
  44557. t.a98 = 392;
  44558. t.a99 = 668;
  44559. t.a100 = 668;
  44560. t.a89 = 390;
  44561. t.a90 = 390;
  44562. t.a93 = 317;
  44563. t.a94 = 317;
  44564. t.a91 = 276;
  44565. t.a92 = 276;
  44566. t.a205 = 509;
  44567. t.a85 = 509;
  44568. t.a206 = 410;
  44569. t.a86 = 410;
  44570. t.a87 = 234;
  44571. t.a88 = 234;
  44572. t.a95 = 334;
  44573. t.a96 = 334;
  44574. t.a101 = 732;
  44575. t.a102 = 544;
  44576. t.a103 = 544;
  44577. t.a104 = 910;
  44578. t.a106 = 667;
  44579. t.a107 = 760;
  44580. t.a108 = 760;
  44581. t.a112 = 776;
  44582. t.a111 = 595;
  44583. t.a110 = 694;
  44584. t.a109 = 626;
  44585. t.a120 = 788;
  44586. t.a121 = 788;
  44587. t.a122 = 788;
  44588. t.a123 = 788;
  44589. t.a124 = 788;
  44590. t.a125 = 788;
  44591. t.a126 = 788;
  44592. t.a127 = 788;
  44593. t.a128 = 788;
  44594. t.a129 = 788;
  44595. t.a130 = 788;
  44596. t.a131 = 788;
  44597. t.a132 = 788;
  44598. t.a133 = 788;
  44599. t.a134 = 788;
  44600. t.a135 = 788;
  44601. t.a136 = 788;
  44602. t.a137 = 788;
  44603. t.a138 = 788;
  44604. t.a139 = 788;
  44605. t.a140 = 788;
  44606. t.a141 = 788;
  44607. t.a142 = 788;
  44608. t.a143 = 788;
  44609. t.a144 = 788;
  44610. t.a145 = 788;
  44611. t.a146 = 788;
  44612. t.a147 = 788;
  44613. t.a148 = 788;
  44614. t.a149 = 788;
  44615. t.a150 = 788;
  44616. t.a151 = 788;
  44617. t.a152 = 788;
  44618. t.a153 = 788;
  44619. t.a154 = 788;
  44620. t.a155 = 788;
  44621. t.a156 = 788;
  44622. t.a157 = 788;
  44623. t.a158 = 788;
  44624. t.a159 = 788;
  44625. t.a160 = 894;
  44626. t.a161 = 838;
  44627. t.a163 = 1016;
  44628. t.a164 = 458;
  44629. t.a196 = 748;
  44630. t.a165 = 924;
  44631. t.a192 = 748;
  44632. t.a166 = 918;
  44633. t.a167 = 927;
  44634. t.a168 = 928;
  44635. t.a169 = 928;
  44636. t.a170 = 834;
  44637. t.a171 = 873;
  44638. t.a172 = 828;
  44639. t.a173 = 924;
  44640. t.a162 = 924;
  44641. t.a174 = 917;
  44642. t.a175 = 930;
  44643. t.a176 = 931;
  44644. t.a177 = 463;
  44645. t.a178 = 883;
  44646. t.a179 = 836;
  44647. t.a193 = 836;
  44648. t.a180 = 867;
  44649. t.a199 = 867;
  44650. t.a181 = 696;
  44651. t.a200 = 696;
  44652. t.a182 = 874;
  44653. t.a201 = 874;
  44654. t.a183 = 760;
  44655. t.a184 = 946;
  44656. t.a197 = 771;
  44657. t.a185 = 865;
  44658. t.a194 = 771;
  44659. t.a198 = 888;
  44660. t.a186 = 967;
  44661. t.a195 = 888;
  44662. t.a187 = 831;
  44663. t.a188 = 873;
  44664. t.a189 = 927;
  44665. t.a190 = 970;
  44666. t.a191 = 918;
  44667. });
  44668. });
  44669. exports.getMetrics = getMetrics;
  44670. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  44671. t.Courier = {
  44672. ascent: 629,
  44673. descent: -157,
  44674. capHeight: 562,
  44675. xHeight: -426
  44676. };
  44677. t["Courier-Bold"] = {
  44678. ascent: 629,
  44679. descent: -157,
  44680. capHeight: 562,
  44681. xHeight: 439
  44682. };
  44683. t["Courier-Oblique"] = {
  44684. ascent: 629,
  44685. descent: -157,
  44686. capHeight: 562,
  44687. xHeight: 426
  44688. };
  44689. t["Courier-BoldOblique"] = {
  44690. ascent: 629,
  44691. descent: -157,
  44692. capHeight: 562,
  44693. xHeight: 426
  44694. };
  44695. t.Helvetica = {
  44696. ascent: 718,
  44697. descent: -207,
  44698. capHeight: 718,
  44699. xHeight: 523
  44700. };
  44701. t["Helvetica-Bold"] = {
  44702. ascent: 718,
  44703. descent: -207,
  44704. capHeight: 718,
  44705. xHeight: 532
  44706. };
  44707. t["Helvetica-Oblique"] = {
  44708. ascent: 718,
  44709. descent: -207,
  44710. capHeight: 718,
  44711. xHeight: 523
  44712. };
  44713. t["Helvetica-BoldOblique"] = {
  44714. ascent: 718,
  44715. descent: -207,
  44716. capHeight: 718,
  44717. xHeight: 532
  44718. };
  44719. t["Times-Roman"] = {
  44720. ascent: 683,
  44721. descent: -217,
  44722. capHeight: 662,
  44723. xHeight: 450
  44724. };
  44725. t["Times-Bold"] = {
  44726. ascent: 683,
  44727. descent: -217,
  44728. capHeight: 676,
  44729. xHeight: 461
  44730. };
  44731. t["Times-Italic"] = {
  44732. ascent: 683,
  44733. descent: -217,
  44734. capHeight: 653,
  44735. xHeight: 441
  44736. };
  44737. t["Times-BoldItalic"] = {
  44738. ascent: 683,
  44739. descent: -217,
  44740. capHeight: 669,
  44741. xHeight: 462
  44742. };
  44743. t.Symbol = {
  44744. ascent: Math.NaN,
  44745. descent: Math.NaN,
  44746. capHeight: Math.NaN,
  44747. xHeight: Math.NaN
  44748. };
  44749. t.ZapfDingbats = {
  44750. ascent: Math.NaN,
  44751. descent: Math.NaN,
  44752. capHeight: Math.NaN,
  44753. xHeight: Math.NaN
  44754. };
  44755. });
  44756. exports.getFontBasicMetrics = getFontBasicMetrics;
  44757. /***/ }),
  44758. /* 175 */
  44759. /***/ ((__unused_webpack_module, exports) => {
  44760. "use strict";
  44761. Object.defineProperty(exports, "__esModule", ({
  44762. value: true
  44763. }));
  44764. exports.GlyfTable = void 0;
  44765. const ON_CURVE_POINT = 1 << 0;
  44766. const X_SHORT_VECTOR = 1 << 1;
  44767. const Y_SHORT_VECTOR = 1 << 2;
  44768. const REPEAT_FLAG = 1 << 3;
  44769. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  44770. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  44771. const OVERLAP_SIMPLE = 1 << 6;
  44772. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  44773. const ARGS_ARE_XY_VALUES = 1 << 1;
  44774. const WE_HAVE_A_SCALE = 1 << 3;
  44775. const MORE_COMPONENTS = 1 << 5;
  44776. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  44777. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  44778. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  44779. class GlyfTable {
  44780. constructor(_ref) {
  44781. let {
  44782. glyfTable,
  44783. isGlyphLocationsLong,
  44784. locaTable,
  44785. numGlyphs
  44786. } = _ref;
  44787. this.glyphs = [];
  44788. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  44789. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  44790. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  44791. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  44792. let pos = 0;
  44793. for (let i = 0; i < numGlyphs; i++) {
  44794. pos += offsetSize;
  44795. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  44796. if (next === prev) {
  44797. this.glyphs.push(new Glyph({}));
  44798. continue;
  44799. }
  44800. const glyph = Glyph.parse(prev, glyf);
  44801. this.glyphs.push(glyph);
  44802. prev = next;
  44803. }
  44804. }
  44805. getSize() {
  44806. return this.glyphs.reduce((a, g) => {
  44807. const size = g.getSize();
  44808. return a + (size + 3 & ~3);
  44809. }, 0);
  44810. }
  44811. write() {
  44812. const totalSize = this.getSize();
  44813. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  44814. const isLocationLong = totalSize > 0x1fffe;
  44815. const offsetSize = isLocationLong ? 4 : 2;
  44816. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  44817. if (isLocationLong) {
  44818. locaTable.setUint32(0, 0);
  44819. } else {
  44820. locaTable.setUint16(0, 0);
  44821. }
  44822. let pos = 0;
  44823. let locaIndex = 0;
  44824. for (const glyph of this.glyphs) {
  44825. pos += glyph.write(pos, glyfTable);
  44826. pos = pos + 3 & ~3;
  44827. locaIndex += offsetSize;
  44828. if (isLocationLong) {
  44829. locaTable.setUint32(locaIndex, pos);
  44830. } else {
  44831. locaTable.setUint16(locaIndex, pos >> 1);
  44832. }
  44833. }
  44834. return {
  44835. isLocationLong,
  44836. loca: new Uint8Array(locaTable.buffer),
  44837. glyf: new Uint8Array(glyfTable.buffer)
  44838. };
  44839. }
  44840. scale(factors) {
  44841. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  44842. this.glyphs[i].scale(factors[i]);
  44843. }
  44844. }
  44845. }
  44846. exports.GlyfTable = GlyfTable;
  44847. class Glyph {
  44848. constructor(_ref2) {
  44849. let {
  44850. header = null,
  44851. simple = null,
  44852. composites = null
  44853. } = _ref2;
  44854. this.header = header;
  44855. this.simple = simple;
  44856. this.composites = composites;
  44857. }
  44858. static parse(pos, glyf) {
  44859. const [read, header] = GlyphHeader.parse(pos, glyf);
  44860. pos += read;
  44861. if (header.numberOfContours < 0) {
  44862. const composites = [];
  44863. while (true) {
  44864. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  44865. pos += n;
  44866. composites.push(composite);
  44867. if (!(composite.flags & MORE_COMPONENTS)) {
  44868. break;
  44869. }
  44870. }
  44871. return new Glyph({
  44872. header,
  44873. composites
  44874. });
  44875. }
  44876. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  44877. return new Glyph({
  44878. header,
  44879. simple
  44880. });
  44881. }
  44882. getSize() {
  44883. if (!this.header) {
  44884. return 0;
  44885. }
  44886. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  44887. return this.header.getSize() + size;
  44888. }
  44889. write(pos, buf) {
  44890. if (!this.header) {
  44891. return 0;
  44892. }
  44893. const spos = pos;
  44894. pos += this.header.write(pos, buf);
  44895. if (this.simple) {
  44896. pos += this.simple.write(pos, buf);
  44897. } else {
  44898. for (const composite of this.composites) {
  44899. pos += composite.write(pos, buf);
  44900. }
  44901. }
  44902. return pos - spos;
  44903. }
  44904. scale(factor) {
  44905. if (!this.header) {
  44906. return;
  44907. }
  44908. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  44909. this.header.scale(xMiddle, factor);
  44910. if (this.simple) {
  44911. this.simple.scale(xMiddle, factor);
  44912. } else {
  44913. for (const composite of this.composites) {
  44914. composite.scale(xMiddle, factor);
  44915. }
  44916. }
  44917. }
  44918. }
  44919. class GlyphHeader {
  44920. constructor(_ref3) {
  44921. let {
  44922. numberOfContours,
  44923. xMin,
  44924. yMin,
  44925. xMax,
  44926. yMax
  44927. } = _ref3;
  44928. this.numberOfContours = numberOfContours;
  44929. this.xMin = xMin;
  44930. this.yMin = yMin;
  44931. this.xMax = xMax;
  44932. this.yMax = yMax;
  44933. }
  44934. static parse(pos, glyf) {
  44935. return [10, new GlyphHeader({
  44936. numberOfContours: glyf.getInt16(pos),
  44937. xMin: glyf.getInt16(pos + 2),
  44938. yMin: glyf.getInt16(pos + 4),
  44939. xMax: glyf.getInt16(pos + 6),
  44940. yMax: glyf.getInt16(pos + 8)
  44941. })];
  44942. }
  44943. getSize() {
  44944. return 10;
  44945. }
  44946. write(pos, buf) {
  44947. buf.setInt16(pos, this.numberOfContours);
  44948. buf.setInt16(pos + 2, this.xMin);
  44949. buf.setInt16(pos + 4, this.yMin);
  44950. buf.setInt16(pos + 6, this.xMax);
  44951. buf.setInt16(pos + 8, this.yMax);
  44952. return 10;
  44953. }
  44954. scale(x, factor) {
  44955. this.xMin = Math.round(x + (this.xMin - x) * factor);
  44956. this.xMax = Math.round(x + (this.xMax - x) * factor);
  44957. }
  44958. }
  44959. class Contour {
  44960. constructor(_ref4) {
  44961. let {
  44962. flags,
  44963. xCoordinates,
  44964. yCoordinates
  44965. } = _ref4;
  44966. this.xCoordinates = xCoordinates;
  44967. this.yCoordinates = yCoordinates;
  44968. this.flags = flags;
  44969. }
  44970. }
  44971. class SimpleGlyph {
  44972. constructor(_ref5) {
  44973. let {
  44974. contours,
  44975. instructions
  44976. } = _ref5;
  44977. this.contours = contours;
  44978. this.instructions = instructions;
  44979. }
  44980. static parse(pos, glyf, numberOfContours) {
  44981. const endPtsOfContours = [];
  44982. for (let i = 0; i < numberOfContours; i++) {
  44983. const endPt = glyf.getUint16(pos);
  44984. pos += 2;
  44985. endPtsOfContours.push(endPt);
  44986. }
  44987. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  44988. const instructionLength = glyf.getUint16(pos);
  44989. pos += 2;
  44990. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  44991. pos += instructionLength;
  44992. const flags = [];
  44993. for (let i = 0; i < numberOfPt; pos++, i++) {
  44994. let flag = glyf.getUint8(pos);
  44995. flags.push(flag);
  44996. if (flag & REPEAT_FLAG) {
  44997. const count = glyf.getUint8(++pos);
  44998. flag ^= REPEAT_FLAG;
  44999. for (let m = 0; m < count; m++) {
  45000. flags.push(flag);
  45001. }
  45002. i += count;
  45003. }
  45004. }
  45005. const allXCoordinates = [];
  45006. let xCoordinates = [];
  45007. let yCoordinates = [];
  45008. let pointFlags = [];
  45009. const contours = [];
  45010. let endPtsOfContoursIndex = 0;
  45011. let lastCoordinate = 0;
  45012. for (let i = 0; i < numberOfPt; i++) {
  45013. const flag = flags[i];
  45014. if (flag & X_SHORT_VECTOR) {
  45015. const x = glyf.getUint8(pos++);
  45016. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  45017. xCoordinates.push(lastCoordinate);
  45018. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  45019. xCoordinates.push(lastCoordinate);
  45020. } else {
  45021. lastCoordinate += glyf.getInt16(pos);
  45022. pos += 2;
  45023. xCoordinates.push(lastCoordinate);
  45024. }
  45025. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  45026. endPtsOfContoursIndex++;
  45027. allXCoordinates.push(xCoordinates);
  45028. xCoordinates = [];
  45029. }
  45030. }
  45031. lastCoordinate = 0;
  45032. endPtsOfContoursIndex = 0;
  45033. for (let i = 0; i < numberOfPt; i++) {
  45034. const flag = flags[i];
  45035. if (flag & Y_SHORT_VECTOR) {
  45036. const y = glyf.getUint8(pos++);
  45037. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  45038. yCoordinates.push(lastCoordinate);
  45039. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  45040. yCoordinates.push(lastCoordinate);
  45041. } else {
  45042. lastCoordinate += glyf.getInt16(pos);
  45043. pos += 2;
  45044. yCoordinates.push(lastCoordinate);
  45045. }
  45046. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  45047. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  45048. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  45049. endPtsOfContoursIndex++;
  45050. contours.push(new Contour({
  45051. flags: pointFlags,
  45052. xCoordinates,
  45053. yCoordinates
  45054. }));
  45055. yCoordinates = [];
  45056. pointFlags = [];
  45057. }
  45058. }
  45059. return new SimpleGlyph({
  45060. contours,
  45061. instructions
  45062. });
  45063. }
  45064. getSize() {
  45065. let size = this.contours.length * 2 + 2 + this.instructions.length;
  45066. let lastX = 0;
  45067. let lastY = 0;
  45068. for (const contour of this.contours) {
  45069. size += contour.flags.length;
  45070. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45071. const x = contour.xCoordinates[i];
  45072. const y = contour.yCoordinates[i];
  45073. let abs = Math.abs(x - lastX);
  45074. if (abs > 255) {
  45075. size += 2;
  45076. } else if (abs > 0) {
  45077. size += 1;
  45078. }
  45079. lastX = x;
  45080. abs = Math.abs(y - lastY);
  45081. if (abs > 255) {
  45082. size += 2;
  45083. } else if (abs > 0) {
  45084. size += 1;
  45085. }
  45086. lastY = y;
  45087. }
  45088. }
  45089. return size;
  45090. }
  45091. write(pos, buf) {
  45092. const spos = pos;
  45093. const xCoordinates = [];
  45094. const yCoordinates = [];
  45095. const flags = [];
  45096. let lastX = 0;
  45097. let lastY = 0;
  45098. for (const contour of this.contours) {
  45099. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45100. let flag = contour.flags[i];
  45101. const x = contour.xCoordinates[i];
  45102. let delta = x - lastX;
  45103. if (delta === 0) {
  45104. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  45105. xCoordinates.push(0);
  45106. } else {
  45107. const abs = Math.abs(delta);
  45108. if (abs <= 255) {
  45109. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  45110. xCoordinates.push(abs);
  45111. } else {
  45112. xCoordinates.push(delta);
  45113. }
  45114. }
  45115. lastX = x;
  45116. const y = contour.yCoordinates[i];
  45117. delta = y - lastY;
  45118. if (delta === 0) {
  45119. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  45120. yCoordinates.push(0);
  45121. } else {
  45122. const abs = Math.abs(delta);
  45123. if (abs <= 255) {
  45124. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  45125. yCoordinates.push(abs);
  45126. } else {
  45127. yCoordinates.push(delta);
  45128. }
  45129. }
  45130. lastY = y;
  45131. flags.push(flag);
  45132. }
  45133. buf.setUint16(pos, xCoordinates.length - 1);
  45134. pos += 2;
  45135. }
  45136. buf.setUint16(pos, this.instructions.length);
  45137. pos += 2;
  45138. if (this.instructions.length) {
  45139. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45140. pos += this.instructions.length;
  45141. }
  45142. for (const flag of flags) {
  45143. buf.setUint8(pos++, flag);
  45144. }
  45145. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  45146. const x = xCoordinates[i];
  45147. const flag = flags[i];
  45148. if (flag & X_SHORT_VECTOR) {
  45149. buf.setUint8(pos++, x);
  45150. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  45151. buf.setInt16(pos, x);
  45152. pos += 2;
  45153. }
  45154. }
  45155. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  45156. const y = yCoordinates[i];
  45157. const flag = flags[i];
  45158. if (flag & Y_SHORT_VECTOR) {
  45159. buf.setUint8(pos++, y);
  45160. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  45161. buf.setInt16(pos, y);
  45162. pos += 2;
  45163. }
  45164. }
  45165. return pos - spos;
  45166. }
  45167. scale(x, factor) {
  45168. for (const contour of this.contours) {
  45169. if (contour.xCoordinates.length === 0) {
  45170. continue;
  45171. }
  45172. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  45173. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  45174. }
  45175. }
  45176. }
  45177. }
  45178. class CompositeGlyph {
  45179. constructor(_ref6) {
  45180. let {
  45181. flags,
  45182. glyphIndex,
  45183. argument1,
  45184. argument2,
  45185. transf,
  45186. instructions
  45187. } = _ref6;
  45188. this.flags = flags;
  45189. this.glyphIndex = glyphIndex;
  45190. this.argument1 = argument1;
  45191. this.argument2 = argument2;
  45192. this.transf = transf;
  45193. this.instructions = instructions;
  45194. }
  45195. static parse(pos, glyf) {
  45196. const spos = pos;
  45197. const transf = [];
  45198. let flags = glyf.getUint16(pos);
  45199. const glyphIndex = glyf.getUint16(pos + 2);
  45200. pos += 4;
  45201. let argument1, argument2;
  45202. if (flags & ARG_1_AND_2_ARE_WORDS) {
  45203. if (flags & ARGS_ARE_XY_VALUES) {
  45204. argument1 = glyf.getInt16(pos);
  45205. argument2 = glyf.getInt16(pos + 2);
  45206. } else {
  45207. argument1 = glyf.getUint16(pos);
  45208. argument2 = glyf.getUint16(pos + 2);
  45209. }
  45210. pos += 4;
  45211. flags ^= ARG_1_AND_2_ARE_WORDS;
  45212. } else {
  45213. if (flags & ARGS_ARE_XY_VALUES) {
  45214. argument1 = glyf.getInt8(pos);
  45215. argument2 = glyf.getInt8(pos + 1);
  45216. } else {
  45217. argument1 = glyf.getUint8(pos);
  45218. argument2 = glyf.getUint8(pos + 1);
  45219. }
  45220. pos += 2;
  45221. }
  45222. if (flags & WE_HAVE_A_SCALE) {
  45223. transf.push(glyf.getUint16(pos));
  45224. pos += 2;
  45225. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  45226. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  45227. pos += 4;
  45228. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  45229. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  45230. pos += 8;
  45231. }
  45232. let instructions = null;
  45233. if (flags & WE_HAVE_INSTRUCTIONS) {
  45234. const instructionLength = glyf.getUint16(pos);
  45235. pos += 2;
  45236. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  45237. pos += instructionLength;
  45238. }
  45239. return [pos - spos, new CompositeGlyph({
  45240. flags,
  45241. glyphIndex,
  45242. argument1,
  45243. argument2,
  45244. transf,
  45245. instructions
  45246. })];
  45247. }
  45248. getSize() {
  45249. let size = 2 + 2 + this.transf.length * 2;
  45250. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45251. size += 2 + this.instructions.length;
  45252. }
  45253. size += 2;
  45254. if (this.flags & 2) {
  45255. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45256. size += 2;
  45257. }
  45258. } else {
  45259. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45260. size += 2;
  45261. }
  45262. }
  45263. return size;
  45264. }
  45265. write(pos, buf) {
  45266. const spos = pos;
  45267. if (this.flags & ARGS_ARE_XY_VALUES) {
  45268. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  45269. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45270. }
  45271. } else {
  45272. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  45273. this.flags |= ARG_1_AND_2_ARE_WORDS;
  45274. }
  45275. }
  45276. buf.setUint16(pos, this.flags);
  45277. buf.setUint16(pos + 2, this.glyphIndex);
  45278. pos += 4;
  45279. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  45280. if (this.flags & ARGS_ARE_XY_VALUES) {
  45281. buf.setInt16(pos, this.argument1);
  45282. buf.setInt16(pos + 2, this.argument2);
  45283. } else {
  45284. buf.setUint16(pos, this.argument1);
  45285. buf.setUint16(pos + 2, this.argument2);
  45286. }
  45287. pos += 4;
  45288. } else {
  45289. buf.setUint8(pos, this.argument1);
  45290. buf.setUint8(pos + 1, this.argument2);
  45291. pos += 2;
  45292. }
  45293. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  45294. buf.setUint16(pos, this.instructions.length);
  45295. pos += 2;
  45296. if (this.instructions.length) {
  45297. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  45298. pos += this.instructions.length;
  45299. }
  45300. }
  45301. return pos - spos;
  45302. }
  45303. scale(x, factor) {}
  45304. }
  45305. /***/ }),
  45306. /* 176 */
  45307. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45308. "use strict";
  45309. Object.defineProperty(exports, "__esModule", ({
  45310. value: true
  45311. }));
  45312. exports.OpenTypeFileBuilder = void 0;
  45313. var _core_utils = __w_pdfjs_require__(135);
  45314. var _util = __w_pdfjs_require__(2);
  45315. function writeInt16(dest, offset, num) {
  45316. dest[offset] = num >> 8 & 0xff;
  45317. dest[offset + 1] = num & 0xff;
  45318. }
  45319. function writeInt32(dest, offset, num) {
  45320. dest[offset] = num >> 24 & 0xff;
  45321. dest[offset + 1] = num >> 16 & 0xff;
  45322. dest[offset + 2] = num >> 8 & 0xff;
  45323. dest[offset + 3] = num & 0xff;
  45324. }
  45325. function writeData(dest, offset, data) {
  45326. if (data instanceof Uint8Array) {
  45327. dest.set(data, offset);
  45328. } else if (typeof data === "string") {
  45329. for (let i = 0, ii = data.length; i < ii; i++) {
  45330. dest[offset++] = data.charCodeAt(i) & 0xff;
  45331. }
  45332. } else {
  45333. for (const num of data) {
  45334. dest[offset++] = num & 0xff;
  45335. }
  45336. }
  45337. }
  45338. const OTF_HEADER_SIZE = 12;
  45339. const OTF_TABLE_ENTRY_SIZE = 16;
  45340. class OpenTypeFileBuilder {
  45341. constructor(sfnt) {
  45342. this.sfnt = sfnt;
  45343. this.tables = Object.create(null);
  45344. }
  45345. static getSearchParams(entriesCount, entrySize) {
  45346. let maxPower2 = 1,
  45347. log2 = 0;
  45348. while ((maxPower2 ^ entriesCount) > maxPower2) {
  45349. maxPower2 <<= 1;
  45350. log2++;
  45351. }
  45352. const searchRange = maxPower2 * entrySize;
  45353. return {
  45354. range: searchRange,
  45355. entry: log2,
  45356. rangeShift: entrySize * entriesCount - searchRange
  45357. };
  45358. }
  45359. toArray() {
  45360. let sfnt = this.sfnt;
  45361. const tables = this.tables;
  45362. const tablesNames = Object.keys(tables);
  45363. tablesNames.sort();
  45364. const numTables = tablesNames.length;
  45365. let i, j, jj, table, tableName;
  45366. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  45367. const tableOffsets = [offset];
  45368. for (i = 0; i < numTables; i++) {
  45369. table = tables[tablesNames[i]];
  45370. const paddedLength = (table.length + 3 & ~3) >>> 0;
  45371. offset += paddedLength;
  45372. tableOffsets.push(offset);
  45373. }
  45374. const file = new Uint8Array(offset);
  45375. for (i = 0; i < numTables; i++) {
  45376. table = tables[tablesNames[i]];
  45377. writeData(file, tableOffsets[i], table);
  45378. }
  45379. if (sfnt === "true") {
  45380. sfnt = (0, _util.string32)(0x00010000);
  45381. }
  45382. file[0] = sfnt.charCodeAt(0) & 0xff;
  45383. file[1] = sfnt.charCodeAt(1) & 0xff;
  45384. file[2] = sfnt.charCodeAt(2) & 0xff;
  45385. file[3] = sfnt.charCodeAt(3) & 0xff;
  45386. writeInt16(file, 4, numTables);
  45387. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  45388. writeInt16(file, 6, searchParams.range);
  45389. writeInt16(file, 8, searchParams.entry);
  45390. writeInt16(file, 10, searchParams.rangeShift);
  45391. offset = OTF_HEADER_SIZE;
  45392. for (i = 0; i < numTables; i++) {
  45393. tableName = tablesNames[i];
  45394. file[offset] = tableName.charCodeAt(0) & 0xff;
  45395. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  45396. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  45397. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  45398. let checksum = 0;
  45399. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  45400. const quad = (0, _core_utils.readUint32)(file, j);
  45401. checksum = checksum + quad >>> 0;
  45402. }
  45403. writeInt32(file, offset + 4, checksum);
  45404. writeInt32(file, offset + 8, tableOffsets[i]);
  45405. writeInt32(file, offset + 12, tables[tableName].length);
  45406. offset += OTF_TABLE_ENTRY_SIZE;
  45407. }
  45408. return file;
  45409. }
  45410. addTable(tag, data) {
  45411. if (tag in this.tables) {
  45412. throw new Error("Table " + tag + " already exists");
  45413. }
  45414. this.tables[tag] = data;
  45415. }
  45416. }
  45417. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  45418. /***/ }),
  45419. /* 177 */
  45420. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45421. "use strict";
  45422. Object.defineProperty(exports, "__esModule", ({
  45423. value: true
  45424. }));
  45425. exports.Type1Font = void 0;
  45426. var _cff_parser = __w_pdfjs_require__(164);
  45427. var _util = __w_pdfjs_require__(2);
  45428. var _fonts_utils = __w_pdfjs_require__(167);
  45429. var _core_utils = __w_pdfjs_require__(135);
  45430. var _stream = __w_pdfjs_require__(139);
  45431. var _type1_parser = __w_pdfjs_require__(178);
  45432. function findBlock(streamBytes, signature, startIndex) {
  45433. const streamBytesLength = streamBytes.length;
  45434. const signatureLength = signature.length;
  45435. const scanLength = streamBytesLength - signatureLength;
  45436. let i = startIndex,
  45437. found = false;
  45438. while (i < scanLength) {
  45439. let j = 0;
  45440. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  45441. j++;
  45442. }
  45443. if (j >= signatureLength) {
  45444. i += j;
  45445. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  45446. i++;
  45447. }
  45448. found = true;
  45449. break;
  45450. }
  45451. i++;
  45452. }
  45453. return {
  45454. found,
  45455. length: i
  45456. };
  45457. }
  45458. function getHeaderBlock(stream, suggestedLength) {
  45459. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  45460. const streamStartPos = stream.pos;
  45461. let headerBytes, headerBytesLength, block;
  45462. try {
  45463. headerBytes = stream.getBytes(suggestedLength);
  45464. headerBytesLength = headerBytes.length;
  45465. } catch (ex) {}
  45466. if (headerBytesLength === suggestedLength) {
  45467. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  45468. if (block.found && block.length === suggestedLength) {
  45469. return {
  45470. stream: new _stream.Stream(headerBytes),
  45471. length: suggestedLength
  45472. };
  45473. }
  45474. }
  45475. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  45476. stream.pos = streamStartPos;
  45477. const SCAN_BLOCK_LENGTH = 2048;
  45478. let actualLength;
  45479. while (true) {
  45480. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  45481. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  45482. if (block.length === 0) {
  45483. break;
  45484. }
  45485. stream.pos += block.length;
  45486. if (block.found) {
  45487. actualLength = stream.pos - streamStartPos;
  45488. break;
  45489. }
  45490. }
  45491. stream.pos = streamStartPos;
  45492. if (actualLength) {
  45493. return {
  45494. stream: new _stream.Stream(stream.getBytes(actualLength)),
  45495. length: actualLength
  45496. };
  45497. }
  45498. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  45499. return {
  45500. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  45501. length: suggestedLength
  45502. };
  45503. }
  45504. function getEexecBlock(stream, suggestedLength) {
  45505. const eexecBytes = stream.getBytes();
  45506. if (eexecBytes.length === 0) {
  45507. throw new _util.FormatError("getEexecBlock - no font program found.");
  45508. }
  45509. return {
  45510. stream: new _stream.Stream(eexecBytes),
  45511. length: eexecBytes.length
  45512. };
  45513. }
  45514. class Type1Font {
  45515. constructor(name, file, properties) {
  45516. const PFB_HEADER_SIZE = 6;
  45517. let headerBlockLength = properties.length1;
  45518. let eexecBlockLength = properties.length2;
  45519. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  45520. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  45521. if (pfbHeaderPresent) {
  45522. file.skip(PFB_HEADER_SIZE);
  45523. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45524. }
  45525. const headerBlock = getHeaderBlock(file, headerBlockLength);
  45526. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45527. headerBlockParser.extractFontHeader(properties);
  45528. if (pfbHeaderPresent) {
  45529. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  45530. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  45531. }
  45532. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  45533. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  45534. const data = eexecBlockParser.extractFontProgram(properties);
  45535. for (const key in data.properties) {
  45536. properties[key] = data.properties[key];
  45537. }
  45538. const charstrings = data.charstrings;
  45539. const type2Charstrings = this.getType2Charstrings(charstrings);
  45540. const subrs = this.getType2Subrs(data.subrs);
  45541. this.charstrings = charstrings;
  45542. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  45543. this.seacs = this.getSeacs(data.charstrings);
  45544. }
  45545. get numGlyphs() {
  45546. return this.charstrings.length + 1;
  45547. }
  45548. getCharset() {
  45549. const charset = [".notdef"];
  45550. for (const {
  45551. glyphName
  45552. } of this.charstrings) {
  45553. charset.push(glyphName);
  45554. }
  45555. return charset;
  45556. }
  45557. getGlyphMapping(properties) {
  45558. const charstrings = this.charstrings;
  45559. if (properties.composite) {
  45560. const charCodeToGlyphId = Object.create(null);
  45561. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  45562. const charCode = properties.cMap.charCodeOf(glyphId);
  45563. charCodeToGlyphId[charCode] = glyphId + 1;
  45564. }
  45565. return charCodeToGlyphId;
  45566. }
  45567. const glyphNames = [".notdef"];
  45568. let builtInEncoding, glyphId;
  45569. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  45570. glyphNames.push(charstrings[glyphId].glyphName);
  45571. }
  45572. const encoding = properties.builtInEncoding;
  45573. if (encoding) {
  45574. builtInEncoding = Object.create(null);
  45575. for (const charCode in encoding) {
  45576. glyphId = glyphNames.indexOf(encoding[charCode]);
  45577. if (glyphId >= 0) {
  45578. builtInEncoding[charCode] = glyphId;
  45579. }
  45580. }
  45581. }
  45582. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  45583. }
  45584. hasGlyphId(id) {
  45585. if (id < 0 || id >= this.numGlyphs) {
  45586. return false;
  45587. }
  45588. if (id === 0) {
  45589. return true;
  45590. }
  45591. const glyph = this.charstrings[id - 1];
  45592. return glyph.charstring.length > 0;
  45593. }
  45594. getSeacs(charstrings) {
  45595. const seacMap = [];
  45596. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  45597. const charstring = charstrings[i];
  45598. if (charstring.seac) {
  45599. seacMap[i + 1] = charstring.seac;
  45600. }
  45601. }
  45602. return seacMap;
  45603. }
  45604. getType2Charstrings(type1Charstrings) {
  45605. const type2Charstrings = [];
  45606. for (const type1Charstring of type1Charstrings) {
  45607. type2Charstrings.push(type1Charstring.charstring);
  45608. }
  45609. return type2Charstrings;
  45610. }
  45611. getType2Subrs(type1Subrs) {
  45612. let bias = 0;
  45613. const count = type1Subrs.length;
  45614. if (count < 1133) {
  45615. bias = 107;
  45616. } else if (count < 33769) {
  45617. bias = 1131;
  45618. } else {
  45619. bias = 32768;
  45620. }
  45621. const type2Subrs = [];
  45622. let i;
  45623. for (i = 0; i < bias; i++) {
  45624. type2Subrs.push([0x0b]);
  45625. }
  45626. for (i = 0; i < count; i++) {
  45627. type2Subrs.push(type1Subrs[i]);
  45628. }
  45629. return type2Subrs;
  45630. }
  45631. wrap(name, glyphs, charstrings, subrs, properties) {
  45632. const cff = new _cff_parser.CFF();
  45633. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  45634. cff.names = [name];
  45635. const topDict = new _cff_parser.CFFTopDict();
  45636. topDict.setByName("version", 391);
  45637. topDict.setByName("Notice", 392);
  45638. topDict.setByName("FullName", 393);
  45639. topDict.setByName("FamilyName", 394);
  45640. topDict.setByName("Weight", 395);
  45641. topDict.setByName("Encoding", null);
  45642. topDict.setByName("FontMatrix", properties.fontMatrix);
  45643. topDict.setByName("FontBBox", properties.bbox);
  45644. topDict.setByName("charset", null);
  45645. topDict.setByName("CharStrings", null);
  45646. topDict.setByName("Private", null);
  45647. cff.topDict = topDict;
  45648. const strings = new _cff_parser.CFFStrings();
  45649. strings.add("Version 0.11");
  45650. strings.add("See original notice");
  45651. strings.add(name);
  45652. strings.add(name);
  45653. strings.add("Medium");
  45654. cff.strings = strings;
  45655. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  45656. const count = glyphs.length;
  45657. const charsetArray = [".notdef"];
  45658. let i, ii;
  45659. for (i = 0; i < count; i++) {
  45660. const glyphName = charstrings[i].glyphName;
  45661. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  45662. if (index === -1) {
  45663. strings.add(glyphName);
  45664. }
  45665. charsetArray.push(glyphName);
  45666. }
  45667. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  45668. const charStringsIndex = new _cff_parser.CFFIndex();
  45669. charStringsIndex.add([0x8b, 0x0e]);
  45670. for (i = 0; i < count; i++) {
  45671. charStringsIndex.add(glyphs[i]);
  45672. }
  45673. cff.charStrings = charStringsIndex;
  45674. const privateDict = new _cff_parser.CFFPrivateDict();
  45675. privateDict.setByName("Subrs", null);
  45676. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  45677. for (i = 0, ii = fields.length; i < ii; i++) {
  45678. const field = fields[i];
  45679. if (!(field in properties.privateData)) {
  45680. continue;
  45681. }
  45682. const value = properties.privateData[field];
  45683. if (Array.isArray(value)) {
  45684. for (let j = value.length - 1; j > 0; j--) {
  45685. value[j] -= value[j - 1];
  45686. }
  45687. }
  45688. privateDict.setByName(field, value);
  45689. }
  45690. cff.topDict.privateDict = privateDict;
  45691. const subrIndex = new _cff_parser.CFFIndex();
  45692. for (i = 0, ii = subrs.length; i < ii; i++) {
  45693. subrIndex.add(subrs[i]);
  45694. }
  45695. privateDict.subrsIndex = subrIndex;
  45696. const compiler = new _cff_parser.CFFCompiler(cff);
  45697. return compiler.compile();
  45698. }
  45699. }
  45700. exports.Type1Font = Type1Font;
  45701. /***/ }),
  45702. /* 178 */
  45703. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45704. "use strict";
  45705. Object.defineProperty(exports, "__esModule", ({
  45706. value: true
  45707. }));
  45708. exports.Type1Parser = void 0;
  45709. var _encodings = __w_pdfjs_require__(166);
  45710. var _core_utils = __w_pdfjs_require__(135);
  45711. var _stream = __w_pdfjs_require__(139);
  45712. var _util = __w_pdfjs_require__(2);
  45713. const HINTING_ENABLED = false;
  45714. const COMMAND_MAP = {
  45715. hstem: [1],
  45716. vstem: [3],
  45717. vmoveto: [4],
  45718. rlineto: [5],
  45719. hlineto: [6],
  45720. vlineto: [7],
  45721. rrcurveto: [8],
  45722. callsubr: [10],
  45723. flex: [12, 35],
  45724. drop: [12, 18],
  45725. endchar: [14],
  45726. rmoveto: [21],
  45727. hmoveto: [22],
  45728. vhcurveto: [30],
  45729. hvcurveto: [31]
  45730. };
  45731. class Type1CharString {
  45732. constructor() {
  45733. this.width = 0;
  45734. this.lsb = 0;
  45735. this.flexing = false;
  45736. this.output = [];
  45737. this.stack = [];
  45738. }
  45739. convert(encoded, subrs, seacAnalysisEnabled) {
  45740. const count = encoded.length;
  45741. let error = false;
  45742. let wx, sbx, subrNumber;
  45743. for (let i = 0; i < count; i++) {
  45744. let value = encoded[i];
  45745. if (value < 32) {
  45746. if (value === 12) {
  45747. value = (value << 8) + encoded[++i];
  45748. }
  45749. switch (value) {
  45750. case 1:
  45751. if (!HINTING_ENABLED) {
  45752. this.stack = [];
  45753. break;
  45754. }
  45755. error = this.executeCommand(2, COMMAND_MAP.hstem);
  45756. break;
  45757. case 3:
  45758. if (!HINTING_ENABLED) {
  45759. this.stack = [];
  45760. break;
  45761. }
  45762. error = this.executeCommand(2, COMMAND_MAP.vstem);
  45763. break;
  45764. case 4:
  45765. if (this.flexing) {
  45766. if (this.stack.length < 1) {
  45767. error = true;
  45768. break;
  45769. }
  45770. const dy = this.stack.pop();
  45771. this.stack.push(0, dy);
  45772. break;
  45773. }
  45774. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  45775. break;
  45776. case 5:
  45777. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  45778. break;
  45779. case 6:
  45780. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  45781. break;
  45782. case 7:
  45783. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  45784. break;
  45785. case 8:
  45786. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  45787. break;
  45788. case 9:
  45789. this.stack = [];
  45790. break;
  45791. case 10:
  45792. if (this.stack.length < 1) {
  45793. error = true;
  45794. break;
  45795. }
  45796. subrNumber = this.stack.pop();
  45797. if (!subrs[subrNumber]) {
  45798. error = true;
  45799. break;
  45800. }
  45801. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  45802. break;
  45803. case 11:
  45804. return error;
  45805. case 13:
  45806. if (this.stack.length < 2) {
  45807. error = true;
  45808. break;
  45809. }
  45810. wx = this.stack.pop();
  45811. sbx = this.stack.pop();
  45812. this.lsb = sbx;
  45813. this.width = wx;
  45814. this.stack.push(wx, sbx);
  45815. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  45816. break;
  45817. case 14:
  45818. this.output.push(COMMAND_MAP.endchar[0]);
  45819. break;
  45820. case 21:
  45821. if (this.flexing) {
  45822. break;
  45823. }
  45824. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  45825. break;
  45826. case 22:
  45827. if (this.flexing) {
  45828. this.stack.push(0);
  45829. break;
  45830. }
  45831. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  45832. break;
  45833. case 30:
  45834. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  45835. break;
  45836. case 31:
  45837. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  45838. break;
  45839. case (12 << 8) + 0:
  45840. this.stack = [];
  45841. break;
  45842. case (12 << 8) + 1:
  45843. if (!HINTING_ENABLED) {
  45844. this.stack = [];
  45845. break;
  45846. }
  45847. error = this.executeCommand(2, COMMAND_MAP.vstem);
  45848. break;
  45849. case (12 << 8) + 2:
  45850. if (!HINTING_ENABLED) {
  45851. this.stack = [];
  45852. break;
  45853. }
  45854. error = this.executeCommand(2, COMMAND_MAP.hstem);
  45855. break;
  45856. case (12 << 8) + 6:
  45857. if (seacAnalysisEnabled) {
  45858. const asb = this.stack.at(-5);
  45859. this.seac = this.stack.splice(-4, 4);
  45860. this.seac[0] += this.lsb - asb;
  45861. error = this.executeCommand(0, COMMAND_MAP.endchar);
  45862. } else {
  45863. error = this.executeCommand(4, COMMAND_MAP.endchar);
  45864. }
  45865. break;
  45866. case (12 << 8) + 7:
  45867. if (this.stack.length < 4) {
  45868. error = true;
  45869. break;
  45870. }
  45871. this.stack.pop();
  45872. wx = this.stack.pop();
  45873. const sby = this.stack.pop();
  45874. sbx = this.stack.pop();
  45875. this.lsb = sbx;
  45876. this.width = wx;
  45877. this.stack.push(wx, sbx, sby);
  45878. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  45879. break;
  45880. case (12 << 8) + 12:
  45881. if (this.stack.length < 2) {
  45882. error = true;
  45883. break;
  45884. }
  45885. const num2 = this.stack.pop();
  45886. const num1 = this.stack.pop();
  45887. this.stack.push(num1 / num2);
  45888. break;
  45889. case (12 << 8) + 16:
  45890. if (this.stack.length < 2) {
  45891. error = true;
  45892. break;
  45893. }
  45894. subrNumber = this.stack.pop();
  45895. const numArgs = this.stack.pop();
  45896. if (subrNumber === 0 && numArgs === 3) {
  45897. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  45898. 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]);
  45899. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  45900. this.flexing = false;
  45901. this.stack.push(flexArgs[15], flexArgs[16]);
  45902. } else if (subrNumber === 1 && numArgs === 0) {
  45903. this.flexing = true;
  45904. }
  45905. break;
  45906. case (12 << 8) + 17:
  45907. break;
  45908. case (12 << 8) + 33:
  45909. this.stack = [];
  45910. break;
  45911. default:
  45912. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  45913. break;
  45914. }
  45915. if (error) {
  45916. break;
  45917. }
  45918. continue;
  45919. } else if (value <= 246) {
  45920. value -= 139;
  45921. } else if (value <= 250) {
  45922. value = (value - 247) * 256 + encoded[++i] + 108;
  45923. } else if (value <= 254) {
  45924. value = -((value - 251) * 256) - encoded[++i] - 108;
  45925. } else {
  45926. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  45927. }
  45928. this.stack.push(value);
  45929. }
  45930. return error;
  45931. }
  45932. executeCommand(howManyArgs, command, keepStack) {
  45933. const stackLength = this.stack.length;
  45934. if (howManyArgs > stackLength) {
  45935. return true;
  45936. }
  45937. const start = stackLength - howManyArgs;
  45938. for (let i = start; i < stackLength; i++) {
  45939. let value = this.stack[i];
  45940. if (Number.isInteger(value)) {
  45941. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  45942. } else {
  45943. value = 65536 * value | 0;
  45944. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  45945. }
  45946. }
  45947. this.output.push(...command);
  45948. if (keepStack) {
  45949. this.stack.splice(start, howManyArgs);
  45950. } else {
  45951. this.stack.length = 0;
  45952. }
  45953. return false;
  45954. }
  45955. }
  45956. const EEXEC_ENCRYPT_KEY = 55665;
  45957. const CHAR_STRS_ENCRYPT_KEY = 4330;
  45958. function isHexDigit(code) {
  45959. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  45960. }
  45961. function decrypt(data, key, discardNumber) {
  45962. if (discardNumber >= data.length) {
  45963. return new Uint8Array(0);
  45964. }
  45965. const c1 = 52845,
  45966. c2 = 22719;
  45967. let r = key | 0,
  45968. i,
  45969. j;
  45970. for (i = 0; i < discardNumber; i++) {
  45971. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  45972. }
  45973. const count = data.length - discardNumber;
  45974. const decrypted = new Uint8Array(count);
  45975. for (i = discardNumber, j = 0; j < count; i++, j++) {
  45976. const value = data[i];
  45977. decrypted[j] = value ^ r >> 8;
  45978. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  45979. }
  45980. return decrypted;
  45981. }
  45982. function decryptAscii(data, key, discardNumber) {
  45983. const c1 = 52845,
  45984. c2 = 22719;
  45985. let r = key | 0;
  45986. const count = data.length,
  45987. maybeLength = count >>> 1;
  45988. const decrypted = new Uint8Array(maybeLength);
  45989. let i, j;
  45990. for (i = 0, j = 0; i < count; i++) {
  45991. const digit1 = data[i];
  45992. if (!isHexDigit(digit1)) {
  45993. continue;
  45994. }
  45995. i++;
  45996. let digit2;
  45997. while (i < count && !isHexDigit(digit2 = data[i])) {
  45998. i++;
  45999. }
  46000. if (i < count) {
  46001. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  46002. decrypted[j++] = value ^ r >> 8;
  46003. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  46004. }
  46005. }
  46006. return decrypted.slice(discardNumber, j);
  46007. }
  46008. function isSpecial(c) {
  46009. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  46010. }
  46011. class Type1Parser {
  46012. constructor(stream, encrypted, seacAnalysisEnabled) {
  46013. if (encrypted) {
  46014. const data = stream.getBytes();
  46015. 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]));
  46016. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  46017. }
  46018. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  46019. this.stream = stream;
  46020. this.nextChar();
  46021. }
  46022. readNumberArray() {
  46023. this.getToken();
  46024. const array = [];
  46025. while (true) {
  46026. const token = this.getToken();
  46027. if (token === null || token === "]" || token === "}") {
  46028. break;
  46029. }
  46030. array.push(parseFloat(token || 0));
  46031. }
  46032. return array;
  46033. }
  46034. readNumber() {
  46035. const token = this.getToken();
  46036. return parseFloat(token || 0);
  46037. }
  46038. readInt() {
  46039. const token = this.getToken();
  46040. return parseInt(token || 0, 10) | 0;
  46041. }
  46042. readBoolean() {
  46043. const token = this.getToken();
  46044. return token === "true" ? 1 : 0;
  46045. }
  46046. nextChar() {
  46047. return this.currentChar = this.stream.getByte();
  46048. }
  46049. prevChar() {
  46050. this.stream.skip(-2);
  46051. return this.currentChar = this.stream.getByte();
  46052. }
  46053. getToken() {
  46054. let comment = false;
  46055. let ch = this.currentChar;
  46056. while (true) {
  46057. if (ch === -1) {
  46058. return null;
  46059. }
  46060. if (comment) {
  46061. if (ch === 0x0a || ch === 0x0d) {
  46062. comment = false;
  46063. }
  46064. } else if (ch === 0x25) {
  46065. comment = true;
  46066. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  46067. break;
  46068. }
  46069. ch = this.nextChar();
  46070. }
  46071. if (isSpecial(ch)) {
  46072. this.nextChar();
  46073. return String.fromCharCode(ch);
  46074. }
  46075. let token = "";
  46076. do {
  46077. token += String.fromCharCode(ch);
  46078. ch = this.nextChar();
  46079. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  46080. return token;
  46081. }
  46082. readCharStrings(bytes, lenIV) {
  46083. if (lenIV === -1) {
  46084. return bytes;
  46085. }
  46086. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  46087. }
  46088. extractFontProgram(properties) {
  46089. const stream = this.stream;
  46090. const subrs = [],
  46091. charstrings = [];
  46092. const privateData = Object.create(null);
  46093. privateData.lenIV = 4;
  46094. const program = {
  46095. subrs: [],
  46096. charstrings: [],
  46097. properties: {
  46098. privateData
  46099. }
  46100. };
  46101. let token, length, data, lenIV;
  46102. while ((token = this.getToken()) !== null) {
  46103. if (token !== "/") {
  46104. continue;
  46105. }
  46106. token = this.getToken();
  46107. switch (token) {
  46108. case "CharStrings":
  46109. this.getToken();
  46110. this.getToken();
  46111. this.getToken();
  46112. this.getToken();
  46113. while (true) {
  46114. token = this.getToken();
  46115. if (token === null || token === "end") {
  46116. break;
  46117. }
  46118. if (token !== "/") {
  46119. continue;
  46120. }
  46121. const glyph = this.getToken();
  46122. length = this.readInt();
  46123. this.getToken();
  46124. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46125. lenIV = program.properties.privateData.lenIV;
  46126. const encoded = this.readCharStrings(data, lenIV);
  46127. this.nextChar();
  46128. token = this.getToken();
  46129. if (token === "noaccess") {
  46130. this.getToken();
  46131. } else if (token === "/") {
  46132. this.prevChar();
  46133. }
  46134. charstrings.push({
  46135. glyph,
  46136. encoded
  46137. });
  46138. }
  46139. break;
  46140. case "Subrs":
  46141. this.readInt();
  46142. this.getToken();
  46143. while (this.getToken() === "dup") {
  46144. const index = this.readInt();
  46145. length = this.readInt();
  46146. this.getToken();
  46147. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  46148. lenIV = program.properties.privateData.lenIV;
  46149. const encoded = this.readCharStrings(data, lenIV);
  46150. this.nextChar();
  46151. token = this.getToken();
  46152. if (token === "noaccess") {
  46153. this.getToken();
  46154. }
  46155. subrs[index] = encoded;
  46156. }
  46157. break;
  46158. case "BlueValues":
  46159. case "OtherBlues":
  46160. case "FamilyBlues":
  46161. case "FamilyOtherBlues":
  46162. const blueArray = this.readNumberArray();
  46163. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  46164. program.properties.privateData[token] = blueArray;
  46165. }
  46166. break;
  46167. case "StemSnapH":
  46168. case "StemSnapV":
  46169. program.properties.privateData[token] = this.readNumberArray();
  46170. break;
  46171. case "StdHW":
  46172. case "StdVW":
  46173. program.properties.privateData[token] = this.readNumberArray()[0];
  46174. break;
  46175. case "BlueShift":
  46176. case "lenIV":
  46177. case "BlueFuzz":
  46178. case "BlueScale":
  46179. case "LanguageGroup":
  46180. case "ExpansionFactor":
  46181. program.properties.privateData[token] = this.readNumber();
  46182. break;
  46183. case "ForceBold":
  46184. program.properties.privateData[token] = this.readBoolean();
  46185. break;
  46186. }
  46187. }
  46188. for (const {
  46189. encoded,
  46190. glyph
  46191. } of charstrings) {
  46192. const charString = new Type1CharString();
  46193. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  46194. let output = charString.output;
  46195. if (error) {
  46196. output = [14];
  46197. }
  46198. const charStringObject = {
  46199. glyphName: glyph,
  46200. charstring: output,
  46201. width: charString.width,
  46202. lsb: charString.lsb,
  46203. seac: charString.seac
  46204. };
  46205. if (glyph === ".notdef") {
  46206. program.charstrings.unshift(charStringObject);
  46207. } else {
  46208. program.charstrings.push(charStringObject);
  46209. }
  46210. if (properties.builtInEncoding) {
  46211. const index = properties.builtInEncoding.indexOf(glyph);
  46212. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  46213. properties.widths[index] = charString.width;
  46214. }
  46215. }
  46216. }
  46217. return program;
  46218. }
  46219. extractFontHeader(properties) {
  46220. let token;
  46221. while ((token = this.getToken()) !== null) {
  46222. if (token !== "/") {
  46223. continue;
  46224. }
  46225. token = this.getToken();
  46226. switch (token) {
  46227. case "FontMatrix":
  46228. const matrix = this.readNumberArray();
  46229. properties.fontMatrix = matrix;
  46230. break;
  46231. case "Encoding":
  46232. const encodingArg = this.getToken();
  46233. let encoding;
  46234. if (!/^\d+$/.test(encodingArg)) {
  46235. encoding = (0, _encodings.getEncoding)(encodingArg);
  46236. } else {
  46237. encoding = [];
  46238. const size = parseInt(encodingArg, 10) | 0;
  46239. this.getToken();
  46240. for (let j = 0; j < size; j++) {
  46241. token = this.getToken();
  46242. while (token !== "dup" && token !== "def") {
  46243. token = this.getToken();
  46244. if (token === null) {
  46245. return;
  46246. }
  46247. }
  46248. if (token === "def") {
  46249. break;
  46250. }
  46251. const index = this.readInt();
  46252. this.getToken();
  46253. const glyph = this.getToken();
  46254. encoding[index] = glyph;
  46255. this.getToken();
  46256. }
  46257. }
  46258. properties.builtInEncoding = encoding;
  46259. break;
  46260. case "FontBBox":
  46261. const fontBBox = this.readNumberArray();
  46262. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  46263. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  46264. properties.ascentScaled = true;
  46265. break;
  46266. }
  46267. }
  46268. }
  46269. }
  46270. exports.Type1Parser = Type1Parser;
  46271. /***/ }),
  46272. /* 179 */
  46273. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46274. "use strict";
  46275. Object.defineProperty(exports, "__esModule", ({
  46276. value: true
  46277. }));
  46278. exports.Pattern = void 0;
  46279. exports.getTilingPatternIR = getTilingPatternIR;
  46280. var _util = __w_pdfjs_require__(2);
  46281. var _base_stream = __w_pdfjs_require__(136);
  46282. var _colorspace = __w_pdfjs_require__(143);
  46283. var _core_utils = __w_pdfjs_require__(135);
  46284. const ShadingType = {
  46285. FUNCTION_BASED: 1,
  46286. AXIAL: 2,
  46287. RADIAL: 3,
  46288. FREE_FORM_MESH: 4,
  46289. LATTICE_FORM_MESH: 5,
  46290. COONS_PATCH_MESH: 6,
  46291. TENSOR_PATCH_MESH: 7
  46292. };
  46293. class Pattern {
  46294. constructor() {
  46295. (0, _util.unreachable)("Cannot initialize Pattern.");
  46296. }
  46297. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  46298. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  46299. const type = dict.get("ShadingType");
  46300. try {
  46301. switch (type) {
  46302. case ShadingType.AXIAL:
  46303. case ShadingType.RADIAL:
  46304. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46305. case ShadingType.FREE_FORM_MESH:
  46306. case ShadingType.LATTICE_FORM_MESH:
  46307. case ShadingType.COONS_PATCH_MESH:
  46308. case ShadingType.TENSOR_PATCH_MESH:
  46309. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  46310. default:
  46311. throw new _util.FormatError("Unsupported ShadingType: " + type);
  46312. }
  46313. } catch (ex) {
  46314. if (ex instanceof _core_utils.MissingDataException) {
  46315. throw ex;
  46316. }
  46317. handler.send("UnsupportedFeature", {
  46318. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  46319. });
  46320. (0, _util.warn)(ex);
  46321. return new DummyShading();
  46322. }
  46323. }
  46324. }
  46325. exports.Pattern = Pattern;
  46326. class BaseShading {
  46327. static get SMALL_NUMBER() {
  46328. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  46329. }
  46330. constructor() {
  46331. if (this.constructor === BaseShading) {
  46332. (0, _util.unreachable)("Cannot initialize BaseShading.");
  46333. }
  46334. }
  46335. getIR() {
  46336. (0, _util.unreachable)("Abstract method `getIR` called.");
  46337. }
  46338. }
  46339. class RadialAxialShading extends BaseShading {
  46340. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46341. super();
  46342. this.coordsArr = dict.getArray("Coords");
  46343. this.shadingType = dict.get("ShadingType");
  46344. const cs = _colorspace.ColorSpace.parse({
  46345. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46346. xref,
  46347. resources,
  46348. pdfFunctionFactory,
  46349. localColorSpaceCache
  46350. });
  46351. const bbox = dict.getArray("BBox");
  46352. if (Array.isArray(bbox) && bbox.length === 4) {
  46353. this.bbox = _util.Util.normalizeRect(bbox);
  46354. } else {
  46355. this.bbox = null;
  46356. }
  46357. let t0 = 0.0,
  46358. t1 = 1.0;
  46359. if (dict.has("Domain")) {
  46360. const domainArr = dict.getArray("Domain");
  46361. t0 = domainArr[0];
  46362. t1 = domainArr[1];
  46363. }
  46364. let extendStart = false,
  46365. extendEnd = false;
  46366. if (dict.has("Extend")) {
  46367. const extendArr = dict.getArray("Extend");
  46368. extendStart = extendArr[0];
  46369. extendEnd = extendArr[1];
  46370. }
  46371. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  46372. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  46373. const distance = Math.hypot(x1 - x2, y1 - y2);
  46374. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  46375. (0, _util.warn)("Unsupported radial gradient.");
  46376. }
  46377. }
  46378. this.extendStart = extendStart;
  46379. this.extendEnd = extendEnd;
  46380. const fnObj = dict.getRaw("Function");
  46381. const fn = pdfFunctionFactory.createFromArray(fnObj);
  46382. const NUMBER_OF_SAMPLES = 10;
  46383. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  46384. const colorStops = this.colorStops = [];
  46385. if (t0 >= t1 || step <= 0) {
  46386. (0, _util.info)("Bad shading domain.");
  46387. return;
  46388. }
  46389. const color = new Float32Array(cs.numComps),
  46390. ratio = new Float32Array(1);
  46391. let rgbColor;
  46392. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  46393. ratio[0] = t0 + i * step;
  46394. fn(ratio, 0, color, 0);
  46395. rgbColor = cs.getRgb(color, 0);
  46396. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46397. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  46398. }
  46399. let background = "transparent";
  46400. if (dict.has("Background")) {
  46401. rgbColor = cs.getRgb(dict.get("Background"), 0);
  46402. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  46403. }
  46404. if (!extendStart) {
  46405. colorStops.unshift([0, background]);
  46406. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  46407. }
  46408. if (!extendEnd) {
  46409. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  46410. colorStops.push([1, background]);
  46411. }
  46412. this.colorStops = colorStops;
  46413. }
  46414. getIR() {
  46415. const coordsArr = this.coordsArr;
  46416. const shadingType = this.shadingType;
  46417. let type, p0, p1, r0, r1;
  46418. if (shadingType === ShadingType.AXIAL) {
  46419. p0 = [coordsArr[0], coordsArr[1]];
  46420. p1 = [coordsArr[2], coordsArr[3]];
  46421. r0 = null;
  46422. r1 = null;
  46423. type = "axial";
  46424. } else if (shadingType === ShadingType.RADIAL) {
  46425. p0 = [coordsArr[0], coordsArr[1]];
  46426. p1 = [coordsArr[3], coordsArr[4]];
  46427. r0 = coordsArr[2];
  46428. r1 = coordsArr[5];
  46429. type = "radial";
  46430. } else {
  46431. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  46432. }
  46433. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  46434. }
  46435. }
  46436. class MeshStreamReader {
  46437. constructor(stream, context) {
  46438. this.stream = stream;
  46439. this.context = context;
  46440. this.buffer = 0;
  46441. this.bufferLength = 0;
  46442. const numComps = context.numComps;
  46443. this.tmpCompsBuf = new Float32Array(numComps);
  46444. const csNumComps = context.colorSpace.numComps;
  46445. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  46446. }
  46447. get hasData() {
  46448. if (this.stream.end) {
  46449. return this.stream.pos < this.stream.end;
  46450. }
  46451. if (this.bufferLength > 0) {
  46452. return true;
  46453. }
  46454. const nextByte = this.stream.getByte();
  46455. if (nextByte < 0) {
  46456. return false;
  46457. }
  46458. this.buffer = nextByte;
  46459. this.bufferLength = 8;
  46460. return true;
  46461. }
  46462. readBits(n) {
  46463. let buffer = this.buffer;
  46464. let bufferLength = this.bufferLength;
  46465. if (n === 32) {
  46466. if (bufferLength === 0) {
  46467. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  46468. }
  46469. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  46470. const nextByte = this.stream.getByte();
  46471. this.buffer = nextByte & (1 << bufferLength) - 1;
  46472. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  46473. }
  46474. if (n === 8 && bufferLength === 0) {
  46475. return this.stream.getByte();
  46476. }
  46477. while (bufferLength < n) {
  46478. buffer = buffer << 8 | this.stream.getByte();
  46479. bufferLength += 8;
  46480. }
  46481. bufferLength -= n;
  46482. this.bufferLength = bufferLength;
  46483. this.buffer = buffer & (1 << bufferLength) - 1;
  46484. return buffer >> bufferLength;
  46485. }
  46486. align() {
  46487. this.buffer = 0;
  46488. this.bufferLength = 0;
  46489. }
  46490. readFlag() {
  46491. return this.readBits(this.context.bitsPerFlag);
  46492. }
  46493. readCoordinate() {
  46494. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  46495. const xi = this.readBits(bitsPerCoordinate);
  46496. const yi = this.readBits(bitsPerCoordinate);
  46497. const decode = this.context.decode;
  46498. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  46499. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  46500. }
  46501. readComponents() {
  46502. const numComps = this.context.numComps;
  46503. const bitsPerComponent = this.context.bitsPerComponent;
  46504. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  46505. const decode = this.context.decode;
  46506. const components = this.tmpCompsBuf;
  46507. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  46508. const ci = this.readBits(bitsPerComponent);
  46509. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  46510. }
  46511. const color = this.tmpCsCompsBuf;
  46512. if (this.context.colorFn) {
  46513. this.context.colorFn(components, 0, color, 0);
  46514. }
  46515. return this.context.colorSpace.getRgb(color, 0);
  46516. }
  46517. }
  46518. const getB = function getBClosure() {
  46519. function buildB(count) {
  46520. const lut = [];
  46521. for (let i = 0; i <= count; i++) {
  46522. const t = i / count,
  46523. t_ = 1 - t;
  46524. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  46525. }
  46526. return lut;
  46527. }
  46528. const cache = [];
  46529. return function (count) {
  46530. if (!cache[count]) {
  46531. cache[count] = buildB(count);
  46532. }
  46533. return cache[count];
  46534. };
  46535. }();
  46536. class MeshShading extends BaseShading {
  46537. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46538. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  46539. }
  46540. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  46541. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  46542. }
  46543. static get TRIANGLE_DENSITY() {
  46544. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  46545. }
  46546. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  46547. super();
  46548. if (!(stream instanceof _base_stream.BaseStream)) {
  46549. throw new _util.FormatError("Mesh data is not a stream");
  46550. }
  46551. const dict = stream.dict;
  46552. this.shadingType = dict.get("ShadingType");
  46553. const bbox = dict.getArray("BBox");
  46554. if (Array.isArray(bbox) && bbox.length === 4) {
  46555. this.bbox = _util.Util.normalizeRect(bbox);
  46556. } else {
  46557. this.bbox = null;
  46558. }
  46559. const cs = _colorspace.ColorSpace.parse({
  46560. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  46561. xref,
  46562. resources,
  46563. pdfFunctionFactory,
  46564. localColorSpaceCache
  46565. });
  46566. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  46567. const fnObj = dict.getRaw("Function");
  46568. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  46569. this.coords = [];
  46570. this.colors = [];
  46571. this.figures = [];
  46572. const decodeContext = {
  46573. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  46574. bitsPerComponent: dict.get("BitsPerComponent"),
  46575. bitsPerFlag: dict.get("BitsPerFlag"),
  46576. decode: dict.getArray("Decode"),
  46577. colorFn: fn,
  46578. colorSpace: cs,
  46579. numComps: fn ? 1 : cs.numComps
  46580. };
  46581. const reader = new MeshStreamReader(stream, decodeContext);
  46582. let patchMesh = false;
  46583. switch (this.shadingType) {
  46584. case ShadingType.FREE_FORM_MESH:
  46585. this._decodeType4Shading(reader);
  46586. break;
  46587. case ShadingType.LATTICE_FORM_MESH:
  46588. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  46589. if (verticesPerRow < 2) {
  46590. throw new _util.FormatError("Invalid VerticesPerRow");
  46591. }
  46592. this._decodeType5Shading(reader, verticesPerRow);
  46593. break;
  46594. case ShadingType.COONS_PATCH_MESH:
  46595. this._decodeType6Shading(reader);
  46596. patchMesh = true;
  46597. break;
  46598. case ShadingType.TENSOR_PATCH_MESH:
  46599. this._decodeType7Shading(reader);
  46600. patchMesh = true;
  46601. break;
  46602. default:
  46603. (0, _util.unreachable)("Unsupported mesh type.");
  46604. break;
  46605. }
  46606. if (patchMesh) {
  46607. this._updateBounds();
  46608. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  46609. this._buildFigureFromPatch(i);
  46610. }
  46611. }
  46612. this._updateBounds();
  46613. this._packData();
  46614. }
  46615. _decodeType4Shading(reader) {
  46616. const coords = this.coords;
  46617. const colors = this.colors;
  46618. const operators = [];
  46619. const ps = [];
  46620. let verticesLeft = 0;
  46621. while (reader.hasData) {
  46622. const f = reader.readFlag();
  46623. const coord = reader.readCoordinate();
  46624. const color = reader.readComponents();
  46625. if (verticesLeft === 0) {
  46626. if (!(0 <= f && f <= 2)) {
  46627. throw new _util.FormatError("Unknown type4 flag");
  46628. }
  46629. switch (f) {
  46630. case 0:
  46631. verticesLeft = 3;
  46632. break;
  46633. case 1:
  46634. ps.push(ps.at(-2), ps.at(-1));
  46635. verticesLeft = 1;
  46636. break;
  46637. case 2:
  46638. ps.push(ps.at(-3), ps.at(-1));
  46639. verticesLeft = 1;
  46640. break;
  46641. }
  46642. operators.push(f);
  46643. }
  46644. ps.push(coords.length);
  46645. coords.push(coord);
  46646. colors.push(color);
  46647. verticesLeft--;
  46648. reader.align();
  46649. }
  46650. this.figures.push({
  46651. type: "triangles",
  46652. coords: new Int32Array(ps),
  46653. colors: new Int32Array(ps)
  46654. });
  46655. }
  46656. _decodeType5Shading(reader, verticesPerRow) {
  46657. const coords = this.coords;
  46658. const colors = this.colors;
  46659. const ps = [];
  46660. while (reader.hasData) {
  46661. const coord = reader.readCoordinate();
  46662. const color = reader.readComponents();
  46663. ps.push(coords.length);
  46664. coords.push(coord);
  46665. colors.push(color);
  46666. }
  46667. this.figures.push({
  46668. type: "lattice",
  46669. coords: new Int32Array(ps),
  46670. colors: new Int32Array(ps),
  46671. verticesPerRow
  46672. });
  46673. }
  46674. _decodeType6Shading(reader) {
  46675. const coords = this.coords;
  46676. const colors = this.colors;
  46677. const ps = new Int32Array(16);
  46678. const cs = new Int32Array(4);
  46679. while (reader.hasData) {
  46680. const f = reader.readFlag();
  46681. if (!(0 <= f && f <= 3)) {
  46682. throw new _util.FormatError("Unknown type6 flag");
  46683. }
  46684. const pi = coords.length;
  46685. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  46686. coords.push(reader.readCoordinate());
  46687. }
  46688. const ci = colors.length;
  46689. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  46690. colors.push(reader.readComponents());
  46691. }
  46692. let tmp1, tmp2, tmp3, tmp4;
  46693. switch (f) {
  46694. case 0:
  46695. ps[12] = pi + 3;
  46696. ps[13] = pi + 4;
  46697. ps[14] = pi + 5;
  46698. ps[15] = pi + 6;
  46699. ps[8] = pi + 2;
  46700. ps[11] = pi + 7;
  46701. ps[4] = pi + 1;
  46702. ps[7] = pi + 8;
  46703. ps[0] = pi;
  46704. ps[1] = pi + 11;
  46705. ps[2] = pi + 10;
  46706. ps[3] = pi + 9;
  46707. cs[2] = ci + 1;
  46708. cs[3] = ci + 2;
  46709. cs[0] = ci;
  46710. cs[1] = ci + 3;
  46711. break;
  46712. case 1:
  46713. tmp1 = ps[12];
  46714. tmp2 = ps[13];
  46715. tmp3 = ps[14];
  46716. tmp4 = ps[15];
  46717. ps[12] = tmp4;
  46718. ps[13] = pi + 0;
  46719. ps[14] = pi + 1;
  46720. ps[15] = pi + 2;
  46721. ps[8] = tmp3;
  46722. ps[11] = pi + 3;
  46723. ps[4] = tmp2;
  46724. ps[7] = pi + 4;
  46725. ps[0] = tmp1;
  46726. ps[1] = pi + 7;
  46727. ps[2] = pi + 6;
  46728. ps[3] = pi + 5;
  46729. tmp1 = cs[2];
  46730. tmp2 = cs[3];
  46731. cs[2] = tmp2;
  46732. cs[3] = ci;
  46733. cs[0] = tmp1;
  46734. cs[1] = ci + 1;
  46735. break;
  46736. case 2:
  46737. tmp1 = ps[15];
  46738. tmp2 = ps[11];
  46739. ps[12] = ps[3];
  46740. ps[13] = pi + 0;
  46741. ps[14] = pi + 1;
  46742. ps[15] = pi + 2;
  46743. ps[8] = ps[7];
  46744. ps[11] = pi + 3;
  46745. ps[4] = tmp2;
  46746. ps[7] = pi + 4;
  46747. ps[0] = tmp1;
  46748. ps[1] = pi + 7;
  46749. ps[2] = pi + 6;
  46750. ps[3] = pi + 5;
  46751. tmp1 = cs[3];
  46752. cs[2] = cs[1];
  46753. cs[3] = ci;
  46754. cs[0] = tmp1;
  46755. cs[1] = ci + 1;
  46756. break;
  46757. case 3:
  46758. ps[12] = ps[0];
  46759. ps[13] = pi + 0;
  46760. ps[14] = pi + 1;
  46761. ps[15] = pi + 2;
  46762. ps[8] = ps[1];
  46763. ps[11] = pi + 3;
  46764. ps[4] = ps[2];
  46765. ps[7] = pi + 4;
  46766. ps[0] = ps[3];
  46767. ps[1] = pi + 7;
  46768. ps[2] = pi + 6;
  46769. ps[3] = pi + 5;
  46770. cs[2] = cs[0];
  46771. cs[3] = ci;
  46772. cs[0] = cs[1];
  46773. cs[1] = ci + 1;
  46774. break;
  46775. }
  46776. ps[5] = coords.length;
  46777. 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]);
  46778. ps[6] = coords.length;
  46779. 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]);
  46780. ps[9] = coords.length;
  46781. 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]);
  46782. ps[10] = coords.length;
  46783. 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]);
  46784. this.figures.push({
  46785. type: "patch",
  46786. coords: new Int32Array(ps),
  46787. colors: new Int32Array(cs)
  46788. });
  46789. }
  46790. }
  46791. _decodeType7Shading(reader) {
  46792. const coords = this.coords;
  46793. const colors = this.colors;
  46794. const ps = new Int32Array(16);
  46795. const cs = new Int32Array(4);
  46796. while (reader.hasData) {
  46797. const f = reader.readFlag();
  46798. if (!(0 <= f && f <= 3)) {
  46799. throw new _util.FormatError("Unknown type7 flag");
  46800. }
  46801. const pi = coords.length;
  46802. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  46803. coords.push(reader.readCoordinate());
  46804. }
  46805. const ci = colors.length;
  46806. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  46807. colors.push(reader.readComponents());
  46808. }
  46809. let tmp1, tmp2, tmp3, tmp4;
  46810. switch (f) {
  46811. case 0:
  46812. ps[12] = pi + 3;
  46813. ps[13] = pi + 4;
  46814. ps[14] = pi + 5;
  46815. ps[15] = pi + 6;
  46816. ps[8] = pi + 2;
  46817. ps[9] = pi + 13;
  46818. ps[10] = pi + 14;
  46819. ps[11] = pi + 7;
  46820. ps[4] = pi + 1;
  46821. ps[5] = pi + 12;
  46822. ps[6] = pi + 15;
  46823. ps[7] = pi + 8;
  46824. ps[0] = pi;
  46825. ps[1] = pi + 11;
  46826. ps[2] = pi + 10;
  46827. ps[3] = pi + 9;
  46828. cs[2] = ci + 1;
  46829. cs[3] = ci + 2;
  46830. cs[0] = ci;
  46831. cs[1] = ci + 3;
  46832. break;
  46833. case 1:
  46834. tmp1 = ps[12];
  46835. tmp2 = ps[13];
  46836. tmp3 = ps[14];
  46837. tmp4 = ps[15];
  46838. ps[12] = tmp4;
  46839. ps[13] = pi + 0;
  46840. ps[14] = pi + 1;
  46841. ps[15] = pi + 2;
  46842. ps[8] = tmp3;
  46843. ps[9] = pi + 9;
  46844. ps[10] = pi + 10;
  46845. ps[11] = pi + 3;
  46846. ps[4] = tmp2;
  46847. ps[5] = pi + 8;
  46848. ps[6] = pi + 11;
  46849. ps[7] = pi + 4;
  46850. ps[0] = tmp1;
  46851. ps[1] = pi + 7;
  46852. ps[2] = pi + 6;
  46853. ps[3] = pi + 5;
  46854. tmp1 = cs[2];
  46855. tmp2 = cs[3];
  46856. cs[2] = tmp2;
  46857. cs[3] = ci;
  46858. cs[0] = tmp1;
  46859. cs[1] = ci + 1;
  46860. break;
  46861. case 2:
  46862. tmp1 = ps[15];
  46863. tmp2 = ps[11];
  46864. ps[12] = ps[3];
  46865. ps[13] = pi + 0;
  46866. ps[14] = pi + 1;
  46867. ps[15] = pi + 2;
  46868. ps[8] = ps[7];
  46869. ps[9] = pi + 9;
  46870. ps[10] = pi + 10;
  46871. ps[11] = pi + 3;
  46872. ps[4] = tmp2;
  46873. ps[5] = pi + 8;
  46874. ps[6] = pi + 11;
  46875. ps[7] = pi + 4;
  46876. ps[0] = tmp1;
  46877. ps[1] = pi + 7;
  46878. ps[2] = pi + 6;
  46879. ps[3] = pi + 5;
  46880. tmp1 = cs[3];
  46881. cs[2] = cs[1];
  46882. cs[3] = ci;
  46883. cs[0] = tmp1;
  46884. cs[1] = ci + 1;
  46885. break;
  46886. case 3:
  46887. ps[12] = ps[0];
  46888. ps[13] = pi + 0;
  46889. ps[14] = pi + 1;
  46890. ps[15] = pi + 2;
  46891. ps[8] = ps[1];
  46892. ps[9] = pi + 9;
  46893. ps[10] = pi + 10;
  46894. ps[11] = pi + 3;
  46895. ps[4] = ps[2];
  46896. ps[5] = pi + 8;
  46897. ps[6] = pi + 11;
  46898. ps[7] = pi + 4;
  46899. ps[0] = ps[3];
  46900. ps[1] = pi + 7;
  46901. ps[2] = pi + 6;
  46902. ps[3] = pi + 5;
  46903. cs[2] = cs[0];
  46904. cs[3] = ci;
  46905. cs[0] = cs[1];
  46906. cs[1] = ci + 1;
  46907. break;
  46908. }
  46909. this.figures.push({
  46910. type: "patch",
  46911. coords: new Int32Array(ps),
  46912. colors: new Int32Array(cs)
  46913. });
  46914. }
  46915. }
  46916. _buildFigureFromPatch(index) {
  46917. const figure = this.figures[index];
  46918. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  46919. const coords = this.coords,
  46920. colors = this.colors;
  46921. const pi = figure.coords;
  46922. const ci = figure.colors;
  46923. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  46924. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  46925. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  46926. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  46927. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  46928. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  46929. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  46930. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  46931. const verticesPerRow = splitXBy + 1;
  46932. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  46933. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  46934. let k = 0;
  46935. const cl = new Uint8Array(3),
  46936. cr = new Uint8Array(3);
  46937. const c0 = colors[ci[0]],
  46938. c1 = colors[ci[1]],
  46939. c2 = colors[ci[2]],
  46940. c3 = colors[ci[3]];
  46941. const bRow = getB(splitYBy),
  46942. bCol = getB(splitXBy);
  46943. for (let row = 0; row <= splitYBy; row++) {
  46944. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  46945. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  46946. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  46947. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  46948. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  46949. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  46950. for (let col = 0; col <= splitXBy; col++, k++) {
  46951. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  46952. continue;
  46953. }
  46954. let x = 0,
  46955. y = 0;
  46956. let q = 0;
  46957. for (let i = 0; i <= 3; i++) {
  46958. for (let j = 0; j <= 3; j++, q++) {
  46959. const m = bRow[row][i] * bCol[col][j];
  46960. x += coords[pi[q]][0] * m;
  46961. y += coords[pi[q]][1] * m;
  46962. }
  46963. }
  46964. figureCoords[k] = coords.length;
  46965. coords.push([x, y]);
  46966. figureColors[k] = colors.length;
  46967. const newColor = new Uint8Array(3);
  46968. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  46969. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  46970. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  46971. colors.push(newColor);
  46972. }
  46973. }
  46974. figureCoords[0] = pi[0];
  46975. figureColors[0] = ci[0];
  46976. figureCoords[splitXBy] = pi[3];
  46977. figureColors[splitXBy] = ci[1];
  46978. figureCoords[verticesPerRow * splitYBy] = pi[12];
  46979. figureColors[verticesPerRow * splitYBy] = ci[2];
  46980. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  46981. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  46982. this.figures[index] = {
  46983. type: "lattice",
  46984. coords: figureCoords,
  46985. colors: figureColors,
  46986. verticesPerRow
  46987. };
  46988. }
  46989. _updateBounds() {
  46990. let minX = this.coords[0][0],
  46991. minY = this.coords[0][1],
  46992. maxX = minX,
  46993. maxY = minY;
  46994. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  46995. const x = this.coords[i][0],
  46996. y = this.coords[i][1];
  46997. minX = minX > x ? x : minX;
  46998. minY = minY > y ? y : minY;
  46999. maxX = maxX < x ? x : maxX;
  47000. maxY = maxY < y ? y : maxY;
  47001. }
  47002. this.bounds = [minX, minY, maxX, maxY];
  47003. }
  47004. _packData() {
  47005. let i, ii, j, jj;
  47006. const coords = this.coords;
  47007. const coordsPacked = new Float32Array(coords.length * 2);
  47008. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  47009. const xy = coords[i];
  47010. coordsPacked[j++] = xy[0];
  47011. coordsPacked[j++] = xy[1];
  47012. }
  47013. this.coords = coordsPacked;
  47014. const colors = this.colors;
  47015. const colorsPacked = new Uint8Array(colors.length * 3);
  47016. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  47017. const c = colors[i];
  47018. colorsPacked[j++] = c[0];
  47019. colorsPacked[j++] = c[1];
  47020. colorsPacked[j++] = c[2];
  47021. }
  47022. this.colors = colorsPacked;
  47023. const figures = this.figures;
  47024. for (i = 0, ii = figures.length; i < ii; i++) {
  47025. const figure = figures[i],
  47026. ps = figure.coords,
  47027. cs = figure.colors;
  47028. for (j = 0, jj = ps.length; j < jj; j++) {
  47029. ps[j] *= 2;
  47030. cs[j] *= 3;
  47031. }
  47032. }
  47033. }
  47034. getIR() {
  47035. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  47036. }
  47037. }
  47038. class DummyShading extends BaseShading {
  47039. getIR() {
  47040. return ["Dummy"];
  47041. }
  47042. }
  47043. function getTilingPatternIR(operatorList, dict, color) {
  47044. const matrix = dict.getArray("Matrix");
  47045. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  47046. const xstep = dict.get("XStep");
  47047. const ystep = dict.get("YStep");
  47048. const paintType = dict.get("PaintType");
  47049. const tilingType = dict.get("TilingType");
  47050. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  47051. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  47052. }
  47053. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  47054. }
  47055. /***/ }),
  47056. /* 180 */
  47057. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47058. "use strict";
  47059. Object.defineProperty(exports, "__esModule", ({
  47060. value: true
  47061. }));
  47062. exports.getXfaFontDict = getXfaFontDict;
  47063. exports.getXfaFontName = getXfaFontName;
  47064. var _calibri_factors = __w_pdfjs_require__(181);
  47065. var _primitives = __w_pdfjs_require__(134);
  47066. var _helvetica_factors = __w_pdfjs_require__(182);
  47067. var _liberationsans_widths = __w_pdfjs_require__(183);
  47068. var _myriadpro_factors = __w_pdfjs_require__(184);
  47069. var _segoeui_factors = __w_pdfjs_require__(185);
  47070. var _core_utils = __w_pdfjs_require__(135);
  47071. var _fonts_utils = __w_pdfjs_require__(167);
  47072. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  47073. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  47074. name: "LiberationSans-Regular",
  47075. factors: _myriadpro_factors.MyriadProRegularFactors,
  47076. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47077. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47078. metrics: _myriadpro_factors.MyriadProRegularMetrics
  47079. };
  47080. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  47081. name: "LiberationSans-Bold",
  47082. factors: _myriadpro_factors.MyriadProBoldFactors,
  47083. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47084. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47085. metrics: _myriadpro_factors.MyriadProBoldMetrics
  47086. };
  47087. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  47088. name: "LiberationSans-Italic",
  47089. factors: _myriadpro_factors.MyriadProItalicFactors,
  47090. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47091. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47092. metrics: _myriadpro_factors.MyriadProItalicMetrics
  47093. };
  47094. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  47095. name: "LiberationSans-BoldItalic",
  47096. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  47097. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47098. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47099. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  47100. };
  47101. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  47102. name: "LiberationSans-Regular",
  47103. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47104. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  47105. };
  47106. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  47107. name: "LiberationSans-Bold",
  47108. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47109. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  47110. };
  47111. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  47112. name: "LiberationSans-Italic",
  47113. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47114. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  47115. };
  47116. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  47117. name: "LiberationSans-BoldItalic",
  47118. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47119. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  47120. };
  47121. t["Calibri-Regular"] = {
  47122. name: "LiberationSans-Regular",
  47123. factors: _calibri_factors.CalibriRegularFactors,
  47124. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47125. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47126. metrics: _calibri_factors.CalibriRegularMetrics
  47127. };
  47128. t["Calibri-Bold"] = {
  47129. name: "LiberationSans-Bold",
  47130. factors: _calibri_factors.CalibriBoldFactors,
  47131. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47132. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47133. metrics: _calibri_factors.CalibriBoldMetrics
  47134. };
  47135. t["Calibri-Italic"] = {
  47136. name: "LiberationSans-Italic",
  47137. factors: _calibri_factors.CalibriItalicFactors,
  47138. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47139. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47140. metrics: _calibri_factors.CalibriItalicMetrics
  47141. };
  47142. t["Calibri-BoldItalic"] = {
  47143. name: "LiberationSans-BoldItalic",
  47144. factors: _calibri_factors.CalibriBoldItalicFactors,
  47145. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47146. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47147. metrics: _calibri_factors.CalibriBoldItalicMetrics
  47148. };
  47149. t["Segoeui-Regular"] = {
  47150. name: "LiberationSans-Regular",
  47151. factors: _segoeui_factors.SegoeuiRegularFactors,
  47152. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47153. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47154. metrics: _segoeui_factors.SegoeuiRegularMetrics
  47155. };
  47156. t["Segoeui-Bold"] = {
  47157. name: "LiberationSans-Bold",
  47158. factors: _segoeui_factors.SegoeuiBoldFactors,
  47159. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47160. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47161. metrics: _segoeui_factors.SegoeuiBoldMetrics
  47162. };
  47163. t["Segoeui-Italic"] = {
  47164. name: "LiberationSans-Italic",
  47165. factors: _segoeui_factors.SegoeuiItalicFactors,
  47166. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47167. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47168. metrics: _segoeui_factors.SegoeuiItalicMetrics
  47169. };
  47170. t["Segoeui-BoldItalic"] = {
  47171. name: "LiberationSans-BoldItalic",
  47172. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  47173. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47174. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47175. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  47176. };
  47177. t["Helvetica-Regular"] = t.Helvetica = {
  47178. name: "LiberationSans-Regular",
  47179. factors: _helvetica_factors.HelveticaRegularFactors,
  47180. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  47181. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  47182. metrics: _helvetica_factors.HelveticaRegularMetrics
  47183. };
  47184. t["Helvetica-Bold"] = {
  47185. name: "LiberationSans-Bold",
  47186. factors: _helvetica_factors.HelveticaBoldFactors,
  47187. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  47188. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  47189. metrics: _helvetica_factors.HelveticaBoldMetrics
  47190. };
  47191. t["Helvetica-Italic"] = {
  47192. name: "LiberationSans-Italic",
  47193. factors: _helvetica_factors.HelveticaItalicFactors,
  47194. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  47195. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  47196. metrics: _helvetica_factors.HelveticaItalicMetrics
  47197. };
  47198. t["Helvetica-BoldItalic"] = {
  47199. name: "LiberationSans-BoldItalic",
  47200. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  47201. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  47202. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  47203. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  47204. };
  47205. });
  47206. function getXfaFontName(name) {
  47207. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  47208. const fontMap = getXFAFontMap();
  47209. return fontMap[fontName];
  47210. }
  47211. function getXfaFontWidths(name) {
  47212. const info = getXfaFontName(name);
  47213. if (!info) {
  47214. return null;
  47215. }
  47216. const {
  47217. baseWidths,
  47218. baseMapping,
  47219. factors
  47220. } = info;
  47221. let rescaledBaseWidths;
  47222. if (!factors) {
  47223. rescaledBaseWidths = baseWidths;
  47224. } else {
  47225. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  47226. }
  47227. let currentCode = -2;
  47228. let currentArray;
  47229. const newWidths = [];
  47230. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort((_ref, _ref2) => {
  47231. let [unicode1] = _ref;
  47232. let [unicode2] = _ref2;
  47233. return unicode1 - unicode2;
  47234. })) {
  47235. if (unicode === -1) {
  47236. continue;
  47237. }
  47238. if (unicode === currentCode + 1) {
  47239. currentArray.push(rescaledBaseWidths[glyphIndex]);
  47240. currentCode += 1;
  47241. } else {
  47242. currentCode = unicode;
  47243. currentArray = [rescaledBaseWidths[glyphIndex]];
  47244. newWidths.push(unicode, currentArray);
  47245. }
  47246. }
  47247. return newWidths;
  47248. }
  47249. function getXfaFontDict(name) {
  47250. const widths = getXfaFontWidths(name);
  47251. const dict = new _primitives.Dict(null);
  47252. dict.set("BaseFont", _primitives.Name.get(name));
  47253. dict.set("Type", _primitives.Name.get("Font"));
  47254. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  47255. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  47256. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  47257. dict.set("W", widths);
  47258. dict.set("FirstChar", widths[0]);
  47259. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  47260. const descriptor = new _primitives.Dict(null);
  47261. dict.set("FontDescriptor", descriptor);
  47262. const systemInfo = new _primitives.Dict(null);
  47263. systemInfo.set("Ordering", "Identity");
  47264. systemInfo.set("Registry", "Adobe");
  47265. systemInfo.set("Supplement", 0);
  47266. dict.set("CIDSystemInfo", systemInfo);
  47267. return dict;
  47268. }
  47269. /***/ }),
  47270. /* 181 */
  47271. /***/ ((__unused_webpack_module, exports) => {
  47272. "use strict";
  47273. Object.defineProperty(exports, "__esModule", ({
  47274. value: true
  47275. }));
  47276. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  47277. 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];
  47278. exports.CalibriBoldFactors = CalibriBoldFactors;
  47279. const CalibriBoldMetrics = {
  47280. lineHeight: 1.2207,
  47281. lineGap: 0.2207
  47282. };
  47283. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  47284. 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];
  47285. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  47286. const CalibriBoldItalicMetrics = {
  47287. lineHeight: 1.2207,
  47288. lineGap: 0.2207
  47289. };
  47290. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  47291. 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];
  47292. exports.CalibriItalicFactors = CalibriItalicFactors;
  47293. const CalibriItalicMetrics = {
  47294. lineHeight: 1.2207,
  47295. lineGap: 0.2207
  47296. };
  47297. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  47298. 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];
  47299. exports.CalibriRegularFactors = CalibriRegularFactors;
  47300. const CalibriRegularMetrics = {
  47301. lineHeight: 1.2207,
  47302. lineGap: 0.2207
  47303. };
  47304. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  47305. /***/ }),
  47306. /* 182 */
  47307. /***/ ((__unused_webpack_module, exports) => {
  47308. "use strict";
  47309. Object.defineProperty(exports, "__esModule", ({
  47310. value: true
  47311. }));
  47312. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  47313. 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];
  47314. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  47315. const HelveticaBoldMetrics = {
  47316. lineHeight: 1.2,
  47317. lineGap: 0.2
  47318. };
  47319. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  47320. 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];
  47321. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  47322. const HelveticaBoldItalicMetrics = {
  47323. lineHeight: 1.35,
  47324. lineGap: 0.2
  47325. };
  47326. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  47327. 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];
  47328. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  47329. const HelveticaItalicMetrics = {
  47330. lineHeight: 1.35,
  47331. lineGap: 0.2
  47332. };
  47333. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  47334. 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];
  47335. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  47336. const HelveticaRegularMetrics = {
  47337. lineHeight: 1.2,
  47338. lineGap: 0.2
  47339. };
  47340. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  47341. /***/ }),
  47342. /* 183 */
  47343. /***/ ((__unused_webpack_module, exports) => {
  47344. "use strict";
  47345. Object.defineProperty(exports, "__esModule", ({
  47346. value: true
  47347. }));
  47348. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  47349. 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];
  47350. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  47351. 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];
  47352. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  47353. 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];
  47354. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  47355. 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];
  47356. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  47357. 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];
  47358. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  47359. 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];
  47360. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  47361. 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];
  47362. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  47363. 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];
  47364. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  47365. /***/ }),
  47366. /* 184 */
  47367. /***/ ((__unused_webpack_module, exports) => {
  47368. "use strict";
  47369. Object.defineProperty(exports, "__esModule", ({
  47370. value: true
  47371. }));
  47372. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  47373. 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];
  47374. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  47375. const MyriadProBoldMetrics = {
  47376. lineHeight: 1.2,
  47377. lineGap: 0.2
  47378. };
  47379. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  47380. 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];
  47381. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  47382. const MyriadProBoldItalicMetrics = {
  47383. lineHeight: 1.2,
  47384. lineGap: 0.2
  47385. };
  47386. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  47387. 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];
  47388. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  47389. const MyriadProItalicMetrics = {
  47390. lineHeight: 1.2,
  47391. lineGap: 0.2
  47392. };
  47393. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  47394. 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];
  47395. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  47396. const MyriadProRegularMetrics = {
  47397. lineHeight: 1.2,
  47398. lineGap: 0.2
  47399. };
  47400. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  47401. /***/ }),
  47402. /* 185 */
  47403. /***/ ((__unused_webpack_module, exports) => {
  47404. "use strict";
  47405. Object.defineProperty(exports, "__esModule", ({
  47406. value: true
  47407. }));
  47408. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  47409. 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];
  47410. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  47411. const SegoeuiBoldMetrics = {
  47412. lineHeight: 1.33008,
  47413. lineGap: 0
  47414. };
  47415. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  47416. 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];
  47417. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  47418. const SegoeuiBoldItalicMetrics = {
  47419. lineHeight: 1.33008,
  47420. lineGap: 0
  47421. };
  47422. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  47423. 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];
  47424. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  47425. const SegoeuiItalicMetrics = {
  47426. lineHeight: 1.33008,
  47427. lineGap: 0
  47428. };
  47429. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  47430. 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];
  47431. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  47432. const SegoeuiRegularMetrics = {
  47433. lineHeight: 1.33008,
  47434. lineGap: 0
  47435. };
  47436. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  47437. /***/ }),
  47438. /* 186 */
  47439. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47440. "use strict";
  47441. Object.defineProperty(exports, "__esModule", ({
  47442. value: true
  47443. }));
  47444. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  47445. exports.isPDFFunction = isPDFFunction;
  47446. var _primitives = __w_pdfjs_require__(134);
  47447. var _util = __w_pdfjs_require__(2);
  47448. var _ps_parser = __w_pdfjs_require__(187);
  47449. var _base_stream = __w_pdfjs_require__(136);
  47450. var _image_utils = __w_pdfjs_require__(188);
  47451. class PDFFunctionFactory {
  47452. constructor(_ref) {
  47453. let {
  47454. xref,
  47455. isEvalSupported = true
  47456. } = _ref;
  47457. this.xref = xref;
  47458. this.isEvalSupported = isEvalSupported !== false;
  47459. }
  47460. create(fn) {
  47461. const cachedFunction = this.getCached(fn);
  47462. if (cachedFunction) {
  47463. return cachedFunction;
  47464. }
  47465. const parsedFunction = PDFFunction.parse({
  47466. xref: this.xref,
  47467. isEvalSupported: this.isEvalSupported,
  47468. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  47469. });
  47470. this._cache(fn, parsedFunction);
  47471. return parsedFunction;
  47472. }
  47473. createFromArray(fnObj) {
  47474. const cachedFunction = this.getCached(fnObj);
  47475. if (cachedFunction) {
  47476. return cachedFunction;
  47477. }
  47478. const parsedFunction = PDFFunction.parseArray({
  47479. xref: this.xref,
  47480. isEvalSupported: this.isEvalSupported,
  47481. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  47482. });
  47483. this._cache(fnObj, parsedFunction);
  47484. return parsedFunction;
  47485. }
  47486. getCached(cacheKey) {
  47487. let fnRef;
  47488. if (cacheKey instanceof _primitives.Ref) {
  47489. fnRef = cacheKey;
  47490. } else if (cacheKey instanceof _primitives.Dict) {
  47491. fnRef = cacheKey.objId;
  47492. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47493. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47494. }
  47495. if (fnRef) {
  47496. const localFunction = this._localFunctionCache.getByRef(fnRef);
  47497. if (localFunction) {
  47498. return localFunction;
  47499. }
  47500. }
  47501. return null;
  47502. }
  47503. _cache(cacheKey, parsedFunction) {
  47504. if (!parsedFunction) {
  47505. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  47506. }
  47507. let fnRef;
  47508. if (cacheKey instanceof _primitives.Ref) {
  47509. fnRef = cacheKey;
  47510. } else if (cacheKey instanceof _primitives.Dict) {
  47511. fnRef = cacheKey.objId;
  47512. } else if (cacheKey instanceof _base_stream.BaseStream) {
  47513. fnRef = cacheKey.dict && cacheKey.dict.objId;
  47514. }
  47515. if (fnRef) {
  47516. this._localFunctionCache.set(null, fnRef, parsedFunction);
  47517. }
  47518. }
  47519. get _localFunctionCache() {
  47520. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  47521. }
  47522. }
  47523. exports.PDFFunctionFactory = PDFFunctionFactory;
  47524. function toNumberArray(arr) {
  47525. if (!Array.isArray(arr)) {
  47526. return null;
  47527. }
  47528. const length = arr.length;
  47529. for (let i = 0; i < length; i++) {
  47530. if (typeof arr[i] !== "number") {
  47531. const result = new Array(length);
  47532. for (let j = 0; j < length; j++) {
  47533. result[j] = +arr[j];
  47534. }
  47535. return result;
  47536. }
  47537. }
  47538. return arr;
  47539. }
  47540. class PDFFunction {
  47541. static getSampleArray(size, outputSize, bps, stream) {
  47542. let i, ii;
  47543. let length = 1;
  47544. for (i = 0, ii = size.length; i < ii; i++) {
  47545. length *= size[i];
  47546. }
  47547. length *= outputSize;
  47548. const array = new Array(length);
  47549. let codeSize = 0;
  47550. let codeBuf = 0;
  47551. const sampleMul = 1.0 / (2.0 ** bps - 1);
  47552. const strBytes = stream.getBytes((length * bps + 7) / 8);
  47553. let strIdx = 0;
  47554. for (i = 0; i < length; i++) {
  47555. while (codeSize < bps) {
  47556. codeBuf <<= 8;
  47557. codeBuf |= strBytes[strIdx++];
  47558. codeSize += 8;
  47559. }
  47560. codeSize -= bps;
  47561. array[i] = (codeBuf >> codeSize) * sampleMul;
  47562. codeBuf &= (1 << codeSize) - 1;
  47563. }
  47564. return array;
  47565. }
  47566. static parse(_ref2) {
  47567. let {
  47568. xref,
  47569. isEvalSupported,
  47570. fn
  47571. } = _ref2;
  47572. const dict = fn.dict || fn;
  47573. const typeNum = dict.get("FunctionType");
  47574. switch (typeNum) {
  47575. case 0:
  47576. return this.constructSampled({
  47577. xref,
  47578. isEvalSupported,
  47579. fn,
  47580. dict
  47581. });
  47582. case 1:
  47583. break;
  47584. case 2:
  47585. return this.constructInterpolated({
  47586. xref,
  47587. isEvalSupported,
  47588. dict
  47589. });
  47590. case 3:
  47591. return this.constructStiched({
  47592. xref,
  47593. isEvalSupported,
  47594. dict
  47595. });
  47596. case 4:
  47597. return this.constructPostScript({
  47598. xref,
  47599. isEvalSupported,
  47600. fn,
  47601. dict
  47602. });
  47603. }
  47604. throw new _util.FormatError("Unknown type of function");
  47605. }
  47606. static parseArray(_ref3) {
  47607. let {
  47608. xref,
  47609. isEvalSupported,
  47610. fnObj
  47611. } = _ref3;
  47612. if (!Array.isArray(fnObj)) {
  47613. return this.parse({
  47614. xref,
  47615. isEvalSupported,
  47616. fn: fnObj
  47617. });
  47618. }
  47619. const fnArray = [];
  47620. for (const fn of fnObj) {
  47621. fnArray.push(this.parse({
  47622. xref,
  47623. isEvalSupported,
  47624. fn: xref.fetchIfRef(fn)
  47625. }));
  47626. }
  47627. return function (src, srcOffset, dest, destOffset) {
  47628. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  47629. fnArray[i](src, srcOffset, dest, destOffset + i);
  47630. }
  47631. };
  47632. }
  47633. static constructSampled(_ref4) {
  47634. let {
  47635. xref,
  47636. isEvalSupported,
  47637. fn,
  47638. dict
  47639. } = _ref4;
  47640. function toMultiArray(arr) {
  47641. const inputLength = arr.length;
  47642. const out = [];
  47643. let index = 0;
  47644. for (let i = 0; i < inputLength; i += 2) {
  47645. out[index++] = [arr[i], arr[i + 1]];
  47646. }
  47647. return out;
  47648. }
  47649. function interpolate(x, xmin, xmax, ymin, ymax) {
  47650. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  47651. }
  47652. let domain = toNumberArray(dict.getArray("Domain"));
  47653. let range = toNumberArray(dict.getArray("Range"));
  47654. if (!domain || !range) {
  47655. throw new _util.FormatError("No domain or range");
  47656. }
  47657. const inputSize = domain.length / 2;
  47658. const outputSize = range.length / 2;
  47659. domain = toMultiArray(domain);
  47660. range = toMultiArray(range);
  47661. const size = toNumberArray(dict.getArray("Size"));
  47662. const bps = dict.get("BitsPerSample");
  47663. const order = dict.get("Order") || 1;
  47664. if (order !== 1) {
  47665. (0, _util.info)("No support for cubic spline interpolation: " + order);
  47666. }
  47667. let encode = toNumberArray(dict.getArray("Encode"));
  47668. if (!encode) {
  47669. encode = [];
  47670. for (let i = 0; i < inputSize; ++i) {
  47671. encode.push([0, size[i] - 1]);
  47672. }
  47673. } else {
  47674. encode = toMultiArray(encode);
  47675. }
  47676. let decode = toNumberArray(dict.getArray("Decode"));
  47677. if (!decode) {
  47678. decode = range;
  47679. } else {
  47680. decode = toMultiArray(decode);
  47681. }
  47682. const samples = this.getSampleArray(size, outputSize, bps, fn);
  47683. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  47684. const cubeVertices = 1 << inputSize;
  47685. const cubeN = new Float64Array(cubeVertices);
  47686. const cubeVertex = new Uint32Array(cubeVertices);
  47687. let i, j;
  47688. for (j = 0; j < cubeVertices; j++) {
  47689. cubeN[j] = 1;
  47690. }
  47691. let k = outputSize,
  47692. pos = 1;
  47693. for (i = 0; i < inputSize; ++i) {
  47694. const domain_2i = domain[i][0];
  47695. const domain_2i_1 = domain[i][1];
  47696. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  47697. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  47698. const size_i = size[i];
  47699. e = Math.min(Math.max(e, 0), size_i - 1);
  47700. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  47701. const n0 = e0 + 1 - e;
  47702. const n1 = e - e0;
  47703. const offset0 = e0 * k;
  47704. const offset1 = offset0 + k;
  47705. for (j = 0; j < cubeVertices; j++) {
  47706. if (j & pos) {
  47707. cubeN[j] *= n1;
  47708. cubeVertex[j] += offset1;
  47709. } else {
  47710. cubeN[j] *= n0;
  47711. cubeVertex[j] += offset0;
  47712. }
  47713. }
  47714. k *= size_i;
  47715. pos <<= 1;
  47716. }
  47717. for (j = 0; j < outputSize; ++j) {
  47718. let rj = 0;
  47719. for (i = 0; i < cubeVertices; i++) {
  47720. rj += samples[cubeVertex[i] + j] * cubeN[i];
  47721. }
  47722. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  47723. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  47724. }
  47725. };
  47726. }
  47727. static constructInterpolated(_ref5) {
  47728. let {
  47729. xref,
  47730. isEvalSupported,
  47731. dict
  47732. } = _ref5;
  47733. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  47734. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  47735. const n = dict.get("N");
  47736. const diff = [];
  47737. for (let i = 0, ii = c0.length; i < ii; ++i) {
  47738. diff.push(c1[i] - c0[i]);
  47739. }
  47740. const length = diff.length;
  47741. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  47742. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  47743. for (let j = 0; j < length; ++j) {
  47744. dest[destOffset + j] = c0[j] + x * diff[j];
  47745. }
  47746. };
  47747. }
  47748. static constructStiched(_ref6) {
  47749. let {
  47750. xref,
  47751. isEvalSupported,
  47752. dict
  47753. } = _ref6;
  47754. const domain = toNumberArray(dict.getArray("Domain"));
  47755. if (!domain) {
  47756. throw new _util.FormatError("No domain");
  47757. }
  47758. const inputSize = domain.length / 2;
  47759. if (inputSize !== 1) {
  47760. throw new _util.FormatError("Bad domain for stiched function");
  47761. }
  47762. const fns = [];
  47763. for (const fn of dict.get("Functions")) {
  47764. fns.push(this.parse({
  47765. xref,
  47766. isEvalSupported,
  47767. fn: xref.fetchIfRef(fn)
  47768. }));
  47769. }
  47770. const bounds = toNumberArray(dict.getArray("Bounds"));
  47771. const encode = toNumberArray(dict.getArray("Encode"));
  47772. const tmpBuf = new Float32Array(1);
  47773. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  47774. const clip = function constructStichedFromIRClip(v, min, max) {
  47775. if (v > max) {
  47776. v = max;
  47777. } else if (v < min) {
  47778. v = min;
  47779. }
  47780. return v;
  47781. };
  47782. const v = clip(src[srcOffset], domain[0], domain[1]);
  47783. const length = bounds.length;
  47784. let i;
  47785. for (i = 0; i < length; ++i) {
  47786. if (v < bounds[i]) {
  47787. break;
  47788. }
  47789. }
  47790. let dmin = domain[0];
  47791. if (i > 0) {
  47792. dmin = bounds[i - 1];
  47793. }
  47794. let dmax = domain[1];
  47795. if (i < bounds.length) {
  47796. dmax = bounds[i];
  47797. }
  47798. const rmin = encode[2 * i];
  47799. const rmax = encode[2 * i + 1];
  47800. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  47801. fns[i](tmpBuf, 0, dest, destOffset);
  47802. };
  47803. }
  47804. static constructPostScript(_ref7) {
  47805. let {
  47806. xref,
  47807. isEvalSupported,
  47808. fn,
  47809. dict
  47810. } = _ref7;
  47811. const domain = toNumberArray(dict.getArray("Domain"));
  47812. const range = toNumberArray(dict.getArray("Range"));
  47813. if (!domain) {
  47814. throw new _util.FormatError("No domain.");
  47815. }
  47816. if (!range) {
  47817. throw new _util.FormatError("No range.");
  47818. }
  47819. const lexer = new _ps_parser.PostScriptLexer(fn);
  47820. const parser = new _ps_parser.PostScriptParser(lexer);
  47821. const code = parser.parse();
  47822. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  47823. const compiled = new PostScriptCompiler().compile(code, domain, range);
  47824. if (compiled) {
  47825. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  47826. }
  47827. }
  47828. (0, _util.info)("Unable to compile PS function");
  47829. const numOutputs = range.length >> 1;
  47830. const numInputs = domain.length >> 1;
  47831. const evaluator = new PostScriptEvaluator(code);
  47832. const cache = Object.create(null);
  47833. const MAX_CACHE_SIZE = 2048 * 4;
  47834. let cache_available = MAX_CACHE_SIZE;
  47835. const tmpBuf = new Float32Array(numInputs);
  47836. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  47837. let i, value;
  47838. let key = "";
  47839. const input = tmpBuf;
  47840. for (i = 0; i < numInputs; i++) {
  47841. value = src[srcOffset + i];
  47842. input[i] = value;
  47843. key += value + "_";
  47844. }
  47845. const cachedValue = cache[key];
  47846. if (cachedValue !== undefined) {
  47847. dest.set(cachedValue, destOffset);
  47848. return;
  47849. }
  47850. const output = new Float32Array(numOutputs);
  47851. const stack = evaluator.execute(input);
  47852. const stackIndex = stack.length - numOutputs;
  47853. for (i = 0; i < numOutputs; i++) {
  47854. value = stack[stackIndex + i];
  47855. let bound = range[i * 2];
  47856. if (value < bound) {
  47857. value = bound;
  47858. } else {
  47859. bound = range[i * 2 + 1];
  47860. if (value > bound) {
  47861. value = bound;
  47862. }
  47863. }
  47864. output[i] = value;
  47865. }
  47866. if (cache_available > 0) {
  47867. cache_available--;
  47868. cache[key] = output;
  47869. }
  47870. dest.set(output, destOffset);
  47871. };
  47872. }
  47873. }
  47874. function isPDFFunction(v) {
  47875. let fnDict;
  47876. if (typeof v !== "object") {
  47877. return false;
  47878. } else if (v instanceof _primitives.Dict) {
  47879. fnDict = v;
  47880. } else if (v instanceof _base_stream.BaseStream) {
  47881. fnDict = v.dict;
  47882. } else {
  47883. return false;
  47884. }
  47885. return fnDict.has("FunctionType");
  47886. }
  47887. class PostScriptStack {
  47888. static get MAX_STACK_SIZE() {
  47889. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  47890. }
  47891. constructor(initialStack) {
  47892. this.stack = initialStack ? Array.from(initialStack) : [];
  47893. }
  47894. push(value) {
  47895. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  47896. throw new Error("PostScript function stack overflow.");
  47897. }
  47898. this.stack.push(value);
  47899. }
  47900. pop() {
  47901. if (this.stack.length <= 0) {
  47902. throw new Error("PostScript function stack underflow.");
  47903. }
  47904. return this.stack.pop();
  47905. }
  47906. copy(n) {
  47907. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  47908. throw new Error("PostScript function stack overflow.");
  47909. }
  47910. const stack = this.stack;
  47911. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  47912. stack.push(stack[i]);
  47913. }
  47914. }
  47915. index(n) {
  47916. this.push(this.stack[this.stack.length - n - 1]);
  47917. }
  47918. roll(n, p) {
  47919. const stack = this.stack;
  47920. const l = stack.length - n;
  47921. const r = stack.length - 1;
  47922. const c = l + (p - Math.floor(p / n) * n);
  47923. for (let i = l, j = r; i < j; i++, j--) {
  47924. const t = stack[i];
  47925. stack[i] = stack[j];
  47926. stack[j] = t;
  47927. }
  47928. for (let i = l, j = c - 1; i < j; i++, j--) {
  47929. const t = stack[i];
  47930. stack[i] = stack[j];
  47931. stack[j] = t;
  47932. }
  47933. for (let i = c, j = r; i < j; i++, j--) {
  47934. const t = stack[i];
  47935. stack[i] = stack[j];
  47936. stack[j] = t;
  47937. }
  47938. }
  47939. }
  47940. class PostScriptEvaluator {
  47941. constructor(operators) {
  47942. this.operators = operators;
  47943. }
  47944. execute(initialStack) {
  47945. const stack = new PostScriptStack(initialStack);
  47946. let counter = 0;
  47947. const operators = this.operators;
  47948. const length = operators.length;
  47949. let operator, a, b;
  47950. while (counter < length) {
  47951. operator = operators[counter++];
  47952. if (typeof operator === "number") {
  47953. stack.push(operator);
  47954. continue;
  47955. }
  47956. switch (operator) {
  47957. case "jz":
  47958. b = stack.pop();
  47959. a = stack.pop();
  47960. if (!a) {
  47961. counter = b;
  47962. }
  47963. break;
  47964. case "j":
  47965. a = stack.pop();
  47966. counter = a;
  47967. break;
  47968. case "abs":
  47969. a = stack.pop();
  47970. stack.push(Math.abs(a));
  47971. break;
  47972. case "add":
  47973. b = stack.pop();
  47974. a = stack.pop();
  47975. stack.push(a + b);
  47976. break;
  47977. case "and":
  47978. b = stack.pop();
  47979. a = stack.pop();
  47980. if (typeof a === "boolean" && typeof b === "boolean") {
  47981. stack.push(a && b);
  47982. } else {
  47983. stack.push(a & b);
  47984. }
  47985. break;
  47986. case "atan":
  47987. a = stack.pop();
  47988. stack.push(Math.atan(a));
  47989. break;
  47990. case "bitshift":
  47991. b = stack.pop();
  47992. a = stack.pop();
  47993. if (a > 0) {
  47994. stack.push(a << b);
  47995. } else {
  47996. stack.push(a >> b);
  47997. }
  47998. break;
  47999. case "ceiling":
  48000. a = stack.pop();
  48001. stack.push(Math.ceil(a));
  48002. break;
  48003. case "copy":
  48004. a = stack.pop();
  48005. stack.copy(a);
  48006. break;
  48007. case "cos":
  48008. a = stack.pop();
  48009. stack.push(Math.cos(a));
  48010. break;
  48011. case "cvi":
  48012. a = stack.pop() | 0;
  48013. stack.push(a);
  48014. break;
  48015. case "cvr":
  48016. break;
  48017. case "div":
  48018. b = stack.pop();
  48019. a = stack.pop();
  48020. stack.push(a / b);
  48021. break;
  48022. case "dup":
  48023. stack.copy(1);
  48024. break;
  48025. case "eq":
  48026. b = stack.pop();
  48027. a = stack.pop();
  48028. stack.push(a === b);
  48029. break;
  48030. case "exch":
  48031. stack.roll(2, 1);
  48032. break;
  48033. case "exp":
  48034. b = stack.pop();
  48035. a = stack.pop();
  48036. stack.push(a ** b);
  48037. break;
  48038. case "false":
  48039. stack.push(false);
  48040. break;
  48041. case "floor":
  48042. a = stack.pop();
  48043. stack.push(Math.floor(a));
  48044. break;
  48045. case "ge":
  48046. b = stack.pop();
  48047. a = stack.pop();
  48048. stack.push(a >= b);
  48049. break;
  48050. case "gt":
  48051. b = stack.pop();
  48052. a = stack.pop();
  48053. stack.push(a > b);
  48054. break;
  48055. case "idiv":
  48056. b = stack.pop();
  48057. a = stack.pop();
  48058. stack.push(a / b | 0);
  48059. break;
  48060. case "index":
  48061. a = stack.pop();
  48062. stack.index(a);
  48063. break;
  48064. case "le":
  48065. b = stack.pop();
  48066. a = stack.pop();
  48067. stack.push(a <= b);
  48068. break;
  48069. case "ln":
  48070. a = stack.pop();
  48071. stack.push(Math.log(a));
  48072. break;
  48073. case "log":
  48074. a = stack.pop();
  48075. stack.push(Math.log(a) / Math.LN10);
  48076. break;
  48077. case "lt":
  48078. b = stack.pop();
  48079. a = stack.pop();
  48080. stack.push(a < b);
  48081. break;
  48082. case "mod":
  48083. b = stack.pop();
  48084. a = stack.pop();
  48085. stack.push(a % b);
  48086. break;
  48087. case "mul":
  48088. b = stack.pop();
  48089. a = stack.pop();
  48090. stack.push(a * b);
  48091. break;
  48092. case "ne":
  48093. b = stack.pop();
  48094. a = stack.pop();
  48095. stack.push(a !== b);
  48096. break;
  48097. case "neg":
  48098. a = stack.pop();
  48099. stack.push(-a);
  48100. break;
  48101. case "not":
  48102. a = stack.pop();
  48103. if (typeof a === "boolean") {
  48104. stack.push(!a);
  48105. } else {
  48106. stack.push(~a);
  48107. }
  48108. break;
  48109. case "or":
  48110. b = stack.pop();
  48111. a = stack.pop();
  48112. if (typeof a === "boolean" && typeof b === "boolean") {
  48113. stack.push(a || b);
  48114. } else {
  48115. stack.push(a | b);
  48116. }
  48117. break;
  48118. case "pop":
  48119. stack.pop();
  48120. break;
  48121. case "roll":
  48122. b = stack.pop();
  48123. a = stack.pop();
  48124. stack.roll(a, b);
  48125. break;
  48126. case "round":
  48127. a = stack.pop();
  48128. stack.push(Math.round(a));
  48129. break;
  48130. case "sin":
  48131. a = stack.pop();
  48132. stack.push(Math.sin(a));
  48133. break;
  48134. case "sqrt":
  48135. a = stack.pop();
  48136. stack.push(Math.sqrt(a));
  48137. break;
  48138. case "sub":
  48139. b = stack.pop();
  48140. a = stack.pop();
  48141. stack.push(a - b);
  48142. break;
  48143. case "true":
  48144. stack.push(true);
  48145. break;
  48146. case "truncate":
  48147. a = stack.pop();
  48148. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  48149. stack.push(a);
  48150. break;
  48151. case "xor":
  48152. b = stack.pop();
  48153. a = stack.pop();
  48154. if (typeof a === "boolean" && typeof b === "boolean") {
  48155. stack.push(a !== b);
  48156. } else {
  48157. stack.push(a ^ b);
  48158. }
  48159. break;
  48160. default:
  48161. throw new _util.FormatError(`Unknown operator ${operator}`);
  48162. }
  48163. }
  48164. return stack.stack;
  48165. }
  48166. }
  48167. exports.PostScriptEvaluator = PostScriptEvaluator;
  48168. class AstNode {
  48169. constructor(type) {
  48170. this.type = type;
  48171. }
  48172. visit(visitor) {
  48173. (0, _util.unreachable)("abstract method");
  48174. }
  48175. }
  48176. class AstArgument extends AstNode {
  48177. constructor(index, min, max) {
  48178. super("args");
  48179. this.index = index;
  48180. this.min = min;
  48181. this.max = max;
  48182. }
  48183. visit(visitor) {
  48184. visitor.visitArgument(this);
  48185. }
  48186. }
  48187. class AstLiteral extends AstNode {
  48188. constructor(number) {
  48189. super("literal");
  48190. this.number = number;
  48191. this.min = number;
  48192. this.max = number;
  48193. }
  48194. visit(visitor) {
  48195. visitor.visitLiteral(this);
  48196. }
  48197. }
  48198. class AstBinaryOperation extends AstNode {
  48199. constructor(op, arg1, arg2, min, max) {
  48200. super("binary");
  48201. this.op = op;
  48202. this.arg1 = arg1;
  48203. this.arg2 = arg2;
  48204. this.min = min;
  48205. this.max = max;
  48206. }
  48207. visit(visitor) {
  48208. visitor.visitBinaryOperation(this);
  48209. }
  48210. }
  48211. class AstMin extends AstNode {
  48212. constructor(arg, max) {
  48213. super("max");
  48214. this.arg = arg;
  48215. this.min = arg.min;
  48216. this.max = max;
  48217. }
  48218. visit(visitor) {
  48219. visitor.visitMin(this);
  48220. }
  48221. }
  48222. class AstVariable extends AstNode {
  48223. constructor(index, min, max) {
  48224. super("var");
  48225. this.index = index;
  48226. this.min = min;
  48227. this.max = max;
  48228. }
  48229. visit(visitor) {
  48230. visitor.visitVariable(this);
  48231. }
  48232. }
  48233. class AstVariableDefinition extends AstNode {
  48234. constructor(variable, arg) {
  48235. super("definition");
  48236. this.variable = variable;
  48237. this.arg = arg;
  48238. }
  48239. visit(visitor) {
  48240. visitor.visitVariableDefinition(this);
  48241. }
  48242. }
  48243. class ExpressionBuilderVisitor {
  48244. constructor() {
  48245. this.parts = [];
  48246. }
  48247. visitArgument(arg) {
  48248. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  48249. }
  48250. visitVariable(variable) {
  48251. this.parts.push("v", variable.index);
  48252. }
  48253. visitLiteral(literal) {
  48254. this.parts.push(literal.number);
  48255. }
  48256. visitBinaryOperation(operation) {
  48257. this.parts.push("(");
  48258. operation.arg1.visit(this);
  48259. this.parts.push(" ", operation.op, " ");
  48260. operation.arg2.visit(this);
  48261. this.parts.push(")");
  48262. }
  48263. visitVariableDefinition(definition) {
  48264. this.parts.push("var ");
  48265. definition.variable.visit(this);
  48266. this.parts.push(" = ");
  48267. definition.arg.visit(this);
  48268. this.parts.push(";");
  48269. }
  48270. visitMin(max) {
  48271. this.parts.push("Math.min(");
  48272. max.arg.visit(this);
  48273. this.parts.push(", ", max.max, ")");
  48274. }
  48275. toString() {
  48276. return this.parts.join("");
  48277. }
  48278. }
  48279. function buildAddOperation(num1, num2) {
  48280. if (num2.type === "literal" && num2.number === 0) {
  48281. return num1;
  48282. }
  48283. if (num1.type === "literal" && num1.number === 0) {
  48284. return num2;
  48285. }
  48286. if (num2.type === "literal" && num1.type === "literal") {
  48287. return new AstLiteral(num1.number + num2.number);
  48288. }
  48289. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  48290. }
  48291. function buildMulOperation(num1, num2) {
  48292. if (num2.type === "literal") {
  48293. if (num2.number === 0) {
  48294. return new AstLiteral(0);
  48295. } else if (num2.number === 1) {
  48296. return num1;
  48297. } else if (num1.type === "literal") {
  48298. return new AstLiteral(num1.number * num2.number);
  48299. }
  48300. }
  48301. if (num1.type === "literal") {
  48302. if (num1.number === 0) {
  48303. return new AstLiteral(0);
  48304. } else if (num1.number === 1) {
  48305. return num2;
  48306. }
  48307. }
  48308. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48309. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  48310. return new AstBinaryOperation("*", num1, num2, min, max);
  48311. }
  48312. function buildSubOperation(num1, num2) {
  48313. if (num2.type === "literal") {
  48314. if (num2.number === 0) {
  48315. return num1;
  48316. } else if (num1.type === "literal") {
  48317. return new AstLiteral(num1.number - num2.number);
  48318. }
  48319. }
  48320. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  48321. return num2.arg2;
  48322. }
  48323. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  48324. }
  48325. function buildMinOperation(num1, max) {
  48326. if (num1.min >= max) {
  48327. return new AstLiteral(max);
  48328. } else if (num1.max <= max) {
  48329. return num1;
  48330. }
  48331. return new AstMin(num1, max);
  48332. }
  48333. class PostScriptCompiler {
  48334. compile(code, domain, range) {
  48335. const stack = [];
  48336. const instructions = [];
  48337. const inputSize = domain.length >> 1,
  48338. outputSize = range.length >> 1;
  48339. let lastRegister = 0;
  48340. let n, j;
  48341. let num1, num2, ast1, ast2, tmpVar, item;
  48342. for (let i = 0; i < inputSize; i++) {
  48343. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  48344. }
  48345. for (let i = 0, ii = code.length; i < ii; i++) {
  48346. item = code[i];
  48347. if (typeof item === "number") {
  48348. stack.push(new AstLiteral(item));
  48349. continue;
  48350. }
  48351. switch (item) {
  48352. case "add":
  48353. if (stack.length < 2) {
  48354. return null;
  48355. }
  48356. num2 = stack.pop();
  48357. num1 = stack.pop();
  48358. stack.push(buildAddOperation(num1, num2));
  48359. break;
  48360. case "cvr":
  48361. if (stack.length < 1) {
  48362. return null;
  48363. }
  48364. break;
  48365. case "mul":
  48366. if (stack.length < 2) {
  48367. return null;
  48368. }
  48369. num2 = stack.pop();
  48370. num1 = stack.pop();
  48371. stack.push(buildMulOperation(num1, num2));
  48372. break;
  48373. case "sub":
  48374. if (stack.length < 2) {
  48375. return null;
  48376. }
  48377. num2 = stack.pop();
  48378. num1 = stack.pop();
  48379. stack.push(buildSubOperation(num1, num2));
  48380. break;
  48381. case "exch":
  48382. if (stack.length < 2) {
  48383. return null;
  48384. }
  48385. ast1 = stack.pop();
  48386. ast2 = stack.pop();
  48387. stack.push(ast1, ast2);
  48388. break;
  48389. case "pop":
  48390. if (stack.length < 1) {
  48391. return null;
  48392. }
  48393. stack.pop();
  48394. break;
  48395. case "index":
  48396. if (stack.length < 1) {
  48397. return null;
  48398. }
  48399. num1 = stack.pop();
  48400. if (num1.type !== "literal") {
  48401. return null;
  48402. }
  48403. n = num1.number;
  48404. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  48405. return null;
  48406. }
  48407. ast1 = stack[stack.length - n - 1];
  48408. if (ast1.type === "literal" || ast1.type === "var") {
  48409. stack.push(ast1);
  48410. break;
  48411. }
  48412. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48413. stack[stack.length - n - 1] = tmpVar;
  48414. stack.push(tmpVar);
  48415. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48416. break;
  48417. case "dup":
  48418. if (stack.length < 1) {
  48419. return null;
  48420. }
  48421. 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]) {
  48422. num1 = stack.pop();
  48423. stack.push(buildMinOperation(num1, code[i + 1]));
  48424. i += 6;
  48425. break;
  48426. }
  48427. ast1 = stack.at(-1);
  48428. if (ast1.type === "literal" || ast1.type === "var") {
  48429. stack.push(ast1);
  48430. break;
  48431. }
  48432. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  48433. stack[stack.length - 1] = tmpVar;
  48434. stack.push(tmpVar);
  48435. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  48436. break;
  48437. case "roll":
  48438. if (stack.length < 2) {
  48439. return null;
  48440. }
  48441. num2 = stack.pop();
  48442. num1 = stack.pop();
  48443. if (num2.type !== "literal" || num1.type !== "literal") {
  48444. return null;
  48445. }
  48446. j = num2.number;
  48447. n = num1.number;
  48448. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  48449. return null;
  48450. }
  48451. j = (j % n + n) % n;
  48452. if (j === 0) {
  48453. break;
  48454. }
  48455. stack.push(...stack.splice(stack.length - n, n - j));
  48456. break;
  48457. default:
  48458. return null;
  48459. }
  48460. }
  48461. if (stack.length !== outputSize) {
  48462. return null;
  48463. }
  48464. const result = [];
  48465. for (const instruction of instructions) {
  48466. const statementBuilder = new ExpressionBuilderVisitor();
  48467. instruction.visit(statementBuilder);
  48468. result.push(statementBuilder.toString());
  48469. }
  48470. for (let i = 0, ii = stack.length; i < ii; i++) {
  48471. const expr = stack[i],
  48472. statementBuilder = new ExpressionBuilderVisitor();
  48473. expr.visit(statementBuilder);
  48474. const min = range[i * 2],
  48475. max = range[i * 2 + 1];
  48476. const out = [statementBuilder.toString()];
  48477. if (min > expr.min) {
  48478. out.unshift("Math.max(", min, ", ");
  48479. out.push(")");
  48480. }
  48481. if (max < expr.max) {
  48482. out.unshift("Math.min(", max, ", ");
  48483. out.push(")");
  48484. }
  48485. out.unshift("dest[destOffset + ", i, "] = ");
  48486. out.push(";");
  48487. result.push(out.join(""));
  48488. }
  48489. return result.join("\n");
  48490. }
  48491. }
  48492. exports.PostScriptCompiler = PostScriptCompiler;
  48493. /***/ }),
  48494. /* 187 */
  48495. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48496. "use strict";
  48497. Object.defineProperty(exports, "__esModule", ({
  48498. value: true
  48499. }));
  48500. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  48501. var _util = __w_pdfjs_require__(2);
  48502. var _primitives = __w_pdfjs_require__(134);
  48503. var _core_utils = __w_pdfjs_require__(135);
  48504. class PostScriptParser {
  48505. constructor(lexer) {
  48506. this.lexer = lexer;
  48507. this.operators = [];
  48508. this.token = null;
  48509. this.prev = null;
  48510. }
  48511. nextToken() {
  48512. this.prev = this.token;
  48513. this.token = this.lexer.getToken();
  48514. }
  48515. accept(type) {
  48516. if (this.token.type === type) {
  48517. this.nextToken();
  48518. return true;
  48519. }
  48520. return false;
  48521. }
  48522. expect(type) {
  48523. if (this.accept(type)) {
  48524. return true;
  48525. }
  48526. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  48527. }
  48528. parse() {
  48529. this.nextToken();
  48530. this.expect(PostScriptTokenTypes.LBRACE);
  48531. this.parseBlock();
  48532. this.expect(PostScriptTokenTypes.RBRACE);
  48533. return this.operators;
  48534. }
  48535. parseBlock() {
  48536. while (true) {
  48537. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48538. this.operators.push(this.prev.value);
  48539. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48540. this.operators.push(this.prev.value);
  48541. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48542. this.parseCondition();
  48543. } else {
  48544. return;
  48545. }
  48546. }
  48547. }
  48548. parseCondition() {
  48549. const conditionLocation = this.operators.length;
  48550. this.operators.push(null, null);
  48551. this.parseBlock();
  48552. this.expect(PostScriptTokenTypes.RBRACE);
  48553. if (this.accept(PostScriptTokenTypes.IF)) {
  48554. this.operators[conditionLocation] = this.operators.length;
  48555. this.operators[conditionLocation + 1] = "jz";
  48556. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48557. const jumpLocation = this.operators.length;
  48558. this.operators.push(null, null);
  48559. const endOfTrue = this.operators.length;
  48560. this.parseBlock();
  48561. this.expect(PostScriptTokenTypes.RBRACE);
  48562. this.expect(PostScriptTokenTypes.IFELSE);
  48563. this.operators[jumpLocation] = this.operators.length;
  48564. this.operators[jumpLocation + 1] = "j";
  48565. this.operators[conditionLocation] = endOfTrue;
  48566. this.operators[conditionLocation + 1] = "jz";
  48567. } else {
  48568. throw new _util.FormatError("PS Function: error parsing conditional.");
  48569. }
  48570. }
  48571. }
  48572. exports.PostScriptParser = PostScriptParser;
  48573. const PostScriptTokenTypes = {
  48574. LBRACE: 0,
  48575. RBRACE: 1,
  48576. NUMBER: 2,
  48577. OPERATOR: 3,
  48578. IF: 4,
  48579. IFELSE: 5
  48580. };
  48581. class PostScriptToken {
  48582. static get opCache() {
  48583. return (0, _util.shadow)(this, "opCache", Object.create(null));
  48584. }
  48585. constructor(type, value) {
  48586. this.type = type;
  48587. this.value = value;
  48588. }
  48589. static getOperator(op) {
  48590. const opValue = PostScriptToken.opCache[op];
  48591. if (opValue) {
  48592. return opValue;
  48593. }
  48594. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  48595. }
  48596. static get LBRACE() {
  48597. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  48598. }
  48599. static get RBRACE() {
  48600. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  48601. }
  48602. static get IF() {
  48603. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  48604. }
  48605. static get IFELSE() {
  48606. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  48607. }
  48608. }
  48609. class PostScriptLexer {
  48610. constructor(stream) {
  48611. this.stream = stream;
  48612. this.nextChar();
  48613. this.strBuf = [];
  48614. }
  48615. nextChar() {
  48616. return this.currentChar = this.stream.getByte();
  48617. }
  48618. getToken() {
  48619. let comment = false;
  48620. let ch = this.currentChar;
  48621. while (true) {
  48622. if (ch < 0) {
  48623. return _primitives.EOF;
  48624. }
  48625. if (comment) {
  48626. if (ch === 0x0a || ch === 0x0d) {
  48627. comment = false;
  48628. }
  48629. } else if (ch === 0x25) {
  48630. comment = true;
  48631. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  48632. break;
  48633. }
  48634. ch = this.nextChar();
  48635. }
  48636. switch (ch | 0) {
  48637. case 0x30:
  48638. case 0x31:
  48639. case 0x32:
  48640. case 0x33:
  48641. case 0x34:
  48642. case 0x35:
  48643. case 0x36:
  48644. case 0x37:
  48645. case 0x38:
  48646. case 0x39:
  48647. case 0x2b:
  48648. case 0x2d:
  48649. case 0x2e:
  48650. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  48651. case 0x7b:
  48652. this.nextChar();
  48653. return PostScriptToken.LBRACE;
  48654. case 0x7d:
  48655. this.nextChar();
  48656. return PostScriptToken.RBRACE;
  48657. }
  48658. const strBuf = this.strBuf;
  48659. strBuf.length = 0;
  48660. strBuf[0] = String.fromCharCode(ch);
  48661. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  48662. strBuf.push(String.fromCharCode(ch));
  48663. }
  48664. const str = strBuf.join("");
  48665. switch (str.toLowerCase()) {
  48666. case "if":
  48667. return PostScriptToken.IF;
  48668. case "ifelse":
  48669. return PostScriptToken.IFELSE;
  48670. default:
  48671. return PostScriptToken.getOperator(str);
  48672. }
  48673. }
  48674. getNumber() {
  48675. let ch = this.currentChar;
  48676. const strBuf = this.strBuf;
  48677. strBuf.length = 0;
  48678. strBuf[0] = String.fromCharCode(ch);
  48679. while ((ch = this.nextChar()) >= 0) {
  48680. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  48681. strBuf.push(String.fromCharCode(ch));
  48682. } else {
  48683. break;
  48684. }
  48685. }
  48686. const value = parseFloat(strBuf.join(""));
  48687. if (isNaN(value)) {
  48688. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  48689. }
  48690. return value;
  48691. }
  48692. }
  48693. exports.PostScriptLexer = PostScriptLexer;
  48694. /***/ }),
  48695. /* 188 */
  48696. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48697. "use strict";
  48698. Object.defineProperty(exports, "__esModule", ({
  48699. value: true
  48700. }));
  48701. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  48702. var _util = __w_pdfjs_require__(2);
  48703. var _primitives = __w_pdfjs_require__(134);
  48704. class BaseLocalCache {
  48705. constructor(options) {
  48706. if (this.constructor === BaseLocalCache) {
  48707. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  48708. }
  48709. this._onlyRefs = (options && options.onlyRefs) === true;
  48710. if (!this._onlyRefs) {
  48711. this._nameRefMap = new Map();
  48712. this._imageMap = new Map();
  48713. }
  48714. this._imageCache = new _primitives.RefSetCache();
  48715. }
  48716. getByName(name) {
  48717. if (this._onlyRefs) {
  48718. (0, _util.unreachable)("Should not call `getByName` method.");
  48719. }
  48720. const ref = this._nameRefMap.get(name);
  48721. if (ref) {
  48722. return this.getByRef(ref);
  48723. }
  48724. return this._imageMap.get(name) || null;
  48725. }
  48726. getByRef(ref) {
  48727. return this._imageCache.get(ref) || null;
  48728. }
  48729. set(name, ref, data) {
  48730. (0, _util.unreachable)("Abstract method `set` called.");
  48731. }
  48732. }
  48733. class LocalImageCache extends BaseLocalCache {
  48734. set(name) {
  48735. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  48736. let data = arguments.length > 2 ? arguments[2] : undefined;
  48737. if (typeof name !== "string") {
  48738. throw new Error('LocalImageCache.set - expected "name" argument.');
  48739. }
  48740. if (ref) {
  48741. if (this._imageCache.has(ref)) {
  48742. return;
  48743. }
  48744. this._nameRefMap.set(name, ref);
  48745. this._imageCache.put(ref, data);
  48746. return;
  48747. }
  48748. if (this._imageMap.has(name)) {
  48749. return;
  48750. }
  48751. this._imageMap.set(name, data);
  48752. }
  48753. }
  48754. exports.LocalImageCache = LocalImageCache;
  48755. class LocalColorSpaceCache extends BaseLocalCache {
  48756. set() {
  48757. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  48758. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  48759. let data = arguments.length > 2 ? arguments[2] : undefined;
  48760. if (typeof name !== "string" && !ref) {
  48761. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  48762. }
  48763. if (ref) {
  48764. if (this._imageCache.has(ref)) {
  48765. return;
  48766. }
  48767. if (name !== null) {
  48768. this._nameRefMap.set(name, ref);
  48769. }
  48770. this._imageCache.put(ref, data);
  48771. return;
  48772. }
  48773. if (this._imageMap.has(name)) {
  48774. return;
  48775. }
  48776. this._imageMap.set(name, data);
  48777. }
  48778. }
  48779. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  48780. class LocalFunctionCache extends BaseLocalCache {
  48781. constructor(options) {
  48782. super({
  48783. onlyRefs: true
  48784. });
  48785. }
  48786. set() {
  48787. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  48788. let ref = arguments.length > 1 ? arguments[1] : undefined;
  48789. let data = arguments.length > 2 ? arguments[2] : undefined;
  48790. if (!ref) {
  48791. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  48792. }
  48793. if (this._imageCache.has(ref)) {
  48794. return;
  48795. }
  48796. this._imageCache.put(ref, data);
  48797. }
  48798. }
  48799. exports.LocalFunctionCache = LocalFunctionCache;
  48800. class LocalGStateCache extends BaseLocalCache {
  48801. set(name) {
  48802. let ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  48803. let data = arguments.length > 2 ? arguments[2] : undefined;
  48804. if (typeof name !== "string") {
  48805. throw new Error('LocalGStateCache.set - expected "name" argument.');
  48806. }
  48807. if (ref) {
  48808. if (this._imageCache.has(ref)) {
  48809. return;
  48810. }
  48811. this._nameRefMap.set(name, ref);
  48812. this._imageCache.put(ref, data);
  48813. return;
  48814. }
  48815. if (this._imageMap.has(name)) {
  48816. return;
  48817. }
  48818. this._imageMap.set(name, data);
  48819. }
  48820. }
  48821. exports.LocalGStateCache = LocalGStateCache;
  48822. class LocalTilingPatternCache extends BaseLocalCache {
  48823. constructor(options) {
  48824. super({
  48825. onlyRefs: true
  48826. });
  48827. }
  48828. set() {
  48829. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  48830. let ref = arguments.length > 1 ? arguments[1] : undefined;
  48831. let data = arguments.length > 2 ? arguments[2] : undefined;
  48832. if (!ref) {
  48833. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  48834. }
  48835. if (this._imageCache.has(ref)) {
  48836. return;
  48837. }
  48838. this._imageCache.put(ref, data);
  48839. }
  48840. }
  48841. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  48842. class GlobalImageCache {
  48843. static get NUM_PAGES_THRESHOLD() {
  48844. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  48845. }
  48846. static get MIN_IMAGES_TO_CACHE() {
  48847. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  48848. }
  48849. static get MAX_BYTE_SIZE() {
  48850. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  48851. }
  48852. constructor() {
  48853. this._refCache = new _primitives.RefSetCache();
  48854. this._imageCache = new _primitives.RefSetCache();
  48855. }
  48856. get _byteSize() {
  48857. let byteSize = 0;
  48858. for (const imageData of this._imageCache) {
  48859. byteSize += imageData.byteSize;
  48860. }
  48861. return byteSize;
  48862. }
  48863. get _cacheLimitReached() {
  48864. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  48865. return false;
  48866. }
  48867. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  48868. return false;
  48869. }
  48870. return true;
  48871. }
  48872. shouldCache(ref, pageIndex) {
  48873. const pageIndexSet = this._refCache.get(ref);
  48874. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  48875. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  48876. return false;
  48877. }
  48878. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  48879. return false;
  48880. }
  48881. return true;
  48882. }
  48883. addPageIndex(ref, pageIndex) {
  48884. let pageIndexSet = this._refCache.get(ref);
  48885. if (!pageIndexSet) {
  48886. pageIndexSet = new Set();
  48887. this._refCache.put(ref, pageIndexSet);
  48888. }
  48889. pageIndexSet.add(pageIndex);
  48890. }
  48891. addByteSize(ref, byteSize) {
  48892. const imageData = this._imageCache.get(ref);
  48893. if (!imageData) {
  48894. return;
  48895. }
  48896. if (imageData.byteSize) {
  48897. return;
  48898. }
  48899. imageData.byteSize = byteSize;
  48900. }
  48901. getData(ref, pageIndex) {
  48902. const pageIndexSet = this._refCache.get(ref);
  48903. if (!pageIndexSet) {
  48904. return null;
  48905. }
  48906. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  48907. return null;
  48908. }
  48909. const imageData = this._imageCache.get(ref);
  48910. if (!imageData) {
  48911. return null;
  48912. }
  48913. pageIndexSet.add(pageIndex);
  48914. return imageData;
  48915. }
  48916. setData(ref, data) {
  48917. if (!this._refCache.has(ref)) {
  48918. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  48919. }
  48920. if (this._imageCache.has(ref)) {
  48921. return;
  48922. }
  48923. if (this._cacheLimitReached) {
  48924. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  48925. return;
  48926. }
  48927. this._imageCache.put(ref, data);
  48928. }
  48929. clear() {
  48930. let onlyData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  48931. if (!onlyData) {
  48932. this._refCache.clear();
  48933. }
  48934. this._imageCache.clear();
  48935. }
  48936. }
  48937. exports.GlobalImageCache = GlobalImageCache;
  48938. /***/ }),
  48939. /* 189 */
  48940. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48941. "use strict";
  48942. Object.defineProperty(exports, "__esModule", ({
  48943. value: true
  48944. }));
  48945. exports.bidi = bidi;
  48946. var _util = __w_pdfjs_require__(2);
  48947. 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"];
  48948. 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"];
  48949. function isOdd(i) {
  48950. return (i & 1) !== 0;
  48951. }
  48952. function isEven(i) {
  48953. return (i & 1) === 0;
  48954. }
  48955. function findUnequal(arr, start, value) {
  48956. let j, jj;
  48957. for (j = start, jj = arr.length; j < jj; ++j) {
  48958. if (arr[j] !== value) {
  48959. return j;
  48960. }
  48961. }
  48962. return j;
  48963. }
  48964. function setValues(arr, start, end, value) {
  48965. for (let j = start; j < end; ++j) {
  48966. arr[j] = value;
  48967. }
  48968. }
  48969. function reverseValues(arr, start, end) {
  48970. for (let i = start, j = end - 1; i < j; ++i, --j) {
  48971. const temp = arr[i];
  48972. arr[i] = arr[j];
  48973. arr[j] = temp;
  48974. }
  48975. }
  48976. function createBidiText(str, isLTR) {
  48977. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  48978. let dir = "ltr";
  48979. if (vertical) {
  48980. dir = "ttb";
  48981. } else if (!isLTR) {
  48982. dir = "rtl";
  48983. }
  48984. return {
  48985. str,
  48986. dir
  48987. };
  48988. }
  48989. const chars = [];
  48990. const types = [];
  48991. function bidi(str) {
  48992. let startLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
  48993. let vertical = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  48994. let isLTR = true;
  48995. const strLength = str.length;
  48996. if (strLength === 0 || vertical) {
  48997. return createBidiText(str, isLTR, vertical);
  48998. }
  48999. chars.length = strLength;
  49000. types.length = strLength;
  49001. let numBidi = 0;
  49002. let i, ii;
  49003. for (i = 0; i < strLength; ++i) {
  49004. chars[i] = str.charAt(i);
  49005. const charCode = str.charCodeAt(i);
  49006. let charType = "L";
  49007. if (charCode <= 0x00ff) {
  49008. charType = baseTypes[charCode];
  49009. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  49010. charType = "R";
  49011. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  49012. charType = arabicTypes[charCode & 0xff];
  49013. if (!charType) {
  49014. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  49015. }
  49016. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  49017. charType = "AL";
  49018. }
  49019. if (charType === "R" || charType === "AL" || charType === "AN") {
  49020. numBidi++;
  49021. }
  49022. types[i] = charType;
  49023. }
  49024. if (numBidi === 0) {
  49025. isLTR = true;
  49026. return createBidiText(str, isLTR);
  49027. }
  49028. if (startLevel === -1) {
  49029. if (numBidi / strLength < 0.3 && strLength > 4) {
  49030. isLTR = true;
  49031. startLevel = 0;
  49032. } else {
  49033. isLTR = false;
  49034. startLevel = 1;
  49035. }
  49036. }
  49037. const levels = [];
  49038. for (i = 0; i < strLength; ++i) {
  49039. levels[i] = startLevel;
  49040. }
  49041. const e = isOdd(startLevel) ? "R" : "L";
  49042. const sor = e;
  49043. const eor = sor;
  49044. let lastType = sor;
  49045. for (i = 0; i < strLength; ++i) {
  49046. if (types[i] === "NSM") {
  49047. types[i] = lastType;
  49048. } else {
  49049. lastType = types[i];
  49050. }
  49051. }
  49052. lastType = sor;
  49053. let t;
  49054. for (i = 0; i < strLength; ++i) {
  49055. t = types[i];
  49056. if (t === "EN") {
  49057. types[i] = lastType === "AL" ? "AN" : "EN";
  49058. } else if (t === "R" || t === "L" || t === "AL") {
  49059. lastType = t;
  49060. }
  49061. }
  49062. for (i = 0; i < strLength; ++i) {
  49063. t = types[i];
  49064. if (t === "AL") {
  49065. types[i] = "R";
  49066. }
  49067. }
  49068. for (i = 1; i < strLength - 1; ++i) {
  49069. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  49070. types[i] = "EN";
  49071. }
  49072. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  49073. types[i] = types[i - 1];
  49074. }
  49075. }
  49076. for (i = 0; i < strLength; ++i) {
  49077. if (types[i] === "EN") {
  49078. for (let j = i - 1; j >= 0; --j) {
  49079. if (types[j] !== "ET") {
  49080. break;
  49081. }
  49082. types[j] = "EN";
  49083. }
  49084. for (let j = i + 1; j < strLength; ++j) {
  49085. if (types[j] !== "ET") {
  49086. break;
  49087. }
  49088. types[j] = "EN";
  49089. }
  49090. }
  49091. }
  49092. for (i = 0; i < strLength; ++i) {
  49093. t = types[i];
  49094. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  49095. types[i] = "ON";
  49096. }
  49097. }
  49098. lastType = sor;
  49099. for (i = 0; i < strLength; ++i) {
  49100. t = types[i];
  49101. if (t === "EN") {
  49102. types[i] = lastType === "L" ? "L" : "EN";
  49103. } else if (t === "R" || t === "L") {
  49104. lastType = t;
  49105. }
  49106. }
  49107. for (i = 0; i < strLength; ++i) {
  49108. if (types[i] === "ON") {
  49109. const end = findUnequal(types, i + 1, "ON");
  49110. let before = sor;
  49111. if (i > 0) {
  49112. before = types[i - 1];
  49113. }
  49114. let after = eor;
  49115. if (end + 1 < strLength) {
  49116. after = types[end + 1];
  49117. }
  49118. if (before !== "L") {
  49119. before = "R";
  49120. }
  49121. if (after !== "L") {
  49122. after = "R";
  49123. }
  49124. if (before === after) {
  49125. setValues(types, i, end, before);
  49126. }
  49127. i = end - 1;
  49128. }
  49129. }
  49130. for (i = 0; i < strLength; ++i) {
  49131. if (types[i] === "ON") {
  49132. types[i] = e;
  49133. }
  49134. }
  49135. for (i = 0; i < strLength; ++i) {
  49136. t = types[i];
  49137. if (isEven(levels[i])) {
  49138. if (t === "R") {
  49139. levels[i] += 1;
  49140. } else if (t === "AN" || t === "EN") {
  49141. levels[i] += 2;
  49142. }
  49143. } else {
  49144. if (t === "L" || t === "AN" || t === "EN") {
  49145. levels[i] += 1;
  49146. }
  49147. }
  49148. }
  49149. let highestLevel = -1;
  49150. let lowestOddLevel = 99;
  49151. let level;
  49152. for (i = 0, ii = levels.length; i < ii; ++i) {
  49153. level = levels[i];
  49154. if (highestLevel < level) {
  49155. highestLevel = level;
  49156. }
  49157. if (lowestOddLevel > level && isOdd(level)) {
  49158. lowestOddLevel = level;
  49159. }
  49160. }
  49161. for (level = highestLevel; level >= lowestOddLevel; --level) {
  49162. let start = -1;
  49163. for (i = 0, ii = levels.length; i < ii; ++i) {
  49164. if (levels[i] < level) {
  49165. if (start >= 0) {
  49166. reverseValues(chars, start, i);
  49167. start = -1;
  49168. }
  49169. } else if (start < 0) {
  49170. start = i;
  49171. }
  49172. }
  49173. if (start >= 0) {
  49174. reverseValues(chars, start, levels.length);
  49175. }
  49176. }
  49177. for (i = 0, ii = chars.length; i < ii; ++i) {
  49178. const ch = chars[i];
  49179. if (ch === "<" || ch === ">") {
  49180. chars[i] = "";
  49181. }
  49182. }
  49183. return createBidiText(chars.join(""), isLTR);
  49184. }
  49185. /***/ }),
  49186. /* 190 */
  49187. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49188. "use strict";
  49189. Object.defineProperty(exports, "__esModule", ({
  49190. value: true
  49191. }));
  49192. exports.MurmurHash3_64 = void 0;
  49193. var _util = __w_pdfjs_require__(2);
  49194. const SEED = 0xc3d2e1f0;
  49195. const MASK_HIGH = 0xffff0000;
  49196. const MASK_LOW = 0xffff;
  49197. class MurmurHash3_64 {
  49198. constructor(seed) {
  49199. this.h1 = seed ? seed & 0xffffffff : SEED;
  49200. this.h2 = seed ? seed & 0xffffffff : SEED;
  49201. }
  49202. update(input) {
  49203. let data, length;
  49204. if (typeof input === "string") {
  49205. data = new Uint8Array(input.length * 2);
  49206. length = 0;
  49207. for (let i = 0, ii = input.length; i < ii; i++) {
  49208. const code = input.charCodeAt(i);
  49209. if (code <= 0xff) {
  49210. data[length++] = code;
  49211. } else {
  49212. data[length++] = code >>> 8;
  49213. data[length++] = code & 0xff;
  49214. }
  49215. }
  49216. } else if ((0, _util.isArrayBuffer)(input)) {
  49217. data = input.slice();
  49218. length = data.byteLength;
  49219. } else {
  49220. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  49221. }
  49222. const blockCounts = length >> 2;
  49223. const tailLength = length - blockCounts * 4;
  49224. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  49225. let k1 = 0,
  49226. k2 = 0;
  49227. let h1 = this.h1,
  49228. h2 = this.h2;
  49229. const C1 = 0xcc9e2d51,
  49230. C2 = 0x1b873593;
  49231. const C1_LOW = C1 & MASK_LOW,
  49232. C2_LOW = C2 & MASK_LOW;
  49233. for (let i = 0; i < blockCounts; i++) {
  49234. if (i & 1) {
  49235. k1 = dataUint32[i];
  49236. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49237. k1 = k1 << 15 | k1 >>> 17;
  49238. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49239. h1 ^= k1;
  49240. h1 = h1 << 13 | h1 >>> 19;
  49241. h1 = h1 * 5 + 0xe6546b64;
  49242. } else {
  49243. k2 = dataUint32[i];
  49244. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  49245. k2 = k2 << 15 | k2 >>> 17;
  49246. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  49247. h2 ^= k2;
  49248. h2 = h2 << 13 | h2 >>> 19;
  49249. h2 = h2 * 5 + 0xe6546b64;
  49250. }
  49251. }
  49252. k1 = 0;
  49253. switch (tailLength) {
  49254. case 3:
  49255. k1 ^= data[blockCounts * 4 + 2] << 16;
  49256. case 2:
  49257. k1 ^= data[blockCounts * 4 + 1] << 8;
  49258. case 1:
  49259. k1 ^= data[blockCounts * 4];
  49260. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  49261. k1 = k1 << 15 | k1 >>> 17;
  49262. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  49263. if (blockCounts & 1) {
  49264. h1 ^= k1;
  49265. } else {
  49266. h2 ^= k1;
  49267. }
  49268. }
  49269. this.h1 = h1;
  49270. this.h2 = h2;
  49271. }
  49272. hexdigest() {
  49273. let h1 = this.h1,
  49274. h2 = this.h2;
  49275. h1 ^= h2 >>> 1;
  49276. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  49277. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  49278. h1 ^= h2 >>> 1;
  49279. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  49280. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  49281. h1 ^= h2 >>> 1;
  49282. const hex1 = (h1 >>> 0).toString(16),
  49283. hex2 = (h2 >>> 0).toString(16);
  49284. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  49285. }
  49286. }
  49287. exports.MurmurHash3_64 = MurmurHash3_64;
  49288. /***/ }),
  49289. /* 191 */
  49290. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49291. "use strict";
  49292. Object.defineProperty(exports, "__esModule", ({
  49293. value: true
  49294. }));
  49295. exports.OperatorList = void 0;
  49296. var _util = __w_pdfjs_require__(2);
  49297. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  49298. let state = parentState;
  49299. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  49300. const item = pattern[i];
  49301. state = state[item] || (state[item] = []);
  49302. }
  49303. state[pattern.at(-1)] = {
  49304. checkFn,
  49305. iterateFn,
  49306. processFn
  49307. };
  49308. }
  49309. const InitialState = [];
  49310. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  49311. const fnArray = context.fnArray;
  49312. const iFirstSave = context.iCurr - 3;
  49313. const pos = (i - iFirstSave) % 4;
  49314. switch (pos) {
  49315. case 0:
  49316. return fnArray[i] === _util.OPS.save;
  49317. case 1:
  49318. return fnArray[i] === _util.OPS.transform;
  49319. case 2:
  49320. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  49321. case 3:
  49322. return fnArray[i] === _util.OPS.restore;
  49323. }
  49324. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  49325. }, function foundInlineImageGroup(context, i) {
  49326. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  49327. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  49328. const MAX_WIDTH = 1000;
  49329. const IMAGE_PADDING = 1;
  49330. const fnArray = context.fnArray,
  49331. argsArray = context.argsArray;
  49332. const curr = context.iCurr;
  49333. const iFirstSave = curr - 3;
  49334. const iFirstTransform = curr - 2;
  49335. const iFirstPIIXO = curr - 1;
  49336. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  49337. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  49338. return i - (i - iFirstSave) % 4;
  49339. }
  49340. let maxX = 0;
  49341. const map = [];
  49342. let maxLineHeight = 0;
  49343. let currentX = IMAGE_PADDING,
  49344. currentY = IMAGE_PADDING;
  49345. for (let q = 0; q < count; q++) {
  49346. const transform = argsArray[iFirstTransform + (q << 2)];
  49347. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  49348. if (currentX + img.width > MAX_WIDTH) {
  49349. maxX = Math.max(maxX, currentX);
  49350. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  49351. currentX = 0;
  49352. maxLineHeight = 0;
  49353. }
  49354. map.push({
  49355. transform,
  49356. x: currentX,
  49357. y: currentY,
  49358. w: img.width,
  49359. h: img.height
  49360. });
  49361. currentX += img.width + 2 * IMAGE_PADDING;
  49362. maxLineHeight = Math.max(maxLineHeight, img.height);
  49363. }
  49364. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  49365. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  49366. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  49367. const imgRowSize = imgWidth << 2;
  49368. for (let q = 0; q < count; q++) {
  49369. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  49370. const rowSize = map[q].w << 2;
  49371. let dataOffset = 0;
  49372. let offset = map[q].x + map[q].y * imgWidth << 2;
  49373. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  49374. for (let k = 0, kk = map[q].h; k < kk; k++) {
  49375. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  49376. dataOffset += rowSize;
  49377. offset += imgRowSize;
  49378. }
  49379. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  49380. while (offset >= 0) {
  49381. data[offset - 4] = data[offset];
  49382. data[offset - 3] = data[offset + 1];
  49383. data[offset - 2] = data[offset + 2];
  49384. data[offset - 1] = data[offset + 3];
  49385. data[offset + rowSize] = data[offset + rowSize - 4];
  49386. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  49387. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  49388. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  49389. offset -= imgRowSize;
  49390. }
  49391. }
  49392. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  49393. argsArray.splice(iFirstSave, count * 4, [{
  49394. width: imgWidth,
  49395. height: imgHeight,
  49396. kind: _util.ImageKind.RGBA_32BPP,
  49397. data: imgData
  49398. }, map]);
  49399. return iFirstSave + 1;
  49400. });
  49401. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  49402. const fnArray = context.fnArray;
  49403. const iFirstSave = context.iCurr - 3;
  49404. const pos = (i - iFirstSave) % 4;
  49405. switch (pos) {
  49406. case 0:
  49407. return fnArray[i] === _util.OPS.save;
  49408. case 1:
  49409. return fnArray[i] === _util.OPS.transform;
  49410. case 2:
  49411. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  49412. case 3:
  49413. return fnArray[i] === _util.OPS.restore;
  49414. }
  49415. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  49416. }, function foundImageMaskGroup(context, i) {
  49417. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  49418. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  49419. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  49420. const fnArray = context.fnArray,
  49421. argsArray = context.argsArray;
  49422. const curr = context.iCurr;
  49423. const iFirstSave = curr - 3;
  49424. const iFirstTransform = curr - 2;
  49425. const iFirstPIMXO = curr - 1;
  49426. let count = Math.floor((i - iFirstSave) / 4);
  49427. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  49428. return i - (i - iFirstSave) % 4;
  49429. }
  49430. let isSameImage = false;
  49431. let iTransform, transformArgs;
  49432. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  49433. const firstTransformArg0 = argsArray[iFirstTransform][0],
  49434. firstTransformArg1 = argsArray[iFirstTransform][1],
  49435. firstTransformArg2 = argsArray[iFirstTransform][2],
  49436. firstTransformArg3 = argsArray[iFirstTransform][3];
  49437. if (firstTransformArg1 === firstTransformArg2) {
  49438. isSameImage = true;
  49439. iTransform = iFirstTransform + 4;
  49440. let iPIMXO = iFirstPIMXO + 4;
  49441. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  49442. transformArgs = argsArray[iTransform];
  49443. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  49444. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  49445. isSameImage = false;
  49446. } else {
  49447. count = q;
  49448. }
  49449. break;
  49450. }
  49451. }
  49452. }
  49453. if (isSameImage) {
  49454. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  49455. const positions = new Float32Array(count * 2);
  49456. iTransform = iFirstTransform;
  49457. for (let q = 0; q < count; q++, iTransform += 4) {
  49458. transformArgs = argsArray[iTransform];
  49459. positions[q << 1] = transformArgs[4];
  49460. positions[(q << 1) + 1] = transformArgs[5];
  49461. }
  49462. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  49463. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  49464. } else {
  49465. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  49466. const images = [];
  49467. for (let q = 0; q < count; q++) {
  49468. transformArgs = argsArray[iFirstTransform + (q << 2)];
  49469. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  49470. images.push({
  49471. data: maskParams.data,
  49472. width: maskParams.width,
  49473. height: maskParams.height,
  49474. interpolate: maskParams.interpolate,
  49475. count: maskParams.count,
  49476. transform: transformArgs
  49477. });
  49478. }
  49479. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  49480. argsArray.splice(iFirstSave, count * 4, [images]);
  49481. }
  49482. return iFirstSave + 1;
  49483. });
  49484. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  49485. const argsArray = context.argsArray;
  49486. const iFirstTransform = context.iCurr - 2;
  49487. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  49488. }, function iterateImageGroup(context, i) {
  49489. const fnArray = context.fnArray,
  49490. argsArray = context.argsArray;
  49491. const iFirstSave = context.iCurr - 3;
  49492. const pos = (i - iFirstSave) % 4;
  49493. switch (pos) {
  49494. case 0:
  49495. return fnArray[i] === _util.OPS.save;
  49496. case 1:
  49497. if (fnArray[i] !== _util.OPS.transform) {
  49498. return false;
  49499. }
  49500. const iFirstTransform = context.iCurr - 2;
  49501. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49502. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49503. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  49504. return false;
  49505. }
  49506. return true;
  49507. case 2:
  49508. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  49509. return false;
  49510. }
  49511. const iFirstPIXO = context.iCurr - 1;
  49512. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49513. if (argsArray[i][0] !== firstPIXOArg0) {
  49514. return false;
  49515. }
  49516. return true;
  49517. case 3:
  49518. return fnArray[i] === _util.OPS.restore;
  49519. }
  49520. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  49521. }, function (context, i) {
  49522. const MIN_IMAGES_IN_BLOCK = 3;
  49523. const MAX_IMAGES_IN_BLOCK = 1000;
  49524. const fnArray = context.fnArray,
  49525. argsArray = context.argsArray;
  49526. const curr = context.iCurr;
  49527. const iFirstSave = curr - 3;
  49528. const iFirstTransform = curr - 2;
  49529. const iFirstPIXO = curr - 1;
  49530. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  49531. const firstTransformArg0 = argsArray[iFirstTransform][0];
  49532. const firstTransformArg3 = argsArray[iFirstTransform][3];
  49533. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  49534. if (count < MIN_IMAGES_IN_BLOCK) {
  49535. return i - (i - iFirstSave) % 4;
  49536. }
  49537. const positions = new Float32Array(count * 2);
  49538. let iTransform = iFirstTransform;
  49539. for (let q = 0; q < count; q++, iTransform += 4) {
  49540. const transformArgs = argsArray[iTransform];
  49541. positions[q << 1] = transformArgs[4];
  49542. positions[(q << 1) + 1] = transformArgs[5];
  49543. }
  49544. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  49545. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  49546. argsArray.splice(iFirstSave, count * 4, args);
  49547. return iFirstSave + 1;
  49548. });
  49549. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  49550. const fnArray = context.fnArray,
  49551. argsArray = context.argsArray;
  49552. const iFirstSave = context.iCurr - 4;
  49553. const pos = (i - iFirstSave) % 5;
  49554. switch (pos) {
  49555. case 0:
  49556. return fnArray[i] === _util.OPS.beginText;
  49557. case 1:
  49558. return fnArray[i] === _util.OPS.setFont;
  49559. case 2:
  49560. return fnArray[i] === _util.OPS.setTextMatrix;
  49561. case 3:
  49562. if (fnArray[i] !== _util.OPS.showText) {
  49563. return false;
  49564. }
  49565. const iFirstSetFont = context.iCurr - 3;
  49566. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  49567. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  49568. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  49569. return false;
  49570. }
  49571. return true;
  49572. case 4:
  49573. return fnArray[i] === _util.OPS.endText;
  49574. }
  49575. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  49576. }, function (context, i) {
  49577. const MIN_CHARS_IN_BLOCK = 3;
  49578. const MAX_CHARS_IN_BLOCK = 1000;
  49579. const fnArray = context.fnArray,
  49580. argsArray = context.argsArray;
  49581. const curr = context.iCurr;
  49582. const iFirstBeginText = curr - 4;
  49583. const iFirstSetFont = curr - 3;
  49584. const iFirstSetTextMatrix = curr - 2;
  49585. const iFirstShowText = curr - 1;
  49586. const iFirstEndText = curr;
  49587. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  49588. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  49589. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  49590. if (count < MIN_CHARS_IN_BLOCK) {
  49591. return i - (i - iFirstBeginText) % 5;
  49592. }
  49593. let iFirst = iFirstBeginText;
  49594. 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) {
  49595. count++;
  49596. iFirst -= 5;
  49597. }
  49598. let iEndText = iFirst + 4;
  49599. for (let q = 1; q < count; q++) {
  49600. fnArray.splice(iEndText, 3);
  49601. argsArray.splice(iEndText, 3);
  49602. iEndText += 2;
  49603. }
  49604. return iEndText + 1;
  49605. });
  49606. class NullOptimizer {
  49607. constructor(queue) {
  49608. this.queue = queue;
  49609. }
  49610. _optimize() {}
  49611. push(fn, args) {
  49612. this.queue.fnArray.push(fn);
  49613. this.queue.argsArray.push(args);
  49614. this._optimize();
  49615. }
  49616. flush() {}
  49617. reset() {}
  49618. }
  49619. class QueueOptimizer extends NullOptimizer {
  49620. constructor(queue) {
  49621. super(queue);
  49622. this.state = null;
  49623. this.context = {
  49624. iCurr: 0,
  49625. fnArray: queue.fnArray,
  49626. argsArray: queue.argsArray
  49627. };
  49628. this.match = null;
  49629. this.lastProcessed = 0;
  49630. }
  49631. _optimize() {
  49632. const fnArray = this.queue.fnArray;
  49633. let i = this.lastProcessed,
  49634. ii = fnArray.length;
  49635. let state = this.state;
  49636. let match = this.match;
  49637. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  49638. this.lastProcessed = ii;
  49639. return;
  49640. }
  49641. const context = this.context;
  49642. while (i < ii) {
  49643. if (match) {
  49644. const iterate = (0, match.iterateFn)(context, i);
  49645. if (iterate) {
  49646. i++;
  49647. continue;
  49648. }
  49649. i = (0, match.processFn)(context, i + 1);
  49650. ii = fnArray.length;
  49651. match = null;
  49652. state = null;
  49653. if (i >= ii) {
  49654. break;
  49655. }
  49656. }
  49657. state = (state || InitialState)[fnArray[i]];
  49658. if (!state || Array.isArray(state)) {
  49659. i++;
  49660. continue;
  49661. }
  49662. context.iCurr = i;
  49663. i++;
  49664. if (state.checkFn && !(0, state.checkFn)(context)) {
  49665. state = null;
  49666. continue;
  49667. }
  49668. match = state;
  49669. state = null;
  49670. }
  49671. this.state = state;
  49672. this.match = match;
  49673. this.lastProcessed = i;
  49674. }
  49675. flush() {
  49676. while (this.match) {
  49677. const length = this.queue.fnArray.length;
  49678. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  49679. this.match = null;
  49680. this.state = null;
  49681. this._optimize();
  49682. }
  49683. }
  49684. reset() {
  49685. this.state = null;
  49686. this.match = null;
  49687. this.lastProcessed = 0;
  49688. }
  49689. }
  49690. class OperatorList {
  49691. static get CHUNK_SIZE() {
  49692. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  49693. }
  49694. static get CHUNK_SIZE_ABOUT() {
  49695. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  49696. }
  49697. constructor() {
  49698. let intent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  49699. let streamSink = arguments.length > 1 ? arguments[1] : undefined;
  49700. this._streamSink = streamSink;
  49701. this.fnArray = [];
  49702. this.argsArray = [];
  49703. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  49704. this.optimizer = new QueueOptimizer(this);
  49705. } else {
  49706. this.optimizer = new NullOptimizer(this);
  49707. }
  49708. this.dependencies = new Set();
  49709. this._totalLength = 0;
  49710. this.weight = 0;
  49711. this._resolved = streamSink ? null : Promise.resolve();
  49712. }
  49713. get length() {
  49714. return this.argsArray.length;
  49715. }
  49716. get ready() {
  49717. return this._resolved || this._streamSink.ready;
  49718. }
  49719. get totalLength() {
  49720. return this._totalLength + this.length;
  49721. }
  49722. addOp(fn, args) {
  49723. this.optimizer.push(fn, args);
  49724. this.weight++;
  49725. if (this._streamSink) {
  49726. if (this.weight >= OperatorList.CHUNK_SIZE) {
  49727. this.flush();
  49728. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  49729. this.flush();
  49730. }
  49731. }
  49732. }
  49733. addImageOps(fn, args, optionalContent) {
  49734. if (optionalContent !== undefined) {
  49735. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  49736. }
  49737. this.addOp(fn, args);
  49738. if (optionalContent !== undefined) {
  49739. this.addOp(_util.OPS.endMarkedContent, []);
  49740. }
  49741. }
  49742. addDependency(dependency) {
  49743. if (this.dependencies.has(dependency)) {
  49744. return;
  49745. }
  49746. this.dependencies.add(dependency);
  49747. this.addOp(_util.OPS.dependency, [dependency]);
  49748. }
  49749. addDependencies(dependencies) {
  49750. for (const dependency of dependencies) {
  49751. this.addDependency(dependency);
  49752. }
  49753. }
  49754. addOpList(opList) {
  49755. if (!(opList instanceof OperatorList)) {
  49756. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  49757. return;
  49758. }
  49759. for (const dependency of opList.dependencies) {
  49760. this.dependencies.add(dependency);
  49761. }
  49762. for (let i = 0, ii = opList.length; i < ii; i++) {
  49763. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  49764. }
  49765. }
  49766. getIR() {
  49767. return {
  49768. fnArray: this.fnArray,
  49769. argsArray: this.argsArray,
  49770. length: this.length
  49771. };
  49772. }
  49773. get _transfers() {
  49774. const transfers = [];
  49775. const {
  49776. fnArray,
  49777. argsArray,
  49778. length
  49779. } = this;
  49780. for (let i = 0; i < length; i++) {
  49781. switch (fnArray[i]) {
  49782. case _util.OPS.paintInlineImageXObject:
  49783. case _util.OPS.paintInlineImageXObjectGroup:
  49784. case _util.OPS.paintImageMaskXObject:
  49785. const arg = argsArray[i][0];
  49786. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  49787. transfers.push(arg.data.buffer);
  49788. }
  49789. break;
  49790. }
  49791. }
  49792. return transfers;
  49793. }
  49794. flush() {
  49795. let lastChunk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  49796. let separateAnnots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  49797. this.optimizer.flush();
  49798. const length = this.length;
  49799. this._totalLength += length;
  49800. this._streamSink.enqueue({
  49801. fnArray: this.fnArray,
  49802. argsArray: this.argsArray,
  49803. lastChunk,
  49804. separateAnnots,
  49805. length
  49806. }, 1, this._transfers);
  49807. this.dependencies.clear();
  49808. this.fnArray.length = 0;
  49809. this.argsArray.length = 0;
  49810. this.weight = 0;
  49811. this.optimizer.reset();
  49812. }
  49813. }
  49814. exports.OperatorList = OperatorList;
  49815. /***/ }),
  49816. /* 192 */
  49817. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49818. "use strict";
  49819. Object.defineProperty(exports, "__esModule", ({
  49820. value: true
  49821. }));
  49822. exports.PDFImage = void 0;
  49823. var _util = __w_pdfjs_require__(2);
  49824. var _image_utils = __w_pdfjs_require__(193);
  49825. var _base_stream = __w_pdfjs_require__(136);
  49826. var _colorspace = __w_pdfjs_require__(143);
  49827. var _decode_stream = __w_pdfjs_require__(148);
  49828. var _jpeg_stream = __w_pdfjs_require__(156);
  49829. var _jpx = __w_pdfjs_require__(159);
  49830. var _primitives = __w_pdfjs_require__(134);
  49831. function decodeAndClamp(value, addend, coefficient, max) {
  49832. value = addend + value * coefficient;
  49833. if (value < 0) {
  49834. value = 0;
  49835. } else if (value > max) {
  49836. value = max;
  49837. }
  49838. return value;
  49839. }
  49840. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  49841. const length = w2 * h2;
  49842. let dest;
  49843. if (bpc <= 8) {
  49844. dest = new Uint8Array(length);
  49845. } else if (bpc <= 16) {
  49846. dest = new Uint16Array(length);
  49847. } else {
  49848. dest = new Uint32Array(length);
  49849. }
  49850. const xRatio = w1 / w2;
  49851. const yRatio = h1 / h2;
  49852. let i,
  49853. j,
  49854. py,
  49855. newIndex = 0,
  49856. oldIndex;
  49857. const xScaled = new Uint16Array(w2);
  49858. const w1Scanline = w1;
  49859. for (i = 0; i < w2; i++) {
  49860. xScaled[i] = Math.floor(i * xRatio);
  49861. }
  49862. for (i = 0; i < h2; i++) {
  49863. py = Math.floor(i * yRatio) * w1Scanline;
  49864. for (j = 0; j < w2; j++) {
  49865. oldIndex = py + xScaled[j];
  49866. dest[newIndex++] = src[oldIndex];
  49867. }
  49868. }
  49869. return dest;
  49870. }
  49871. class PDFImage {
  49872. constructor(_ref) {
  49873. let {
  49874. xref,
  49875. res,
  49876. image,
  49877. isInline = false,
  49878. smask = null,
  49879. mask = null,
  49880. isMask = false,
  49881. pdfFunctionFactory,
  49882. localColorSpaceCache
  49883. } = _ref;
  49884. this.image = image;
  49885. const dict = image.dict;
  49886. const filter = dict.get("F", "Filter");
  49887. let filterName;
  49888. if (filter instanceof _primitives.Name) {
  49889. filterName = filter.name;
  49890. } else if (Array.isArray(filter)) {
  49891. const filterZero = xref.fetchIfRef(filter[0]);
  49892. if (filterZero instanceof _primitives.Name) {
  49893. filterName = filterZero.name;
  49894. }
  49895. }
  49896. switch (filterName) {
  49897. case "JPXDecode":
  49898. const jpxImage = new _jpx.JpxImage();
  49899. jpxImage.parseImageProperties(image.stream);
  49900. image.stream.reset();
  49901. image.width = jpxImage.width;
  49902. image.height = jpxImage.height;
  49903. image.bitsPerComponent = jpxImage.bitsPerComponent;
  49904. image.numComps = jpxImage.componentsCount;
  49905. break;
  49906. case "JBIG2Decode":
  49907. image.bitsPerComponent = 1;
  49908. image.numComps = 1;
  49909. break;
  49910. }
  49911. let width = dict.get("W", "Width");
  49912. let height = dict.get("H", "Height");
  49913. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  49914. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  49915. width = image.width;
  49916. height = image.height;
  49917. }
  49918. if (width < 1 || height < 1) {
  49919. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  49920. }
  49921. this.width = width;
  49922. this.height = height;
  49923. this.interpolate = dict.get("I", "Interpolate");
  49924. this.imageMask = dict.get("IM", "ImageMask") || false;
  49925. this.matte = dict.get("Matte") || false;
  49926. let bitsPerComponent = image.bitsPerComponent;
  49927. if (!bitsPerComponent) {
  49928. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  49929. if (!bitsPerComponent) {
  49930. if (this.imageMask) {
  49931. bitsPerComponent = 1;
  49932. } else {
  49933. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  49934. }
  49935. }
  49936. }
  49937. this.bpc = bitsPerComponent;
  49938. if (!this.imageMask) {
  49939. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  49940. if (!colorSpace) {
  49941. (0, _util.info)("JPX images (which do not require color spaces)");
  49942. switch (image.numComps) {
  49943. case 1:
  49944. colorSpace = _primitives.Name.get("DeviceGray");
  49945. break;
  49946. case 3:
  49947. colorSpace = _primitives.Name.get("DeviceRGB");
  49948. break;
  49949. case 4:
  49950. colorSpace = _primitives.Name.get("DeviceCMYK");
  49951. break;
  49952. default:
  49953. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  49954. }
  49955. }
  49956. this.colorSpace = _colorspace.ColorSpace.parse({
  49957. cs: colorSpace,
  49958. xref,
  49959. resources: isInline ? res : null,
  49960. pdfFunctionFactory,
  49961. localColorSpaceCache
  49962. });
  49963. this.numComps = this.colorSpace.numComps;
  49964. }
  49965. this.decode = dict.getArray("D", "Decode");
  49966. this.needsDecode = false;
  49967. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  49968. this.needsDecode = true;
  49969. const max = (1 << bitsPerComponent) - 1;
  49970. this.decodeCoefficients = [];
  49971. this.decodeAddends = [];
  49972. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  49973. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  49974. const dmin = this.decode[i];
  49975. const dmax = this.decode[i + 1];
  49976. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  49977. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  49978. }
  49979. }
  49980. if (smask) {
  49981. this.smask = new PDFImage({
  49982. xref,
  49983. res,
  49984. image: smask,
  49985. isInline,
  49986. pdfFunctionFactory,
  49987. localColorSpaceCache
  49988. });
  49989. } else if (mask) {
  49990. if (mask instanceof _base_stream.BaseStream) {
  49991. const maskDict = mask.dict,
  49992. imageMask = maskDict.get("IM", "ImageMask");
  49993. if (!imageMask) {
  49994. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  49995. } else {
  49996. this.mask = new PDFImage({
  49997. xref,
  49998. res,
  49999. image: mask,
  50000. isInline,
  50001. isMask: true,
  50002. pdfFunctionFactory,
  50003. localColorSpaceCache
  50004. });
  50005. }
  50006. } else {
  50007. this.mask = mask;
  50008. }
  50009. }
  50010. }
  50011. static async buildImage(_ref2) {
  50012. let {
  50013. xref,
  50014. res,
  50015. image,
  50016. isInline = false,
  50017. pdfFunctionFactory,
  50018. localColorSpaceCache
  50019. } = _ref2;
  50020. const imageData = image;
  50021. let smaskData = null;
  50022. let maskData = null;
  50023. const smask = image.dict.get("SMask");
  50024. const mask = image.dict.get("Mask");
  50025. if (smask) {
  50026. if (smask instanceof _base_stream.BaseStream) {
  50027. smaskData = smask;
  50028. } else {
  50029. (0, _util.warn)("Unsupported /SMask format.");
  50030. }
  50031. } else if (mask) {
  50032. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  50033. maskData = mask;
  50034. } else {
  50035. (0, _util.warn)("Unsupported /Mask format.");
  50036. }
  50037. }
  50038. return new PDFImage({
  50039. xref,
  50040. res,
  50041. image: imageData,
  50042. isInline,
  50043. smask: smaskData,
  50044. mask: maskData,
  50045. pdfFunctionFactory,
  50046. localColorSpaceCache
  50047. });
  50048. }
  50049. static createRawMask(_ref3) {
  50050. let {
  50051. imgArray,
  50052. width,
  50053. height,
  50054. imageIsFromDecodeStream,
  50055. inverseDecode,
  50056. interpolate
  50057. } = _ref3;
  50058. const computedLength = (width + 7 >> 3) * height;
  50059. const actualLength = imgArray.byteLength;
  50060. const haveFullData = computedLength === actualLength;
  50061. let data, i;
  50062. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  50063. data = imgArray;
  50064. } else if (!inverseDecode) {
  50065. data = new Uint8Array(imgArray);
  50066. } else {
  50067. data = new Uint8Array(computedLength);
  50068. data.set(imgArray);
  50069. data.fill(0xff, actualLength);
  50070. }
  50071. if (inverseDecode) {
  50072. for (i = 0; i < actualLength; i++) {
  50073. data[i] ^= 0xff;
  50074. }
  50075. }
  50076. return {
  50077. data,
  50078. width,
  50079. height,
  50080. interpolate
  50081. };
  50082. }
  50083. static createMask(_ref4) {
  50084. let {
  50085. imgArray,
  50086. width,
  50087. height,
  50088. imageIsFromDecodeStream,
  50089. inverseDecode,
  50090. interpolate,
  50091. isOffscreenCanvasSupported = true
  50092. } = _ref4;
  50093. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  50094. if (isSingleOpaquePixel) {
  50095. return {
  50096. isSingleOpaquePixel
  50097. };
  50098. }
  50099. if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
  50100. const canvas = new OffscreenCanvas(width, height);
  50101. const ctx = canvas.getContext("2d");
  50102. const imgData = ctx.createImageData(width, height);
  50103. (0, _image_utils.applyMaskImageData)({
  50104. src: imgArray,
  50105. dest: imgData.data,
  50106. width,
  50107. height,
  50108. inverseDecode
  50109. });
  50110. ctx.putImageData(imgData, 0, 0);
  50111. const bitmap = canvas.transferToImageBitmap();
  50112. return {
  50113. data: null,
  50114. width,
  50115. height,
  50116. interpolate,
  50117. bitmap
  50118. };
  50119. }
  50120. return this.createRawMask({
  50121. imgArray,
  50122. width,
  50123. height,
  50124. inverseDecode,
  50125. imageIsFromDecodeStream,
  50126. interpolate
  50127. });
  50128. }
  50129. get drawWidth() {
  50130. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  50131. }
  50132. get drawHeight() {
  50133. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  50134. }
  50135. decodeBuffer(buffer) {
  50136. const bpc = this.bpc;
  50137. const numComps = this.numComps;
  50138. const decodeAddends = this.decodeAddends;
  50139. const decodeCoefficients = this.decodeCoefficients;
  50140. const max = (1 << bpc) - 1;
  50141. let i, ii;
  50142. if (bpc === 1) {
  50143. for (i = 0, ii = buffer.length; i < ii; i++) {
  50144. buffer[i] = +!buffer[i];
  50145. }
  50146. return;
  50147. }
  50148. let index = 0;
  50149. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  50150. for (let j = 0; j < numComps; j++) {
  50151. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  50152. index++;
  50153. }
  50154. }
  50155. }
  50156. getComponents(buffer) {
  50157. const bpc = this.bpc;
  50158. if (bpc === 8) {
  50159. return buffer;
  50160. }
  50161. const width = this.width;
  50162. const height = this.height;
  50163. const numComps = this.numComps;
  50164. const length = width * height * numComps;
  50165. let bufferPos = 0;
  50166. let output;
  50167. if (bpc <= 8) {
  50168. output = new Uint8Array(length);
  50169. } else if (bpc <= 16) {
  50170. output = new Uint16Array(length);
  50171. } else {
  50172. output = new Uint32Array(length);
  50173. }
  50174. const rowComps = width * numComps;
  50175. const max = (1 << bpc) - 1;
  50176. let i = 0,
  50177. ii,
  50178. buf;
  50179. if (bpc === 1) {
  50180. let mask, loop1End, loop2End;
  50181. for (let j = 0; j < height; j++) {
  50182. loop1End = i + (rowComps & ~7);
  50183. loop2End = i + rowComps;
  50184. while (i < loop1End) {
  50185. buf = buffer[bufferPos++];
  50186. output[i] = buf >> 7 & 1;
  50187. output[i + 1] = buf >> 6 & 1;
  50188. output[i + 2] = buf >> 5 & 1;
  50189. output[i + 3] = buf >> 4 & 1;
  50190. output[i + 4] = buf >> 3 & 1;
  50191. output[i + 5] = buf >> 2 & 1;
  50192. output[i + 6] = buf >> 1 & 1;
  50193. output[i + 7] = buf & 1;
  50194. i += 8;
  50195. }
  50196. if (i < loop2End) {
  50197. buf = buffer[bufferPos++];
  50198. mask = 128;
  50199. while (i < loop2End) {
  50200. output[i++] = +!!(buf & mask);
  50201. mask >>= 1;
  50202. }
  50203. }
  50204. }
  50205. } else {
  50206. let bits = 0;
  50207. buf = 0;
  50208. for (i = 0, ii = length; i < ii; ++i) {
  50209. if (i % rowComps === 0) {
  50210. buf = 0;
  50211. bits = 0;
  50212. }
  50213. while (bits < bpc) {
  50214. buf = buf << 8 | buffer[bufferPos++];
  50215. bits += 8;
  50216. }
  50217. const remainingBits = bits - bpc;
  50218. let value = buf >> remainingBits;
  50219. if (value < 0) {
  50220. value = 0;
  50221. } else if (value > max) {
  50222. value = max;
  50223. }
  50224. output[i] = value;
  50225. buf &= (1 << remainingBits) - 1;
  50226. bits = remainingBits;
  50227. }
  50228. }
  50229. return output;
  50230. }
  50231. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  50232. const smask = this.smask;
  50233. const mask = this.mask;
  50234. let alphaBuf, sw, sh, i, ii, j;
  50235. if (smask) {
  50236. sw = smask.width;
  50237. sh = smask.height;
  50238. alphaBuf = new Uint8ClampedArray(sw * sh);
  50239. smask.fillGrayBuffer(alphaBuf);
  50240. if (sw !== width || sh !== height) {
  50241. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  50242. }
  50243. } else if (mask) {
  50244. if (mask instanceof PDFImage) {
  50245. sw = mask.width;
  50246. sh = mask.height;
  50247. alphaBuf = new Uint8ClampedArray(sw * sh);
  50248. mask.numComps = 1;
  50249. mask.fillGrayBuffer(alphaBuf);
  50250. for (i = 0, ii = sw * sh; i < ii; ++i) {
  50251. alphaBuf[i] = 255 - alphaBuf[i];
  50252. }
  50253. if (sw !== width || sh !== height) {
  50254. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  50255. }
  50256. } else if (Array.isArray(mask)) {
  50257. alphaBuf = new Uint8ClampedArray(width * height);
  50258. const numComps = this.numComps;
  50259. for (i = 0, ii = width * height; i < ii; ++i) {
  50260. let opacity = 0;
  50261. const imageOffset = i * numComps;
  50262. for (j = 0; j < numComps; ++j) {
  50263. const color = image[imageOffset + j];
  50264. const maskOffset = j * 2;
  50265. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  50266. opacity = 255;
  50267. break;
  50268. }
  50269. }
  50270. alphaBuf[i] = opacity;
  50271. }
  50272. } else {
  50273. throw new _util.FormatError("Unknown mask format.");
  50274. }
  50275. }
  50276. if (alphaBuf) {
  50277. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50278. rgbaBuf[j] = alphaBuf[i];
  50279. }
  50280. } else {
  50281. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  50282. rgbaBuf[j] = 255;
  50283. }
  50284. }
  50285. }
  50286. undoPreblend(buffer, width, height) {
  50287. const matte = this.smask && this.smask.matte;
  50288. if (!matte) {
  50289. return;
  50290. }
  50291. const matteRgb = this.colorSpace.getRgb(matte, 0);
  50292. const matteR = matteRgb[0];
  50293. const matteG = matteRgb[1];
  50294. const matteB = matteRgb[2];
  50295. const length = width * height * 4;
  50296. for (let i = 0; i < length; i += 4) {
  50297. const alpha = buffer[i + 3];
  50298. if (alpha === 0) {
  50299. buffer[i] = 255;
  50300. buffer[i + 1] = 255;
  50301. buffer[i + 2] = 255;
  50302. continue;
  50303. }
  50304. const k = 255 / alpha;
  50305. buffer[i] = (buffer[i] - matteR) * k + matteR;
  50306. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  50307. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  50308. }
  50309. }
  50310. createImageData() {
  50311. let forceRGBA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  50312. const drawWidth = this.drawWidth;
  50313. const drawHeight = this.drawHeight;
  50314. const imgData = {
  50315. width: drawWidth,
  50316. height: drawHeight,
  50317. interpolate: this.interpolate,
  50318. kind: 0,
  50319. data: null
  50320. };
  50321. const numComps = this.numComps;
  50322. const originalWidth = this.width;
  50323. const originalHeight = this.height;
  50324. const bpc = this.bpc;
  50325. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  50326. if (!forceRGBA) {
  50327. let kind;
  50328. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  50329. kind = _util.ImageKind.GRAYSCALE_1BPP;
  50330. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  50331. kind = _util.ImageKind.RGB_24BPP;
  50332. }
  50333. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  50334. imgData.kind = kind;
  50335. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  50336. if (this.needsDecode) {
  50337. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  50338. const buffer = imgData.data;
  50339. for (let i = 0, ii = buffer.length; i < ii; i++) {
  50340. buffer[i] ^= 0xff;
  50341. }
  50342. }
  50343. return imgData;
  50344. }
  50345. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  50346. let imageLength = originalHeight * rowBytes;
  50347. switch (this.colorSpace.name) {
  50348. case "DeviceGray":
  50349. imageLength *= 3;
  50350. case "DeviceRGB":
  50351. case "DeviceCMYK":
  50352. imgData.kind = _util.ImageKind.RGB_24BPP;
  50353. imgData.data = this.getImageBytes(imageLength, {
  50354. drawWidth,
  50355. drawHeight,
  50356. forceRGB: true
  50357. });
  50358. return imgData;
  50359. }
  50360. }
  50361. }
  50362. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  50363. internal: true
  50364. });
  50365. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  50366. const comps = this.getComponents(imgArray);
  50367. let alpha01, maybeUndoPreblend;
  50368. if (!forceRGBA && !this.smask && !this.mask) {
  50369. imgData.kind = _util.ImageKind.RGB_24BPP;
  50370. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  50371. alpha01 = 0;
  50372. maybeUndoPreblend = false;
  50373. } else {
  50374. imgData.kind = _util.ImageKind.RGBA_32BPP;
  50375. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  50376. alpha01 = 1;
  50377. maybeUndoPreblend = true;
  50378. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  50379. }
  50380. if (this.needsDecode) {
  50381. this.decodeBuffer(comps);
  50382. }
  50383. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  50384. if (maybeUndoPreblend) {
  50385. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  50386. }
  50387. return imgData;
  50388. }
  50389. fillGrayBuffer(buffer) {
  50390. const numComps = this.numComps;
  50391. if (numComps !== 1) {
  50392. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  50393. }
  50394. const width = this.width;
  50395. const height = this.height;
  50396. const bpc = this.bpc;
  50397. const rowBytes = width * numComps * bpc + 7 >> 3;
  50398. const imgArray = this.getImageBytes(height * rowBytes, {
  50399. internal: true
  50400. });
  50401. const comps = this.getComponents(imgArray);
  50402. let i, length;
  50403. if (bpc === 1) {
  50404. length = width * height;
  50405. if (this.needsDecode) {
  50406. for (i = 0; i < length; ++i) {
  50407. buffer[i] = comps[i] - 1 & 255;
  50408. }
  50409. } else {
  50410. for (i = 0; i < length; ++i) {
  50411. buffer[i] = -comps[i] & 255;
  50412. }
  50413. }
  50414. return;
  50415. }
  50416. if (this.needsDecode) {
  50417. this.decodeBuffer(comps);
  50418. }
  50419. length = width * height;
  50420. const scale = 255 / ((1 << bpc) - 1);
  50421. for (i = 0; i < length; ++i) {
  50422. buffer[i] = scale * comps[i];
  50423. }
  50424. }
  50425. getImageBytes(length, _ref5) {
  50426. let {
  50427. drawWidth,
  50428. drawHeight,
  50429. forceRGB = false,
  50430. internal = false
  50431. } = _ref5;
  50432. this.image.reset();
  50433. this.image.drawWidth = drawWidth || this.width;
  50434. this.image.drawHeight = drawHeight || this.height;
  50435. this.image.forceRGB = !!forceRGB;
  50436. const imageBytes = this.image.getBytes(length);
  50437. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  50438. return imageBytes;
  50439. }
  50440. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  50441. return new Uint8Array(imageBytes);
  50442. }
  50443. }
  50444. exports.PDFImage = PDFImage;
  50445. /***/ }),
  50446. /* 193 */
  50447. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50448. "use strict";
  50449. Object.defineProperty(exports, "__esModule", ({
  50450. value: true
  50451. }));
  50452. exports.applyMaskImageData = applyMaskImageData;
  50453. var _util = __w_pdfjs_require__(2);
  50454. function applyMaskImageData(_ref) {
  50455. let {
  50456. src,
  50457. srcPos = 0,
  50458. dest,
  50459. destPos = 0,
  50460. width,
  50461. height,
  50462. inverseDecode = false
  50463. } = _ref;
  50464. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  50465. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  50466. const widthInSource = width >> 3;
  50467. const widthRemainder = width & 7;
  50468. const srcLength = src.length;
  50469. dest = new Uint32Array(dest.buffer);
  50470. for (let i = 0; i < height; i++) {
  50471. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  50472. const elem = srcPos < srcLength ? src[srcPos] : 255;
  50473. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  50474. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  50475. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  50476. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  50477. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  50478. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  50479. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  50480. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  50481. }
  50482. if (widthRemainder === 0) {
  50483. continue;
  50484. }
  50485. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  50486. for (let j = 0; j < widthRemainder; j++) {
  50487. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  50488. }
  50489. }
  50490. return {
  50491. srcPos,
  50492. destPos
  50493. };
  50494. }
  50495. /***/ }),
  50496. /* 194 */
  50497. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50498. "use strict";
  50499. Object.defineProperty(exports, "__esModule", ({
  50500. value: true
  50501. }));
  50502. exports.incrementalUpdate = incrementalUpdate;
  50503. exports.writeDict = writeDict;
  50504. exports.writeObject = writeObject;
  50505. var _util = __w_pdfjs_require__(2);
  50506. var _primitives = __w_pdfjs_require__(134);
  50507. var _core_utils = __w_pdfjs_require__(135);
  50508. var _xml_parser = __w_pdfjs_require__(195);
  50509. var _base_stream = __w_pdfjs_require__(136);
  50510. var _crypto = __w_pdfjs_require__(196);
  50511. function writeObject(ref, obj, buffer, transform) {
  50512. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  50513. if (obj instanceof _primitives.Dict) {
  50514. writeDict(obj, buffer, transform);
  50515. } else if (obj instanceof _base_stream.BaseStream) {
  50516. writeStream(obj, buffer, transform);
  50517. }
  50518. buffer.push("\nendobj\n");
  50519. }
  50520. function writeDict(dict, buffer, transform) {
  50521. buffer.push("<<");
  50522. for (const key of dict.getKeys()) {
  50523. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  50524. writeValue(dict.getRaw(key), buffer, transform);
  50525. }
  50526. buffer.push(">>");
  50527. }
  50528. function writeStream(stream, buffer, transform) {
  50529. writeDict(stream.dict, buffer, transform);
  50530. buffer.push(" stream\n");
  50531. let string = stream.getString();
  50532. if (transform !== null) {
  50533. string = transform.encryptString(string);
  50534. }
  50535. buffer.push(string, "\nendstream\n");
  50536. }
  50537. function writeArray(array, buffer, transform) {
  50538. buffer.push("[");
  50539. let first = true;
  50540. for (const val of array) {
  50541. if (!first) {
  50542. buffer.push(" ");
  50543. } else {
  50544. first = false;
  50545. }
  50546. writeValue(val, buffer, transform);
  50547. }
  50548. buffer.push("]");
  50549. }
  50550. function writeValue(value, buffer, transform) {
  50551. if (value instanceof _primitives.Name) {
  50552. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  50553. } else if (value instanceof _primitives.Ref) {
  50554. buffer.push(`${value.num} ${value.gen} R`);
  50555. } else if (Array.isArray(value)) {
  50556. writeArray(value, buffer, transform);
  50557. } else if (typeof value === "string") {
  50558. if (transform !== null) {
  50559. value = transform.encryptString(value);
  50560. }
  50561. buffer.push(`(${(0, _util.escapeString)(value)})`);
  50562. } else if (typeof value === "number") {
  50563. buffer.push((0, _core_utils.numberToString)(value));
  50564. } else if (typeof value === "boolean") {
  50565. buffer.push(value.toString());
  50566. } else if (value instanceof _primitives.Dict) {
  50567. writeDict(value, buffer, transform);
  50568. } else if (value instanceof _base_stream.BaseStream) {
  50569. writeStream(value, buffer, transform);
  50570. } else if (value === null) {
  50571. buffer.push("null");
  50572. } else {
  50573. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  50574. }
  50575. }
  50576. function writeInt(number, size, offset, buffer) {
  50577. for (let i = size + offset - 1; i > offset - 1; i--) {
  50578. buffer[i] = number & 0xff;
  50579. number >>= 8;
  50580. }
  50581. return offset + size;
  50582. }
  50583. function writeString(string, offset, buffer) {
  50584. for (let i = 0, len = string.length; i < len; i++) {
  50585. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  50586. }
  50587. }
  50588. function computeMD5(filesize, xrefInfo) {
  50589. const time = Math.floor(Date.now() / 1000);
  50590. const filename = xrefInfo.filename || "";
  50591. const md5Buffer = [time.toString(), filename, filesize.toString()];
  50592. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  50593. for (const value of Object.values(xrefInfo.info)) {
  50594. md5Buffer.push(value);
  50595. md5BufferLen += value.length;
  50596. }
  50597. const array = new Uint8Array(md5BufferLen);
  50598. let offset = 0;
  50599. for (const str of md5Buffer) {
  50600. writeString(str, offset, array);
  50601. offset += str.length;
  50602. }
  50603. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  50604. }
  50605. function writeXFADataForAcroform(str, newRefs) {
  50606. const xml = new _xml_parser.SimpleXMLParser({
  50607. hasAttributes: true
  50608. }).parseFromString(str);
  50609. for (const {
  50610. xfa
  50611. } of newRefs) {
  50612. if (!xfa) {
  50613. continue;
  50614. }
  50615. const {
  50616. path,
  50617. value
  50618. } = xfa;
  50619. if (!path) {
  50620. continue;
  50621. }
  50622. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  50623. if (node) {
  50624. if (Array.isArray(value)) {
  50625. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  50626. } else {
  50627. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  50628. }
  50629. } else {
  50630. (0, _util.warn)(`Node not found for path: ${path}`);
  50631. }
  50632. }
  50633. const buffer = [];
  50634. xml.documentElement.dump(buffer);
  50635. return buffer.join("");
  50636. }
  50637. function updateXFA(_ref) {
  50638. let {
  50639. xfaData,
  50640. xfaDatasetsRef,
  50641. hasXfaDatasetsEntry,
  50642. acroFormRef,
  50643. acroForm,
  50644. newRefs,
  50645. xref,
  50646. xrefInfo
  50647. } = _ref;
  50648. if (xref === null) {
  50649. return;
  50650. }
  50651. if (!hasXfaDatasetsEntry) {
  50652. if (!acroFormRef) {
  50653. (0, _util.warn)("XFA - Cannot save it");
  50654. return;
  50655. }
  50656. const oldXfa = acroForm.get("XFA");
  50657. const newXfa = oldXfa.slice();
  50658. newXfa.splice(2, 0, "datasets");
  50659. newXfa.splice(3, 0, xfaDatasetsRef);
  50660. acroForm.set("XFA", newXfa);
  50661. const encrypt = xref.encrypt;
  50662. let transform = null;
  50663. if (encrypt) {
  50664. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  50665. }
  50666. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  50667. writeDict(acroForm, buffer, transform);
  50668. buffer.push("\n");
  50669. acroForm.set("XFA", oldXfa);
  50670. newRefs.push({
  50671. ref: acroFormRef,
  50672. data: buffer.join("")
  50673. });
  50674. }
  50675. if (xfaData === null) {
  50676. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  50677. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  50678. }
  50679. const encrypt = xref.encrypt;
  50680. if (encrypt) {
  50681. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  50682. xfaData = transform.encryptString(xfaData);
  50683. }
  50684. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  50685. newRefs.push({
  50686. ref: xfaDatasetsRef,
  50687. data
  50688. });
  50689. }
  50690. function incrementalUpdate(_ref2) {
  50691. let {
  50692. originalData,
  50693. xrefInfo,
  50694. newRefs,
  50695. xref = null,
  50696. hasXfa = false,
  50697. xfaDatasetsRef = null,
  50698. hasXfaDatasetsEntry = false,
  50699. acroFormRef = null,
  50700. acroForm = null,
  50701. xfaData = null
  50702. } = _ref2;
  50703. if (hasXfa) {
  50704. updateXFA({
  50705. xfaData,
  50706. xfaDatasetsRef,
  50707. hasXfaDatasetsEntry,
  50708. acroFormRef,
  50709. acroForm,
  50710. newRefs,
  50711. xref,
  50712. xrefInfo
  50713. });
  50714. }
  50715. const newXref = new _primitives.Dict(null);
  50716. const refForXrefTable = xrefInfo.newRef;
  50717. let buffer, baseOffset;
  50718. const lastByte = originalData.at(-1);
  50719. if (lastByte === 0x0a || lastByte === 0x0d) {
  50720. buffer = [];
  50721. baseOffset = originalData.length;
  50722. } else {
  50723. buffer = ["\n"];
  50724. baseOffset = originalData.length + 1;
  50725. }
  50726. newXref.set("Size", refForXrefTable.num + 1);
  50727. newXref.set("Prev", xrefInfo.startXRef);
  50728. newXref.set("Type", _primitives.Name.get("XRef"));
  50729. if (xrefInfo.rootRef !== null) {
  50730. newXref.set("Root", xrefInfo.rootRef);
  50731. }
  50732. if (xrefInfo.infoRef !== null) {
  50733. newXref.set("Info", xrefInfo.infoRef);
  50734. }
  50735. if (xrefInfo.encryptRef !== null) {
  50736. newXref.set("Encrypt", xrefInfo.encryptRef);
  50737. }
  50738. newRefs.push({
  50739. ref: refForXrefTable,
  50740. data: ""
  50741. });
  50742. newRefs = newRefs.sort((a, b) => {
  50743. return a.ref.num - b.ref.num;
  50744. });
  50745. const xrefTableData = [[0, 1, 0xffff]];
  50746. const indexes = [0, 1];
  50747. let maxOffset = 0;
  50748. for (const {
  50749. ref,
  50750. data
  50751. } of newRefs) {
  50752. maxOffset = Math.max(maxOffset, baseOffset);
  50753. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  50754. baseOffset += data.length;
  50755. indexes.push(ref.num, 1);
  50756. buffer.push(data);
  50757. }
  50758. newXref.set("Index", indexes);
  50759. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  50760. const md5 = computeMD5(baseOffset, xrefInfo);
  50761. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  50762. }
  50763. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  50764. const sizes = [1, offsetSize, 2];
  50765. const structSize = sizes[0] + sizes[1] + sizes[2];
  50766. const tableLength = structSize * xrefTableData.length;
  50767. newXref.set("W", sizes);
  50768. newXref.set("Length", tableLength);
  50769. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  50770. writeDict(newXref, buffer, null);
  50771. buffer.push(" stream\n");
  50772. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  50773. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  50774. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  50775. array.set(originalData);
  50776. let offset = originalData.length;
  50777. for (const str of buffer) {
  50778. writeString(str, offset, array);
  50779. offset += str.length;
  50780. }
  50781. for (const [type, objOffset, gen] of xrefTableData) {
  50782. offset = writeInt(type, sizes[0], offset, array);
  50783. offset = writeInt(objOffset, sizes[1], offset, array);
  50784. offset = writeInt(gen, sizes[2], offset, array);
  50785. }
  50786. writeString(footer, offset, array);
  50787. return array;
  50788. }
  50789. /***/ }),
  50790. /* 195 */
  50791. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50792. "use strict";
  50793. Object.defineProperty(exports, "__esModule", ({
  50794. value: true
  50795. }));
  50796. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  50797. var _core_utils = __w_pdfjs_require__(135);
  50798. const XMLParserErrorCode = {
  50799. NoError: 0,
  50800. EndOfDocument: -1,
  50801. UnterminatedCdat: -2,
  50802. UnterminatedXmlDeclaration: -3,
  50803. UnterminatedDoctypeDeclaration: -4,
  50804. UnterminatedComment: -5,
  50805. MalformedElement: -6,
  50806. OutOfMemory: -7,
  50807. UnterminatedAttributeValue: -8,
  50808. UnterminatedElement: -9,
  50809. ElementNeverBegun: -10
  50810. };
  50811. exports.XMLParserErrorCode = XMLParserErrorCode;
  50812. function isWhitespace(s, index) {
  50813. const ch = s[index];
  50814. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  50815. }
  50816. function isWhitespaceString(s) {
  50817. for (let i = 0, ii = s.length; i < ii; i++) {
  50818. if (!isWhitespace(s, i)) {
  50819. return false;
  50820. }
  50821. }
  50822. return true;
  50823. }
  50824. class XMLParserBase {
  50825. _resolveEntities(s) {
  50826. return s.replace(/&([^;]+);/g, (all, entity) => {
  50827. if (entity.substring(0, 2) === "#x") {
  50828. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  50829. } else if (entity.substring(0, 1) === "#") {
  50830. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  50831. }
  50832. switch (entity) {
  50833. case "lt":
  50834. return "<";
  50835. case "gt":
  50836. return ">";
  50837. case "amp":
  50838. return "&";
  50839. case "quot":
  50840. return '"';
  50841. case "apos":
  50842. return "'";
  50843. }
  50844. return this.onResolveEntity(entity);
  50845. });
  50846. }
  50847. _parseContent(s, start) {
  50848. const attributes = [];
  50849. let pos = start;
  50850. function skipWs() {
  50851. while (pos < s.length && isWhitespace(s, pos)) {
  50852. ++pos;
  50853. }
  50854. }
  50855. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  50856. ++pos;
  50857. }
  50858. const name = s.substring(start, pos);
  50859. skipWs();
  50860. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  50861. skipWs();
  50862. let attrName = "",
  50863. attrValue = "";
  50864. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  50865. attrName += s[pos];
  50866. ++pos;
  50867. }
  50868. skipWs();
  50869. if (s[pos] !== "=") {
  50870. return null;
  50871. }
  50872. ++pos;
  50873. skipWs();
  50874. const attrEndChar = s[pos];
  50875. if (attrEndChar !== '"' && attrEndChar !== "'") {
  50876. return null;
  50877. }
  50878. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  50879. if (attrEndIndex < 0) {
  50880. return null;
  50881. }
  50882. attrValue = s.substring(pos, attrEndIndex);
  50883. attributes.push({
  50884. name: attrName,
  50885. value: this._resolveEntities(attrValue)
  50886. });
  50887. pos = attrEndIndex + 1;
  50888. skipWs();
  50889. }
  50890. return {
  50891. name,
  50892. attributes,
  50893. parsed: pos - start
  50894. };
  50895. }
  50896. _parseProcessingInstruction(s, start) {
  50897. let pos = start;
  50898. function skipWs() {
  50899. while (pos < s.length && isWhitespace(s, pos)) {
  50900. ++pos;
  50901. }
  50902. }
  50903. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  50904. ++pos;
  50905. }
  50906. const name = s.substring(start, pos);
  50907. skipWs();
  50908. const attrStart = pos;
  50909. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  50910. ++pos;
  50911. }
  50912. const value = s.substring(attrStart, pos);
  50913. return {
  50914. name,
  50915. value,
  50916. parsed: pos - start
  50917. };
  50918. }
  50919. parseXml(s) {
  50920. let i = 0;
  50921. while (i < s.length) {
  50922. const ch = s[i];
  50923. let j = i;
  50924. if (ch === "<") {
  50925. ++j;
  50926. const ch2 = s[j];
  50927. let q;
  50928. switch (ch2) {
  50929. case "/":
  50930. ++j;
  50931. q = s.indexOf(">", j);
  50932. if (q < 0) {
  50933. this.onError(XMLParserErrorCode.UnterminatedElement);
  50934. return;
  50935. }
  50936. this.onEndElement(s.substring(j, q));
  50937. j = q + 1;
  50938. break;
  50939. case "?":
  50940. ++j;
  50941. const pi = this._parseProcessingInstruction(s, j);
  50942. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  50943. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  50944. return;
  50945. }
  50946. this.onPi(pi.name, pi.value);
  50947. j += pi.parsed + 2;
  50948. break;
  50949. case "!":
  50950. if (s.substring(j + 1, j + 3) === "--") {
  50951. q = s.indexOf("-->", j + 3);
  50952. if (q < 0) {
  50953. this.onError(XMLParserErrorCode.UnterminatedComment);
  50954. return;
  50955. }
  50956. this.onComment(s.substring(j + 3, q));
  50957. j = q + 3;
  50958. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  50959. q = s.indexOf("]]>", j + 8);
  50960. if (q < 0) {
  50961. this.onError(XMLParserErrorCode.UnterminatedCdat);
  50962. return;
  50963. }
  50964. this.onCdata(s.substring(j + 8, q));
  50965. j = q + 3;
  50966. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  50967. const q2 = s.indexOf("[", j + 8);
  50968. let complexDoctype = false;
  50969. q = s.indexOf(">", j + 8);
  50970. if (q < 0) {
  50971. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  50972. return;
  50973. }
  50974. if (q2 > 0 && q > q2) {
  50975. q = s.indexOf("]>", j + 8);
  50976. if (q < 0) {
  50977. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  50978. return;
  50979. }
  50980. complexDoctype = true;
  50981. }
  50982. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  50983. this.onDoctype(doctypeContent);
  50984. j = q + (complexDoctype ? 2 : 1);
  50985. } else {
  50986. this.onError(XMLParserErrorCode.MalformedElement);
  50987. return;
  50988. }
  50989. break;
  50990. default:
  50991. const content = this._parseContent(s, j);
  50992. if (content === null) {
  50993. this.onError(XMLParserErrorCode.MalformedElement);
  50994. return;
  50995. }
  50996. let isClosed = false;
  50997. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  50998. isClosed = true;
  50999. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  51000. this.onError(XMLParserErrorCode.UnterminatedElement);
  51001. return;
  51002. }
  51003. this.onBeginElement(content.name, content.attributes, isClosed);
  51004. j += content.parsed + (isClosed ? 2 : 1);
  51005. break;
  51006. }
  51007. } else {
  51008. while (j < s.length && s[j] !== "<") {
  51009. j++;
  51010. }
  51011. const text = s.substring(i, j);
  51012. this.onText(this._resolveEntities(text));
  51013. }
  51014. i = j;
  51015. }
  51016. }
  51017. onResolveEntity(name) {
  51018. return `&${name};`;
  51019. }
  51020. onPi(name, value) {}
  51021. onComment(text) {}
  51022. onCdata(text) {}
  51023. onDoctype(doctypeContent) {}
  51024. onText(text) {}
  51025. onBeginElement(name, attributes, isEmpty) {}
  51026. onEndElement(name) {}
  51027. onError(code) {}
  51028. }
  51029. exports.XMLParserBase = XMLParserBase;
  51030. class SimpleDOMNode {
  51031. constructor(nodeName, nodeValue) {
  51032. this.nodeName = nodeName;
  51033. this.nodeValue = nodeValue;
  51034. Object.defineProperty(this, "parentNode", {
  51035. value: null,
  51036. writable: true
  51037. });
  51038. }
  51039. get firstChild() {
  51040. return this.childNodes && this.childNodes[0];
  51041. }
  51042. get nextSibling() {
  51043. const childNodes = this.parentNode.childNodes;
  51044. if (!childNodes) {
  51045. return undefined;
  51046. }
  51047. const index = childNodes.indexOf(this);
  51048. if (index === -1) {
  51049. return undefined;
  51050. }
  51051. return childNodes[index + 1];
  51052. }
  51053. get textContent() {
  51054. if (!this.childNodes) {
  51055. return this.nodeValue || "";
  51056. }
  51057. return this.childNodes.map(function (child) {
  51058. return child.textContent;
  51059. }).join("");
  51060. }
  51061. get children() {
  51062. return this.childNodes || [];
  51063. }
  51064. hasChildNodes() {
  51065. return this.childNodes && this.childNodes.length > 0;
  51066. }
  51067. searchNode(paths, pos) {
  51068. if (pos >= paths.length) {
  51069. return this;
  51070. }
  51071. const component = paths[pos];
  51072. const stack = [];
  51073. let node = this;
  51074. while (true) {
  51075. if (component.name === node.nodeName) {
  51076. if (component.pos === 0) {
  51077. const res = node.searchNode(paths, pos + 1);
  51078. if (res !== null) {
  51079. return res;
  51080. }
  51081. } else if (stack.length === 0) {
  51082. return null;
  51083. } else {
  51084. const [parent] = stack.pop();
  51085. let siblingPos = 0;
  51086. for (const child of parent.childNodes) {
  51087. if (component.name === child.nodeName) {
  51088. if (siblingPos === component.pos) {
  51089. return child.searchNode(paths, pos + 1);
  51090. }
  51091. siblingPos++;
  51092. }
  51093. }
  51094. return node.searchNode(paths, pos + 1);
  51095. }
  51096. }
  51097. if (node.childNodes && node.childNodes.length !== 0) {
  51098. stack.push([node, 0]);
  51099. node = node.childNodes[0];
  51100. } else if (stack.length === 0) {
  51101. return null;
  51102. } else {
  51103. while (stack.length !== 0) {
  51104. const [parent, currentPos] = stack.pop();
  51105. const newPos = currentPos + 1;
  51106. if (newPos < parent.childNodes.length) {
  51107. stack.push([parent, newPos]);
  51108. node = parent.childNodes[newPos];
  51109. break;
  51110. }
  51111. }
  51112. if (stack.length === 0) {
  51113. return null;
  51114. }
  51115. }
  51116. }
  51117. }
  51118. dump(buffer) {
  51119. if (this.nodeName === "#text") {
  51120. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  51121. return;
  51122. }
  51123. buffer.push(`<${this.nodeName}`);
  51124. if (this.attributes) {
  51125. for (const attribute of this.attributes) {
  51126. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  51127. }
  51128. }
  51129. if (this.hasChildNodes()) {
  51130. buffer.push(">");
  51131. for (const child of this.childNodes) {
  51132. child.dump(buffer);
  51133. }
  51134. buffer.push(`</${this.nodeName}>`);
  51135. } else if (this.nodeValue) {
  51136. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  51137. } else {
  51138. buffer.push("/>");
  51139. }
  51140. }
  51141. }
  51142. exports.SimpleDOMNode = SimpleDOMNode;
  51143. class SimpleXMLParser extends XMLParserBase {
  51144. constructor(_ref) {
  51145. let {
  51146. hasAttributes = false,
  51147. lowerCaseName = false
  51148. } = _ref;
  51149. super();
  51150. this._currentFragment = null;
  51151. this._stack = null;
  51152. this._errorCode = XMLParserErrorCode.NoError;
  51153. this._hasAttributes = hasAttributes;
  51154. this._lowerCaseName = lowerCaseName;
  51155. }
  51156. parseFromString(data) {
  51157. this._currentFragment = [];
  51158. this._stack = [];
  51159. this._errorCode = XMLParserErrorCode.NoError;
  51160. this.parseXml(data);
  51161. if (this._errorCode !== XMLParserErrorCode.NoError) {
  51162. return undefined;
  51163. }
  51164. const [documentElement] = this._currentFragment;
  51165. if (!documentElement) {
  51166. return undefined;
  51167. }
  51168. return {
  51169. documentElement
  51170. };
  51171. }
  51172. onText(text) {
  51173. if (isWhitespaceString(text)) {
  51174. return;
  51175. }
  51176. const node = new SimpleDOMNode("#text", text);
  51177. this._currentFragment.push(node);
  51178. }
  51179. onCdata(text) {
  51180. const node = new SimpleDOMNode("#text", text);
  51181. this._currentFragment.push(node);
  51182. }
  51183. onBeginElement(name, attributes, isEmpty) {
  51184. if (this._lowerCaseName) {
  51185. name = name.toLowerCase();
  51186. }
  51187. const node = new SimpleDOMNode(name);
  51188. node.childNodes = [];
  51189. if (this._hasAttributes) {
  51190. node.attributes = attributes;
  51191. }
  51192. this._currentFragment.push(node);
  51193. if (isEmpty) {
  51194. return;
  51195. }
  51196. this._stack.push(this._currentFragment);
  51197. this._currentFragment = node.childNodes;
  51198. }
  51199. onEndElement(name) {
  51200. this._currentFragment = this._stack.pop() || [];
  51201. const lastElement = this._currentFragment.at(-1);
  51202. if (!lastElement) {
  51203. return null;
  51204. }
  51205. for (const childNode of lastElement.childNodes) {
  51206. childNode.parentNode = lastElement;
  51207. }
  51208. return lastElement;
  51209. }
  51210. onError(code) {
  51211. this._errorCode = code;
  51212. }
  51213. }
  51214. exports.SimpleXMLParser = SimpleXMLParser;
  51215. /***/ }),
  51216. /* 196 */
  51217. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51218. "use strict";
  51219. Object.defineProperty(exports, "__esModule", ({
  51220. value: true
  51221. }));
  51222. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  51223. exports.calculateSHA384 = calculateSHA384;
  51224. exports.calculateSHA512 = void 0;
  51225. var _util = __w_pdfjs_require__(2);
  51226. var _primitives = __w_pdfjs_require__(134);
  51227. var _decrypt_stream = __w_pdfjs_require__(197);
  51228. class ARCFourCipher {
  51229. constructor(key) {
  51230. this.a = 0;
  51231. this.b = 0;
  51232. const s = new Uint8Array(256);
  51233. const keyLength = key.length;
  51234. for (let i = 0; i < 256; ++i) {
  51235. s[i] = i;
  51236. }
  51237. for (let i = 0, j = 0; i < 256; ++i) {
  51238. const tmp = s[i];
  51239. j = j + tmp + key[i % keyLength] & 0xff;
  51240. s[i] = s[j];
  51241. s[j] = tmp;
  51242. }
  51243. this.s = s;
  51244. }
  51245. encryptBlock(data) {
  51246. let a = this.a,
  51247. b = this.b;
  51248. const s = this.s;
  51249. const n = data.length;
  51250. const output = new Uint8Array(n);
  51251. for (let i = 0; i < n; ++i) {
  51252. a = a + 1 & 0xff;
  51253. const tmp = s[a];
  51254. b = b + tmp & 0xff;
  51255. const tmp2 = s[b];
  51256. s[a] = tmp2;
  51257. s[b] = tmp;
  51258. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  51259. }
  51260. this.a = a;
  51261. this.b = b;
  51262. return output;
  51263. }
  51264. decryptBlock(data) {
  51265. return this.encryptBlock(data);
  51266. }
  51267. encrypt(data) {
  51268. return this.encryptBlock(data);
  51269. }
  51270. }
  51271. exports.ARCFourCipher = ARCFourCipher;
  51272. const calculateMD5 = function calculateMD5Closure() {
  51273. 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]);
  51274. 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]);
  51275. function hash(data, offset, length) {
  51276. let h0 = 1732584193,
  51277. h1 = -271733879,
  51278. h2 = -1732584194,
  51279. h3 = 271733878;
  51280. const paddedLength = length + 72 & ~63;
  51281. const padded = new Uint8Array(paddedLength);
  51282. let i, j;
  51283. for (i = 0; i < length; ++i) {
  51284. padded[i] = data[offset++];
  51285. }
  51286. padded[i++] = 0x80;
  51287. const n = paddedLength - 8;
  51288. while (i < n) {
  51289. padded[i++] = 0;
  51290. }
  51291. padded[i++] = length << 3 & 0xff;
  51292. padded[i++] = length >> 5 & 0xff;
  51293. padded[i++] = length >> 13 & 0xff;
  51294. padded[i++] = length >> 21 & 0xff;
  51295. padded[i++] = length >>> 29 & 0xff;
  51296. padded[i++] = 0;
  51297. padded[i++] = 0;
  51298. padded[i++] = 0;
  51299. const w = new Int32Array(16);
  51300. for (i = 0; i < paddedLength;) {
  51301. for (j = 0; j < 16; ++j, i += 4) {
  51302. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  51303. }
  51304. let a = h0,
  51305. b = h1,
  51306. c = h2,
  51307. d = h3,
  51308. f,
  51309. g;
  51310. for (j = 0; j < 64; ++j) {
  51311. if (j < 16) {
  51312. f = b & c | ~b & d;
  51313. g = j;
  51314. } else if (j < 32) {
  51315. f = d & b | ~d & c;
  51316. g = 5 * j + 1 & 15;
  51317. } else if (j < 48) {
  51318. f = b ^ c ^ d;
  51319. g = 3 * j + 5 & 15;
  51320. } else {
  51321. f = c ^ (b | ~d);
  51322. g = 7 * j & 15;
  51323. }
  51324. const tmp = d,
  51325. rotateArg = a + f + k[j] + w[g] | 0,
  51326. rotate = r[j];
  51327. d = c;
  51328. c = b;
  51329. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  51330. a = tmp;
  51331. }
  51332. h0 = h0 + a | 0;
  51333. h1 = h1 + b | 0;
  51334. h2 = h2 + c | 0;
  51335. h3 = h3 + d | 0;
  51336. }
  51337. 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]);
  51338. }
  51339. return hash;
  51340. }();
  51341. exports.calculateMD5 = calculateMD5;
  51342. class Word64 {
  51343. constructor(highInteger, lowInteger) {
  51344. this.high = highInteger | 0;
  51345. this.low = lowInteger | 0;
  51346. }
  51347. and(word) {
  51348. this.high &= word.high;
  51349. this.low &= word.low;
  51350. }
  51351. xor(word) {
  51352. this.high ^= word.high;
  51353. this.low ^= word.low;
  51354. }
  51355. or(word) {
  51356. this.high |= word.high;
  51357. this.low |= word.low;
  51358. }
  51359. shiftRight(places) {
  51360. if (places >= 32) {
  51361. this.low = this.high >>> places - 32 | 0;
  51362. this.high = 0;
  51363. } else {
  51364. this.low = this.low >>> places | this.high << 32 - places;
  51365. this.high = this.high >>> places | 0;
  51366. }
  51367. }
  51368. shiftLeft(places) {
  51369. if (places >= 32) {
  51370. this.high = this.low << places - 32;
  51371. this.low = 0;
  51372. } else {
  51373. this.high = this.high << places | this.low >>> 32 - places;
  51374. this.low <<= places;
  51375. }
  51376. }
  51377. rotateRight(places) {
  51378. let low, high;
  51379. if (places & 32) {
  51380. high = this.low;
  51381. low = this.high;
  51382. } else {
  51383. low = this.low;
  51384. high = this.high;
  51385. }
  51386. places &= 31;
  51387. this.low = low >>> places | high << 32 - places;
  51388. this.high = high >>> places | low << 32 - places;
  51389. }
  51390. not() {
  51391. this.high = ~this.high;
  51392. this.low = ~this.low;
  51393. }
  51394. add(word) {
  51395. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  51396. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  51397. if (lowAdd > 0xffffffff) {
  51398. highAdd += 1;
  51399. }
  51400. this.low = lowAdd | 0;
  51401. this.high = highAdd | 0;
  51402. }
  51403. copyTo(bytes, offset) {
  51404. bytes[offset] = this.high >>> 24 & 0xff;
  51405. bytes[offset + 1] = this.high >> 16 & 0xff;
  51406. bytes[offset + 2] = this.high >> 8 & 0xff;
  51407. bytes[offset + 3] = this.high & 0xff;
  51408. bytes[offset + 4] = this.low >>> 24 & 0xff;
  51409. bytes[offset + 5] = this.low >> 16 & 0xff;
  51410. bytes[offset + 6] = this.low >> 8 & 0xff;
  51411. bytes[offset + 7] = this.low & 0xff;
  51412. }
  51413. assign(word) {
  51414. this.high = word.high;
  51415. this.low = word.low;
  51416. }
  51417. }
  51418. const calculateSHA256 = function calculateSHA256Closure() {
  51419. function rotr(x, n) {
  51420. return x >>> n | x << 32 - n;
  51421. }
  51422. function ch(x, y, z) {
  51423. return x & y ^ ~x & z;
  51424. }
  51425. function maj(x, y, z) {
  51426. return x & y ^ x & z ^ y & z;
  51427. }
  51428. function sigma(x) {
  51429. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  51430. }
  51431. function sigmaPrime(x) {
  51432. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  51433. }
  51434. function littleSigma(x) {
  51435. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  51436. }
  51437. function littleSigmaPrime(x) {
  51438. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  51439. }
  51440. 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];
  51441. function hash(data, offset, length) {
  51442. let h0 = 0x6a09e667,
  51443. h1 = 0xbb67ae85,
  51444. h2 = 0x3c6ef372,
  51445. h3 = 0xa54ff53a,
  51446. h4 = 0x510e527f,
  51447. h5 = 0x9b05688c,
  51448. h6 = 0x1f83d9ab,
  51449. h7 = 0x5be0cd19;
  51450. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  51451. const padded = new Uint8Array(paddedLength);
  51452. let i, j;
  51453. for (i = 0; i < length; ++i) {
  51454. padded[i] = data[offset++];
  51455. }
  51456. padded[i++] = 0x80;
  51457. const n = paddedLength - 8;
  51458. while (i < n) {
  51459. padded[i++] = 0;
  51460. }
  51461. padded[i++] = 0;
  51462. padded[i++] = 0;
  51463. padded[i++] = 0;
  51464. padded[i++] = length >>> 29 & 0xff;
  51465. padded[i++] = length >> 21 & 0xff;
  51466. padded[i++] = length >> 13 & 0xff;
  51467. padded[i++] = length >> 5 & 0xff;
  51468. padded[i++] = length << 3 & 0xff;
  51469. const w = new Uint32Array(64);
  51470. for (i = 0; i < paddedLength;) {
  51471. for (j = 0; j < 16; ++j) {
  51472. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51473. i += 4;
  51474. }
  51475. for (j = 16; j < 64; ++j) {
  51476. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  51477. }
  51478. let a = h0,
  51479. b = h1,
  51480. c = h2,
  51481. d = h3,
  51482. e = h4,
  51483. f = h5,
  51484. g = h6,
  51485. h = h7,
  51486. t1,
  51487. t2;
  51488. for (j = 0; j < 64; ++j) {
  51489. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  51490. t2 = sigma(a) + maj(a, b, c);
  51491. h = g;
  51492. g = f;
  51493. f = e;
  51494. e = d + t1 | 0;
  51495. d = c;
  51496. c = b;
  51497. b = a;
  51498. a = t1 + t2 | 0;
  51499. }
  51500. h0 = h0 + a | 0;
  51501. h1 = h1 + b | 0;
  51502. h2 = h2 + c | 0;
  51503. h3 = h3 + d | 0;
  51504. h4 = h4 + e | 0;
  51505. h5 = h5 + f | 0;
  51506. h6 = h6 + g | 0;
  51507. h7 = h7 + h | 0;
  51508. }
  51509. 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]);
  51510. }
  51511. return hash;
  51512. }();
  51513. exports.calculateSHA256 = calculateSHA256;
  51514. const calculateSHA512 = function calculateSHA512Closure() {
  51515. function ch(result, x, y, z, tmp) {
  51516. result.assign(x);
  51517. result.and(y);
  51518. tmp.assign(x);
  51519. tmp.not();
  51520. tmp.and(z);
  51521. result.xor(tmp);
  51522. }
  51523. function maj(result, x, y, z, tmp) {
  51524. result.assign(x);
  51525. result.and(y);
  51526. tmp.assign(x);
  51527. tmp.and(z);
  51528. result.xor(tmp);
  51529. tmp.assign(y);
  51530. tmp.and(z);
  51531. result.xor(tmp);
  51532. }
  51533. function sigma(result, x, tmp) {
  51534. result.assign(x);
  51535. result.rotateRight(28);
  51536. tmp.assign(x);
  51537. tmp.rotateRight(34);
  51538. result.xor(tmp);
  51539. tmp.assign(x);
  51540. tmp.rotateRight(39);
  51541. result.xor(tmp);
  51542. }
  51543. function sigmaPrime(result, x, tmp) {
  51544. result.assign(x);
  51545. result.rotateRight(14);
  51546. tmp.assign(x);
  51547. tmp.rotateRight(18);
  51548. result.xor(tmp);
  51549. tmp.assign(x);
  51550. tmp.rotateRight(41);
  51551. result.xor(tmp);
  51552. }
  51553. function littleSigma(result, x, tmp) {
  51554. result.assign(x);
  51555. result.rotateRight(1);
  51556. tmp.assign(x);
  51557. tmp.rotateRight(8);
  51558. result.xor(tmp);
  51559. tmp.assign(x);
  51560. tmp.shiftRight(7);
  51561. result.xor(tmp);
  51562. }
  51563. function littleSigmaPrime(result, x, tmp) {
  51564. result.assign(x);
  51565. result.rotateRight(19);
  51566. tmp.assign(x);
  51567. tmp.rotateRight(61);
  51568. result.xor(tmp);
  51569. tmp.assign(x);
  51570. tmp.shiftRight(6);
  51571. result.xor(tmp);
  51572. }
  51573. 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)];
  51574. function hash(data, offset, length) {
  51575. let mode384 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  51576. let h0, h1, h2, h3, h4, h5, h6, h7;
  51577. if (!mode384) {
  51578. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  51579. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  51580. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  51581. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  51582. h4 = new Word64(0x510e527f, 0xade682d1);
  51583. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  51584. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  51585. h7 = new Word64(0x5be0cd19, 0x137e2179);
  51586. } else {
  51587. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  51588. h1 = new Word64(0x629a292a, 0x367cd507);
  51589. h2 = new Word64(0x9159015a, 0x3070dd17);
  51590. h3 = new Word64(0x152fecd8, 0xf70e5939);
  51591. h4 = new Word64(0x67332667, 0xffc00b31);
  51592. h5 = new Word64(0x8eb44a87, 0x68581511);
  51593. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  51594. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  51595. }
  51596. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  51597. const padded = new Uint8Array(paddedLength);
  51598. let i, j;
  51599. for (i = 0; i < length; ++i) {
  51600. padded[i] = data[offset++];
  51601. }
  51602. padded[i++] = 0x80;
  51603. const n = paddedLength - 16;
  51604. while (i < n) {
  51605. padded[i++] = 0;
  51606. }
  51607. padded[i++] = 0;
  51608. padded[i++] = 0;
  51609. padded[i++] = 0;
  51610. padded[i++] = 0;
  51611. padded[i++] = 0;
  51612. padded[i++] = 0;
  51613. padded[i++] = 0;
  51614. padded[i++] = 0;
  51615. padded[i++] = 0;
  51616. padded[i++] = 0;
  51617. padded[i++] = 0;
  51618. padded[i++] = length >>> 29 & 0xff;
  51619. padded[i++] = length >> 21 & 0xff;
  51620. padded[i++] = length >> 13 & 0xff;
  51621. padded[i++] = length >> 5 & 0xff;
  51622. padded[i++] = length << 3 & 0xff;
  51623. const w = new Array(80);
  51624. for (i = 0; i < 80; i++) {
  51625. w[i] = new Word64(0, 0);
  51626. }
  51627. let a = new Word64(0, 0),
  51628. b = new Word64(0, 0),
  51629. c = new Word64(0, 0);
  51630. let d = new Word64(0, 0),
  51631. e = new Word64(0, 0),
  51632. f = new Word64(0, 0);
  51633. let g = new Word64(0, 0),
  51634. h = new Word64(0, 0);
  51635. const t1 = new Word64(0, 0),
  51636. t2 = new Word64(0, 0);
  51637. const tmp1 = new Word64(0, 0),
  51638. tmp2 = new Word64(0, 0);
  51639. let tmp3;
  51640. for (i = 0; i < paddedLength;) {
  51641. for (j = 0; j < 16; ++j) {
  51642. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51643. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  51644. i += 8;
  51645. }
  51646. for (j = 16; j < 80; ++j) {
  51647. tmp3 = w[j];
  51648. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  51649. tmp3.add(w[j - 7]);
  51650. littleSigma(tmp1, w[j - 15], tmp2);
  51651. tmp3.add(tmp1);
  51652. tmp3.add(w[j - 16]);
  51653. }
  51654. a.assign(h0);
  51655. b.assign(h1);
  51656. c.assign(h2);
  51657. d.assign(h3);
  51658. e.assign(h4);
  51659. f.assign(h5);
  51660. g.assign(h6);
  51661. h.assign(h7);
  51662. for (j = 0; j < 80; ++j) {
  51663. t1.assign(h);
  51664. sigmaPrime(tmp1, e, tmp2);
  51665. t1.add(tmp1);
  51666. ch(tmp1, e, f, g, tmp2);
  51667. t1.add(tmp1);
  51668. t1.add(k[j]);
  51669. t1.add(w[j]);
  51670. sigma(t2, a, tmp2);
  51671. maj(tmp1, a, b, c, tmp2);
  51672. t2.add(tmp1);
  51673. tmp3 = h;
  51674. h = g;
  51675. g = f;
  51676. f = e;
  51677. d.add(t1);
  51678. e = d;
  51679. d = c;
  51680. c = b;
  51681. b = a;
  51682. tmp3.assign(t1);
  51683. tmp3.add(t2);
  51684. a = tmp3;
  51685. }
  51686. h0.add(a);
  51687. h1.add(b);
  51688. h2.add(c);
  51689. h3.add(d);
  51690. h4.add(e);
  51691. h5.add(f);
  51692. h6.add(g);
  51693. h7.add(h);
  51694. }
  51695. let result;
  51696. if (!mode384) {
  51697. result = new Uint8Array(64);
  51698. h0.copyTo(result, 0);
  51699. h1.copyTo(result, 8);
  51700. h2.copyTo(result, 16);
  51701. h3.copyTo(result, 24);
  51702. h4.copyTo(result, 32);
  51703. h5.copyTo(result, 40);
  51704. h6.copyTo(result, 48);
  51705. h7.copyTo(result, 56);
  51706. } else {
  51707. result = new Uint8Array(48);
  51708. h0.copyTo(result, 0);
  51709. h1.copyTo(result, 8);
  51710. h2.copyTo(result, 16);
  51711. h3.copyTo(result, 24);
  51712. h4.copyTo(result, 32);
  51713. h5.copyTo(result, 40);
  51714. }
  51715. return result;
  51716. }
  51717. return hash;
  51718. }();
  51719. exports.calculateSHA512 = calculateSHA512;
  51720. function calculateSHA384(data, offset, length) {
  51721. return calculateSHA512(data, offset, length, true);
  51722. }
  51723. class NullCipher {
  51724. decryptBlock(data) {
  51725. return data;
  51726. }
  51727. encrypt(data) {
  51728. return data;
  51729. }
  51730. }
  51731. class AESBaseCipher {
  51732. constructor() {
  51733. if (this.constructor === AESBaseCipher) {
  51734. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  51735. }
  51736. 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]);
  51737. 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]);
  51738. 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]);
  51739. this._mixCol = new Uint8Array(256);
  51740. for (let i = 0; i < 256; i++) {
  51741. if (i < 128) {
  51742. this._mixCol[i] = i << 1;
  51743. } else {
  51744. this._mixCol[i] = i << 1 ^ 0x1b;
  51745. }
  51746. }
  51747. this.buffer = new Uint8Array(16);
  51748. this.bufferPosition = 0;
  51749. }
  51750. _expandKey(cipherKey) {
  51751. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  51752. }
  51753. _decrypt(input, key) {
  51754. let t, u, v;
  51755. const state = new Uint8Array(16);
  51756. state.set(input);
  51757. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  51758. state[j] ^= key[k];
  51759. }
  51760. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  51761. t = state[13];
  51762. state[13] = state[9];
  51763. state[9] = state[5];
  51764. state[5] = state[1];
  51765. state[1] = t;
  51766. t = state[14];
  51767. u = state[10];
  51768. state[14] = state[6];
  51769. state[10] = state[2];
  51770. state[6] = t;
  51771. state[2] = u;
  51772. t = state[15];
  51773. u = state[11];
  51774. v = state[7];
  51775. state[15] = state[3];
  51776. state[11] = t;
  51777. state[7] = u;
  51778. state[3] = v;
  51779. for (let j = 0; j < 16; ++j) {
  51780. state[j] = this._inv_s[state[j]];
  51781. }
  51782. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  51783. state[j] ^= key[k];
  51784. }
  51785. for (let j = 0; j < 16; j += 4) {
  51786. const s0 = this._mix[state[j]];
  51787. const s1 = this._mix[state[j + 1]];
  51788. const s2 = this._mix[state[j + 2]];
  51789. const s3 = this._mix[state[j + 3]];
  51790. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  51791. state[j] = t >>> 24 & 0xff;
  51792. state[j + 1] = t >> 16 & 0xff;
  51793. state[j + 2] = t >> 8 & 0xff;
  51794. state[j + 3] = t & 0xff;
  51795. }
  51796. }
  51797. t = state[13];
  51798. state[13] = state[9];
  51799. state[9] = state[5];
  51800. state[5] = state[1];
  51801. state[1] = t;
  51802. t = state[14];
  51803. u = state[10];
  51804. state[14] = state[6];
  51805. state[10] = state[2];
  51806. state[6] = t;
  51807. state[2] = u;
  51808. t = state[15];
  51809. u = state[11];
  51810. v = state[7];
  51811. state[15] = state[3];
  51812. state[11] = t;
  51813. state[7] = u;
  51814. state[3] = v;
  51815. for (let j = 0; j < 16; ++j) {
  51816. state[j] = this._inv_s[state[j]];
  51817. state[j] ^= key[j];
  51818. }
  51819. return state;
  51820. }
  51821. _encrypt(input, key) {
  51822. const s = this._s;
  51823. let t, u, v;
  51824. const state = new Uint8Array(16);
  51825. state.set(input);
  51826. for (let j = 0; j < 16; ++j) {
  51827. state[j] ^= key[j];
  51828. }
  51829. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  51830. for (let j = 0; j < 16; ++j) {
  51831. state[j] = s[state[j]];
  51832. }
  51833. v = state[1];
  51834. state[1] = state[5];
  51835. state[5] = state[9];
  51836. state[9] = state[13];
  51837. state[13] = v;
  51838. v = state[2];
  51839. u = state[6];
  51840. state[2] = state[10];
  51841. state[6] = state[14];
  51842. state[10] = v;
  51843. state[14] = u;
  51844. v = state[3];
  51845. u = state[7];
  51846. t = state[11];
  51847. state[3] = state[15];
  51848. state[7] = v;
  51849. state[11] = u;
  51850. state[15] = t;
  51851. for (let j = 0; j < 16; j += 4) {
  51852. const s0 = state[j + 0];
  51853. const s1 = state[j + 1];
  51854. const s2 = state[j + 2];
  51855. const s3 = state[j + 3];
  51856. t = s0 ^ s1 ^ s2 ^ s3;
  51857. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  51858. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  51859. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  51860. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  51861. }
  51862. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  51863. state[j] ^= key[k];
  51864. }
  51865. }
  51866. for (let j = 0; j < 16; ++j) {
  51867. state[j] = s[state[j]];
  51868. }
  51869. v = state[1];
  51870. state[1] = state[5];
  51871. state[5] = state[9];
  51872. state[9] = state[13];
  51873. state[13] = v;
  51874. v = state[2];
  51875. u = state[6];
  51876. state[2] = state[10];
  51877. state[6] = state[14];
  51878. state[10] = v;
  51879. state[14] = u;
  51880. v = state[3];
  51881. u = state[7];
  51882. t = state[11];
  51883. state[3] = state[15];
  51884. state[7] = v;
  51885. state[11] = u;
  51886. state[15] = t;
  51887. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  51888. state[j] ^= key[k];
  51889. }
  51890. return state;
  51891. }
  51892. _decryptBlock2(data, finalize) {
  51893. const sourceLength = data.length;
  51894. let buffer = this.buffer,
  51895. bufferLength = this.bufferPosition;
  51896. const result = [];
  51897. let iv = this.iv;
  51898. for (let i = 0; i < sourceLength; ++i) {
  51899. buffer[bufferLength] = data[i];
  51900. ++bufferLength;
  51901. if (bufferLength < 16) {
  51902. continue;
  51903. }
  51904. const plain = this._decrypt(buffer, this._key);
  51905. for (let j = 0; j < 16; ++j) {
  51906. plain[j] ^= iv[j];
  51907. }
  51908. iv = buffer;
  51909. result.push(plain);
  51910. buffer = new Uint8Array(16);
  51911. bufferLength = 0;
  51912. }
  51913. this.buffer = buffer;
  51914. this.bufferLength = bufferLength;
  51915. this.iv = iv;
  51916. if (result.length === 0) {
  51917. return new Uint8Array(0);
  51918. }
  51919. let outputLength = 16 * result.length;
  51920. if (finalize) {
  51921. const lastBlock = result.at(-1);
  51922. let psLen = lastBlock[15];
  51923. if (psLen <= 16) {
  51924. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  51925. if (lastBlock[i] !== psLen) {
  51926. psLen = 0;
  51927. break;
  51928. }
  51929. }
  51930. outputLength -= psLen;
  51931. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  51932. }
  51933. }
  51934. const output = new Uint8Array(outputLength);
  51935. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  51936. output.set(result[i], j);
  51937. }
  51938. return output;
  51939. }
  51940. decryptBlock(data, finalize) {
  51941. let iv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  51942. const sourceLength = data.length;
  51943. const buffer = this.buffer;
  51944. let bufferLength = this.bufferPosition;
  51945. if (iv) {
  51946. this.iv = iv;
  51947. } else {
  51948. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  51949. buffer[bufferLength] = data[i];
  51950. }
  51951. if (bufferLength < 16) {
  51952. this.bufferLength = bufferLength;
  51953. return new Uint8Array(0);
  51954. }
  51955. this.iv = buffer;
  51956. data = data.subarray(16);
  51957. }
  51958. this.buffer = new Uint8Array(16);
  51959. this.bufferLength = 0;
  51960. this.decryptBlock = this._decryptBlock2;
  51961. return this.decryptBlock(data, finalize);
  51962. }
  51963. encrypt(data, iv) {
  51964. const sourceLength = data.length;
  51965. let buffer = this.buffer,
  51966. bufferLength = this.bufferPosition;
  51967. const result = [];
  51968. if (!iv) {
  51969. iv = new Uint8Array(16);
  51970. }
  51971. for (let i = 0; i < sourceLength; ++i) {
  51972. buffer[bufferLength] = data[i];
  51973. ++bufferLength;
  51974. if (bufferLength < 16) {
  51975. continue;
  51976. }
  51977. for (let j = 0; j < 16; ++j) {
  51978. buffer[j] ^= iv[j];
  51979. }
  51980. const cipher = this._encrypt(buffer, this._key);
  51981. iv = cipher;
  51982. result.push(cipher);
  51983. buffer = new Uint8Array(16);
  51984. bufferLength = 0;
  51985. }
  51986. this.buffer = buffer;
  51987. this.bufferLength = bufferLength;
  51988. this.iv = iv;
  51989. if (result.length === 0) {
  51990. return new Uint8Array(0);
  51991. }
  51992. const outputLength = 16 * result.length;
  51993. const output = new Uint8Array(outputLength);
  51994. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  51995. output.set(result[i], j);
  51996. }
  51997. return output;
  51998. }
  51999. }
  52000. class AES128Cipher extends AESBaseCipher {
  52001. constructor(key) {
  52002. super();
  52003. this._cyclesOfRepetition = 10;
  52004. this._keySize = 160;
  52005. 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]);
  52006. this._key = this._expandKey(key);
  52007. }
  52008. _expandKey(cipherKey) {
  52009. const b = 176;
  52010. const s = this._s;
  52011. const rcon = this._rcon;
  52012. const result = new Uint8Array(b);
  52013. result.set(cipherKey);
  52014. for (let j = 16, i = 1; j < b; ++i) {
  52015. let t1 = result[j - 3];
  52016. let t2 = result[j - 2];
  52017. let t3 = result[j - 1];
  52018. let t4 = result[j - 4];
  52019. t1 = s[t1];
  52020. t2 = s[t2];
  52021. t3 = s[t3];
  52022. t4 = s[t4];
  52023. t1 ^= rcon[i];
  52024. for (let n = 0; n < 4; ++n) {
  52025. result[j] = t1 ^= result[j - 16];
  52026. j++;
  52027. result[j] = t2 ^= result[j - 16];
  52028. j++;
  52029. result[j] = t3 ^= result[j - 16];
  52030. j++;
  52031. result[j] = t4 ^= result[j - 16];
  52032. j++;
  52033. }
  52034. }
  52035. return result;
  52036. }
  52037. }
  52038. exports.AES128Cipher = AES128Cipher;
  52039. class AES256Cipher extends AESBaseCipher {
  52040. constructor(key) {
  52041. super();
  52042. this._cyclesOfRepetition = 14;
  52043. this._keySize = 224;
  52044. this._key = this._expandKey(key);
  52045. }
  52046. _expandKey(cipherKey) {
  52047. const b = 240;
  52048. const s = this._s;
  52049. const result = new Uint8Array(b);
  52050. result.set(cipherKey);
  52051. let r = 1;
  52052. let t1, t2, t3, t4;
  52053. for (let j = 32, i = 1; j < b; ++i) {
  52054. if (j % 32 === 16) {
  52055. t1 = s[t1];
  52056. t2 = s[t2];
  52057. t3 = s[t3];
  52058. t4 = s[t4];
  52059. } else if (j % 32 === 0) {
  52060. t1 = result[j - 3];
  52061. t2 = result[j - 2];
  52062. t3 = result[j - 1];
  52063. t4 = result[j - 4];
  52064. t1 = s[t1];
  52065. t2 = s[t2];
  52066. t3 = s[t3];
  52067. t4 = s[t4];
  52068. t1 ^= r;
  52069. if ((r <<= 1) >= 256) {
  52070. r = (r ^ 0x1b) & 0xff;
  52071. }
  52072. }
  52073. for (let n = 0; n < 4; ++n) {
  52074. result[j] = t1 ^= result[j - 32];
  52075. j++;
  52076. result[j] = t2 ^= result[j - 32];
  52077. j++;
  52078. result[j] = t3 ^= result[j - 32];
  52079. j++;
  52080. result[j] = t4 ^= result[j - 32];
  52081. j++;
  52082. }
  52083. }
  52084. return result;
  52085. }
  52086. }
  52087. exports.AES256Cipher = AES256Cipher;
  52088. class PDF17 {
  52089. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52090. const hashData = new Uint8Array(password.length + 56);
  52091. hashData.set(password, 0);
  52092. hashData.set(ownerValidationSalt, password.length);
  52093. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52094. const result = calculateSHA256(hashData, 0, hashData.length);
  52095. return (0, _util.isArrayEqual)(result, ownerPassword);
  52096. }
  52097. checkUserPassword(password, userValidationSalt, userPassword) {
  52098. const hashData = new Uint8Array(password.length + 8);
  52099. hashData.set(password, 0);
  52100. hashData.set(userValidationSalt, password.length);
  52101. const result = calculateSHA256(hashData, 0, hashData.length);
  52102. return (0, _util.isArrayEqual)(result, userPassword);
  52103. }
  52104. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52105. const hashData = new Uint8Array(password.length + 56);
  52106. hashData.set(password, 0);
  52107. hashData.set(ownerKeySalt, password.length);
  52108. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52109. const key = calculateSHA256(hashData, 0, hashData.length);
  52110. const cipher = new AES256Cipher(key);
  52111. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52112. }
  52113. getUserKey(password, userKeySalt, userEncryption) {
  52114. const hashData = new Uint8Array(password.length + 8);
  52115. hashData.set(password, 0);
  52116. hashData.set(userKeySalt, password.length);
  52117. const key = calculateSHA256(hashData, 0, hashData.length);
  52118. const cipher = new AES256Cipher(key);
  52119. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52120. }
  52121. }
  52122. exports.PDF17 = PDF17;
  52123. const PDF20 = function PDF20Closure() {
  52124. function calculatePDF20Hash(password, input, userBytes) {
  52125. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  52126. let e = [0];
  52127. let i = 0;
  52128. while (i < 64 || e.at(-1) > i - 32) {
  52129. const combinedLength = password.length + k.length + userBytes.length,
  52130. combinedArray = new Uint8Array(combinedLength);
  52131. let writeOffset = 0;
  52132. combinedArray.set(password, writeOffset);
  52133. writeOffset += password.length;
  52134. combinedArray.set(k, writeOffset);
  52135. writeOffset += k.length;
  52136. combinedArray.set(userBytes, writeOffset);
  52137. const k1 = new Uint8Array(combinedLength * 64);
  52138. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  52139. k1.set(combinedArray, pos);
  52140. }
  52141. const cipher = new AES128Cipher(k.subarray(0, 16));
  52142. e = cipher.encrypt(k1, k.subarray(16, 32));
  52143. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  52144. if (remainder === 0) {
  52145. k = calculateSHA256(e, 0, e.length);
  52146. } else if (remainder === 1) {
  52147. k = calculateSHA384(e, 0, e.length);
  52148. } else if (remainder === 2) {
  52149. k = calculateSHA512(e, 0, e.length);
  52150. }
  52151. i++;
  52152. }
  52153. return k.subarray(0, 32);
  52154. }
  52155. class PDF20 {
  52156. hash(password, concatBytes, userBytes) {
  52157. return calculatePDF20Hash(password, concatBytes, userBytes);
  52158. }
  52159. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52160. const hashData = new Uint8Array(password.length + 56);
  52161. hashData.set(password, 0);
  52162. hashData.set(ownerValidationSalt, password.length);
  52163. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52164. const result = calculatePDF20Hash(password, hashData, userBytes);
  52165. return (0, _util.isArrayEqual)(result, ownerPassword);
  52166. }
  52167. checkUserPassword(password, userValidationSalt, userPassword) {
  52168. const hashData = new Uint8Array(password.length + 8);
  52169. hashData.set(password, 0);
  52170. hashData.set(userValidationSalt, password.length);
  52171. const result = calculatePDF20Hash(password, hashData, []);
  52172. return (0, _util.isArrayEqual)(result, userPassword);
  52173. }
  52174. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52175. const hashData = new Uint8Array(password.length + 56);
  52176. hashData.set(password, 0);
  52177. hashData.set(ownerKeySalt, password.length);
  52178. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52179. const key = calculatePDF20Hash(password, hashData, userBytes);
  52180. const cipher = new AES256Cipher(key);
  52181. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52182. }
  52183. getUserKey(password, userKeySalt, userEncryption) {
  52184. const hashData = new Uint8Array(password.length + 8);
  52185. hashData.set(password, 0);
  52186. hashData.set(userKeySalt, password.length);
  52187. const key = calculatePDF20Hash(password, hashData, []);
  52188. const cipher = new AES256Cipher(key);
  52189. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52190. }
  52191. }
  52192. return PDF20;
  52193. }();
  52194. exports.PDF20 = PDF20;
  52195. class CipherTransform {
  52196. constructor(stringCipherConstructor, streamCipherConstructor) {
  52197. this.StringCipherConstructor = stringCipherConstructor;
  52198. this.StreamCipherConstructor = streamCipherConstructor;
  52199. }
  52200. createStream(stream, length) {
  52201. const cipher = new this.StreamCipherConstructor();
  52202. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  52203. return cipher.decryptBlock(data, finalize);
  52204. });
  52205. }
  52206. decryptString(s) {
  52207. const cipher = new this.StringCipherConstructor();
  52208. let data = (0, _util.stringToBytes)(s);
  52209. data = cipher.decryptBlock(data, true);
  52210. return (0, _util.bytesToString)(data);
  52211. }
  52212. encryptString(s) {
  52213. const cipher = new this.StringCipherConstructor();
  52214. if (cipher instanceof AESBaseCipher) {
  52215. const strLen = s.length;
  52216. const pad = 16 - strLen % 16;
  52217. s += String.fromCharCode(pad).repeat(pad);
  52218. const iv = new Uint8Array(16);
  52219. if (typeof crypto !== "undefined") {
  52220. crypto.getRandomValues(iv);
  52221. } else {
  52222. for (let i = 0; i < 16; i++) {
  52223. iv[i] = Math.floor(256 * Math.random());
  52224. }
  52225. }
  52226. let data = (0, _util.stringToBytes)(s);
  52227. data = cipher.encrypt(data, iv);
  52228. const buf = new Uint8Array(16 + data.length);
  52229. buf.set(iv);
  52230. buf.set(data, 16);
  52231. return (0, _util.bytesToString)(buf);
  52232. }
  52233. let data = (0, _util.stringToBytes)(s);
  52234. data = cipher.encrypt(data);
  52235. return (0, _util.bytesToString)(data);
  52236. }
  52237. }
  52238. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  52239. 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]);
  52240. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  52241. if (password) {
  52242. const passwordLength = Math.min(127, password.length);
  52243. password = password.subarray(0, passwordLength);
  52244. } else {
  52245. password = [];
  52246. }
  52247. let pdfAlgorithm;
  52248. if (revision === 6) {
  52249. pdfAlgorithm = new PDF20();
  52250. } else {
  52251. pdfAlgorithm = new PDF17();
  52252. }
  52253. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  52254. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  52255. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  52256. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  52257. }
  52258. return null;
  52259. }
  52260. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  52261. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  52262. const hashData = new Uint8Array(hashDataSize);
  52263. let i = 0,
  52264. j,
  52265. n;
  52266. if (password) {
  52267. n = Math.min(32, password.length);
  52268. for (; i < n; ++i) {
  52269. hashData[i] = password[i];
  52270. }
  52271. }
  52272. j = 0;
  52273. while (i < 32) {
  52274. hashData[i++] = defaultPasswordBytes[j++];
  52275. }
  52276. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  52277. hashData[i++] = ownerPassword[j];
  52278. }
  52279. hashData[i++] = flags & 0xff;
  52280. hashData[i++] = flags >> 8 & 0xff;
  52281. hashData[i++] = flags >> 16 & 0xff;
  52282. hashData[i++] = flags >>> 24 & 0xff;
  52283. for (j = 0, n = fileId.length; j < n; ++j) {
  52284. hashData[i++] = fileId[j];
  52285. }
  52286. if (revision >= 4 && !encryptMetadata) {
  52287. hashData[i++] = 0xff;
  52288. hashData[i++] = 0xff;
  52289. hashData[i++] = 0xff;
  52290. hashData[i++] = 0xff;
  52291. }
  52292. let hash = calculateMD5(hashData, 0, i);
  52293. const keyLengthInBytes = keyLength >> 3;
  52294. if (revision >= 3) {
  52295. for (j = 0; j < 50; ++j) {
  52296. hash = calculateMD5(hash, 0, keyLengthInBytes);
  52297. }
  52298. }
  52299. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  52300. let cipher, checkData;
  52301. if (revision >= 3) {
  52302. for (i = 0; i < 32; ++i) {
  52303. hashData[i] = defaultPasswordBytes[i];
  52304. }
  52305. for (j = 0, n = fileId.length; j < n; ++j) {
  52306. hashData[i++] = fileId[j];
  52307. }
  52308. cipher = new ARCFourCipher(encryptionKey);
  52309. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  52310. n = encryptionKey.length;
  52311. const derivedKey = new Uint8Array(n);
  52312. for (j = 1; j <= 19; ++j) {
  52313. for (let k = 0; k < n; ++k) {
  52314. derivedKey[k] = encryptionKey[k] ^ j;
  52315. }
  52316. cipher = new ARCFourCipher(derivedKey);
  52317. checkData = cipher.encryptBlock(checkData);
  52318. }
  52319. for (j = 0, n = checkData.length; j < n; ++j) {
  52320. if (userPassword[j] !== checkData[j]) {
  52321. return null;
  52322. }
  52323. }
  52324. } else {
  52325. cipher = new ARCFourCipher(encryptionKey);
  52326. checkData = cipher.encryptBlock(defaultPasswordBytes);
  52327. for (j = 0, n = checkData.length; j < n; ++j) {
  52328. if (userPassword[j] !== checkData[j]) {
  52329. return null;
  52330. }
  52331. }
  52332. }
  52333. return encryptionKey;
  52334. }
  52335. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  52336. const hashData = new Uint8Array(32);
  52337. let i = 0;
  52338. const n = Math.min(32, password.length);
  52339. for (; i < n; ++i) {
  52340. hashData[i] = password[i];
  52341. }
  52342. let j = 0;
  52343. while (i < 32) {
  52344. hashData[i++] = defaultPasswordBytes[j++];
  52345. }
  52346. let hash = calculateMD5(hashData, 0, i);
  52347. const keyLengthInBytes = keyLength >> 3;
  52348. if (revision >= 3) {
  52349. for (j = 0; j < 50; ++j) {
  52350. hash = calculateMD5(hash, 0, hash.length);
  52351. }
  52352. }
  52353. let cipher, userPassword;
  52354. if (revision >= 3) {
  52355. userPassword = ownerPassword;
  52356. const derivedKey = new Uint8Array(keyLengthInBytes);
  52357. for (j = 19; j >= 0; j--) {
  52358. for (let k = 0; k < keyLengthInBytes; ++k) {
  52359. derivedKey[k] = hash[k] ^ j;
  52360. }
  52361. cipher = new ARCFourCipher(derivedKey);
  52362. userPassword = cipher.encryptBlock(userPassword);
  52363. }
  52364. } else {
  52365. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  52366. userPassword = cipher.encryptBlock(ownerPassword);
  52367. }
  52368. return userPassword;
  52369. }
  52370. const identityName = _primitives.Name.get("Identity");
  52371. function buildObjectKey(num, gen, encryptionKey) {
  52372. let isAes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  52373. const key = new Uint8Array(encryptionKey.length + 9);
  52374. const n = encryptionKey.length;
  52375. let i;
  52376. for (i = 0; i < n; ++i) {
  52377. key[i] = encryptionKey[i];
  52378. }
  52379. key[i++] = num & 0xff;
  52380. key[i++] = num >> 8 & 0xff;
  52381. key[i++] = num >> 16 & 0xff;
  52382. key[i++] = gen & 0xff;
  52383. key[i++] = gen >> 8 & 0xff;
  52384. if (isAes) {
  52385. key[i++] = 0x73;
  52386. key[i++] = 0x41;
  52387. key[i++] = 0x6c;
  52388. key[i++] = 0x54;
  52389. }
  52390. const hash = calculateMD5(key, 0, i);
  52391. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  52392. }
  52393. function buildCipherConstructor(cf, name, num, gen, key) {
  52394. if (!(name instanceof _primitives.Name)) {
  52395. throw new _util.FormatError("Invalid crypt filter name.");
  52396. }
  52397. const cryptFilter = cf.get(name.name);
  52398. let cfm;
  52399. if (cryptFilter !== null && cryptFilter !== undefined) {
  52400. cfm = cryptFilter.get("CFM");
  52401. }
  52402. if (!cfm || cfm.name === "None") {
  52403. return function cipherTransformFactoryBuildCipherConstructorNone() {
  52404. return new NullCipher();
  52405. };
  52406. }
  52407. if (cfm.name === "V2") {
  52408. return function cipherTransformFactoryBuildCipherConstructorV2() {
  52409. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  52410. };
  52411. }
  52412. if (cfm.name === "AESV2") {
  52413. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  52414. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  52415. };
  52416. }
  52417. if (cfm.name === "AESV3") {
  52418. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  52419. return new AES256Cipher(key);
  52420. };
  52421. }
  52422. throw new _util.FormatError("Unknown crypto method");
  52423. }
  52424. class CipherTransformFactory {
  52425. constructor(dict, fileId, password) {
  52426. const filter = dict.get("Filter");
  52427. if (!(0, _primitives.isName)(filter, "Standard")) {
  52428. throw new _util.FormatError("unknown encryption method");
  52429. }
  52430. this.filterName = filter.name;
  52431. this.dict = dict;
  52432. const algorithm = dict.get("V");
  52433. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  52434. throw new _util.FormatError("unsupported encryption algorithm");
  52435. }
  52436. this.algorithm = algorithm;
  52437. let keyLength = dict.get("Length");
  52438. if (!keyLength) {
  52439. if (algorithm <= 3) {
  52440. keyLength = 40;
  52441. } else {
  52442. const cfDict = dict.get("CF");
  52443. const streamCryptoName = dict.get("StmF");
  52444. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  52445. cfDict.suppressEncryption = true;
  52446. const handlerDict = cfDict.get(streamCryptoName.name);
  52447. keyLength = handlerDict && handlerDict.get("Length") || 128;
  52448. if (keyLength < 40) {
  52449. keyLength <<= 3;
  52450. }
  52451. }
  52452. }
  52453. }
  52454. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  52455. throw new _util.FormatError("invalid key length");
  52456. }
  52457. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  52458. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  52459. const flags = dict.get("P");
  52460. const revision = dict.get("R");
  52461. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  52462. this.encryptMetadata = encryptMetadata;
  52463. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  52464. let passwordBytes;
  52465. if (password) {
  52466. if (revision === 6) {
  52467. try {
  52468. password = (0, _util.utf8StringToString)(password);
  52469. } catch (ex) {
  52470. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  52471. }
  52472. }
  52473. passwordBytes = (0, _util.stringToBytes)(password);
  52474. }
  52475. let encryptionKey;
  52476. if (algorithm !== 5) {
  52477. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52478. } else {
  52479. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  52480. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  52481. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  52482. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  52483. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  52484. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  52485. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  52486. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  52487. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  52488. }
  52489. if (!encryptionKey && !password) {
  52490. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  52491. } else if (!encryptionKey && password) {
  52492. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  52493. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52494. }
  52495. if (!encryptionKey) {
  52496. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  52497. }
  52498. this.encryptionKey = encryptionKey;
  52499. if (algorithm >= 4) {
  52500. const cf = dict.get("CF");
  52501. if (cf instanceof _primitives.Dict) {
  52502. cf.suppressEncryption = true;
  52503. }
  52504. this.cf = cf;
  52505. this.stmf = dict.get("StmF") || identityName;
  52506. this.strf = dict.get("StrF") || identityName;
  52507. this.eff = dict.get("EFF") || this.stmf;
  52508. }
  52509. }
  52510. createCipherTransform(num, gen) {
  52511. if (this.algorithm === 4 || this.algorithm === 5) {
  52512. return new CipherTransform(buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  52513. }
  52514. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  52515. const cipherConstructor = function buildCipherCipherConstructor() {
  52516. return new ARCFourCipher(key);
  52517. };
  52518. return new CipherTransform(cipherConstructor, cipherConstructor);
  52519. }
  52520. }
  52521. return CipherTransformFactory;
  52522. }();
  52523. exports.CipherTransformFactory = CipherTransformFactory;
  52524. /***/ }),
  52525. /* 197 */
  52526. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52527. "use strict";
  52528. Object.defineProperty(exports, "__esModule", ({
  52529. value: true
  52530. }));
  52531. exports.DecryptStream = void 0;
  52532. var _decode_stream = __w_pdfjs_require__(148);
  52533. const chunkSize = 512;
  52534. class DecryptStream extends _decode_stream.DecodeStream {
  52535. constructor(str, maybeLength, decrypt) {
  52536. super(maybeLength);
  52537. this.str = str;
  52538. this.dict = str.dict;
  52539. this.decrypt = decrypt;
  52540. this.nextChunk = null;
  52541. this.initialized = false;
  52542. }
  52543. readBlock() {
  52544. let chunk;
  52545. if (this.initialized) {
  52546. chunk = this.nextChunk;
  52547. } else {
  52548. chunk = this.str.getBytes(chunkSize);
  52549. this.initialized = true;
  52550. }
  52551. if (!chunk || chunk.length === 0) {
  52552. this.eof = true;
  52553. return;
  52554. }
  52555. this.nextChunk = this.str.getBytes(chunkSize);
  52556. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  52557. const decrypt = this.decrypt;
  52558. chunk = decrypt(chunk, !hasMoreData);
  52559. const bufferLength = this.bufferLength,
  52560. newLength = bufferLength + chunk.length,
  52561. buffer = this.ensureBuffer(newLength);
  52562. buffer.set(chunk, bufferLength);
  52563. this.bufferLength = newLength;
  52564. }
  52565. }
  52566. exports.DecryptStream = DecryptStream;
  52567. /***/ }),
  52568. /* 198 */
  52569. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52570. "use strict";
  52571. Object.defineProperty(exports, "__esModule", ({
  52572. value: true
  52573. }));
  52574. exports.Catalog = void 0;
  52575. var _core_utils = __w_pdfjs_require__(135);
  52576. var _util = __w_pdfjs_require__(2);
  52577. var _primitives = __w_pdfjs_require__(134);
  52578. var _name_number_tree = __w_pdfjs_require__(199);
  52579. var _base_stream = __w_pdfjs_require__(136);
  52580. var _cleanup_helper = __w_pdfjs_require__(200);
  52581. var _colorspace = __w_pdfjs_require__(143);
  52582. var _file_spec = __w_pdfjs_require__(201);
  52583. var _image_utils = __w_pdfjs_require__(188);
  52584. var _metadata_parser = __w_pdfjs_require__(202);
  52585. var _struct_tree = __w_pdfjs_require__(203);
  52586. function fetchDestination(dest) {
  52587. if (dest instanceof _primitives.Dict) {
  52588. dest = dest.get("D");
  52589. }
  52590. return Array.isArray(dest) ? dest : null;
  52591. }
  52592. class Catalog {
  52593. constructor(pdfManager, xref) {
  52594. this.pdfManager = pdfManager;
  52595. this.xref = xref;
  52596. this._catDict = xref.getCatalogObj();
  52597. if (!(this._catDict instanceof _primitives.Dict)) {
  52598. throw new _util.FormatError("Catalog object is not a dictionary.");
  52599. }
  52600. this.toplevelPagesDict;
  52601. this._actualNumPages = null;
  52602. this.fontCache = new _primitives.RefSetCache();
  52603. this.builtInCMapCache = new Map();
  52604. this.standardFontDataCache = new Map();
  52605. this.globalImageCache = new _image_utils.GlobalImageCache();
  52606. this.pageKidsCountCache = new _primitives.RefSetCache();
  52607. this.pageIndexCache = new _primitives.RefSetCache();
  52608. this.nonBlendModesSet = new _primitives.RefSet();
  52609. }
  52610. get version() {
  52611. const version = this._catDict.get("Version");
  52612. if (version instanceof _primitives.Name) {
  52613. if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
  52614. return (0, _util.shadow)(this, "version", version.name);
  52615. }
  52616. (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
  52617. }
  52618. return (0, _util.shadow)(this, "version", null);
  52619. }
  52620. get lang() {
  52621. const lang = this._catDict.get("Lang");
  52622. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  52623. }
  52624. get needsRendering() {
  52625. const needsRendering = this._catDict.get("NeedsRendering");
  52626. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  52627. }
  52628. get collection() {
  52629. let collection = null;
  52630. try {
  52631. const obj = this._catDict.get("Collection");
  52632. if (obj instanceof _primitives.Dict && obj.size > 0) {
  52633. collection = obj;
  52634. }
  52635. } catch (ex) {
  52636. if (ex instanceof _core_utils.MissingDataException) {
  52637. throw ex;
  52638. }
  52639. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  52640. }
  52641. return (0, _util.shadow)(this, "collection", collection);
  52642. }
  52643. get acroForm() {
  52644. let acroForm = null;
  52645. try {
  52646. const obj = this._catDict.get("AcroForm");
  52647. if (obj instanceof _primitives.Dict && obj.size > 0) {
  52648. acroForm = obj;
  52649. }
  52650. } catch (ex) {
  52651. if (ex instanceof _core_utils.MissingDataException) {
  52652. throw ex;
  52653. }
  52654. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  52655. }
  52656. return (0, _util.shadow)(this, "acroForm", acroForm);
  52657. }
  52658. get acroFormRef() {
  52659. const value = this._catDict.getRaw("AcroForm");
  52660. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  52661. }
  52662. get metadata() {
  52663. const streamRef = this._catDict.getRaw("Metadata");
  52664. if (!(streamRef instanceof _primitives.Ref)) {
  52665. return (0, _util.shadow)(this, "metadata", null);
  52666. }
  52667. let metadata = null;
  52668. try {
  52669. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  52670. const stream = this.xref.fetch(streamRef, suppressEncryption);
  52671. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  52672. const type = stream.dict.get("Type");
  52673. const subtype = stream.dict.get("Subtype");
  52674. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  52675. const data = (0, _util.stringToUTF8String)(stream.getString());
  52676. if (data) {
  52677. metadata = new _metadata_parser.MetadataParser(data).serializable;
  52678. }
  52679. }
  52680. }
  52681. } catch (ex) {
  52682. if (ex instanceof _core_utils.MissingDataException) {
  52683. throw ex;
  52684. }
  52685. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  52686. }
  52687. return (0, _util.shadow)(this, "metadata", metadata);
  52688. }
  52689. get markInfo() {
  52690. let markInfo = null;
  52691. try {
  52692. markInfo = this._readMarkInfo();
  52693. } catch (ex) {
  52694. if (ex instanceof _core_utils.MissingDataException) {
  52695. throw ex;
  52696. }
  52697. (0, _util.warn)("Unable to read mark info.");
  52698. }
  52699. return (0, _util.shadow)(this, "markInfo", markInfo);
  52700. }
  52701. _readMarkInfo() {
  52702. const obj = this._catDict.get("MarkInfo");
  52703. if (!(obj instanceof _primitives.Dict)) {
  52704. return null;
  52705. }
  52706. const markInfo = {
  52707. Marked: false,
  52708. UserProperties: false,
  52709. Suspects: false
  52710. };
  52711. for (const key in markInfo) {
  52712. const value = obj.get(key);
  52713. if (typeof value === "boolean") {
  52714. markInfo[key] = value;
  52715. }
  52716. }
  52717. return markInfo;
  52718. }
  52719. get structTreeRoot() {
  52720. let structTree = null;
  52721. try {
  52722. structTree = this._readStructTreeRoot();
  52723. } catch (ex) {
  52724. if (ex instanceof _core_utils.MissingDataException) {
  52725. throw ex;
  52726. }
  52727. (0, _util.warn)("Unable read to structTreeRoot info.");
  52728. }
  52729. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  52730. }
  52731. _readStructTreeRoot() {
  52732. const obj = this._catDict.get("StructTreeRoot");
  52733. if (!(obj instanceof _primitives.Dict)) {
  52734. return null;
  52735. }
  52736. const root = new _struct_tree.StructTreeRoot(obj);
  52737. root.init();
  52738. return root;
  52739. }
  52740. get toplevelPagesDict() {
  52741. const pagesObj = this._catDict.get("Pages");
  52742. if (!(pagesObj instanceof _primitives.Dict)) {
  52743. throw new _util.FormatError("Invalid top-level pages dictionary.");
  52744. }
  52745. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  52746. }
  52747. get documentOutline() {
  52748. let obj = null;
  52749. try {
  52750. obj = this._readDocumentOutline();
  52751. } catch (ex) {
  52752. if (ex instanceof _core_utils.MissingDataException) {
  52753. throw ex;
  52754. }
  52755. (0, _util.warn)("Unable to read document outline.");
  52756. }
  52757. return (0, _util.shadow)(this, "documentOutline", obj);
  52758. }
  52759. _readDocumentOutline() {
  52760. let obj = this._catDict.get("Outlines");
  52761. if (!(obj instanceof _primitives.Dict)) {
  52762. return null;
  52763. }
  52764. obj = obj.getRaw("First");
  52765. if (!(obj instanceof _primitives.Ref)) {
  52766. return null;
  52767. }
  52768. const root = {
  52769. items: []
  52770. };
  52771. const queue = [{
  52772. obj,
  52773. parent: root
  52774. }];
  52775. const processed = new _primitives.RefSet();
  52776. processed.put(obj);
  52777. const xref = this.xref,
  52778. blackColor = new Uint8ClampedArray(3);
  52779. while (queue.length > 0) {
  52780. const i = queue.shift();
  52781. const outlineDict = xref.fetchIfRef(i.obj);
  52782. if (outlineDict === null) {
  52783. continue;
  52784. }
  52785. if (!outlineDict.has("Title")) {
  52786. throw new _util.FormatError("Invalid outline item encountered.");
  52787. }
  52788. const data = {
  52789. url: null,
  52790. dest: null,
  52791. action: null
  52792. };
  52793. Catalog.parseDestDictionary({
  52794. destDict: outlineDict,
  52795. resultObj: data,
  52796. docBaseUrl: this.pdfManager.docBaseUrl,
  52797. docAttachments: this.attachments
  52798. });
  52799. const title = outlineDict.get("Title");
  52800. const flags = outlineDict.get("F") || 0;
  52801. const color = outlineDict.getArray("C");
  52802. const count = outlineDict.get("Count");
  52803. let rgbColor = blackColor;
  52804. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  52805. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  52806. }
  52807. const outlineItem = {
  52808. action: data.action,
  52809. attachment: data.attachment,
  52810. dest: data.dest,
  52811. url: data.url,
  52812. unsafeUrl: data.unsafeUrl,
  52813. newWindow: data.newWindow,
  52814. setOCGState: data.setOCGState,
  52815. title: (0, _util.stringToPDFString)(title),
  52816. color: rgbColor,
  52817. count: Number.isInteger(count) ? count : undefined,
  52818. bold: !!(flags & 2),
  52819. italic: !!(flags & 1),
  52820. items: []
  52821. };
  52822. i.parent.items.push(outlineItem);
  52823. obj = outlineDict.getRaw("First");
  52824. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  52825. queue.push({
  52826. obj,
  52827. parent: outlineItem
  52828. });
  52829. processed.put(obj);
  52830. }
  52831. obj = outlineDict.getRaw("Next");
  52832. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  52833. queue.push({
  52834. obj,
  52835. parent: i.parent
  52836. });
  52837. processed.put(obj);
  52838. }
  52839. }
  52840. return root.items.length > 0 ? root.items : null;
  52841. }
  52842. get permissions() {
  52843. let permissions = null;
  52844. try {
  52845. permissions = this._readPermissions();
  52846. } catch (ex) {
  52847. if (ex instanceof _core_utils.MissingDataException) {
  52848. throw ex;
  52849. }
  52850. (0, _util.warn)("Unable to read permissions.");
  52851. }
  52852. return (0, _util.shadow)(this, "permissions", permissions);
  52853. }
  52854. _readPermissions() {
  52855. const encrypt = this.xref.trailer.get("Encrypt");
  52856. if (!(encrypt instanceof _primitives.Dict)) {
  52857. return null;
  52858. }
  52859. let flags = encrypt.get("P");
  52860. if (typeof flags !== "number") {
  52861. return null;
  52862. }
  52863. flags += 2 ** 32;
  52864. const permissions = [];
  52865. for (const key in _util.PermissionFlag) {
  52866. const value = _util.PermissionFlag[key];
  52867. if (flags & value) {
  52868. permissions.push(value);
  52869. }
  52870. }
  52871. return permissions;
  52872. }
  52873. get optionalContentConfig() {
  52874. let config = null;
  52875. try {
  52876. const properties = this._catDict.get("OCProperties");
  52877. if (!properties) {
  52878. return (0, _util.shadow)(this, "optionalContentConfig", null);
  52879. }
  52880. const defaultConfig = properties.get("D");
  52881. if (!defaultConfig) {
  52882. return (0, _util.shadow)(this, "optionalContentConfig", null);
  52883. }
  52884. const groupsData = properties.get("OCGs");
  52885. if (!Array.isArray(groupsData)) {
  52886. return (0, _util.shadow)(this, "optionalContentConfig", null);
  52887. }
  52888. const groups = [];
  52889. const groupRefs = [];
  52890. for (const groupRef of groupsData) {
  52891. if (!(groupRef instanceof _primitives.Ref)) {
  52892. continue;
  52893. }
  52894. groupRefs.push(groupRef);
  52895. const group = this.xref.fetchIfRef(groupRef);
  52896. groups.push({
  52897. id: groupRef.toString(),
  52898. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  52899. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  52900. });
  52901. }
  52902. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  52903. config.groups = groups;
  52904. } catch (ex) {
  52905. if (ex instanceof _core_utils.MissingDataException) {
  52906. throw ex;
  52907. }
  52908. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  52909. }
  52910. return (0, _util.shadow)(this, "optionalContentConfig", config);
  52911. }
  52912. _readOptionalContentConfig(config, contentGroupRefs) {
  52913. function parseOnOff(refs) {
  52914. const onParsed = [];
  52915. if (Array.isArray(refs)) {
  52916. for (const value of refs) {
  52917. if (!(value instanceof _primitives.Ref)) {
  52918. continue;
  52919. }
  52920. if (contentGroupRefs.includes(value)) {
  52921. onParsed.push(value.toString());
  52922. }
  52923. }
  52924. }
  52925. return onParsed;
  52926. }
  52927. function parseOrder(refs) {
  52928. let nestedLevels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  52929. if (!Array.isArray(refs)) {
  52930. return null;
  52931. }
  52932. const order = [];
  52933. for (const value of refs) {
  52934. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  52935. parsedOrderRefs.put(value);
  52936. order.push(value.toString());
  52937. continue;
  52938. }
  52939. const nestedOrder = parseNestedOrder(value, nestedLevels);
  52940. if (nestedOrder) {
  52941. order.push(nestedOrder);
  52942. }
  52943. }
  52944. if (nestedLevels > 0) {
  52945. return order;
  52946. }
  52947. const hiddenGroups = [];
  52948. for (const groupRef of contentGroupRefs) {
  52949. if (parsedOrderRefs.has(groupRef)) {
  52950. continue;
  52951. }
  52952. hiddenGroups.push(groupRef.toString());
  52953. }
  52954. if (hiddenGroups.length) {
  52955. order.push({
  52956. name: null,
  52957. order: hiddenGroups
  52958. });
  52959. }
  52960. return order;
  52961. }
  52962. function parseNestedOrder(ref, nestedLevels) {
  52963. if (++nestedLevels > MAX_NESTED_LEVELS) {
  52964. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  52965. return null;
  52966. }
  52967. const value = xref.fetchIfRef(ref);
  52968. if (!Array.isArray(value)) {
  52969. return null;
  52970. }
  52971. const nestedName = xref.fetchIfRef(value[0]);
  52972. if (typeof nestedName !== "string") {
  52973. return null;
  52974. }
  52975. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  52976. if (!nestedOrder || !nestedOrder.length) {
  52977. return null;
  52978. }
  52979. return {
  52980. name: (0, _util.stringToPDFString)(nestedName),
  52981. order: nestedOrder
  52982. };
  52983. }
  52984. const xref = this.xref,
  52985. parsedOrderRefs = new _primitives.RefSet(),
  52986. MAX_NESTED_LEVELS = 10;
  52987. return {
  52988. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  52989. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  52990. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  52991. on: parseOnOff(config.get("ON")),
  52992. off: parseOnOff(config.get("OFF")),
  52993. order: parseOrder(config.get("Order")),
  52994. groups: null
  52995. };
  52996. }
  52997. setActualNumPages() {
  52998. let num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  52999. this._actualNumPages = num;
  53000. }
  53001. get hasActualNumPages() {
  53002. return this._actualNumPages !== null;
  53003. }
  53004. get _pagesCount() {
  53005. const obj = this.toplevelPagesDict.get("Count");
  53006. if (!Number.isInteger(obj)) {
  53007. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  53008. }
  53009. return (0, _util.shadow)(this, "_pagesCount", obj);
  53010. }
  53011. get numPages() {
  53012. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  53013. }
  53014. get destinations() {
  53015. const obj = this._readDests(),
  53016. dests = Object.create(null);
  53017. if (obj instanceof _name_number_tree.NameTree) {
  53018. for (const [key, value] of obj.getAll()) {
  53019. const dest = fetchDestination(value);
  53020. if (dest) {
  53021. dests[(0, _util.stringToPDFString)(key)] = dest;
  53022. }
  53023. }
  53024. } else if (obj instanceof _primitives.Dict) {
  53025. obj.forEach(function (key, value) {
  53026. const dest = fetchDestination(value);
  53027. if (dest) {
  53028. dests[key] = dest;
  53029. }
  53030. });
  53031. }
  53032. return (0, _util.shadow)(this, "destinations", dests);
  53033. }
  53034. getDestination(id) {
  53035. const obj = this._readDests();
  53036. if (obj instanceof _name_number_tree.NameTree) {
  53037. const dest = fetchDestination(obj.get(id));
  53038. if (dest) {
  53039. return dest;
  53040. }
  53041. const allDest = this.destinations[id];
  53042. if (allDest) {
  53043. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  53044. return allDest;
  53045. }
  53046. } else if (obj instanceof _primitives.Dict) {
  53047. const dest = fetchDestination(obj.get(id));
  53048. if (dest) {
  53049. return dest;
  53050. }
  53051. }
  53052. return null;
  53053. }
  53054. _readDests() {
  53055. const obj = this._catDict.get("Names");
  53056. if (obj && obj.has("Dests")) {
  53057. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  53058. } else if (this._catDict.has("Dests")) {
  53059. return this._catDict.get("Dests");
  53060. }
  53061. return undefined;
  53062. }
  53063. get pageLabels() {
  53064. let obj = null;
  53065. try {
  53066. obj = this._readPageLabels();
  53067. } catch (ex) {
  53068. if (ex instanceof _core_utils.MissingDataException) {
  53069. throw ex;
  53070. }
  53071. (0, _util.warn)("Unable to read page labels.");
  53072. }
  53073. return (0, _util.shadow)(this, "pageLabels", obj);
  53074. }
  53075. _readPageLabels() {
  53076. const obj = this._catDict.getRaw("PageLabels");
  53077. if (!obj) {
  53078. return null;
  53079. }
  53080. const pageLabels = new Array(this.numPages);
  53081. let style = null,
  53082. prefix = "";
  53083. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  53084. const nums = numberTree.getAll();
  53085. let currentLabel = "",
  53086. currentIndex = 1;
  53087. for (let i = 0, ii = this.numPages; i < ii; i++) {
  53088. const labelDict = nums.get(i);
  53089. if (labelDict !== undefined) {
  53090. if (!(labelDict instanceof _primitives.Dict)) {
  53091. throw new _util.FormatError("PageLabel is not a dictionary.");
  53092. }
  53093. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  53094. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  53095. }
  53096. if (labelDict.has("S")) {
  53097. const s = labelDict.get("S");
  53098. if (!(s instanceof _primitives.Name)) {
  53099. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  53100. }
  53101. style = s.name;
  53102. } else {
  53103. style = null;
  53104. }
  53105. if (labelDict.has("P")) {
  53106. const p = labelDict.get("P");
  53107. if (typeof p !== "string") {
  53108. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  53109. }
  53110. prefix = (0, _util.stringToPDFString)(p);
  53111. } else {
  53112. prefix = "";
  53113. }
  53114. if (labelDict.has("St")) {
  53115. const st = labelDict.get("St");
  53116. if (!(Number.isInteger(st) && st >= 1)) {
  53117. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  53118. }
  53119. currentIndex = st;
  53120. } else {
  53121. currentIndex = 1;
  53122. }
  53123. }
  53124. switch (style) {
  53125. case "D":
  53126. currentLabel = currentIndex;
  53127. break;
  53128. case "R":
  53129. case "r":
  53130. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  53131. break;
  53132. case "A":
  53133. case "a":
  53134. const LIMIT = 26;
  53135. const A_UPPER_CASE = 0x41,
  53136. A_LOWER_CASE = 0x61;
  53137. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  53138. const letterIndex = currentIndex - 1;
  53139. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  53140. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  53141. break;
  53142. default:
  53143. if (style) {
  53144. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  53145. }
  53146. currentLabel = "";
  53147. }
  53148. pageLabels[i] = prefix + currentLabel;
  53149. currentIndex++;
  53150. }
  53151. return pageLabels;
  53152. }
  53153. get pageLayout() {
  53154. const obj = this._catDict.get("PageLayout");
  53155. let pageLayout = "";
  53156. if (obj instanceof _primitives.Name) {
  53157. switch (obj.name) {
  53158. case "SinglePage":
  53159. case "OneColumn":
  53160. case "TwoColumnLeft":
  53161. case "TwoColumnRight":
  53162. case "TwoPageLeft":
  53163. case "TwoPageRight":
  53164. pageLayout = obj.name;
  53165. }
  53166. }
  53167. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  53168. }
  53169. get pageMode() {
  53170. const obj = this._catDict.get("PageMode");
  53171. let pageMode = "UseNone";
  53172. if (obj instanceof _primitives.Name) {
  53173. switch (obj.name) {
  53174. case "UseNone":
  53175. case "UseOutlines":
  53176. case "UseThumbs":
  53177. case "FullScreen":
  53178. case "UseOC":
  53179. case "UseAttachments":
  53180. pageMode = obj.name;
  53181. }
  53182. }
  53183. return (0, _util.shadow)(this, "pageMode", pageMode);
  53184. }
  53185. get viewerPreferences() {
  53186. const obj = this._catDict.get("ViewerPreferences");
  53187. if (!(obj instanceof _primitives.Dict)) {
  53188. return (0, _util.shadow)(this, "viewerPreferences", null);
  53189. }
  53190. let prefs = null;
  53191. for (const key of obj.getKeys()) {
  53192. const value = obj.get(key);
  53193. let prefValue;
  53194. switch (key) {
  53195. case "HideToolbar":
  53196. case "HideMenubar":
  53197. case "HideWindowUI":
  53198. case "FitWindow":
  53199. case "CenterWindow":
  53200. case "DisplayDocTitle":
  53201. case "PickTrayByPDFSize":
  53202. if (typeof value === "boolean") {
  53203. prefValue = value;
  53204. }
  53205. break;
  53206. case "NonFullScreenPageMode":
  53207. if (value instanceof _primitives.Name) {
  53208. switch (value.name) {
  53209. case "UseNone":
  53210. case "UseOutlines":
  53211. case "UseThumbs":
  53212. case "UseOC":
  53213. prefValue = value.name;
  53214. break;
  53215. default:
  53216. prefValue = "UseNone";
  53217. }
  53218. }
  53219. break;
  53220. case "Direction":
  53221. if (value instanceof _primitives.Name) {
  53222. switch (value.name) {
  53223. case "L2R":
  53224. case "R2L":
  53225. prefValue = value.name;
  53226. break;
  53227. default:
  53228. prefValue = "L2R";
  53229. }
  53230. }
  53231. break;
  53232. case "ViewArea":
  53233. case "ViewClip":
  53234. case "PrintArea":
  53235. case "PrintClip":
  53236. if (value instanceof _primitives.Name) {
  53237. switch (value.name) {
  53238. case "MediaBox":
  53239. case "CropBox":
  53240. case "BleedBox":
  53241. case "TrimBox":
  53242. case "ArtBox":
  53243. prefValue = value.name;
  53244. break;
  53245. default:
  53246. prefValue = "CropBox";
  53247. }
  53248. }
  53249. break;
  53250. case "PrintScaling":
  53251. if (value instanceof _primitives.Name) {
  53252. switch (value.name) {
  53253. case "None":
  53254. case "AppDefault":
  53255. prefValue = value.name;
  53256. break;
  53257. default:
  53258. prefValue = "AppDefault";
  53259. }
  53260. }
  53261. break;
  53262. case "Duplex":
  53263. if (value instanceof _primitives.Name) {
  53264. switch (value.name) {
  53265. case "Simplex":
  53266. case "DuplexFlipShortEdge":
  53267. case "DuplexFlipLongEdge":
  53268. prefValue = value.name;
  53269. break;
  53270. default:
  53271. prefValue = "None";
  53272. }
  53273. }
  53274. break;
  53275. case "PrintPageRange":
  53276. if (Array.isArray(value) && value.length % 2 === 0) {
  53277. const isValid = value.every((page, i, arr) => {
  53278. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  53279. });
  53280. if (isValid) {
  53281. prefValue = value;
  53282. }
  53283. }
  53284. break;
  53285. case "NumCopies":
  53286. if (Number.isInteger(value) && value > 0) {
  53287. prefValue = value;
  53288. }
  53289. break;
  53290. default:
  53291. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  53292. continue;
  53293. }
  53294. if (prefValue === undefined) {
  53295. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  53296. continue;
  53297. }
  53298. if (!prefs) {
  53299. prefs = Object.create(null);
  53300. }
  53301. prefs[key] = prefValue;
  53302. }
  53303. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  53304. }
  53305. get openAction() {
  53306. const obj = this._catDict.get("OpenAction");
  53307. const openAction = Object.create(null);
  53308. if (obj instanceof _primitives.Dict) {
  53309. const destDict = new _primitives.Dict(this.xref);
  53310. destDict.set("A", obj);
  53311. const resultObj = {
  53312. url: null,
  53313. dest: null,
  53314. action: null
  53315. };
  53316. Catalog.parseDestDictionary({
  53317. destDict,
  53318. resultObj
  53319. });
  53320. if (Array.isArray(resultObj.dest)) {
  53321. openAction.dest = resultObj.dest;
  53322. } else if (resultObj.action) {
  53323. openAction.action = resultObj.action;
  53324. }
  53325. } else if (Array.isArray(obj)) {
  53326. openAction.dest = obj;
  53327. }
  53328. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  53329. }
  53330. get attachments() {
  53331. const obj = this._catDict.get("Names");
  53332. let attachments = null;
  53333. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  53334. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  53335. for (const [key, value] of nameTree.getAll()) {
  53336. const fs = new _file_spec.FileSpec(value, this.xref);
  53337. if (!attachments) {
  53338. attachments = Object.create(null);
  53339. }
  53340. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  53341. }
  53342. }
  53343. return (0, _util.shadow)(this, "attachments", attachments);
  53344. }
  53345. get xfaImages() {
  53346. const obj = this._catDict.get("Names");
  53347. let xfaImages = null;
  53348. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  53349. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  53350. for (const [key, value] of nameTree.getAll()) {
  53351. if (!xfaImages) {
  53352. xfaImages = new _primitives.Dict(this.xref);
  53353. }
  53354. xfaImages.set((0, _util.stringToPDFString)(key), value);
  53355. }
  53356. }
  53357. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  53358. }
  53359. _collectJavaScript() {
  53360. const obj = this._catDict.get("Names");
  53361. let javaScript = null;
  53362. function appendIfJavaScriptDict(name, jsDict) {
  53363. if (!(jsDict instanceof _primitives.Dict)) {
  53364. return;
  53365. }
  53366. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  53367. return;
  53368. }
  53369. let js = jsDict.get("JS");
  53370. if (js instanceof _base_stream.BaseStream) {
  53371. js = js.getString();
  53372. } else if (typeof js !== "string") {
  53373. return;
  53374. }
  53375. if (javaScript === null) {
  53376. javaScript = new Map();
  53377. }
  53378. js = (0, _util.stringToPDFString)(js).replace(/\u0000/g, "");
  53379. javaScript.set(name, js);
  53380. }
  53381. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  53382. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  53383. for (const [key, value] of nameTree.getAll()) {
  53384. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  53385. }
  53386. }
  53387. const openAction = this._catDict.get("OpenAction");
  53388. if (openAction) {
  53389. appendIfJavaScriptDict("OpenAction", openAction);
  53390. }
  53391. return javaScript;
  53392. }
  53393. get javaScript() {
  53394. const javaScript = this._collectJavaScript();
  53395. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  53396. }
  53397. get jsActions() {
  53398. const javaScript = this._collectJavaScript();
  53399. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  53400. if (javaScript) {
  53401. if (!actions) {
  53402. actions = Object.create(null);
  53403. }
  53404. for (const [key, val] of javaScript) {
  53405. if (key in actions) {
  53406. actions[key].push(val);
  53407. } else {
  53408. actions[key] = [val];
  53409. }
  53410. }
  53411. }
  53412. return (0, _util.shadow)(this, "jsActions", actions);
  53413. }
  53414. async fontFallback(id, handler) {
  53415. const translatedFonts = await Promise.all(this.fontCache);
  53416. for (const translatedFont of translatedFonts) {
  53417. if (translatedFont.loadedName === id) {
  53418. translatedFont.fallback(handler);
  53419. return;
  53420. }
  53421. }
  53422. }
  53423. async cleanup() {
  53424. let manuallyTriggered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53425. (0, _cleanup_helper.clearGlobalCaches)();
  53426. this.globalImageCache.clear(manuallyTriggered);
  53427. this.pageKidsCountCache.clear();
  53428. this.pageIndexCache.clear();
  53429. this.nonBlendModesSet.clear();
  53430. const translatedFonts = await Promise.all(this.fontCache);
  53431. for (const {
  53432. dict
  53433. } of translatedFonts) {
  53434. delete dict.cacheKey;
  53435. }
  53436. this.fontCache.clear();
  53437. this.builtInCMapCache.clear();
  53438. this.standardFontDataCache.clear();
  53439. }
  53440. async getPageDict(pageIndex) {
  53441. const nodesToVisit = [this.toplevelPagesDict];
  53442. const visitedNodes = new _primitives.RefSet();
  53443. const pagesRef = this._catDict.getRaw("Pages");
  53444. if (pagesRef instanceof _primitives.Ref) {
  53445. visitedNodes.put(pagesRef);
  53446. }
  53447. const xref = this.xref,
  53448. pageKidsCountCache = this.pageKidsCountCache,
  53449. pageIndexCache = this.pageIndexCache;
  53450. let currentPageIndex = 0;
  53451. while (nodesToVisit.length) {
  53452. const currentNode = nodesToVisit.pop();
  53453. if (currentNode instanceof _primitives.Ref) {
  53454. const count = pageKidsCountCache.get(currentNode);
  53455. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  53456. currentPageIndex += count;
  53457. continue;
  53458. }
  53459. if (visitedNodes.has(currentNode)) {
  53460. throw new _util.FormatError("Pages tree contains circular reference.");
  53461. }
  53462. visitedNodes.put(currentNode);
  53463. const obj = await xref.fetchAsync(currentNode);
  53464. if (obj instanceof _primitives.Dict) {
  53465. let type = obj.getRaw("Type");
  53466. if (type instanceof _primitives.Ref) {
  53467. type = await xref.fetchAsync(type);
  53468. }
  53469. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  53470. if (!pageKidsCountCache.has(currentNode)) {
  53471. pageKidsCountCache.put(currentNode, 1);
  53472. }
  53473. if (!pageIndexCache.has(currentNode)) {
  53474. pageIndexCache.put(currentNode, currentPageIndex);
  53475. }
  53476. if (currentPageIndex === pageIndex) {
  53477. return [obj, currentNode];
  53478. }
  53479. currentPageIndex++;
  53480. continue;
  53481. }
  53482. }
  53483. nodesToVisit.push(obj);
  53484. continue;
  53485. }
  53486. if (!(currentNode instanceof _primitives.Dict)) {
  53487. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  53488. }
  53489. const {
  53490. objId
  53491. } = currentNode;
  53492. let count = currentNode.getRaw("Count");
  53493. if (count instanceof _primitives.Ref) {
  53494. count = await xref.fetchAsync(count);
  53495. }
  53496. if (Number.isInteger(count) && count >= 0) {
  53497. if (objId && !pageKidsCountCache.has(objId)) {
  53498. pageKidsCountCache.put(objId, count);
  53499. }
  53500. if (currentPageIndex + count <= pageIndex) {
  53501. currentPageIndex += count;
  53502. continue;
  53503. }
  53504. }
  53505. let kids = currentNode.getRaw("Kids");
  53506. if (kids instanceof _primitives.Ref) {
  53507. kids = await xref.fetchAsync(kids);
  53508. }
  53509. if (!Array.isArray(kids)) {
  53510. let type = currentNode.getRaw("Type");
  53511. if (type instanceof _primitives.Ref) {
  53512. type = await xref.fetchAsync(type);
  53513. }
  53514. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  53515. if (currentPageIndex === pageIndex) {
  53516. return [currentNode, null];
  53517. }
  53518. currentPageIndex++;
  53519. continue;
  53520. }
  53521. throw new _util.FormatError("Page dictionary kids object is not an array.");
  53522. }
  53523. for (let last = kids.length - 1; last >= 0; last--) {
  53524. nodesToVisit.push(kids[last]);
  53525. }
  53526. }
  53527. throw new Error(`Page index ${pageIndex} not found.`);
  53528. }
  53529. async getAllPageDicts() {
  53530. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  53531. const queue = [{
  53532. currentNode: this.toplevelPagesDict,
  53533. posInKids: 0
  53534. }];
  53535. const visitedNodes = new _primitives.RefSet();
  53536. const pagesRef = this._catDict.getRaw("Pages");
  53537. if (pagesRef instanceof _primitives.Ref) {
  53538. visitedNodes.put(pagesRef);
  53539. }
  53540. const map = new Map(),
  53541. xref = this.xref,
  53542. pageIndexCache = this.pageIndexCache;
  53543. let pageIndex = 0;
  53544. function addPageDict(pageDict, pageRef) {
  53545. if (pageRef && !pageIndexCache.has(pageRef)) {
  53546. pageIndexCache.put(pageRef, pageIndex);
  53547. }
  53548. map.set(pageIndex++, [pageDict, pageRef]);
  53549. }
  53550. function addPageError(error) {
  53551. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  53552. throw error;
  53553. }
  53554. map.set(pageIndex++, [error, null]);
  53555. }
  53556. while (queue.length > 0) {
  53557. const queueItem = queue.at(-1);
  53558. const {
  53559. currentNode,
  53560. posInKids
  53561. } = queueItem;
  53562. let kids = currentNode.getRaw("Kids");
  53563. if (kids instanceof _primitives.Ref) {
  53564. try {
  53565. kids = await xref.fetchAsync(kids);
  53566. } catch (ex) {
  53567. addPageError(ex);
  53568. break;
  53569. }
  53570. }
  53571. if (!Array.isArray(kids)) {
  53572. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  53573. break;
  53574. }
  53575. if (posInKids >= kids.length) {
  53576. queue.pop();
  53577. continue;
  53578. }
  53579. const kidObj = kids[posInKids];
  53580. let obj;
  53581. if (kidObj instanceof _primitives.Ref) {
  53582. if (visitedNodes.has(kidObj)) {
  53583. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  53584. break;
  53585. }
  53586. visitedNodes.put(kidObj);
  53587. try {
  53588. obj = await xref.fetchAsync(kidObj);
  53589. } catch (ex) {
  53590. addPageError(ex);
  53591. break;
  53592. }
  53593. } else {
  53594. obj = kidObj;
  53595. }
  53596. if (!(obj instanceof _primitives.Dict)) {
  53597. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  53598. break;
  53599. }
  53600. let type = obj.getRaw("Type");
  53601. if (type instanceof _primitives.Ref) {
  53602. try {
  53603. type = await xref.fetchAsync(type);
  53604. } catch (ex) {
  53605. addPageError(ex);
  53606. break;
  53607. }
  53608. }
  53609. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  53610. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  53611. } else {
  53612. queue.push({
  53613. currentNode: obj,
  53614. posInKids: 0
  53615. });
  53616. }
  53617. queueItem.posInKids++;
  53618. }
  53619. return map;
  53620. }
  53621. getPageIndex(pageRef) {
  53622. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  53623. if (cachedPageIndex !== undefined) {
  53624. return Promise.resolve(cachedPageIndex);
  53625. }
  53626. const xref = this.xref;
  53627. function pagesBeforeRef(kidRef) {
  53628. let total = 0,
  53629. parentRef;
  53630. return xref.fetchAsync(kidRef).then(function (node) {
  53631. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  53632. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  53633. }
  53634. if (!node) {
  53635. return null;
  53636. }
  53637. if (!(node instanceof _primitives.Dict)) {
  53638. throw new _util.FormatError("Node must be a dictionary.");
  53639. }
  53640. parentRef = node.getRaw("Parent");
  53641. return node.getAsync("Parent");
  53642. }).then(function (parent) {
  53643. if (!parent) {
  53644. return null;
  53645. }
  53646. if (!(parent instanceof _primitives.Dict)) {
  53647. throw new _util.FormatError("Parent must be a dictionary.");
  53648. }
  53649. return parent.getAsync("Kids");
  53650. }).then(function (kids) {
  53651. if (!kids) {
  53652. return null;
  53653. }
  53654. const kidPromises = [];
  53655. let found = false;
  53656. for (const kid of kids) {
  53657. if (!(kid instanceof _primitives.Ref)) {
  53658. throw new _util.FormatError("Kid must be a reference.");
  53659. }
  53660. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  53661. found = true;
  53662. break;
  53663. }
  53664. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  53665. if (!(obj instanceof _primitives.Dict)) {
  53666. throw new _util.FormatError("Kid node must be a dictionary.");
  53667. }
  53668. if (obj.has("Count")) {
  53669. total += obj.get("Count");
  53670. } else {
  53671. total++;
  53672. }
  53673. }));
  53674. }
  53675. if (!found) {
  53676. throw new _util.FormatError("Kid reference not found in parent's kids.");
  53677. }
  53678. return Promise.all(kidPromises).then(function () {
  53679. return [total, parentRef];
  53680. });
  53681. });
  53682. }
  53683. let total = 0;
  53684. const next = ref => pagesBeforeRef(ref).then(args => {
  53685. if (!args) {
  53686. this.pageIndexCache.put(pageRef, total);
  53687. return total;
  53688. }
  53689. const [count, parentRef] = args;
  53690. total += count;
  53691. return next(parentRef);
  53692. });
  53693. return next(pageRef);
  53694. }
  53695. get baseUrl() {
  53696. const uri = this._catDict.get("URI");
  53697. if (uri instanceof _primitives.Dict) {
  53698. const base = uri.get("Base");
  53699. if (typeof base === "string") {
  53700. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  53701. tryConvertEncoding: true
  53702. });
  53703. if (absoluteUrl) {
  53704. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  53705. }
  53706. }
  53707. }
  53708. return (0, _util.shadow)(this, "baseUrl", null);
  53709. }
  53710. static parseDestDictionary(params) {
  53711. const destDict = params.destDict;
  53712. if (!(destDict instanceof _primitives.Dict)) {
  53713. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  53714. return;
  53715. }
  53716. const resultObj = params.resultObj;
  53717. if (typeof resultObj !== "object") {
  53718. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  53719. return;
  53720. }
  53721. const docBaseUrl = params.docBaseUrl || null;
  53722. const docAttachments = params.docAttachments || null;
  53723. let action = destDict.get("A"),
  53724. url,
  53725. dest;
  53726. if (!(action instanceof _primitives.Dict)) {
  53727. if (destDict.has("Dest")) {
  53728. action = destDict.get("Dest");
  53729. } else {
  53730. action = destDict.get("AA");
  53731. if (action instanceof _primitives.Dict) {
  53732. if (action.has("D")) {
  53733. action = action.get("D");
  53734. } else if (action.has("U")) {
  53735. action = action.get("U");
  53736. }
  53737. }
  53738. }
  53739. }
  53740. if (action instanceof _primitives.Dict) {
  53741. const actionType = action.get("S");
  53742. if (!(actionType instanceof _primitives.Name)) {
  53743. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  53744. return;
  53745. }
  53746. const actionName = actionType.name;
  53747. switch (actionName) {
  53748. case "ResetForm":
  53749. const flags = action.get("Flags");
  53750. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  53751. const fields = [];
  53752. const refs = [];
  53753. for (const obj of action.get("Fields") || []) {
  53754. if (obj instanceof _primitives.Ref) {
  53755. refs.push(obj.toString());
  53756. } else if (typeof obj === "string") {
  53757. fields.push((0, _util.stringToPDFString)(obj));
  53758. }
  53759. }
  53760. resultObj.resetForm = {
  53761. fields,
  53762. refs,
  53763. include
  53764. };
  53765. break;
  53766. case "URI":
  53767. url = action.get("URI");
  53768. if (url instanceof _primitives.Name) {
  53769. url = "/" + url.name;
  53770. }
  53771. break;
  53772. case "GoTo":
  53773. dest = action.get("D");
  53774. break;
  53775. case "Launch":
  53776. case "GoToR":
  53777. const urlDict = action.get("F");
  53778. if (urlDict instanceof _primitives.Dict) {
  53779. url = urlDict.get("F") || null;
  53780. } else if (typeof urlDict === "string") {
  53781. url = urlDict;
  53782. }
  53783. let remoteDest = action.get("D");
  53784. if (remoteDest) {
  53785. if (remoteDest instanceof _primitives.Name) {
  53786. remoteDest = remoteDest.name;
  53787. }
  53788. if (typeof url === "string") {
  53789. const baseUrl = url.split("#")[0];
  53790. if (typeof remoteDest === "string") {
  53791. url = baseUrl + "#" + remoteDest;
  53792. } else if (Array.isArray(remoteDest)) {
  53793. url = baseUrl + "#" + JSON.stringify(remoteDest);
  53794. }
  53795. }
  53796. }
  53797. const newWindow = action.get("NewWindow");
  53798. if (typeof newWindow === "boolean") {
  53799. resultObj.newWindow = newWindow;
  53800. }
  53801. break;
  53802. case "GoToE":
  53803. const target = action.get("T");
  53804. let attachment;
  53805. if (docAttachments && target instanceof _primitives.Dict) {
  53806. const relationship = target.get("R");
  53807. const name = target.get("N");
  53808. if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
  53809. attachment = docAttachments[(0, _util.stringToPDFString)(name)];
  53810. }
  53811. }
  53812. if (attachment) {
  53813. resultObj.attachment = attachment;
  53814. } else {
  53815. (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
  53816. }
  53817. break;
  53818. case "Named":
  53819. const namedAction = action.get("N");
  53820. if (namedAction instanceof _primitives.Name) {
  53821. resultObj.action = namedAction.name;
  53822. }
  53823. break;
  53824. case "SetOCGState":
  53825. const state = action.get("State");
  53826. const preserveRB = action.get("PreserveRB");
  53827. if (!Array.isArray(state) || state.length === 0) {
  53828. break;
  53829. }
  53830. const stateArr = [];
  53831. for (const elem of state) {
  53832. if (elem instanceof _primitives.Name) {
  53833. switch (elem.name) {
  53834. case "ON":
  53835. case "OFF":
  53836. case "Toggle":
  53837. stateArr.push(elem.name);
  53838. break;
  53839. }
  53840. } else if (elem instanceof _primitives.Ref) {
  53841. stateArr.push(elem.toString());
  53842. }
  53843. }
  53844. if (stateArr.length !== state.length) {
  53845. break;
  53846. }
  53847. resultObj.setOCGState = {
  53848. state: stateArr,
  53849. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  53850. };
  53851. break;
  53852. case "JavaScript":
  53853. const jsAction = action.get("JS");
  53854. let js;
  53855. if (jsAction instanceof _base_stream.BaseStream) {
  53856. js = jsAction.getString();
  53857. } else if (typeof jsAction === "string") {
  53858. js = jsAction;
  53859. }
  53860. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  53861. if (jsURL) {
  53862. url = jsURL.url;
  53863. resultObj.newWindow = jsURL.newWindow;
  53864. break;
  53865. }
  53866. default:
  53867. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  53868. break;
  53869. }
  53870. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  53871. break;
  53872. }
  53873. } else if (destDict.has("Dest")) {
  53874. dest = destDict.get("Dest");
  53875. }
  53876. if (typeof url === "string") {
  53877. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  53878. addDefaultProtocol: true,
  53879. tryConvertEncoding: true
  53880. });
  53881. if (absoluteUrl) {
  53882. resultObj.url = absoluteUrl.href;
  53883. }
  53884. resultObj.unsafeUrl = url;
  53885. }
  53886. if (dest) {
  53887. if (dest instanceof _primitives.Name) {
  53888. dest = dest.name;
  53889. }
  53890. if (typeof dest === "string") {
  53891. resultObj.dest = (0, _util.stringToPDFString)(dest);
  53892. } else if (Array.isArray(dest)) {
  53893. resultObj.dest = dest;
  53894. }
  53895. }
  53896. }
  53897. }
  53898. exports.Catalog = Catalog;
  53899. /***/ }),
  53900. /* 199 */
  53901. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  53902. "use strict";
  53903. Object.defineProperty(exports, "__esModule", ({
  53904. value: true
  53905. }));
  53906. exports.NumberTree = exports.NameTree = void 0;
  53907. var _primitives = __w_pdfjs_require__(134);
  53908. var _util = __w_pdfjs_require__(2);
  53909. class NameOrNumberTree {
  53910. constructor(root, xref, type) {
  53911. if (this.constructor === NameOrNumberTree) {
  53912. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  53913. }
  53914. this.root = root;
  53915. this.xref = xref;
  53916. this._type = type;
  53917. }
  53918. getAll() {
  53919. const map = new Map();
  53920. if (!this.root) {
  53921. return map;
  53922. }
  53923. const xref = this.xref;
  53924. const processed = new _primitives.RefSet();
  53925. processed.put(this.root);
  53926. const queue = [this.root];
  53927. while (queue.length > 0) {
  53928. const obj = xref.fetchIfRef(queue.shift());
  53929. if (!(obj instanceof _primitives.Dict)) {
  53930. continue;
  53931. }
  53932. if (obj.has("Kids")) {
  53933. const kids = obj.get("Kids");
  53934. if (!Array.isArray(kids)) {
  53935. continue;
  53936. }
  53937. for (const kid of kids) {
  53938. if (processed.has(kid)) {
  53939. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  53940. }
  53941. queue.push(kid);
  53942. processed.put(kid);
  53943. }
  53944. continue;
  53945. }
  53946. const entries = obj.get(this._type);
  53947. if (!Array.isArray(entries)) {
  53948. continue;
  53949. }
  53950. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  53951. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  53952. }
  53953. }
  53954. return map;
  53955. }
  53956. get(key) {
  53957. if (!this.root) {
  53958. return null;
  53959. }
  53960. const xref = this.xref;
  53961. let kidsOrEntries = xref.fetchIfRef(this.root);
  53962. let loopCount = 0;
  53963. const MAX_LEVELS = 10;
  53964. while (kidsOrEntries.has("Kids")) {
  53965. if (++loopCount > MAX_LEVELS) {
  53966. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  53967. return null;
  53968. }
  53969. const kids = kidsOrEntries.get("Kids");
  53970. if (!Array.isArray(kids)) {
  53971. return null;
  53972. }
  53973. let l = 0,
  53974. r = kids.length - 1;
  53975. while (l <= r) {
  53976. const m = l + r >> 1;
  53977. const kid = xref.fetchIfRef(kids[m]);
  53978. const limits = kid.get("Limits");
  53979. if (key < xref.fetchIfRef(limits[0])) {
  53980. r = m - 1;
  53981. } else if (key > xref.fetchIfRef(limits[1])) {
  53982. l = m + 1;
  53983. } else {
  53984. kidsOrEntries = kid;
  53985. break;
  53986. }
  53987. }
  53988. if (l > r) {
  53989. return null;
  53990. }
  53991. }
  53992. const entries = kidsOrEntries.get(this._type);
  53993. if (Array.isArray(entries)) {
  53994. let l = 0,
  53995. r = entries.length - 2;
  53996. while (l <= r) {
  53997. const tmp = l + r >> 1,
  53998. m = tmp + (tmp & 1);
  53999. const currentKey = xref.fetchIfRef(entries[m]);
  54000. if (key < currentKey) {
  54001. r = m - 2;
  54002. } else if (key > currentKey) {
  54003. l = m + 2;
  54004. } else {
  54005. return xref.fetchIfRef(entries[m + 1]);
  54006. }
  54007. }
  54008. }
  54009. return null;
  54010. }
  54011. }
  54012. class NameTree extends NameOrNumberTree {
  54013. constructor(root, xref) {
  54014. super(root, xref, "Names");
  54015. }
  54016. }
  54017. exports.NameTree = NameTree;
  54018. class NumberTree extends NameOrNumberTree {
  54019. constructor(root, xref) {
  54020. super(root, xref, "Nums");
  54021. }
  54022. }
  54023. exports.NumberTree = NumberTree;
  54024. /***/ }),
  54025. /* 200 */
  54026. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54027. "use strict";
  54028. Object.defineProperty(exports, "__esModule", ({
  54029. value: true
  54030. }));
  54031. exports.clearGlobalCaches = clearGlobalCaches;
  54032. var _primitives = __w_pdfjs_require__(134);
  54033. var _unicode = __w_pdfjs_require__(169);
  54034. function clearGlobalCaches() {
  54035. (0, _primitives.clearPrimitiveCaches)();
  54036. (0, _unicode.clearUnicodeCaches)();
  54037. }
  54038. /***/ }),
  54039. /* 201 */
  54040. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54041. "use strict";
  54042. Object.defineProperty(exports, "__esModule", ({
  54043. value: true
  54044. }));
  54045. exports.FileSpec = void 0;
  54046. var _util = __w_pdfjs_require__(2);
  54047. var _base_stream = __w_pdfjs_require__(136);
  54048. var _primitives = __w_pdfjs_require__(134);
  54049. function pickPlatformItem(dict) {
  54050. if (dict.has("UF")) {
  54051. return dict.get("UF");
  54052. } else if (dict.has("F")) {
  54053. return dict.get("F");
  54054. } else if (dict.has("Unix")) {
  54055. return dict.get("Unix");
  54056. } else if (dict.has("Mac")) {
  54057. return dict.get("Mac");
  54058. } else if (dict.has("DOS")) {
  54059. return dict.get("DOS");
  54060. }
  54061. return null;
  54062. }
  54063. class FileSpec {
  54064. constructor(root, xref) {
  54065. if (!(root instanceof _primitives.Dict)) {
  54066. return;
  54067. }
  54068. this.xref = xref;
  54069. this.root = root;
  54070. if (root.has("FS")) {
  54071. this.fs = root.get("FS");
  54072. }
  54073. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  54074. if (root.has("RF")) {
  54075. (0, _util.warn)("Related file specifications are not supported");
  54076. }
  54077. this.contentAvailable = true;
  54078. if (!root.has("EF")) {
  54079. this.contentAvailable = false;
  54080. (0, _util.warn)("Non-embedded file specifications are not supported");
  54081. }
  54082. }
  54083. get filename() {
  54084. if (!this._filename && this.root) {
  54085. const filename = pickPlatformItem(this.root) || "unnamed";
  54086. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  54087. }
  54088. return this._filename;
  54089. }
  54090. get content() {
  54091. if (!this.contentAvailable) {
  54092. return null;
  54093. }
  54094. if (!this.contentRef && this.root) {
  54095. this.contentRef = pickPlatformItem(this.root.get("EF"));
  54096. }
  54097. let content = null;
  54098. if (this.contentRef) {
  54099. const fileObj = this.xref.fetchIfRef(this.contentRef);
  54100. if (fileObj instanceof _base_stream.BaseStream) {
  54101. content = fileObj.getBytes();
  54102. } else {
  54103. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  54104. }
  54105. } else {
  54106. (0, _util.warn)("Embedded file specification does not have a content");
  54107. }
  54108. return content;
  54109. }
  54110. get serializable() {
  54111. return {
  54112. filename: this.filename,
  54113. content: this.content
  54114. };
  54115. }
  54116. }
  54117. exports.FileSpec = FileSpec;
  54118. /***/ }),
  54119. /* 202 */
  54120. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54121. "use strict";
  54122. Object.defineProperty(exports, "__esModule", ({
  54123. value: true
  54124. }));
  54125. exports.MetadataParser = void 0;
  54126. var _xml_parser = __w_pdfjs_require__(195);
  54127. class MetadataParser {
  54128. constructor(data) {
  54129. data = this._repair(data);
  54130. const parser = new _xml_parser.SimpleXMLParser({
  54131. lowerCaseName: true
  54132. });
  54133. const xmlDocument = parser.parseFromString(data);
  54134. this._metadataMap = new Map();
  54135. this._data = data;
  54136. if (xmlDocument) {
  54137. this._parse(xmlDocument);
  54138. }
  54139. }
  54140. _repair(data) {
  54141. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  54142. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  54143. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  54144. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  54145. switch (name) {
  54146. case "amp":
  54147. return "&";
  54148. case "apos":
  54149. return "'";
  54150. case "gt":
  54151. return ">";
  54152. case "lt":
  54153. return "<";
  54154. case "quot":
  54155. return '"';
  54156. }
  54157. throw new Error(`_repair: ${name} isn't defined.`);
  54158. });
  54159. const charBuf = [];
  54160. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  54161. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  54162. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  54163. charBuf.push(String.fromCharCode(code));
  54164. } else {
  54165. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  54166. }
  54167. }
  54168. return ">" + charBuf.join("");
  54169. });
  54170. }
  54171. _getSequence(entry) {
  54172. const name = entry.nodeName;
  54173. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  54174. return null;
  54175. }
  54176. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  54177. }
  54178. _parseArray(entry) {
  54179. if (!entry.hasChildNodes()) {
  54180. return;
  54181. }
  54182. const [seqNode] = entry.childNodes;
  54183. const sequence = this._getSequence(seqNode) || [];
  54184. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  54185. }
  54186. _parse(xmlDocument) {
  54187. let rdf = xmlDocument.documentElement;
  54188. if (rdf.nodeName !== "rdf:rdf") {
  54189. rdf = rdf.firstChild;
  54190. while (rdf && rdf.nodeName !== "rdf:rdf") {
  54191. rdf = rdf.nextSibling;
  54192. }
  54193. }
  54194. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  54195. return;
  54196. }
  54197. for (const desc of rdf.childNodes) {
  54198. if (desc.nodeName !== "rdf:description") {
  54199. continue;
  54200. }
  54201. for (const entry of desc.childNodes) {
  54202. const name = entry.nodeName;
  54203. switch (name) {
  54204. case "#text":
  54205. continue;
  54206. case "dc:creator":
  54207. case "dc:subject":
  54208. this._parseArray(entry);
  54209. continue;
  54210. }
  54211. this._metadataMap.set(name, entry.textContent.trim());
  54212. }
  54213. }
  54214. }
  54215. get serializable() {
  54216. return {
  54217. parsedData: this._metadataMap,
  54218. rawData: this._data
  54219. };
  54220. }
  54221. }
  54222. exports.MetadataParser = MetadataParser;
  54223. /***/ }),
  54224. /* 203 */
  54225. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54226. "use strict";
  54227. Object.defineProperty(exports, "__esModule", ({
  54228. value: true
  54229. }));
  54230. exports.StructTreeRoot = exports.StructTreePage = void 0;
  54231. var _primitives = __w_pdfjs_require__(134);
  54232. var _util = __w_pdfjs_require__(2);
  54233. var _name_number_tree = __w_pdfjs_require__(199);
  54234. const MAX_DEPTH = 40;
  54235. const StructElementType = {
  54236. PAGE_CONTENT: "PAGE_CONTENT",
  54237. STREAM_CONTENT: "STREAM_CONTENT",
  54238. OBJECT: "OBJECT",
  54239. ELEMENT: "ELEMENT"
  54240. };
  54241. class StructTreeRoot {
  54242. constructor(rootDict) {
  54243. this.dict = rootDict;
  54244. this.roleMap = new Map();
  54245. }
  54246. init() {
  54247. this.readRoleMap();
  54248. }
  54249. readRoleMap() {
  54250. const roleMapDict = this.dict.get("RoleMap");
  54251. if (!(roleMapDict instanceof _primitives.Dict)) {
  54252. return;
  54253. }
  54254. roleMapDict.forEach((key, value) => {
  54255. if (!(value instanceof _primitives.Name)) {
  54256. return;
  54257. }
  54258. this.roleMap.set(key, value.name);
  54259. });
  54260. }
  54261. }
  54262. exports.StructTreeRoot = StructTreeRoot;
  54263. class StructElementNode {
  54264. constructor(tree, dict) {
  54265. this.tree = tree;
  54266. this.dict = dict;
  54267. this.kids = [];
  54268. this.parseKids();
  54269. }
  54270. get role() {
  54271. const nameObj = this.dict.get("S");
  54272. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  54273. const {
  54274. root
  54275. } = this.tree;
  54276. if (root.roleMap.has(name)) {
  54277. return root.roleMap.get(name);
  54278. }
  54279. return name;
  54280. }
  54281. parseKids() {
  54282. let pageObjId = null;
  54283. const objRef = this.dict.getRaw("Pg");
  54284. if (objRef instanceof _primitives.Ref) {
  54285. pageObjId = objRef.toString();
  54286. }
  54287. const kids = this.dict.get("K");
  54288. if (Array.isArray(kids)) {
  54289. for (const kid of kids) {
  54290. const element = this.parseKid(pageObjId, kid);
  54291. if (element) {
  54292. this.kids.push(element);
  54293. }
  54294. }
  54295. } else {
  54296. const element = this.parseKid(pageObjId, kids);
  54297. if (element) {
  54298. this.kids.push(element);
  54299. }
  54300. }
  54301. }
  54302. parseKid(pageObjId, kid) {
  54303. if (Number.isInteger(kid)) {
  54304. if (this.tree.pageDict.objId !== pageObjId) {
  54305. return null;
  54306. }
  54307. return new StructElement({
  54308. type: StructElementType.PAGE_CONTENT,
  54309. mcid: kid,
  54310. pageObjId
  54311. });
  54312. }
  54313. let kidDict = null;
  54314. if (kid instanceof _primitives.Ref) {
  54315. kidDict = this.dict.xref.fetch(kid);
  54316. } else if (kid instanceof _primitives.Dict) {
  54317. kidDict = kid;
  54318. }
  54319. if (!kidDict) {
  54320. return null;
  54321. }
  54322. const pageRef = kidDict.getRaw("Pg");
  54323. if (pageRef instanceof _primitives.Ref) {
  54324. pageObjId = pageRef.toString();
  54325. }
  54326. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  54327. if (type === "MCR") {
  54328. if (this.tree.pageDict.objId !== pageObjId) {
  54329. return null;
  54330. }
  54331. return new StructElement({
  54332. type: StructElementType.STREAM_CONTENT,
  54333. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  54334. pageObjId,
  54335. mcid: kidDict.get("MCID")
  54336. });
  54337. }
  54338. if (type === "OBJR") {
  54339. if (this.tree.pageDict.objId !== pageObjId) {
  54340. return null;
  54341. }
  54342. return new StructElement({
  54343. type: StructElementType.OBJECT,
  54344. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  54345. pageObjId
  54346. });
  54347. }
  54348. return new StructElement({
  54349. type: StructElementType.ELEMENT,
  54350. dict: kidDict
  54351. });
  54352. }
  54353. }
  54354. class StructElement {
  54355. constructor(_ref) {
  54356. let {
  54357. type,
  54358. dict = null,
  54359. mcid = null,
  54360. pageObjId = null,
  54361. refObjId = null
  54362. } = _ref;
  54363. this.type = type;
  54364. this.dict = dict;
  54365. this.mcid = mcid;
  54366. this.pageObjId = pageObjId;
  54367. this.refObjId = refObjId;
  54368. this.parentNode = null;
  54369. }
  54370. }
  54371. class StructTreePage {
  54372. constructor(structTreeRoot, pageDict) {
  54373. this.root = structTreeRoot;
  54374. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  54375. this.pageDict = pageDict;
  54376. this.nodes = [];
  54377. }
  54378. parse() {
  54379. if (!this.root || !this.rootDict) {
  54380. return;
  54381. }
  54382. const parentTree = this.rootDict.get("ParentTree");
  54383. if (!parentTree) {
  54384. return;
  54385. }
  54386. const id = this.pageDict.get("StructParents");
  54387. if (!Number.isInteger(id)) {
  54388. return;
  54389. }
  54390. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  54391. const parentArray = numberTree.get(id);
  54392. if (!Array.isArray(parentArray)) {
  54393. return;
  54394. }
  54395. const map = new Map();
  54396. for (const ref of parentArray) {
  54397. if (ref instanceof _primitives.Ref) {
  54398. this.addNode(this.rootDict.xref.fetch(ref), map);
  54399. }
  54400. }
  54401. }
  54402. addNode(dict, map) {
  54403. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54404. if (level > MAX_DEPTH) {
  54405. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  54406. return null;
  54407. }
  54408. if (map.has(dict)) {
  54409. return map.get(dict);
  54410. }
  54411. const element = new StructElementNode(this, dict);
  54412. map.set(dict, element);
  54413. const parent = dict.get("P");
  54414. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  54415. if (!this.addTopLevelNode(dict, element)) {
  54416. map.delete(dict);
  54417. }
  54418. return element;
  54419. }
  54420. const parentNode = this.addNode(parent, map, level + 1);
  54421. if (!parentNode) {
  54422. return element;
  54423. }
  54424. let save = false;
  54425. for (const kid of parentNode.kids) {
  54426. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  54427. kid.parentNode = element;
  54428. save = true;
  54429. }
  54430. }
  54431. if (!save) {
  54432. map.delete(dict);
  54433. }
  54434. return element;
  54435. }
  54436. addTopLevelNode(dict, element) {
  54437. const obj = this.rootDict.get("K");
  54438. if (!obj) {
  54439. return false;
  54440. }
  54441. if (obj instanceof _primitives.Dict) {
  54442. if (obj.objId !== dict.objId) {
  54443. return false;
  54444. }
  54445. this.nodes[0] = element;
  54446. return true;
  54447. }
  54448. if (!Array.isArray(obj)) {
  54449. return true;
  54450. }
  54451. let save = false;
  54452. for (let i = 0; i < obj.length; i++) {
  54453. const kidRef = obj[i];
  54454. if (kidRef && kidRef.toString() === dict.objId) {
  54455. this.nodes[i] = element;
  54456. save = true;
  54457. }
  54458. }
  54459. return save;
  54460. }
  54461. get serializable() {
  54462. function nodeToSerializable(node, parent) {
  54463. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  54464. if (level > MAX_DEPTH) {
  54465. (0, _util.warn)("StructTree too deep to be fully serialized.");
  54466. return;
  54467. }
  54468. const obj = Object.create(null);
  54469. obj.role = node.role;
  54470. obj.children = [];
  54471. parent.children.push(obj);
  54472. const alt = node.dict.get("Alt");
  54473. if (typeof alt === "string") {
  54474. obj.alt = (0, _util.stringToPDFString)(alt);
  54475. }
  54476. const lang = node.dict.get("Lang");
  54477. if (typeof lang === "string") {
  54478. obj.lang = (0, _util.stringToPDFString)(lang);
  54479. }
  54480. for (const kid of node.kids) {
  54481. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  54482. if (kidElement) {
  54483. nodeToSerializable(kidElement, obj, level + 1);
  54484. continue;
  54485. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  54486. obj.children.push({
  54487. type: "content",
  54488. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  54489. });
  54490. } else if (kid.type === StructElementType.OBJECT) {
  54491. obj.children.push({
  54492. type: "object",
  54493. id: kid.refObjId
  54494. });
  54495. }
  54496. }
  54497. }
  54498. const root = Object.create(null);
  54499. root.children = [];
  54500. root.role = "Root";
  54501. for (const child of this.nodes) {
  54502. if (!child) {
  54503. continue;
  54504. }
  54505. nodeToSerializable(child, root);
  54506. }
  54507. return root;
  54508. }
  54509. }
  54510. exports.StructTreePage = StructTreePage;
  54511. /***/ }),
  54512. /* 204 */
  54513. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54514. "use strict";
  54515. Object.defineProperty(exports, "__esModule", ({
  54516. value: true
  54517. }));
  54518. exports.ObjectLoader = void 0;
  54519. var _primitives = __w_pdfjs_require__(134);
  54520. var _base_stream = __w_pdfjs_require__(136);
  54521. var _core_utils = __w_pdfjs_require__(135);
  54522. var _util = __w_pdfjs_require__(2);
  54523. function mayHaveChildren(value) {
  54524. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  54525. }
  54526. function addChildren(node, nodesToVisit) {
  54527. if (node instanceof _primitives.Dict) {
  54528. node = node.getRawValues();
  54529. } else if (node instanceof _base_stream.BaseStream) {
  54530. node = node.dict.getRawValues();
  54531. } else if (!Array.isArray(node)) {
  54532. return;
  54533. }
  54534. for (const rawValue of node) {
  54535. if (mayHaveChildren(rawValue)) {
  54536. nodesToVisit.push(rawValue);
  54537. }
  54538. }
  54539. }
  54540. class ObjectLoader {
  54541. constructor(dict, keys, xref) {
  54542. this.dict = dict;
  54543. this.keys = keys;
  54544. this.xref = xref;
  54545. this.refSet = null;
  54546. }
  54547. async load() {
  54548. if (this.xref.stream.isDataLoaded) {
  54549. return undefined;
  54550. }
  54551. const {
  54552. keys,
  54553. dict
  54554. } = this;
  54555. this.refSet = new _primitives.RefSet();
  54556. const nodesToVisit = [];
  54557. for (const key of keys) {
  54558. const rawValue = dict.getRaw(key);
  54559. if (rawValue !== undefined) {
  54560. nodesToVisit.push(rawValue);
  54561. }
  54562. }
  54563. return this._walk(nodesToVisit);
  54564. }
  54565. async _walk(nodesToVisit) {
  54566. const nodesToRevisit = [];
  54567. const pendingRequests = [];
  54568. while (nodesToVisit.length) {
  54569. let currentNode = nodesToVisit.pop();
  54570. if (currentNode instanceof _primitives.Ref) {
  54571. if (this.refSet.has(currentNode)) {
  54572. continue;
  54573. }
  54574. try {
  54575. this.refSet.put(currentNode);
  54576. currentNode = this.xref.fetch(currentNode);
  54577. } catch (ex) {
  54578. if (!(ex instanceof _core_utils.MissingDataException)) {
  54579. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  54580. this.refSet = null;
  54581. const {
  54582. manager
  54583. } = this.xref.stream;
  54584. return manager.requestAllChunks();
  54585. }
  54586. nodesToRevisit.push(currentNode);
  54587. pendingRequests.push({
  54588. begin: ex.begin,
  54589. end: ex.end
  54590. });
  54591. }
  54592. }
  54593. if (currentNode instanceof _base_stream.BaseStream) {
  54594. const baseStreams = currentNode.getBaseStreams();
  54595. if (baseStreams) {
  54596. let foundMissingData = false;
  54597. for (const stream of baseStreams) {
  54598. if (stream.isDataLoaded) {
  54599. continue;
  54600. }
  54601. foundMissingData = true;
  54602. pendingRequests.push({
  54603. begin: stream.start,
  54604. end: stream.end
  54605. });
  54606. }
  54607. if (foundMissingData) {
  54608. nodesToRevisit.push(currentNode);
  54609. }
  54610. }
  54611. }
  54612. addChildren(currentNode, nodesToVisit);
  54613. }
  54614. if (pendingRequests.length) {
  54615. await this.xref.stream.manager.requestRanges(pendingRequests);
  54616. for (const node of nodesToRevisit) {
  54617. if (node instanceof _primitives.Ref) {
  54618. this.refSet.remove(node);
  54619. }
  54620. }
  54621. return this._walk(nodesToRevisit);
  54622. }
  54623. this.refSet = null;
  54624. return undefined;
  54625. }
  54626. }
  54627. exports.ObjectLoader = ObjectLoader;
  54628. /***/ }),
  54629. /* 205 */
  54630. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54631. "use strict";
  54632. Object.defineProperty(exports, "__esModule", ({
  54633. value: true
  54634. }));
  54635. exports.XFAFactory = void 0;
  54636. var _xfa_object = __w_pdfjs_require__(206);
  54637. var _bind = __w_pdfjs_require__(210);
  54638. var _data = __w_pdfjs_require__(216);
  54639. var _fonts = __w_pdfjs_require__(214);
  54640. var _utils = __w_pdfjs_require__(207);
  54641. var _util = __w_pdfjs_require__(2);
  54642. var _parser = __w_pdfjs_require__(217);
  54643. var _xhtml = __w_pdfjs_require__(227);
  54644. class XFAFactory {
  54645. constructor(data) {
  54646. try {
  54647. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  54648. const binder = new _bind.Binder(this.root);
  54649. this.form = binder.bind();
  54650. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  54651. this.form[_xfa_object.$globalData].template = this.form;
  54652. } catch (e) {
  54653. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  54654. }
  54655. }
  54656. isValid() {
  54657. return this.root && this.form;
  54658. }
  54659. _createPagesHelper() {
  54660. const iterator = this.form[_xfa_object.$toPages]();
  54661. return new Promise((resolve, reject) => {
  54662. const nextIteration = () => {
  54663. try {
  54664. const value = iterator.next();
  54665. if (value.done) {
  54666. resolve(value.value);
  54667. } else {
  54668. setTimeout(nextIteration, 0);
  54669. }
  54670. } catch (e) {
  54671. reject(e);
  54672. }
  54673. };
  54674. setTimeout(nextIteration, 0);
  54675. });
  54676. }
  54677. async _createPages() {
  54678. try {
  54679. this.pages = await this._createPagesHelper();
  54680. this.dims = this.pages.children.map(c => {
  54681. const {
  54682. width,
  54683. height
  54684. } = c.attributes.style;
  54685. return [0, 0, parseInt(width), parseInt(height)];
  54686. });
  54687. } catch (e) {
  54688. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  54689. }
  54690. }
  54691. getBoundingBox(pageIndex) {
  54692. return this.dims[pageIndex];
  54693. }
  54694. async getNumPages() {
  54695. if (!this.pages) {
  54696. await this._createPages();
  54697. }
  54698. return this.dims.length;
  54699. }
  54700. setImages(images) {
  54701. this.form[_xfa_object.$globalData].images = images;
  54702. }
  54703. setFonts(fonts) {
  54704. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  54705. const missingFonts = [];
  54706. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  54707. typeface = (0, _utils.stripQuotes)(typeface);
  54708. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  54709. if (!font) {
  54710. missingFonts.push(typeface);
  54711. }
  54712. }
  54713. if (missingFonts.length > 0) {
  54714. return missingFonts;
  54715. }
  54716. return null;
  54717. }
  54718. appendFonts(fonts, reallyMissingFonts) {
  54719. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  54720. }
  54721. async getPages() {
  54722. if (!this.pages) {
  54723. await this._createPages();
  54724. }
  54725. const pages = this.pages;
  54726. this.pages = null;
  54727. return pages;
  54728. }
  54729. serializeData(storage) {
  54730. return this.dataHandler.serialize(storage);
  54731. }
  54732. static _createDocument(data) {
  54733. if (!data["/xdp:xdp"]) {
  54734. return data["xdp:xdp"];
  54735. }
  54736. return Object.values(data).join("");
  54737. }
  54738. static getRichTextAsHtml(rc) {
  54739. if (!rc || typeof rc !== "string") {
  54740. return null;
  54741. }
  54742. try {
  54743. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  54744. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  54745. const newRoot = _xhtml.XhtmlNamespace.body({});
  54746. newRoot[_xfa_object.$appendChild](root);
  54747. root = newRoot;
  54748. }
  54749. const result = root[_xfa_object.$toHTML]();
  54750. if (!result.success) {
  54751. return null;
  54752. }
  54753. const {
  54754. html
  54755. } = result;
  54756. const {
  54757. attributes
  54758. } = html;
  54759. if (attributes) {
  54760. if (attributes.class) {
  54761. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  54762. }
  54763. attributes.dir = "auto";
  54764. }
  54765. return {
  54766. html,
  54767. str: root[_xfa_object.$text]()
  54768. };
  54769. } catch (e) {
  54770. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  54771. }
  54772. return null;
  54773. }
  54774. }
  54775. exports.XFAFactory = XFAFactory;
  54776. /***/ }),
  54777. /* 206 */
  54778. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54779. "use strict";
  54780. Object.defineProperty(exports, "__esModule", ({
  54781. value: true
  54782. }));
  54783. 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;
  54784. var _utils = __w_pdfjs_require__(207);
  54785. var _util = __w_pdfjs_require__(2);
  54786. var _core_utils = __w_pdfjs_require__(135);
  54787. var _namespaces = __w_pdfjs_require__(208);
  54788. var _som = __w_pdfjs_require__(209);
  54789. const $acceptWhitespace = Symbol();
  54790. exports.$acceptWhitespace = $acceptWhitespace;
  54791. const $addHTML = Symbol();
  54792. exports.$addHTML = $addHTML;
  54793. const $appendChild = Symbol();
  54794. exports.$appendChild = $appendChild;
  54795. const $childrenToHTML = Symbol();
  54796. exports.$childrenToHTML = $childrenToHTML;
  54797. const $clean = Symbol();
  54798. exports.$clean = $clean;
  54799. const $cleanPage = Symbol();
  54800. exports.$cleanPage = $cleanPage;
  54801. const $cleanup = Symbol();
  54802. exports.$cleanup = $cleanup;
  54803. const $clone = Symbol();
  54804. exports.$clone = $clone;
  54805. const $consumed = Symbol();
  54806. exports.$consumed = $consumed;
  54807. const $content = Symbol("content");
  54808. exports.$content = $content;
  54809. const $data = Symbol("data");
  54810. exports.$data = $data;
  54811. const $dump = Symbol();
  54812. exports.$dump = $dump;
  54813. const $extra = Symbol("extra");
  54814. exports.$extra = $extra;
  54815. const $finalize = Symbol();
  54816. exports.$finalize = $finalize;
  54817. const $flushHTML = Symbol();
  54818. exports.$flushHTML = $flushHTML;
  54819. const $getAttributeIt = Symbol();
  54820. exports.$getAttributeIt = $getAttributeIt;
  54821. const $getAttributes = Symbol();
  54822. exports.$getAttributes = $getAttributes;
  54823. const $getAvailableSpace = Symbol();
  54824. exports.$getAvailableSpace = $getAvailableSpace;
  54825. const $getChildrenByClass = Symbol();
  54826. exports.$getChildrenByClass = $getChildrenByClass;
  54827. const $getChildrenByName = Symbol();
  54828. exports.$getChildrenByName = $getChildrenByName;
  54829. const $getChildrenByNameIt = Symbol();
  54830. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  54831. const $getDataValue = Symbol();
  54832. exports.$getDataValue = $getDataValue;
  54833. const $getExtra = Symbol();
  54834. exports.$getExtra = $getExtra;
  54835. const $getRealChildrenByNameIt = Symbol();
  54836. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  54837. const $getChildren = Symbol();
  54838. exports.$getChildren = $getChildren;
  54839. const $getContainedChildren = Symbol();
  54840. exports.$getContainedChildren = $getContainedChildren;
  54841. const $getNextPage = Symbol();
  54842. exports.$getNextPage = $getNextPage;
  54843. const $getSubformParent = Symbol();
  54844. exports.$getSubformParent = $getSubformParent;
  54845. const $getParent = Symbol();
  54846. exports.$getParent = $getParent;
  54847. const $getTemplateRoot = Symbol();
  54848. exports.$getTemplateRoot = $getTemplateRoot;
  54849. const $globalData = Symbol();
  54850. exports.$globalData = $globalData;
  54851. const $hasSettableValue = Symbol();
  54852. exports.$hasSettableValue = $hasSettableValue;
  54853. const $ids = Symbol();
  54854. exports.$ids = $ids;
  54855. const $indexOf = Symbol();
  54856. exports.$indexOf = $indexOf;
  54857. const $insertAt = Symbol();
  54858. exports.$insertAt = $insertAt;
  54859. const $isCDATAXml = Symbol();
  54860. exports.$isCDATAXml = $isCDATAXml;
  54861. const $isBindable = Symbol();
  54862. exports.$isBindable = $isBindable;
  54863. const $isDataValue = Symbol();
  54864. exports.$isDataValue = $isDataValue;
  54865. const $isDescendent = Symbol();
  54866. exports.$isDescendent = $isDescendent;
  54867. const $isNsAgnostic = Symbol();
  54868. exports.$isNsAgnostic = $isNsAgnostic;
  54869. const $isSplittable = Symbol();
  54870. exports.$isSplittable = $isSplittable;
  54871. const $isThereMoreWidth = Symbol();
  54872. exports.$isThereMoreWidth = $isThereMoreWidth;
  54873. const $isTransparent = Symbol();
  54874. exports.$isTransparent = $isTransparent;
  54875. const $isUsable = Symbol();
  54876. exports.$isUsable = $isUsable;
  54877. const $lastAttribute = Symbol();
  54878. const $namespaceId = Symbol("namespaceId");
  54879. exports.$namespaceId = $namespaceId;
  54880. const $nodeName = Symbol("nodeName");
  54881. exports.$nodeName = $nodeName;
  54882. const $nsAttributes = Symbol();
  54883. exports.$nsAttributes = $nsAttributes;
  54884. const $onChild = Symbol();
  54885. exports.$onChild = $onChild;
  54886. const $onChildCheck = Symbol();
  54887. exports.$onChildCheck = $onChildCheck;
  54888. const $onText = Symbol();
  54889. exports.$onText = $onText;
  54890. const $pushGlyphs = Symbol();
  54891. exports.$pushGlyphs = $pushGlyphs;
  54892. const $popPara = Symbol();
  54893. exports.$popPara = $popPara;
  54894. const $pushPara = Symbol();
  54895. exports.$pushPara = $pushPara;
  54896. const $removeChild = Symbol();
  54897. exports.$removeChild = $removeChild;
  54898. const $root = Symbol("root");
  54899. exports.$root = $root;
  54900. const $resolvePrototypes = Symbol();
  54901. exports.$resolvePrototypes = $resolvePrototypes;
  54902. const $searchNode = Symbol();
  54903. exports.$searchNode = $searchNode;
  54904. const $setId = Symbol();
  54905. exports.$setId = $setId;
  54906. const $setSetAttributes = Symbol();
  54907. exports.$setSetAttributes = $setSetAttributes;
  54908. const $setValue = Symbol();
  54909. exports.$setValue = $setValue;
  54910. const $tabIndex = Symbol();
  54911. exports.$tabIndex = $tabIndex;
  54912. const $text = Symbol();
  54913. exports.$text = $text;
  54914. const $toPages = Symbol();
  54915. exports.$toPages = $toPages;
  54916. const $toHTML = Symbol();
  54917. exports.$toHTML = $toHTML;
  54918. const $toString = Symbol();
  54919. exports.$toString = $toString;
  54920. const $toStyle = Symbol();
  54921. exports.$toStyle = $toStyle;
  54922. const $uid = Symbol("uid");
  54923. exports.$uid = $uid;
  54924. const _applyPrototype = Symbol();
  54925. const _attributes = Symbol();
  54926. const _attributeNames = Symbol();
  54927. const _children = Symbol("_children");
  54928. const _cloneAttribute = Symbol();
  54929. const _dataValue = Symbol();
  54930. const _defaultValue = Symbol();
  54931. const _filteredChildrenGenerator = Symbol();
  54932. const _getPrototype = Symbol();
  54933. const _getUnsetAttributes = Symbol();
  54934. const _hasChildren = Symbol();
  54935. const _max = Symbol();
  54936. const _options = Symbol();
  54937. const _parent = Symbol("parent");
  54938. const _resolvePrototypesHelper = Symbol();
  54939. const _setAttributes = Symbol();
  54940. const _validator = Symbol();
  54941. let uid = 0;
  54942. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  54943. class XFAObject {
  54944. constructor(nsId, name) {
  54945. let hasChildren = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  54946. this[$namespaceId] = nsId;
  54947. this[$nodeName] = name;
  54948. this[_hasChildren] = hasChildren;
  54949. this[_parent] = null;
  54950. this[_children] = [];
  54951. this[$uid] = `${name}${uid++}`;
  54952. this[$globalData] = null;
  54953. }
  54954. [$onChild](child) {
  54955. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  54956. return false;
  54957. }
  54958. const name = child[$nodeName];
  54959. const node = this[name];
  54960. if (node instanceof XFAObjectArray) {
  54961. if (node.push(child)) {
  54962. this[$appendChild](child);
  54963. return true;
  54964. }
  54965. } else {
  54966. if (node !== null) {
  54967. this[$removeChild](node);
  54968. }
  54969. this[name] = child;
  54970. this[$appendChild](child);
  54971. return true;
  54972. }
  54973. let id = "";
  54974. if (this.id) {
  54975. id = ` (id: ${this.id})`;
  54976. } else if (this.name) {
  54977. id = ` (name: ${this.name} ${this.h.value})`;
  54978. }
  54979. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  54980. return false;
  54981. }
  54982. [$onChildCheck](child) {
  54983. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  54984. }
  54985. [$isNsAgnostic]() {
  54986. return false;
  54987. }
  54988. [$acceptWhitespace]() {
  54989. return false;
  54990. }
  54991. [$isCDATAXml]() {
  54992. return false;
  54993. }
  54994. [$isBindable]() {
  54995. return false;
  54996. }
  54997. [$popPara]() {
  54998. if (this.para) {
  54999. this[$getTemplateRoot]()[$extra].paraStack.pop();
  55000. }
  55001. }
  55002. [$pushPara]() {
  55003. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  55004. }
  55005. [$setId](ids) {
  55006. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  55007. ids.set(this.id, this);
  55008. }
  55009. }
  55010. [$getTemplateRoot]() {
  55011. return this[$globalData].template;
  55012. }
  55013. [$isSplittable]() {
  55014. return false;
  55015. }
  55016. [$isThereMoreWidth]() {
  55017. return false;
  55018. }
  55019. [$appendChild](child) {
  55020. child[_parent] = this;
  55021. this[_children].push(child);
  55022. if (!child[$globalData] && this[$globalData]) {
  55023. child[$globalData] = this[$globalData];
  55024. }
  55025. }
  55026. [$removeChild](child) {
  55027. const i = this[_children].indexOf(child);
  55028. this[_children].splice(i, 1);
  55029. }
  55030. [$hasSettableValue]() {
  55031. return this.hasOwnProperty("value");
  55032. }
  55033. [$setValue](_) {}
  55034. [$onText](_) {}
  55035. [$finalize]() {}
  55036. [$clean](builder) {
  55037. delete this[_hasChildren];
  55038. if (this[$cleanup]) {
  55039. builder.clean(this[$cleanup]);
  55040. delete this[$cleanup];
  55041. }
  55042. }
  55043. [$indexOf](child) {
  55044. return this[_children].indexOf(child);
  55045. }
  55046. [$insertAt](i, child) {
  55047. child[_parent] = this;
  55048. this[_children].splice(i, 0, child);
  55049. if (!child[$globalData] && this[$globalData]) {
  55050. child[$globalData] = this[$globalData];
  55051. }
  55052. }
  55053. [$isTransparent]() {
  55054. return !this.name;
  55055. }
  55056. [$lastAttribute]() {
  55057. return "";
  55058. }
  55059. [$text]() {
  55060. if (this[_children].length === 0) {
  55061. return this[$content];
  55062. }
  55063. return this[_children].map(c => c[$text]()).join("");
  55064. }
  55065. get [_attributeNames]() {
  55066. const proto = Object.getPrototypeOf(this);
  55067. if (!proto._attributes) {
  55068. const attributes = proto._attributes = new Set();
  55069. for (const name of Object.getOwnPropertyNames(this)) {
  55070. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  55071. break;
  55072. }
  55073. attributes.add(name);
  55074. }
  55075. }
  55076. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  55077. }
  55078. [$isDescendent](parent) {
  55079. let node = this;
  55080. while (node) {
  55081. if (node === parent) {
  55082. return true;
  55083. }
  55084. node = node[$getParent]();
  55085. }
  55086. return false;
  55087. }
  55088. [$getParent]() {
  55089. return this[_parent];
  55090. }
  55091. [$getSubformParent]() {
  55092. return this[$getParent]();
  55093. }
  55094. [$getChildren]() {
  55095. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55096. if (!name) {
  55097. return this[_children];
  55098. }
  55099. return this[name];
  55100. }
  55101. [$dump]() {
  55102. const dumped = Object.create(null);
  55103. if (this[$content]) {
  55104. dumped.$content = this[$content];
  55105. }
  55106. for (const name of Object.getOwnPropertyNames(this)) {
  55107. const value = this[name];
  55108. if (value === null) {
  55109. continue;
  55110. }
  55111. if (value instanceof XFAObject) {
  55112. dumped[name] = value[$dump]();
  55113. } else if (value instanceof XFAObjectArray) {
  55114. if (!value.isEmpty()) {
  55115. dumped[name] = value.dump();
  55116. }
  55117. } else {
  55118. dumped[name] = value;
  55119. }
  55120. }
  55121. return dumped;
  55122. }
  55123. [$toStyle]() {
  55124. return null;
  55125. }
  55126. [$toHTML]() {
  55127. return _utils.HTMLResult.EMPTY;
  55128. }
  55129. *[$getContainedChildren]() {
  55130. for (const node of this[$getChildren]()) {
  55131. yield node;
  55132. }
  55133. }
  55134. *[_filteredChildrenGenerator](filter, include) {
  55135. for (const node of this[$getContainedChildren]()) {
  55136. if (!filter || include === filter.has(node[$nodeName])) {
  55137. const availableSpace = this[$getAvailableSpace]();
  55138. const res = node[$toHTML](availableSpace);
  55139. if (!res.success) {
  55140. this[$extra].failingNode = node;
  55141. }
  55142. yield res;
  55143. }
  55144. }
  55145. }
  55146. [$flushHTML]() {
  55147. return null;
  55148. }
  55149. [$addHTML](html, bbox) {
  55150. this[$extra].children.push(html);
  55151. }
  55152. [$getAvailableSpace]() {}
  55153. [$childrenToHTML](_ref) {
  55154. let {
  55155. filter = null,
  55156. include = true
  55157. } = _ref;
  55158. if (!this[$extra].generator) {
  55159. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  55160. } else {
  55161. const availableSpace = this[$getAvailableSpace]();
  55162. const res = this[$extra].failingNode[$toHTML](availableSpace);
  55163. if (!res.success) {
  55164. return res;
  55165. }
  55166. if (res.html) {
  55167. this[$addHTML](res.html, res.bbox);
  55168. }
  55169. delete this[$extra].failingNode;
  55170. }
  55171. while (true) {
  55172. const gen = this[$extra].generator.next();
  55173. if (gen.done) {
  55174. break;
  55175. }
  55176. const res = gen.value;
  55177. if (!res.success) {
  55178. return res;
  55179. }
  55180. if (res.html) {
  55181. this[$addHTML](res.html, res.bbox);
  55182. }
  55183. }
  55184. this[$extra].generator = null;
  55185. return _utils.HTMLResult.EMPTY;
  55186. }
  55187. [$setSetAttributes](attributes) {
  55188. this[_setAttributes] = new Set(Object.keys(attributes));
  55189. }
  55190. [_getUnsetAttributes](protoAttributes) {
  55191. const allAttr = this[_attributeNames];
  55192. const setAttr = this[_setAttributes];
  55193. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  55194. }
  55195. [$resolvePrototypes](ids) {
  55196. let ancestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
  55197. for (const child of this[_children]) {
  55198. child[_resolvePrototypesHelper](ids, ancestors);
  55199. }
  55200. }
  55201. [_resolvePrototypesHelper](ids, ancestors) {
  55202. const proto = this[_getPrototype](ids, ancestors);
  55203. if (proto) {
  55204. this[_applyPrototype](proto, ids, ancestors);
  55205. } else {
  55206. this[$resolvePrototypes](ids, ancestors);
  55207. }
  55208. }
  55209. [_getPrototype](ids, ancestors) {
  55210. const {
  55211. use,
  55212. usehref
  55213. } = this;
  55214. if (!use && !usehref) {
  55215. return null;
  55216. }
  55217. let proto = null;
  55218. let somExpression = null;
  55219. let id = null;
  55220. let ref = use;
  55221. if (usehref) {
  55222. ref = usehref;
  55223. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  55224. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  55225. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  55226. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  55227. } else if (usehref.startsWith("#")) {
  55228. id = usehref.slice(1);
  55229. } else if (usehref.startsWith(".#")) {
  55230. id = usehref.slice(2);
  55231. }
  55232. } else if (use.startsWith("#")) {
  55233. id = use.slice(1);
  55234. } else {
  55235. somExpression = use;
  55236. }
  55237. this.use = this.usehref = "";
  55238. if (id) {
  55239. proto = ids.get(id);
  55240. } else {
  55241. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  55242. if (proto) {
  55243. proto = proto[0];
  55244. }
  55245. }
  55246. if (!proto) {
  55247. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  55248. return null;
  55249. }
  55250. if (proto[$nodeName] !== this[$nodeName]) {
  55251. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  55252. return null;
  55253. }
  55254. if (ancestors.has(proto)) {
  55255. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55256. return null;
  55257. }
  55258. ancestors.add(proto);
  55259. const protoProto = proto[_getPrototype](ids, ancestors);
  55260. if (protoProto) {
  55261. proto[_applyPrototype](protoProto, ids, ancestors);
  55262. }
  55263. proto[$resolvePrototypes](ids, ancestors);
  55264. ancestors.delete(proto);
  55265. return proto;
  55266. }
  55267. [_applyPrototype](proto, ids, ancestors) {
  55268. if (ancestors.has(proto)) {
  55269. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  55270. return;
  55271. }
  55272. if (!this[$content] && proto[$content]) {
  55273. this[$content] = proto[$content];
  55274. }
  55275. const newAncestors = new Set(ancestors);
  55276. newAncestors.add(proto);
  55277. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  55278. this[unsetAttrName] = proto[unsetAttrName];
  55279. if (this[_setAttributes]) {
  55280. this[_setAttributes].add(unsetAttrName);
  55281. }
  55282. }
  55283. for (const name of Object.getOwnPropertyNames(this)) {
  55284. if (this[_attributeNames].has(name)) {
  55285. continue;
  55286. }
  55287. const value = this[name];
  55288. const protoValue = proto[name];
  55289. if (value instanceof XFAObjectArray) {
  55290. for (const child of value[_children]) {
  55291. child[_resolvePrototypesHelper](ids, ancestors);
  55292. }
  55293. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  55294. const child = proto[_children][i][$clone]();
  55295. if (value.push(child)) {
  55296. child[_parent] = this;
  55297. this[_children].push(child);
  55298. child[_resolvePrototypesHelper](ids, ancestors);
  55299. } else {
  55300. break;
  55301. }
  55302. }
  55303. continue;
  55304. }
  55305. if (value !== null) {
  55306. value[$resolvePrototypes](ids, ancestors);
  55307. if (protoValue) {
  55308. value[_applyPrototype](protoValue, ids, ancestors);
  55309. }
  55310. continue;
  55311. }
  55312. if (protoValue !== null) {
  55313. const child = protoValue[$clone]();
  55314. child[_parent] = this;
  55315. this[name] = child;
  55316. this[_children].push(child);
  55317. child[_resolvePrototypesHelper](ids, ancestors);
  55318. }
  55319. }
  55320. }
  55321. static [_cloneAttribute](obj) {
  55322. if (Array.isArray(obj)) {
  55323. return obj.map(x => XFAObject[_cloneAttribute](x));
  55324. }
  55325. if (typeof obj === "object" && obj !== null) {
  55326. return Object.assign({}, obj);
  55327. }
  55328. return obj;
  55329. }
  55330. [$clone]() {
  55331. const clone = Object.create(Object.getPrototypeOf(this));
  55332. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  55333. try {
  55334. clone[$symbol] = this[$symbol];
  55335. } catch (_) {
  55336. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  55337. }
  55338. }
  55339. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  55340. clone[_children] = [];
  55341. for (const name of Object.getOwnPropertyNames(this)) {
  55342. if (this[_attributeNames].has(name)) {
  55343. clone[name] = XFAObject[_cloneAttribute](this[name]);
  55344. continue;
  55345. }
  55346. const value = this[name];
  55347. if (value instanceof XFAObjectArray) {
  55348. clone[name] = new XFAObjectArray(value[_max]);
  55349. } else {
  55350. clone[name] = null;
  55351. }
  55352. }
  55353. for (const child of this[_children]) {
  55354. const name = child[$nodeName];
  55355. const clonedChild = child[$clone]();
  55356. clone[_children].push(clonedChild);
  55357. clonedChild[_parent] = clone;
  55358. if (clone[name] === null) {
  55359. clone[name] = clonedChild;
  55360. } else {
  55361. clone[name][_children].push(clonedChild);
  55362. }
  55363. }
  55364. return clone;
  55365. }
  55366. [$getChildren]() {
  55367. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55368. if (!name) {
  55369. return this[_children];
  55370. }
  55371. return this[_children].filter(c => c[$nodeName] === name);
  55372. }
  55373. [$getChildrenByClass](name) {
  55374. return this[name];
  55375. }
  55376. [$getChildrenByName](name, allTransparent) {
  55377. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55378. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  55379. }
  55380. *[$getChildrenByNameIt](name, allTransparent) {
  55381. let first = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  55382. if (name === "parent") {
  55383. yield this[_parent];
  55384. return;
  55385. }
  55386. for (const child of this[_children]) {
  55387. if (child[$nodeName] === name) {
  55388. yield child;
  55389. }
  55390. if (child.name === name) {
  55391. yield child;
  55392. }
  55393. if (allTransparent || child[$isTransparent]()) {
  55394. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  55395. }
  55396. }
  55397. if (first && this[_attributeNames].has(name)) {
  55398. yield new XFAAttribute(this, name, this[name]);
  55399. }
  55400. }
  55401. }
  55402. exports.XFAObject = XFAObject;
  55403. class XFAObjectArray {
  55404. constructor() {
  55405. let max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;
  55406. this[_max] = max;
  55407. this[_children] = [];
  55408. }
  55409. push(child) {
  55410. const len = this[_children].length;
  55411. if (len <= this[_max]) {
  55412. this[_children].push(child);
  55413. return true;
  55414. }
  55415. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  55416. return false;
  55417. }
  55418. isEmpty() {
  55419. return this[_children].length === 0;
  55420. }
  55421. dump() {
  55422. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  55423. }
  55424. [$clone]() {
  55425. const clone = new XFAObjectArray(this[_max]);
  55426. clone[_children] = this[_children].map(c => c[$clone]());
  55427. return clone;
  55428. }
  55429. get children() {
  55430. return this[_children];
  55431. }
  55432. clear() {
  55433. this[_children].length = 0;
  55434. }
  55435. }
  55436. exports.XFAObjectArray = XFAObjectArray;
  55437. class XFAAttribute {
  55438. constructor(node, name, value) {
  55439. this[_parent] = node;
  55440. this[$nodeName] = name;
  55441. this[$content] = value;
  55442. this[$consumed] = false;
  55443. this[$uid] = `attribute${uid++}`;
  55444. }
  55445. [$getParent]() {
  55446. return this[_parent];
  55447. }
  55448. [$isDataValue]() {
  55449. return true;
  55450. }
  55451. [$getDataValue]() {
  55452. return this[$content].trim();
  55453. }
  55454. [$setValue](value) {
  55455. value = value.value || "";
  55456. this[$content] = value.toString();
  55457. }
  55458. [$text]() {
  55459. return this[$content];
  55460. }
  55461. [$isDescendent](parent) {
  55462. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  55463. }
  55464. }
  55465. exports.XFAAttribute = XFAAttribute;
  55466. class XmlObject extends XFAObject {
  55467. constructor(nsId, name) {
  55468. let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  55469. super(nsId, name);
  55470. this[$content] = "";
  55471. this[_dataValue] = null;
  55472. if (name !== "#text") {
  55473. const map = new Map();
  55474. this[_attributes] = map;
  55475. for (const [attrName, value] of Object.entries(attributes)) {
  55476. map.set(attrName, new XFAAttribute(this, attrName, value));
  55477. }
  55478. if (attributes.hasOwnProperty($nsAttributes)) {
  55479. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  55480. if (dataNode !== undefined) {
  55481. if (dataNode === "dataGroup") {
  55482. this[_dataValue] = false;
  55483. } else if (dataNode === "dataValue") {
  55484. this[_dataValue] = true;
  55485. }
  55486. }
  55487. }
  55488. }
  55489. this[$consumed] = false;
  55490. }
  55491. [$toString](buf) {
  55492. const tagName = this[$nodeName];
  55493. if (tagName === "#text") {
  55494. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55495. return;
  55496. }
  55497. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  55498. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  55499. buf.push(`<${prefix}${utf8TagName}`);
  55500. for (const [name, value] of this[_attributes].entries()) {
  55501. const utf8Name = (0, _util.utf8StringToString)(name);
  55502. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  55503. }
  55504. if (this[_dataValue] !== null) {
  55505. if (this[_dataValue]) {
  55506. buf.push(` xfa:dataNode="dataValue"`);
  55507. } else {
  55508. buf.push(` xfa:dataNode="dataGroup"`);
  55509. }
  55510. }
  55511. if (!this[$content] && this[_children].length === 0) {
  55512. buf.push("/>");
  55513. return;
  55514. }
  55515. buf.push(">");
  55516. if (this[$content]) {
  55517. if (typeof this[$content] === "string") {
  55518. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  55519. } else {
  55520. this[$content][$toString](buf);
  55521. }
  55522. } else {
  55523. for (const child of this[_children]) {
  55524. child[$toString](buf);
  55525. }
  55526. }
  55527. buf.push(`</${prefix}${utf8TagName}>`);
  55528. }
  55529. [$onChild](child) {
  55530. if (this[$content]) {
  55531. const node = new XmlObject(this[$namespaceId], "#text");
  55532. this[$appendChild](node);
  55533. node[$content] = this[$content];
  55534. this[$content] = "";
  55535. }
  55536. this[$appendChild](child);
  55537. return true;
  55538. }
  55539. [$onText](str) {
  55540. this[$content] += str;
  55541. }
  55542. [$finalize]() {
  55543. if (this[$content] && this[_children].length > 0) {
  55544. const node = new XmlObject(this[$namespaceId], "#text");
  55545. this[$appendChild](node);
  55546. node[$content] = this[$content];
  55547. delete this[$content];
  55548. }
  55549. }
  55550. [$toHTML]() {
  55551. if (this[$nodeName] === "#text") {
  55552. return _utils.HTMLResult.success({
  55553. name: "#text",
  55554. value: this[$content]
  55555. });
  55556. }
  55557. return _utils.HTMLResult.EMPTY;
  55558. }
  55559. [$getChildren]() {
  55560. let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  55561. if (!name) {
  55562. return this[_children];
  55563. }
  55564. return this[_children].filter(c => c[$nodeName] === name);
  55565. }
  55566. [$getAttributes]() {
  55567. return this[_attributes];
  55568. }
  55569. [$getChildrenByClass](name) {
  55570. const value = this[_attributes].get(name);
  55571. if (value !== undefined) {
  55572. return value;
  55573. }
  55574. return this[$getChildren](name);
  55575. }
  55576. *[$getChildrenByNameIt](name, allTransparent) {
  55577. const value = this[_attributes].get(name);
  55578. if (value) {
  55579. yield value;
  55580. }
  55581. for (const child of this[_children]) {
  55582. if (child[$nodeName] === name) {
  55583. yield child;
  55584. }
  55585. if (allTransparent) {
  55586. yield* child[$getChildrenByNameIt](name, allTransparent);
  55587. }
  55588. }
  55589. }
  55590. *[$getAttributeIt](name, skipConsumed) {
  55591. const value = this[_attributes].get(name);
  55592. if (value && (!skipConsumed || !value[$consumed])) {
  55593. yield value;
  55594. }
  55595. for (const child of this[_children]) {
  55596. yield* child[$getAttributeIt](name, skipConsumed);
  55597. }
  55598. }
  55599. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  55600. for (const child of this[_children]) {
  55601. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  55602. yield child;
  55603. }
  55604. if (allTransparent) {
  55605. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  55606. }
  55607. }
  55608. }
  55609. [$isDataValue]() {
  55610. if (this[_dataValue] === null) {
  55611. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  55612. }
  55613. return this[_dataValue];
  55614. }
  55615. [$getDataValue]() {
  55616. if (this[_dataValue] === null) {
  55617. if (this[_children].length === 0) {
  55618. return this[$content].trim();
  55619. }
  55620. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  55621. return this[_children][0][$text]().trim();
  55622. }
  55623. return null;
  55624. }
  55625. return this[$content].trim();
  55626. }
  55627. [$setValue](value) {
  55628. value = value.value || "";
  55629. this[$content] = value.toString();
  55630. }
  55631. [$dump]() {
  55632. let hasNS = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  55633. const dumped = Object.create(null);
  55634. if (hasNS) {
  55635. dumped.$ns = this[$namespaceId];
  55636. }
  55637. if (this[$content]) {
  55638. dumped.$content = this[$content];
  55639. }
  55640. dumped.$name = this[$nodeName];
  55641. dumped.children = [];
  55642. for (const child of this[_children]) {
  55643. dumped.children.push(child[$dump](hasNS));
  55644. }
  55645. dumped.attributes = Object.create(null);
  55646. for (const [name, value] of this[_attributes]) {
  55647. dumped.attributes[name] = value[$content];
  55648. }
  55649. return dumped;
  55650. }
  55651. }
  55652. exports.XmlObject = XmlObject;
  55653. class ContentObject extends XFAObject {
  55654. constructor(nsId, name) {
  55655. super(nsId, name);
  55656. this[$content] = "";
  55657. }
  55658. [$onText](text) {
  55659. this[$content] += text;
  55660. }
  55661. [$finalize]() {}
  55662. }
  55663. exports.ContentObject = ContentObject;
  55664. class OptionObject extends ContentObject {
  55665. constructor(nsId, name, options) {
  55666. super(nsId, name);
  55667. this[_options] = options;
  55668. }
  55669. [$finalize]() {
  55670. this[$content] = (0, _utils.getKeyword)({
  55671. data: this[$content],
  55672. defaultValue: this[_options][0],
  55673. validate: k => this[_options].includes(k)
  55674. });
  55675. }
  55676. [$clean](builder) {
  55677. super[$clean](builder);
  55678. delete this[_options];
  55679. }
  55680. }
  55681. exports.OptionObject = OptionObject;
  55682. class StringObject extends ContentObject {
  55683. [$finalize]() {
  55684. this[$content] = this[$content].trim();
  55685. }
  55686. }
  55687. exports.StringObject = StringObject;
  55688. class IntegerObject extends ContentObject {
  55689. constructor(nsId, name, defaultValue, validator) {
  55690. super(nsId, name);
  55691. this[_defaultValue] = defaultValue;
  55692. this[_validator] = validator;
  55693. }
  55694. [$finalize]() {
  55695. this[$content] = (0, _utils.getInteger)({
  55696. data: this[$content],
  55697. defaultValue: this[_defaultValue],
  55698. validate: this[_validator]
  55699. });
  55700. }
  55701. [$clean](builder) {
  55702. super[$clean](builder);
  55703. delete this[_defaultValue];
  55704. delete this[_validator];
  55705. }
  55706. }
  55707. exports.IntegerObject = IntegerObject;
  55708. class Option01 extends IntegerObject {
  55709. constructor(nsId, name) {
  55710. super(nsId, name, 0, n => n === 1);
  55711. }
  55712. }
  55713. exports.Option01 = Option01;
  55714. class Option10 extends IntegerObject {
  55715. constructor(nsId, name) {
  55716. super(nsId, name, 1, n => n === 0);
  55717. }
  55718. }
  55719. exports.Option10 = Option10;
  55720. /***/ }),
  55721. /* 207 */
  55722. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55723. "use strict";
  55724. Object.defineProperty(exports, "__esModule", ({
  55725. value: true
  55726. }));
  55727. exports.HTMLResult = void 0;
  55728. exports.getBBox = getBBox;
  55729. exports.getColor = getColor;
  55730. exports.getFloat = getFloat;
  55731. exports.getInteger = getInteger;
  55732. exports.getKeyword = getKeyword;
  55733. exports.getMeasurement = getMeasurement;
  55734. exports.getRatio = getRatio;
  55735. exports.getRelevant = getRelevant;
  55736. exports.getStringOption = getStringOption;
  55737. exports.stripQuotes = stripQuotes;
  55738. var _util = __w_pdfjs_require__(2);
  55739. const dimConverters = {
  55740. pt: x => x,
  55741. cm: x => x / 2.54 * 72,
  55742. mm: x => x / (10 * 2.54) * 72,
  55743. in: x => x * 72,
  55744. px: x => x
  55745. };
  55746. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  55747. function stripQuotes(str) {
  55748. if (str.startsWith("'") || str.startsWith('"')) {
  55749. return str.slice(1, str.length - 1);
  55750. }
  55751. return str;
  55752. }
  55753. function getInteger(_ref) {
  55754. let {
  55755. data,
  55756. defaultValue,
  55757. validate
  55758. } = _ref;
  55759. if (!data) {
  55760. return defaultValue;
  55761. }
  55762. data = data.trim();
  55763. const n = parseInt(data, 10);
  55764. if (!isNaN(n) && validate(n)) {
  55765. return n;
  55766. }
  55767. return defaultValue;
  55768. }
  55769. function getFloat(_ref2) {
  55770. let {
  55771. data,
  55772. defaultValue,
  55773. validate
  55774. } = _ref2;
  55775. if (!data) {
  55776. return defaultValue;
  55777. }
  55778. data = data.trim();
  55779. const n = parseFloat(data);
  55780. if (!isNaN(n) && validate(n)) {
  55781. return n;
  55782. }
  55783. return defaultValue;
  55784. }
  55785. function getKeyword(_ref3) {
  55786. let {
  55787. data,
  55788. defaultValue,
  55789. validate
  55790. } = _ref3;
  55791. if (!data) {
  55792. return defaultValue;
  55793. }
  55794. data = data.trim();
  55795. if (validate(data)) {
  55796. return data;
  55797. }
  55798. return defaultValue;
  55799. }
  55800. function getStringOption(data, options) {
  55801. return getKeyword({
  55802. data,
  55803. defaultValue: options[0],
  55804. validate: k => options.includes(k)
  55805. });
  55806. }
  55807. function getMeasurement(str) {
  55808. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "0";
  55809. def = def || "0";
  55810. if (!str) {
  55811. return getMeasurement(def);
  55812. }
  55813. const match = str.trim().match(measurementPattern);
  55814. if (!match) {
  55815. return getMeasurement(def);
  55816. }
  55817. const [, valueStr, unit] = match;
  55818. const value = parseFloat(valueStr);
  55819. if (isNaN(value)) {
  55820. return getMeasurement(def);
  55821. }
  55822. if (value === 0) {
  55823. return 0;
  55824. }
  55825. const conv = dimConverters[unit];
  55826. if (conv) {
  55827. return conv(value);
  55828. }
  55829. return value;
  55830. }
  55831. function getRatio(data) {
  55832. if (!data) {
  55833. return {
  55834. num: 1,
  55835. den: 1
  55836. };
  55837. }
  55838. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  55839. if (ratio.length === 1) {
  55840. ratio.push(1);
  55841. }
  55842. if (ratio.length === 0) {
  55843. return {
  55844. num: 1,
  55845. den: 1
  55846. };
  55847. }
  55848. const [num, den] = ratio;
  55849. return {
  55850. num,
  55851. den
  55852. };
  55853. }
  55854. function getRelevant(data) {
  55855. if (!data) {
  55856. return [];
  55857. }
  55858. return data.trim().split(/\s+/).map(e => {
  55859. return {
  55860. excluded: e[0] === "-",
  55861. viewname: e.substring(1)
  55862. };
  55863. });
  55864. }
  55865. function getColor(data) {
  55866. let def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
  55867. let [r, g, b] = def;
  55868. if (!data) {
  55869. return {
  55870. r,
  55871. g,
  55872. b
  55873. };
  55874. }
  55875. 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);
  55876. if (color.length < 3) {
  55877. return {
  55878. r,
  55879. g,
  55880. b
  55881. };
  55882. }
  55883. [r, g, b] = color;
  55884. return {
  55885. r,
  55886. g,
  55887. b
  55888. };
  55889. }
  55890. function getBBox(data) {
  55891. const def = -1;
  55892. if (!data) {
  55893. return {
  55894. x: def,
  55895. y: def,
  55896. width: def,
  55897. height: def
  55898. };
  55899. }
  55900. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  55901. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  55902. return {
  55903. x: def,
  55904. y: def,
  55905. width: def,
  55906. height: def
  55907. };
  55908. }
  55909. const [x, y, width, height] = bbox;
  55910. return {
  55911. x,
  55912. y,
  55913. width,
  55914. height
  55915. };
  55916. }
  55917. class HTMLResult {
  55918. static get FAILURE() {
  55919. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  55920. }
  55921. static get EMPTY() {
  55922. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  55923. }
  55924. constructor(success, html, bbox, breakNode) {
  55925. this.success = success;
  55926. this.html = html;
  55927. this.bbox = bbox;
  55928. this.breakNode = breakNode;
  55929. }
  55930. isBreak() {
  55931. return !!this.breakNode;
  55932. }
  55933. static breakNode(node) {
  55934. return new HTMLResult(false, null, null, node);
  55935. }
  55936. static success(html) {
  55937. let bbox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  55938. return new HTMLResult(true, html, bbox, null);
  55939. }
  55940. }
  55941. exports.HTMLResult = HTMLResult;
  55942. /***/ }),
  55943. /* 208 */
  55944. /***/ ((__unused_webpack_module, exports) => {
  55945. "use strict";
  55946. Object.defineProperty(exports, "__esModule", ({
  55947. value: true
  55948. }));
  55949. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  55950. const $buildXFAObject = Symbol();
  55951. exports.$buildXFAObject = $buildXFAObject;
  55952. const NamespaceIds = {
  55953. config: {
  55954. id: 0,
  55955. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  55956. },
  55957. connectionSet: {
  55958. id: 1,
  55959. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  55960. },
  55961. datasets: {
  55962. id: 2,
  55963. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  55964. },
  55965. form: {
  55966. id: 3,
  55967. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  55968. },
  55969. localeSet: {
  55970. id: 4,
  55971. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  55972. },
  55973. pdf: {
  55974. id: 5,
  55975. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  55976. },
  55977. signature: {
  55978. id: 6,
  55979. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  55980. },
  55981. sourceSet: {
  55982. id: 7,
  55983. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  55984. },
  55985. stylesheet: {
  55986. id: 8,
  55987. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  55988. },
  55989. template: {
  55990. id: 9,
  55991. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  55992. },
  55993. xdc: {
  55994. id: 10,
  55995. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  55996. },
  55997. xdp: {
  55998. id: 11,
  55999. check: ns => ns === "http://ns.adobe.com/xdp/"
  56000. },
  56001. xfdf: {
  56002. id: 12,
  56003. check: ns => ns === "http://ns.adobe.com/xfdf/"
  56004. },
  56005. xhtml: {
  56006. id: 13,
  56007. check: ns => ns === "http://www.w3.org/1999/xhtml"
  56008. },
  56009. xmpmeta: {
  56010. id: 14,
  56011. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  56012. }
  56013. };
  56014. exports.NamespaceIds = NamespaceIds;
  56015. /***/ }),
  56016. /* 209 */
  56017. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56018. "use strict";
  56019. Object.defineProperty(exports, "__esModule", ({
  56020. value: true
  56021. }));
  56022. exports.createDataNode = createDataNode;
  56023. exports.searchNode = searchNode;
  56024. var _xfa_object = __w_pdfjs_require__(206);
  56025. var _namespaces = __w_pdfjs_require__(208);
  56026. var _util = __w_pdfjs_require__(2);
  56027. const namePattern = /^[^.[]+/;
  56028. const indexPattern = /^[^\]]+/;
  56029. const operators = {
  56030. dot: 0,
  56031. dotDot: 1,
  56032. dotHash: 2,
  56033. dotBracket: 3,
  56034. dotParen: 4
  56035. };
  56036. 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]]);
  56037. const somCache = new WeakMap();
  56038. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56039. function parseIndex(index) {
  56040. index = index.trim();
  56041. if (index === "*") {
  56042. return Infinity;
  56043. }
  56044. return parseInt(index, 10) || 0;
  56045. }
  56046. function parseExpression(expr, dotDotAllowed) {
  56047. let noExpr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  56048. let match = expr.match(namePattern);
  56049. if (!match) {
  56050. return null;
  56051. }
  56052. let [name] = match;
  56053. const parsed = [{
  56054. name,
  56055. cacheName: "." + name,
  56056. index: 0,
  56057. js: null,
  56058. formCalc: null,
  56059. operator: operators.dot
  56060. }];
  56061. let pos = name.length;
  56062. while (pos < expr.length) {
  56063. const spos = pos;
  56064. const char = expr.charAt(pos++);
  56065. if (char === "[") {
  56066. match = expr.slice(pos).match(indexPattern);
  56067. if (!match) {
  56068. (0, _util.warn)("XFA - Invalid index in SOM expression");
  56069. return null;
  56070. }
  56071. parsed.at(-1).index = parseIndex(match[0]);
  56072. pos += match[0].length + 1;
  56073. continue;
  56074. }
  56075. let operator;
  56076. switch (expr.charAt(pos)) {
  56077. case ".":
  56078. if (!dotDotAllowed) {
  56079. return null;
  56080. }
  56081. pos++;
  56082. operator = operators.dotDot;
  56083. break;
  56084. case "#":
  56085. pos++;
  56086. operator = operators.dotHash;
  56087. break;
  56088. case "[":
  56089. if (noExpr) {
  56090. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  56091. return null;
  56092. }
  56093. operator = operators.dotBracket;
  56094. break;
  56095. case "(":
  56096. if (noExpr) {
  56097. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  56098. return null;
  56099. }
  56100. operator = operators.dotParen;
  56101. break;
  56102. default:
  56103. operator = operators.dot;
  56104. break;
  56105. }
  56106. match = expr.slice(pos).match(namePattern);
  56107. if (!match) {
  56108. break;
  56109. }
  56110. [name] = match;
  56111. pos += name.length;
  56112. parsed.push({
  56113. name,
  56114. cacheName: expr.slice(spos, pos),
  56115. operator,
  56116. index: 0,
  56117. js: null,
  56118. formCalc: null
  56119. });
  56120. }
  56121. return parsed;
  56122. }
  56123. function searchNode(root, container, expr) {
  56124. let dotDotAllowed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
  56125. let useCache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  56126. const parsed = parseExpression(expr, dotDotAllowed);
  56127. if (!parsed) {
  56128. return null;
  56129. }
  56130. const fn = shortcuts.get(parsed[0].name);
  56131. let i = 0;
  56132. let isQualified;
  56133. if (fn) {
  56134. isQualified = true;
  56135. root = [fn(root, container)];
  56136. i = 1;
  56137. } else {
  56138. isQualified = container === null;
  56139. root = [container || root];
  56140. }
  56141. for (let ii = parsed.length; i < ii; i++) {
  56142. const {
  56143. name,
  56144. cacheName,
  56145. operator,
  56146. index
  56147. } = parsed[i];
  56148. const nodes = [];
  56149. for (const node of root) {
  56150. if (!(node instanceof _xfa_object.XFAObject)) {
  56151. continue;
  56152. }
  56153. let children, cached;
  56154. if (useCache) {
  56155. cached = somCache.get(node);
  56156. if (!cached) {
  56157. cached = new Map();
  56158. somCache.set(node, cached);
  56159. }
  56160. children = cached.get(cacheName);
  56161. }
  56162. if (!children) {
  56163. switch (operator) {
  56164. case operators.dot:
  56165. children = node[_xfa_object.$getChildrenByName](name, false);
  56166. break;
  56167. case operators.dotDot:
  56168. children = node[_xfa_object.$getChildrenByName](name, true);
  56169. break;
  56170. case operators.dotHash:
  56171. children = node[_xfa_object.$getChildrenByClass](name);
  56172. if (children instanceof _xfa_object.XFAObjectArray) {
  56173. children = children.children;
  56174. } else {
  56175. children = [children];
  56176. }
  56177. break;
  56178. default:
  56179. break;
  56180. }
  56181. if (useCache) {
  56182. cached.set(cacheName, children);
  56183. }
  56184. }
  56185. if (children.length > 0) {
  56186. nodes.push(children);
  56187. }
  56188. }
  56189. if (nodes.length === 0 && !isQualified && i === 0) {
  56190. const parent = container[_xfa_object.$getParent]();
  56191. container = parent;
  56192. if (!container) {
  56193. return null;
  56194. }
  56195. i = -1;
  56196. root = [container];
  56197. continue;
  56198. }
  56199. if (isFinite(index)) {
  56200. root = nodes.filter(node => index < node.length).map(node => node[index]);
  56201. } else {
  56202. root = nodes.flat();
  56203. }
  56204. }
  56205. if (root.length === 0) {
  56206. return null;
  56207. }
  56208. return root;
  56209. }
  56210. function createNodes(root, path) {
  56211. let node = null;
  56212. for (const {
  56213. name,
  56214. index
  56215. } of path) {
  56216. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  56217. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  56218. node = new _xfa_object.XmlObject(nsId, name);
  56219. root[_xfa_object.$appendChild](node);
  56220. }
  56221. root = node;
  56222. }
  56223. return node;
  56224. }
  56225. function createDataNode(root, container, expr) {
  56226. const parsed = parseExpression(expr);
  56227. if (!parsed) {
  56228. return null;
  56229. }
  56230. if (parsed.some(x => x.operator === operators.dotDot)) {
  56231. return null;
  56232. }
  56233. const fn = shortcuts.get(parsed[0].name);
  56234. let i = 0;
  56235. if (fn) {
  56236. root = fn(root, container);
  56237. i = 1;
  56238. } else {
  56239. root = container || root;
  56240. }
  56241. for (let ii = parsed.length; i < ii; i++) {
  56242. const {
  56243. name,
  56244. operator,
  56245. index
  56246. } = parsed[i];
  56247. if (!isFinite(index)) {
  56248. parsed[i].index = 0;
  56249. return createNodes(root, parsed.slice(i));
  56250. }
  56251. let children;
  56252. switch (operator) {
  56253. case operators.dot:
  56254. children = root[_xfa_object.$getChildrenByName](name, false);
  56255. break;
  56256. case operators.dotDot:
  56257. children = root[_xfa_object.$getChildrenByName](name, true);
  56258. break;
  56259. case operators.dotHash:
  56260. children = root[_xfa_object.$getChildrenByClass](name);
  56261. if (children instanceof _xfa_object.XFAObjectArray) {
  56262. children = children.children;
  56263. } else {
  56264. children = [children];
  56265. }
  56266. break;
  56267. default:
  56268. break;
  56269. }
  56270. if (children.length === 0) {
  56271. return createNodes(root, parsed.slice(i));
  56272. }
  56273. if (index < children.length) {
  56274. const child = children[index];
  56275. if (!(child instanceof _xfa_object.XFAObject)) {
  56276. (0, _util.warn)(`XFA - Cannot create a node.`);
  56277. return null;
  56278. }
  56279. root = child;
  56280. } else {
  56281. parsed[i].index = index - children.length;
  56282. return createNodes(root, parsed.slice(i));
  56283. }
  56284. }
  56285. return null;
  56286. }
  56287. /***/ }),
  56288. /* 210 */
  56289. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56290. "use strict";
  56291. Object.defineProperty(exports, "__esModule", ({
  56292. value: true
  56293. }));
  56294. exports.Binder = void 0;
  56295. var _xfa_object = __w_pdfjs_require__(206);
  56296. var _template = __w_pdfjs_require__(211);
  56297. var _som = __w_pdfjs_require__(209);
  56298. var _namespaces = __w_pdfjs_require__(208);
  56299. var _util = __w_pdfjs_require__(2);
  56300. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  56301. function createText(content) {
  56302. const node = new _template.Text({});
  56303. node[_xfa_object.$content] = content;
  56304. return node;
  56305. }
  56306. class Binder {
  56307. constructor(root) {
  56308. this.root = root;
  56309. this.datasets = root.datasets;
  56310. if (root.datasets && root.datasets.data) {
  56311. this.data = root.datasets.data;
  56312. } else {
  56313. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  56314. }
  56315. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  56316. this.root.form = this.form = root.template[_xfa_object.$clone]();
  56317. }
  56318. _isConsumeData() {
  56319. return !this.emptyMerge && this._mergeMode;
  56320. }
  56321. _isMatchTemplate() {
  56322. return !this._isConsumeData();
  56323. }
  56324. bind() {
  56325. this._bindElement(this.form, this.data);
  56326. return this.form;
  56327. }
  56328. getData() {
  56329. return this.data;
  56330. }
  56331. _bindValue(formNode, data, picture) {
  56332. formNode[_xfa_object.$data] = data;
  56333. if (formNode[_xfa_object.$hasSettableValue]()) {
  56334. if (data[_xfa_object.$isDataValue]()) {
  56335. const value = data[_xfa_object.$getDataValue]();
  56336. formNode[_xfa_object.$setValue](createText(value));
  56337. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  56338. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  56339. formNode[_xfa_object.$setValue](createText(value));
  56340. } else if (this._isConsumeData()) {
  56341. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56342. }
  56343. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  56344. this._bindElement(formNode, data);
  56345. } else {
  56346. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  56347. }
  56348. }
  56349. _findDataByNameToConsume(name, isValue, dataNode, global) {
  56350. if (!name) {
  56351. return null;
  56352. }
  56353. let generator, match;
  56354. for (let i = 0; i < 3; i++) {
  56355. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  56356. while (true) {
  56357. match = generator.next().value;
  56358. if (!match) {
  56359. break;
  56360. }
  56361. if (isValue === match[_xfa_object.$isDataValue]()) {
  56362. return match;
  56363. }
  56364. }
  56365. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  56366. break;
  56367. }
  56368. dataNode = dataNode[_xfa_object.$getParent]();
  56369. }
  56370. if (!global) {
  56371. return null;
  56372. }
  56373. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  56374. match = generator.next().value;
  56375. if (match) {
  56376. return match;
  56377. }
  56378. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  56379. match = generator.next().value;
  56380. if (match && match[_xfa_object.$isDataValue]()) {
  56381. return match;
  56382. }
  56383. return null;
  56384. }
  56385. _setProperties(formNode, dataNode) {
  56386. if (!formNode.hasOwnProperty("setProperty")) {
  56387. return;
  56388. }
  56389. for (const {
  56390. ref,
  56391. target,
  56392. connection
  56393. } of formNode.setProperty.children) {
  56394. if (connection) {
  56395. continue;
  56396. }
  56397. if (!ref) {
  56398. continue;
  56399. }
  56400. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56401. if (!nodes) {
  56402. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56403. continue;
  56404. }
  56405. const [node] = nodes;
  56406. if (!node[_xfa_object.$isDescendent](this.data)) {
  56407. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  56408. continue;
  56409. }
  56410. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  56411. if (!targetNodes) {
  56412. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  56413. continue;
  56414. }
  56415. const [targetNode] = targetNodes;
  56416. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  56417. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  56418. continue;
  56419. }
  56420. const targetParent = targetNode[_xfa_object.$getParent]();
  56421. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  56422. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  56423. continue;
  56424. }
  56425. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  56426. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  56427. continue;
  56428. }
  56429. const content = node[_xfa_object.$text]();
  56430. const name = targetNode[_xfa_object.$nodeName];
  56431. if (targetNode instanceof _xfa_object.XFAAttribute) {
  56432. const attrs = Object.create(null);
  56433. attrs[name] = content;
  56434. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  56435. targetParent[name] = obj[name];
  56436. continue;
  56437. }
  56438. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  56439. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  56440. continue;
  56441. }
  56442. targetNode[_xfa_object.$data] = node;
  56443. targetNode[_xfa_object.$content] = content;
  56444. targetNode[_xfa_object.$finalize]();
  56445. }
  56446. }
  56447. _bindItems(formNode, dataNode) {
  56448. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  56449. return;
  56450. }
  56451. for (const item of formNode.items.children) {
  56452. formNode[_xfa_object.$removeChild](item);
  56453. }
  56454. formNode.items.clear();
  56455. const labels = new _template.Items({});
  56456. const values = new _template.Items({});
  56457. formNode[_xfa_object.$appendChild](labels);
  56458. formNode.items.push(labels);
  56459. formNode[_xfa_object.$appendChild](values);
  56460. formNode.items.push(values);
  56461. for (const {
  56462. ref,
  56463. labelRef,
  56464. valueRef,
  56465. connection
  56466. } of formNode.bindItems.children) {
  56467. if (connection) {
  56468. continue;
  56469. }
  56470. if (!ref) {
  56471. continue;
  56472. }
  56473. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  56474. if (!nodes) {
  56475. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  56476. continue;
  56477. }
  56478. for (const node of nodes) {
  56479. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  56480. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  56481. continue;
  56482. }
  56483. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  56484. if (!labelNodes) {
  56485. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  56486. continue;
  56487. }
  56488. const [labelNode] = labelNodes;
  56489. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  56490. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  56491. continue;
  56492. }
  56493. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  56494. if (!valueNodes) {
  56495. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  56496. continue;
  56497. }
  56498. const [valueNode] = valueNodes;
  56499. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  56500. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  56501. continue;
  56502. }
  56503. const label = createText(labelNode[_xfa_object.$text]());
  56504. const value = createText(valueNode[_xfa_object.$text]());
  56505. labels[_xfa_object.$appendChild](label);
  56506. labels.text.push(label);
  56507. values[_xfa_object.$appendChild](value);
  56508. values.text.push(value);
  56509. }
  56510. }
  56511. }
  56512. _bindOccurrences(formNode, matches, picture) {
  56513. let baseClone;
  56514. if (matches.length > 1) {
  56515. baseClone = formNode[_xfa_object.$clone]();
  56516. baseClone[_xfa_object.$removeChild](baseClone.occur);
  56517. baseClone.occur = null;
  56518. }
  56519. this._bindValue(formNode, matches[0], picture);
  56520. this._setProperties(formNode, matches[0]);
  56521. this._bindItems(formNode, matches[0]);
  56522. if (matches.length === 1) {
  56523. return;
  56524. }
  56525. const parent = formNode[_xfa_object.$getParent]();
  56526. const name = formNode[_xfa_object.$nodeName];
  56527. const pos = parent[_xfa_object.$indexOf](formNode);
  56528. for (let i = 1, ii = matches.length; i < ii; i++) {
  56529. const match = matches[i];
  56530. const clone = baseClone[_xfa_object.$clone]();
  56531. parent[name].push(clone);
  56532. parent[_xfa_object.$insertAt](pos + i, clone);
  56533. this._bindValue(clone, match, picture);
  56534. this._setProperties(clone, match);
  56535. this._bindItems(clone, match);
  56536. }
  56537. }
  56538. _createOccurrences(formNode) {
  56539. if (!this.emptyMerge) {
  56540. return;
  56541. }
  56542. const {
  56543. occur
  56544. } = formNode;
  56545. if (!occur || occur.initial <= 1) {
  56546. return;
  56547. }
  56548. const parent = formNode[_xfa_object.$getParent]();
  56549. const name = formNode[_xfa_object.$nodeName];
  56550. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  56551. return;
  56552. }
  56553. let currentNumber;
  56554. if (formNode.name) {
  56555. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  56556. } else {
  56557. currentNumber = parent[name].children.length;
  56558. }
  56559. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  56560. const ii = occur.initial - currentNumber;
  56561. if (ii) {
  56562. const nodeClone = formNode[_xfa_object.$clone]();
  56563. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  56564. nodeClone.occur = null;
  56565. parent[name].push(nodeClone);
  56566. parent[_xfa_object.$insertAt](pos, nodeClone);
  56567. for (let i = 1; i < ii; i++) {
  56568. const clone = nodeClone[_xfa_object.$clone]();
  56569. parent[name].push(clone);
  56570. parent[_xfa_object.$insertAt](pos + i, clone);
  56571. }
  56572. }
  56573. }
  56574. _getOccurInfo(formNode) {
  56575. const {
  56576. name,
  56577. occur
  56578. } = formNode;
  56579. if (!occur || !name) {
  56580. return [1, 1];
  56581. }
  56582. const max = occur.max === -1 ? Infinity : occur.max;
  56583. return [occur.min, max];
  56584. }
  56585. _setAndBind(formNode, dataNode) {
  56586. this._setProperties(formNode, dataNode);
  56587. this._bindItems(formNode, dataNode);
  56588. this._bindElement(formNode, dataNode);
  56589. }
  56590. _bindElement(formNode, dataNode) {
  56591. const uselessNodes = [];
  56592. this._createOccurrences(formNode);
  56593. for (const child of formNode[_xfa_object.$getChildren]()) {
  56594. if (child[_xfa_object.$data]) {
  56595. continue;
  56596. }
  56597. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  56598. this._mergeMode = child.mergeMode === "consumeData";
  56599. const dataChildren = dataNode[_xfa_object.$getChildren]();
  56600. if (dataChildren.length > 0) {
  56601. this._bindOccurrences(child, [dataChildren[0]], null);
  56602. } else if (this.emptyMerge) {
  56603. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  56604. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  56605. dataNode[_xfa_object.$appendChild](dataChild);
  56606. this._bindElement(child, dataChild);
  56607. }
  56608. continue;
  56609. }
  56610. if (!child[_xfa_object.$isBindable]()) {
  56611. continue;
  56612. }
  56613. let global = false;
  56614. let picture = null;
  56615. let ref = null;
  56616. let match = null;
  56617. if (child.bind) {
  56618. switch (child.bind.match) {
  56619. case "none":
  56620. this._setAndBind(child, dataNode);
  56621. continue;
  56622. case "global":
  56623. global = true;
  56624. break;
  56625. case "dataRef":
  56626. if (!child.bind.ref) {
  56627. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  56628. this._setAndBind(child, dataNode);
  56629. continue;
  56630. }
  56631. ref = child.bind.ref;
  56632. break;
  56633. default:
  56634. break;
  56635. }
  56636. if (child.bind.picture) {
  56637. picture = child.bind.picture[_xfa_object.$content];
  56638. }
  56639. }
  56640. const [min, max] = this._getOccurInfo(child);
  56641. if (ref) {
  56642. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  56643. if (match === null) {
  56644. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  56645. if (!match) {
  56646. continue;
  56647. }
  56648. if (this._isConsumeData()) {
  56649. match[_xfa_object.$consumed] = true;
  56650. }
  56651. this._setAndBind(child, match);
  56652. continue;
  56653. } else {
  56654. if (this._isConsumeData()) {
  56655. match = match.filter(node => !node[_xfa_object.$consumed]);
  56656. }
  56657. if (match.length > max) {
  56658. match = match.slice(0, max);
  56659. } else if (match.length === 0) {
  56660. match = null;
  56661. }
  56662. if (match && this._isConsumeData()) {
  56663. match.forEach(node => {
  56664. node[_xfa_object.$consumed] = true;
  56665. });
  56666. }
  56667. }
  56668. } else {
  56669. if (!child.name) {
  56670. this._setAndBind(child, dataNode);
  56671. continue;
  56672. }
  56673. if (this._isConsumeData()) {
  56674. const matches = [];
  56675. while (matches.length < max) {
  56676. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  56677. if (!found) {
  56678. break;
  56679. }
  56680. found[_xfa_object.$consumed] = true;
  56681. matches.push(found);
  56682. }
  56683. match = matches.length > 0 ? matches : null;
  56684. } else {
  56685. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  56686. if (!match) {
  56687. if (min === 0) {
  56688. uselessNodes.push(child);
  56689. continue;
  56690. }
  56691. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  56692. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  56693. if (this.emptyMerge) {
  56694. match[_xfa_object.$consumed] = true;
  56695. }
  56696. dataNode[_xfa_object.$appendChild](match);
  56697. this._setAndBind(child, match);
  56698. continue;
  56699. }
  56700. if (this.emptyMerge) {
  56701. match[_xfa_object.$consumed] = true;
  56702. }
  56703. match = [match];
  56704. }
  56705. }
  56706. if (match) {
  56707. this._bindOccurrences(child, match, picture);
  56708. } else if (min > 0) {
  56709. this._setAndBind(child, dataNode);
  56710. } else {
  56711. uselessNodes.push(child);
  56712. }
  56713. }
  56714. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  56715. }
  56716. }
  56717. exports.Binder = Binder;
  56718. /***/ }),
  56719. /* 211 */
  56720. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56721. "use strict";
  56722. Object.defineProperty(exports, "__esModule", ({
  56723. value: true
  56724. }));
  56725. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  56726. var _xfa_object = __w_pdfjs_require__(206);
  56727. var _namespaces = __w_pdfjs_require__(208);
  56728. var _layout = __w_pdfjs_require__(212);
  56729. var _html_utils = __w_pdfjs_require__(213);
  56730. var _utils = __w_pdfjs_require__(207);
  56731. var _util = __w_pdfjs_require__(2);
  56732. var _fonts = __w_pdfjs_require__(214);
  56733. var _core_utils = __w_pdfjs_require__(135);
  56734. var _som = __w_pdfjs_require__(209);
  56735. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  56736. const SVG_NS = "http://www.w3.org/2000/svg";
  56737. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  56738. const MAX_EMPTY_PAGES = 3;
  56739. const DEFAULT_TAB_INDEX = 5000;
  56740. const HEADING_PATTERN = /^H(\d+)$/;
  56741. 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"]);
  56742. 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"]];
  56743. function getBorderDims(node) {
  56744. if (!node || !node.border) {
  56745. return {
  56746. w: 0,
  56747. h: 0
  56748. };
  56749. }
  56750. const borderExtra = node.border[_xfa_object.$getExtra]();
  56751. if (!borderExtra) {
  56752. return {
  56753. w: 0,
  56754. h: 0
  56755. };
  56756. }
  56757. return {
  56758. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  56759. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  56760. };
  56761. }
  56762. function hasMargin(node) {
  56763. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  56764. }
  56765. function _setValue(templateNode, value) {
  56766. if (!templateNode.value) {
  56767. const nodeValue = new Value({});
  56768. templateNode[_xfa_object.$appendChild](nodeValue);
  56769. templateNode.value = nodeValue;
  56770. }
  56771. templateNode.value[_xfa_object.$setValue](value);
  56772. }
  56773. function* getContainedChildren(node) {
  56774. for (const child of node[_xfa_object.$getChildren]()) {
  56775. if (child instanceof SubformSet) {
  56776. yield* child[_xfa_object.$getContainedChildren]();
  56777. continue;
  56778. }
  56779. yield child;
  56780. }
  56781. }
  56782. function isRequired(node) {
  56783. return node.validate && node.validate.nullTest === "error";
  56784. }
  56785. function setTabIndex(node) {
  56786. while (node) {
  56787. if (!node.traversal) {
  56788. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  56789. return;
  56790. }
  56791. if (node[_xfa_object.$tabIndex]) {
  56792. return;
  56793. }
  56794. let next = null;
  56795. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  56796. if (child.operation === "next") {
  56797. next = child;
  56798. break;
  56799. }
  56800. }
  56801. if (!next || !next.ref) {
  56802. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  56803. return;
  56804. }
  56805. const root = node[_xfa_object.$getTemplateRoot]();
  56806. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  56807. const ref = root[_xfa_object.$searchNode](next.ref, node);
  56808. if (!ref) {
  56809. return;
  56810. }
  56811. node = ref[0];
  56812. }
  56813. }
  56814. function applyAssist(obj, attributes) {
  56815. const assist = obj.assist;
  56816. if (assist) {
  56817. const assistTitle = assist[_xfa_object.$toHTML]();
  56818. if (assistTitle) {
  56819. attributes.title = assistTitle;
  56820. }
  56821. const role = assist.role;
  56822. const match = role.match(HEADING_PATTERN);
  56823. if (match) {
  56824. const ariaRole = "heading";
  56825. const ariaLevel = match[1];
  56826. attributes.role = ariaRole;
  56827. attributes["aria-level"] = ariaLevel;
  56828. }
  56829. }
  56830. if (obj.layout === "table") {
  56831. attributes.role = "table";
  56832. } else if (obj.layout === "row") {
  56833. attributes.role = "row";
  56834. } else {
  56835. const parent = obj[_xfa_object.$getParent]();
  56836. if (parent.layout === "row") {
  56837. if (parent.assist && parent.assist.role === "TH") {
  56838. attributes.role = "columnheader";
  56839. } else {
  56840. attributes.role = "cell";
  56841. }
  56842. }
  56843. }
  56844. }
  56845. function ariaLabel(obj) {
  56846. if (!obj.assist) {
  56847. return null;
  56848. }
  56849. const assist = obj.assist;
  56850. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  56851. return assist.speak[_xfa_object.$content];
  56852. }
  56853. if (assist.toolTip) {
  56854. return assist.toolTip[_xfa_object.$content];
  56855. }
  56856. return null;
  56857. }
  56858. function valueToHtml(value) {
  56859. return _utils.HTMLResult.success({
  56860. name: "div",
  56861. attributes: {
  56862. class: ["xfaRich"],
  56863. style: Object.create(null)
  56864. },
  56865. children: [{
  56866. name: "span",
  56867. attributes: {
  56868. style: Object.create(null)
  56869. },
  56870. value
  56871. }]
  56872. });
  56873. }
  56874. function setFirstUnsplittable(node) {
  56875. const root = node[_xfa_object.$getTemplateRoot]();
  56876. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  56877. root[_xfa_object.$extra].firstUnsplittable = node;
  56878. root[_xfa_object.$extra].noLayoutFailure = true;
  56879. }
  56880. }
  56881. function unsetFirstUnsplittable(node) {
  56882. const root = node[_xfa_object.$getTemplateRoot]();
  56883. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  56884. root[_xfa_object.$extra].noLayoutFailure = false;
  56885. }
  56886. }
  56887. function handleBreak(node) {
  56888. if (node[_xfa_object.$extra]) {
  56889. return false;
  56890. }
  56891. node[_xfa_object.$extra] = Object.create(null);
  56892. if (node.targetType === "auto") {
  56893. return false;
  56894. }
  56895. const root = node[_xfa_object.$getTemplateRoot]();
  56896. let target = null;
  56897. if (node.target) {
  56898. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  56899. if (!target) {
  56900. return false;
  56901. }
  56902. target = target[0];
  56903. }
  56904. const {
  56905. currentPageArea,
  56906. currentContentArea
  56907. } = root[_xfa_object.$extra];
  56908. if (node.targetType === "pageArea") {
  56909. if (!(target instanceof PageArea)) {
  56910. target = null;
  56911. }
  56912. if (node.startNew) {
  56913. node[_xfa_object.$extra].target = target || currentPageArea;
  56914. return true;
  56915. } else if (target && target !== currentPageArea) {
  56916. node[_xfa_object.$extra].target = target;
  56917. return true;
  56918. }
  56919. return false;
  56920. }
  56921. if (!(target instanceof ContentArea)) {
  56922. target = null;
  56923. }
  56924. const pageArea = target && target[_xfa_object.$getParent]();
  56925. let index;
  56926. let nextPageArea = pageArea;
  56927. if (node.startNew) {
  56928. if (target) {
  56929. const contentAreas = pageArea.contentArea.children;
  56930. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  56931. const indexForTarget = contentAreas.indexOf(target);
  56932. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  56933. nextPageArea = null;
  56934. }
  56935. index = indexForTarget - 1;
  56936. } else {
  56937. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  56938. }
  56939. } else if (target && target !== currentContentArea) {
  56940. const contentAreas = pageArea.contentArea.children;
  56941. index = contentAreas.indexOf(target) - 1;
  56942. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  56943. } else {
  56944. return false;
  56945. }
  56946. node[_xfa_object.$extra].target = nextPageArea;
  56947. node[_xfa_object.$extra].index = index;
  56948. return true;
  56949. }
  56950. function handleOverflow(node, extraNode, space) {
  56951. const root = node[_xfa_object.$getTemplateRoot]();
  56952. const saved = root[_xfa_object.$extra].noLayoutFailure;
  56953. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  56954. extraNode[_xfa_object.$getSubformParent] = () => node;
  56955. root[_xfa_object.$extra].noLayoutFailure = true;
  56956. const res = extraNode[_xfa_object.$toHTML](space);
  56957. node[_xfa_object.$addHTML](res.html, res.bbox);
  56958. root[_xfa_object.$extra].noLayoutFailure = saved;
  56959. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  56960. }
  56961. class AppearanceFilter extends _xfa_object.StringObject {
  56962. constructor(attributes) {
  56963. super(TEMPLATE_NS_ID, "appearanceFilter");
  56964. this.id = attributes.id || "";
  56965. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56966. this.use = attributes.use || "";
  56967. this.usehref = attributes.usehref || "";
  56968. }
  56969. }
  56970. class Arc extends _xfa_object.XFAObject {
  56971. constructor(attributes) {
  56972. super(TEMPLATE_NS_ID, "arc", true);
  56973. this.circular = (0, _utils.getInteger)({
  56974. data: attributes.circular,
  56975. defaultValue: 0,
  56976. validate: x => x === 1
  56977. });
  56978. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  56979. this.id = attributes.id || "";
  56980. this.startAngle = (0, _utils.getFloat)({
  56981. data: attributes.startAngle,
  56982. defaultValue: 0,
  56983. validate: x => true
  56984. });
  56985. this.sweepAngle = (0, _utils.getFloat)({
  56986. data: attributes.sweepAngle,
  56987. defaultValue: 360,
  56988. validate: x => true
  56989. });
  56990. this.use = attributes.use || "";
  56991. this.usehref = attributes.usehref || "";
  56992. this.edge = null;
  56993. this.fill = null;
  56994. }
  56995. [_xfa_object.$toHTML]() {
  56996. const edge = this.edge || new Edge({});
  56997. const edgeStyle = edge[_xfa_object.$toStyle]();
  56998. const style = Object.create(null);
  56999. if (this.fill && this.fill.presence === "visible") {
  57000. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57001. } else {
  57002. style.fill = "transparent";
  57003. }
  57004. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  57005. style.stroke = edgeStyle.color;
  57006. let arc;
  57007. const attributes = {
  57008. xmlns: SVG_NS,
  57009. style: {
  57010. width: "100%",
  57011. height: "100%",
  57012. overflow: "visible"
  57013. }
  57014. };
  57015. if (this.sweepAngle === 360) {
  57016. arc = {
  57017. name: "ellipse",
  57018. attributes: {
  57019. xmlns: SVG_NS,
  57020. cx: "50%",
  57021. cy: "50%",
  57022. rx: "50%",
  57023. ry: "50%",
  57024. style
  57025. }
  57026. };
  57027. } else {
  57028. const startAngle = this.startAngle * Math.PI / 180;
  57029. const sweepAngle = this.sweepAngle * Math.PI / 180;
  57030. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  57031. 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))];
  57032. arc = {
  57033. name: "path",
  57034. attributes: {
  57035. xmlns: SVG_NS,
  57036. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  57037. vectorEffect: "non-scaling-stroke",
  57038. style
  57039. }
  57040. };
  57041. Object.assign(attributes, {
  57042. viewBox: "0 0 100 100",
  57043. preserveAspectRatio: "none"
  57044. });
  57045. }
  57046. const svg = {
  57047. name: "svg",
  57048. children: [arc],
  57049. attributes
  57050. };
  57051. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57052. if (hasMargin(parent)) {
  57053. return _utils.HTMLResult.success({
  57054. name: "div",
  57055. attributes: {
  57056. style: {
  57057. display: "inline",
  57058. width: "100%",
  57059. height: "100%"
  57060. }
  57061. },
  57062. children: [svg]
  57063. });
  57064. }
  57065. svg.attributes.style.position = "absolute";
  57066. return _utils.HTMLResult.success(svg);
  57067. }
  57068. }
  57069. class Area extends _xfa_object.XFAObject {
  57070. constructor(attributes) {
  57071. super(TEMPLATE_NS_ID, "area", true);
  57072. this.colSpan = (0, _utils.getInteger)({
  57073. data: attributes.colSpan,
  57074. defaultValue: 1,
  57075. validate: n => n >= 1 || n === -1
  57076. });
  57077. this.id = attributes.id || "";
  57078. this.name = attributes.name || "";
  57079. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57080. this.use = attributes.use || "";
  57081. this.usehref = attributes.usehref || "";
  57082. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57083. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57084. this.desc = null;
  57085. this.extras = null;
  57086. this.area = new _xfa_object.XFAObjectArray();
  57087. this.draw = new _xfa_object.XFAObjectArray();
  57088. this.exObject = new _xfa_object.XFAObjectArray();
  57089. this.exclGroup = new _xfa_object.XFAObjectArray();
  57090. this.field = new _xfa_object.XFAObjectArray();
  57091. this.subform = new _xfa_object.XFAObjectArray();
  57092. this.subformSet = new _xfa_object.XFAObjectArray();
  57093. }
  57094. *[_xfa_object.$getContainedChildren]() {
  57095. yield* getContainedChildren(this);
  57096. }
  57097. [_xfa_object.$isTransparent]() {
  57098. return true;
  57099. }
  57100. [_xfa_object.$isBindable]() {
  57101. return true;
  57102. }
  57103. [_xfa_object.$addHTML](html, bbox) {
  57104. const [x, y, w, h] = bbox;
  57105. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  57106. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  57107. this[_xfa_object.$extra].children.push(html);
  57108. }
  57109. [_xfa_object.$getAvailableSpace]() {
  57110. return this[_xfa_object.$extra].availableSpace;
  57111. }
  57112. [_xfa_object.$toHTML](availableSpace) {
  57113. const style = (0, _html_utils.toStyle)(this, "position");
  57114. const attributes = {
  57115. style,
  57116. id: this[_xfa_object.$uid],
  57117. class: ["xfaArea"]
  57118. };
  57119. if ((0, _html_utils.isPrintOnly)(this)) {
  57120. attributes.class.push("xfaPrintOnly");
  57121. }
  57122. if (this.name) {
  57123. attributes.xfaName = this.name;
  57124. }
  57125. const children = [];
  57126. this[_xfa_object.$extra] = {
  57127. children,
  57128. width: 0,
  57129. height: 0,
  57130. availableSpace
  57131. };
  57132. const result = this[_xfa_object.$childrenToHTML]({
  57133. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  57134. include: true
  57135. });
  57136. if (!result.success) {
  57137. if (result.isBreak()) {
  57138. return result;
  57139. }
  57140. delete this[_xfa_object.$extra];
  57141. return _utils.HTMLResult.FAILURE;
  57142. }
  57143. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  57144. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  57145. const html = {
  57146. name: "div",
  57147. attributes,
  57148. children
  57149. };
  57150. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  57151. delete this[_xfa_object.$extra];
  57152. return _utils.HTMLResult.success(html, bbox);
  57153. }
  57154. }
  57155. class Assist extends _xfa_object.XFAObject {
  57156. constructor(attributes) {
  57157. super(TEMPLATE_NS_ID, "assist", true);
  57158. this.id = attributes.id || "";
  57159. this.role = attributes.role || "";
  57160. this.use = attributes.use || "";
  57161. this.usehref = attributes.usehref || "";
  57162. this.speak = null;
  57163. this.toolTip = null;
  57164. }
  57165. [_xfa_object.$toHTML]() {
  57166. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  57167. }
  57168. }
  57169. class Barcode extends _xfa_object.XFAObject {
  57170. constructor(attributes) {
  57171. super(TEMPLATE_NS_ID, "barcode", true);
  57172. this.charEncoding = (0, _utils.getKeyword)({
  57173. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  57174. defaultValue: "",
  57175. 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}/)
  57176. });
  57177. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  57178. this.dataColumnCount = (0, _utils.getInteger)({
  57179. data: attributes.dataColumnCount,
  57180. defaultValue: -1,
  57181. validate: x => x >= 0
  57182. });
  57183. this.dataLength = (0, _utils.getInteger)({
  57184. data: attributes.dataLength,
  57185. defaultValue: -1,
  57186. validate: x => x >= 0
  57187. });
  57188. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  57189. this.dataRowCount = (0, _utils.getInteger)({
  57190. data: attributes.dataRowCount,
  57191. defaultValue: -1,
  57192. validate: x => x >= 0
  57193. });
  57194. this.endChar = attributes.endChar || "";
  57195. this.errorCorrectionLevel = (0, _utils.getInteger)({
  57196. data: attributes.errorCorrectionLevel,
  57197. defaultValue: -1,
  57198. validate: x => x >= 0 && x <= 8
  57199. });
  57200. this.id = attributes.id || "";
  57201. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  57202. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  57203. this.printCheckDigit = (0, _utils.getInteger)({
  57204. data: attributes.printCheckDigit,
  57205. defaultValue: 0,
  57206. validate: x => x === 1
  57207. });
  57208. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  57209. this.startChar = attributes.startChar || "";
  57210. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  57211. this.truncate = (0, _utils.getInteger)({
  57212. data: attributes.truncate,
  57213. defaultValue: 0,
  57214. validate: x => x === 1
  57215. });
  57216. 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"]);
  57217. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  57218. this.use = attributes.use || "";
  57219. this.usehref = attributes.usehref || "";
  57220. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  57221. this.encrypt = null;
  57222. this.extras = null;
  57223. }
  57224. }
  57225. class Bind extends _xfa_object.XFAObject {
  57226. constructor(attributes) {
  57227. super(TEMPLATE_NS_ID, "bind", true);
  57228. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  57229. this.ref = attributes.ref || "";
  57230. this.picture = null;
  57231. }
  57232. }
  57233. class BindItems extends _xfa_object.XFAObject {
  57234. constructor(attributes) {
  57235. super(TEMPLATE_NS_ID, "bindItems");
  57236. this.connection = attributes.connection || "";
  57237. this.labelRef = attributes.labelRef || "";
  57238. this.ref = attributes.ref || "";
  57239. this.valueRef = attributes.valueRef || "";
  57240. }
  57241. }
  57242. exports.BindItems = BindItems;
  57243. class Bookend extends _xfa_object.XFAObject {
  57244. constructor(attributes) {
  57245. super(TEMPLATE_NS_ID, "bookend");
  57246. this.id = attributes.id || "";
  57247. this.leader = attributes.leader || "";
  57248. this.trailer = attributes.trailer || "";
  57249. this.use = attributes.use || "";
  57250. this.usehref = attributes.usehref || "";
  57251. }
  57252. }
  57253. class BooleanElement extends _xfa_object.Option01 {
  57254. constructor(attributes) {
  57255. super(TEMPLATE_NS_ID, "boolean");
  57256. this.id = attributes.id || "";
  57257. this.name = attributes.name || "";
  57258. this.use = attributes.use || "";
  57259. this.usehref = attributes.usehref || "";
  57260. }
  57261. [_xfa_object.$toHTML](availableSpace) {
  57262. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  57263. }
  57264. }
  57265. class Border extends _xfa_object.XFAObject {
  57266. constructor(attributes) {
  57267. super(TEMPLATE_NS_ID, "border", true);
  57268. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  57269. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  57270. this.id = attributes.id || "";
  57271. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57272. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57273. this.use = attributes.use || "";
  57274. this.usehref = attributes.usehref || "";
  57275. this.corner = new _xfa_object.XFAObjectArray(4);
  57276. this.edge = new _xfa_object.XFAObjectArray(4);
  57277. this.extras = null;
  57278. this.fill = null;
  57279. this.margin = null;
  57280. }
  57281. [_xfa_object.$getExtra]() {
  57282. if (!this[_xfa_object.$extra]) {
  57283. const edges = this.edge.children.slice();
  57284. if (edges.length < 4) {
  57285. const defaultEdge = edges.at(-1) || new Edge({});
  57286. for (let i = edges.length; i < 4; i++) {
  57287. edges.push(defaultEdge);
  57288. }
  57289. }
  57290. const widths = edges.map(edge => edge.thickness);
  57291. const insets = [0, 0, 0, 0];
  57292. if (this.margin) {
  57293. insets[0] = this.margin.topInset;
  57294. insets[1] = this.margin.rightInset;
  57295. insets[2] = this.margin.bottomInset;
  57296. insets[3] = this.margin.leftInset;
  57297. }
  57298. this[_xfa_object.$extra] = {
  57299. widths,
  57300. insets,
  57301. edges
  57302. };
  57303. }
  57304. return this[_xfa_object.$extra];
  57305. }
  57306. [_xfa_object.$toStyle]() {
  57307. const {
  57308. edges
  57309. } = this[_xfa_object.$getExtra]();
  57310. const edgeStyles = edges.map(node => {
  57311. const style = node[_xfa_object.$toStyle]();
  57312. style.color = style.color || "#000000";
  57313. return style;
  57314. });
  57315. const style = Object.create(null);
  57316. if (this.margin) {
  57317. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  57318. }
  57319. if (this.fill && this.fill.presence === "visible") {
  57320. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  57321. }
  57322. if (this.corner.children.some(node => node.radius !== 0)) {
  57323. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  57324. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  57325. const last = cornerStyles.at(-1);
  57326. for (let i = cornerStyles.length; i < 4; i++) {
  57327. cornerStyles.push(last);
  57328. }
  57329. }
  57330. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  57331. }
  57332. switch (this.presence) {
  57333. case "invisible":
  57334. case "hidden":
  57335. style.borderStyle = "";
  57336. break;
  57337. case "inactive":
  57338. style.borderStyle = "none";
  57339. break;
  57340. default:
  57341. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  57342. break;
  57343. }
  57344. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  57345. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  57346. return style;
  57347. }
  57348. }
  57349. class Break extends _xfa_object.XFAObject {
  57350. constructor(attributes) {
  57351. super(TEMPLATE_NS_ID, "break", true);
  57352. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57353. this.afterTarget = attributes.afterTarget || "";
  57354. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  57355. this.beforeTarget = attributes.beforeTarget || "";
  57356. this.bookendLeader = attributes.bookendLeader || "";
  57357. this.bookendTrailer = attributes.bookendTrailer || "";
  57358. this.id = attributes.id || "";
  57359. this.overflowLeader = attributes.overflowLeader || "";
  57360. this.overflowTarget = attributes.overflowTarget || "";
  57361. this.overflowTrailer = attributes.overflowTrailer || "";
  57362. this.startNew = (0, _utils.getInteger)({
  57363. data: attributes.startNew,
  57364. defaultValue: 0,
  57365. validate: x => x === 1
  57366. });
  57367. this.use = attributes.use || "";
  57368. this.usehref = attributes.usehref || "";
  57369. this.extras = null;
  57370. }
  57371. }
  57372. class BreakAfter extends _xfa_object.XFAObject {
  57373. constructor(attributes) {
  57374. super(TEMPLATE_NS_ID, "breakAfter", true);
  57375. this.id = attributes.id || "";
  57376. this.leader = attributes.leader || "";
  57377. this.startNew = (0, _utils.getInteger)({
  57378. data: attributes.startNew,
  57379. defaultValue: 0,
  57380. validate: x => x === 1
  57381. });
  57382. this.target = attributes.target || "";
  57383. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57384. this.trailer = attributes.trailer || "";
  57385. this.use = attributes.use || "";
  57386. this.usehref = attributes.usehref || "";
  57387. this.script = null;
  57388. }
  57389. }
  57390. class BreakBefore extends _xfa_object.XFAObject {
  57391. constructor(attributes) {
  57392. super(TEMPLATE_NS_ID, "breakBefore", true);
  57393. this.id = attributes.id || "";
  57394. this.leader = attributes.leader || "";
  57395. this.startNew = (0, _utils.getInteger)({
  57396. data: attributes.startNew,
  57397. defaultValue: 0,
  57398. validate: x => x === 1
  57399. });
  57400. this.target = attributes.target || "";
  57401. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  57402. this.trailer = attributes.trailer || "";
  57403. this.use = attributes.use || "";
  57404. this.usehref = attributes.usehref || "";
  57405. this.script = null;
  57406. }
  57407. [_xfa_object.$toHTML](availableSpace) {
  57408. this[_xfa_object.$extra] = {};
  57409. return _utils.HTMLResult.FAILURE;
  57410. }
  57411. }
  57412. class Button extends _xfa_object.XFAObject {
  57413. constructor(attributes) {
  57414. super(TEMPLATE_NS_ID, "button", true);
  57415. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  57416. this.id = attributes.id || "";
  57417. this.use = attributes.use || "";
  57418. this.usehref = attributes.usehref || "";
  57419. this.extras = null;
  57420. }
  57421. [_xfa_object.$toHTML](availableSpace) {
  57422. const parent = this[_xfa_object.$getParent]();
  57423. const grandpa = parent[_xfa_object.$getParent]();
  57424. const htmlButton = {
  57425. name: "button",
  57426. attributes: {
  57427. id: this[_xfa_object.$uid],
  57428. class: ["xfaButton"],
  57429. style: {}
  57430. },
  57431. children: []
  57432. };
  57433. for (const event of grandpa.event.children) {
  57434. if (event.activity !== "click" || !event.script) {
  57435. continue;
  57436. }
  57437. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  57438. if (!jsURL) {
  57439. continue;
  57440. }
  57441. const href = (0, _html_utils.fixURL)(jsURL.url);
  57442. if (!href) {
  57443. continue;
  57444. }
  57445. htmlButton.children.push({
  57446. name: "a",
  57447. attributes: {
  57448. id: "link" + this[_xfa_object.$uid],
  57449. href,
  57450. newWindow: jsURL.newWindow,
  57451. class: ["xfaLink"],
  57452. style: {}
  57453. },
  57454. children: []
  57455. });
  57456. }
  57457. return _utils.HTMLResult.success(htmlButton);
  57458. }
  57459. }
  57460. class Calculate extends _xfa_object.XFAObject {
  57461. constructor(attributes) {
  57462. super(TEMPLATE_NS_ID, "calculate", true);
  57463. this.id = attributes.id || "";
  57464. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  57465. this.use = attributes.use || "";
  57466. this.usehref = attributes.usehref || "";
  57467. this.extras = null;
  57468. this.message = null;
  57469. this.script = null;
  57470. }
  57471. }
  57472. class Caption extends _xfa_object.XFAObject {
  57473. constructor(attributes) {
  57474. super(TEMPLATE_NS_ID, "caption", true);
  57475. this.id = attributes.id || "";
  57476. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  57477. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57478. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  57479. this.use = attributes.use || "";
  57480. this.usehref = attributes.usehref || "";
  57481. this.extras = null;
  57482. this.font = null;
  57483. this.margin = null;
  57484. this.para = null;
  57485. this.value = null;
  57486. }
  57487. [_xfa_object.$setValue](value) {
  57488. _setValue(this, value);
  57489. }
  57490. [_xfa_object.$getExtra](availableSpace) {
  57491. if (!this[_xfa_object.$extra]) {
  57492. let {
  57493. width,
  57494. height
  57495. } = availableSpace;
  57496. switch (this.placement) {
  57497. case "left":
  57498. case "right":
  57499. case "inline":
  57500. width = this.reserve <= 0 ? width : this.reserve;
  57501. break;
  57502. case "top":
  57503. case "bottom":
  57504. height = this.reserve <= 0 ? height : this.reserve;
  57505. break;
  57506. }
  57507. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  57508. width,
  57509. height
  57510. });
  57511. }
  57512. return this[_xfa_object.$extra];
  57513. }
  57514. [_xfa_object.$toHTML](availableSpace) {
  57515. if (!this.value) {
  57516. return _utils.HTMLResult.EMPTY;
  57517. }
  57518. this[_xfa_object.$pushPara]();
  57519. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  57520. if (!value) {
  57521. this[_xfa_object.$popPara]();
  57522. return _utils.HTMLResult.EMPTY;
  57523. }
  57524. const savedReserve = this.reserve;
  57525. if (this.reserve <= 0) {
  57526. const {
  57527. w,
  57528. h
  57529. } = this[_xfa_object.$getExtra](availableSpace);
  57530. switch (this.placement) {
  57531. case "left":
  57532. case "right":
  57533. case "inline":
  57534. this.reserve = w;
  57535. break;
  57536. case "top":
  57537. case "bottom":
  57538. this.reserve = h;
  57539. break;
  57540. }
  57541. }
  57542. const children = [];
  57543. if (typeof value === "string") {
  57544. children.push({
  57545. name: "#text",
  57546. value
  57547. });
  57548. } else {
  57549. children.push(value);
  57550. }
  57551. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  57552. switch (this.placement) {
  57553. case "left":
  57554. case "right":
  57555. if (this.reserve > 0) {
  57556. style.width = (0, _html_utils.measureToString)(this.reserve);
  57557. }
  57558. break;
  57559. case "top":
  57560. case "bottom":
  57561. if (this.reserve > 0) {
  57562. style.height = (0, _html_utils.measureToString)(this.reserve);
  57563. }
  57564. break;
  57565. }
  57566. (0, _html_utils.setPara)(this, null, value);
  57567. this[_xfa_object.$popPara]();
  57568. this.reserve = savedReserve;
  57569. return _utils.HTMLResult.success({
  57570. name: "div",
  57571. attributes: {
  57572. style,
  57573. class: ["xfaCaption"]
  57574. },
  57575. children
  57576. });
  57577. }
  57578. }
  57579. class Certificate extends _xfa_object.StringObject {
  57580. constructor(attributes) {
  57581. super(TEMPLATE_NS_ID, "certificate");
  57582. this.id = attributes.id || "";
  57583. this.name = attributes.name || "";
  57584. this.use = attributes.use || "";
  57585. this.usehref = attributes.usehref || "";
  57586. }
  57587. }
  57588. class Certificates extends _xfa_object.XFAObject {
  57589. constructor(attributes) {
  57590. super(TEMPLATE_NS_ID, "certificates", true);
  57591. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  57592. this.id = attributes.id || "";
  57593. this.url = attributes.url || "";
  57594. this.urlPolicy = attributes.urlPolicy || "";
  57595. this.use = attributes.use || "";
  57596. this.usehref = attributes.usehref || "";
  57597. this.encryption = null;
  57598. this.issuers = null;
  57599. this.keyUsage = null;
  57600. this.oids = null;
  57601. this.signing = null;
  57602. this.subjectDNs = null;
  57603. }
  57604. }
  57605. class CheckButton extends _xfa_object.XFAObject {
  57606. constructor(attributes) {
  57607. super(TEMPLATE_NS_ID, "checkButton", true);
  57608. this.id = attributes.id || "";
  57609. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  57610. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  57611. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  57612. this.use = attributes.use || "";
  57613. this.usehref = attributes.usehref || "";
  57614. this.border = null;
  57615. this.extras = null;
  57616. this.margin = null;
  57617. }
  57618. [_xfa_object.$toHTML](availableSpace) {
  57619. const style = (0, _html_utils.toStyle)("margin");
  57620. const size = (0, _html_utils.measureToString)(this.size);
  57621. style.width = style.height = size;
  57622. let type;
  57623. let className;
  57624. let groupId;
  57625. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57626. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  57627. const exportedValue = {
  57628. on: (items[0] !== undefined ? items[0] : "on").toString(),
  57629. off: (items[1] !== undefined ? items[1] : "off").toString()
  57630. };
  57631. const value = field.value && field.value[_xfa_object.$text]() || "off";
  57632. const checked = value === exportedValue.on || undefined;
  57633. const container = field[_xfa_object.$getSubformParent]();
  57634. const fieldId = field[_xfa_object.$uid];
  57635. let dataId;
  57636. if (container instanceof ExclGroup) {
  57637. groupId = container[_xfa_object.$uid];
  57638. type = "radio";
  57639. className = "xfaRadio";
  57640. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  57641. } else {
  57642. type = "checkbox";
  57643. className = "xfaCheckbox";
  57644. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  57645. }
  57646. const input = {
  57647. name: "input",
  57648. attributes: {
  57649. class: [className],
  57650. style,
  57651. fieldId,
  57652. dataId,
  57653. type,
  57654. checked,
  57655. xfaOn: exportedValue.on,
  57656. xfaOff: exportedValue.off,
  57657. "aria-label": ariaLabel(field),
  57658. "aria-required": false
  57659. }
  57660. };
  57661. if (groupId) {
  57662. input.attributes.name = groupId;
  57663. }
  57664. if (isRequired(field)) {
  57665. input.attributes["aria-required"] = true;
  57666. input.attributes.required = true;
  57667. }
  57668. return _utils.HTMLResult.success({
  57669. name: "label",
  57670. attributes: {
  57671. class: ["xfaLabel"]
  57672. },
  57673. children: [input]
  57674. });
  57675. }
  57676. }
  57677. class ChoiceList extends _xfa_object.XFAObject {
  57678. constructor(attributes) {
  57679. super(TEMPLATE_NS_ID, "choiceList", true);
  57680. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  57681. this.id = attributes.id || "";
  57682. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  57683. this.textEntry = (0, _utils.getInteger)({
  57684. data: attributes.textEntry,
  57685. defaultValue: 0,
  57686. validate: x => x === 1
  57687. });
  57688. this.use = attributes.use || "";
  57689. this.usehref = attributes.usehref || "";
  57690. this.border = null;
  57691. this.extras = null;
  57692. this.margin = null;
  57693. }
  57694. [_xfa_object.$toHTML](availableSpace) {
  57695. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  57696. const ui = this[_xfa_object.$getParent]();
  57697. const field = ui[_xfa_object.$getParent]();
  57698. const fontSize = field.font && field.font.size || 10;
  57699. const optionStyle = {
  57700. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  57701. };
  57702. const children = [];
  57703. if (field.items.children.length > 0) {
  57704. const items = field.items;
  57705. let displayedIndex = 0;
  57706. let saveIndex = 0;
  57707. if (items.children.length === 2) {
  57708. displayedIndex = items.children[0].save;
  57709. saveIndex = 1 - displayedIndex;
  57710. }
  57711. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  57712. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  57713. let selected = false;
  57714. const value = field.value && field.value[_xfa_object.$text]() || "";
  57715. for (let i = 0, ii = displayed.length; i < ii; i++) {
  57716. const option = {
  57717. name: "option",
  57718. attributes: {
  57719. value: values[i] || displayed[i],
  57720. style: optionStyle
  57721. },
  57722. value: displayed[i]
  57723. };
  57724. if (values[i] === value) {
  57725. option.attributes.selected = selected = true;
  57726. }
  57727. children.push(option);
  57728. }
  57729. if (!selected) {
  57730. children.splice(0, 0, {
  57731. name: "option",
  57732. attributes: {
  57733. hidden: true,
  57734. selected: true
  57735. },
  57736. value: " "
  57737. });
  57738. }
  57739. }
  57740. const selectAttributes = {
  57741. class: ["xfaSelect"],
  57742. fieldId: field[_xfa_object.$uid],
  57743. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57744. style,
  57745. "aria-label": ariaLabel(field),
  57746. "aria-required": false
  57747. };
  57748. if (isRequired(field)) {
  57749. selectAttributes["aria-required"] = true;
  57750. selectAttributes.required = true;
  57751. }
  57752. if (this.open === "multiSelect") {
  57753. selectAttributes.multiple = true;
  57754. }
  57755. return _utils.HTMLResult.success({
  57756. name: "label",
  57757. attributes: {
  57758. class: ["xfaLabel"]
  57759. },
  57760. children: [{
  57761. name: "select",
  57762. children,
  57763. attributes: selectAttributes
  57764. }]
  57765. });
  57766. }
  57767. }
  57768. class Color extends _xfa_object.XFAObject {
  57769. constructor(attributes) {
  57770. super(TEMPLATE_NS_ID, "color", true);
  57771. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  57772. this.id = attributes.id || "";
  57773. this.use = attributes.use || "";
  57774. this.usehref = attributes.usehref || "";
  57775. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  57776. this.extras = null;
  57777. }
  57778. [_xfa_object.$hasSettableValue]() {
  57779. return false;
  57780. }
  57781. [_xfa_object.$toStyle]() {
  57782. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  57783. }
  57784. }
  57785. class Comb extends _xfa_object.XFAObject {
  57786. constructor(attributes) {
  57787. super(TEMPLATE_NS_ID, "comb");
  57788. this.id = attributes.id || "";
  57789. this.numberOfCells = (0, _utils.getInteger)({
  57790. data: attributes.numberOfCells,
  57791. defaultValue: 0,
  57792. validate: x => x >= 0
  57793. });
  57794. this.use = attributes.use || "";
  57795. this.usehref = attributes.usehref || "";
  57796. }
  57797. }
  57798. class Connect extends _xfa_object.XFAObject {
  57799. constructor(attributes) {
  57800. super(TEMPLATE_NS_ID, "connect", true);
  57801. this.connection = attributes.connection || "";
  57802. this.id = attributes.id || "";
  57803. this.ref = attributes.ref || "";
  57804. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  57805. this.use = attributes.use || "";
  57806. this.usehref = attributes.usehref || "";
  57807. this.picture = null;
  57808. }
  57809. }
  57810. class ContentArea extends _xfa_object.XFAObject {
  57811. constructor(attributes) {
  57812. super(TEMPLATE_NS_ID, "contentArea", true);
  57813. this.h = (0, _utils.getMeasurement)(attributes.h);
  57814. this.id = attributes.id || "";
  57815. this.name = attributes.name || "";
  57816. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  57817. this.use = attributes.use || "";
  57818. this.usehref = attributes.usehref || "";
  57819. this.w = (0, _utils.getMeasurement)(attributes.w);
  57820. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  57821. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  57822. this.desc = null;
  57823. this.extras = null;
  57824. }
  57825. [_xfa_object.$toHTML](availableSpace) {
  57826. const left = (0, _html_utils.measureToString)(this.x);
  57827. const top = (0, _html_utils.measureToString)(this.y);
  57828. const style = {
  57829. left,
  57830. top,
  57831. width: (0, _html_utils.measureToString)(this.w),
  57832. height: (0, _html_utils.measureToString)(this.h)
  57833. };
  57834. const classNames = ["xfaContentarea"];
  57835. if ((0, _html_utils.isPrintOnly)(this)) {
  57836. classNames.push("xfaPrintOnly");
  57837. }
  57838. return _utils.HTMLResult.success({
  57839. name: "div",
  57840. children: [],
  57841. attributes: {
  57842. style,
  57843. class: classNames,
  57844. id: this[_xfa_object.$uid]
  57845. }
  57846. });
  57847. }
  57848. }
  57849. class Corner extends _xfa_object.XFAObject {
  57850. constructor(attributes) {
  57851. super(TEMPLATE_NS_ID, "corner", true);
  57852. this.id = attributes.id || "";
  57853. this.inverted = (0, _utils.getInteger)({
  57854. data: attributes.inverted,
  57855. defaultValue: 0,
  57856. validate: x => x === 1
  57857. });
  57858. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  57859. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  57860. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  57861. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  57862. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  57863. this.use = attributes.use || "";
  57864. this.usehref = attributes.usehref || "";
  57865. this.color = null;
  57866. this.extras = null;
  57867. }
  57868. [_xfa_object.$toStyle]() {
  57869. const style = (0, _html_utils.toStyle)(this, "visibility");
  57870. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  57871. return style;
  57872. }
  57873. }
  57874. class DateElement extends _xfa_object.ContentObject {
  57875. constructor(attributes) {
  57876. super(TEMPLATE_NS_ID, "date");
  57877. this.id = attributes.id || "";
  57878. this.name = attributes.name || "";
  57879. this.use = attributes.use || "";
  57880. this.usehref = attributes.usehref || "";
  57881. }
  57882. [_xfa_object.$finalize]() {
  57883. const date = this[_xfa_object.$content].trim();
  57884. this[_xfa_object.$content] = date ? new Date(date) : null;
  57885. }
  57886. [_xfa_object.$toHTML](availableSpace) {
  57887. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  57888. }
  57889. }
  57890. class DateTime extends _xfa_object.ContentObject {
  57891. constructor(attributes) {
  57892. super(TEMPLATE_NS_ID, "dateTime");
  57893. this.id = attributes.id || "";
  57894. this.name = attributes.name || "";
  57895. this.use = attributes.use || "";
  57896. this.usehref = attributes.usehref || "";
  57897. }
  57898. [_xfa_object.$finalize]() {
  57899. const date = this[_xfa_object.$content].trim();
  57900. this[_xfa_object.$content] = date ? new Date(date) : null;
  57901. }
  57902. [_xfa_object.$toHTML](availableSpace) {
  57903. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  57904. }
  57905. }
  57906. class DateTimeEdit extends _xfa_object.XFAObject {
  57907. constructor(attributes) {
  57908. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  57909. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  57910. this.id = attributes.id || "";
  57911. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  57912. this.use = attributes.use || "";
  57913. this.usehref = attributes.usehref || "";
  57914. this.border = null;
  57915. this.comb = null;
  57916. this.extras = null;
  57917. this.margin = null;
  57918. }
  57919. [_xfa_object.$toHTML](availableSpace) {
  57920. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  57921. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  57922. const html = {
  57923. name: "input",
  57924. attributes: {
  57925. type: "text",
  57926. fieldId: field[_xfa_object.$uid],
  57927. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  57928. class: ["xfaTextfield"],
  57929. style,
  57930. "aria-label": ariaLabel(field),
  57931. "aria-required": false
  57932. }
  57933. };
  57934. if (isRequired(field)) {
  57935. html.attributes["aria-required"] = true;
  57936. html.attributes.required = true;
  57937. }
  57938. return _utils.HTMLResult.success({
  57939. name: "label",
  57940. attributes: {
  57941. class: ["xfaLabel"]
  57942. },
  57943. children: [html]
  57944. });
  57945. }
  57946. }
  57947. class Decimal extends _xfa_object.ContentObject {
  57948. constructor(attributes) {
  57949. super(TEMPLATE_NS_ID, "decimal");
  57950. this.fracDigits = (0, _utils.getInteger)({
  57951. data: attributes.fracDigits,
  57952. defaultValue: 2,
  57953. validate: x => true
  57954. });
  57955. this.id = attributes.id || "";
  57956. this.leadDigits = (0, _utils.getInteger)({
  57957. data: attributes.leadDigits,
  57958. defaultValue: -1,
  57959. validate: x => true
  57960. });
  57961. this.name = attributes.name || "";
  57962. this.use = attributes.use || "";
  57963. this.usehref = attributes.usehref || "";
  57964. }
  57965. [_xfa_object.$finalize]() {
  57966. const number = parseFloat(this[_xfa_object.$content].trim());
  57967. this[_xfa_object.$content] = isNaN(number) ? null : number;
  57968. }
  57969. [_xfa_object.$toHTML](availableSpace) {
  57970. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  57971. }
  57972. }
  57973. class DefaultUi extends _xfa_object.XFAObject {
  57974. constructor(attributes) {
  57975. super(TEMPLATE_NS_ID, "defaultUi", true);
  57976. this.id = attributes.id || "";
  57977. this.use = attributes.use || "";
  57978. this.usehref = attributes.usehref || "";
  57979. this.extras = null;
  57980. }
  57981. }
  57982. class Desc extends _xfa_object.XFAObject {
  57983. constructor(attributes) {
  57984. super(TEMPLATE_NS_ID, "desc", true);
  57985. this.id = attributes.id || "";
  57986. this.use = attributes.use || "";
  57987. this.usehref = attributes.usehref || "";
  57988. this.boolean = new _xfa_object.XFAObjectArray();
  57989. this.date = new _xfa_object.XFAObjectArray();
  57990. this.dateTime = new _xfa_object.XFAObjectArray();
  57991. this.decimal = new _xfa_object.XFAObjectArray();
  57992. this.exData = new _xfa_object.XFAObjectArray();
  57993. this.float = new _xfa_object.XFAObjectArray();
  57994. this.image = new _xfa_object.XFAObjectArray();
  57995. this.integer = new _xfa_object.XFAObjectArray();
  57996. this.text = new _xfa_object.XFAObjectArray();
  57997. this.time = new _xfa_object.XFAObjectArray();
  57998. }
  57999. }
  58000. class DigestMethod extends _xfa_object.OptionObject {
  58001. constructor(attributes) {
  58002. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  58003. this.id = attributes.id || "";
  58004. this.use = attributes.use || "";
  58005. this.usehref = attributes.usehref || "";
  58006. }
  58007. }
  58008. class DigestMethods extends _xfa_object.XFAObject {
  58009. constructor(attributes) {
  58010. super(TEMPLATE_NS_ID, "digestMethods", true);
  58011. this.id = attributes.id || "";
  58012. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58013. this.use = attributes.use || "";
  58014. this.usehref = attributes.usehref || "";
  58015. this.digestMethod = new _xfa_object.XFAObjectArray();
  58016. }
  58017. }
  58018. class Draw extends _xfa_object.XFAObject {
  58019. constructor(attributes) {
  58020. super(TEMPLATE_NS_ID, "draw", true);
  58021. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58022. this.colSpan = (0, _utils.getInteger)({
  58023. data: attributes.colSpan,
  58024. defaultValue: 1,
  58025. validate: n => n >= 1 || n === -1
  58026. });
  58027. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58028. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58029. this.id = attributes.id || "";
  58030. this.locale = attributes.locale || "";
  58031. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58032. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58033. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58034. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58035. this.name = attributes.name || "";
  58036. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58037. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58038. this.rotate = (0, _utils.getInteger)({
  58039. data: attributes.rotate,
  58040. defaultValue: 0,
  58041. validate: x => x % 90 === 0
  58042. });
  58043. this.use = attributes.use || "";
  58044. this.usehref = attributes.usehref || "";
  58045. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58046. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58047. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58048. this.assist = null;
  58049. this.border = null;
  58050. this.caption = null;
  58051. this.desc = null;
  58052. this.extras = null;
  58053. this.font = null;
  58054. this.keep = null;
  58055. this.margin = null;
  58056. this.para = null;
  58057. this.traversal = null;
  58058. this.ui = null;
  58059. this.value = null;
  58060. this.setProperty = new _xfa_object.XFAObjectArray();
  58061. }
  58062. [_xfa_object.$setValue](value) {
  58063. _setValue(this, value);
  58064. }
  58065. [_xfa_object.$toHTML](availableSpace) {
  58066. setTabIndex(this);
  58067. if (this.presence === "hidden" || this.presence === "inactive") {
  58068. return _utils.HTMLResult.EMPTY;
  58069. }
  58070. (0, _html_utils.fixDimensions)(this);
  58071. this[_xfa_object.$pushPara]();
  58072. const savedW = this.w;
  58073. const savedH = this.h;
  58074. const {
  58075. w,
  58076. h,
  58077. isBroken
  58078. } = (0, _html_utils.layoutNode)(this, availableSpace);
  58079. if (w && this.w === "") {
  58080. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  58081. this[_xfa_object.$popPara]();
  58082. return _utils.HTMLResult.FAILURE;
  58083. }
  58084. this.w = w;
  58085. }
  58086. if (h && this.h === "") {
  58087. this.h = h;
  58088. }
  58089. setFirstUnsplittable(this);
  58090. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58091. this.w = savedW;
  58092. this.h = savedH;
  58093. this[_xfa_object.$popPara]();
  58094. return _utils.HTMLResult.FAILURE;
  58095. }
  58096. unsetFirstUnsplittable(this);
  58097. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  58098. (0, _html_utils.setMinMaxDimensions)(this, style);
  58099. if (style.margin) {
  58100. style.padding = style.margin;
  58101. delete style.margin;
  58102. }
  58103. const classNames = ["xfaDraw"];
  58104. if (this.font) {
  58105. classNames.push("xfaFont");
  58106. }
  58107. if ((0, _html_utils.isPrintOnly)(this)) {
  58108. classNames.push("xfaPrintOnly");
  58109. }
  58110. const attributes = {
  58111. style,
  58112. id: this[_xfa_object.$uid],
  58113. class: classNames
  58114. };
  58115. if (this.name) {
  58116. attributes.xfaName = this.name;
  58117. }
  58118. const html = {
  58119. name: "div",
  58120. attributes,
  58121. children: []
  58122. };
  58123. applyAssist(this, attributes);
  58124. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  58125. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  58126. if (value === null) {
  58127. this.w = savedW;
  58128. this.h = savedH;
  58129. this[_xfa_object.$popPara]();
  58130. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58131. }
  58132. html.children.push(value);
  58133. (0, _html_utils.setPara)(this, style, value);
  58134. this.w = savedW;
  58135. this.h = savedH;
  58136. this[_xfa_object.$popPara]();
  58137. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58138. }
  58139. }
  58140. class Edge extends _xfa_object.XFAObject {
  58141. constructor(attributes) {
  58142. super(TEMPLATE_NS_ID, "edge", true);
  58143. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  58144. this.id = attributes.id || "";
  58145. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58146. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  58147. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  58148. this.use = attributes.use || "";
  58149. this.usehref = attributes.usehref || "";
  58150. this.color = null;
  58151. this.extras = null;
  58152. }
  58153. [_xfa_object.$toStyle]() {
  58154. const style = (0, _html_utils.toStyle)(this, "visibility");
  58155. Object.assign(style, {
  58156. linecap: this.cap,
  58157. width: (0, _html_utils.measureToString)(this.thickness),
  58158. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  58159. style: ""
  58160. });
  58161. if (this.presence !== "visible") {
  58162. style.style = "none";
  58163. } else {
  58164. switch (this.stroke) {
  58165. case "solid":
  58166. style.style = "solid";
  58167. break;
  58168. case "dashDot":
  58169. style.style = "dashed";
  58170. break;
  58171. case "dashDotDot":
  58172. style.style = "dashed";
  58173. break;
  58174. case "dashed":
  58175. style.style = "dashed";
  58176. break;
  58177. case "dotted":
  58178. style.style = "dotted";
  58179. break;
  58180. case "embossed":
  58181. style.style = "ridge";
  58182. break;
  58183. case "etched":
  58184. style.style = "groove";
  58185. break;
  58186. case "lowered":
  58187. style.style = "inset";
  58188. break;
  58189. case "raised":
  58190. style.style = "outset";
  58191. break;
  58192. }
  58193. }
  58194. return style;
  58195. }
  58196. }
  58197. class Encoding extends _xfa_object.OptionObject {
  58198. constructor(attributes) {
  58199. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  58200. this.id = attributes.id || "";
  58201. this.use = attributes.use || "";
  58202. this.usehref = attributes.usehref || "";
  58203. }
  58204. }
  58205. class Encodings extends _xfa_object.XFAObject {
  58206. constructor(attributes) {
  58207. super(TEMPLATE_NS_ID, "encodings", true);
  58208. this.id = attributes.id || "";
  58209. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58210. this.use = attributes.use || "";
  58211. this.usehref = attributes.usehref || "";
  58212. this.encoding = new _xfa_object.XFAObjectArray();
  58213. }
  58214. }
  58215. class Encrypt extends _xfa_object.XFAObject {
  58216. constructor(attributes) {
  58217. super(TEMPLATE_NS_ID, "encrypt", true);
  58218. this.id = attributes.id || "";
  58219. this.use = attributes.use || "";
  58220. this.usehref = attributes.usehref || "";
  58221. this.certificate = null;
  58222. }
  58223. }
  58224. class EncryptData extends _xfa_object.XFAObject {
  58225. constructor(attributes) {
  58226. super(TEMPLATE_NS_ID, "encryptData", true);
  58227. this.id = attributes.id || "";
  58228. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  58229. this.target = attributes.target || "";
  58230. this.use = attributes.use || "";
  58231. this.usehref = attributes.usehref || "";
  58232. this.filter = null;
  58233. this.manifest = null;
  58234. }
  58235. }
  58236. class Encryption extends _xfa_object.XFAObject {
  58237. constructor(attributes) {
  58238. super(TEMPLATE_NS_ID, "encryption", true);
  58239. this.id = attributes.id || "";
  58240. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58241. this.use = attributes.use || "";
  58242. this.usehref = attributes.usehref || "";
  58243. this.certificate = new _xfa_object.XFAObjectArray();
  58244. }
  58245. }
  58246. class EncryptionMethod extends _xfa_object.OptionObject {
  58247. constructor(attributes) {
  58248. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  58249. this.id = attributes.id || "";
  58250. this.use = attributes.use || "";
  58251. this.usehref = attributes.usehref || "";
  58252. }
  58253. }
  58254. class EncryptionMethods extends _xfa_object.XFAObject {
  58255. constructor(attributes) {
  58256. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  58257. this.id = attributes.id || "";
  58258. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  58259. this.use = attributes.use || "";
  58260. this.usehref = attributes.usehref || "";
  58261. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  58262. }
  58263. }
  58264. class Event extends _xfa_object.XFAObject {
  58265. constructor(attributes) {
  58266. super(TEMPLATE_NS_ID, "event", true);
  58267. 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"]);
  58268. this.id = attributes.id || "";
  58269. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  58270. this.name = attributes.name || "";
  58271. this.ref = attributes.ref || "";
  58272. this.use = attributes.use || "";
  58273. this.usehref = attributes.usehref || "";
  58274. this.extras = null;
  58275. this.encryptData = null;
  58276. this.execute = null;
  58277. this.script = null;
  58278. this.signData = null;
  58279. this.submit = null;
  58280. }
  58281. }
  58282. class ExData extends _xfa_object.ContentObject {
  58283. constructor(attributes) {
  58284. super(TEMPLATE_NS_ID, "exData");
  58285. this.contentType = attributes.contentType || "";
  58286. this.href = attributes.href || "";
  58287. this.id = attributes.id || "";
  58288. this.maxLength = (0, _utils.getInteger)({
  58289. data: attributes.maxLength,
  58290. defaultValue: -1,
  58291. validate: x => x >= -1
  58292. });
  58293. this.name = attributes.name || "";
  58294. this.rid = attributes.rid || "";
  58295. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  58296. this.use = attributes.use || "";
  58297. this.usehref = attributes.usehref || "";
  58298. }
  58299. [_xfa_object.$isCDATAXml]() {
  58300. return this.contentType === "text/html";
  58301. }
  58302. [_xfa_object.$onChild](child) {
  58303. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  58304. this[_xfa_object.$content] = child;
  58305. return true;
  58306. }
  58307. if (this.contentType === "text/xml") {
  58308. this[_xfa_object.$content] = child;
  58309. return true;
  58310. }
  58311. return false;
  58312. }
  58313. [_xfa_object.$toHTML](availableSpace) {
  58314. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  58315. return _utils.HTMLResult.EMPTY;
  58316. }
  58317. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  58318. }
  58319. }
  58320. class ExObject extends _xfa_object.XFAObject {
  58321. constructor(attributes) {
  58322. super(TEMPLATE_NS_ID, "exObject", true);
  58323. this.archive = attributes.archive || "";
  58324. this.classId = attributes.classId || "";
  58325. this.codeBase = attributes.codeBase || "";
  58326. this.codeType = attributes.codeType || "";
  58327. this.id = attributes.id || "";
  58328. this.name = attributes.name || "";
  58329. this.use = attributes.use || "";
  58330. this.usehref = attributes.usehref || "";
  58331. this.extras = null;
  58332. this.boolean = new _xfa_object.XFAObjectArray();
  58333. this.date = new _xfa_object.XFAObjectArray();
  58334. this.dateTime = new _xfa_object.XFAObjectArray();
  58335. this.decimal = new _xfa_object.XFAObjectArray();
  58336. this.exData = new _xfa_object.XFAObjectArray();
  58337. this.exObject = new _xfa_object.XFAObjectArray();
  58338. this.float = new _xfa_object.XFAObjectArray();
  58339. this.image = new _xfa_object.XFAObjectArray();
  58340. this.integer = new _xfa_object.XFAObjectArray();
  58341. this.text = new _xfa_object.XFAObjectArray();
  58342. this.time = new _xfa_object.XFAObjectArray();
  58343. }
  58344. }
  58345. class ExclGroup extends _xfa_object.XFAObject {
  58346. constructor(attributes) {
  58347. super(TEMPLATE_NS_ID, "exclGroup", true);
  58348. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  58349. this.accessKey = attributes.accessKey || "";
  58350. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58351. this.colSpan = (0, _utils.getInteger)({
  58352. data: attributes.colSpan,
  58353. defaultValue: 1,
  58354. validate: n => n >= 1 || n === -1
  58355. });
  58356. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58357. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58358. this.id = attributes.id || "";
  58359. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  58360. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58361. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58362. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58363. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58364. this.name = attributes.name || "";
  58365. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58366. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58367. this.use = attributes.use || "";
  58368. this.usehref = attributes.usehref || "";
  58369. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58370. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58371. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58372. this.assist = null;
  58373. this.bind = null;
  58374. this.border = null;
  58375. this.calculate = null;
  58376. this.caption = null;
  58377. this.desc = null;
  58378. this.extras = null;
  58379. this.margin = null;
  58380. this.para = null;
  58381. this.traversal = null;
  58382. this.validate = null;
  58383. this.connect = new _xfa_object.XFAObjectArray();
  58384. this.event = new _xfa_object.XFAObjectArray();
  58385. this.field = new _xfa_object.XFAObjectArray();
  58386. this.setProperty = new _xfa_object.XFAObjectArray();
  58387. }
  58388. [_xfa_object.$isBindable]() {
  58389. return true;
  58390. }
  58391. [_xfa_object.$hasSettableValue]() {
  58392. return true;
  58393. }
  58394. [_xfa_object.$setValue](value) {
  58395. for (const field of this.field.children) {
  58396. if (!field.value) {
  58397. const nodeValue = new Value({});
  58398. field[_xfa_object.$appendChild](nodeValue);
  58399. field.value = nodeValue;
  58400. }
  58401. field.value[_xfa_object.$setValue](value);
  58402. }
  58403. }
  58404. [_xfa_object.$isThereMoreWidth]() {
  58405. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  58406. }
  58407. [_xfa_object.$isSplittable]() {
  58408. const parent = this[_xfa_object.$getSubformParent]();
  58409. if (!parent[_xfa_object.$isSplittable]()) {
  58410. return false;
  58411. }
  58412. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  58413. return this[_xfa_object.$extra]._isSplittable;
  58414. }
  58415. if (this.layout === "position" || this.layout.includes("row")) {
  58416. this[_xfa_object.$extra]._isSplittable = false;
  58417. return false;
  58418. }
  58419. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  58420. return false;
  58421. }
  58422. this[_xfa_object.$extra]._isSplittable = true;
  58423. return true;
  58424. }
  58425. [_xfa_object.$flushHTML]() {
  58426. return (0, _layout.flushHTML)(this);
  58427. }
  58428. [_xfa_object.$addHTML](html, bbox) {
  58429. (0, _layout.addHTML)(this, html, bbox);
  58430. }
  58431. [_xfa_object.$getAvailableSpace]() {
  58432. return (0, _layout.getAvailableSpace)(this);
  58433. }
  58434. [_xfa_object.$toHTML](availableSpace) {
  58435. setTabIndex(this);
  58436. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  58437. return _utils.HTMLResult.EMPTY;
  58438. }
  58439. (0, _html_utils.fixDimensions)(this);
  58440. const children = [];
  58441. const attributes = {
  58442. id: this[_xfa_object.$uid],
  58443. class: []
  58444. };
  58445. (0, _html_utils.setAccess)(this, attributes.class);
  58446. if (!this[_xfa_object.$extra]) {
  58447. this[_xfa_object.$extra] = Object.create(null);
  58448. }
  58449. Object.assign(this[_xfa_object.$extra], {
  58450. children,
  58451. attributes,
  58452. attempt: 0,
  58453. line: null,
  58454. numberInLine: 0,
  58455. availableSpace: {
  58456. width: Math.min(this.w || Infinity, availableSpace.width),
  58457. height: Math.min(this.h || Infinity, availableSpace.height)
  58458. },
  58459. width: 0,
  58460. height: 0,
  58461. prevHeight: 0,
  58462. currentWidth: 0
  58463. });
  58464. const isSplittable = this[_xfa_object.$isSplittable]();
  58465. if (!isSplittable) {
  58466. setFirstUnsplittable(this);
  58467. }
  58468. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58469. return _utils.HTMLResult.FAILURE;
  58470. }
  58471. const filter = new Set(["field"]);
  58472. if (this.layout.includes("row")) {
  58473. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  58474. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  58475. this[_xfa_object.$extra].columnWidths = columnWidths;
  58476. this[_xfa_object.$extra].currentColumn = 0;
  58477. }
  58478. }
  58479. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  58480. const classNames = ["xfaExclgroup"];
  58481. const cl = (0, _html_utils.layoutClass)(this);
  58482. if (cl) {
  58483. classNames.push(cl);
  58484. }
  58485. if ((0, _html_utils.isPrintOnly)(this)) {
  58486. classNames.push("xfaPrintOnly");
  58487. }
  58488. attributes.style = style;
  58489. attributes.class = classNames;
  58490. if (this.name) {
  58491. attributes.xfaName = this.name;
  58492. }
  58493. this[_xfa_object.$pushPara]();
  58494. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  58495. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  58496. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  58497. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  58498. this[_xfa_object.$extra].numberInLine = 0;
  58499. }
  58500. const result = this[_xfa_object.$childrenToHTML]({
  58501. filter,
  58502. include: true
  58503. });
  58504. if (result.success) {
  58505. break;
  58506. }
  58507. if (result.isBreak()) {
  58508. this[_xfa_object.$popPara]();
  58509. return result;
  58510. }
  58511. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  58512. this[_xfa_object.$extra].attempt = maxRun;
  58513. break;
  58514. }
  58515. }
  58516. this[_xfa_object.$popPara]();
  58517. if (!isSplittable) {
  58518. unsetFirstUnsplittable(this);
  58519. }
  58520. if (this[_xfa_object.$extra].attempt === maxRun) {
  58521. if (!isSplittable) {
  58522. delete this[_xfa_object.$extra];
  58523. }
  58524. return _utils.HTMLResult.FAILURE;
  58525. }
  58526. let marginH = 0;
  58527. let marginV = 0;
  58528. if (this.margin) {
  58529. marginH = this.margin.leftInset + this.margin.rightInset;
  58530. marginV = this.margin.topInset + this.margin.bottomInset;
  58531. }
  58532. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  58533. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  58534. const bbox = [this.x, this.y, width, height];
  58535. if (this.w === "") {
  58536. style.width = (0, _html_utils.measureToString)(width);
  58537. }
  58538. if (this.h === "") {
  58539. style.height = (0, _html_utils.measureToString)(height);
  58540. }
  58541. const html = {
  58542. name: "div",
  58543. attributes,
  58544. children
  58545. };
  58546. applyAssist(this, attributes);
  58547. delete this[_xfa_object.$extra];
  58548. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58549. }
  58550. }
  58551. class Execute extends _xfa_object.XFAObject {
  58552. constructor(attributes) {
  58553. super(TEMPLATE_NS_ID, "execute");
  58554. this.connection = attributes.connection || "";
  58555. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  58556. this.id = attributes.id || "";
  58557. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  58558. this.use = attributes.use || "";
  58559. this.usehref = attributes.usehref || "";
  58560. }
  58561. }
  58562. class Extras extends _xfa_object.XFAObject {
  58563. constructor(attributes) {
  58564. super(TEMPLATE_NS_ID, "extras", true);
  58565. this.id = attributes.id || "";
  58566. this.name = attributes.name || "";
  58567. this.use = attributes.use || "";
  58568. this.usehref = attributes.usehref || "";
  58569. this.boolean = new _xfa_object.XFAObjectArray();
  58570. this.date = new _xfa_object.XFAObjectArray();
  58571. this.dateTime = new _xfa_object.XFAObjectArray();
  58572. this.decimal = new _xfa_object.XFAObjectArray();
  58573. this.exData = new _xfa_object.XFAObjectArray();
  58574. this.extras = new _xfa_object.XFAObjectArray();
  58575. this.float = new _xfa_object.XFAObjectArray();
  58576. this.image = new _xfa_object.XFAObjectArray();
  58577. this.integer = new _xfa_object.XFAObjectArray();
  58578. this.text = new _xfa_object.XFAObjectArray();
  58579. this.time = new _xfa_object.XFAObjectArray();
  58580. }
  58581. }
  58582. class Field extends _xfa_object.XFAObject {
  58583. constructor(attributes) {
  58584. super(TEMPLATE_NS_ID, "field", true);
  58585. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  58586. this.accessKey = attributes.accessKey || "";
  58587. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  58588. this.colSpan = (0, _utils.getInteger)({
  58589. data: attributes.colSpan,
  58590. defaultValue: 1,
  58591. validate: n => n >= 1 || n === -1
  58592. });
  58593. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  58594. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  58595. this.id = attributes.id || "";
  58596. this.locale = attributes.locale || "";
  58597. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  58598. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  58599. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  58600. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  58601. this.name = attributes.name || "";
  58602. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58603. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  58604. this.rotate = (0, _utils.getInteger)({
  58605. data: attributes.rotate,
  58606. defaultValue: 0,
  58607. validate: x => x % 90 === 0
  58608. });
  58609. this.use = attributes.use || "";
  58610. this.usehref = attributes.usehref || "";
  58611. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  58612. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  58613. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  58614. this.assist = null;
  58615. this.bind = null;
  58616. this.border = null;
  58617. this.calculate = null;
  58618. this.caption = null;
  58619. this.desc = null;
  58620. this.extras = null;
  58621. this.font = null;
  58622. this.format = null;
  58623. this.items = new _xfa_object.XFAObjectArray(2);
  58624. this.keep = null;
  58625. this.margin = null;
  58626. this.para = null;
  58627. this.traversal = null;
  58628. this.ui = null;
  58629. this.validate = null;
  58630. this.value = null;
  58631. this.bindItems = new _xfa_object.XFAObjectArray();
  58632. this.connect = new _xfa_object.XFAObjectArray();
  58633. this.event = new _xfa_object.XFAObjectArray();
  58634. this.setProperty = new _xfa_object.XFAObjectArray();
  58635. }
  58636. [_xfa_object.$isBindable]() {
  58637. return true;
  58638. }
  58639. [_xfa_object.$setValue](value) {
  58640. _setValue(this, value);
  58641. }
  58642. [_xfa_object.$toHTML](availableSpace) {
  58643. setTabIndex(this);
  58644. if (!this.ui) {
  58645. this.ui = new Ui({});
  58646. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  58647. this[_xfa_object.$appendChild](this.ui);
  58648. let node;
  58649. switch (this.items.children.length) {
  58650. case 0:
  58651. node = new TextEdit({});
  58652. this.ui.textEdit = node;
  58653. break;
  58654. case 1:
  58655. node = new CheckButton({});
  58656. this.ui.checkButton = node;
  58657. break;
  58658. case 2:
  58659. node = new ChoiceList({});
  58660. this.ui.choiceList = node;
  58661. break;
  58662. }
  58663. this.ui[_xfa_object.$appendChild](node);
  58664. }
  58665. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  58666. return _utils.HTMLResult.EMPTY;
  58667. }
  58668. if (this.caption) {
  58669. delete this.caption[_xfa_object.$extra];
  58670. }
  58671. this[_xfa_object.$pushPara]();
  58672. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  58673. const savedW = this.w;
  58674. const savedH = this.h;
  58675. let marginH = 0;
  58676. let marginV = 0;
  58677. if (this.margin) {
  58678. marginH = this.margin.leftInset + this.margin.rightInset;
  58679. marginV = this.margin.topInset + this.margin.bottomInset;
  58680. }
  58681. let borderDims = null;
  58682. if (this.w === "" || this.h === "") {
  58683. let width = null;
  58684. let height = null;
  58685. let uiW = 0;
  58686. let uiH = 0;
  58687. if (this.ui.checkButton) {
  58688. uiW = uiH = this.ui.checkButton.size;
  58689. } else {
  58690. const {
  58691. w,
  58692. h
  58693. } = (0, _html_utils.layoutNode)(this, availableSpace);
  58694. if (w !== null) {
  58695. uiW = w;
  58696. uiH = h;
  58697. } else {
  58698. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  58699. }
  58700. }
  58701. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  58702. uiW += borderDims.w;
  58703. uiH += borderDims.h;
  58704. if (this.caption) {
  58705. const {
  58706. w,
  58707. h,
  58708. isBroken
  58709. } = this.caption[_xfa_object.$getExtra](availableSpace);
  58710. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  58711. this[_xfa_object.$popPara]();
  58712. return _utils.HTMLResult.FAILURE;
  58713. }
  58714. width = w;
  58715. height = h;
  58716. switch (this.caption.placement) {
  58717. case "left":
  58718. case "right":
  58719. case "inline":
  58720. width += uiW;
  58721. break;
  58722. case "top":
  58723. case "bottom":
  58724. height += uiH;
  58725. break;
  58726. }
  58727. } else {
  58728. width = uiW;
  58729. height = uiH;
  58730. }
  58731. if (width && this.w === "") {
  58732. width += marginH;
  58733. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  58734. }
  58735. if (height && this.h === "") {
  58736. height += marginV;
  58737. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  58738. }
  58739. }
  58740. this[_xfa_object.$popPara]();
  58741. (0, _html_utils.fixDimensions)(this);
  58742. setFirstUnsplittable(this);
  58743. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  58744. this.w = savedW;
  58745. this.h = savedH;
  58746. this[_xfa_object.$popPara]();
  58747. return _utils.HTMLResult.FAILURE;
  58748. }
  58749. unsetFirstUnsplittable(this);
  58750. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  58751. (0, _html_utils.setMinMaxDimensions)(this, style);
  58752. const classNames = ["xfaField"];
  58753. if (this.font) {
  58754. classNames.push("xfaFont");
  58755. }
  58756. if ((0, _html_utils.isPrintOnly)(this)) {
  58757. classNames.push("xfaPrintOnly");
  58758. }
  58759. const attributes = {
  58760. style,
  58761. id: this[_xfa_object.$uid],
  58762. class: classNames
  58763. };
  58764. if (style.margin) {
  58765. style.padding = style.margin;
  58766. delete style.margin;
  58767. }
  58768. (0, _html_utils.setAccess)(this, classNames);
  58769. if (this.name) {
  58770. attributes.xfaName = this.name;
  58771. }
  58772. const children = [];
  58773. const html = {
  58774. name: "div",
  58775. attributes,
  58776. children
  58777. };
  58778. applyAssist(this, attributes);
  58779. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  58780. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  58781. const ui = this.ui[_xfa_object.$toHTML]().html;
  58782. if (!ui) {
  58783. Object.assign(style, borderStyle);
  58784. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58785. }
  58786. if (this[_xfa_object.$tabIndex]) {
  58787. if (ui.children && ui.children[0]) {
  58788. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  58789. } else {
  58790. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  58791. }
  58792. }
  58793. if (!ui.attributes.style) {
  58794. ui.attributes.style = Object.create(null);
  58795. }
  58796. let aElement = null;
  58797. if (this.ui.button) {
  58798. if (ui.children.length === 1) {
  58799. [aElement] = ui.children.splice(0, 1);
  58800. }
  58801. Object.assign(ui.attributes.style, borderStyle);
  58802. } else {
  58803. Object.assign(style, borderStyle);
  58804. }
  58805. children.push(ui);
  58806. if (this.value) {
  58807. if (this.ui.imageEdit) {
  58808. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  58809. } else if (!this.ui.button) {
  58810. let value = "";
  58811. if (this.value.exData) {
  58812. value = this.value.exData[_xfa_object.$text]();
  58813. } else if (this.value.text) {
  58814. value = this.value.text[_xfa_object.$getExtra]();
  58815. } else {
  58816. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  58817. if (htmlValue !== null) {
  58818. value = htmlValue.children[0].value;
  58819. }
  58820. }
  58821. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  58822. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  58823. }
  58824. if (value) {
  58825. if (this.ui.numericEdit) {
  58826. value = parseFloat(value);
  58827. value = isNaN(value) ? "" : value.toString();
  58828. }
  58829. if (ui.children[0].name === "textarea") {
  58830. ui.children[0].attributes.textContent = value;
  58831. } else {
  58832. ui.children[0].attributes.value = value;
  58833. }
  58834. }
  58835. }
  58836. }
  58837. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  58838. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  58839. let captionHeight = 0;
  58840. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  58841. captionHeight = this.caption.reserve;
  58842. if (captionHeight <= 0) {
  58843. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  58844. }
  58845. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  58846. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  58847. } else {
  58848. ui.children[0].attributes.style.height = "100%";
  58849. }
  58850. }
  58851. if (aElement) {
  58852. ui.children.push(aElement);
  58853. }
  58854. if (!caption) {
  58855. if (ui.attributes.class) {
  58856. ui.attributes.class.push("xfaLeft");
  58857. }
  58858. this.w = savedW;
  58859. this.h = savedH;
  58860. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58861. }
  58862. if (this.ui.button) {
  58863. if (style.padding) {
  58864. delete style.padding;
  58865. }
  58866. if (caption.name === "div") {
  58867. caption.name = "span";
  58868. }
  58869. ui.children.push(caption);
  58870. return _utils.HTMLResult.success(html, bbox);
  58871. } else if (this.ui.checkButton) {
  58872. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  58873. }
  58874. if (!ui.attributes.class) {
  58875. ui.attributes.class = [];
  58876. }
  58877. ui.children.splice(0, 0, caption);
  58878. switch (this.caption.placement) {
  58879. case "left":
  58880. ui.attributes.class.push("xfaLeft");
  58881. break;
  58882. case "right":
  58883. ui.attributes.class.push("xfaRight");
  58884. break;
  58885. case "top":
  58886. ui.attributes.class.push("xfaTop");
  58887. break;
  58888. case "bottom":
  58889. ui.attributes.class.push("xfaBottom");
  58890. break;
  58891. case "inline":
  58892. ui.attributes.class.push("xfaLeft");
  58893. break;
  58894. }
  58895. this.w = savedW;
  58896. this.h = savedH;
  58897. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  58898. }
  58899. }
  58900. exports.Field = Field;
  58901. class Fill extends _xfa_object.XFAObject {
  58902. constructor(attributes) {
  58903. super(TEMPLATE_NS_ID, "fill", true);
  58904. this.id = attributes.id || "";
  58905. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  58906. this.use = attributes.use || "";
  58907. this.usehref = attributes.usehref || "";
  58908. this.color = null;
  58909. this.extras = null;
  58910. this.linear = null;
  58911. this.pattern = null;
  58912. this.radial = null;
  58913. this.solid = null;
  58914. this.stipple = null;
  58915. }
  58916. [_xfa_object.$toStyle]() {
  58917. const parent = this[_xfa_object.$getParent]();
  58918. const grandpa = parent[_xfa_object.$getParent]();
  58919. const ggrandpa = grandpa[_xfa_object.$getParent]();
  58920. const style = Object.create(null);
  58921. let propName = "color";
  58922. let altPropName = propName;
  58923. if (parent instanceof Border) {
  58924. propName = "background-color";
  58925. altPropName = "background";
  58926. if (ggrandpa instanceof Ui) {
  58927. style.backgroundColor = "white";
  58928. }
  58929. }
  58930. if (parent instanceof Rectangle || parent instanceof Arc) {
  58931. propName = altPropName = "fill";
  58932. style.fill = "white";
  58933. }
  58934. for (const name of Object.getOwnPropertyNames(this)) {
  58935. if (name === "extras" || name === "color") {
  58936. continue;
  58937. }
  58938. const obj = this[name];
  58939. if (!(obj instanceof _xfa_object.XFAObject)) {
  58940. continue;
  58941. }
  58942. const color = obj[_xfa_object.$toStyle](this.color);
  58943. if (color) {
  58944. style[color.startsWith("#") ? propName : altPropName] = color;
  58945. }
  58946. return style;
  58947. }
  58948. if (this.color && this.color.value) {
  58949. const color = this.color[_xfa_object.$toStyle]();
  58950. style[color.startsWith("#") ? propName : altPropName] = color;
  58951. }
  58952. return style;
  58953. }
  58954. }
  58955. class Filter extends _xfa_object.XFAObject {
  58956. constructor(attributes) {
  58957. super(TEMPLATE_NS_ID, "filter", true);
  58958. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  58959. this.id = attributes.id || "";
  58960. this.name = attributes.name || "";
  58961. this.use = attributes.use || "";
  58962. this.usehref = attributes.usehref || "";
  58963. this.version = (0, _utils.getInteger)({
  58964. data: this.version,
  58965. defaultValue: 5,
  58966. validate: x => x >= 1 && x <= 5
  58967. });
  58968. this.appearanceFilter = null;
  58969. this.certificates = null;
  58970. this.digestMethods = null;
  58971. this.encodings = null;
  58972. this.encryptionMethods = null;
  58973. this.handler = null;
  58974. this.lockDocument = null;
  58975. this.mdp = null;
  58976. this.reasons = null;
  58977. this.timeStamp = null;
  58978. }
  58979. }
  58980. class Float extends _xfa_object.ContentObject {
  58981. constructor(attributes) {
  58982. super(TEMPLATE_NS_ID, "float");
  58983. this.id = attributes.id || "";
  58984. this.name = attributes.name || "";
  58985. this.use = attributes.use || "";
  58986. this.usehref = attributes.usehref || "";
  58987. }
  58988. [_xfa_object.$finalize]() {
  58989. const number = parseFloat(this[_xfa_object.$content].trim());
  58990. this[_xfa_object.$content] = isNaN(number) ? null : number;
  58991. }
  58992. [_xfa_object.$toHTML](availableSpace) {
  58993. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  58994. }
  58995. }
  58996. class Font extends _xfa_object.XFAObject {
  58997. constructor(attributes) {
  58998. super(TEMPLATE_NS_ID, "font", true);
  58999. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  59000. this.fontHorizontalScale = (0, _utils.getFloat)({
  59001. data: attributes.fontHorizontalScale,
  59002. defaultValue: 100,
  59003. validate: x => x >= 0
  59004. });
  59005. this.fontVerticalScale = (0, _utils.getFloat)({
  59006. data: attributes.fontVerticalScale,
  59007. defaultValue: 100,
  59008. validate: x => x >= 0
  59009. });
  59010. this.id = attributes.id || "";
  59011. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  59012. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  59013. this.lineThrough = (0, _utils.getInteger)({
  59014. data: attributes.lineThrough,
  59015. defaultValue: 0,
  59016. validate: x => x === 1 || x === 2
  59017. });
  59018. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  59019. this.overline = (0, _utils.getInteger)({
  59020. data: attributes.overline,
  59021. defaultValue: 0,
  59022. validate: x => x === 1 || x === 2
  59023. });
  59024. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  59025. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  59026. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  59027. this.typeface = attributes.typeface || "Courier";
  59028. this.underline = (0, _utils.getInteger)({
  59029. data: attributes.underline,
  59030. defaultValue: 0,
  59031. validate: x => x === 1 || x === 2
  59032. });
  59033. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  59034. this.use = attributes.use || "";
  59035. this.usehref = attributes.usehref || "";
  59036. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  59037. this.extras = null;
  59038. this.fill = null;
  59039. }
  59040. [_xfa_object.$clean](builder) {
  59041. super[_xfa_object.$clean](builder);
  59042. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  59043. }
  59044. [_xfa_object.$toStyle]() {
  59045. const style = (0, _html_utils.toStyle)(this, "fill");
  59046. const color = style.color;
  59047. if (color) {
  59048. if (color === "#000000") {
  59049. delete style.color;
  59050. } else if (!color.startsWith("#")) {
  59051. style.background = color;
  59052. style.backgroundClip = "text";
  59053. style.color = "transparent";
  59054. }
  59055. }
  59056. if (this.baselineShift) {
  59057. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  59058. }
  59059. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  59060. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  59061. if (this.lineThrough !== 0) {
  59062. style.textDecoration = "line-through";
  59063. if (this.lineThrough === 2) {
  59064. style.textDecorationStyle = "double";
  59065. }
  59066. }
  59067. if (this.overline !== 0) {
  59068. style.textDecoration = "overline";
  59069. if (this.overline === 2) {
  59070. style.textDecorationStyle = "double";
  59071. }
  59072. }
  59073. style.fontStyle = this.posture;
  59074. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  59075. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  59076. if (this.underline !== 0) {
  59077. style.textDecoration = "underline";
  59078. if (this.underline === 2) {
  59079. style.textDecorationStyle = "double";
  59080. }
  59081. }
  59082. style.fontWeight = this.weight;
  59083. return style;
  59084. }
  59085. }
  59086. class Format extends _xfa_object.XFAObject {
  59087. constructor(attributes) {
  59088. super(TEMPLATE_NS_ID, "format", true);
  59089. this.id = attributes.id || "";
  59090. this.use = attributes.use || "";
  59091. this.usehref = attributes.usehref || "";
  59092. this.extras = null;
  59093. this.picture = null;
  59094. }
  59095. }
  59096. class Handler extends _xfa_object.StringObject {
  59097. constructor(attributes) {
  59098. super(TEMPLATE_NS_ID, "handler");
  59099. this.id = attributes.id || "";
  59100. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59101. this.use = attributes.use || "";
  59102. this.usehref = attributes.usehref || "";
  59103. }
  59104. }
  59105. class Hyphenation extends _xfa_object.XFAObject {
  59106. constructor(attributes) {
  59107. super(TEMPLATE_NS_ID, "hyphenation");
  59108. this.excludeAllCaps = (0, _utils.getInteger)({
  59109. data: attributes.excludeAllCaps,
  59110. defaultValue: 0,
  59111. validate: x => x === 1
  59112. });
  59113. this.excludeInitialCap = (0, _utils.getInteger)({
  59114. data: attributes.excludeInitialCap,
  59115. defaultValue: 0,
  59116. validate: x => x === 1
  59117. });
  59118. this.hyphenate = (0, _utils.getInteger)({
  59119. data: attributes.hyphenate,
  59120. defaultValue: 0,
  59121. validate: x => x === 1
  59122. });
  59123. this.id = attributes.id || "";
  59124. this.pushCharacterCount = (0, _utils.getInteger)({
  59125. data: attributes.pushCharacterCount,
  59126. defaultValue: 3,
  59127. validate: x => x >= 0
  59128. });
  59129. this.remainCharacterCount = (0, _utils.getInteger)({
  59130. data: attributes.remainCharacterCount,
  59131. defaultValue: 3,
  59132. validate: x => x >= 0
  59133. });
  59134. this.use = attributes.use || "";
  59135. this.usehref = attributes.usehref || "";
  59136. this.wordCharacterCount = (0, _utils.getInteger)({
  59137. data: attributes.wordCharacterCount,
  59138. defaultValue: 7,
  59139. validate: x => x >= 0
  59140. });
  59141. }
  59142. }
  59143. class Image extends _xfa_object.StringObject {
  59144. constructor(attributes) {
  59145. super(TEMPLATE_NS_ID, "image");
  59146. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  59147. this.contentType = attributes.contentType || "";
  59148. this.href = attributes.href || "";
  59149. this.id = attributes.id || "";
  59150. this.name = attributes.name || "";
  59151. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  59152. this.use = attributes.use || "";
  59153. this.usehref = attributes.usehref || "";
  59154. }
  59155. [_xfa_object.$toHTML]() {
  59156. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  59157. return _utils.HTMLResult.EMPTY;
  59158. }
  59159. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  59160. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  59161. return _utils.HTMLResult.EMPTY;
  59162. }
  59163. if (!buffer && this.transferEncoding === "base64") {
  59164. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  59165. }
  59166. if (!buffer) {
  59167. return _utils.HTMLResult.EMPTY;
  59168. }
  59169. if (!this.contentType) {
  59170. for (const [header, type] of IMAGES_HEADERS) {
  59171. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  59172. this.contentType = type;
  59173. break;
  59174. }
  59175. }
  59176. if (!this.contentType) {
  59177. return _utils.HTMLResult.EMPTY;
  59178. }
  59179. }
  59180. const blob = new Blob([buffer], {
  59181. type: this.contentType
  59182. });
  59183. let style;
  59184. switch (this.aspect) {
  59185. case "fit":
  59186. case "actual":
  59187. break;
  59188. case "height":
  59189. style = {
  59190. height: "100%",
  59191. objectFit: "fill"
  59192. };
  59193. break;
  59194. case "none":
  59195. style = {
  59196. width: "100%",
  59197. height: "100%",
  59198. objectFit: "fill"
  59199. };
  59200. break;
  59201. case "width":
  59202. style = {
  59203. width: "100%",
  59204. objectFit: "fill"
  59205. };
  59206. break;
  59207. }
  59208. const parent = this[_xfa_object.$getParent]();
  59209. return _utils.HTMLResult.success({
  59210. name: "img",
  59211. attributes: {
  59212. class: ["xfaImage"],
  59213. style,
  59214. src: URL.createObjectURL(blob),
  59215. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  59216. }
  59217. });
  59218. }
  59219. }
  59220. class ImageEdit extends _xfa_object.XFAObject {
  59221. constructor(attributes) {
  59222. super(TEMPLATE_NS_ID, "imageEdit", true);
  59223. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  59224. this.id = attributes.id || "";
  59225. this.use = attributes.use || "";
  59226. this.usehref = attributes.usehref || "";
  59227. this.border = null;
  59228. this.extras = null;
  59229. this.margin = null;
  59230. }
  59231. [_xfa_object.$toHTML](availableSpace) {
  59232. if (this.data === "embed") {
  59233. return _utils.HTMLResult.success({
  59234. name: "div",
  59235. children: [],
  59236. attributes: {}
  59237. });
  59238. }
  59239. return _utils.HTMLResult.EMPTY;
  59240. }
  59241. }
  59242. class Integer extends _xfa_object.ContentObject {
  59243. constructor(attributes) {
  59244. super(TEMPLATE_NS_ID, "integer");
  59245. this.id = attributes.id || "";
  59246. this.name = attributes.name || "";
  59247. this.use = attributes.use || "";
  59248. this.usehref = attributes.usehref || "";
  59249. }
  59250. [_xfa_object.$finalize]() {
  59251. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  59252. this[_xfa_object.$content] = isNaN(number) ? null : number;
  59253. }
  59254. [_xfa_object.$toHTML](availableSpace) {
  59255. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  59256. }
  59257. }
  59258. class Issuers extends _xfa_object.XFAObject {
  59259. constructor(attributes) {
  59260. super(TEMPLATE_NS_ID, "issuers", true);
  59261. this.id = attributes.id || "";
  59262. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59263. this.use = attributes.use || "";
  59264. this.usehref = attributes.usehref || "";
  59265. this.certificate = new _xfa_object.XFAObjectArray();
  59266. }
  59267. }
  59268. class Items extends _xfa_object.XFAObject {
  59269. constructor(attributes) {
  59270. super(TEMPLATE_NS_ID, "items", true);
  59271. this.id = attributes.id || "";
  59272. this.name = attributes.name || "";
  59273. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  59274. this.ref = attributes.ref || "";
  59275. this.save = (0, _utils.getInteger)({
  59276. data: attributes.save,
  59277. defaultValue: 0,
  59278. validate: x => x === 1
  59279. });
  59280. this.use = attributes.use || "";
  59281. this.usehref = attributes.usehref || "";
  59282. this.boolean = new _xfa_object.XFAObjectArray();
  59283. this.date = new _xfa_object.XFAObjectArray();
  59284. this.dateTime = new _xfa_object.XFAObjectArray();
  59285. this.decimal = new _xfa_object.XFAObjectArray();
  59286. this.exData = new _xfa_object.XFAObjectArray();
  59287. this.float = new _xfa_object.XFAObjectArray();
  59288. this.image = new _xfa_object.XFAObjectArray();
  59289. this.integer = new _xfa_object.XFAObjectArray();
  59290. this.text = new _xfa_object.XFAObjectArray();
  59291. this.time = new _xfa_object.XFAObjectArray();
  59292. }
  59293. [_xfa_object.$toHTML]() {
  59294. const output = [];
  59295. for (const child of this[_xfa_object.$getChildren]()) {
  59296. output.push(child[_xfa_object.$text]());
  59297. }
  59298. return _utils.HTMLResult.success(output);
  59299. }
  59300. }
  59301. exports.Items = Items;
  59302. class Keep extends _xfa_object.XFAObject {
  59303. constructor(attributes) {
  59304. super(TEMPLATE_NS_ID, "keep", true);
  59305. this.id = attributes.id || "";
  59306. const options = ["none", "contentArea", "pageArea"];
  59307. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  59308. this.next = (0, _utils.getStringOption)(attributes.next, options);
  59309. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  59310. this.use = attributes.use || "";
  59311. this.usehref = attributes.usehref || "";
  59312. this.extras = null;
  59313. }
  59314. }
  59315. class KeyUsage extends _xfa_object.XFAObject {
  59316. constructor(attributes) {
  59317. super(TEMPLATE_NS_ID, "keyUsage");
  59318. const options = ["", "yes", "no"];
  59319. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  59320. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  59321. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  59322. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  59323. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  59324. this.id = attributes.id || "";
  59325. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  59326. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  59327. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  59328. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  59329. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59330. this.use = attributes.use || "";
  59331. this.usehref = attributes.usehref || "";
  59332. }
  59333. }
  59334. class Line extends _xfa_object.XFAObject {
  59335. constructor(attributes) {
  59336. super(TEMPLATE_NS_ID, "line", true);
  59337. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  59338. this.id = attributes.id || "";
  59339. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  59340. this.use = attributes.use || "";
  59341. this.usehref = attributes.usehref || "";
  59342. this.edge = null;
  59343. }
  59344. [_xfa_object.$toHTML]() {
  59345. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59346. const edge = this.edge || new Edge({});
  59347. const edgeStyle = edge[_xfa_object.$toStyle]();
  59348. const style = Object.create(null);
  59349. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  59350. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  59351. style.stroke = edgeStyle.color;
  59352. let x1, y1, x2, y2;
  59353. let width = "100%";
  59354. let height = "100%";
  59355. if (parent.w <= thickness) {
  59356. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  59357. width = style.strokeWidth;
  59358. } else if (parent.h <= thickness) {
  59359. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  59360. height = style.strokeWidth;
  59361. } else {
  59362. if (this.slope === "\\") {
  59363. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  59364. } else {
  59365. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  59366. }
  59367. }
  59368. const line = {
  59369. name: "line",
  59370. attributes: {
  59371. xmlns: SVG_NS,
  59372. x1,
  59373. y1,
  59374. x2,
  59375. y2,
  59376. style
  59377. }
  59378. };
  59379. const svg = {
  59380. name: "svg",
  59381. children: [line],
  59382. attributes: {
  59383. xmlns: SVG_NS,
  59384. width,
  59385. height,
  59386. style: {
  59387. overflow: "visible"
  59388. }
  59389. }
  59390. };
  59391. if (hasMargin(parent)) {
  59392. return _utils.HTMLResult.success({
  59393. name: "div",
  59394. attributes: {
  59395. style: {
  59396. display: "inline",
  59397. width: "100%",
  59398. height: "100%"
  59399. }
  59400. },
  59401. children: [svg]
  59402. });
  59403. }
  59404. svg.attributes.style.position = "absolute";
  59405. return _utils.HTMLResult.success(svg);
  59406. }
  59407. }
  59408. class Linear extends _xfa_object.XFAObject {
  59409. constructor(attributes) {
  59410. super(TEMPLATE_NS_ID, "linear", true);
  59411. this.id = attributes.id || "";
  59412. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  59413. this.use = attributes.use || "";
  59414. this.usehref = attributes.usehref || "";
  59415. this.color = null;
  59416. this.extras = null;
  59417. }
  59418. [_xfa_object.$toStyle](startColor) {
  59419. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  59420. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  59421. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  59422. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  59423. }
  59424. }
  59425. class LockDocument extends _xfa_object.ContentObject {
  59426. constructor(attributes) {
  59427. super(TEMPLATE_NS_ID, "lockDocument");
  59428. this.id = attributes.id || "";
  59429. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59430. this.use = attributes.use || "";
  59431. this.usehref = attributes.usehref || "";
  59432. }
  59433. [_xfa_object.$finalize]() {
  59434. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  59435. }
  59436. }
  59437. class Manifest extends _xfa_object.XFAObject {
  59438. constructor(attributes) {
  59439. super(TEMPLATE_NS_ID, "manifest", true);
  59440. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  59441. this.id = attributes.id || "";
  59442. this.name = attributes.name || "";
  59443. this.use = attributes.use || "";
  59444. this.usehref = attributes.usehref || "";
  59445. this.extras = null;
  59446. this.ref = new _xfa_object.XFAObjectArray();
  59447. }
  59448. }
  59449. class Margin extends _xfa_object.XFAObject {
  59450. constructor(attributes) {
  59451. super(TEMPLATE_NS_ID, "margin", true);
  59452. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  59453. this.id = attributes.id || "";
  59454. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  59455. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  59456. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  59457. this.use = attributes.use || "";
  59458. this.usehref = attributes.usehref || "";
  59459. this.extras = null;
  59460. }
  59461. [_xfa_object.$toStyle]() {
  59462. return {
  59463. 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)
  59464. };
  59465. }
  59466. }
  59467. class Mdp extends _xfa_object.XFAObject {
  59468. constructor(attributes) {
  59469. super(TEMPLATE_NS_ID, "mdp");
  59470. this.id = attributes.id || "";
  59471. this.permissions = (0, _utils.getInteger)({
  59472. data: attributes.permissions,
  59473. defaultValue: 2,
  59474. validate: x => x === 1 || x === 3
  59475. });
  59476. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  59477. this.use = attributes.use || "";
  59478. this.usehref = attributes.usehref || "";
  59479. }
  59480. }
  59481. class Medium extends _xfa_object.XFAObject {
  59482. constructor(attributes) {
  59483. super(TEMPLATE_NS_ID, "medium");
  59484. this.id = attributes.id || "";
  59485. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  59486. this.long = (0, _utils.getMeasurement)(attributes.long);
  59487. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  59488. this.short = (0, _utils.getMeasurement)(attributes.short);
  59489. this.stock = attributes.stock || "";
  59490. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  59491. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  59492. this.use = attributes.use || "";
  59493. this.usehref = attributes.usehref || "";
  59494. }
  59495. }
  59496. class Message extends _xfa_object.XFAObject {
  59497. constructor(attributes) {
  59498. super(TEMPLATE_NS_ID, "message", true);
  59499. this.id = attributes.id || "";
  59500. this.use = attributes.use || "";
  59501. this.usehref = attributes.usehref || "";
  59502. this.text = new _xfa_object.XFAObjectArray();
  59503. }
  59504. }
  59505. class NumericEdit extends _xfa_object.XFAObject {
  59506. constructor(attributes) {
  59507. super(TEMPLATE_NS_ID, "numericEdit", true);
  59508. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  59509. this.id = attributes.id || "";
  59510. this.use = attributes.use || "";
  59511. this.usehref = attributes.usehref || "";
  59512. this.border = null;
  59513. this.comb = null;
  59514. this.extras = null;
  59515. this.margin = null;
  59516. }
  59517. [_xfa_object.$toHTML](availableSpace) {
  59518. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  59519. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  59520. const html = {
  59521. name: "input",
  59522. attributes: {
  59523. type: "text",
  59524. fieldId: field[_xfa_object.$uid],
  59525. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  59526. class: ["xfaTextfield"],
  59527. style,
  59528. "aria-label": ariaLabel(field),
  59529. "aria-required": false
  59530. }
  59531. };
  59532. if (isRequired(field)) {
  59533. html.attributes["aria-required"] = true;
  59534. html.attributes.required = true;
  59535. }
  59536. return _utils.HTMLResult.success({
  59537. name: "label",
  59538. attributes: {
  59539. class: ["xfaLabel"]
  59540. },
  59541. children: [html]
  59542. });
  59543. }
  59544. }
  59545. class Occur extends _xfa_object.XFAObject {
  59546. constructor(attributes) {
  59547. super(TEMPLATE_NS_ID, "occur", true);
  59548. this.id = attributes.id || "";
  59549. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  59550. data: attributes.initial,
  59551. defaultValue: "",
  59552. validate: x => true
  59553. }) : "";
  59554. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  59555. data: attributes.max,
  59556. defaultValue: 1,
  59557. validate: x => true
  59558. }) : "";
  59559. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  59560. data: attributes.min,
  59561. defaultValue: 1,
  59562. validate: x => true
  59563. }) : "";
  59564. this.use = attributes.use || "";
  59565. this.usehref = attributes.usehref || "";
  59566. this.extras = null;
  59567. }
  59568. [_xfa_object.$clean]() {
  59569. const parent = this[_xfa_object.$getParent]();
  59570. const originalMin = this.min;
  59571. if (this.min === "") {
  59572. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  59573. }
  59574. if (this.max === "") {
  59575. if (originalMin === "") {
  59576. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  59577. } else {
  59578. this.max = this.min;
  59579. }
  59580. }
  59581. if (this.max !== -1 && this.max < this.min) {
  59582. this.max = this.min;
  59583. }
  59584. if (this.initial === "") {
  59585. this.initial = parent instanceof Template ? 1 : this.min;
  59586. }
  59587. }
  59588. }
  59589. class Oid extends _xfa_object.StringObject {
  59590. constructor(attributes) {
  59591. super(TEMPLATE_NS_ID, "oid");
  59592. this.id = attributes.id || "";
  59593. this.name = attributes.name || "";
  59594. this.use = attributes.use || "";
  59595. this.usehref = attributes.usehref || "";
  59596. }
  59597. }
  59598. class Oids extends _xfa_object.XFAObject {
  59599. constructor(attributes) {
  59600. super(TEMPLATE_NS_ID, "oids", true);
  59601. this.id = attributes.id || "";
  59602. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  59603. this.use = attributes.use || "";
  59604. this.usehref = attributes.usehref || "";
  59605. this.oid = new _xfa_object.XFAObjectArray();
  59606. }
  59607. }
  59608. class Overflow extends _xfa_object.XFAObject {
  59609. constructor(attributes) {
  59610. super(TEMPLATE_NS_ID, "overflow");
  59611. this.id = attributes.id || "";
  59612. this.leader = attributes.leader || "";
  59613. this.target = attributes.target || "";
  59614. this.trailer = attributes.trailer || "";
  59615. this.use = attributes.use || "";
  59616. this.usehref = attributes.usehref || "";
  59617. }
  59618. [_xfa_object.$getExtra]() {
  59619. if (!this[_xfa_object.$extra]) {
  59620. const parent = this[_xfa_object.$getParent]();
  59621. const root = this[_xfa_object.$getTemplateRoot]();
  59622. const target = root[_xfa_object.$searchNode](this.target, parent);
  59623. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  59624. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  59625. this[_xfa_object.$extra] = {
  59626. target: target && target[0] || null,
  59627. leader: leader && leader[0] || null,
  59628. trailer: trailer && trailer[0] || null,
  59629. addLeader: false,
  59630. addTrailer: false
  59631. };
  59632. }
  59633. return this[_xfa_object.$extra];
  59634. }
  59635. }
  59636. class PageArea extends _xfa_object.XFAObject {
  59637. constructor(attributes) {
  59638. super(TEMPLATE_NS_ID, "pageArea", true);
  59639. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  59640. this.id = attributes.id || "";
  59641. this.initialNumber = (0, _utils.getInteger)({
  59642. data: attributes.initialNumber,
  59643. defaultValue: 1,
  59644. validate: x => true
  59645. });
  59646. this.name = attributes.name || "";
  59647. this.numbered = (0, _utils.getInteger)({
  59648. data: attributes.numbered,
  59649. defaultValue: 1,
  59650. validate: x => true
  59651. });
  59652. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  59653. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  59654. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  59655. this.use = attributes.use || "";
  59656. this.usehref = attributes.usehref || "";
  59657. this.desc = null;
  59658. this.extras = null;
  59659. this.medium = null;
  59660. this.occur = null;
  59661. this.area = new _xfa_object.XFAObjectArray();
  59662. this.contentArea = new _xfa_object.XFAObjectArray();
  59663. this.draw = new _xfa_object.XFAObjectArray();
  59664. this.exclGroup = new _xfa_object.XFAObjectArray();
  59665. this.field = new _xfa_object.XFAObjectArray();
  59666. this.subform = new _xfa_object.XFAObjectArray();
  59667. }
  59668. [_xfa_object.$isUsable]() {
  59669. if (!this[_xfa_object.$extra]) {
  59670. this[_xfa_object.$extra] = {
  59671. numberOfUse: 0
  59672. };
  59673. return true;
  59674. }
  59675. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  59676. }
  59677. [_xfa_object.$cleanPage]() {
  59678. delete this[_xfa_object.$extra];
  59679. }
  59680. [_xfa_object.$getNextPage]() {
  59681. if (!this[_xfa_object.$extra]) {
  59682. this[_xfa_object.$extra] = {
  59683. numberOfUse: 0
  59684. };
  59685. }
  59686. const parent = this[_xfa_object.$getParent]();
  59687. if (parent.relation === "orderedOccurrence") {
  59688. if (this[_xfa_object.$isUsable]()) {
  59689. this[_xfa_object.$extra].numberOfUse += 1;
  59690. return this;
  59691. }
  59692. }
  59693. return parent[_xfa_object.$getNextPage]();
  59694. }
  59695. [_xfa_object.$getAvailableSpace]() {
  59696. return this[_xfa_object.$extra].space || {
  59697. width: 0,
  59698. height: 0
  59699. };
  59700. }
  59701. [_xfa_object.$toHTML]() {
  59702. if (!this[_xfa_object.$extra]) {
  59703. this[_xfa_object.$extra] = {
  59704. numberOfUse: 1
  59705. };
  59706. }
  59707. const children = [];
  59708. this[_xfa_object.$extra].children = children;
  59709. const style = Object.create(null);
  59710. if (this.medium && this.medium.short && this.medium.long) {
  59711. style.width = (0, _html_utils.measureToString)(this.medium.short);
  59712. style.height = (0, _html_utils.measureToString)(this.medium.long);
  59713. this[_xfa_object.$extra].space = {
  59714. width: this.medium.short,
  59715. height: this.medium.long
  59716. };
  59717. if (this.medium.orientation === "landscape") {
  59718. const x = style.width;
  59719. style.width = style.height;
  59720. style.height = x;
  59721. this[_xfa_object.$extra].space = {
  59722. width: this.medium.long,
  59723. height: this.medium.short
  59724. };
  59725. }
  59726. } else {
  59727. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  59728. }
  59729. this[_xfa_object.$childrenToHTML]({
  59730. filter: new Set(["area", "draw", "field", "subform"]),
  59731. include: true
  59732. });
  59733. this[_xfa_object.$childrenToHTML]({
  59734. filter: new Set(["contentArea"]),
  59735. include: true
  59736. });
  59737. return _utils.HTMLResult.success({
  59738. name: "div",
  59739. children,
  59740. attributes: {
  59741. class: ["xfaPage"],
  59742. id: this[_xfa_object.$uid],
  59743. style,
  59744. xfaName: this.name
  59745. }
  59746. });
  59747. }
  59748. }
  59749. class PageSet extends _xfa_object.XFAObject {
  59750. constructor(attributes) {
  59751. super(TEMPLATE_NS_ID, "pageSet", true);
  59752. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  59753. this.id = attributes.id || "";
  59754. this.name = attributes.name || "";
  59755. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  59756. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  59757. this.use = attributes.use || "";
  59758. this.usehref = attributes.usehref || "";
  59759. this.extras = null;
  59760. this.occur = null;
  59761. this.pageArea = new _xfa_object.XFAObjectArray();
  59762. this.pageSet = new _xfa_object.XFAObjectArray();
  59763. }
  59764. [_xfa_object.$cleanPage]() {
  59765. for (const page of this.pageArea.children) {
  59766. page[_xfa_object.$cleanPage]();
  59767. }
  59768. for (const page of this.pageSet.children) {
  59769. page[_xfa_object.$cleanPage]();
  59770. }
  59771. }
  59772. [_xfa_object.$isUsable]() {
  59773. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  59774. }
  59775. [_xfa_object.$getNextPage]() {
  59776. if (!this[_xfa_object.$extra]) {
  59777. this[_xfa_object.$extra] = {
  59778. numberOfUse: 1,
  59779. pageIndex: -1,
  59780. pageSetIndex: -1
  59781. };
  59782. }
  59783. if (this.relation === "orderedOccurrence") {
  59784. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  59785. this[_xfa_object.$extra].pageIndex += 1;
  59786. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  59787. return pageArea[_xfa_object.$getNextPage]();
  59788. }
  59789. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  59790. this[_xfa_object.$extra].pageSetIndex += 1;
  59791. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  59792. }
  59793. if (this[_xfa_object.$isUsable]()) {
  59794. this[_xfa_object.$extra].numberOfUse += 1;
  59795. this[_xfa_object.$extra].pageIndex = -1;
  59796. this[_xfa_object.$extra].pageSetIndex = -1;
  59797. return this[_xfa_object.$getNextPage]();
  59798. }
  59799. const parent = this[_xfa_object.$getParent]();
  59800. if (parent instanceof PageSet) {
  59801. return parent[_xfa_object.$getNextPage]();
  59802. }
  59803. this[_xfa_object.$cleanPage]();
  59804. return this[_xfa_object.$getNextPage]();
  59805. }
  59806. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  59807. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  59808. const position = pageNumber === 0 ? "first" : "rest";
  59809. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  59810. if (page) {
  59811. return page;
  59812. }
  59813. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  59814. if (page) {
  59815. return page;
  59816. }
  59817. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  59818. if (page) {
  59819. return page;
  59820. }
  59821. return this.pageArea.children[0];
  59822. }
  59823. }
  59824. class Para extends _xfa_object.XFAObject {
  59825. constructor(attributes) {
  59826. super(TEMPLATE_NS_ID, "para", true);
  59827. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  59828. this.id = attributes.id || "";
  59829. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  59830. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  59831. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  59832. this.orphans = (0, _utils.getInteger)({
  59833. data: attributes.orphans,
  59834. defaultValue: 0,
  59835. validate: x => x >= 0
  59836. });
  59837. this.preserve = attributes.preserve || "";
  59838. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  59839. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  59840. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  59841. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  59842. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  59843. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  59844. this.use = attributes.use || "";
  59845. this.usehref = attributes.usehref || "";
  59846. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  59847. this.widows = (0, _utils.getInteger)({
  59848. data: attributes.widows,
  59849. defaultValue: 0,
  59850. validate: x => x >= 0
  59851. });
  59852. this.hyphenation = null;
  59853. }
  59854. [_xfa_object.$toStyle]() {
  59855. const style = (0, _html_utils.toStyle)(this, "hAlign");
  59856. if (this.marginLeft !== "") {
  59857. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  59858. }
  59859. if (this.marginRight !== "") {
  59860. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  59861. }
  59862. if (this.spaceAbove !== "") {
  59863. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  59864. }
  59865. if (this.spaceBelow !== "") {
  59866. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  59867. }
  59868. if (this.textIndent !== "") {
  59869. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  59870. (0, _html_utils.fixTextIndent)(style);
  59871. }
  59872. if (this.lineHeight > 0) {
  59873. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  59874. }
  59875. if (this.tabDefault !== "") {
  59876. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  59877. }
  59878. if (this.tabStops.length > 0) {}
  59879. if (this.hyphenatation) {
  59880. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  59881. }
  59882. return style;
  59883. }
  59884. }
  59885. class PasswordEdit extends _xfa_object.XFAObject {
  59886. constructor(attributes) {
  59887. super(TEMPLATE_NS_ID, "passwordEdit", true);
  59888. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  59889. this.id = attributes.id || "";
  59890. this.passwordChar = attributes.passwordChar || "*";
  59891. this.use = attributes.use || "";
  59892. this.usehref = attributes.usehref || "";
  59893. this.border = null;
  59894. this.extras = null;
  59895. this.margin = null;
  59896. }
  59897. }
  59898. class Pattern extends _xfa_object.XFAObject {
  59899. constructor(attributes) {
  59900. super(TEMPLATE_NS_ID, "pattern", true);
  59901. this.id = attributes.id || "";
  59902. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  59903. this.use = attributes.use || "";
  59904. this.usehref = attributes.usehref || "";
  59905. this.color = null;
  59906. this.extras = null;
  59907. }
  59908. [_xfa_object.$toStyle](startColor) {
  59909. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  59910. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  59911. const width = 5;
  59912. const cmd = "repeating-linear-gradient";
  59913. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  59914. switch (this.type) {
  59915. case "crossHatch":
  59916. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  59917. case "crossDiagonal":
  59918. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  59919. case "diagonalLeft":
  59920. return `${cmd}(45deg,${colors})`;
  59921. case "diagonalRight":
  59922. return `${cmd}(-45deg,${colors})`;
  59923. case "horizontal":
  59924. return `${cmd}(to top,${colors})`;
  59925. case "vertical":
  59926. return `${cmd}(to right,${colors})`;
  59927. }
  59928. return "";
  59929. }
  59930. }
  59931. class Picture extends _xfa_object.StringObject {
  59932. constructor(attributes) {
  59933. super(TEMPLATE_NS_ID, "picture");
  59934. this.id = attributes.id || "";
  59935. this.use = attributes.use || "";
  59936. this.usehref = attributes.usehref || "";
  59937. }
  59938. }
  59939. class Proto extends _xfa_object.XFAObject {
  59940. constructor(attributes) {
  59941. super(TEMPLATE_NS_ID, "proto", true);
  59942. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  59943. this.arc = new _xfa_object.XFAObjectArray();
  59944. this.area = new _xfa_object.XFAObjectArray();
  59945. this.assist = new _xfa_object.XFAObjectArray();
  59946. this.barcode = new _xfa_object.XFAObjectArray();
  59947. this.bindItems = new _xfa_object.XFAObjectArray();
  59948. this.bookend = new _xfa_object.XFAObjectArray();
  59949. this.boolean = new _xfa_object.XFAObjectArray();
  59950. this.border = new _xfa_object.XFAObjectArray();
  59951. this.break = new _xfa_object.XFAObjectArray();
  59952. this.breakAfter = new _xfa_object.XFAObjectArray();
  59953. this.breakBefore = new _xfa_object.XFAObjectArray();
  59954. this.button = new _xfa_object.XFAObjectArray();
  59955. this.calculate = new _xfa_object.XFAObjectArray();
  59956. this.caption = new _xfa_object.XFAObjectArray();
  59957. this.certificate = new _xfa_object.XFAObjectArray();
  59958. this.certificates = new _xfa_object.XFAObjectArray();
  59959. this.checkButton = new _xfa_object.XFAObjectArray();
  59960. this.choiceList = new _xfa_object.XFAObjectArray();
  59961. this.color = new _xfa_object.XFAObjectArray();
  59962. this.comb = new _xfa_object.XFAObjectArray();
  59963. this.connect = new _xfa_object.XFAObjectArray();
  59964. this.contentArea = new _xfa_object.XFAObjectArray();
  59965. this.corner = new _xfa_object.XFAObjectArray();
  59966. this.date = new _xfa_object.XFAObjectArray();
  59967. this.dateTime = new _xfa_object.XFAObjectArray();
  59968. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  59969. this.decimal = new _xfa_object.XFAObjectArray();
  59970. this.defaultUi = new _xfa_object.XFAObjectArray();
  59971. this.desc = new _xfa_object.XFAObjectArray();
  59972. this.digestMethod = new _xfa_object.XFAObjectArray();
  59973. this.digestMethods = new _xfa_object.XFAObjectArray();
  59974. this.draw = new _xfa_object.XFAObjectArray();
  59975. this.edge = new _xfa_object.XFAObjectArray();
  59976. this.encoding = new _xfa_object.XFAObjectArray();
  59977. this.encodings = new _xfa_object.XFAObjectArray();
  59978. this.encrypt = new _xfa_object.XFAObjectArray();
  59979. this.encryptData = new _xfa_object.XFAObjectArray();
  59980. this.encryption = new _xfa_object.XFAObjectArray();
  59981. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  59982. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  59983. this.event = new _xfa_object.XFAObjectArray();
  59984. this.exData = new _xfa_object.XFAObjectArray();
  59985. this.exObject = new _xfa_object.XFAObjectArray();
  59986. this.exclGroup = new _xfa_object.XFAObjectArray();
  59987. this.execute = new _xfa_object.XFAObjectArray();
  59988. this.extras = new _xfa_object.XFAObjectArray();
  59989. this.field = new _xfa_object.XFAObjectArray();
  59990. this.fill = new _xfa_object.XFAObjectArray();
  59991. this.filter = new _xfa_object.XFAObjectArray();
  59992. this.float = new _xfa_object.XFAObjectArray();
  59993. this.font = new _xfa_object.XFAObjectArray();
  59994. this.format = new _xfa_object.XFAObjectArray();
  59995. this.handler = new _xfa_object.XFAObjectArray();
  59996. this.hyphenation = new _xfa_object.XFAObjectArray();
  59997. this.image = new _xfa_object.XFAObjectArray();
  59998. this.imageEdit = new _xfa_object.XFAObjectArray();
  59999. this.integer = new _xfa_object.XFAObjectArray();
  60000. this.issuers = new _xfa_object.XFAObjectArray();
  60001. this.items = new _xfa_object.XFAObjectArray();
  60002. this.keep = new _xfa_object.XFAObjectArray();
  60003. this.keyUsage = new _xfa_object.XFAObjectArray();
  60004. this.line = new _xfa_object.XFAObjectArray();
  60005. this.linear = new _xfa_object.XFAObjectArray();
  60006. this.lockDocument = new _xfa_object.XFAObjectArray();
  60007. this.manifest = new _xfa_object.XFAObjectArray();
  60008. this.margin = new _xfa_object.XFAObjectArray();
  60009. this.mdp = new _xfa_object.XFAObjectArray();
  60010. this.medium = new _xfa_object.XFAObjectArray();
  60011. this.message = new _xfa_object.XFAObjectArray();
  60012. this.numericEdit = new _xfa_object.XFAObjectArray();
  60013. this.occur = new _xfa_object.XFAObjectArray();
  60014. this.oid = new _xfa_object.XFAObjectArray();
  60015. this.oids = new _xfa_object.XFAObjectArray();
  60016. this.overflow = new _xfa_object.XFAObjectArray();
  60017. this.pageArea = new _xfa_object.XFAObjectArray();
  60018. this.pageSet = new _xfa_object.XFAObjectArray();
  60019. this.para = new _xfa_object.XFAObjectArray();
  60020. this.passwordEdit = new _xfa_object.XFAObjectArray();
  60021. this.pattern = new _xfa_object.XFAObjectArray();
  60022. this.picture = new _xfa_object.XFAObjectArray();
  60023. this.radial = new _xfa_object.XFAObjectArray();
  60024. this.reason = new _xfa_object.XFAObjectArray();
  60025. this.reasons = new _xfa_object.XFAObjectArray();
  60026. this.rectangle = new _xfa_object.XFAObjectArray();
  60027. this.ref = new _xfa_object.XFAObjectArray();
  60028. this.script = new _xfa_object.XFAObjectArray();
  60029. this.setProperty = new _xfa_object.XFAObjectArray();
  60030. this.signData = new _xfa_object.XFAObjectArray();
  60031. this.signature = new _xfa_object.XFAObjectArray();
  60032. this.signing = new _xfa_object.XFAObjectArray();
  60033. this.solid = new _xfa_object.XFAObjectArray();
  60034. this.speak = new _xfa_object.XFAObjectArray();
  60035. this.stipple = new _xfa_object.XFAObjectArray();
  60036. this.subform = new _xfa_object.XFAObjectArray();
  60037. this.subformSet = new _xfa_object.XFAObjectArray();
  60038. this.subjectDN = new _xfa_object.XFAObjectArray();
  60039. this.subjectDNs = new _xfa_object.XFAObjectArray();
  60040. this.submit = new _xfa_object.XFAObjectArray();
  60041. this.text = new _xfa_object.XFAObjectArray();
  60042. this.textEdit = new _xfa_object.XFAObjectArray();
  60043. this.time = new _xfa_object.XFAObjectArray();
  60044. this.timeStamp = new _xfa_object.XFAObjectArray();
  60045. this.toolTip = new _xfa_object.XFAObjectArray();
  60046. this.traversal = new _xfa_object.XFAObjectArray();
  60047. this.traverse = new _xfa_object.XFAObjectArray();
  60048. this.ui = new _xfa_object.XFAObjectArray();
  60049. this.validate = new _xfa_object.XFAObjectArray();
  60050. this.value = new _xfa_object.XFAObjectArray();
  60051. this.variables = new _xfa_object.XFAObjectArray();
  60052. }
  60053. }
  60054. class Radial extends _xfa_object.XFAObject {
  60055. constructor(attributes) {
  60056. super(TEMPLATE_NS_ID, "radial", true);
  60057. this.id = attributes.id || "";
  60058. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  60059. this.use = attributes.use || "";
  60060. this.usehref = attributes.usehref || "";
  60061. this.color = null;
  60062. this.extras = null;
  60063. }
  60064. [_xfa_object.$toStyle](startColor) {
  60065. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60066. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  60067. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  60068. return `radial-gradient(circle at center, ${colors})`;
  60069. }
  60070. }
  60071. class Reason extends _xfa_object.StringObject {
  60072. constructor(attributes) {
  60073. super(TEMPLATE_NS_ID, "reason");
  60074. this.id = attributes.id || "";
  60075. this.name = attributes.name || "";
  60076. this.use = attributes.use || "";
  60077. this.usehref = attributes.usehref || "";
  60078. }
  60079. }
  60080. class Reasons extends _xfa_object.XFAObject {
  60081. constructor(attributes) {
  60082. super(TEMPLATE_NS_ID, "reasons", true);
  60083. this.id = attributes.id || "";
  60084. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60085. this.use = attributes.use || "";
  60086. this.usehref = attributes.usehref || "";
  60087. this.reason = new _xfa_object.XFAObjectArray();
  60088. }
  60089. }
  60090. class Rectangle extends _xfa_object.XFAObject {
  60091. constructor(attributes) {
  60092. super(TEMPLATE_NS_ID, "rectangle", true);
  60093. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  60094. this.id = attributes.id || "";
  60095. this.use = attributes.use || "";
  60096. this.usehref = attributes.usehref || "";
  60097. this.corner = new _xfa_object.XFAObjectArray(4);
  60098. this.edge = new _xfa_object.XFAObjectArray(4);
  60099. this.fill = null;
  60100. }
  60101. [_xfa_object.$toHTML]() {
  60102. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  60103. const edgeStyle = edge[_xfa_object.$toStyle]();
  60104. const style = Object.create(null);
  60105. if (this.fill && this.fill.presence === "visible") {
  60106. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  60107. } else {
  60108. style.fill = "transparent";
  60109. }
  60110. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  60111. style.stroke = edgeStyle.color;
  60112. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  60113. const cornerStyle = corner[_xfa_object.$toStyle]();
  60114. const rect = {
  60115. name: "rect",
  60116. attributes: {
  60117. xmlns: SVG_NS,
  60118. width: "100%",
  60119. height: "100%",
  60120. x: 0,
  60121. y: 0,
  60122. rx: cornerStyle.radius,
  60123. ry: cornerStyle.radius,
  60124. style
  60125. }
  60126. };
  60127. const svg = {
  60128. name: "svg",
  60129. children: [rect],
  60130. attributes: {
  60131. xmlns: SVG_NS,
  60132. style: {
  60133. overflow: "visible"
  60134. },
  60135. width: "100%",
  60136. height: "100%"
  60137. }
  60138. };
  60139. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  60140. if (hasMargin(parent)) {
  60141. return _utils.HTMLResult.success({
  60142. name: "div",
  60143. attributes: {
  60144. style: {
  60145. display: "inline",
  60146. width: "100%",
  60147. height: "100%"
  60148. }
  60149. },
  60150. children: [svg]
  60151. });
  60152. }
  60153. svg.attributes.style.position = "absolute";
  60154. return _utils.HTMLResult.success(svg);
  60155. }
  60156. }
  60157. class RefElement extends _xfa_object.StringObject {
  60158. constructor(attributes) {
  60159. super(TEMPLATE_NS_ID, "ref");
  60160. this.id = attributes.id || "";
  60161. this.use = attributes.use || "";
  60162. this.usehref = attributes.usehref || "";
  60163. }
  60164. }
  60165. class Script extends _xfa_object.StringObject {
  60166. constructor(attributes) {
  60167. super(TEMPLATE_NS_ID, "script");
  60168. this.binding = attributes.binding || "";
  60169. this.contentType = attributes.contentType || "";
  60170. this.id = attributes.id || "";
  60171. this.name = attributes.name || "";
  60172. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  60173. this.use = attributes.use || "";
  60174. this.usehref = attributes.usehref || "";
  60175. }
  60176. }
  60177. class SetProperty extends _xfa_object.XFAObject {
  60178. constructor(attributes) {
  60179. super(TEMPLATE_NS_ID, "setProperty");
  60180. this.connection = attributes.connection || "";
  60181. this.ref = attributes.ref || "";
  60182. this.target = attributes.target || "";
  60183. }
  60184. }
  60185. exports.SetProperty = SetProperty;
  60186. class SignData extends _xfa_object.XFAObject {
  60187. constructor(attributes) {
  60188. super(TEMPLATE_NS_ID, "signData", true);
  60189. this.id = attributes.id || "";
  60190. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  60191. this.ref = attributes.ref || "";
  60192. this.target = attributes.target || "";
  60193. this.use = attributes.use || "";
  60194. this.usehref = attributes.usehref || "";
  60195. this.filter = null;
  60196. this.manifest = null;
  60197. }
  60198. }
  60199. class Signature extends _xfa_object.XFAObject {
  60200. constructor(attributes) {
  60201. super(TEMPLATE_NS_ID, "signature", true);
  60202. this.id = attributes.id || "";
  60203. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  60204. this.use = attributes.use || "";
  60205. this.usehref = attributes.usehref || "";
  60206. this.border = null;
  60207. this.extras = null;
  60208. this.filter = null;
  60209. this.manifest = null;
  60210. this.margin = null;
  60211. }
  60212. }
  60213. class Signing extends _xfa_object.XFAObject {
  60214. constructor(attributes) {
  60215. super(TEMPLATE_NS_ID, "signing", true);
  60216. this.id = attributes.id || "";
  60217. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60218. this.use = attributes.use || "";
  60219. this.usehref = attributes.usehref || "";
  60220. this.certificate = new _xfa_object.XFAObjectArray();
  60221. }
  60222. }
  60223. class Solid extends _xfa_object.XFAObject {
  60224. constructor(attributes) {
  60225. super(TEMPLATE_NS_ID, "solid", true);
  60226. this.id = attributes.id || "";
  60227. this.use = attributes.use || "";
  60228. this.usehref = attributes.usehref || "";
  60229. this.extras = null;
  60230. }
  60231. [_xfa_object.$toStyle](startColor) {
  60232. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  60233. }
  60234. }
  60235. class Speak extends _xfa_object.StringObject {
  60236. constructor(attributes) {
  60237. super(TEMPLATE_NS_ID, "speak");
  60238. this.disable = (0, _utils.getInteger)({
  60239. data: attributes.disable,
  60240. defaultValue: 0,
  60241. validate: x => x === 1
  60242. });
  60243. this.id = attributes.id || "";
  60244. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  60245. this.rid = attributes.rid || "";
  60246. this.use = attributes.use || "";
  60247. this.usehref = attributes.usehref || "";
  60248. }
  60249. }
  60250. class Stipple extends _xfa_object.XFAObject {
  60251. constructor(attributes) {
  60252. super(TEMPLATE_NS_ID, "stipple", true);
  60253. this.id = attributes.id || "";
  60254. this.rate = (0, _utils.getInteger)({
  60255. data: attributes.rate,
  60256. defaultValue: 50,
  60257. validate: x => x >= 0 && x <= 100
  60258. });
  60259. this.use = attributes.use || "";
  60260. this.usehref = attributes.usehref || "";
  60261. this.color = null;
  60262. this.extras = null;
  60263. }
  60264. [_xfa_object.$toStyle](bgColor) {
  60265. const alpha = this.rate / 100;
  60266. 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));
  60267. }
  60268. }
  60269. class Subform extends _xfa_object.XFAObject {
  60270. constructor(attributes) {
  60271. super(TEMPLATE_NS_ID, "subform", true);
  60272. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  60273. this.allowMacro = (0, _utils.getInteger)({
  60274. data: attributes.allowMacro,
  60275. defaultValue: 0,
  60276. validate: x => x === 1
  60277. });
  60278. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  60279. this.colSpan = (0, _utils.getInteger)({
  60280. data: attributes.colSpan,
  60281. defaultValue: 1,
  60282. validate: n => n >= 1 || n === -1
  60283. });
  60284. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  60285. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  60286. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  60287. this.id = attributes.id || "";
  60288. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  60289. this.locale = attributes.locale || "";
  60290. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  60291. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  60292. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  60293. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  60294. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  60295. this.name = attributes.name || "";
  60296. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  60297. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60298. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  60299. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  60300. this.use = attributes.use || "";
  60301. this.usehref = attributes.usehref || "";
  60302. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  60303. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  60304. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  60305. this.assist = null;
  60306. this.bind = null;
  60307. this.bookend = null;
  60308. this.border = null;
  60309. this.break = null;
  60310. this.calculate = null;
  60311. this.desc = null;
  60312. this.extras = null;
  60313. this.keep = null;
  60314. this.margin = null;
  60315. this.occur = null;
  60316. this.overflow = null;
  60317. this.pageSet = null;
  60318. this.para = null;
  60319. this.traversal = null;
  60320. this.validate = null;
  60321. this.variables = null;
  60322. this.area = new _xfa_object.XFAObjectArray();
  60323. this.breakAfter = new _xfa_object.XFAObjectArray();
  60324. this.breakBefore = new _xfa_object.XFAObjectArray();
  60325. this.connect = new _xfa_object.XFAObjectArray();
  60326. this.draw = new _xfa_object.XFAObjectArray();
  60327. this.event = new _xfa_object.XFAObjectArray();
  60328. this.exObject = new _xfa_object.XFAObjectArray();
  60329. this.exclGroup = new _xfa_object.XFAObjectArray();
  60330. this.field = new _xfa_object.XFAObjectArray();
  60331. this.proto = new _xfa_object.XFAObjectArray();
  60332. this.setProperty = new _xfa_object.XFAObjectArray();
  60333. this.subform = new _xfa_object.XFAObjectArray();
  60334. this.subformSet = new _xfa_object.XFAObjectArray();
  60335. }
  60336. [_xfa_object.$getSubformParent]() {
  60337. const parent = this[_xfa_object.$getParent]();
  60338. if (parent instanceof SubformSet) {
  60339. return parent[_xfa_object.$getSubformParent]();
  60340. }
  60341. return parent;
  60342. }
  60343. [_xfa_object.$isBindable]() {
  60344. return true;
  60345. }
  60346. [_xfa_object.$isThereMoreWidth]() {
  60347. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  60348. }
  60349. *[_xfa_object.$getContainedChildren]() {
  60350. yield* getContainedChildren(this);
  60351. }
  60352. [_xfa_object.$flushHTML]() {
  60353. return (0, _layout.flushHTML)(this);
  60354. }
  60355. [_xfa_object.$addHTML](html, bbox) {
  60356. (0, _layout.addHTML)(this, html, bbox);
  60357. }
  60358. [_xfa_object.$getAvailableSpace]() {
  60359. return (0, _layout.getAvailableSpace)(this);
  60360. }
  60361. [_xfa_object.$isSplittable]() {
  60362. const parent = this[_xfa_object.$getSubformParent]();
  60363. if (!parent[_xfa_object.$isSplittable]()) {
  60364. return false;
  60365. }
  60366. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  60367. return this[_xfa_object.$extra]._isSplittable;
  60368. }
  60369. if (this.layout === "position" || this.layout.includes("row")) {
  60370. this[_xfa_object.$extra]._isSplittable = false;
  60371. return false;
  60372. }
  60373. if (this.keep && this.keep.intact !== "none") {
  60374. this[_xfa_object.$extra]._isSplittable = false;
  60375. return false;
  60376. }
  60377. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  60378. return false;
  60379. }
  60380. this[_xfa_object.$extra]._isSplittable = true;
  60381. return true;
  60382. }
  60383. [_xfa_object.$toHTML](availableSpace) {
  60384. setTabIndex(this);
  60385. if (this.break) {
  60386. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  60387. const node = new BreakAfter({
  60388. targetType: this.break.after,
  60389. target: this.break.afterTarget,
  60390. startNew: this.break.startNew.toString()
  60391. });
  60392. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60393. this[_xfa_object.$appendChild](node);
  60394. this.breakAfter.push(node);
  60395. }
  60396. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  60397. const node = new BreakBefore({
  60398. targetType: this.break.before,
  60399. target: this.break.beforeTarget,
  60400. startNew: this.break.startNew.toString()
  60401. });
  60402. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60403. this[_xfa_object.$appendChild](node);
  60404. this.breakBefore.push(node);
  60405. }
  60406. if (this.break.overflowTarget !== "") {
  60407. const node = new Overflow({
  60408. target: this.break.overflowTarget,
  60409. leader: this.break.overflowLeader,
  60410. trailer: this.break.overflowTrailer
  60411. });
  60412. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  60413. this[_xfa_object.$appendChild](node);
  60414. this.overflow.push(node);
  60415. }
  60416. this[_xfa_object.$removeChild](this.break);
  60417. this.break = null;
  60418. }
  60419. if (this.presence === "hidden" || this.presence === "inactive") {
  60420. return _utils.HTMLResult.EMPTY;
  60421. }
  60422. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  60423. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  60424. }
  60425. if (this.breakBefore.children.length >= 1) {
  60426. const breakBefore = this.breakBefore.children[0];
  60427. if (handleBreak(breakBefore)) {
  60428. return _utils.HTMLResult.breakNode(breakBefore);
  60429. }
  60430. }
  60431. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  60432. return _utils.HTMLResult.EMPTY;
  60433. }
  60434. (0, _html_utils.fixDimensions)(this);
  60435. const children = [];
  60436. const attributes = {
  60437. id: this[_xfa_object.$uid],
  60438. class: []
  60439. };
  60440. (0, _html_utils.setAccess)(this, attributes.class);
  60441. if (!this[_xfa_object.$extra]) {
  60442. this[_xfa_object.$extra] = Object.create(null);
  60443. }
  60444. Object.assign(this[_xfa_object.$extra], {
  60445. children,
  60446. line: null,
  60447. attributes,
  60448. attempt: 0,
  60449. numberInLine: 0,
  60450. availableSpace: {
  60451. width: Math.min(this.w || Infinity, availableSpace.width),
  60452. height: Math.min(this.h || Infinity, availableSpace.height)
  60453. },
  60454. width: 0,
  60455. height: 0,
  60456. prevHeight: 0,
  60457. currentWidth: 0
  60458. });
  60459. const root = this[_xfa_object.$getTemplateRoot]();
  60460. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  60461. const isSplittable = this[_xfa_object.$isSplittable]();
  60462. if (!isSplittable) {
  60463. setFirstUnsplittable(this);
  60464. }
  60465. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  60466. return _utils.HTMLResult.FAILURE;
  60467. }
  60468. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  60469. if (this.layout.includes("row")) {
  60470. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  60471. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  60472. this[_xfa_object.$extra].columnWidths = columnWidths;
  60473. this[_xfa_object.$extra].currentColumn = 0;
  60474. }
  60475. }
  60476. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  60477. const classNames = ["xfaSubform"];
  60478. const cl = (0, _html_utils.layoutClass)(this);
  60479. if (cl) {
  60480. classNames.push(cl);
  60481. }
  60482. attributes.style = style;
  60483. attributes.class = classNames;
  60484. if (this.name) {
  60485. attributes.xfaName = this.name;
  60486. }
  60487. if (this.overflow) {
  60488. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60489. if (overflowExtra.addLeader) {
  60490. overflowExtra.addLeader = false;
  60491. handleOverflow(this, overflowExtra.leader, availableSpace);
  60492. }
  60493. }
  60494. this[_xfa_object.$pushPara]();
  60495. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  60496. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  60497. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  60498. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  60499. this[_xfa_object.$extra].numberInLine = 0;
  60500. }
  60501. const result = this[_xfa_object.$childrenToHTML]({
  60502. filter,
  60503. include: true
  60504. });
  60505. if (result.success) {
  60506. break;
  60507. }
  60508. if (result.isBreak()) {
  60509. this[_xfa_object.$popPara]();
  60510. return result;
  60511. }
  60512. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  60513. this[_xfa_object.$extra].attempt = maxRun;
  60514. break;
  60515. }
  60516. }
  60517. this[_xfa_object.$popPara]();
  60518. if (!isSplittable) {
  60519. unsetFirstUnsplittable(this);
  60520. }
  60521. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  60522. if (this[_xfa_object.$extra].attempt === maxRun) {
  60523. if (this.overflow) {
  60524. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  60525. }
  60526. if (!isSplittable) {
  60527. delete this[_xfa_object.$extra];
  60528. }
  60529. return _utils.HTMLResult.FAILURE;
  60530. }
  60531. if (this.overflow) {
  60532. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  60533. if (overflowExtra.addTrailer) {
  60534. overflowExtra.addTrailer = false;
  60535. handleOverflow(this, overflowExtra.trailer, availableSpace);
  60536. }
  60537. }
  60538. let marginH = 0;
  60539. let marginV = 0;
  60540. if (this.margin) {
  60541. marginH = this.margin.leftInset + this.margin.rightInset;
  60542. marginV = this.margin.topInset + this.margin.bottomInset;
  60543. }
  60544. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  60545. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  60546. const bbox = [this.x, this.y, width, height];
  60547. if (this.w === "") {
  60548. style.width = (0, _html_utils.measureToString)(width);
  60549. }
  60550. if (this.h === "") {
  60551. style.height = (0, _html_utils.measureToString)(height);
  60552. }
  60553. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  60554. return _utils.HTMLResult.EMPTY;
  60555. }
  60556. const html = {
  60557. name: "div",
  60558. attributes,
  60559. children
  60560. };
  60561. applyAssist(this, attributes);
  60562. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  60563. if (this.breakAfter.children.length >= 1) {
  60564. const breakAfter = this.breakAfter.children[0];
  60565. if (handleBreak(breakAfter)) {
  60566. this[_xfa_object.$extra].afterBreakAfter = result;
  60567. return _utils.HTMLResult.breakNode(breakAfter);
  60568. }
  60569. }
  60570. delete this[_xfa_object.$extra];
  60571. return result;
  60572. }
  60573. }
  60574. class SubformSet extends _xfa_object.XFAObject {
  60575. constructor(attributes) {
  60576. super(TEMPLATE_NS_ID, "subformSet", true);
  60577. this.id = attributes.id || "";
  60578. this.name = attributes.name || "";
  60579. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  60580. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  60581. this.use = attributes.use || "";
  60582. this.usehref = attributes.usehref || "";
  60583. this.bookend = null;
  60584. this.break = null;
  60585. this.desc = null;
  60586. this.extras = null;
  60587. this.occur = null;
  60588. this.overflow = null;
  60589. this.breakAfter = new _xfa_object.XFAObjectArray();
  60590. this.breakBefore = new _xfa_object.XFAObjectArray();
  60591. this.subform = new _xfa_object.XFAObjectArray();
  60592. this.subformSet = new _xfa_object.XFAObjectArray();
  60593. }
  60594. *[_xfa_object.$getContainedChildren]() {
  60595. yield* getContainedChildren(this);
  60596. }
  60597. [_xfa_object.$getSubformParent]() {
  60598. let parent = this[_xfa_object.$getParent]();
  60599. while (!(parent instanceof Subform)) {
  60600. parent = parent[_xfa_object.$getParent]();
  60601. }
  60602. return parent;
  60603. }
  60604. [_xfa_object.$isBindable]() {
  60605. return true;
  60606. }
  60607. }
  60608. class SubjectDN extends _xfa_object.ContentObject {
  60609. constructor(attributes) {
  60610. super(TEMPLATE_NS_ID, "subjectDN");
  60611. this.delimiter = attributes.delimiter || ",";
  60612. this.id = attributes.id || "";
  60613. this.name = attributes.name || "";
  60614. this.use = attributes.use || "";
  60615. this.usehref = attributes.usehref || "";
  60616. }
  60617. [_xfa_object.$finalize]() {
  60618. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  60619. kv = kv.split("=", 2);
  60620. kv[0] = kv[0].trim();
  60621. return kv;
  60622. }));
  60623. }
  60624. }
  60625. class SubjectDNs extends _xfa_object.XFAObject {
  60626. constructor(attributes) {
  60627. super(TEMPLATE_NS_ID, "subjectDNs", true);
  60628. this.id = attributes.id || "";
  60629. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  60630. this.use = attributes.use || "";
  60631. this.usehref = attributes.usehref || "";
  60632. this.subjectDN = new _xfa_object.XFAObjectArray();
  60633. }
  60634. }
  60635. class Submit extends _xfa_object.XFAObject {
  60636. constructor(attributes) {
  60637. super(TEMPLATE_NS_ID, "submit", true);
  60638. this.embedPDF = (0, _utils.getInteger)({
  60639. data: attributes.embedPDF,
  60640. defaultValue: 0,
  60641. validate: x => x === 1
  60642. });
  60643. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  60644. this.id = attributes.id || "";
  60645. this.target = attributes.target || "";
  60646. this.textEncoding = (0, _utils.getKeyword)({
  60647. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  60648. defaultValue: "",
  60649. 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}/)
  60650. });
  60651. this.use = attributes.use || "";
  60652. this.usehref = attributes.usehref || "";
  60653. this.xdpContent = attributes.xdpContent || "";
  60654. this.encrypt = null;
  60655. this.encryptData = new _xfa_object.XFAObjectArray();
  60656. this.signData = new _xfa_object.XFAObjectArray();
  60657. }
  60658. }
  60659. class Template extends _xfa_object.XFAObject {
  60660. constructor(attributes) {
  60661. super(TEMPLATE_NS_ID, "template", true);
  60662. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  60663. this.extras = null;
  60664. this.subform = new _xfa_object.XFAObjectArray();
  60665. }
  60666. [_xfa_object.$finalize]() {
  60667. if (this.subform.children.length === 0) {
  60668. (0, _util.warn)("XFA - No subforms in template node.");
  60669. }
  60670. if (this.subform.children.length >= 2) {
  60671. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  60672. }
  60673. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  60674. }
  60675. [_xfa_object.$isSplittable]() {
  60676. return true;
  60677. }
  60678. [_xfa_object.$searchNode](expr, container) {
  60679. if (expr.startsWith("#")) {
  60680. return [this[_xfa_object.$ids].get(expr.slice(1))];
  60681. }
  60682. return (0, _som.searchNode)(this, container, expr, true, true);
  60683. }
  60684. *[_xfa_object.$toPages]() {
  60685. if (!this.subform.children.length) {
  60686. return _utils.HTMLResult.success({
  60687. name: "div",
  60688. children: []
  60689. });
  60690. }
  60691. this[_xfa_object.$extra] = {
  60692. overflowNode: null,
  60693. firstUnsplittable: null,
  60694. currentContentArea: null,
  60695. currentPageArea: null,
  60696. noLayoutFailure: false,
  60697. pageNumber: 1,
  60698. pagePosition: "first",
  60699. oddOrEven: "odd",
  60700. blankOrNotBlank: "nonBlank",
  60701. paraStack: []
  60702. };
  60703. const root = this.subform.children[0];
  60704. root.pageSet[_xfa_object.$cleanPage]();
  60705. const pageAreas = root.pageSet.pageArea.children;
  60706. const mainHtml = {
  60707. name: "div",
  60708. children: []
  60709. };
  60710. let pageArea = null;
  60711. let breakBefore = null;
  60712. let breakBeforeTarget = null;
  60713. if (root.breakBefore.children.length >= 1) {
  60714. breakBefore = root.breakBefore.children[0];
  60715. breakBeforeTarget = breakBefore.target;
  60716. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  60717. breakBefore = root.subform.children[0].breakBefore.children[0];
  60718. breakBeforeTarget = breakBefore.target;
  60719. } else if (root.break && root.break.beforeTarget) {
  60720. breakBefore = root.break;
  60721. breakBeforeTarget = breakBefore.beforeTarget;
  60722. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  60723. breakBefore = root.subform.children[0].break;
  60724. breakBeforeTarget = breakBefore.beforeTarget;
  60725. }
  60726. if (breakBefore) {
  60727. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  60728. if (target instanceof PageArea) {
  60729. pageArea = target;
  60730. breakBefore[_xfa_object.$extra] = {};
  60731. }
  60732. }
  60733. if (!pageArea) {
  60734. pageArea = pageAreas[0];
  60735. }
  60736. pageArea[_xfa_object.$extra] = {
  60737. numberOfUse: 1
  60738. };
  60739. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  60740. pageAreaParent[_xfa_object.$extra] = {
  60741. numberOfUse: 1,
  60742. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  60743. pageSetIndex: 0
  60744. };
  60745. let targetPageArea;
  60746. let leader = null;
  60747. let trailer = null;
  60748. let hasSomething = true;
  60749. let hasSomethingCounter = 0;
  60750. let startIndex = 0;
  60751. while (true) {
  60752. if (!hasSomething) {
  60753. mainHtml.children.pop();
  60754. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  60755. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  60756. return mainHtml;
  60757. }
  60758. } else {
  60759. hasSomethingCounter = 0;
  60760. }
  60761. targetPageArea = null;
  60762. this[_xfa_object.$extra].currentPageArea = pageArea;
  60763. const page = pageArea[_xfa_object.$toHTML]().html;
  60764. mainHtml.children.push(page);
  60765. if (leader) {
  60766. this[_xfa_object.$extra].noLayoutFailure = true;
  60767. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  60768. leader = null;
  60769. }
  60770. if (trailer) {
  60771. this[_xfa_object.$extra].noLayoutFailure = true;
  60772. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  60773. trailer = null;
  60774. }
  60775. const contentAreas = pageArea.contentArea.children;
  60776. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  60777. hasSomething = false;
  60778. this[_xfa_object.$extra].firstUnsplittable = null;
  60779. this[_xfa_object.$extra].noLayoutFailure = false;
  60780. const flush = index => {
  60781. const html = root[_xfa_object.$flushHTML]();
  60782. if (html) {
  60783. hasSomething = hasSomething || html.children && html.children.length !== 0;
  60784. htmlContentAreas[index].children.push(html);
  60785. }
  60786. };
  60787. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  60788. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  60789. const space = {
  60790. width: contentArea.w,
  60791. height: contentArea.h
  60792. };
  60793. startIndex = 0;
  60794. if (leader) {
  60795. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  60796. leader = null;
  60797. }
  60798. if (trailer) {
  60799. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  60800. trailer = null;
  60801. }
  60802. const html = root[_xfa_object.$toHTML](space);
  60803. if (html.success) {
  60804. if (html.html) {
  60805. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  60806. htmlContentAreas[i].children.push(html.html);
  60807. } else if (!hasSomething && mainHtml.children.length > 1) {
  60808. mainHtml.children.pop();
  60809. }
  60810. return mainHtml;
  60811. }
  60812. if (html.isBreak()) {
  60813. const node = html.breakNode;
  60814. flush(i);
  60815. if (node.targetType === "auto") {
  60816. continue;
  60817. }
  60818. if (node.leader) {
  60819. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  60820. leader = leader ? leader[0] : null;
  60821. }
  60822. if (node.trailer) {
  60823. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  60824. trailer = trailer ? trailer[0] : null;
  60825. }
  60826. if (node.targetType === "pageArea") {
  60827. targetPageArea = node[_xfa_object.$extra].target;
  60828. i = Infinity;
  60829. } else if (!node[_xfa_object.$extra].target) {
  60830. i = node[_xfa_object.$extra].index;
  60831. } else {
  60832. targetPageArea = node[_xfa_object.$extra].target;
  60833. startIndex = node[_xfa_object.$extra].index + 1;
  60834. i = Infinity;
  60835. }
  60836. continue;
  60837. }
  60838. if (this[_xfa_object.$extra].overflowNode) {
  60839. const node = this[_xfa_object.$extra].overflowNode;
  60840. this[_xfa_object.$extra].overflowNode = null;
  60841. const overflowExtra = node[_xfa_object.$getExtra]();
  60842. const target = overflowExtra.target;
  60843. overflowExtra.addLeader = overflowExtra.leader !== null;
  60844. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  60845. flush(i);
  60846. const currentIndex = i;
  60847. i = Infinity;
  60848. if (target instanceof PageArea) {
  60849. targetPageArea = target;
  60850. } else if (target instanceof ContentArea) {
  60851. const index = contentAreas.indexOf(target);
  60852. if (index !== -1) {
  60853. if (index > currentIndex) {
  60854. i = index - 1;
  60855. } else {
  60856. startIndex = index;
  60857. }
  60858. } else {
  60859. targetPageArea = target[_xfa_object.$getParent]();
  60860. startIndex = targetPageArea.contentArea.children.indexOf(target);
  60861. }
  60862. }
  60863. continue;
  60864. }
  60865. flush(i);
  60866. }
  60867. this[_xfa_object.$extra].pageNumber += 1;
  60868. if (targetPageArea) {
  60869. if (targetPageArea[_xfa_object.$isUsable]()) {
  60870. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  60871. } else {
  60872. targetPageArea = null;
  60873. }
  60874. }
  60875. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  60876. yield null;
  60877. }
  60878. }
  60879. }
  60880. exports.Template = Template;
  60881. class Text extends _xfa_object.ContentObject {
  60882. constructor(attributes) {
  60883. super(TEMPLATE_NS_ID, "text");
  60884. this.id = attributes.id || "";
  60885. this.maxChars = (0, _utils.getInteger)({
  60886. data: attributes.maxChars,
  60887. defaultValue: 0,
  60888. validate: x => x >= 0
  60889. });
  60890. this.name = attributes.name || "";
  60891. this.rid = attributes.rid || "";
  60892. this.use = attributes.use || "";
  60893. this.usehref = attributes.usehref || "";
  60894. }
  60895. [_xfa_object.$acceptWhitespace]() {
  60896. return true;
  60897. }
  60898. [_xfa_object.$onChild](child) {
  60899. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  60900. this[_xfa_object.$content] = child;
  60901. return true;
  60902. }
  60903. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  60904. return false;
  60905. }
  60906. [_xfa_object.$onText](str) {
  60907. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  60908. return;
  60909. }
  60910. super[_xfa_object.$onText](str);
  60911. }
  60912. [_xfa_object.$finalize]() {
  60913. if (typeof this[_xfa_object.$content] === "string") {
  60914. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  60915. }
  60916. }
  60917. [_xfa_object.$getExtra]() {
  60918. if (typeof this[_xfa_object.$content] === "string") {
  60919. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  60920. if (line) {
  60921. acc.push(line);
  60922. }
  60923. return acc;
  60924. }, []).join("\n");
  60925. }
  60926. return this[_xfa_object.$content][_xfa_object.$text]();
  60927. }
  60928. [_xfa_object.$toHTML](availableSpace) {
  60929. if (typeof this[_xfa_object.$content] === "string") {
  60930. const html = valueToHtml(this[_xfa_object.$content]).html;
  60931. if (this[_xfa_object.$content].includes("\u2029")) {
  60932. html.name = "div";
  60933. html.children = [];
  60934. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  60935. acc.push({
  60936. name: "span",
  60937. value: line
  60938. }, {
  60939. name: "br"
  60940. });
  60941. return acc;
  60942. }, [])).forEach(lines => {
  60943. html.children.push({
  60944. name: "p",
  60945. children: lines
  60946. });
  60947. });
  60948. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  60949. html.name = "div";
  60950. html.children = [];
  60951. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  60952. html.children.push({
  60953. name: "span",
  60954. value: line
  60955. }, {
  60956. name: "br"
  60957. });
  60958. });
  60959. }
  60960. return _utils.HTMLResult.success(html);
  60961. }
  60962. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  60963. }
  60964. }
  60965. exports.Text = Text;
  60966. class TextEdit extends _xfa_object.XFAObject {
  60967. constructor(attributes) {
  60968. super(TEMPLATE_NS_ID, "textEdit", true);
  60969. this.allowRichText = (0, _utils.getInteger)({
  60970. data: attributes.allowRichText,
  60971. defaultValue: 0,
  60972. validate: x => x === 1
  60973. });
  60974. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  60975. this.id = attributes.id || "";
  60976. this.multiLine = (0, _utils.getInteger)({
  60977. data: attributes.multiLine,
  60978. defaultValue: "",
  60979. validate: x => x === 0 || x === 1
  60980. });
  60981. this.use = attributes.use || "";
  60982. this.usehref = attributes.usehref || "";
  60983. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  60984. this.border = null;
  60985. this.comb = null;
  60986. this.extras = null;
  60987. this.margin = null;
  60988. }
  60989. [_xfa_object.$toHTML](availableSpace) {
  60990. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  60991. let html;
  60992. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  60993. if (this.multiLine === "") {
  60994. this.multiLine = field instanceof Draw ? 1 : 0;
  60995. }
  60996. if (this.multiLine === 1) {
  60997. html = {
  60998. name: "textarea",
  60999. attributes: {
  61000. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  61001. fieldId: field[_xfa_object.$uid],
  61002. class: ["xfaTextfield"],
  61003. style,
  61004. "aria-label": ariaLabel(field),
  61005. "aria-required": false
  61006. }
  61007. };
  61008. } else {
  61009. html = {
  61010. name: "input",
  61011. attributes: {
  61012. type: "text",
  61013. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  61014. fieldId: field[_xfa_object.$uid],
  61015. class: ["xfaTextfield"],
  61016. style,
  61017. "aria-label": ariaLabel(field),
  61018. "aria-required": false
  61019. }
  61020. };
  61021. }
  61022. if (isRequired(field)) {
  61023. html.attributes["aria-required"] = true;
  61024. html.attributes.required = true;
  61025. }
  61026. return _utils.HTMLResult.success({
  61027. name: "label",
  61028. attributes: {
  61029. class: ["xfaLabel"]
  61030. },
  61031. children: [html]
  61032. });
  61033. }
  61034. }
  61035. class Time extends _xfa_object.StringObject {
  61036. constructor(attributes) {
  61037. super(TEMPLATE_NS_ID, "time");
  61038. this.id = attributes.id || "";
  61039. this.name = attributes.name || "";
  61040. this.use = attributes.use || "";
  61041. this.usehref = attributes.usehref || "";
  61042. }
  61043. [_xfa_object.$finalize]() {
  61044. const date = this[_xfa_object.$content].trim();
  61045. this[_xfa_object.$content] = date ? new Date(date) : null;
  61046. }
  61047. [_xfa_object.$toHTML](availableSpace) {
  61048. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  61049. }
  61050. }
  61051. class TimeStamp extends _xfa_object.XFAObject {
  61052. constructor(attributes) {
  61053. super(TEMPLATE_NS_ID, "timeStamp");
  61054. this.id = attributes.id || "";
  61055. this.server = attributes.server || "";
  61056. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  61057. this.use = attributes.use || "";
  61058. this.usehref = attributes.usehref || "";
  61059. }
  61060. }
  61061. class ToolTip extends _xfa_object.StringObject {
  61062. constructor(attributes) {
  61063. super(TEMPLATE_NS_ID, "toolTip");
  61064. this.id = attributes.id || "";
  61065. this.rid = attributes.rid || "";
  61066. this.use = attributes.use || "";
  61067. this.usehref = attributes.usehref || "";
  61068. }
  61069. }
  61070. class Traversal extends _xfa_object.XFAObject {
  61071. constructor(attributes) {
  61072. super(TEMPLATE_NS_ID, "traversal", true);
  61073. this.id = attributes.id || "";
  61074. this.use = attributes.use || "";
  61075. this.usehref = attributes.usehref || "";
  61076. this.extras = null;
  61077. this.traverse = new _xfa_object.XFAObjectArray();
  61078. }
  61079. }
  61080. class Traverse extends _xfa_object.XFAObject {
  61081. constructor(attributes) {
  61082. super(TEMPLATE_NS_ID, "traverse", true);
  61083. this.id = attributes.id || "";
  61084. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  61085. this.ref = attributes.ref || "";
  61086. this.use = attributes.use || "";
  61087. this.usehref = attributes.usehref || "";
  61088. this.extras = null;
  61089. this.script = null;
  61090. }
  61091. get name() {
  61092. return this.operation;
  61093. }
  61094. [_xfa_object.$isTransparent]() {
  61095. return false;
  61096. }
  61097. }
  61098. class Ui extends _xfa_object.XFAObject {
  61099. constructor(attributes) {
  61100. super(TEMPLATE_NS_ID, "ui", true);
  61101. this.id = attributes.id || "";
  61102. this.use = attributes.use || "";
  61103. this.usehref = attributes.usehref || "";
  61104. this.extras = null;
  61105. this.picture = null;
  61106. this.barcode = null;
  61107. this.button = null;
  61108. this.checkButton = null;
  61109. this.choiceList = null;
  61110. this.dateTimeEdit = null;
  61111. this.defaultUi = null;
  61112. this.imageEdit = null;
  61113. this.numericEdit = null;
  61114. this.passwordEdit = null;
  61115. this.signature = null;
  61116. this.textEdit = null;
  61117. }
  61118. [_xfa_object.$getExtra]() {
  61119. if (this[_xfa_object.$extra] === undefined) {
  61120. for (const name of Object.getOwnPropertyNames(this)) {
  61121. if (name === "extras" || name === "picture") {
  61122. continue;
  61123. }
  61124. const obj = this[name];
  61125. if (!(obj instanceof _xfa_object.XFAObject)) {
  61126. continue;
  61127. }
  61128. this[_xfa_object.$extra] = obj;
  61129. return obj;
  61130. }
  61131. this[_xfa_object.$extra] = null;
  61132. }
  61133. return this[_xfa_object.$extra];
  61134. }
  61135. [_xfa_object.$toHTML](availableSpace) {
  61136. const obj = this[_xfa_object.$getExtra]();
  61137. if (obj) {
  61138. return obj[_xfa_object.$toHTML](availableSpace);
  61139. }
  61140. return _utils.HTMLResult.EMPTY;
  61141. }
  61142. }
  61143. class Validate extends _xfa_object.XFAObject {
  61144. constructor(attributes) {
  61145. super(TEMPLATE_NS_ID, "validate", true);
  61146. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  61147. this.id = attributes.id || "";
  61148. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  61149. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  61150. this.use = attributes.use || "";
  61151. this.usehref = attributes.usehref || "";
  61152. this.extras = null;
  61153. this.message = null;
  61154. this.picture = null;
  61155. this.script = null;
  61156. }
  61157. }
  61158. class Value extends _xfa_object.XFAObject {
  61159. constructor(attributes) {
  61160. super(TEMPLATE_NS_ID, "value", true);
  61161. this.id = attributes.id || "";
  61162. this.override = (0, _utils.getInteger)({
  61163. data: attributes.override,
  61164. defaultValue: 0,
  61165. validate: x => x === 1
  61166. });
  61167. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  61168. this.use = attributes.use || "";
  61169. this.usehref = attributes.usehref || "";
  61170. this.arc = null;
  61171. this.boolean = null;
  61172. this.date = null;
  61173. this.dateTime = null;
  61174. this.decimal = null;
  61175. this.exData = null;
  61176. this.float = null;
  61177. this.image = null;
  61178. this.integer = null;
  61179. this.line = null;
  61180. this.rectangle = null;
  61181. this.text = null;
  61182. this.time = null;
  61183. }
  61184. [_xfa_object.$setValue](value) {
  61185. const parent = this[_xfa_object.$getParent]();
  61186. if (parent instanceof Field) {
  61187. if (parent.ui && parent.ui.imageEdit) {
  61188. if (!this.image) {
  61189. this.image = new Image({});
  61190. this[_xfa_object.$appendChild](this.image);
  61191. }
  61192. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  61193. return;
  61194. }
  61195. }
  61196. const valueName = value[_xfa_object.$nodeName];
  61197. if (this[valueName] !== null) {
  61198. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  61199. return;
  61200. }
  61201. for (const name of Object.getOwnPropertyNames(this)) {
  61202. const obj = this[name];
  61203. if (obj instanceof _xfa_object.XFAObject) {
  61204. this[name] = null;
  61205. this[_xfa_object.$removeChild](obj);
  61206. }
  61207. }
  61208. this[value[_xfa_object.$nodeName]] = value;
  61209. this[_xfa_object.$appendChild](value);
  61210. }
  61211. [_xfa_object.$text]() {
  61212. if (this.exData) {
  61213. if (typeof this.exData[_xfa_object.$content] === "string") {
  61214. return this.exData[_xfa_object.$content].trim();
  61215. }
  61216. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  61217. }
  61218. for (const name of Object.getOwnPropertyNames(this)) {
  61219. if (name === "image") {
  61220. continue;
  61221. }
  61222. const obj = this[name];
  61223. if (obj instanceof _xfa_object.XFAObject) {
  61224. return (obj[_xfa_object.$content] || "").toString().trim();
  61225. }
  61226. }
  61227. return null;
  61228. }
  61229. [_xfa_object.$toHTML](availableSpace) {
  61230. for (const name of Object.getOwnPropertyNames(this)) {
  61231. const obj = this[name];
  61232. if (!(obj instanceof _xfa_object.XFAObject)) {
  61233. continue;
  61234. }
  61235. return obj[_xfa_object.$toHTML](availableSpace);
  61236. }
  61237. return _utils.HTMLResult.EMPTY;
  61238. }
  61239. }
  61240. exports.Value = Value;
  61241. class Variables extends _xfa_object.XFAObject {
  61242. constructor(attributes) {
  61243. super(TEMPLATE_NS_ID, "variables", true);
  61244. this.id = attributes.id || "";
  61245. this.use = attributes.use || "";
  61246. this.usehref = attributes.usehref || "";
  61247. this.boolean = new _xfa_object.XFAObjectArray();
  61248. this.date = new _xfa_object.XFAObjectArray();
  61249. this.dateTime = new _xfa_object.XFAObjectArray();
  61250. this.decimal = new _xfa_object.XFAObjectArray();
  61251. this.exData = new _xfa_object.XFAObjectArray();
  61252. this.float = new _xfa_object.XFAObjectArray();
  61253. this.image = new _xfa_object.XFAObjectArray();
  61254. this.integer = new _xfa_object.XFAObjectArray();
  61255. this.manifest = new _xfa_object.XFAObjectArray();
  61256. this.script = new _xfa_object.XFAObjectArray();
  61257. this.text = new _xfa_object.XFAObjectArray();
  61258. this.time = new _xfa_object.XFAObjectArray();
  61259. }
  61260. [_xfa_object.$isTransparent]() {
  61261. return true;
  61262. }
  61263. }
  61264. class TemplateNamespace {
  61265. static [_namespaces.$buildXFAObject](name, attributes) {
  61266. if (TemplateNamespace.hasOwnProperty(name)) {
  61267. const node = TemplateNamespace[name](attributes);
  61268. node[_xfa_object.$setSetAttributes](attributes);
  61269. return node;
  61270. }
  61271. return undefined;
  61272. }
  61273. static appearanceFilter(attrs) {
  61274. return new AppearanceFilter(attrs);
  61275. }
  61276. static arc(attrs) {
  61277. return new Arc(attrs);
  61278. }
  61279. static area(attrs) {
  61280. return new Area(attrs);
  61281. }
  61282. static assist(attrs) {
  61283. return new Assist(attrs);
  61284. }
  61285. static barcode(attrs) {
  61286. return new Barcode(attrs);
  61287. }
  61288. static bind(attrs) {
  61289. return new Bind(attrs);
  61290. }
  61291. static bindItems(attrs) {
  61292. return new BindItems(attrs);
  61293. }
  61294. static bookend(attrs) {
  61295. return new Bookend(attrs);
  61296. }
  61297. static boolean(attrs) {
  61298. return new BooleanElement(attrs);
  61299. }
  61300. static border(attrs) {
  61301. return new Border(attrs);
  61302. }
  61303. static break(attrs) {
  61304. return new Break(attrs);
  61305. }
  61306. static breakAfter(attrs) {
  61307. return new BreakAfter(attrs);
  61308. }
  61309. static breakBefore(attrs) {
  61310. return new BreakBefore(attrs);
  61311. }
  61312. static button(attrs) {
  61313. return new Button(attrs);
  61314. }
  61315. static calculate(attrs) {
  61316. return new Calculate(attrs);
  61317. }
  61318. static caption(attrs) {
  61319. return new Caption(attrs);
  61320. }
  61321. static certificate(attrs) {
  61322. return new Certificate(attrs);
  61323. }
  61324. static certificates(attrs) {
  61325. return new Certificates(attrs);
  61326. }
  61327. static checkButton(attrs) {
  61328. return new CheckButton(attrs);
  61329. }
  61330. static choiceList(attrs) {
  61331. return new ChoiceList(attrs);
  61332. }
  61333. static color(attrs) {
  61334. return new Color(attrs);
  61335. }
  61336. static comb(attrs) {
  61337. return new Comb(attrs);
  61338. }
  61339. static connect(attrs) {
  61340. return new Connect(attrs);
  61341. }
  61342. static contentArea(attrs) {
  61343. return new ContentArea(attrs);
  61344. }
  61345. static corner(attrs) {
  61346. return new Corner(attrs);
  61347. }
  61348. static date(attrs) {
  61349. return new DateElement(attrs);
  61350. }
  61351. static dateTime(attrs) {
  61352. return new DateTime(attrs);
  61353. }
  61354. static dateTimeEdit(attrs) {
  61355. return new DateTimeEdit(attrs);
  61356. }
  61357. static decimal(attrs) {
  61358. return new Decimal(attrs);
  61359. }
  61360. static defaultUi(attrs) {
  61361. return new DefaultUi(attrs);
  61362. }
  61363. static desc(attrs) {
  61364. return new Desc(attrs);
  61365. }
  61366. static digestMethod(attrs) {
  61367. return new DigestMethod(attrs);
  61368. }
  61369. static digestMethods(attrs) {
  61370. return new DigestMethods(attrs);
  61371. }
  61372. static draw(attrs) {
  61373. return new Draw(attrs);
  61374. }
  61375. static edge(attrs) {
  61376. return new Edge(attrs);
  61377. }
  61378. static encoding(attrs) {
  61379. return new Encoding(attrs);
  61380. }
  61381. static encodings(attrs) {
  61382. return new Encodings(attrs);
  61383. }
  61384. static encrypt(attrs) {
  61385. return new Encrypt(attrs);
  61386. }
  61387. static encryptData(attrs) {
  61388. return new EncryptData(attrs);
  61389. }
  61390. static encryption(attrs) {
  61391. return new Encryption(attrs);
  61392. }
  61393. static encryptionMethod(attrs) {
  61394. return new EncryptionMethod(attrs);
  61395. }
  61396. static encryptionMethods(attrs) {
  61397. return new EncryptionMethods(attrs);
  61398. }
  61399. static event(attrs) {
  61400. return new Event(attrs);
  61401. }
  61402. static exData(attrs) {
  61403. return new ExData(attrs);
  61404. }
  61405. static exObject(attrs) {
  61406. return new ExObject(attrs);
  61407. }
  61408. static exclGroup(attrs) {
  61409. return new ExclGroup(attrs);
  61410. }
  61411. static execute(attrs) {
  61412. return new Execute(attrs);
  61413. }
  61414. static extras(attrs) {
  61415. return new Extras(attrs);
  61416. }
  61417. static field(attrs) {
  61418. return new Field(attrs);
  61419. }
  61420. static fill(attrs) {
  61421. return new Fill(attrs);
  61422. }
  61423. static filter(attrs) {
  61424. return new Filter(attrs);
  61425. }
  61426. static float(attrs) {
  61427. return new Float(attrs);
  61428. }
  61429. static font(attrs) {
  61430. return new Font(attrs);
  61431. }
  61432. static format(attrs) {
  61433. return new Format(attrs);
  61434. }
  61435. static handler(attrs) {
  61436. return new Handler(attrs);
  61437. }
  61438. static hyphenation(attrs) {
  61439. return new Hyphenation(attrs);
  61440. }
  61441. static image(attrs) {
  61442. return new Image(attrs);
  61443. }
  61444. static imageEdit(attrs) {
  61445. return new ImageEdit(attrs);
  61446. }
  61447. static integer(attrs) {
  61448. return new Integer(attrs);
  61449. }
  61450. static issuers(attrs) {
  61451. return new Issuers(attrs);
  61452. }
  61453. static items(attrs) {
  61454. return new Items(attrs);
  61455. }
  61456. static keep(attrs) {
  61457. return new Keep(attrs);
  61458. }
  61459. static keyUsage(attrs) {
  61460. return new KeyUsage(attrs);
  61461. }
  61462. static line(attrs) {
  61463. return new Line(attrs);
  61464. }
  61465. static linear(attrs) {
  61466. return new Linear(attrs);
  61467. }
  61468. static lockDocument(attrs) {
  61469. return new LockDocument(attrs);
  61470. }
  61471. static manifest(attrs) {
  61472. return new Manifest(attrs);
  61473. }
  61474. static margin(attrs) {
  61475. return new Margin(attrs);
  61476. }
  61477. static mdp(attrs) {
  61478. return new Mdp(attrs);
  61479. }
  61480. static medium(attrs) {
  61481. return new Medium(attrs);
  61482. }
  61483. static message(attrs) {
  61484. return new Message(attrs);
  61485. }
  61486. static numericEdit(attrs) {
  61487. return new NumericEdit(attrs);
  61488. }
  61489. static occur(attrs) {
  61490. return new Occur(attrs);
  61491. }
  61492. static oid(attrs) {
  61493. return new Oid(attrs);
  61494. }
  61495. static oids(attrs) {
  61496. return new Oids(attrs);
  61497. }
  61498. static overflow(attrs) {
  61499. return new Overflow(attrs);
  61500. }
  61501. static pageArea(attrs) {
  61502. return new PageArea(attrs);
  61503. }
  61504. static pageSet(attrs) {
  61505. return new PageSet(attrs);
  61506. }
  61507. static para(attrs) {
  61508. return new Para(attrs);
  61509. }
  61510. static passwordEdit(attrs) {
  61511. return new PasswordEdit(attrs);
  61512. }
  61513. static pattern(attrs) {
  61514. return new Pattern(attrs);
  61515. }
  61516. static picture(attrs) {
  61517. return new Picture(attrs);
  61518. }
  61519. static proto(attrs) {
  61520. return new Proto(attrs);
  61521. }
  61522. static radial(attrs) {
  61523. return new Radial(attrs);
  61524. }
  61525. static reason(attrs) {
  61526. return new Reason(attrs);
  61527. }
  61528. static reasons(attrs) {
  61529. return new Reasons(attrs);
  61530. }
  61531. static rectangle(attrs) {
  61532. return new Rectangle(attrs);
  61533. }
  61534. static ref(attrs) {
  61535. return new RefElement(attrs);
  61536. }
  61537. static script(attrs) {
  61538. return new Script(attrs);
  61539. }
  61540. static setProperty(attrs) {
  61541. return new SetProperty(attrs);
  61542. }
  61543. static signData(attrs) {
  61544. return new SignData(attrs);
  61545. }
  61546. static signature(attrs) {
  61547. return new Signature(attrs);
  61548. }
  61549. static signing(attrs) {
  61550. return new Signing(attrs);
  61551. }
  61552. static solid(attrs) {
  61553. return new Solid(attrs);
  61554. }
  61555. static speak(attrs) {
  61556. return new Speak(attrs);
  61557. }
  61558. static stipple(attrs) {
  61559. return new Stipple(attrs);
  61560. }
  61561. static subform(attrs) {
  61562. return new Subform(attrs);
  61563. }
  61564. static subformSet(attrs) {
  61565. return new SubformSet(attrs);
  61566. }
  61567. static subjectDN(attrs) {
  61568. return new SubjectDN(attrs);
  61569. }
  61570. static subjectDNs(attrs) {
  61571. return new SubjectDNs(attrs);
  61572. }
  61573. static submit(attrs) {
  61574. return new Submit(attrs);
  61575. }
  61576. static template(attrs) {
  61577. return new Template(attrs);
  61578. }
  61579. static text(attrs) {
  61580. return new Text(attrs);
  61581. }
  61582. static textEdit(attrs) {
  61583. return new TextEdit(attrs);
  61584. }
  61585. static time(attrs) {
  61586. return new Time(attrs);
  61587. }
  61588. static timeStamp(attrs) {
  61589. return new TimeStamp(attrs);
  61590. }
  61591. static toolTip(attrs) {
  61592. return new ToolTip(attrs);
  61593. }
  61594. static traversal(attrs) {
  61595. return new Traversal(attrs);
  61596. }
  61597. static traverse(attrs) {
  61598. return new Traverse(attrs);
  61599. }
  61600. static ui(attrs) {
  61601. return new Ui(attrs);
  61602. }
  61603. static validate(attrs) {
  61604. return new Validate(attrs);
  61605. }
  61606. static value(attrs) {
  61607. return new Value(attrs);
  61608. }
  61609. static variables(attrs) {
  61610. return new Variables(attrs);
  61611. }
  61612. }
  61613. exports.TemplateNamespace = TemplateNamespace;
  61614. /***/ }),
  61615. /* 212 */
  61616. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61617. "use strict";
  61618. Object.defineProperty(exports, "__esModule", ({
  61619. value: true
  61620. }));
  61621. exports.addHTML = addHTML;
  61622. exports.checkDimensions = checkDimensions;
  61623. exports.flushHTML = flushHTML;
  61624. exports.getAvailableSpace = getAvailableSpace;
  61625. var _xfa_object = __w_pdfjs_require__(206);
  61626. var _html_utils = __w_pdfjs_require__(213);
  61627. function createLine(node, children) {
  61628. return {
  61629. name: "div",
  61630. attributes: {
  61631. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  61632. },
  61633. children
  61634. };
  61635. }
  61636. function flushHTML(node) {
  61637. if (!node[_xfa_object.$extra]) {
  61638. return null;
  61639. }
  61640. const attributes = node[_xfa_object.$extra].attributes;
  61641. const html = {
  61642. name: "div",
  61643. attributes,
  61644. children: node[_xfa_object.$extra].children
  61645. };
  61646. if (node[_xfa_object.$extra].failingNode) {
  61647. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  61648. if (htmlFromFailing) {
  61649. if (node.layout.endsWith("-tb")) {
  61650. html.children.push(createLine(node, [htmlFromFailing]));
  61651. } else {
  61652. html.children.push(htmlFromFailing);
  61653. }
  61654. }
  61655. }
  61656. if (html.children.length === 0) {
  61657. return null;
  61658. }
  61659. return html;
  61660. }
  61661. function addHTML(node, html, bbox) {
  61662. const extra = node[_xfa_object.$extra];
  61663. const availableSpace = extra.availableSpace;
  61664. const [x, y, w, h] = bbox;
  61665. switch (node.layout) {
  61666. case "position":
  61667. {
  61668. extra.width = Math.max(extra.width, x + w);
  61669. extra.height = Math.max(extra.height, y + h);
  61670. extra.children.push(html);
  61671. break;
  61672. }
  61673. case "lr-tb":
  61674. case "rl-tb":
  61675. if (!extra.line || extra.attempt === 1) {
  61676. extra.line = createLine(node, []);
  61677. extra.children.push(extra.line);
  61678. extra.numberInLine = 0;
  61679. }
  61680. extra.numberInLine += 1;
  61681. extra.line.children.push(html);
  61682. if (extra.attempt === 0) {
  61683. extra.currentWidth += w;
  61684. extra.height = Math.max(extra.height, extra.prevHeight + h);
  61685. } else {
  61686. extra.currentWidth = w;
  61687. extra.prevHeight = extra.height;
  61688. extra.height += h;
  61689. extra.attempt = 0;
  61690. }
  61691. extra.width = Math.max(extra.width, extra.currentWidth);
  61692. break;
  61693. case "rl-row":
  61694. case "row":
  61695. {
  61696. extra.children.push(html);
  61697. extra.width += w;
  61698. extra.height = Math.max(extra.height, h);
  61699. const height = (0, _html_utils.measureToString)(extra.height);
  61700. for (const child of extra.children) {
  61701. child.attributes.style.height = height;
  61702. }
  61703. break;
  61704. }
  61705. case "table":
  61706. {
  61707. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  61708. extra.height += h;
  61709. extra.children.push(html);
  61710. break;
  61711. }
  61712. case "tb":
  61713. {
  61714. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  61715. extra.height += h;
  61716. extra.children.push(html);
  61717. break;
  61718. }
  61719. }
  61720. }
  61721. function getAvailableSpace(node) {
  61722. const availableSpace = node[_xfa_object.$extra].availableSpace;
  61723. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  61724. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  61725. switch (node.layout) {
  61726. case "lr-tb":
  61727. case "rl-tb":
  61728. if (node[_xfa_object.$extra].attempt === 0) {
  61729. return {
  61730. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  61731. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  61732. };
  61733. }
  61734. return {
  61735. width: availableSpace.width - marginH,
  61736. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  61737. };
  61738. case "rl-row":
  61739. case "row":
  61740. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  61741. return {
  61742. width,
  61743. height: availableSpace.height - marginH
  61744. };
  61745. case "table":
  61746. case "tb":
  61747. return {
  61748. width: availableSpace.width - marginH,
  61749. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  61750. };
  61751. case "position":
  61752. default:
  61753. return availableSpace;
  61754. }
  61755. }
  61756. function getTransformedBBox(node) {
  61757. let w = node.w === "" ? NaN : node.w;
  61758. let h = node.h === "" ? NaN : node.h;
  61759. let [centerX, centerY] = [0, 0];
  61760. switch (node.anchorType || "") {
  61761. case "bottomCenter":
  61762. [centerX, centerY] = [w / 2, h];
  61763. break;
  61764. case "bottomLeft":
  61765. [centerX, centerY] = [0, h];
  61766. break;
  61767. case "bottomRight":
  61768. [centerX, centerY] = [w, h];
  61769. break;
  61770. case "middleCenter":
  61771. [centerX, centerY] = [w / 2, h / 2];
  61772. break;
  61773. case "middleLeft":
  61774. [centerX, centerY] = [0, h / 2];
  61775. break;
  61776. case "middleRight":
  61777. [centerX, centerY] = [w, h / 2];
  61778. break;
  61779. case "topCenter":
  61780. [centerX, centerY] = [w / 2, 0];
  61781. break;
  61782. case "topRight":
  61783. [centerX, centerY] = [w, 0];
  61784. break;
  61785. }
  61786. let x, y;
  61787. switch (node.rotate || 0) {
  61788. case 0:
  61789. [x, y] = [-centerX, -centerY];
  61790. break;
  61791. case 90:
  61792. [x, y] = [-centerY, centerX];
  61793. [w, h] = [h, -w];
  61794. break;
  61795. case 180:
  61796. [x, y] = [centerX, centerY];
  61797. [w, h] = [-w, -h];
  61798. break;
  61799. case 270:
  61800. [x, y] = [centerY, -centerX];
  61801. [w, h] = [-h, w];
  61802. break;
  61803. }
  61804. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  61805. }
  61806. function checkDimensions(node, space) {
  61807. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  61808. return true;
  61809. }
  61810. if (node.w === 0 || node.h === 0) {
  61811. return true;
  61812. }
  61813. const ERROR = 2;
  61814. const parent = node[_xfa_object.$getSubformParent]();
  61815. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  61816. const [, y, w, h] = getTransformedBBox(node);
  61817. switch (parent.layout) {
  61818. case "lr-tb":
  61819. case "rl-tb":
  61820. if (attempt === 0) {
  61821. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61822. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  61823. return false;
  61824. }
  61825. if (node.w !== "") {
  61826. if (Math.round(w - space.width) <= ERROR) {
  61827. return true;
  61828. }
  61829. if (parent[_xfa_object.$extra].numberInLine === 0) {
  61830. return space.height > ERROR;
  61831. }
  61832. return false;
  61833. }
  61834. return space.width > ERROR;
  61835. }
  61836. if (node.w !== "") {
  61837. return Math.round(w - space.width) <= ERROR;
  61838. }
  61839. return space.width > ERROR;
  61840. }
  61841. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61842. return true;
  61843. }
  61844. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  61845. return false;
  61846. }
  61847. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  61848. return space.height > ERROR;
  61849. }
  61850. if (parent[_xfa_object.$isThereMoreWidth]()) {
  61851. return false;
  61852. }
  61853. return space.height > ERROR;
  61854. case "table":
  61855. case "tb":
  61856. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61857. return true;
  61858. }
  61859. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  61860. return Math.round(h - space.height) <= ERROR;
  61861. }
  61862. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  61863. return space.height > ERROR;
  61864. }
  61865. if (parent[_xfa_object.$isThereMoreWidth]()) {
  61866. return false;
  61867. }
  61868. return space.height > ERROR;
  61869. case "position":
  61870. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61871. return true;
  61872. }
  61873. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  61874. return true;
  61875. }
  61876. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  61877. return h + y > area.h;
  61878. case "rl-row":
  61879. case "row":
  61880. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  61881. return true;
  61882. }
  61883. if (node.h !== "") {
  61884. return Math.round(h - space.height) <= ERROR;
  61885. }
  61886. return true;
  61887. default:
  61888. return true;
  61889. }
  61890. }
  61891. /***/ }),
  61892. /* 213 */
  61893. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61894. "use strict";
  61895. Object.defineProperty(exports, "__esModule", ({
  61896. value: true
  61897. }));
  61898. exports.computeBbox = computeBbox;
  61899. exports.createWrapper = createWrapper;
  61900. exports.fixDimensions = fixDimensions;
  61901. exports.fixTextIndent = fixTextIndent;
  61902. exports.fixURL = fixURL;
  61903. exports.isPrintOnly = isPrintOnly;
  61904. exports.layoutClass = layoutClass;
  61905. exports.layoutNode = layoutNode;
  61906. exports.measureToString = measureToString;
  61907. exports.setAccess = setAccess;
  61908. exports.setFontFamily = setFontFamily;
  61909. exports.setMinMaxDimensions = setMinMaxDimensions;
  61910. exports.setPara = setPara;
  61911. exports.toStyle = toStyle;
  61912. var _xfa_object = __w_pdfjs_require__(206);
  61913. var _util = __w_pdfjs_require__(2);
  61914. var _utils = __w_pdfjs_require__(207);
  61915. var _fonts = __w_pdfjs_require__(214);
  61916. var _text = __w_pdfjs_require__(215);
  61917. function measureToString(m) {
  61918. if (typeof m === "string") {
  61919. return "0px";
  61920. }
  61921. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  61922. }
  61923. const converters = {
  61924. anchorType(node, style) {
  61925. const parent = node[_xfa_object.$getSubformParent]();
  61926. if (!parent || parent.layout && parent.layout !== "position") {
  61927. return;
  61928. }
  61929. if (!("transform" in style)) {
  61930. style.transform = "";
  61931. }
  61932. switch (node.anchorType) {
  61933. case "bottomCenter":
  61934. style.transform += "translate(-50%, -100%)";
  61935. break;
  61936. case "bottomLeft":
  61937. style.transform += "translate(0,-100%)";
  61938. break;
  61939. case "bottomRight":
  61940. style.transform += "translate(-100%,-100%)";
  61941. break;
  61942. case "middleCenter":
  61943. style.transform += "translate(-50%,-50%)";
  61944. break;
  61945. case "middleLeft":
  61946. style.transform += "translate(0,-50%)";
  61947. break;
  61948. case "middleRight":
  61949. style.transform += "translate(-100%,-50%)";
  61950. break;
  61951. case "topCenter":
  61952. style.transform += "translate(-50%,0)";
  61953. break;
  61954. case "topRight":
  61955. style.transform += "translate(-100%,0)";
  61956. break;
  61957. }
  61958. },
  61959. dimensions(node, style) {
  61960. const parent = node[_xfa_object.$getSubformParent]();
  61961. let width = node.w;
  61962. const height = node.h;
  61963. if (parent.layout && parent.layout.includes("row")) {
  61964. const extra = parent[_xfa_object.$extra];
  61965. const colSpan = node.colSpan;
  61966. let w;
  61967. if (colSpan === -1) {
  61968. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  61969. extra.currentColumn = 0;
  61970. } else {
  61971. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  61972. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  61973. }
  61974. if (!isNaN(w)) {
  61975. width = node.w = w;
  61976. }
  61977. }
  61978. if (width !== "") {
  61979. style.width = measureToString(width);
  61980. } else {
  61981. style.width = "auto";
  61982. }
  61983. if (height !== "") {
  61984. style.height = measureToString(height);
  61985. } else {
  61986. style.height = "auto";
  61987. }
  61988. },
  61989. position(node, style) {
  61990. const parent = node[_xfa_object.$getSubformParent]();
  61991. if (parent && parent.layout && parent.layout !== "position") {
  61992. return;
  61993. }
  61994. style.position = "absolute";
  61995. style.left = measureToString(node.x);
  61996. style.top = measureToString(node.y);
  61997. },
  61998. rotate(node, style) {
  61999. if (node.rotate) {
  62000. if (!("transform" in style)) {
  62001. style.transform = "";
  62002. }
  62003. style.transform += `rotate(-${node.rotate}deg)`;
  62004. style.transformOrigin = "top left";
  62005. }
  62006. },
  62007. presence(node, style) {
  62008. switch (node.presence) {
  62009. case "invisible":
  62010. style.visibility = "hidden";
  62011. break;
  62012. case "hidden":
  62013. case "inactive":
  62014. style.display = "none";
  62015. break;
  62016. }
  62017. },
  62018. hAlign(node, style) {
  62019. if (node[_xfa_object.$nodeName] === "para") {
  62020. switch (node.hAlign) {
  62021. case "justifyAll":
  62022. style.textAlign = "justify-all";
  62023. break;
  62024. case "radix":
  62025. style.textAlign = "left";
  62026. break;
  62027. default:
  62028. style.textAlign = node.hAlign;
  62029. }
  62030. } else {
  62031. switch (node.hAlign) {
  62032. case "left":
  62033. style.alignSelf = "start";
  62034. break;
  62035. case "center":
  62036. style.alignSelf = "center";
  62037. break;
  62038. case "right":
  62039. style.alignSelf = "end";
  62040. break;
  62041. }
  62042. }
  62043. },
  62044. margin(node, style) {
  62045. if (node.margin) {
  62046. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  62047. }
  62048. }
  62049. };
  62050. function setMinMaxDimensions(node, style) {
  62051. const parent = node[_xfa_object.$getSubformParent]();
  62052. if (parent.layout === "position") {
  62053. if (node.minW > 0) {
  62054. style.minWidth = measureToString(node.minW);
  62055. }
  62056. if (node.maxW > 0) {
  62057. style.maxWidth = measureToString(node.maxW);
  62058. }
  62059. if (node.minH > 0) {
  62060. style.minHeight = measureToString(node.minH);
  62061. }
  62062. if (node.maxH > 0) {
  62063. style.maxHeight = measureToString(node.maxH);
  62064. }
  62065. }
  62066. }
  62067. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  62068. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  62069. if (typeof text === "string") {
  62070. measure.addString(text);
  62071. } else {
  62072. text[_xfa_object.$pushGlyphs](measure);
  62073. }
  62074. return measure.compute(width);
  62075. }
  62076. function layoutNode(node, availableSpace) {
  62077. let height = null;
  62078. let width = null;
  62079. let isBroken = false;
  62080. if ((!node.w || !node.h) && node.value) {
  62081. let marginH = 0;
  62082. let marginV = 0;
  62083. if (node.margin) {
  62084. marginH = node.margin.leftInset + node.margin.rightInset;
  62085. marginV = node.margin.topInset + node.margin.bottomInset;
  62086. }
  62087. let lineHeight = null;
  62088. let margin = null;
  62089. if (node.para) {
  62090. margin = Object.create(null);
  62091. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  62092. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  62093. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  62094. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  62095. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  62096. }
  62097. let font = node.font;
  62098. if (!font) {
  62099. const root = node[_xfa_object.$getTemplateRoot]();
  62100. let parent = node[_xfa_object.$getParent]();
  62101. while (parent && parent !== root) {
  62102. if (parent.font) {
  62103. font = parent.font;
  62104. break;
  62105. }
  62106. parent = parent[_xfa_object.$getParent]();
  62107. }
  62108. }
  62109. const maxWidth = (node.w || availableSpace.width) - marginH;
  62110. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  62111. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  62112. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  62113. width = res.width;
  62114. height = res.height;
  62115. isBroken = res.isBroken;
  62116. } else {
  62117. const text = node.value[_xfa_object.$text]();
  62118. if (text) {
  62119. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  62120. width = res.width;
  62121. height = res.height;
  62122. isBroken = res.isBroken;
  62123. }
  62124. }
  62125. if (width !== null && !node.w) {
  62126. width += marginH;
  62127. }
  62128. if (height !== null && !node.h) {
  62129. height += marginV;
  62130. }
  62131. }
  62132. return {
  62133. w: width,
  62134. h: height,
  62135. isBroken
  62136. };
  62137. }
  62138. function computeBbox(node, html, availableSpace) {
  62139. let bbox;
  62140. if (node.w !== "" && node.h !== "") {
  62141. bbox = [node.x, node.y, node.w, node.h];
  62142. } else {
  62143. if (!availableSpace) {
  62144. return null;
  62145. }
  62146. let width = node.w;
  62147. if (width === "") {
  62148. if (node.maxW === 0) {
  62149. const parent = node[_xfa_object.$getSubformParent]();
  62150. if (parent.layout === "position" && parent.w !== "") {
  62151. width = 0;
  62152. } else {
  62153. width = node.minW;
  62154. }
  62155. } else {
  62156. width = Math.min(node.maxW, availableSpace.width);
  62157. }
  62158. html.attributes.style.width = measureToString(width);
  62159. }
  62160. let height = node.h;
  62161. if (height === "") {
  62162. if (node.maxH === 0) {
  62163. const parent = node[_xfa_object.$getSubformParent]();
  62164. if (parent.layout === "position" && parent.h !== "") {
  62165. height = 0;
  62166. } else {
  62167. height = node.minH;
  62168. }
  62169. } else {
  62170. height = Math.min(node.maxH, availableSpace.height);
  62171. }
  62172. html.attributes.style.height = measureToString(height);
  62173. }
  62174. bbox = [node.x, node.y, width, height];
  62175. }
  62176. return bbox;
  62177. }
  62178. function fixDimensions(node) {
  62179. const parent = node[_xfa_object.$getSubformParent]();
  62180. if (parent.layout && parent.layout.includes("row")) {
  62181. const extra = parent[_xfa_object.$extra];
  62182. const colSpan = node.colSpan;
  62183. let width;
  62184. if (colSpan === -1) {
  62185. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  62186. } else {
  62187. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  62188. }
  62189. if (!isNaN(width)) {
  62190. node.w = width;
  62191. }
  62192. }
  62193. if (parent.layout && parent.layout !== "position") {
  62194. node.x = node.y = 0;
  62195. }
  62196. if (node.layout === "table") {
  62197. if (node.w === "" && Array.isArray(node.columnWidths)) {
  62198. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  62199. }
  62200. }
  62201. }
  62202. function layoutClass(node) {
  62203. switch (node.layout) {
  62204. case "position":
  62205. return "xfaPosition";
  62206. case "lr-tb":
  62207. return "xfaLrTb";
  62208. case "rl-row":
  62209. return "xfaRlRow";
  62210. case "rl-tb":
  62211. return "xfaRlTb";
  62212. case "row":
  62213. return "xfaRow";
  62214. case "table":
  62215. return "xfaTable";
  62216. case "tb":
  62217. return "xfaTb";
  62218. default:
  62219. return "xfaPosition";
  62220. }
  62221. }
  62222. function toStyle(node) {
  62223. const style = Object.create(null);
  62224. for (var _len = arguments.length, names = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  62225. names[_key - 1] = arguments[_key];
  62226. }
  62227. for (const name of names) {
  62228. const value = node[name];
  62229. if (value === null) {
  62230. continue;
  62231. }
  62232. if (converters.hasOwnProperty(name)) {
  62233. converters[name](node, style);
  62234. continue;
  62235. }
  62236. if (value instanceof _xfa_object.XFAObject) {
  62237. const newStyle = value[_xfa_object.$toStyle]();
  62238. if (newStyle) {
  62239. Object.assign(style, newStyle);
  62240. } else {
  62241. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  62242. }
  62243. }
  62244. }
  62245. return style;
  62246. }
  62247. function createWrapper(node, html) {
  62248. const {
  62249. attributes
  62250. } = html;
  62251. const {
  62252. style
  62253. } = attributes;
  62254. const wrapper = {
  62255. name: "div",
  62256. attributes: {
  62257. class: ["xfaWrapper"],
  62258. style: Object.create(null)
  62259. },
  62260. children: []
  62261. };
  62262. attributes.class.push("xfaWrapped");
  62263. if (node.border) {
  62264. const {
  62265. widths,
  62266. insets
  62267. } = node.border[_xfa_object.$extra];
  62268. let width, height;
  62269. let top = insets[0];
  62270. let left = insets[3];
  62271. const insetsH = insets[0] + insets[2];
  62272. const insetsW = insets[1] + insets[3];
  62273. switch (node.border.hand) {
  62274. case "even":
  62275. top -= widths[0] / 2;
  62276. left -= widths[3] / 2;
  62277. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  62278. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  62279. break;
  62280. case "left":
  62281. top -= widths[0];
  62282. left -= widths[3];
  62283. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  62284. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  62285. break;
  62286. case "right":
  62287. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  62288. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  62289. break;
  62290. }
  62291. const classNames = ["xfaBorder"];
  62292. if (isPrintOnly(node.border)) {
  62293. classNames.push("xfaPrintOnly");
  62294. }
  62295. const border = {
  62296. name: "div",
  62297. attributes: {
  62298. class: classNames,
  62299. style: {
  62300. top: `${top}px`,
  62301. left: `${left}px`,
  62302. width,
  62303. height
  62304. }
  62305. },
  62306. children: []
  62307. };
  62308. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  62309. if (style[key] !== undefined) {
  62310. border.attributes.style[key] = style[key];
  62311. delete style[key];
  62312. }
  62313. }
  62314. wrapper.children.push(border, html);
  62315. } else {
  62316. wrapper.children.push(html);
  62317. }
  62318. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  62319. if (style[key] !== undefined) {
  62320. wrapper.attributes.style[key] = style[key];
  62321. delete style[key];
  62322. }
  62323. }
  62324. if (style.position === "absolute") {
  62325. wrapper.attributes.style.position = "absolute";
  62326. } else {
  62327. wrapper.attributes.style.position = "relative";
  62328. }
  62329. delete style.position;
  62330. if (style.alignSelf) {
  62331. wrapper.attributes.style.alignSelf = style.alignSelf;
  62332. delete style.alignSelf;
  62333. }
  62334. return wrapper;
  62335. }
  62336. function fixTextIndent(styles) {
  62337. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  62338. if (indent >= 0) {
  62339. return;
  62340. }
  62341. const align = styles.textAlign === "right" ? "right" : "left";
  62342. const name = "padding" + (align === "left" ? "Left" : "Right");
  62343. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  62344. styles[name] = `${padding - indent}px`;
  62345. }
  62346. function setAccess(node, classNames) {
  62347. switch (node.access) {
  62348. case "nonInteractive":
  62349. classNames.push("xfaNonInteractive");
  62350. break;
  62351. case "readOnly":
  62352. classNames.push("xfaReadOnly");
  62353. break;
  62354. case "protected":
  62355. classNames.push("xfaDisabled");
  62356. break;
  62357. }
  62358. }
  62359. function isPrintOnly(node) {
  62360. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  62361. }
  62362. function getCurrentPara(node) {
  62363. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  62364. return stack.length ? stack.at(-1) : null;
  62365. }
  62366. function setPara(node, nodeStyle, value) {
  62367. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  62368. if (nodeStyle) {
  62369. if (node.h === "") {
  62370. nodeStyle.height = "auto";
  62371. }
  62372. if (node.w === "") {
  62373. nodeStyle.width = "auto";
  62374. }
  62375. }
  62376. const para = getCurrentPara(node);
  62377. if (para) {
  62378. const valueStyle = value.attributes.style;
  62379. valueStyle.display = "flex";
  62380. valueStyle.flexDirection = "column";
  62381. switch (para.vAlign) {
  62382. case "top":
  62383. valueStyle.justifyContent = "start";
  62384. break;
  62385. case "bottom":
  62386. valueStyle.justifyContent = "end";
  62387. break;
  62388. case "middle":
  62389. valueStyle.justifyContent = "center";
  62390. break;
  62391. }
  62392. const paraStyle = para[_xfa_object.$toStyle]();
  62393. for (const [key, val] of Object.entries(paraStyle)) {
  62394. if (!(key in valueStyle)) {
  62395. valueStyle[key] = val;
  62396. }
  62397. }
  62398. }
  62399. }
  62400. }
  62401. function setFontFamily(xfaFont, node, fontFinder, style) {
  62402. if (!fontFinder) {
  62403. delete style.fontFamily;
  62404. return;
  62405. }
  62406. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  62407. style.fontFamily = `"${name}"`;
  62408. const typeface = fontFinder.find(name);
  62409. if (typeface) {
  62410. const {
  62411. fontFamily
  62412. } = typeface.regular.cssFontInfo;
  62413. if (fontFamily !== name) {
  62414. style.fontFamily = `"${fontFamily}"`;
  62415. }
  62416. const para = getCurrentPara(node);
  62417. if (para && para.lineHeight !== "") {
  62418. return;
  62419. }
  62420. if (style.lineHeight) {
  62421. return;
  62422. }
  62423. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  62424. if (pdfFont) {
  62425. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  62426. }
  62427. }
  62428. }
  62429. function fixURL(str) {
  62430. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  62431. addDefaultProtocol: true,
  62432. tryConvertEncoding: true
  62433. });
  62434. return absoluteUrl ? absoluteUrl.href : null;
  62435. }
  62436. /***/ }),
  62437. /* 214 */
  62438. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62439. "use strict";
  62440. Object.defineProperty(exports, "__esModule", ({
  62441. value: true
  62442. }));
  62443. exports.FontFinder = void 0;
  62444. exports.getMetrics = getMetrics;
  62445. exports.selectFont = selectFont;
  62446. var _xfa_object = __w_pdfjs_require__(206);
  62447. var _utils = __w_pdfjs_require__(207);
  62448. var _util = __w_pdfjs_require__(2);
  62449. class FontFinder {
  62450. constructor(pdfFonts) {
  62451. this.fonts = new Map();
  62452. this.cache = new Map();
  62453. this.warned = new Set();
  62454. this.defaultFont = null;
  62455. this.add(pdfFonts);
  62456. }
  62457. add(pdfFonts) {
  62458. let reallyMissingFonts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  62459. for (const pdfFont of pdfFonts) {
  62460. this.addPdfFont(pdfFont);
  62461. }
  62462. for (const pdfFont of this.fonts.values()) {
  62463. if (!pdfFont.regular) {
  62464. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  62465. }
  62466. }
  62467. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  62468. return;
  62469. }
  62470. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  62471. for (const missing of reallyMissingFonts) {
  62472. this.fonts.set(missing, myriad);
  62473. }
  62474. }
  62475. addPdfFont(pdfFont) {
  62476. const cssFontInfo = pdfFont.cssFontInfo;
  62477. const name = cssFontInfo.fontFamily;
  62478. let font = this.fonts.get(name);
  62479. if (!font) {
  62480. font = Object.create(null);
  62481. this.fonts.set(name, font);
  62482. if (!this.defaultFont) {
  62483. this.defaultFont = font;
  62484. }
  62485. }
  62486. let property = "";
  62487. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  62488. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  62489. property = fontWeight >= 700 ? "bolditalic" : "italic";
  62490. } else if (fontWeight >= 700) {
  62491. property = "bold";
  62492. }
  62493. if (!property) {
  62494. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  62495. property = "bold";
  62496. }
  62497. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  62498. property += "italic";
  62499. }
  62500. }
  62501. if (!property) {
  62502. property = "regular";
  62503. }
  62504. font[property] = pdfFont;
  62505. }
  62506. getDefault() {
  62507. return this.defaultFont;
  62508. }
  62509. find(fontName) {
  62510. let mustWarn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  62511. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  62512. if (font) {
  62513. return font;
  62514. }
  62515. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  62516. let name = fontName.replace(pattern, "");
  62517. font = this.fonts.get(name);
  62518. if (font) {
  62519. this.cache.set(fontName, font);
  62520. return font;
  62521. }
  62522. name = name.toLowerCase();
  62523. const maybe = [];
  62524. for (const [family, pdfFont] of this.fonts.entries()) {
  62525. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  62526. maybe.push(pdfFont);
  62527. }
  62528. }
  62529. if (maybe.length === 0) {
  62530. for (const [, pdfFont] of this.fonts.entries()) {
  62531. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  62532. maybe.push(pdfFont);
  62533. }
  62534. }
  62535. }
  62536. if (maybe.length === 0) {
  62537. name = name.replace(/psmt|mt/gi, "");
  62538. for (const [family, pdfFont] of this.fonts.entries()) {
  62539. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  62540. maybe.push(pdfFont);
  62541. }
  62542. }
  62543. }
  62544. if (maybe.length === 0) {
  62545. for (const pdfFont of this.fonts.values()) {
  62546. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  62547. maybe.push(pdfFont);
  62548. }
  62549. }
  62550. }
  62551. if (maybe.length >= 1) {
  62552. if (maybe.length !== 1 && mustWarn) {
  62553. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  62554. }
  62555. this.cache.set(fontName, maybe[0]);
  62556. return maybe[0];
  62557. }
  62558. if (mustWarn && !this.warned.has(fontName)) {
  62559. this.warned.add(fontName);
  62560. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  62561. }
  62562. return null;
  62563. }
  62564. }
  62565. exports.FontFinder = FontFinder;
  62566. function selectFont(xfaFont, typeface) {
  62567. if (xfaFont.posture === "italic") {
  62568. if (xfaFont.weight === "bold") {
  62569. return typeface.bolditalic;
  62570. }
  62571. return typeface.italic;
  62572. } else if (xfaFont.weight === "bold") {
  62573. return typeface.bold;
  62574. }
  62575. return typeface.regular;
  62576. }
  62577. function getMetrics(xfaFont) {
  62578. let real = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  62579. let pdfFont = null;
  62580. if (xfaFont) {
  62581. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  62582. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  62583. pdfFont = selectFont(xfaFont, typeface);
  62584. }
  62585. if (!pdfFont) {
  62586. return {
  62587. lineHeight: 12,
  62588. lineGap: 2,
  62589. lineNoGap: 10
  62590. };
  62591. }
  62592. const size = xfaFont.size || 10;
  62593. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  62594. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  62595. return {
  62596. lineHeight: lineHeight * size,
  62597. lineGap: lineGap * size,
  62598. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  62599. };
  62600. }
  62601. /***/ }),
  62602. /* 215 */
  62603. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62604. "use strict";
  62605. Object.defineProperty(exports, "__esModule", ({
  62606. value: true
  62607. }));
  62608. exports.TextMeasure = void 0;
  62609. var _fonts = __w_pdfjs_require__(214);
  62610. const WIDTH_FACTOR = 1.02;
  62611. class FontInfo {
  62612. constructor(xfaFont, margin, lineHeight, fontFinder) {
  62613. this.lineHeight = lineHeight;
  62614. this.paraMargin = margin || {
  62615. top: 0,
  62616. bottom: 0,
  62617. left: 0,
  62618. right: 0
  62619. };
  62620. if (!xfaFont) {
  62621. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  62622. return;
  62623. }
  62624. this.xfaFont = {
  62625. typeface: xfaFont.typeface,
  62626. posture: xfaFont.posture,
  62627. weight: xfaFont.weight,
  62628. size: xfaFont.size,
  62629. letterSpacing: xfaFont.letterSpacing
  62630. };
  62631. const typeface = fontFinder.find(xfaFont.typeface);
  62632. if (!typeface) {
  62633. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  62634. return;
  62635. }
  62636. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  62637. if (!this.pdfFont) {
  62638. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  62639. }
  62640. }
  62641. defaultFont(fontFinder) {
  62642. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  62643. if (font && font.regular) {
  62644. const pdfFont = font.regular;
  62645. const info = pdfFont.cssFontInfo;
  62646. const xfaFont = {
  62647. typeface: info.fontFamily,
  62648. posture: "normal",
  62649. weight: "normal",
  62650. size: 10,
  62651. letterSpacing: 0
  62652. };
  62653. return [pdfFont, xfaFont];
  62654. }
  62655. const xfaFont = {
  62656. typeface: "Courier",
  62657. posture: "normal",
  62658. weight: "normal",
  62659. size: 10,
  62660. letterSpacing: 0
  62661. };
  62662. return [null, xfaFont];
  62663. }
  62664. }
  62665. class FontSelector {
  62666. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  62667. this.fontFinder = fontFinder;
  62668. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  62669. }
  62670. pushData(xfaFont, margin, lineHeight) {
  62671. const lastFont = this.stack.at(-1);
  62672. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  62673. if (!xfaFont[name]) {
  62674. xfaFont[name] = lastFont.xfaFont[name];
  62675. }
  62676. }
  62677. for (const name of ["top", "bottom", "left", "right"]) {
  62678. if (isNaN(margin[name])) {
  62679. margin[name] = lastFont.paraMargin[name];
  62680. }
  62681. }
  62682. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  62683. if (!fontInfo.pdfFont) {
  62684. fontInfo.pdfFont = lastFont.pdfFont;
  62685. }
  62686. this.stack.push(fontInfo);
  62687. }
  62688. popFont() {
  62689. this.stack.pop();
  62690. }
  62691. topFont() {
  62692. return this.stack.at(-1);
  62693. }
  62694. }
  62695. class TextMeasure {
  62696. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  62697. this.glyphs = [];
  62698. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  62699. this.extraHeight = 0;
  62700. }
  62701. pushData(xfaFont, margin, lineHeight) {
  62702. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  62703. }
  62704. popFont(xfaFont) {
  62705. return this.fontSelector.popFont();
  62706. }
  62707. addPara() {
  62708. const lastFont = this.fontSelector.topFont();
  62709. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  62710. }
  62711. addString(str) {
  62712. if (!str) {
  62713. return;
  62714. }
  62715. const lastFont = this.fontSelector.topFont();
  62716. const fontSize = lastFont.xfaFont.size;
  62717. if (lastFont.pdfFont) {
  62718. const letterSpacing = lastFont.xfaFont.letterSpacing;
  62719. const pdfFont = lastFont.pdfFont;
  62720. const fontLineHeight = pdfFont.lineHeight || 1.2;
  62721. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  62722. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  62723. const noGap = fontLineHeight - lineGap;
  62724. const firstLineHeight = Math.max(1, noGap) * fontSize;
  62725. const scale = fontSize / 1000;
  62726. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  62727. for (const line of str.split(/[\u2029\n]/)) {
  62728. const encodedLine = pdfFont.encodeString(line).join("");
  62729. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  62730. for (const glyph of glyphs) {
  62731. const width = glyph.width || fallbackWidth;
  62732. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  62733. }
  62734. this.glyphs.push([0, 0, 0, "\n", true]);
  62735. }
  62736. this.glyphs.pop();
  62737. return;
  62738. }
  62739. for (const line of str.split(/[\u2029\n]/)) {
  62740. for (const char of line.split("")) {
  62741. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  62742. }
  62743. this.glyphs.push([0, 0, 0, "\n", true]);
  62744. }
  62745. this.glyphs.pop();
  62746. }
  62747. compute(maxWidth) {
  62748. let lastSpacePos = -1,
  62749. lastSpaceWidth = 0,
  62750. width = 0,
  62751. height = 0,
  62752. currentLineWidth = 0,
  62753. currentLineHeight = 0;
  62754. let isBroken = false;
  62755. let isFirstLine = true;
  62756. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  62757. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  62758. const isSpace = char === " ";
  62759. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  62760. if (isEOL) {
  62761. width = Math.max(width, currentLineWidth);
  62762. currentLineWidth = 0;
  62763. height += currentLineHeight;
  62764. currentLineHeight = glyphHeight;
  62765. lastSpacePos = -1;
  62766. lastSpaceWidth = 0;
  62767. isFirstLine = false;
  62768. continue;
  62769. }
  62770. if (isSpace) {
  62771. if (currentLineWidth + glyphWidth > maxWidth) {
  62772. width = Math.max(width, currentLineWidth);
  62773. currentLineWidth = 0;
  62774. height += currentLineHeight;
  62775. currentLineHeight = glyphHeight;
  62776. lastSpacePos = -1;
  62777. lastSpaceWidth = 0;
  62778. isBroken = true;
  62779. isFirstLine = false;
  62780. } else {
  62781. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  62782. lastSpaceWidth = currentLineWidth;
  62783. currentLineWidth += glyphWidth;
  62784. lastSpacePos = i;
  62785. }
  62786. continue;
  62787. }
  62788. if (currentLineWidth + glyphWidth > maxWidth) {
  62789. height += currentLineHeight;
  62790. currentLineHeight = glyphHeight;
  62791. if (lastSpacePos !== -1) {
  62792. i = lastSpacePos;
  62793. width = Math.max(width, lastSpaceWidth);
  62794. currentLineWidth = 0;
  62795. lastSpacePos = -1;
  62796. lastSpaceWidth = 0;
  62797. } else {
  62798. width = Math.max(width, currentLineWidth);
  62799. currentLineWidth = glyphWidth;
  62800. }
  62801. isBroken = true;
  62802. isFirstLine = false;
  62803. continue;
  62804. }
  62805. currentLineWidth += glyphWidth;
  62806. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  62807. }
  62808. width = Math.max(width, currentLineWidth);
  62809. height += currentLineHeight + this.extraHeight;
  62810. return {
  62811. width: WIDTH_FACTOR * width,
  62812. height,
  62813. isBroken
  62814. };
  62815. }
  62816. }
  62817. exports.TextMeasure = TextMeasure;
  62818. /***/ }),
  62819. /* 216 */
  62820. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62821. "use strict";
  62822. Object.defineProperty(exports, "__esModule", ({
  62823. value: true
  62824. }));
  62825. exports.DataHandler = void 0;
  62826. var _xfa_object = __w_pdfjs_require__(206);
  62827. class DataHandler {
  62828. constructor(root, data) {
  62829. this.data = data;
  62830. this.dataset = root.datasets || null;
  62831. }
  62832. serialize(storage) {
  62833. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  62834. while (stack.length > 0) {
  62835. const last = stack.at(-1);
  62836. const [i, children] = last;
  62837. if (i + 1 === children.length) {
  62838. stack.pop();
  62839. continue;
  62840. }
  62841. const child = children[++last[0]];
  62842. const storageEntry = storage.get(child[_xfa_object.$uid]);
  62843. if (storageEntry) {
  62844. child[_xfa_object.$setValue](storageEntry);
  62845. } else {
  62846. const attributes = child[_xfa_object.$getAttributes]();
  62847. for (const value of attributes.values()) {
  62848. const entry = storage.get(value[_xfa_object.$uid]);
  62849. if (entry) {
  62850. value[_xfa_object.$setValue](entry);
  62851. break;
  62852. }
  62853. }
  62854. }
  62855. const nodes = child[_xfa_object.$getChildren]();
  62856. if (nodes.length > 0) {
  62857. stack.push([-1, nodes]);
  62858. }
  62859. }
  62860. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  62861. if (this.dataset) {
  62862. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  62863. if (child[_xfa_object.$nodeName] !== "data") {
  62864. child[_xfa_object.$toString](buf);
  62865. }
  62866. }
  62867. }
  62868. this.data[_xfa_object.$toString](buf);
  62869. buf.push("</xfa:datasets>");
  62870. return buf.join("");
  62871. }
  62872. }
  62873. exports.DataHandler = DataHandler;
  62874. /***/ }),
  62875. /* 217 */
  62876. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62877. "use strict";
  62878. Object.defineProperty(exports, "__esModule", ({
  62879. value: true
  62880. }));
  62881. exports.XFAParser = void 0;
  62882. var _xfa_object = __w_pdfjs_require__(206);
  62883. var _xml_parser = __w_pdfjs_require__(195);
  62884. var _builder = __w_pdfjs_require__(218);
  62885. var _util = __w_pdfjs_require__(2);
  62886. class XFAParser extends _xml_parser.XMLParserBase {
  62887. constructor() {
  62888. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  62889. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  62890. super();
  62891. this._builder = new _builder.Builder(rootNameSpace);
  62892. this._stack = [];
  62893. this._globalData = {
  62894. usedTypefaces: new Set()
  62895. };
  62896. this._ids = new Map();
  62897. this._current = this._builder.buildRoot(this._ids);
  62898. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  62899. this._whiteRegex = /^\s+$/;
  62900. this._nbsps = /\xa0+/g;
  62901. this._richText = richText;
  62902. }
  62903. parse(data) {
  62904. this.parseXml(data);
  62905. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  62906. return undefined;
  62907. }
  62908. this._current[_xfa_object.$finalize]();
  62909. return this._current.element;
  62910. }
  62911. onText(text) {
  62912. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  62913. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  62914. this._current[_xfa_object.$onText](text, this._richText);
  62915. return;
  62916. }
  62917. if (this._whiteRegex.test(text)) {
  62918. return;
  62919. }
  62920. this._current[_xfa_object.$onText](text.trim());
  62921. }
  62922. onCdata(text) {
  62923. this._current[_xfa_object.$onText](text);
  62924. }
  62925. _mkAttributes(attributes, tagName) {
  62926. let namespace = null;
  62927. let prefixes = null;
  62928. const attributeObj = Object.create({});
  62929. for (const {
  62930. name,
  62931. value
  62932. } of attributes) {
  62933. if (name === "xmlns") {
  62934. if (!namespace) {
  62935. namespace = value;
  62936. } else {
  62937. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  62938. }
  62939. } else if (name.startsWith("xmlns:")) {
  62940. const prefix = name.substring("xmlns:".length);
  62941. if (!prefixes) {
  62942. prefixes = [];
  62943. }
  62944. prefixes.push({
  62945. prefix,
  62946. value
  62947. });
  62948. } else {
  62949. const i = name.indexOf(":");
  62950. if (i === -1) {
  62951. attributeObj[name] = value;
  62952. } else {
  62953. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  62954. if (!nsAttrs) {
  62955. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  62956. }
  62957. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  62958. let attrs = nsAttrs[ns];
  62959. if (!attrs) {
  62960. attrs = nsAttrs[ns] = Object.create(null);
  62961. }
  62962. attrs[attrName] = value;
  62963. }
  62964. }
  62965. }
  62966. return [namespace, prefixes, attributeObj];
  62967. }
  62968. _getNameAndPrefix(name, nsAgnostic) {
  62969. const i = name.indexOf(":");
  62970. if (i === -1) {
  62971. return [name, null];
  62972. }
  62973. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  62974. }
  62975. onBeginElement(tagName, attributes, isEmpty) {
  62976. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  62977. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  62978. const node = this._builder.build({
  62979. nsPrefix,
  62980. name,
  62981. attributes: attributesObj,
  62982. namespace,
  62983. prefixes
  62984. });
  62985. node[_xfa_object.$globalData] = this._globalData;
  62986. if (isEmpty) {
  62987. node[_xfa_object.$finalize]();
  62988. if (this._current[_xfa_object.$onChild](node)) {
  62989. node[_xfa_object.$setId](this._ids);
  62990. }
  62991. node[_xfa_object.$clean](this._builder);
  62992. return;
  62993. }
  62994. this._stack.push(this._current);
  62995. this._current = node;
  62996. }
  62997. onEndElement(name) {
  62998. const node = this._current;
  62999. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  63000. const parser = new XFAParser();
  63001. parser._globalData = this._globalData;
  63002. const root = parser.parse(node[_xfa_object.$content]);
  63003. node[_xfa_object.$content] = null;
  63004. node[_xfa_object.$onChild](root);
  63005. }
  63006. node[_xfa_object.$finalize]();
  63007. this._current = this._stack.pop();
  63008. if (this._current[_xfa_object.$onChild](node)) {
  63009. node[_xfa_object.$setId](this._ids);
  63010. }
  63011. node[_xfa_object.$clean](this._builder);
  63012. }
  63013. onError(code) {
  63014. this._errorCode = code;
  63015. }
  63016. }
  63017. exports.XFAParser = XFAParser;
  63018. /***/ }),
  63019. /* 218 */
  63020. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63021. "use strict";
  63022. Object.defineProperty(exports, "__esModule", ({
  63023. value: true
  63024. }));
  63025. exports.Builder = void 0;
  63026. var _namespaces = __w_pdfjs_require__(208);
  63027. var _xfa_object = __w_pdfjs_require__(206);
  63028. var _setup = __w_pdfjs_require__(219);
  63029. var _template = __w_pdfjs_require__(211);
  63030. var _unknown = __w_pdfjs_require__(228);
  63031. var _util = __w_pdfjs_require__(2);
  63032. class Root extends _xfa_object.XFAObject {
  63033. constructor(ids) {
  63034. super(-1, "root", Object.create(null));
  63035. this.element = null;
  63036. this[_xfa_object.$ids] = ids;
  63037. }
  63038. [_xfa_object.$onChild](child) {
  63039. this.element = child;
  63040. return true;
  63041. }
  63042. [_xfa_object.$finalize]() {
  63043. super[_xfa_object.$finalize]();
  63044. if (this.element.template instanceof _template.Template) {
  63045. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  63046. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  63047. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  63048. }
  63049. }
  63050. }
  63051. class Empty extends _xfa_object.XFAObject {
  63052. constructor() {
  63053. super(-1, "", Object.create(null));
  63054. }
  63055. [_xfa_object.$onChild](_) {
  63056. return false;
  63057. }
  63058. }
  63059. class Builder {
  63060. constructor() {
  63061. let rootNameSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  63062. this._namespaceStack = [];
  63063. this._nsAgnosticLevel = 0;
  63064. this._namespacePrefixes = new Map();
  63065. this._namespaces = new Map();
  63066. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(_ref => {
  63067. let {
  63068. id
  63069. } = _ref;
  63070. return id;
  63071. }));
  63072. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  63073. }
  63074. buildRoot(ids) {
  63075. return new Root(ids);
  63076. }
  63077. build(_ref2) {
  63078. let {
  63079. nsPrefix,
  63080. name,
  63081. attributes,
  63082. namespace,
  63083. prefixes
  63084. } = _ref2;
  63085. const hasNamespaceDef = namespace !== null;
  63086. if (hasNamespaceDef) {
  63087. this._namespaceStack.push(this._currentNamespace);
  63088. this._currentNamespace = this._searchNamespace(namespace);
  63089. }
  63090. if (prefixes) {
  63091. this._addNamespacePrefix(prefixes);
  63092. }
  63093. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  63094. const dataTemplate = _setup.NamespaceSetUp.datasets;
  63095. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  63096. let xfaAttrs = null;
  63097. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  63098. const nsToUse = this._getNamespaceToUse(ns);
  63099. if (nsToUse === dataTemplate) {
  63100. xfaAttrs = {
  63101. xfa: attrs
  63102. };
  63103. break;
  63104. }
  63105. }
  63106. if (xfaAttrs) {
  63107. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  63108. } else {
  63109. delete attributes[_xfa_object.$nsAttributes];
  63110. }
  63111. }
  63112. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  63113. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  63114. if (node[_xfa_object.$isNsAgnostic]()) {
  63115. this._nsAgnosticLevel++;
  63116. }
  63117. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  63118. node[_xfa_object.$cleanup] = {
  63119. hasNamespace: hasNamespaceDef,
  63120. prefixes,
  63121. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  63122. };
  63123. }
  63124. return node;
  63125. }
  63126. isNsAgnostic() {
  63127. return this._nsAgnosticLevel > 0;
  63128. }
  63129. _searchNamespace(nsName) {
  63130. let ns = this._namespaces.get(nsName);
  63131. if (ns) {
  63132. return ns;
  63133. }
  63134. for (const [name, {
  63135. check
  63136. }] of Object.entries(_namespaces.NamespaceIds)) {
  63137. if (check(nsName)) {
  63138. ns = _setup.NamespaceSetUp[name];
  63139. if (ns) {
  63140. this._namespaces.set(nsName, ns);
  63141. return ns;
  63142. }
  63143. break;
  63144. }
  63145. }
  63146. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  63147. this._namespaces.set(nsName, ns);
  63148. return ns;
  63149. }
  63150. _addNamespacePrefix(prefixes) {
  63151. for (const {
  63152. prefix,
  63153. value
  63154. } of prefixes) {
  63155. const namespace = this._searchNamespace(value);
  63156. let prefixStack = this._namespacePrefixes.get(prefix);
  63157. if (!prefixStack) {
  63158. prefixStack = [];
  63159. this._namespacePrefixes.set(prefix, prefixStack);
  63160. }
  63161. prefixStack.push(namespace);
  63162. }
  63163. }
  63164. _getNamespaceToUse(prefix) {
  63165. if (!prefix) {
  63166. return this._currentNamespace;
  63167. }
  63168. const prefixStack = this._namespacePrefixes.get(prefix);
  63169. if (prefixStack && prefixStack.length > 0) {
  63170. return prefixStack.at(-1);
  63171. }
  63172. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  63173. return null;
  63174. }
  63175. clean(data) {
  63176. const {
  63177. hasNamespace,
  63178. prefixes,
  63179. nsAgnostic
  63180. } = data;
  63181. if (hasNamespace) {
  63182. this._currentNamespace = this._namespaceStack.pop();
  63183. }
  63184. if (prefixes) {
  63185. prefixes.forEach(_ref3 => {
  63186. let {
  63187. prefix
  63188. } = _ref3;
  63189. this._namespacePrefixes.get(prefix).pop();
  63190. });
  63191. }
  63192. if (nsAgnostic) {
  63193. this._nsAgnosticLevel--;
  63194. }
  63195. }
  63196. }
  63197. exports.Builder = Builder;
  63198. /***/ }),
  63199. /* 219 */
  63200. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63201. "use strict";
  63202. Object.defineProperty(exports, "__esModule", ({
  63203. value: true
  63204. }));
  63205. exports.NamespaceSetUp = void 0;
  63206. var _config = __w_pdfjs_require__(220);
  63207. var _connection_set = __w_pdfjs_require__(221);
  63208. var _datasets = __w_pdfjs_require__(222);
  63209. var _locale_set = __w_pdfjs_require__(223);
  63210. var _signature = __w_pdfjs_require__(224);
  63211. var _stylesheet = __w_pdfjs_require__(225);
  63212. var _template = __w_pdfjs_require__(211);
  63213. var _xdp = __w_pdfjs_require__(226);
  63214. var _xhtml = __w_pdfjs_require__(227);
  63215. const NamespaceSetUp = {
  63216. config: _config.ConfigNamespace,
  63217. connection: _connection_set.ConnectionSetNamespace,
  63218. datasets: _datasets.DatasetsNamespace,
  63219. localeSet: _locale_set.LocaleSetNamespace,
  63220. signature: _signature.SignatureNamespace,
  63221. stylesheet: _stylesheet.StylesheetNamespace,
  63222. template: _template.TemplateNamespace,
  63223. xdp: _xdp.XdpNamespace,
  63224. xhtml: _xhtml.XhtmlNamespace
  63225. };
  63226. exports.NamespaceSetUp = NamespaceSetUp;
  63227. /***/ }),
  63228. /* 220 */
  63229. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  63230. "use strict";
  63231. Object.defineProperty(exports, "__esModule", ({
  63232. value: true
  63233. }));
  63234. exports.ConfigNamespace = void 0;
  63235. var _namespaces = __w_pdfjs_require__(208);
  63236. var _xfa_object = __w_pdfjs_require__(206);
  63237. var _utils = __w_pdfjs_require__(207);
  63238. var _util = __w_pdfjs_require__(2);
  63239. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  63240. class Acrobat extends _xfa_object.XFAObject {
  63241. constructor(attributes) {
  63242. super(CONFIG_NS_ID, "acrobat", true);
  63243. this.acrobat7 = null;
  63244. this.autoSave = null;
  63245. this.common = null;
  63246. this.validate = null;
  63247. this.validateApprovalSignatures = null;
  63248. this.submitUrl = new _xfa_object.XFAObjectArray();
  63249. }
  63250. }
  63251. class Acrobat7 extends _xfa_object.XFAObject {
  63252. constructor(attributes) {
  63253. super(CONFIG_NS_ID, "acrobat7", true);
  63254. this.dynamicRender = null;
  63255. }
  63256. }
  63257. class ADBE_JSConsole extends _xfa_object.OptionObject {
  63258. constructor(attributes) {
  63259. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  63260. }
  63261. }
  63262. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  63263. constructor(attributes) {
  63264. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  63265. }
  63266. }
  63267. class AddSilentPrint extends _xfa_object.Option01 {
  63268. constructor(attributes) {
  63269. super(CONFIG_NS_ID, "addSilentPrint");
  63270. }
  63271. }
  63272. class AddViewerPreferences extends _xfa_object.Option01 {
  63273. constructor(attributes) {
  63274. super(CONFIG_NS_ID, "addViewerPreferences");
  63275. }
  63276. }
  63277. class AdjustData extends _xfa_object.Option10 {
  63278. constructor(attributes) {
  63279. super(CONFIG_NS_ID, "adjustData");
  63280. }
  63281. }
  63282. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  63283. constructor(attributes) {
  63284. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  63285. }
  63286. }
  63287. class Agent extends _xfa_object.XFAObject {
  63288. constructor(attributes) {
  63289. super(CONFIG_NS_ID, "agent", true);
  63290. this.name = attributes.name ? attributes.name.trim() : "";
  63291. this.common = new _xfa_object.XFAObjectArray();
  63292. }
  63293. }
  63294. class AlwaysEmbed extends _xfa_object.ContentObject {
  63295. constructor(attributes) {
  63296. super(CONFIG_NS_ID, "alwaysEmbed");
  63297. }
  63298. }
  63299. class Amd extends _xfa_object.StringObject {
  63300. constructor(attributes) {
  63301. super(CONFIG_NS_ID, "amd");
  63302. }
  63303. }
  63304. class Area extends _xfa_object.XFAObject {
  63305. constructor(attributes) {
  63306. super(CONFIG_NS_ID, "area");
  63307. this.level = (0, _utils.getInteger)({
  63308. data: attributes.level,
  63309. defaultValue: 0,
  63310. validate: n => n >= 1 && n <= 3
  63311. });
  63312. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  63313. }
  63314. }
  63315. class Attributes extends _xfa_object.OptionObject {
  63316. constructor(attributes) {
  63317. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  63318. }
  63319. }
  63320. class AutoSave extends _xfa_object.OptionObject {
  63321. constructor(attributes) {
  63322. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  63323. }
  63324. }
  63325. class Base extends _xfa_object.StringObject {
  63326. constructor(attributes) {
  63327. super(CONFIG_NS_ID, "base");
  63328. }
  63329. }
  63330. class BatchOutput extends _xfa_object.XFAObject {
  63331. constructor(attributes) {
  63332. super(CONFIG_NS_ID, "batchOutput");
  63333. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  63334. }
  63335. }
  63336. class BehaviorOverride extends _xfa_object.ContentObject {
  63337. constructor(attributes) {
  63338. super(CONFIG_NS_ID, "behaviorOverride");
  63339. }
  63340. [_xfa_object.$finalize]() {
  63341. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  63342. }
  63343. }
  63344. class Cache extends _xfa_object.XFAObject {
  63345. constructor(attributes) {
  63346. super(CONFIG_NS_ID, "cache", true);
  63347. this.templateCache = null;
  63348. }
  63349. }
  63350. class Change extends _xfa_object.Option01 {
  63351. constructor(attributes) {
  63352. super(CONFIG_NS_ID, "change");
  63353. }
  63354. }
  63355. class Common extends _xfa_object.XFAObject {
  63356. constructor(attributes) {
  63357. super(CONFIG_NS_ID, "common", true);
  63358. this.data = null;
  63359. this.locale = null;
  63360. this.localeSet = null;
  63361. this.messaging = null;
  63362. this.suppressBanner = null;
  63363. this.template = null;
  63364. this.validationMessaging = null;
  63365. this.versionControl = null;
  63366. this.log = new _xfa_object.XFAObjectArray();
  63367. }
  63368. }
  63369. class Compress extends _xfa_object.XFAObject {
  63370. constructor(attributes) {
  63371. super(CONFIG_NS_ID, "compress");
  63372. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  63373. }
  63374. }
  63375. class CompressLogicalStructure extends _xfa_object.Option01 {
  63376. constructor(attributes) {
  63377. super(CONFIG_NS_ID, "compressLogicalStructure");
  63378. }
  63379. }
  63380. class CompressObjectStream extends _xfa_object.Option10 {
  63381. constructor(attributes) {
  63382. super(CONFIG_NS_ID, "compressObjectStream");
  63383. }
  63384. }
  63385. class Compression extends _xfa_object.XFAObject {
  63386. constructor(attributes) {
  63387. super(CONFIG_NS_ID, "compression", true);
  63388. this.compressLogicalStructure = null;
  63389. this.compressObjectStream = null;
  63390. this.level = null;
  63391. this.type = null;
  63392. }
  63393. }
  63394. class Config extends _xfa_object.XFAObject {
  63395. constructor(attributes) {
  63396. super(CONFIG_NS_ID, "config", true);
  63397. this.acrobat = null;
  63398. this.present = null;
  63399. this.trace = null;
  63400. this.agent = new _xfa_object.XFAObjectArray();
  63401. }
  63402. }
  63403. class Conformance extends _xfa_object.OptionObject {
  63404. constructor(attributes) {
  63405. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  63406. }
  63407. }
  63408. class ContentCopy extends _xfa_object.Option01 {
  63409. constructor(attributes) {
  63410. super(CONFIG_NS_ID, "contentCopy");
  63411. }
  63412. }
  63413. class Copies extends _xfa_object.IntegerObject {
  63414. constructor(attributes) {
  63415. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  63416. }
  63417. }
  63418. class Creator extends _xfa_object.StringObject {
  63419. constructor(attributes) {
  63420. super(CONFIG_NS_ID, "creator");
  63421. }
  63422. }
  63423. class CurrentPage extends _xfa_object.IntegerObject {
  63424. constructor(attributes) {
  63425. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  63426. }
  63427. }
  63428. class Data extends _xfa_object.XFAObject {
  63429. constructor(attributes) {
  63430. super(CONFIG_NS_ID, "data", true);
  63431. this.adjustData = null;
  63432. this.attributes = null;
  63433. this.incrementalLoad = null;
  63434. this.outputXSL = null;
  63435. this.range = null;
  63436. this.record = null;
  63437. this.startNode = null;
  63438. this.uri = null;
  63439. this.window = null;
  63440. this.xsl = null;
  63441. this.excludeNS = new _xfa_object.XFAObjectArray();
  63442. this.transform = new _xfa_object.XFAObjectArray();
  63443. }
  63444. }
  63445. class Debug extends _xfa_object.XFAObject {
  63446. constructor(attributes) {
  63447. super(CONFIG_NS_ID, "debug", true);
  63448. this.uri = null;
  63449. }
  63450. }
  63451. class DefaultTypeface extends _xfa_object.ContentObject {
  63452. constructor(attributes) {
  63453. super(CONFIG_NS_ID, "defaultTypeface");
  63454. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  63455. }
  63456. }
  63457. class Destination extends _xfa_object.OptionObject {
  63458. constructor(attributes) {
  63459. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  63460. }
  63461. }
  63462. class DocumentAssembly extends _xfa_object.Option01 {
  63463. constructor(attributes) {
  63464. super(CONFIG_NS_ID, "documentAssembly");
  63465. }
  63466. }
  63467. class Driver extends _xfa_object.XFAObject {
  63468. constructor(attributes) {
  63469. super(CONFIG_NS_ID, "driver", true);
  63470. this.name = attributes.name ? attributes.name.trim() : "";
  63471. this.fontInfo = null;
  63472. this.xdc = null;
  63473. }
  63474. }
  63475. class DuplexOption extends _xfa_object.OptionObject {
  63476. constructor(attributes) {
  63477. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  63478. }
  63479. }
  63480. class DynamicRender extends _xfa_object.OptionObject {
  63481. constructor(attributes) {
  63482. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  63483. }
  63484. }
  63485. class Embed extends _xfa_object.Option01 {
  63486. constructor(attributes) {
  63487. super(CONFIG_NS_ID, "embed");
  63488. }
  63489. }
  63490. class Encrypt extends _xfa_object.Option01 {
  63491. constructor(attributes) {
  63492. super(CONFIG_NS_ID, "encrypt");
  63493. }
  63494. }
  63495. class Encryption extends _xfa_object.XFAObject {
  63496. constructor(attributes) {
  63497. super(CONFIG_NS_ID, "encryption", true);
  63498. this.encrypt = null;
  63499. this.encryptionLevel = null;
  63500. this.permissions = null;
  63501. }
  63502. }
  63503. class EncryptionLevel extends _xfa_object.OptionObject {
  63504. constructor(attributes) {
  63505. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  63506. }
  63507. }
  63508. class Enforce extends _xfa_object.StringObject {
  63509. constructor(attributes) {
  63510. super(CONFIG_NS_ID, "enforce");
  63511. }
  63512. }
  63513. class Equate extends _xfa_object.XFAObject {
  63514. constructor(attributes) {
  63515. super(CONFIG_NS_ID, "equate");
  63516. this.force = (0, _utils.getInteger)({
  63517. data: attributes.force,
  63518. defaultValue: 1,
  63519. validate: n => n === 0
  63520. });
  63521. this.from = attributes.from || "";
  63522. this.to = attributes.to || "";
  63523. }
  63524. }
  63525. class EquateRange extends _xfa_object.XFAObject {
  63526. constructor(attributes) {
  63527. super(CONFIG_NS_ID, "equateRange");
  63528. this.from = attributes.from || "";
  63529. this.to = attributes.to || "";
  63530. this._unicodeRange = attributes.unicodeRange || "";
  63531. }
  63532. get unicodeRange() {
  63533. const ranges = [];
  63534. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  63535. const unicodeRange = this._unicodeRange;
  63536. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  63537. range = range.split("-", 2).map(x => {
  63538. const found = x.match(unicodeRegex);
  63539. if (!found) {
  63540. return 0;
  63541. }
  63542. return parseInt(found[1], 16);
  63543. });
  63544. if (range.length === 1) {
  63545. range.push(range[0]);
  63546. }
  63547. ranges.push(range);
  63548. }
  63549. return (0, _util.shadow)(this, "unicodeRange", ranges);
  63550. }
  63551. }
  63552. class Exclude extends _xfa_object.ContentObject {
  63553. constructor(attributes) {
  63554. super(CONFIG_NS_ID, "exclude");
  63555. }
  63556. [_xfa_object.$finalize]() {
  63557. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  63558. }
  63559. }
  63560. class ExcludeNS extends _xfa_object.StringObject {
  63561. constructor(attributes) {
  63562. super(CONFIG_NS_ID, "excludeNS");
  63563. }
  63564. }
  63565. class FlipLabel extends _xfa_object.OptionObject {
  63566. constructor(attributes) {
  63567. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  63568. }
  63569. }
  63570. class FontInfo extends _xfa_object.XFAObject {
  63571. constructor(attributes) {
  63572. super(CONFIG_NS_ID, "fontInfo", true);
  63573. this.embed = null;
  63574. this.map = null;
  63575. this.subsetBelow = null;
  63576. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  63577. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  63578. this.neverEmbed = new _xfa_object.XFAObjectArray();
  63579. }
  63580. }
  63581. class FormFieldFilling extends _xfa_object.Option01 {
  63582. constructor(attributes) {
  63583. super(CONFIG_NS_ID, "formFieldFilling");
  63584. }
  63585. }
  63586. class GroupParent extends _xfa_object.StringObject {
  63587. constructor(attributes) {
  63588. super(CONFIG_NS_ID, "groupParent");
  63589. }
  63590. }
  63591. class IfEmpty extends _xfa_object.OptionObject {
  63592. constructor(attributes) {
  63593. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  63594. }
  63595. }
  63596. class IncludeXDPContent extends _xfa_object.StringObject {
  63597. constructor(attributes) {
  63598. super(CONFIG_NS_ID, "includeXDPContent");
  63599. }
  63600. }
  63601. class IncrementalLoad extends _xfa_object.OptionObject {
  63602. constructor(attributes) {
  63603. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  63604. }
  63605. }
  63606. class IncrementalMerge extends _xfa_object.Option01 {
  63607. constructor(attributes) {
  63608. super(CONFIG_NS_ID, "incrementalMerge");
  63609. }
  63610. }
  63611. class Interactive extends _xfa_object.Option01 {
  63612. constructor(attributes) {
  63613. super(CONFIG_NS_ID, "interactive");
  63614. }
  63615. }
  63616. class Jog extends _xfa_object.OptionObject {
  63617. constructor(attributes) {
  63618. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  63619. }
  63620. }
  63621. class LabelPrinter extends _xfa_object.XFAObject {
  63622. constructor(attributes) {
  63623. super(CONFIG_NS_ID, "labelPrinter", true);
  63624. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  63625. this.batchOutput = null;
  63626. this.flipLabel = null;
  63627. this.fontInfo = null;
  63628. this.xdc = null;
  63629. }
  63630. }
  63631. class Layout extends _xfa_object.OptionObject {
  63632. constructor(attributes) {
  63633. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  63634. }
  63635. }
  63636. class Level extends _xfa_object.IntegerObject {
  63637. constructor(attributes) {
  63638. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  63639. }
  63640. }
  63641. class Linearized extends _xfa_object.Option01 {
  63642. constructor(attributes) {
  63643. super(CONFIG_NS_ID, "linearized");
  63644. }
  63645. }
  63646. class Locale extends _xfa_object.StringObject {
  63647. constructor(attributes) {
  63648. super(CONFIG_NS_ID, "locale");
  63649. }
  63650. }
  63651. class LocaleSet extends _xfa_object.StringObject {
  63652. constructor(attributes) {
  63653. super(CONFIG_NS_ID, "localeSet");
  63654. }
  63655. }
  63656. class Log extends _xfa_object.XFAObject {
  63657. constructor(attributes) {
  63658. super(CONFIG_NS_ID, "log", true);
  63659. this.mode = null;
  63660. this.threshold = null;
  63661. this.to = null;
  63662. this.uri = null;
  63663. }
  63664. }
  63665. class MapElement extends _xfa_object.XFAObject {
  63666. constructor(attributes) {
  63667. super(CONFIG_NS_ID, "map", true);
  63668. this.equate = new _xfa_object.XFAObjectArray();
  63669. this.equateRange = new _xfa_object.XFAObjectArray();
  63670. }
  63671. }
  63672. class MediumInfo extends _xfa_object.XFAObject {
  63673. constructor(attributes) {
  63674. super(CONFIG_NS_ID, "mediumInfo", true);
  63675. this.map = null;
  63676. }
  63677. }
  63678. class Message extends _xfa_object.XFAObject {
  63679. constructor(attributes) {
  63680. super(CONFIG_NS_ID, "message", true);
  63681. this.msgId = null;
  63682. this.severity = null;
  63683. }
  63684. }
  63685. class Messaging extends _xfa_object.XFAObject {
  63686. constructor(attributes) {
  63687. super(CONFIG_NS_ID, "messaging", true);
  63688. this.message = new _xfa_object.XFAObjectArray();
  63689. }
  63690. }
  63691. class Mode extends _xfa_object.OptionObject {
  63692. constructor(attributes) {
  63693. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  63694. }
  63695. }
  63696. class ModifyAnnots extends _xfa_object.Option01 {
  63697. constructor(attributes) {
  63698. super(CONFIG_NS_ID, "modifyAnnots");
  63699. }
  63700. }
  63701. class MsgId extends _xfa_object.IntegerObject {
  63702. constructor(attributes) {
  63703. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  63704. }
  63705. }
  63706. class NameAttr extends _xfa_object.StringObject {
  63707. constructor(attributes) {
  63708. super(CONFIG_NS_ID, "nameAttr");
  63709. }
  63710. }
  63711. class NeverEmbed extends _xfa_object.ContentObject {
  63712. constructor(attributes) {
  63713. super(CONFIG_NS_ID, "neverEmbed");
  63714. }
  63715. }
  63716. class NumberOfCopies extends _xfa_object.IntegerObject {
  63717. constructor(attributes) {
  63718. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  63719. }
  63720. }
  63721. class OpenAction extends _xfa_object.XFAObject {
  63722. constructor(attributes) {
  63723. super(CONFIG_NS_ID, "openAction", true);
  63724. this.destination = null;
  63725. }
  63726. }
  63727. class Output extends _xfa_object.XFAObject {
  63728. constructor(attributes) {
  63729. super(CONFIG_NS_ID, "output", true);
  63730. this.to = null;
  63731. this.type = null;
  63732. this.uri = null;
  63733. }
  63734. }
  63735. class OutputBin extends _xfa_object.StringObject {
  63736. constructor(attributes) {
  63737. super(CONFIG_NS_ID, "outputBin");
  63738. }
  63739. }
  63740. class OutputXSL extends _xfa_object.XFAObject {
  63741. constructor(attributes) {
  63742. super(CONFIG_NS_ID, "outputXSL", true);
  63743. this.uri = null;
  63744. }
  63745. }
  63746. class Overprint extends _xfa_object.OptionObject {
  63747. constructor(attributes) {
  63748. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  63749. }
  63750. }
  63751. class Packets extends _xfa_object.StringObject {
  63752. constructor(attributes) {
  63753. super(CONFIG_NS_ID, "packets");
  63754. }
  63755. [_xfa_object.$finalize]() {
  63756. if (this[_xfa_object.$content] === "*") {
  63757. return;
  63758. }
  63759. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  63760. }
  63761. }
  63762. class PageOffset extends _xfa_object.XFAObject {
  63763. constructor(attributes) {
  63764. super(CONFIG_NS_ID, "pageOffset");
  63765. this.x = (0, _utils.getInteger)({
  63766. data: attributes.x,
  63767. defaultValue: "useXDCSetting",
  63768. validate: n => true
  63769. });
  63770. this.y = (0, _utils.getInteger)({
  63771. data: attributes.y,
  63772. defaultValue: "useXDCSetting",
  63773. validate: n => true
  63774. });
  63775. }
  63776. }
  63777. class PageRange extends _xfa_object.StringObject {
  63778. constructor(attributes) {
  63779. super(CONFIG_NS_ID, "pageRange");
  63780. }
  63781. [_xfa_object.$finalize]() {
  63782. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  63783. const ranges = [];
  63784. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  63785. ranges.push(numbers.slice(i, i + 2));
  63786. }
  63787. this[_xfa_object.$content] = ranges;
  63788. }
  63789. }
  63790. class Pagination extends _xfa_object.OptionObject {
  63791. constructor(attributes) {
  63792. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  63793. }
  63794. }
  63795. class PaginationOverride extends _xfa_object.OptionObject {
  63796. constructor(attributes) {
  63797. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  63798. }
  63799. }
  63800. class Part extends _xfa_object.IntegerObject {
  63801. constructor(attributes) {
  63802. super(CONFIG_NS_ID, "part", 1, n => false);
  63803. }
  63804. }
  63805. class Pcl extends _xfa_object.XFAObject {
  63806. constructor(attributes) {
  63807. super(CONFIG_NS_ID, "pcl", true);
  63808. this.name = attributes.name || "";
  63809. this.batchOutput = null;
  63810. this.fontInfo = null;
  63811. this.jog = null;
  63812. this.mediumInfo = null;
  63813. this.outputBin = null;
  63814. this.pageOffset = null;
  63815. this.staple = null;
  63816. this.xdc = null;
  63817. }
  63818. }
  63819. class Pdf extends _xfa_object.XFAObject {
  63820. constructor(attributes) {
  63821. super(CONFIG_NS_ID, "pdf", true);
  63822. this.name = attributes.name || "";
  63823. this.adobeExtensionLevel = null;
  63824. this.batchOutput = null;
  63825. this.compression = null;
  63826. this.creator = null;
  63827. this.encryption = null;
  63828. this.fontInfo = null;
  63829. this.interactive = null;
  63830. this.linearized = null;
  63831. this.openAction = null;
  63832. this.pdfa = null;
  63833. this.producer = null;
  63834. this.renderPolicy = null;
  63835. this.scriptModel = null;
  63836. this.silentPrint = null;
  63837. this.submitFormat = null;
  63838. this.tagged = null;
  63839. this.version = null;
  63840. this.viewerPreferences = null;
  63841. this.xdc = null;
  63842. }
  63843. }
  63844. class Pdfa extends _xfa_object.XFAObject {
  63845. constructor(attributes) {
  63846. super(CONFIG_NS_ID, "pdfa", true);
  63847. this.amd = null;
  63848. this.conformance = null;
  63849. this.includeXDPContent = null;
  63850. this.part = null;
  63851. }
  63852. }
  63853. class Permissions extends _xfa_object.XFAObject {
  63854. constructor(attributes) {
  63855. super(CONFIG_NS_ID, "permissions", true);
  63856. this.accessibleContent = null;
  63857. this.change = null;
  63858. this.contentCopy = null;
  63859. this.documentAssembly = null;
  63860. this.formFieldFilling = null;
  63861. this.modifyAnnots = null;
  63862. this.plaintextMetadata = null;
  63863. this.print = null;
  63864. this.printHighQuality = null;
  63865. }
  63866. }
  63867. class PickTrayByPDFSize extends _xfa_object.Option01 {
  63868. constructor(attributes) {
  63869. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  63870. }
  63871. }
  63872. class Picture extends _xfa_object.StringObject {
  63873. constructor(attributes) {
  63874. super(CONFIG_NS_ID, "picture");
  63875. }
  63876. }
  63877. class PlaintextMetadata extends _xfa_object.Option01 {
  63878. constructor(attributes) {
  63879. super(CONFIG_NS_ID, "plaintextMetadata");
  63880. }
  63881. }
  63882. class Presence extends _xfa_object.OptionObject {
  63883. constructor(attributes) {
  63884. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  63885. }
  63886. }
  63887. class Present extends _xfa_object.XFAObject {
  63888. constructor(attributes) {
  63889. super(CONFIG_NS_ID, "present", true);
  63890. this.behaviorOverride = null;
  63891. this.cache = null;
  63892. this.common = null;
  63893. this.copies = null;
  63894. this.destination = null;
  63895. this.incrementalMerge = null;
  63896. this.layout = null;
  63897. this.output = null;
  63898. this.overprint = null;
  63899. this.pagination = null;
  63900. this.paginationOverride = null;
  63901. this.script = null;
  63902. this.validate = null;
  63903. this.xdp = null;
  63904. this.driver = new _xfa_object.XFAObjectArray();
  63905. this.labelPrinter = new _xfa_object.XFAObjectArray();
  63906. this.pcl = new _xfa_object.XFAObjectArray();
  63907. this.pdf = new _xfa_object.XFAObjectArray();
  63908. this.ps = new _xfa_object.XFAObjectArray();
  63909. this.submitUrl = new _xfa_object.XFAObjectArray();
  63910. this.webClient = new _xfa_object.XFAObjectArray();
  63911. this.zpl = new _xfa_object.XFAObjectArray();
  63912. }
  63913. }
  63914. class Print extends _xfa_object.Option01 {
  63915. constructor(attributes) {
  63916. super(CONFIG_NS_ID, "print");
  63917. }
  63918. }
  63919. class PrintHighQuality extends _xfa_object.Option01 {
  63920. constructor(attributes) {
  63921. super(CONFIG_NS_ID, "printHighQuality");
  63922. }
  63923. }
  63924. class PrintScaling extends _xfa_object.OptionObject {
  63925. constructor(attributes) {
  63926. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  63927. }
  63928. }
  63929. class PrinterName extends _xfa_object.StringObject {
  63930. constructor(attributes) {
  63931. super(CONFIG_NS_ID, "printerName");
  63932. }
  63933. }
  63934. class Producer extends _xfa_object.StringObject {
  63935. constructor(attributes) {
  63936. super(CONFIG_NS_ID, "producer");
  63937. }
  63938. }
  63939. class Ps extends _xfa_object.XFAObject {
  63940. constructor(attributes) {
  63941. super(CONFIG_NS_ID, "ps", true);
  63942. this.name = attributes.name || "";
  63943. this.batchOutput = null;
  63944. this.fontInfo = null;
  63945. this.jog = null;
  63946. this.mediumInfo = null;
  63947. this.outputBin = null;
  63948. this.staple = null;
  63949. this.xdc = null;
  63950. }
  63951. }
  63952. class Range extends _xfa_object.ContentObject {
  63953. constructor(attributes) {
  63954. super(CONFIG_NS_ID, "range");
  63955. }
  63956. [_xfa_object.$finalize]() {
  63957. 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 => {
  63958. if (range.length === 1) {
  63959. range.push(range[0]);
  63960. }
  63961. return range;
  63962. });
  63963. }
  63964. }
  63965. class Record extends _xfa_object.ContentObject {
  63966. constructor(attributes) {
  63967. super(CONFIG_NS_ID, "record");
  63968. }
  63969. [_xfa_object.$finalize]() {
  63970. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  63971. const n = parseInt(this[_xfa_object.$content], 10);
  63972. if (!isNaN(n) && n >= 0) {
  63973. this[_xfa_object.$content] = n;
  63974. }
  63975. }
  63976. }
  63977. class Relevant extends _xfa_object.ContentObject {
  63978. constructor(attributes) {
  63979. super(CONFIG_NS_ID, "relevant");
  63980. }
  63981. [_xfa_object.$finalize]() {
  63982. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  63983. }
  63984. }
  63985. class Rename extends _xfa_object.ContentObject {
  63986. constructor(attributes) {
  63987. super(CONFIG_NS_ID, "rename");
  63988. }
  63989. [_xfa_object.$finalize]() {
  63990. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  63991. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_xfa_object.$content])) {
  63992. (0, _util.warn)("XFA - Rename: invalid XFA name");
  63993. }
  63994. }
  63995. }
  63996. class RenderPolicy extends _xfa_object.OptionObject {
  63997. constructor(attributes) {
  63998. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  63999. }
  64000. }
  64001. class RunScripts extends _xfa_object.OptionObject {
  64002. constructor(attributes) {
  64003. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  64004. }
  64005. }
  64006. class Script extends _xfa_object.XFAObject {
  64007. constructor(attributes) {
  64008. super(CONFIG_NS_ID, "script", true);
  64009. this.currentPage = null;
  64010. this.exclude = null;
  64011. this.runScripts = null;
  64012. }
  64013. }
  64014. class ScriptModel extends _xfa_object.OptionObject {
  64015. constructor(attributes) {
  64016. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  64017. }
  64018. }
  64019. class Severity extends _xfa_object.OptionObject {
  64020. constructor(attributes) {
  64021. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  64022. }
  64023. }
  64024. class SilentPrint extends _xfa_object.XFAObject {
  64025. constructor(attributes) {
  64026. super(CONFIG_NS_ID, "silentPrint", true);
  64027. this.addSilentPrint = null;
  64028. this.printerName = null;
  64029. }
  64030. }
  64031. class Staple extends _xfa_object.XFAObject {
  64032. constructor(attributes) {
  64033. super(CONFIG_NS_ID, "staple");
  64034. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  64035. }
  64036. }
  64037. class StartNode extends _xfa_object.StringObject {
  64038. constructor(attributes) {
  64039. super(CONFIG_NS_ID, "startNode");
  64040. }
  64041. }
  64042. class StartPage extends _xfa_object.IntegerObject {
  64043. constructor(attributes) {
  64044. super(CONFIG_NS_ID, "startPage", 0, n => true);
  64045. }
  64046. }
  64047. class SubmitFormat extends _xfa_object.OptionObject {
  64048. constructor(attributes) {
  64049. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  64050. }
  64051. }
  64052. class SubmitUrl extends _xfa_object.StringObject {
  64053. constructor(attributes) {
  64054. super(CONFIG_NS_ID, "submitUrl");
  64055. }
  64056. }
  64057. class SubsetBelow extends _xfa_object.IntegerObject {
  64058. constructor(attributes) {
  64059. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  64060. }
  64061. }
  64062. class SuppressBanner extends _xfa_object.Option01 {
  64063. constructor(attributes) {
  64064. super(CONFIG_NS_ID, "suppressBanner");
  64065. }
  64066. }
  64067. class Tagged extends _xfa_object.Option01 {
  64068. constructor(attributes) {
  64069. super(CONFIG_NS_ID, "tagged");
  64070. }
  64071. }
  64072. class Template extends _xfa_object.XFAObject {
  64073. constructor(attributes) {
  64074. super(CONFIG_NS_ID, "template", true);
  64075. this.base = null;
  64076. this.relevant = null;
  64077. this.startPage = null;
  64078. this.uri = null;
  64079. this.xsl = null;
  64080. }
  64081. }
  64082. class Threshold extends _xfa_object.OptionObject {
  64083. constructor(attributes) {
  64084. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  64085. }
  64086. }
  64087. class To extends _xfa_object.OptionObject {
  64088. constructor(attributes) {
  64089. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  64090. }
  64091. }
  64092. class TemplateCache extends _xfa_object.XFAObject {
  64093. constructor(attributes) {
  64094. super(CONFIG_NS_ID, "templateCache");
  64095. this.maxEntries = (0, _utils.getInteger)({
  64096. data: attributes.maxEntries,
  64097. defaultValue: 5,
  64098. validate: n => n >= 0
  64099. });
  64100. }
  64101. }
  64102. class Trace extends _xfa_object.XFAObject {
  64103. constructor(attributes) {
  64104. super(CONFIG_NS_ID, "trace", true);
  64105. this.area = new _xfa_object.XFAObjectArray();
  64106. }
  64107. }
  64108. class Transform extends _xfa_object.XFAObject {
  64109. constructor(attributes) {
  64110. super(CONFIG_NS_ID, "transform", true);
  64111. this.groupParent = null;
  64112. this.ifEmpty = null;
  64113. this.nameAttr = null;
  64114. this.picture = null;
  64115. this.presence = null;
  64116. this.rename = null;
  64117. this.whitespace = null;
  64118. }
  64119. }
  64120. class Type extends _xfa_object.OptionObject {
  64121. constructor(attributes) {
  64122. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  64123. }
  64124. }
  64125. class Uri extends _xfa_object.StringObject {
  64126. constructor(attributes) {
  64127. super(CONFIG_NS_ID, "uri");
  64128. }
  64129. }
  64130. class Validate extends _xfa_object.OptionObject {
  64131. constructor(attributes) {
  64132. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  64133. }
  64134. }
  64135. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  64136. constructor(attributes) {
  64137. super(CONFIG_NS_ID, "validateApprovalSignatures");
  64138. }
  64139. [_xfa_object.$finalize]() {
  64140. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  64141. }
  64142. }
  64143. class ValidationMessaging extends _xfa_object.OptionObject {
  64144. constructor(attributes) {
  64145. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  64146. }
  64147. }
  64148. class Version extends _xfa_object.OptionObject {
  64149. constructor(attributes) {
  64150. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  64151. }
  64152. }
  64153. class VersionControl extends _xfa_object.XFAObject {
  64154. constructor(attributes) {
  64155. super(CONFIG_NS_ID, "VersionControl");
  64156. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  64157. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  64158. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  64159. }
  64160. }
  64161. class ViewerPreferences extends _xfa_object.XFAObject {
  64162. constructor(attributes) {
  64163. super(CONFIG_NS_ID, "viewerPreferences", true);
  64164. this.ADBE_JSConsole = null;
  64165. this.ADBE_JSDebugger = null;
  64166. this.addViewerPreferences = null;
  64167. this.duplexOption = null;
  64168. this.enforce = null;
  64169. this.numberOfCopies = null;
  64170. this.pageRange = null;
  64171. this.pickTrayByPDFSize = null;
  64172. this.printScaling = null;
  64173. }
  64174. }
  64175. class WebClient extends _xfa_object.XFAObject {
  64176. constructor(attributes) {
  64177. super(CONFIG_NS_ID, "webClient", true);
  64178. this.name = attributes.name ? attributes.name.trim() : "";
  64179. this.fontInfo = null;
  64180. this.xdc = null;
  64181. }
  64182. }
  64183. class Whitespace extends _xfa_object.OptionObject {
  64184. constructor(attributes) {
  64185. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  64186. }
  64187. }
  64188. class Window extends _xfa_object.ContentObject {
  64189. constructor(attributes) {
  64190. super(CONFIG_NS_ID, "window");
  64191. }
  64192. [_xfa_object.$finalize]() {
  64193. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  64194. if (pair.some(x => isNaN(x))) {
  64195. this[_xfa_object.$content] = [0, 0];
  64196. return;
  64197. }
  64198. if (pair.length === 1) {
  64199. pair.push(pair[0]);
  64200. }
  64201. this[_xfa_object.$content] = pair;
  64202. }
  64203. }
  64204. class Xdc extends _xfa_object.XFAObject {
  64205. constructor(attributes) {
  64206. super(CONFIG_NS_ID, "xdc", true);
  64207. this.uri = new _xfa_object.XFAObjectArray();
  64208. this.xsl = new _xfa_object.XFAObjectArray();
  64209. }
  64210. }
  64211. class Xdp extends _xfa_object.XFAObject {
  64212. constructor(attributes) {
  64213. super(CONFIG_NS_ID, "xdp", true);
  64214. this.packets = null;
  64215. }
  64216. }
  64217. class Xsl extends _xfa_object.XFAObject {
  64218. constructor(attributes) {
  64219. super(CONFIG_NS_ID, "xsl", true);
  64220. this.debug = null;
  64221. this.uri = null;
  64222. }
  64223. }
  64224. class Zpl extends _xfa_object.XFAObject {
  64225. constructor(attributes) {
  64226. super(CONFIG_NS_ID, "zpl", true);
  64227. this.name = attributes.name ? attributes.name.trim() : "";
  64228. this.batchOutput = null;
  64229. this.flipLabel = null;
  64230. this.fontInfo = null;
  64231. this.xdc = null;
  64232. }
  64233. }
  64234. class ConfigNamespace {
  64235. static [_namespaces.$buildXFAObject](name, attributes) {
  64236. if (ConfigNamespace.hasOwnProperty(name)) {
  64237. return ConfigNamespace[name](attributes);
  64238. }
  64239. return undefined;
  64240. }
  64241. static acrobat(attrs) {
  64242. return new Acrobat(attrs);
  64243. }
  64244. static acrobat7(attrs) {
  64245. return new Acrobat7(attrs);
  64246. }
  64247. static ADBE_JSConsole(attrs) {
  64248. return new ADBE_JSConsole(attrs);
  64249. }
  64250. static ADBE_JSDebugger(attrs) {
  64251. return new ADBE_JSDebugger(attrs);
  64252. }
  64253. static addSilentPrint(attrs) {
  64254. return new AddSilentPrint(attrs);
  64255. }
  64256. static addViewerPreferences(attrs) {
  64257. return new AddViewerPreferences(attrs);
  64258. }
  64259. static adjustData(attrs) {
  64260. return new AdjustData(attrs);
  64261. }
  64262. static adobeExtensionLevel(attrs) {
  64263. return new AdobeExtensionLevel(attrs);
  64264. }
  64265. static agent(attrs) {
  64266. return new Agent(attrs);
  64267. }
  64268. static alwaysEmbed(attrs) {
  64269. return new AlwaysEmbed(attrs);
  64270. }
  64271. static amd(attrs) {
  64272. return new Amd(attrs);
  64273. }
  64274. static area(attrs) {
  64275. return new Area(attrs);
  64276. }
  64277. static attributes(attrs) {
  64278. return new Attributes(attrs);
  64279. }
  64280. static autoSave(attrs) {
  64281. return new AutoSave(attrs);
  64282. }
  64283. static base(attrs) {
  64284. return new Base(attrs);
  64285. }
  64286. static batchOutput(attrs) {
  64287. return new BatchOutput(attrs);
  64288. }
  64289. static behaviorOverride(attrs) {
  64290. return new BehaviorOverride(attrs);
  64291. }
  64292. static cache(attrs) {
  64293. return new Cache(attrs);
  64294. }
  64295. static change(attrs) {
  64296. return new Change(attrs);
  64297. }
  64298. static common(attrs) {
  64299. return new Common(attrs);
  64300. }
  64301. static compress(attrs) {
  64302. return new Compress(attrs);
  64303. }
  64304. static compressLogicalStructure(attrs) {
  64305. return new CompressLogicalStructure(attrs);
  64306. }
  64307. static compressObjectStream(attrs) {
  64308. return new CompressObjectStream(attrs);
  64309. }
  64310. static compression(attrs) {
  64311. return new Compression(attrs);
  64312. }
  64313. static config(attrs) {
  64314. return new Config(attrs);
  64315. }
  64316. static conformance(attrs) {
  64317. return new Conformance(attrs);
  64318. }
  64319. static contentCopy(attrs) {
  64320. return new ContentCopy(attrs);
  64321. }
  64322. static copies(attrs) {
  64323. return new Copies(attrs);
  64324. }
  64325. static creator(attrs) {
  64326. return new Creator(attrs);
  64327. }
  64328. static currentPage(attrs) {
  64329. return new CurrentPage(attrs);
  64330. }
  64331. static data(attrs) {
  64332. return new Data(attrs);
  64333. }
  64334. static debug(attrs) {
  64335. return new Debug(attrs);
  64336. }
  64337. static defaultTypeface(attrs) {
  64338. return new DefaultTypeface(attrs);
  64339. }
  64340. static destination(attrs) {
  64341. return new Destination(attrs);
  64342. }
  64343. static documentAssembly(attrs) {
  64344. return new DocumentAssembly(attrs);
  64345. }
  64346. static driver(attrs) {
  64347. return new Driver(attrs);
  64348. }
  64349. static duplexOption(attrs) {
  64350. return new DuplexOption(attrs);
  64351. }
  64352. static dynamicRender(attrs) {
  64353. return new DynamicRender(attrs);
  64354. }
  64355. static embed(attrs) {
  64356. return new Embed(attrs);
  64357. }
  64358. static encrypt(attrs) {
  64359. return new Encrypt(attrs);
  64360. }
  64361. static encryption(attrs) {
  64362. return new Encryption(attrs);
  64363. }
  64364. static encryptionLevel(attrs) {
  64365. return new EncryptionLevel(attrs);
  64366. }
  64367. static enforce(attrs) {
  64368. return new Enforce(attrs);
  64369. }
  64370. static equate(attrs) {
  64371. return new Equate(attrs);
  64372. }
  64373. static equateRange(attrs) {
  64374. return new EquateRange(attrs);
  64375. }
  64376. static exclude(attrs) {
  64377. return new Exclude(attrs);
  64378. }
  64379. static excludeNS(attrs) {
  64380. return new ExcludeNS(attrs);
  64381. }
  64382. static flipLabel(attrs) {
  64383. return new FlipLabel(attrs);
  64384. }
  64385. static fontInfo(attrs) {
  64386. return new FontInfo(attrs);
  64387. }
  64388. static formFieldFilling(attrs) {
  64389. return new FormFieldFilling(attrs);
  64390. }
  64391. static groupParent(attrs) {
  64392. return new GroupParent(attrs);
  64393. }
  64394. static ifEmpty(attrs) {
  64395. return new IfEmpty(attrs);
  64396. }
  64397. static includeXDPContent(attrs) {
  64398. return new IncludeXDPContent(attrs);
  64399. }
  64400. static incrementalLoad(attrs) {
  64401. return new IncrementalLoad(attrs);
  64402. }
  64403. static incrementalMerge(attrs) {
  64404. return new IncrementalMerge(attrs);
  64405. }
  64406. static interactive(attrs) {
  64407. return new Interactive(attrs);
  64408. }
  64409. static jog(attrs) {
  64410. return new Jog(attrs);
  64411. }
  64412. static labelPrinter(attrs) {
  64413. return new LabelPrinter(attrs);
  64414. }
  64415. static layout(attrs) {
  64416. return new Layout(attrs);
  64417. }
  64418. static level(attrs) {
  64419. return new Level(attrs);
  64420. }
  64421. static linearized(attrs) {
  64422. return new Linearized(attrs);
  64423. }
  64424. static locale(attrs) {
  64425. return new Locale(attrs);
  64426. }
  64427. static localeSet(attrs) {
  64428. return new LocaleSet(attrs);
  64429. }
  64430. static log(attrs) {
  64431. return new Log(attrs);
  64432. }
  64433. static map(attrs) {
  64434. return new MapElement(attrs);
  64435. }
  64436. static mediumInfo(attrs) {
  64437. return new MediumInfo(attrs);
  64438. }
  64439. static message(attrs) {
  64440. return new Message(attrs);
  64441. }
  64442. static messaging(attrs) {
  64443. return new Messaging(attrs);
  64444. }
  64445. static mode(attrs) {
  64446. return new Mode(attrs);
  64447. }
  64448. static modifyAnnots(attrs) {
  64449. return new ModifyAnnots(attrs);
  64450. }
  64451. static msgId(attrs) {
  64452. return new MsgId(attrs);
  64453. }
  64454. static nameAttr(attrs) {
  64455. return new NameAttr(attrs);
  64456. }
  64457. static neverEmbed(attrs) {
  64458. return new NeverEmbed(attrs);
  64459. }
  64460. static numberOfCopies(attrs) {
  64461. return new NumberOfCopies(attrs);
  64462. }
  64463. static openAction(attrs) {
  64464. return new OpenAction(attrs);
  64465. }
  64466. static output(attrs) {
  64467. return new Output(attrs);
  64468. }
  64469. static outputBin(attrs) {
  64470. return new OutputBin(attrs);
  64471. }
  64472. static outputXSL(attrs) {
  64473. return new OutputXSL(attrs);
  64474. }
  64475. static overprint(attrs) {
  64476. return new Overprint(attrs);
  64477. }
  64478. static packets(attrs) {
  64479. return new Packets(attrs);
  64480. }
  64481. static pageOffset(attrs) {
  64482. return new PageOffset(attrs);
  64483. }
  64484. static pageRange(attrs) {
  64485. return new PageRange(attrs);
  64486. }
  64487. static pagination(attrs) {
  64488. return new Pagination(attrs);
  64489. }
  64490. static paginationOverride(attrs) {
  64491. return new PaginationOverride(attrs);
  64492. }
  64493. static part(attrs) {
  64494. return new Part(attrs);
  64495. }
  64496. static pcl(attrs) {
  64497. return new Pcl(attrs);
  64498. }
  64499. static pdf(attrs) {
  64500. return new Pdf(attrs);
  64501. }
  64502. static pdfa(attrs) {
  64503. return new Pdfa(attrs);
  64504. }
  64505. static permissions(attrs) {
  64506. return new Permissions(attrs);
  64507. }
  64508. static pickTrayByPDFSize(attrs) {
  64509. return new PickTrayByPDFSize(attrs);
  64510. }
  64511. static picture(attrs) {
  64512. return new Picture(attrs);
  64513. }
  64514. static plaintextMetadata(attrs) {
  64515. return new PlaintextMetadata(attrs);
  64516. }
  64517. static presence(attrs) {
  64518. return new Presence(attrs);
  64519. }
  64520. static present(attrs) {
  64521. return new Present(attrs);
  64522. }
  64523. static print(attrs) {
  64524. return new Print(attrs);
  64525. }
  64526. static printHighQuality(attrs) {
  64527. return new PrintHighQuality(attrs);
  64528. }
  64529. static printScaling(attrs) {
  64530. return new PrintScaling(attrs);
  64531. }
  64532. static printerName(attrs) {
  64533. return new PrinterName(attrs);
  64534. }
  64535. static producer(attrs) {
  64536. return new Producer(attrs);
  64537. }
  64538. static ps(attrs) {
  64539. return new Ps(attrs);
  64540. }
  64541. static range(attrs) {
  64542. return new Range(attrs);
  64543. }
  64544. static record(attrs) {
  64545. return new Record(attrs);
  64546. }
  64547. static relevant(attrs) {
  64548. return new Relevant(attrs);
  64549. }
  64550. static rename(attrs) {
  64551. return new Rename(attrs);
  64552. }
  64553. static renderPolicy(attrs) {
  64554. return new RenderPolicy(attrs);
  64555. }
  64556. static runScripts(attrs) {
  64557. return new RunScripts(attrs);
  64558. }
  64559. static script(attrs) {
  64560. return new Script(attrs);
  64561. }
  64562. static scriptModel(attrs) {
  64563. return new ScriptModel(attrs);
  64564. }
  64565. static severity(attrs) {
  64566. return new Severity(attrs);
  64567. }
  64568. static silentPrint(attrs) {
  64569. return new SilentPrint(attrs);
  64570. }
  64571. static staple(attrs) {
  64572. return new Staple(attrs);
  64573. }
  64574. static startNode(attrs) {
  64575. return new StartNode(attrs);
  64576. }
  64577. static startPage(attrs) {
  64578. return new StartPage(attrs);
  64579. }
  64580. static submitFormat(attrs) {
  64581. return new SubmitFormat(attrs);
  64582. }
  64583. static submitUrl(attrs) {
  64584. return new SubmitUrl(attrs);
  64585. }
  64586. static subsetBelow(attrs) {
  64587. return new SubsetBelow(attrs);
  64588. }
  64589. static suppressBanner(attrs) {
  64590. return new SuppressBanner(attrs);
  64591. }
  64592. static tagged(attrs) {
  64593. return new Tagged(attrs);
  64594. }
  64595. static template(attrs) {
  64596. return new Template(attrs);
  64597. }
  64598. static templateCache(attrs) {
  64599. return new TemplateCache(attrs);
  64600. }
  64601. static threshold(attrs) {
  64602. return new Threshold(attrs);
  64603. }
  64604. static to(attrs) {
  64605. return new To(attrs);
  64606. }
  64607. static trace(attrs) {
  64608. return new Trace(attrs);
  64609. }
  64610. static transform(attrs) {
  64611. return new Transform(attrs);
  64612. }
  64613. static type(attrs) {
  64614. return new Type(attrs);
  64615. }
  64616. static uri(attrs) {
  64617. return new Uri(attrs);
  64618. }
  64619. static validate(attrs) {
  64620. return new Validate(attrs);
  64621. }
  64622. static validateApprovalSignatures(attrs) {
  64623. return new ValidateApprovalSignatures(attrs);
  64624. }
  64625. static validationMessaging(attrs) {
  64626. return new ValidationMessaging(attrs);
  64627. }
  64628. static version(attrs) {
  64629. return new Version(attrs);
  64630. }
  64631. static versionControl(attrs) {
  64632. return new VersionControl(attrs);
  64633. }
  64634. static viewerPreferences(attrs) {
  64635. return new ViewerPreferences(attrs);
  64636. }
  64637. static webClient(attrs) {
  64638. return new WebClient(attrs);
  64639. }
  64640. static whitespace(attrs) {
  64641. return new Whitespace(attrs);
  64642. }
  64643. static window(attrs) {
  64644. return new Window(attrs);
  64645. }
  64646. static xdc(attrs) {
  64647. return new Xdc(attrs);
  64648. }
  64649. static xdp(attrs) {
  64650. return new Xdp(attrs);
  64651. }
  64652. static xsl(attrs) {
  64653. return new Xsl(attrs);
  64654. }
  64655. static zpl(attrs) {
  64656. return new Zpl(attrs);
  64657. }
  64658. }
  64659. exports.ConfigNamespace = ConfigNamespace;
  64660. /***/ }),
  64661. /* 221 */
  64662. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64663. "use strict";
  64664. Object.defineProperty(exports, "__esModule", ({
  64665. value: true
  64666. }));
  64667. exports.ConnectionSetNamespace = void 0;
  64668. var _namespaces = __w_pdfjs_require__(208);
  64669. var _xfa_object = __w_pdfjs_require__(206);
  64670. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  64671. class ConnectionSet extends _xfa_object.XFAObject {
  64672. constructor(attributes) {
  64673. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  64674. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  64675. this.xmlConnection = new _xfa_object.XFAObjectArray();
  64676. this.xsdConnection = new _xfa_object.XFAObjectArray();
  64677. }
  64678. }
  64679. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  64680. constructor(attributes) {
  64681. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  64682. this.id = attributes.id || "";
  64683. this.name = attributes.name || "";
  64684. this.use = attributes.use || "";
  64685. this.usehref = attributes.usehref || "";
  64686. }
  64687. }
  64688. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  64689. constructor(attributes) {
  64690. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  64691. this.id = attributes.id || "";
  64692. this.name = attributes.name || "";
  64693. this.use = attributes.use || "";
  64694. this.usehref = attributes.usehref || "";
  64695. }
  64696. }
  64697. class Operation extends _xfa_object.StringObject {
  64698. constructor(attributes) {
  64699. super(CONNECTION_SET_NS_ID, "operation");
  64700. this.id = attributes.id || "";
  64701. this.input = attributes.input || "";
  64702. this.name = attributes.name || "";
  64703. this.output = attributes.output || "";
  64704. this.use = attributes.use || "";
  64705. this.usehref = attributes.usehref || "";
  64706. }
  64707. }
  64708. class RootElement extends _xfa_object.StringObject {
  64709. constructor(attributes) {
  64710. super(CONNECTION_SET_NS_ID, "rootElement");
  64711. this.id = attributes.id || "";
  64712. this.name = attributes.name || "";
  64713. this.use = attributes.use || "";
  64714. this.usehref = attributes.usehref || "";
  64715. }
  64716. }
  64717. class SoapAction extends _xfa_object.StringObject {
  64718. constructor(attributes) {
  64719. super(CONNECTION_SET_NS_ID, "soapAction");
  64720. this.id = attributes.id || "";
  64721. this.name = attributes.name || "";
  64722. this.use = attributes.use || "";
  64723. this.usehref = attributes.usehref || "";
  64724. }
  64725. }
  64726. class SoapAddress extends _xfa_object.StringObject {
  64727. constructor(attributes) {
  64728. super(CONNECTION_SET_NS_ID, "soapAddress");
  64729. this.id = attributes.id || "";
  64730. this.name = attributes.name || "";
  64731. this.use = attributes.use || "";
  64732. this.usehref = attributes.usehref || "";
  64733. }
  64734. }
  64735. class Uri extends _xfa_object.StringObject {
  64736. constructor(attributes) {
  64737. super(CONNECTION_SET_NS_ID, "uri");
  64738. this.id = attributes.id || "";
  64739. this.name = attributes.name || "";
  64740. this.use = attributes.use || "";
  64741. this.usehref = attributes.usehref || "";
  64742. }
  64743. }
  64744. class WsdlAddress extends _xfa_object.StringObject {
  64745. constructor(attributes) {
  64746. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  64747. this.id = attributes.id || "";
  64748. this.name = attributes.name || "";
  64749. this.use = attributes.use || "";
  64750. this.usehref = attributes.usehref || "";
  64751. }
  64752. }
  64753. class WsdlConnection extends _xfa_object.XFAObject {
  64754. constructor(attributes) {
  64755. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  64756. this.dataDescription = attributes.dataDescription || "";
  64757. this.name = attributes.name || "";
  64758. this.effectiveInputPolicy = null;
  64759. this.effectiveOutputPolicy = null;
  64760. this.operation = null;
  64761. this.soapAction = null;
  64762. this.soapAddress = null;
  64763. this.wsdlAddress = null;
  64764. }
  64765. }
  64766. class XmlConnection extends _xfa_object.XFAObject {
  64767. constructor(attributes) {
  64768. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  64769. this.dataDescription = attributes.dataDescription || "";
  64770. this.name = attributes.name || "";
  64771. this.uri = null;
  64772. }
  64773. }
  64774. class XsdConnection extends _xfa_object.XFAObject {
  64775. constructor(attributes) {
  64776. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  64777. this.dataDescription = attributes.dataDescription || "";
  64778. this.name = attributes.name || "";
  64779. this.rootElement = null;
  64780. this.uri = null;
  64781. }
  64782. }
  64783. class ConnectionSetNamespace {
  64784. static [_namespaces.$buildXFAObject](name, attributes) {
  64785. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  64786. return ConnectionSetNamespace[name](attributes);
  64787. }
  64788. return undefined;
  64789. }
  64790. static connectionSet(attrs) {
  64791. return new ConnectionSet(attrs);
  64792. }
  64793. static effectiveInputPolicy(attrs) {
  64794. return new EffectiveInputPolicy(attrs);
  64795. }
  64796. static effectiveOutputPolicy(attrs) {
  64797. return new EffectiveOutputPolicy(attrs);
  64798. }
  64799. static operation(attrs) {
  64800. return new Operation(attrs);
  64801. }
  64802. static rootElement(attrs) {
  64803. return new RootElement(attrs);
  64804. }
  64805. static soapAction(attrs) {
  64806. return new SoapAction(attrs);
  64807. }
  64808. static soapAddress(attrs) {
  64809. return new SoapAddress(attrs);
  64810. }
  64811. static uri(attrs) {
  64812. return new Uri(attrs);
  64813. }
  64814. static wsdlAddress(attrs) {
  64815. return new WsdlAddress(attrs);
  64816. }
  64817. static wsdlConnection(attrs) {
  64818. return new WsdlConnection(attrs);
  64819. }
  64820. static xmlConnection(attrs) {
  64821. return new XmlConnection(attrs);
  64822. }
  64823. static xsdConnection(attrs) {
  64824. return new XsdConnection(attrs);
  64825. }
  64826. }
  64827. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  64828. /***/ }),
  64829. /* 222 */
  64830. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64831. "use strict";
  64832. Object.defineProperty(exports, "__esModule", ({
  64833. value: true
  64834. }));
  64835. exports.DatasetsNamespace = void 0;
  64836. var _xfa_object = __w_pdfjs_require__(206);
  64837. var _namespaces = __w_pdfjs_require__(208);
  64838. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  64839. class Data extends _xfa_object.XmlObject {
  64840. constructor(attributes) {
  64841. super(DATASETS_NS_ID, "data", attributes);
  64842. }
  64843. [_xfa_object.$isNsAgnostic]() {
  64844. return true;
  64845. }
  64846. }
  64847. class Datasets extends _xfa_object.XFAObject {
  64848. constructor(attributes) {
  64849. super(DATASETS_NS_ID, "datasets", true);
  64850. this.data = null;
  64851. this.Signature = null;
  64852. }
  64853. [_xfa_object.$onChild](child) {
  64854. const name = child[_xfa_object.$nodeName];
  64855. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  64856. this[name] = child;
  64857. }
  64858. this[_xfa_object.$appendChild](child);
  64859. }
  64860. }
  64861. class DatasetsNamespace {
  64862. static [_namespaces.$buildXFAObject](name, attributes) {
  64863. if (DatasetsNamespace.hasOwnProperty(name)) {
  64864. return DatasetsNamespace[name](attributes);
  64865. }
  64866. return undefined;
  64867. }
  64868. static datasets(attributes) {
  64869. return new Datasets(attributes);
  64870. }
  64871. static data(attributes) {
  64872. return new Data(attributes);
  64873. }
  64874. }
  64875. exports.DatasetsNamespace = DatasetsNamespace;
  64876. /***/ }),
  64877. /* 223 */
  64878. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  64879. "use strict";
  64880. Object.defineProperty(exports, "__esModule", ({
  64881. value: true
  64882. }));
  64883. exports.LocaleSetNamespace = void 0;
  64884. var _namespaces = __w_pdfjs_require__(208);
  64885. var _xfa_object = __w_pdfjs_require__(206);
  64886. var _utils = __w_pdfjs_require__(207);
  64887. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  64888. class CalendarSymbols extends _xfa_object.XFAObject {
  64889. constructor(attributes) {
  64890. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  64891. this.name = "gregorian";
  64892. this.dayNames = new _xfa_object.XFAObjectArray(2);
  64893. this.eraNames = null;
  64894. this.meridiemNames = null;
  64895. this.monthNames = new _xfa_object.XFAObjectArray(2);
  64896. }
  64897. }
  64898. class CurrencySymbol extends _xfa_object.StringObject {
  64899. constructor(attributes) {
  64900. super(LOCALE_SET_NS_ID, "currencySymbol");
  64901. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  64902. }
  64903. }
  64904. class CurrencySymbols extends _xfa_object.XFAObject {
  64905. constructor(attributes) {
  64906. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  64907. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  64908. }
  64909. }
  64910. class DatePattern extends _xfa_object.StringObject {
  64911. constructor(attributes) {
  64912. super(LOCALE_SET_NS_ID, "datePattern");
  64913. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  64914. }
  64915. }
  64916. class DatePatterns extends _xfa_object.XFAObject {
  64917. constructor(attributes) {
  64918. super(LOCALE_SET_NS_ID, "datePatterns", true);
  64919. this.datePattern = new _xfa_object.XFAObjectArray(4);
  64920. }
  64921. }
  64922. class DateTimeSymbols extends _xfa_object.ContentObject {
  64923. constructor(attributes) {
  64924. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  64925. }
  64926. }
  64927. class Day extends _xfa_object.StringObject {
  64928. constructor(attributes) {
  64929. super(LOCALE_SET_NS_ID, "day");
  64930. }
  64931. }
  64932. class DayNames extends _xfa_object.XFAObject {
  64933. constructor(attributes) {
  64934. super(LOCALE_SET_NS_ID, "dayNames", true);
  64935. this.abbr = (0, _utils.getInteger)({
  64936. data: attributes.abbr,
  64937. defaultValue: 0,
  64938. validate: x => x === 1
  64939. });
  64940. this.day = new _xfa_object.XFAObjectArray(7);
  64941. }
  64942. }
  64943. class Era extends _xfa_object.StringObject {
  64944. constructor(attributes) {
  64945. super(LOCALE_SET_NS_ID, "era");
  64946. }
  64947. }
  64948. class EraNames extends _xfa_object.XFAObject {
  64949. constructor(attributes) {
  64950. super(LOCALE_SET_NS_ID, "eraNames", true);
  64951. this.era = new _xfa_object.XFAObjectArray(2);
  64952. }
  64953. }
  64954. class Locale extends _xfa_object.XFAObject {
  64955. constructor(attributes) {
  64956. super(LOCALE_SET_NS_ID, "locale", true);
  64957. this.desc = attributes.desc || "";
  64958. this.name = "isoname";
  64959. this.calendarSymbols = null;
  64960. this.currencySymbols = null;
  64961. this.datePatterns = null;
  64962. this.dateTimeSymbols = null;
  64963. this.numberPatterns = null;
  64964. this.numberSymbols = null;
  64965. this.timePatterns = null;
  64966. this.typeFaces = null;
  64967. }
  64968. }
  64969. class LocaleSet extends _xfa_object.XFAObject {
  64970. constructor(attributes) {
  64971. super(LOCALE_SET_NS_ID, "localeSet", true);
  64972. this.locale = new _xfa_object.XFAObjectArray();
  64973. }
  64974. }
  64975. class Meridiem extends _xfa_object.StringObject {
  64976. constructor(attributes) {
  64977. super(LOCALE_SET_NS_ID, "meridiem");
  64978. }
  64979. }
  64980. class MeridiemNames extends _xfa_object.XFAObject {
  64981. constructor(attributes) {
  64982. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  64983. this.meridiem = new _xfa_object.XFAObjectArray(2);
  64984. }
  64985. }
  64986. class Month extends _xfa_object.StringObject {
  64987. constructor(attributes) {
  64988. super(LOCALE_SET_NS_ID, "month");
  64989. }
  64990. }
  64991. class MonthNames extends _xfa_object.XFAObject {
  64992. constructor(attributes) {
  64993. super(LOCALE_SET_NS_ID, "monthNames", true);
  64994. this.abbr = (0, _utils.getInteger)({
  64995. data: attributes.abbr,
  64996. defaultValue: 0,
  64997. validate: x => x === 1
  64998. });
  64999. this.month = new _xfa_object.XFAObjectArray(12);
  65000. }
  65001. }
  65002. class NumberPattern extends _xfa_object.StringObject {
  65003. constructor(attributes) {
  65004. super(LOCALE_SET_NS_ID, "numberPattern");
  65005. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65006. }
  65007. }
  65008. class NumberPatterns extends _xfa_object.XFAObject {
  65009. constructor(attributes) {
  65010. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  65011. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  65012. }
  65013. }
  65014. class NumberSymbol extends _xfa_object.StringObject {
  65015. constructor(attributes) {
  65016. super(LOCALE_SET_NS_ID, "numberSymbol");
  65017. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  65018. }
  65019. }
  65020. class NumberSymbols extends _xfa_object.XFAObject {
  65021. constructor(attributes) {
  65022. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  65023. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  65024. }
  65025. }
  65026. class TimePattern extends _xfa_object.StringObject {
  65027. constructor(attributes) {
  65028. super(LOCALE_SET_NS_ID, "timePattern");
  65029. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  65030. }
  65031. }
  65032. class TimePatterns extends _xfa_object.XFAObject {
  65033. constructor(attributes) {
  65034. super(LOCALE_SET_NS_ID, "timePatterns", true);
  65035. this.timePattern = new _xfa_object.XFAObjectArray(4);
  65036. }
  65037. }
  65038. class TypeFace extends _xfa_object.XFAObject {
  65039. constructor(attributes) {
  65040. super(LOCALE_SET_NS_ID, "typeFace", true);
  65041. this.name = attributes.name | "";
  65042. }
  65043. }
  65044. class TypeFaces extends _xfa_object.XFAObject {
  65045. constructor(attributes) {
  65046. super(LOCALE_SET_NS_ID, "typeFaces", true);
  65047. this.typeFace = new _xfa_object.XFAObjectArray();
  65048. }
  65049. }
  65050. class LocaleSetNamespace {
  65051. static [_namespaces.$buildXFAObject](name, attributes) {
  65052. if (LocaleSetNamespace.hasOwnProperty(name)) {
  65053. return LocaleSetNamespace[name](attributes);
  65054. }
  65055. return undefined;
  65056. }
  65057. static calendarSymbols(attrs) {
  65058. return new CalendarSymbols(attrs);
  65059. }
  65060. static currencySymbol(attrs) {
  65061. return new CurrencySymbol(attrs);
  65062. }
  65063. static currencySymbols(attrs) {
  65064. return new CurrencySymbols(attrs);
  65065. }
  65066. static datePattern(attrs) {
  65067. return new DatePattern(attrs);
  65068. }
  65069. static datePatterns(attrs) {
  65070. return new DatePatterns(attrs);
  65071. }
  65072. static dateTimeSymbols(attrs) {
  65073. return new DateTimeSymbols(attrs);
  65074. }
  65075. static day(attrs) {
  65076. return new Day(attrs);
  65077. }
  65078. static dayNames(attrs) {
  65079. return new DayNames(attrs);
  65080. }
  65081. static era(attrs) {
  65082. return new Era(attrs);
  65083. }
  65084. static eraNames(attrs) {
  65085. return new EraNames(attrs);
  65086. }
  65087. static locale(attrs) {
  65088. return new Locale(attrs);
  65089. }
  65090. static localeSet(attrs) {
  65091. return new LocaleSet(attrs);
  65092. }
  65093. static meridiem(attrs) {
  65094. return new Meridiem(attrs);
  65095. }
  65096. static meridiemNames(attrs) {
  65097. return new MeridiemNames(attrs);
  65098. }
  65099. static month(attrs) {
  65100. return new Month(attrs);
  65101. }
  65102. static monthNames(attrs) {
  65103. return new MonthNames(attrs);
  65104. }
  65105. static numberPattern(attrs) {
  65106. return new NumberPattern(attrs);
  65107. }
  65108. static numberPatterns(attrs) {
  65109. return new NumberPatterns(attrs);
  65110. }
  65111. static numberSymbol(attrs) {
  65112. return new NumberSymbol(attrs);
  65113. }
  65114. static numberSymbols(attrs) {
  65115. return new NumberSymbols(attrs);
  65116. }
  65117. static timePattern(attrs) {
  65118. return new TimePattern(attrs);
  65119. }
  65120. static timePatterns(attrs) {
  65121. return new TimePatterns(attrs);
  65122. }
  65123. static typeFace(attrs) {
  65124. return new TypeFace(attrs);
  65125. }
  65126. static typeFaces(attrs) {
  65127. return new TypeFaces(attrs);
  65128. }
  65129. }
  65130. exports.LocaleSetNamespace = LocaleSetNamespace;
  65131. /***/ }),
  65132. /* 224 */
  65133. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65134. "use strict";
  65135. Object.defineProperty(exports, "__esModule", ({
  65136. value: true
  65137. }));
  65138. exports.SignatureNamespace = void 0;
  65139. var _namespaces = __w_pdfjs_require__(208);
  65140. var _xfa_object = __w_pdfjs_require__(206);
  65141. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  65142. class Signature extends _xfa_object.XFAObject {
  65143. constructor(attributes) {
  65144. super(SIGNATURE_NS_ID, "signature", true);
  65145. }
  65146. }
  65147. class SignatureNamespace {
  65148. static [_namespaces.$buildXFAObject](name, attributes) {
  65149. if (SignatureNamespace.hasOwnProperty(name)) {
  65150. return SignatureNamespace[name](attributes);
  65151. }
  65152. return undefined;
  65153. }
  65154. static signature(attributes) {
  65155. return new Signature(attributes);
  65156. }
  65157. }
  65158. exports.SignatureNamespace = SignatureNamespace;
  65159. /***/ }),
  65160. /* 225 */
  65161. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65162. "use strict";
  65163. Object.defineProperty(exports, "__esModule", ({
  65164. value: true
  65165. }));
  65166. exports.StylesheetNamespace = void 0;
  65167. var _namespaces = __w_pdfjs_require__(208);
  65168. var _xfa_object = __w_pdfjs_require__(206);
  65169. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  65170. class Stylesheet extends _xfa_object.XFAObject {
  65171. constructor(attributes) {
  65172. super(STYLESHEET_NS_ID, "stylesheet", true);
  65173. }
  65174. }
  65175. class StylesheetNamespace {
  65176. static [_namespaces.$buildXFAObject](name, attributes) {
  65177. if (StylesheetNamespace.hasOwnProperty(name)) {
  65178. return StylesheetNamespace[name](attributes);
  65179. }
  65180. return undefined;
  65181. }
  65182. static stylesheet(attributes) {
  65183. return new Stylesheet(attributes);
  65184. }
  65185. }
  65186. exports.StylesheetNamespace = StylesheetNamespace;
  65187. /***/ }),
  65188. /* 226 */
  65189. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65190. "use strict";
  65191. Object.defineProperty(exports, "__esModule", ({
  65192. value: true
  65193. }));
  65194. exports.XdpNamespace = void 0;
  65195. var _namespaces = __w_pdfjs_require__(208);
  65196. var _xfa_object = __w_pdfjs_require__(206);
  65197. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  65198. class Xdp extends _xfa_object.XFAObject {
  65199. constructor(attributes) {
  65200. super(XDP_NS_ID, "xdp", true);
  65201. this.uuid = attributes.uuid || "";
  65202. this.timeStamp = attributes.timeStamp || "";
  65203. this.config = null;
  65204. this.connectionSet = null;
  65205. this.datasets = null;
  65206. this.localeSet = null;
  65207. this.stylesheet = new _xfa_object.XFAObjectArray();
  65208. this.template = null;
  65209. }
  65210. [_xfa_object.$onChildCheck](child) {
  65211. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  65212. return ns && child[_xfa_object.$namespaceId] === ns.id;
  65213. }
  65214. }
  65215. class XdpNamespace {
  65216. static [_namespaces.$buildXFAObject](name, attributes) {
  65217. if (XdpNamespace.hasOwnProperty(name)) {
  65218. return XdpNamespace[name](attributes);
  65219. }
  65220. return undefined;
  65221. }
  65222. static xdp(attributes) {
  65223. return new Xdp(attributes);
  65224. }
  65225. }
  65226. exports.XdpNamespace = XdpNamespace;
  65227. /***/ }),
  65228. /* 227 */
  65229. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65230. "use strict";
  65231. Object.defineProperty(exports, "__esModule", ({
  65232. value: true
  65233. }));
  65234. exports.XhtmlNamespace = void 0;
  65235. var _xfa_object = __w_pdfjs_require__(206);
  65236. var _namespaces = __w_pdfjs_require__(208);
  65237. var _html_utils = __w_pdfjs_require__(213);
  65238. var _utils = __w_pdfjs_require__(207);
  65239. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  65240. const $richText = Symbol();
  65241. 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"]);
  65242. 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) => {
  65243. value = original.fontSize = (0, _utils.getMeasurement)(value);
  65244. return (0, _html_utils.measureToString)(0.99 * value);
  65245. }], ["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))]]);
  65246. const spacesRegExp = /\s+/g;
  65247. const crlfRegExp = /[\r\n]+/g;
  65248. const crlfForRichTextRegExp = /\r\n?/g;
  65249. function mapStyle(styleStr, node, richText) {
  65250. const style = Object.create(null);
  65251. if (!styleStr) {
  65252. return style;
  65253. }
  65254. const original = Object.create(null);
  65255. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  65256. const mapping = StyleMapping.get(key);
  65257. if (mapping === "") {
  65258. continue;
  65259. }
  65260. let newValue = value;
  65261. if (mapping) {
  65262. if (typeof mapping === "string") {
  65263. newValue = mapping;
  65264. } else {
  65265. newValue = mapping(value, original);
  65266. }
  65267. }
  65268. if (key.endsWith("scale")) {
  65269. if (style.transform) {
  65270. style.transform = `${style[key]} ${newValue}`;
  65271. } else {
  65272. style.transform = newValue;
  65273. }
  65274. } else {
  65275. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  65276. }
  65277. }
  65278. if (style.fontFamily) {
  65279. (0, _html_utils.setFontFamily)({
  65280. typeface: style.fontFamily,
  65281. weight: style.fontWeight || "normal",
  65282. posture: style.fontStyle || "normal",
  65283. size: original.fontSize || 0
  65284. }, node, node[_xfa_object.$globalData].fontFinder, style);
  65285. }
  65286. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  65287. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  65288. const VERTICAL_FACTOR = 0.333;
  65289. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  65290. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  65291. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  65292. }
  65293. if (richText && style.fontSize) {
  65294. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  65295. }
  65296. (0, _html_utils.fixTextIndent)(style);
  65297. return style;
  65298. }
  65299. function checkStyle(node) {
  65300. if (!node.style) {
  65301. return "";
  65302. }
  65303. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(_ref => {
  65304. let [key, value] = _ref;
  65305. if (key === "font-family") {
  65306. node[_xfa_object.$globalData].usedTypefaces.add(value);
  65307. }
  65308. return VALID_STYLES.has(key);
  65309. }).map(kv => kv.join(":")).join(";");
  65310. }
  65311. const NoWhites = new Set(["body", "html"]);
  65312. class XhtmlObject extends _xfa_object.XmlObject {
  65313. constructor(attributes, name) {
  65314. super(XHTML_NS_ID, name);
  65315. this[$richText] = false;
  65316. this.style = attributes.style || "";
  65317. }
  65318. [_xfa_object.$clean](builder) {
  65319. super[_xfa_object.$clean](builder);
  65320. this.style = checkStyle(this);
  65321. }
  65322. [_xfa_object.$acceptWhitespace]() {
  65323. return !NoWhites.has(this[_xfa_object.$nodeName]);
  65324. }
  65325. [_xfa_object.$onText](str) {
  65326. let richText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  65327. if (!richText) {
  65328. str = str.replace(crlfRegExp, "");
  65329. if (!this.style.includes("xfa-spacerun:yes")) {
  65330. str = str.replace(spacesRegExp, " ");
  65331. }
  65332. } else {
  65333. this[$richText] = true;
  65334. }
  65335. if (str) {
  65336. this[_xfa_object.$content] += str;
  65337. }
  65338. }
  65339. [_xfa_object.$pushGlyphs](measure) {
  65340. let mustPop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  65341. const xfaFont = Object.create(null);
  65342. const margin = {
  65343. top: NaN,
  65344. bottom: NaN,
  65345. left: NaN,
  65346. right: NaN
  65347. };
  65348. let lineHeight = null;
  65349. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  65350. switch (key) {
  65351. case "font-family":
  65352. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  65353. break;
  65354. case "font-size":
  65355. xfaFont.size = (0, _utils.getMeasurement)(value);
  65356. break;
  65357. case "font-weight":
  65358. xfaFont.weight = value;
  65359. break;
  65360. case "font-style":
  65361. xfaFont.posture = value;
  65362. break;
  65363. case "letter-spacing":
  65364. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  65365. break;
  65366. case "margin":
  65367. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  65368. switch (values.length) {
  65369. case 1:
  65370. margin.top = margin.bottom = margin.left = margin.right = values[0];
  65371. break;
  65372. case 2:
  65373. margin.top = margin.bottom = values[0];
  65374. margin.left = margin.right = values[1];
  65375. break;
  65376. case 3:
  65377. margin.top = values[0];
  65378. margin.bottom = values[2];
  65379. margin.left = margin.right = values[1];
  65380. break;
  65381. case 4:
  65382. margin.top = values[0];
  65383. margin.left = values[1];
  65384. margin.bottom = values[2];
  65385. margin.right = values[3];
  65386. break;
  65387. }
  65388. break;
  65389. case "margin-top":
  65390. margin.top = (0, _utils.getMeasurement)(value);
  65391. break;
  65392. case "margin-bottom":
  65393. margin.bottom = (0, _utils.getMeasurement)(value);
  65394. break;
  65395. case "margin-left":
  65396. margin.left = (0, _utils.getMeasurement)(value);
  65397. break;
  65398. case "margin-right":
  65399. margin.right = (0, _utils.getMeasurement)(value);
  65400. break;
  65401. case "line-height":
  65402. lineHeight = (0, _utils.getMeasurement)(value);
  65403. break;
  65404. }
  65405. }
  65406. measure.pushData(xfaFont, margin, lineHeight);
  65407. if (this[_xfa_object.$content]) {
  65408. measure.addString(this[_xfa_object.$content]);
  65409. } else {
  65410. for (const child of this[_xfa_object.$getChildren]()) {
  65411. if (child[_xfa_object.$nodeName] === "#text") {
  65412. measure.addString(child[_xfa_object.$content]);
  65413. continue;
  65414. }
  65415. child[_xfa_object.$pushGlyphs](measure);
  65416. }
  65417. }
  65418. if (mustPop) {
  65419. measure.popFont();
  65420. }
  65421. }
  65422. [_xfa_object.$toHTML](availableSpace) {
  65423. const children = [];
  65424. this[_xfa_object.$extra] = {
  65425. children
  65426. };
  65427. this[_xfa_object.$childrenToHTML]({});
  65428. if (children.length === 0 && !this[_xfa_object.$content]) {
  65429. return _utils.HTMLResult.EMPTY;
  65430. }
  65431. let value;
  65432. if (this[$richText]) {
  65433. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  65434. } else {
  65435. value = this[_xfa_object.$content] || undefined;
  65436. }
  65437. return _utils.HTMLResult.success({
  65438. name: this[_xfa_object.$nodeName],
  65439. attributes: {
  65440. href: this.href,
  65441. style: mapStyle(this.style, this, this[$richText])
  65442. },
  65443. children,
  65444. value
  65445. });
  65446. }
  65447. }
  65448. class A extends XhtmlObject {
  65449. constructor(attributes) {
  65450. super(attributes, "a");
  65451. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  65452. }
  65453. }
  65454. class B extends XhtmlObject {
  65455. constructor(attributes) {
  65456. super(attributes, "b");
  65457. }
  65458. [_xfa_object.$pushGlyphs](measure) {
  65459. measure.pushFont({
  65460. weight: "bold"
  65461. });
  65462. super[_xfa_object.$pushGlyphs](measure);
  65463. measure.popFont();
  65464. }
  65465. }
  65466. class Body extends XhtmlObject {
  65467. constructor(attributes) {
  65468. super(attributes, "body");
  65469. }
  65470. [_xfa_object.$toHTML](availableSpace) {
  65471. const res = super[_xfa_object.$toHTML](availableSpace);
  65472. const {
  65473. html
  65474. } = res;
  65475. if (!html) {
  65476. return _utils.HTMLResult.EMPTY;
  65477. }
  65478. html.name = "div";
  65479. html.attributes.class = ["xfaRich"];
  65480. return res;
  65481. }
  65482. }
  65483. class Br extends XhtmlObject {
  65484. constructor(attributes) {
  65485. super(attributes, "br");
  65486. }
  65487. [_xfa_object.$text]() {
  65488. return "\n";
  65489. }
  65490. [_xfa_object.$pushGlyphs](measure) {
  65491. measure.addString("\n");
  65492. }
  65493. [_xfa_object.$toHTML](availableSpace) {
  65494. return _utils.HTMLResult.success({
  65495. name: "br"
  65496. });
  65497. }
  65498. }
  65499. class Html extends XhtmlObject {
  65500. constructor(attributes) {
  65501. super(attributes, "html");
  65502. }
  65503. [_xfa_object.$toHTML](availableSpace) {
  65504. const children = [];
  65505. this[_xfa_object.$extra] = {
  65506. children
  65507. };
  65508. this[_xfa_object.$childrenToHTML]({});
  65509. if (children.length === 0) {
  65510. return _utils.HTMLResult.success({
  65511. name: "div",
  65512. attributes: {
  65513. class: ["xfaRich"],
  65514. style: {}
  65515. },
  65516. value: this[_xfa_object.$content] || ""
  65517. });
  65518. }
  65519. if (children.length === 1) {
  65520. const child = children[0];
  65521. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  65522. return _utils.HTMLResult.success(child);
  65523. }
  65524. }
  65525. return _utils.HTMLResult.success({
  65526. name: "div",
  65527. attributes: {
  65528. class: ["xfaRich"],
  65529. style: {}
  65530. },
  65531. children
  65532. });
  65533. }
  65534. }
  65535. class I extends XhtmlObject {
  65536. constructor(attributes) {
  65537. super(attributes, "i");
  65538. }
  65539. [_xfa_object.$pushGlyphs](measure) {
  65540. measure.pushFont({
  65541. posture: "italic"
  65542. });
  65543. super[_xfa_object.$pushGlyphs](measure);
  65544. measure.popFont();
  65545. }
  65546. }
  65547. class Li extends XhtmlObject {
  65548. constructor(attributes) {
  65549. super(attributes, "li");
  65550. }
  65551. }
  65552. class Ol extends XhtmlObject {
  65553. constructor(attributes) {
  65554. super(attributes, "ol");
  65555. }
  65556. }
  65557. class P extends XhtmlObject {
  65558. constructor(attributes) {
  65559. super(attributes, "p");
  65560. }
  65561. [_xfa_object.$pushGlyphs](measure) {
  65562. super[_xfa_object.$pushGlyphs](measure, false);
  65563. measure.addString("\n");
  65564. measure.addPara();
  65565. measure.popFont();
  65566. }
  65567. [_xfa_object.$text]() {
  65568. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  65569. if (siblings.at(-1) === this) {
  65570. return super[_xfa_object.$text]();
  65571. }
  65572. return super[_xfa_object.$text]() + "\n";
  65573. }
  65574. }
  65575. class Span extends XhtmlObject {
  65576. constructor(attributes) {
  65577. super(attributes, "span");
  65578. }
  65579. }
  65580. class Sub extends XhtmlObject {
  65581. constructor(attributes) {
  65582. super(attributes, "sub");
  65583. }
  65584. }
  65585. class Sup extends XhtmlObject {
  65586. constructor(attributes) {
  65587. super(attributes, "sup");
  65588. }
  65589. }
  65590. class Ul extends XhtmlObject {
  65591. constructor(attributes) {
  65592. super(attributes, "ul");
  65593. }
  65594. }
  65595. class XhtmlNamespace {
  65596. static [_namespaces.$buildXFAObject](name, attributes) {
  65597. if (XhtmlNamespace.hasOwnProperty(name)) {
  65598. return XhtmlNamespace[name](attributes);
  65599. }
  65600. return undefined;
  65601. }
  65602. static a(attributes) {
  65603. return new A(attributes);
  65604. }
  65605. static b(attributes) {
  65606. return new B(attributes);
  65607. }
  65608. static body(attributes) {
  65609. return new Body(attributes);
  65610. }
  65611. static br(attributes) {
  65612. return new Br(attributes);
  65613. }
  65614. static html(attributes) {
  65615. return new Html(attributes);
  65616. }
  65617. static i(attributes) {
  65618. return new I(attributes);
  65619. }
  65620. static li(attributes) {
  65621. return new Li(attributes);
  65622. }
  65623. static ol(attributes) {
  65624. return new Ol(attributes);
  65625. }
  65626. static p(attributes) {
  65627. return new P(attributes);
  65628. }
  65629. static span(attributes) {
  65630. return new Span(attributes);
  65631. }
  65632. static sub(attributes) {
  65633. return new Sub(attributes);
  65634. }
  65635. static sup(attributes) {
  65636. return new Sup(attributes);
  65637. }
  65638. static ul(attributes) {
  65639. return new Ul(attributes);
  65640. }
  65641. }
  65642. exports.XhtmlNamespace = XhtmlNamespace;
  65643. /***/ }),
  65644. /* 228 */
  65645. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65646. "use strict";
  65647. Object.defineProperty(exports, "__esModule", ({
  65648. value: true
  65649. }));
  65650. exports.UnknownNamespace = void 0;
  65651. var _namespaces = __w_pdfjs_require__(208);
  65652. var _xfa_object = __w_pdfjs_require__(206);
  65653. class UnknownNamespace {
  65654. constructor(nsId) {
  65655. this.namespaceId = nsId;
  65656. }
  65657. [_namespaces.$buildXFAObject](name, attributes) {
  65658. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  65659. }
  65660. }
  65661. exports.UnknownNamespace = UnknownNamespace;
  65662. /***/ }),
  65663. /* 229 */
  65664. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65665. "use strict";
  65666. Object.defineProperty(exports, "__esModule", ({
  65667. value: true
  65668. }));
  65669. exports.DatasetReader = void 0;
  65670. var _util = __w_pdfjs_require__(2);
  65671. var _core_utils = __w_pdfjs_require__(135);
  65672. var _xml_parser = __w_pdfjs_require__(195);
  65673. function decodeString(str) {
  65674. try {
  65675. return (0, _util.stringToUTF8String)(str);
  65676. } catch (ex) {
  65677. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  65678. return str;
  65679. }
  65680. }
  65681. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  65682. constructor(options) {
  65683. super(options);
  65684. this.node = null;
  65685. }
  65686. onEndElement(name) {
  65687. const node = super.onEndElement(name);
  65688. if (node && name === "xfa:datasets") {
  65689. this.node = node;
  65690. throw new Error("Aborting DatasetXMLParser.");
  65691. }
  65692. }
  65693. }
  65694. class DatasetReader {
  65695. constructor(data) {
  65696. if (data.datasets) {
  65697. this.node = new _xml_parser.SimpleXMLParser({
  65698. hasAttributes: true
  65699. }).parseFromString(data.datasets).documentElement;
  65700. } else {
  65701. const parser = new DatasetXMLParser({
  65702. hasAttributes: true
  65703. });
  65704. try {
  65705. parser.parseFromString(data["xdp:xdp"]);
  65706. } catch (_) {}
  65707. this.node = parser.node;
  65708. }
  65709. }
  65710. getValue(path) {
  65711. if (!this.node || !path) {
  65712. return "";
  65713. }
  65714. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  65715. if (!node) {
  65716. return "";
  65717. }
  65718. const first = node.firstChild;
  65719. if (first && first.nodeName === "value") {
  65720. return node.children.map(child => decodeString(child.textContent));
  65721. }
  65722. return decodeString(node.textContent);
  65723. }
  65724. }
  65725. exports.DatasetReader = DatasetReader;
  65726. /***/ }),
  65727. /* 230 */
  65728. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  65729. "use strict";
  65730. Object.defineProperty(exports, "__esModule", ({
  65731. value: true
  65732. }));
  65733. exports.XRef = void 0;
  65734. var _util = __w_pdfjs_require__(2);
  65735. var _primitives = __w_pdfjs_require__(134);
  65736. var _core_utils = __w_pdfjs_require__(135);
  65737. var _parser = __w_pdfjs_require__(146);
  65738. var _base_stream = __w_pdfjs_require__(136);
  65739. var _crypto = __w_pdfjs_require__(196);
  65740. class XRef {
  65741. constructor(stream, pdfManager) {
  65742. this.stream = stream;
  65743. this.pdfManager = pdfManager;
  65744. this.entries = [];
  65745. this.xrefstms = Object.create(null);
  65746. this._cacheMap = new Map();
  65747. this._pendingRefs = new _primitives.RefSet();
  65748. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  65749. this._newRefNum = null;
  65750. }
  65751. getNewRef() {
  65752. if (this._newRefNum === null) {
  65753. this._newRefNum = this.entries.length || 1;
  65754. }
  65755. return _primitives.Ref.get(this._newRefNum++, 0);
  65756. }
  65757. resetNewRef() {
  65758. this._newRefNum = null;
  65759. }
  65760. setStartXRef(startXRef) {
  65761. this.startXRefQueue = [startXRef];
  65762. }
  65763. parse() {
  65764. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  65765. let trailerDict;
  65766. if (!recoveryMode) {
  65767. trailerDict = this.readXRef();
  65768. } else {
  65769. (0, _util.warn)("Indexing all PDF objects");
  65770. trailerDict = this.indexObjects();
  65771. }
  65772. trailerDict.assignXref(this);
  65773. this.trailer = trailerDict;
  65774. let encrypt;
  65775. try {
  65776. encrypt = trailerDict.get("Encrypt");
  65777. } catch (ex) {
  65778. if (ex instanceof _core_utils.MissingDataException) {
  65779. throw ex;
  65780. }
  65781. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  65782. }
  65783. if (encrypt instanceof _primitives.Dict) {
  65784. const ids = trailerDict.get("ID");
  65785. const fileId = ids && ids.length ? ids[0] : "";
  65786. encrypt.suppressEncryption = true;
  65787. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  65788. }
  65789. let root;
  65790. try {
  65791. root = trailerDict.get("Root");
  65792. } catch (ex) {
  65793. if (ex instanceof _core_utils.MissingDataException) {
  65794. throw ex;
  65795. }
  65796. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  65797. }
  65798. if (root instanceof _primitives.Dict) {
  65799. try {
  65800. const pages = root.get("Pages");
  65801. if (pages instanceof _primitives.Dict) {
  65802. this.root = root;
  65803. return;
  65804. }
  65805. } catch (ex) {
  65806. if (ex instanceof _core_utils.MissingDataException) {
  65807. throw ex;
  65808. }
  65809. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  65810. }
  65811. }
  65812. if (!recoveryMode) {
  65813. throw new _core_utils.XRefParseException();
  65814. }
  65815. throw new _util.InvalidPDFException("Invalid Root reference.");
  65816. }
  65817. processXRefTable(parser) {
  65818. if (!("tableState" in this)) {
  65819. this.tableState = {
  65820. entryNum: 0,
  65821. streamPos: parser.lexer.stream.pos,
  65822. parserBuf1: parser.buf1,
  65823. parserBuf2: parser.buf2
  65824. };
  65825. }
  65826. const obj = this.readXRefTable(parser);
  65827. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  65828. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  65829. }
  65830. let dict = parser.getObj();
  65831. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  65832. dict = dict.dict;
  65833. }
  65834. if (!(dict instanceof _primitives.Dict)) {
  65835. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  65836. }
  65837. delete this.tableState;
  65838. return dict;
  65839. }
  65840. readXRefTable(parser) {
  65841. const stream = parser.lexer.stream;
  65842. const tableState = this.tableState;
  65843. stream.pos = tableState.streamPos;
  65844. parser.buf1 = tableState.parserBuf1;
  65845. parser.buf2 = tableState.parserBuf2;
  65846. let obj;
  65847. while (true) {
  65848. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  65849. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  65850. break;
  65851. }
  65852. tableState.firstEntryNum = obj;
  65853. tableState.entryCount = parser.getObj();
  65854. }
  65855. let first = tableState.firstEntryNum;
  65856. const count = tableState.entryCount;
  65857. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  65858. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  65859. }
  65860. for (let i = tableState.entryNum; i < count; i++) {
  65861. tableState.streamPos = stream.pos;
  65862. tableState.entryNum = i;
  65863. tableState.parserBuf1 = parser.buf1;
  65864. tableState.parserBuf2 = parser.buf2;
  65865. const entry = {};
  65866. entry.offset = parser.getObj();
  65867. entry.gen = parser.getObj();
  65868. const type = parser.getObj();
  65869. if (type instanceof _primitives.Cmd) {
  65870. switch (type.cmd) {
  65871. case "f":
  65872. entry.free = true;
  65873. break;
  65874. case "n":
  65875. entry.uncompressed = true;
  65876. break;
  65877. }
  65878. }
  65879. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  65880. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  65881. }
  65882. if (i === 0 && entry.free && first === 1) {
  65883. first = 0;
  65884. }
  65885. if (!this.entries[i + first]) {
  65886. this.entries[i + first] = entry;
  65887. }
  65888. }
  65889. tableState.entryNum = 0;
  65890. tableState.streamPos = stream.pos;
  65891. tableState.parserBuf1 = parser.buf1;
  65892. tableState.parserBuf2 = parser.buf2;
  65893. delete tableState.firstEntryNum;
  65894. delete tableState.entryCount;
  65895. }
  65896. if (this.entries[0] && !this.entries[0].free) {
  65897. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  65898. }
  65899. return obj;
  65900. }
  65901. processXRefStream(stream) {
  65902. if (!("streamState" in this)) {
  65903. const streamParameters = stream.dict;
  65904. const byteWidths = streamParameters.get("W");
  65905. let range = streamParameters.get("Index");
  65906. if (!range) {
  65907. range = [0, streamParameters.get("Size")];
  65908. }
  65909. this.streamState = {
  65910. entryRanges: range,
  65911. byteWidths,
  65912. entryNum: 0,
  65913. streamPos: stream.pos
  65914. };
  65915. }
  65916. this.readXRefStream(stream);
  65917. delete this.streamState;
  65918. return stream.dict;
  65919. }
  65920. readXRefStream(stream) {
  65921. const streamState = this.streamState;
  65922. stream.pos = streamState.streamPos;
  65923. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  65924. const entryRanges = streamState.entryRanges;
  65925. while (entryRanges.length > 0) {
  65926. const [first, n] = entryRanges;
  65927. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  65928. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  65929. }
  65930. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  65931. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  65932. }
  65933. for (let i = streamState.entryNum; i < n; ++i) {
  65934. streamState.entryNum = i;
  65935. streamState.streamPos = stream.pos;
  65936. let type = 0,
  65937. offset = 0,
  65938. generation = 0;
  65939. for (let j = 0; j < typeFieldWidth; ++j) {
  65940. const typeByte = stream.getByte();
  65941. if (typeByte === -1) {
  65942. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  65943. }
  65944. type = type << 8 | typeByte;
  65945. }
  65946. if (typeFieldWidth === 0) {
  65947. type = 1;
  65948. }
  65949. for (let j = 0; j < offsetFieldWidth; ++j) {
  65950. const offsetByte = stream.getByte();
  65951. if (offsetByte === -1) {
  65952. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  65953. }
  65954. offset = offset << 8 | offsetByte;
  65955. }
  65956. for (let j = 0; j < generationFieldWidth; ++j) {
  65957. const generationByte = stream.getByte();
  65958. if (generationByte === -1) {
  65959. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  65960. }
  65961. generation = generation << 8 | generationByte;
  65962. }
  65963. const entry = {};
  65964. entry.offset = offset;
  65965. entry.gen = generation;
  65966. switch (type) {
  65967. case 0:
  65968. entry.free = true;
  65969. break;
  65970. case 1:
  65971. entry.uncompressed = true;
  65972. break;
  65973. case 2:
  65974. break;
  65975. default:
  65976. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  65977. }
  65978. if (!this.entries[first + i]) {
  65979. this.entries[first + i] = entry;
  65980. }
  65981. }
  65982. streamState.entryNum = 0;
  65983. streamState.streamPos = stream.pos;
  65984. entryRanges.splice(0, 2);
  65985. }
  65986. }
  65987. indexObjects() {
  65988. const TAB = 0x9,
  65989. LF = 0xa,
  65990. CR = 0xd,
  65991. SPACE = 0x20;
  65992. const PERCENT = 0x25,
  65993. LT = 0x3c;
  65994. function readToken(data, offset) {
  65995. let token = "",
  65996. ch = data[offset];
  65997. while (ch !== LF && ch !== CR && ch !== LT) {
  65998. if (++offset >= data.length) {
  65999. break;
  66000. }
  66001. token += String.fromCharCode(ch);
  66002. ch = data[offset];
  66003. }
  66004. return token;
  66005. }
  66006. function skipUntil(data, offset, what) {
  66007. const length = what.length,
  66008. dataLength = data.length;
  66009. let skipped = 0;
  66010. while (offset < dataLength) {
  66011. let i = 0;
  66012. while (i < length && data[offset + i] === what[i]) {
  66013. ++i;
  66014. }
  66015. if (i >= length) {
  66016. break;
  66017. }
  66018. offset++;
  66019. skipped++;
  66020. }
  66021. return skipped;
  66022. }
  66023. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  66024. const endobjRegExp = /\bendobj[\b\s]$/;
  66025. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  66026. const CHECK_CONTENT_LENGTH = 25;
  66027. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  66028. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  66029. const objBytes = new Uint8Array([111, 98, 106]);
  66030. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  66031. this.entries.length = 0;
  66032. this._cacheMap.clear();
  66033. const stream = this.stream;
  66034. stream.pos = 0;
  66035. const buffer = stream.getBytes(),
  66036. length = buffer.length;
  66037. let position = stream.start;
  66038. const trailers = [],
  66039. xrefStms = [];
  66040. while (position < length) {
  66041. let ch = buffer[position];
  66042. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  66043. ++position;
  66044. continue;
  66045. }
  66046. if (ch === PERCENT) {
  66047. do {
  66048. ++position;
  66049. if (position >= length) {
  66050. break;
  66051. }
  66052. ch = buffer[position];
  66053. } while (ch !== LF && ch !== CR);
  66054. continue;
  66055. }
  66056. const token = readToken(buffer, position);
  66057. let m;
  66058. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  66059. position += skipUntil(buffer, position, trailerBytes);
  66060. trailers.push(position);
  66061. position += skipUntil(buffer, position, startxrefBytes);
  66062. } else if (m = objRegExp.exec(token)) {
  66063. const num = m[1] | 0,
  66064. gen = m[2] | 0;
  66065. let contentLength,
  66066. startPos = position + token.length,
  66067. updateEntries = false;
  66068. if (!this.entries[num]) {
  66069. updateEntries = true;
  66070. } else if (this.entries[num].gen === gen) {
  66071. try {
  66072. const parser = new _parser.Parser({
  66073. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  66074. });
  66075. parser.getObj();
  66076. updateEntries = true;
  66077. } catch (ex) {
  66078. if (ex instanceof _core_utils.ParserEOFException) {
  66079. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  66080. } else {
  66081. updateEntries = true;
  66082. }
  66083. }
  66084. }
  66085. if (updateEntries) {
  66086. this.entries[num] = {
  66087. offset: position - stream.start,
  66088. gen,
  66089. uncompressed: true
  66090. };
  66091. }
  66092. while (startPos < buffer.length) {
  66093. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  66094. contentLength = endPos - position;
  66095. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  66096. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  66097. if (endobjRegExp.test(tokenStr)) {
  66098. break;
  66099. } else {
  66100. const objToken = nestedObjRegExp.exec(tokenStr);
  66101. if (objToken && objToken[1]) {
  66102. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  66103. contentLength -= objToken[1].length;
  66104. break;
  66105. }
  66106. }
  66107. startPos = endPos;
  66108. }
  66109. const content = buffer.subarray(position, position + contentLength);
  66110. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  66111. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  66112. xrefStms.push(position - stream.start);
  66113. this.xrefstms[position - stream.start] = 1;
  66114. }
  66115. position += contentLength;
  66116. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  66117. trailers.push(position);
  66118. position += skipUntil(buffer, position, startxrefBytes);
  66119. } else {
  66120. position += token.length + 1;
  66121. }
  66122. }
  66123. for (const xrefStm of xrefStms) {
  66124. this.startXRefQueue.push(xrefStm);
  66125. this.readXRef(true);
  66126. }
  66127. let trailerDict, trailerError;
  66128. for (const trailer of [...trailers, "generationFallback", ...trailers]) {
  66129. if (trailer === "generationFallback") {
  66130. if (!trailerError) {
  66131. break;
  66132. }
  66133. this._generationFallback = true;
  66134. continue;
  66135. }
  66136. stream.pos = trailer;
  66137. const parser = new _parser.Parser({
  66138. lexer: new _parser.Lexer(stream),
  66139. xref: this,
  66140. allowStreams: true,
  66141. recoveryMode: true
  66142. });
  66143. const obj = parser.getObj();
  66144. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  66145. continue;
  66146. }
  66147. const dict = parser.getObj();
  66148. if (!(dict instanceof _primitives.Dict)) {
  66149. continue;
  66150. }
  66151. let validPagesDict = false;
  66152. try {
  66153. const rootDict = dict.get("Root");
  66154. if (!(rootDict instanceof _primitives.Dict)) {
  66155. continue;
  66156. }
  66157. const pagesDict = rootDict.get("Pages");
  66158. if (!(pagesDict instanceof _primitives.Dict)) {
  66159. continue;
  66160. }
  66161. const pagesCount = pagesDict.get("Count");
  66162. if (Number.isInteger(pagesCount)) {
  66163. validPagesDict = true;
  66164. }
  66165. } catch (ex) {
  66166. trailerError = ex;
  66167. continue;
  66168. }
  66169. if (validPagesDict && dict.has("ID")) {
  66170. return dict;
  66171. }
  66172. trailerDict = dict;
  66173. }
  66174. if (trailerDict) {
  66175. return trailerDict;
  66176. }
  66177. if (this.topDict) {
  66178. return this.topDict;
  66179. }
  66180. throw new _util.InvalidPDFException("Invalid PDF structure.");
  66181. }
  66182. readXRef() {
  66183. let recoveryMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  66184. const stream = this.stream;
  66185. const startXRefParsedCache = new Set();
  66186. try {
  66187. while (this.startXRefQueue.length) {
  66188. const startXRef = this.startXRefQueue[0];
  66189. if (startXRefParsedCache.has(startXRef)) {
  66190. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  66191. this.startXRefQueue.shift();
  66192. continue;
  66193. }
  66194. startXRefParsedCache.add(startXRef);
  66195. stream.pos = startXRef + stream.start;
  66196. const parser = new _parser.Parser({
  66197. lexer: new _parser.Lexer(stream),
  66198. xref: this,
  66199. allowStreams: true
  66200. });
  66201. let obj = parser.getObj();
  66202. let dict;
  66203. if ((0, _primitives.isCmd)(obj, "xref")) {
  66204. dict = this.processXRefTable(parser);
  66205. if (!this.topDict) {
  66206. this.topDict = dict;
  66207. }
  66208. obj = dict.get("XRefStm");
  66209. if (Number.isInteger(obj)) {
  66210. const pos = obj;
  66211. if (!(pos in this.xrefstms)) {
  66212. this.xrefstms[pos] = 1;
  66213. this.startXRefQueue.push(pos);
  66214. }
  66215. }
  66216. } else if (Number.isInteger(obj)) {
  66217. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  66218. throw new _util.FormatError("Invalid XRef stream");
  66219. }
  66220. dict = this.processXRefStream(obj);
  66221. if (!this.topDict) {
  66222. this.topDict = dict;
  66223. }
  66224. if (!dict) {
  66225. throw new _util.FormatError("Failed to read XRef stream");
  66226. }
  66227. } else {
  66228. throw new _util.FormatError("Invalid XRef stream header");
  66229. }
  66230. obj = dict.get("Prev");
  66231. if (Number.isInteger(obj)) {
  66232. this.startXRefQueue.push(obj);
  66233. } else if (obj instanceof _primitives.Ref) {
  66234. this.startXRefQueue.push(obj.num);
  66235. }
  66236. this.startXRefQueue.shift();
  66237. }
  66238. return this.topDict;
  66239. } catch (e) {
  66240. if (e instanceof _core_utils.MissingDataException) {
  66241. throw e;
  66242. }
  66243. (0, _util.info)("(while reading XRef): " + e);
  66244. this.startXRefQueue.shift();
  66245. }
  66246. if (recoveryMode) {
  66247. return undefined;
  66248. }
  66249. throw new _core_utils.XRefParseException();
  66250. }
  66251. getEntry(i) {
  66252. const xrefEntry = this.entries[i];
  66253. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  66254. return xrefEntry;
  66255. }
  66256. return null;
  66257. }
  66258. fetchIfRef(obj) {
  66259. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66260. if (obj instanceof _primitives.Ref) {
  66261. return this.fetch(obj, suppressEncryption);
  66262. }
  66263. return obj;
  66264. }
  66265. fetch(ref) {
  66266. let suppressEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  66267. if (!(ref instanceof _primitives.Ref)) {
  66268. throw new Error("ref object is not a reference");
  66269. }
  66270. const num = ref.num;
  66271. const cacheEntry = this._cacheMap.get(num);
  66272. if (cacheEntry !== undefined) {
  66273. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  66274. cacheEntry.objId = ref.toString();
  66275. }
  66276. return cacheEntry;
  66277. }
  66278. let xrefEntry = this.getEntry(num);
  66279. if (xrefEntry === null) {
  66280. this._cacheMap.set(num, xrefEntry);
  66281. return xrefEntry;
  66282. }
  66283. if (this._pendingRefs.has(ref)) {
  66284. this._pendingRefs.remove(ref);
  66285. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  66286. return _primitives.CIRCULAR_REF;
  66287. }
  66288. this._pendingRefs.put(ref);
  66289. try {
  66290. if (xrefEntry.uncompressed) {
  66291. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  66292. } else {
  66293. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  66294. }
  66295. this._pendingRefs.remove(ref);
  66296. } catch (ex) {
  66297. this._pendingRefs.remove(ref);
  66298. throw ex;
  66299. }
  66300. if (xrefEntry instanceof _primitives.Dict) {
  66301. xrefEntry.objId = ref.toString();
  66302. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  66303. xrefEntry.dict.objId = ref.toString();
  66304. }
  66305. return xrefEntry;
  66306. }
  66307. fetchUncompressed(ref, xrefEntry) {
  66308. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66309. const gen = ref.gen;
  66310. let num = ref.num;
  66311. if (xrefEntry.gen !== gen) {
  66312. const msg = `Inconsistent generation in XRef: ${ref}`;
  66313. if (this._generationFallback && xrefEntry.gen < gen) {
  66314. (0, _util.warn)(msg);
  66315. return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  66316. }
  66317. throw new _core_utils.XRefEntryException(msg);
  66318. }
  66319. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  66320. const parser = new _parser.Parser({
  66321. lexer: new _parser.Lexer(stream),
  66322. xref: this,
  66323. allowStreams: true
  66324. });
  66325. const obj1 = parser.getObj();
  66326. const obj2 = parser.getObj();
  66327. const obj3 = parser.getObj();
  66328. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  66329. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66330. }
  66331. if (obj3.cmd !== "obj") {
  66332. if (obj3.cmd.startsWith("obj")) {
  66333. num = parseInt(obj3.cmd.substring(3), 10);
  66334. if (!Number.isNaN(num)) {
  66335. return num;
  66336. }
  66337. }
  66338. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  66339. }
  66340. if (this.encrypt && !suppressEncryption) {
  66341. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  66342. } else {
  66343. xrefEntry = parser.getObj();
  66344. }
  66345. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  66346. this._cacheMap.set(num, xrefEntry);
  66347. }
  66348. return xrefEntry;
  66349. }
  66350. fetchCompressed(ref, xrefEntry) {
  66351. let suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  66352. const tableOffset = xrefEntry.offset;
  66353. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  66354. if (!(stream instanceof _base_stream.BaseStream)) {
  66355. throw new _util.FormatError("bad ObjStm stream");
  66356. }
  66357. const first = stream.dict.get("First");
  66358. const n = stream.dict.get("N");
  66359. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  66360. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  66361. }
  66362. let parser = new _parser.Parser({
  66363. lexer: new _parser.Lexer(stream),
  66364. xref: this,
  66365. allowStreams: true
  66366. });
  66367. const nums = new Array(n);
  66368. const offsets = new Array(n);
  66369. for (let i = 0; i < n; ++i) {
  66370. const num = parser.getObj();
  66371. if (!Number.isInteger(num)) {
  66372. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  66373. }
  66374. const offset = parser.getObj();
  66375. if (!Number.isInteger(offset)) {
  66376. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  66377. }
  66378. nums[i] = num;
  66379. offsets[i] = offset;
  66380. }
  66381. const start = (stream.start || 0) + first;
  66382. const entries = new Array(n);
  66383. for (let i = 0; i < n; ++i) {
  66384. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  66385. if (length < 0) {
  66386. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  66387. }
  66388. parser = new _parser.Parser({
  66389. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  66390. xref: this,
  66391. allowStreams: true
  66392. });
  66393. const obj = parser.getObj();
  66394. entries[i] = obj;
  66395. if (obj instanceof _base_stream.BaseStream) {
  66396. continue;
  66397. }
  66398. const num = nums[i],
  66399. entry = this.entries[num];
  66400. if (entry && entry.offset === tableOffset && entry.gen === i) {
  66401. this._cacheMap.set(num, obj);
  66402. }
  66403. }
  66404. xrefEntry = entries[xrefEntry.gen];
  66405. if (xrefEntry === undefined) {
  66406. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  66407. }
  66408. return xrefEntry;
  66409. }
  66410. async fetchIfRefAsync(obj, suppressEncryption) {
  66411. if (obj instanceof _primitives.Ref) {
  66412. return this.fetchAsync(obj, suppressEncryption);
  66413. }
  66414. return obj;
  66415. }
  66416. async fetchAsync(ref, suppressEncryption) {
  66417. try {
  66418. return this.fetch(ref, suppressEncryption);
  66419. } catch (ex) {
  66420. if (!(ex instanceof _core_utils.MissingDataException)) {
  66421. throw ex;
  66422. }
  66423. await this.pdfManager.requestRange(ex.begin, ex.end);
  66424. return this.fetchAsync(ref, suppressEncryption);
  66425. }
  66426. }
  66427. getCatalogObj() {
  66428. return this.root;
  66429. }
  66430. }
  66431. exports.XRef = XRef;
  66432. /***/ }),
  66433. /* 231 */
  66434. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66435. "use strict";
  66436. Object.defineProperty(exports, "__esModule", ({
  66437. value: true
  66438. }));
  66439. exports.MessageHandler = void 0;
  66440. var _util = __w_pdfjs_require__(2);
  66441. const CallbackKind = {
  66442. UNKNOWN: 0,
  66443. DATA: 1,
  66444. ERROR: 2
  66445. };
  66446. const StreamKind = {
  66447. UNKNOWN: 0,
  66448. CANCEL: 1,
  66449. CANCEL_COMPLETE: 2,
  66450. CLOSE: 3,
  66451. ENQUEUE: 4,
  66452. ERROR: 5,
  66453. PULL: 6,
  66454. PULL_COMPLETE: 7,
  66455. START_COMPLETE: 8
  66456. };
  66457. function wrapReason(reason) {
  66458. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  66459. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  66460. }
  66461. switch (reason.name) {
  66462. case "AbortException":
  66463. return new _util.AbortException(reason.message);
  66464. case "MissingPDFException":
  66465. return new _util.MissingPDFException(reason.message);
  66466. case "PasswordException":
  66467. return new _util.PasswordException(reason.message, reason.code);
  66468. case "UnexpectedResponseException":
  66469. return new _util.UnexpectedResponseException(reason.message, reason.status);
  66470. case "UnknownErrorException":
  66471. return new _util.UnknownErrorException(reason.message, reason.details);
  66472. default:
  66473. return new _util.UnknownErrorException(reason.message, reason.toString());
  66474. }
  66475. }
  66476. class MessageHandler {
  66477. constructor(sourceName, targetName, comObj) {
  66478. this.sourceName = sourceName;
  66479. this.targetName = targetName;
  66480. this.comObj = comObj;
  66481. this.callbackId = 1;
  66482. this.streamId = 1;
  66483. this.streamSinks = Object.create(null);
  66484. this.streamControllers = Object.create(null);
  66485. this.callbackCapabilities = Object.create(null);
  66486. this.actionHandler = Object.create(null);
  66487. this._onComObjOnMessage = event => {
  66488. const data = event.data;
  66489. if (data.targetName !== this.sourceName) {
  66490. return;
  66491. }
  66492. if (data.stream) {
  66493. this._processStreamMessage(data);
  66494. return;
  66495. }
  66496. if (data.callback) {
  66497. const callbackId = data.callbackId;
  66498. const capability = this.callbackCapabilities[callbackId];
  66499. if (!capability) {
  66500. throw new Error(`Cannot resolve callback ${callbackId}`);
  66501. }
  66502. delete this.callbackCapabilities[callbackId];
  66503. if (data.callback === CallbackKind.DATA) {
  66504. capability.resolve(data.data);
  66505. } else if (data.callback === CallbackKind.ERROR) {
  66506. capability.reject(wrapReason(data.reason));
  66507. } else {
  66508. throw new Error("Unexpected callback case");
  66509. }
  66510. return;
  66511. }
  66512. const action = this.actionHandler[data.action];
  66513. if (!action) {
  66514. throw new Error(`Unknown action from worker: ${data.action}`);
  66515. }
  66516. if (data.callbackId) {
  66517. const cbSourceName = this.sourceName;
  66518. const cbTargetName = data.sourceName;
  66519. new Promise(function (resolve) {
  66520. resolve(action(data.data));
  66521. }).then(function (result) {
  66522. comObj.postMessage({
  66523. sourceName: cbSourceName,
  66524. targetName: cbTargetName,
  66525. callback: CallbackKind.DATA,
  66526. callbackId: data.callbackId,
  66527. data: result
  66528. });
  66529. }, function (reason) {
  66530. comObj.postMessage({
  66531. sourceName: cbSourceName,
  66532. targetName: cbTargetName,
  66533. callback: CallbackKind.ERROR,
  66534. callbackId: data.callbackId,
  66535. reason: wrapReason(reason)
  66536. });
  66537. });
  66538. return;
  66539. }
  66540. if (data.streamId) {
  66541. this._createStreamSink(data);
  66542. return;
  66543. }
  66544. action(data.data);
  66545. };
  66546. comObj.addEventListener("message", this._onComObjOnMessage);
  66547. }
  66548. on(actionName, handler) {
  66549. const ah = this.actionHandler;
  66550. if (ah[actionName]) {
  66551. throw new Error(`There is already an actionName called "${actionName}"`);
  66552. }
  66553. ah[actionName] = handler;
  66554. }
  66555. send(actionName, data, transfers) {
  66556. this.comObj.postMessage({
  66557. sourceName: this.sourceName,
  66558. targetName: this.targetName,
  66559. action: actionName,
  66560. data
  66561. }, transfers);
  66562. }
  66563. sendWithPromise(actionName, data, transfers) {
  66564. const callbackId = this.callbackId++;
  66565. const capability = (0, _util.createPromiseCapability)();
  66566. this.callbackCapabilities[callbackId] = capability;
  66567. try {
  66568. this.comObj.postMessage({
  66569. sourceName: this.sourceName,
  66570. targetName: this.targetName,
  66571. action: actionName,
  66572. callbackId,
  66573. data
  66574. }, transfers);
  66575. } catch (ex) {
  66576. capability.reject(ex);
  66577. }
  66578. return capability.promise;
  66579. }
  66580. sendWithStream(actionName, data, queueingStrategy, transfers) {
  66581. const streamId = this.streamId++,
  66582. sourceName = this.sourceName,
  66583. targetName = this.targetName,
  66584. comObj = this.comObj;
  66585. return new ReadableStream({
  66586. start: controller => {
  66587. const startCapability = (0, _util.createPromiseCapability)();
  66588. this.streamControllers[streamId] = {
  66589. controller,
  66590. startCall: startCapability,
  66591. pullCall: null,
  66592. cancelCall: null,
  66593. isClosed: false
  66594. };
  66595. comObj.postMessage({
  66596. sourceName,
  66597. targetName,
  66598. action: actionName,
  66599. streamId,
  66600. data,
  66601. desiredSize: controller.desiredSize
  66602. }, transfers);
  66603. return startCapability.promise;
  66604. },
  66605. pull: controller => {
  66606. const pullCapability = (0, _util.createPromiseCapability)();
  66607. this.streamControllers[streamId].pullCall = pullCapability;
  66608. comObj.postMessage({
  66609. sourceName,
  66610. targetName,
  66611. stream: StreamKind.PULL,
  66612. streamId,
  66613. desiredSize: controller.desiredSize
  66614. });
  66615. return pullCapability.promise;
  66616. },
  66617. cancel: reason => {
  66618. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  66619. const cancelCapability = (0, _util.createPromiseCapability)();
  66620. this.streamControllers[streamId].cancelCall = cancelCapability;
  66621. this.streamControllers[streamId].isClosed = true;
  66622. comObj.postMessage({
  66623. sourceName,
  66624. targetName,
  66625. stream: StreamKind.CANCEL,
  66626. streamId,
  66627. reason: wrapReason(reason)
  66628. });
  66629. return cancelCapability.promise;
  66630. }
  66631. }, queueingStrategy);
  66632. }
  66633. _createStreamSink(data) {
  66634. const streamId = data.streamId,
  66635. sourceName = this.sourceName,
  66636. targetName = data.sourceName,
  66637. comObj = this.comObj;
  66638. const self = this,
  66639. action = this.actionHandler[data.action];
  66640. const streamSink = {
  66641. enqueue(chunk) {
  66642. let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  66643. let transfers = arguments.length > 2 ? arguments[2] : undefined;
  66644. if (this.isCancelled) {
  66645. return;
  66646. }
  66647. const lastDesiredSize = this.desiredSize;
  66648. this.desiredSize -= size;
  66649. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  66650. this.sinkCapability = (0, _util.createPromiseCapability)();
  66651. this.ready = this.sinkCapability.promise;
  66652. }
  66653. comObj.postMessage({
  66654. sourceName,
  66655. targetName,
  66656. stream: StreamKind.ENQUEUE,
  66657. streamId,
  66658. chunk
  66659. }, transfers);
  66660. },
  66661. close() {
  66662. if (this.isCancelled) {
  66663. return;
  66664. }
  66665. this.isCancelled = true;
  66666. comObj.postMessage({
  66667. sourceName,
  66668. targetName,
  66669. stream: StreamKind.CLOSE,
  66670. streamId
  66671. });
  66672. delete self.streamSinks[streamId];
  66673. },
  66674. error(reason) {
  66675. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  66676. if (this.isCancelled) {
  66677. return;
  66678. }
  66679. this.isCancelled = true;
  66680. comObj.postMessage({
  66681. sourceName,
  66682. targetName,
  66683. stream: StreamKind.ERROR,
  66684. streamId,
  66685. reason: wrapReason(reason)
  66686. });
  66687. },
  66688. sinkCapability: (0, _util.createPromiseCapability)(),
  66689. onPull: null,
  66690. onCancel: null,
  66691. isCancelled: false,
  66692. desiredSize: data.desiredSize,
  66693. ready: null
  66694. };
  66695. streamSink.sinkCapability.resolve();
  66696. streamSink.ready = streamSink.sinkCapability.promise;
  66697. this.streamSinks[streamId] = streamSink;
  66698. new Promise(function (resolve) {
  66699. resolve(action(data.data, streamSink));
  66700. }).then(function () {
  66701. comObj.postMessage({
  66702. sourceName,
  66703. targetName,
  66704. stream: StreamKind.START_COMPLETE,
  66705. streamId,
  66706. success: true
  66707. });
  66708. }, function (reason) {
  66709. comObj.postMessage({
  66710. sourceName,
  66711. targetName,
  66712. stream: StreamKind.START_COMPLETE,
  66713. streamId,
  66714. reason: wrapReason(reason)
  66715. });
  66716. });
  66717. }
  66718. _processStreamMessage(data) {
  66719. const streamId = data.streamId,
  66720. sourceName = this.sourceName,
  66721. targetName = data.sourceName,
  66722. comObj = this.comObj;
  66723. const streamController = this.streamControllers[streamId],
  66724. streamSink = this.streamSinks[streamId];
  66725. switch (data.stream) {
  66726. case StreamKind.START_COMPLETE:
  66727. if (data.success) {
  66728. streamController.startCall.resolve();
  66729. } else {
  66730. streamController.startCall.reject(wrapReason(data.reason));
  66731. }
  66732. break;
  66733. case StreamKind.PULL_COMPLETE:
  66734. if (data.success) {
  66735. streamController.pullCall.resolve();
  66736. } else {
  66737. streamController.pullCall.reject(wrapReason(data.reason));
  66738. }
  66739. break;
  66740. case StreamKind.PULL:
  66741. if (!streamSink) {
  66742. comObj.postMessage({
  66743. sourceName,
  66744. targetName,
  66745. stream: StreamKind.PULL_COMPLETE,
  66746. streamId,
  66747. success: true
  66748. });
  66749. break;
  66750. }
  66751. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  66752. streamSink.sinkCapability.resolve();
  66753. }
  66754. streamSink.desiredSize = data.desiredSize;
  66755. new Promise(function (resolve) {
  66756. resolve(streamSink.onPull && streamSink.onPull());
  66757. }).then(function () {
  66758. comObj.postMessage({
  66759. sourceName,
  66760. targetName,
  66761. stream: StreamKind.PULL_COMPLETE,
  66762. streamId,
  66763. success: true
  66764. });
  66765. }, function (reason) {
  66766. comObj.postMessage({
  66767. sourceName,
  66768. targetName,
  66769. stream: StreamKind.PULL_COMPLETE,
  66770. streamId,
  66771. reason: wrapReason(reason)
  66772. });
  66773. });
  66774. break;
  66775. case StreamKind.ENQUEUE:
  66776. (0, _util.assert)(streamController, "enqueue should have stream controller");
  66777. if (streamController.isClosed) {
  66778. break;
  66779. }
  66780. streamController.controller.enqueue(data.chunk);
  66781. break;
  66782. case StreamKind.CLOSE:
  66783. (0, _util.assert)(streamController, "close should have stream controller");
  66784. if (streamController.isClosed) {
  66785. break;
  66786. }
  66787. streamController.isClosed = true;
  66788. streamController.controller.close();
  66789. this._deleteStreamController(streamController, streamId);
  66790. break;
  66791. case StreamKind.ERROR:
  66792. (0, _util.assert)(streamController, "error should have stream controller");
  66793. streamController.controller.error(wrapReason(data.reason));
  66794. this._deleteStreamController(streamController, streamId);
  66795. break;
  66796. case StreamKind.CANCEL_COMPLETE:
  66797. if (data.success) {
  66798. streamController.cancelCall.resolve();
  66799. } else {
  66800. streamController.cancelCall.reject(wrapReason(data.reason));
  66801. }
  66802. this._deleteStreamController(streamController, streamId);
  66803. break;
  66804. case StreamKind.CANCEL:
  66805. if (!streamSink) {
  66806. break;
  66807. }
  66808. new Promise(function (resolve) {
  66809. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  66810. }).then(function () {
  66811. comObj.postMessage({
  66812. sourceName,
  66813. targetName,
  66814. stream: StreamKind.CANCEL_COMPLETE,
  66815. streamId,
  66816. success: true
  66817. });
  66818. }, function (reason) {
  66819. comObj.postMessage({
  66820. sourceName,
  66821. targetName,
  66822. stream: StreamKind.CANCEL_COMPLETE,
  66823. streamId,
  66824. reason: wrapReason(reason)
  66825. });
  66826. });
  66827. streamSink.sinkCapability.reject(wrapReason(data.reason));
  66828. streamSink.isCancelled = true;
  66829. delete this.streamSinks[streamId];
  66830. break;
  66831. default:
  66832. throw new Error("Unexpected stream case");
  66833. }
  66834. }
  66835. async _deleteStreamController(streamController, streamId) {
  66836. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  66837. delete this.streamControllers[streamId];
  66838. }
  66839. destroy() {
  66840. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  66841. }
  66842. }
  66843. exports.MessageHandler = MessageHandler;
  66844. /***/ }),
  66845. /* 232 */
  66846. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  66847. "use strict";
  66848. Object.defineProperty(exports, "__esModule", ({
  66849. value: true
  66850. }));
  66851. exports.PDFWorkerStream = void 0;
  66852. var _util = __w_pdfjs_require__(2);
  66853. class PDFWorkerStream {
  66854. constructor(msgHandler) {
  66855. this._msgHandler = msgHandler;
  66856. this._contentLength = null;
  66857. this._fullRequestReader = null;
  66858. this._rangeRequestReaders = [];
  66859. }
  66860. getFullReader() {
  66861. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  66862. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  66863. return this._fullRequestReader;
  66864. }
  66865. getRangeReader(begin, end) {
  66866. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  66867. this._rangeRequestReaders.push(reader);
  66868. return reader;
  66869. }
  66870. cancelAllRequests(reason) {
  66871. if (this._fullRequestReader) {
  66872. this._fullRequestReader.cancel(reason);
  66873. }
  66874. for (const reader of this._rangeRequestReaders.slice(0)) {
  66875. reader.cancel(reason);
  66876. }
  66877. }
  66878. }
  66879. exports.PDFWorkerStream = PDFWorkerStream;
  66880. class PDFWorkerStreamReader {
  66881. constructor(msgHandler) {
  66882. this._msgHandler = msgHandler;
  66883. this.onProgress = null;
  66884. this._contentLength = null;
  66885. this._isRangeSupported = false;
  66886. this._isStreamingSupported = false;
  66887. const readableStream = this._msgHandler.sendWithStream("GetReader");
  66888. this._reader = readableStream.getReader();
  66889. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  66890. this._isStreamingSupported = data.isStreamingSupported;
  66891. this._isRangeSupported = data.isRangeSupported;
  66892. this._contentLength = data.contentLength;
  66893. });
  66894. }
  66895. get headersReady() {
  66896. return this._headersReady;
  66897. }
  66898. get contentLength() {
  66899. return this._contentLength;
  66900. }
  66901. get isStreamingSupported() {
  66902. return this._isStreamingSupported;
  66903. }
  66904. get isRangeSupported() {
  66905. return this._isRangeSupported;
  66906. }
  66907. async read() {
  66908. const {
  66909. value,
  66910. done
  66911. } = await this._reader.read();
  66912. if (done) {
  66913. return {
  66914. value: undefined,
  66915. done: true
  66916. };
  66917. }
  66918. return {
  66919. value: value.buffer,
  66920. done: false
  66921. };
  66922. }
  66923. cancel(reason) {
  66924. this._reader.cancel(reason);
  66925. }
  66926. }
  66927. class PDFWorkerStreamRangeReader {
  66928. constructor(begin, end, msgHandler) {
  66929. this._msgHandler = msgHandler;
  66930. this.onProgress = null;
  66931. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  66932. begin,
  66933. end
  66934. });
  66935. this._reader = readableStream.getReader();
  66936. }
  66937. get isStreamingSupported() {
  66938. return false;
  66939. }
  66940. async read() {
  66941. const {
  66942. value,
  66943. done
  66944. } = await this._reader.read();
  66945. if (done) {
  66946. return {
  66947. value: undefined,
  66948. done: true
  66949. };
  66950. }
  66951. return {
  66952. value: value.buffer,
  66953. done: false
  66954. };
  66955. }
  66956. cancel(reason) {
  66957. this._reader.cancel(reason);
  66958. }
  66959. }
  66960. /***/ })
  66961. /******/ ]);
  66962. /************************************************************************/
  66963. /******/ // The module cache
  66964. /******/ var __webpack_module_cache__ = {};
  66965. /******/
  66966. /******/ // The require function
  66967. /******/ function __w_pdfjs_require__(moduleId) {
  66968. /******/ // Check if module is in cache
  66969. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  66970. /******/ if (cachedModule !== undefined) {
  66971. /******/ return cachedModule.exports;
  66972. /******/ }
  66973. /******/ // Create a new module (and put it into the cache)
  66974. /******/ var module = __webpack_module_cache__[moduleId] = {
  66975. /******/ // no module.id needed
  66976. /******/ // no module.loaded needed
  66977. /******/ exports: {}
  66978. /******/ };
  66979. /******/
  66980. /******/ // Execute the module function
  66981. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  66982. /******/
  66983. /******/ // Return the exports of the module
  66984. /******/ return module.exports;
  66985. /******/ }
  66986. /******/
  66987. /************************************************************************/
  66988. /******/ /* webpack/runtime/define property getters */
  66989. /******/ (() => {
  66990. /******/ // define getter functions for harmony exports
  66991. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  66992. /******/ for(var key in definition) {
  66993. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  66994. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  66995. /******/ }
  66996. /******/ }
  66997. /******/ };
  66998. /******/ })();
  66999. /******/
  67000. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  67001. /******/ (() => {
  67002. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  67003. /******/ })();
  67004. /******/
  67005. /******/ /* webpack/runtime/make namespace object */
  67006. /******/ (() => {
  67007. /******/ // define __esModule on exports
  67008. /******/ __w_pdfjs_require__.r = (exports) => {
  67009. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  67010. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  67011. /******/ }
  67012. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  67013. /******/ };
  67014. /******/ })();
  67015. /******/
  67016. /************************************************************************/
  67017. var __webpack_exports__ = {};
  67018. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  67019. (() => {
  67020. "use strict";
  67021. var exports = __webpack_exports__;
  67022. Object.defineProperty(exports, "__esModule", ({
  67023. value: true
  67024. }));
  67025. Object.defineProperty(exports, "WorkerMessageHandler", ({
  67026. enumerable: true,
  67027. get: function () {
  67028. return _worker.WorkerMessageHandler;
  67029. }
  67030. }));
  67031. var _worker = __w_pdfjs_require__(1);
  67032. const pdfjsVersion = '3.0.279';
  67033. const pdfjsBuild = 'd0823066c';
  67034. })();
  67035. /******/ return __webpack_exports__;
  67036. /******/ })()
  67037. ;
  67038. });
  67039. //# sourceMappingURL=pdf.worker.js.map